detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <div class="BidSystemProductDeOrderEdit">
  3. <Toptitle title="拆单页">
  4. <slot name="titleButton">
  5. <Button
  6. @click="showSupModal = true"
  7. type="primary"
  8. style="margin-right:10px;"
  9. >项目辅料</Button
  10. >
  11. <Button
  12. @click="goback()"
  13. type="primary"
  14. ghost
  15. style="margin-right:10px;"
  16. >返回</Button
  17. >
  18. <!-- <Button
  19. @click="postData()"
  20. type="primary"
  21. ghost
  22. style="margin-right:10px;"
  23. >保存</Button
  24. > -->
  25. </slot>
  26. </Toptitle>
  27. <div class="top_search_info">
  28. <Form inline :label-width="100">
  29. <FormItem label="产品名称:">
  30. <Input
  31. type="text"
  32. size="small"
  33. clearable
  34. v-model="searchData.title"
  35. placeholder="请输入产品名称"
  36. />
  37. </FormItem>
  38. <FormItem label="图号:">
  39. <Input
  40. type="text"
  41. size="small"
  42. clearable
  43. v-model="searchData.url_number"
  44. style="width: 150px"
  45. placeholder="请输入图号"
  46. />
  47. </FormItem>
  48. <FormItem label="拆单状态:">
  49. <Select
  50. v-model="searchData.state"
  51. size="small"
  52. clearable
  53. filterable
  54. style="width: 150px"
  55. >
  56. <Option label="未完成" :value="0"> </Option>
  57. <Option label="拆单中" :value="1"> </Option>
  58. <Option label="已完成" :value="2"> </Option>
  59. </Select>
  60. </FormItem>
  61. <FormItem>
  62. <Button
  63. size="small"
  64. type="primary"
  65. @click="
  66. initData(
  67. formData.order_no,
  68. formData.orders_area_product_detail_id
  69. )
  70. "
  71. >搜索</Button
  72. >
  73. </FormItem>
  74. </Form>
  75. </div>
  76. <div class="top_search">
  77. <div><span>订单号:</span>{{ formData.order_no }}</div>
  78. <div><span>小区名称:</span>{{ formData.residential_name }}</div>
  79. <div><span>客户姓名:</span>{{ formData.client_name }}</div>
  80. <div>
  81. <span>紧急程度:</span
  82. ><span
  83. v-for="_item in warningList"
  84. :key="_item.id"
  85. v-show="_item.id == formData.warning_state"
  86. >{{ _item.title }}</span
  87. >
  88. </div>
  89. <div>
  90. <span>收款:</span>{{ formData.pay_state == 1 ? "已收款" : "未收款" }}
  91. </div>
  92. <div><span>详细地址:</span>{{ formData.address }}</div>
  93. <div><span>手机号:</span>{{ formData.mobile }}</div>
  94. <div>
  95. <span>开始日期:</span>{{ func.replaceDate(formData.start_time) }}
  96. </div>
  97. <div><span>交付日期:</span>{{ func.replaceDate(formData.end_time) }}</div>
  98. <div>
  99. <span>业务员:</span>
  100. <span
  101. v-for="item in salesmanList"
  102. :key="item.id"
  103. v-show="formData.salesman == item.id"
  104. >{{ formData.salesman }}</span
  105. >
  106. </div>
  107. <!-- <div><span>订单类型:</span>{{formData.renovation_type==1?"工装":"家装"}}</div> -->
  108. <div><span>备注:</span>{{ formData.remark }}</div>
  109. </div>
  110. <div class="addArea">
  111. <div class="addAreaTable">
  112. <Table :columns="tableColumns" :data="formData.detail" border>
  113. <template slot="set" slot-scope="{ row, index }">
  114. <a
  115. :disabled="row.status != 0"
  116. style="margin:0 5px"
  117. @click="handleSet(row, index, 1)"
  118. >拆单</a
  119. >
  120. <a style="margin:0 5px" @click="handleSet(row, index, 2)">详情</a>
  121. </template>
  122. </Table>
  123. </div>
  124. </div>
  125. <!-- 项目辅料弹窗 -->
  126. <Modal title="项目辅料" v-model="showSupModal" :width="400">
  127. <div>
  128. <div class="supModalBtn">
  129. <!-- <Button @click="handleAddSup" type="primary">新增</Button> -->
  130. </div>
  131. <Table :columns="supTableColumns" :data="supTableData" border>
  132. <template slot="combine" slot-scope="{ index }">
  133. <Select
  134. v-model="supTableData[index].id"
  135. @on-change="handlechange"
  136. size="small"
  137. >
  138. <Option
  139. v-for="item in combineList"
  140. :value="item.id"
  141. :key="item.id"
  142. :label="item.title"
  143. ></Option>
  144. </Select>
  145. </template>
  146. <template slot="supSet" slot-scope="{ row , index}">
  147. <!-- <a
  148. style="margin: 0 5px; color: red"
  149. v-show="$route.query.type != 3"
  150. @click="handleSupSet(row, index)"
  151. >删除</a
  152. > -->
  153. </template>
  154. </Table>
  155. </div>
  156. <div class="modal-footer" slot="footer">
  157. <Button @click="showSupModal = false">取消</Button>
  158. <Button type="primary" @click="showSupModal = false">确认</Button>
  159. </div>
  160. </Modal>
  161. </div>
  162. </template>
  163. <script>
  164. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  165. // 例如:import 《组件名称》 from '《组件路径》';
  166. export default {
  167. name: "BidSystemProductDeOrderEdit",
  168. components: {},
  169. props: {},
  170. // import引入的组件需要注入到对象中才能使用
  171. data() {
  172. // 这里存放数据
  173. return {
  174. showSupModal: false,
  175. showPDTModal: false,
  176. formData: {
  177. order_no: "",
  178. orders_area_product_detail_id: "",
  179. residential_name: "",
  180. client_name: "",
  181. address: "",
  182. mobile: "",
  183. pay_state: "",
  184. warning_state: "",
  185. salesman: "",
  186. remark: "",
  187. //区域列表
  188. area: [
  189. {
  190. num: "",
  191. title: "",
  192. unit: "",
  193. quantity: "",
  194. house_type: "",
  195. remark: "",
  196. order_no: "",
  197. product: [
  198. // {
  199. // title:'',
  200. // num:'',
  201. // measure:'',
  202. // process_property:'',
  203. // url:'',
  204. // url_number:'',
  205. // remark:''
  206. // }
  207. ],
  208. },
  209. ],
  210. },
  211. product: [{}],
  212. searchData: {},
  213. tableColumns: [
  214. {
  215. title: "序号",
  216. type: "index",
  217. align: "center",
  218. minWidth: 80,
  219. resizable: true,
  220. },
  221. {
  222. title: "产品名称",
  223. key: "title",
  224. align: "center",
  225. minWidth: 120,
  226. resizable: true,
  227. },
  228. {
  229. title: "计量单位",
  230. key: "unit",
  231. align: "center",
  232. minWidth: 100,
  233. resizable: true,
  234. },
  235. {
  236. title: "图号",
  237. key: "url_number",
  238. align: "center",
  239. minWidth: 80,
  240. resizable: true,
  241. },
  242. {
  243. title: "数量",
  244. key: "num",
  245. align: "center",
  246. minWidth: 80,
  247. resizable: true,
  248. },
  249. {
  250. title: "规格",
  251. key: "measure",
  252. align: "center",
  253. minWidth: 140,
  254. resizable: true,
  255. },
  256. {
  257. title: "工艺属性",
  258. key: "process_property",
  259. align: "center",
  260. minWidth: 140,
  261. resizable: true,
  262. tooltip: true,
  263. },
  264. {
  265. title: "图纸",
  266. key: "url",
  267. align: "center",
  268. resizable: true,
  269. minWidth: 80,
  270. render: (h, params) => {
  271. const { row } = params;
  272. return h(
  273. "div",
  274. row.url.map((item, index) => {
  275. return h("img", {
  276. attrs: {
  277. src: this.$store.state.ip + item,
  278. style:
  279. "max-width:50px;max-height:50px;position:relative;top:3px;",
  280. },
  281. on: {
  282. click: (e) => {
  283. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  284. // if (res.code == 200) {
  285. // row.imgs = res.data
  286. let list = [];
  287. row.url.forEach((el) => {
  288. list.push({ img_url: el });
  289. });
  290. this.$previewImg({
  291. list,
  292. baseUrl: this.$store.state.ip,
  293. baseImgField: "img_url",
  294. baseTitleField: "",
  295. });
  296. // }
  297. // })
  298. },
  299. },
  300. });
  301. })
  302. );
  303. },
  304. },
  305. {
  306. title: "左右式",
  307. key: "left_right_mode",
  308. align: "center",
  309. resizable: true,
  310. minWidth: 80,
  311. render: (h, params) => {
  312. const { row } = params;
  313. return h("span", {}, row.left_right_mode == 1 ? "左式" : "右式");
  314. },
  315. },
  316. {
  317. title: "拆单状态",
  318. key: "status",
  319. align: "center",
  320. resizable: true,
  321. minWidth: 80,
  322. render: (h, params) => {
  323. const { row } = params;
  324. return h("span", {}, row.status == 0 ? "未完成" : "已完成");
  325. },
  326. },
  327. {
  328. title: "操作",
  329. key: "name",
  330. align: "center",
  331. width: "120",
  332. slot: "set",
  333. minWidth: 80,
  334. fixed: "right",
  335. resizable: true,
  336. },
  337. ],
  338. //产品分类列表
  339. PDTTypeList: [],
  340. //业务员列表
  341. salesmanList: [],
  342. warningList: [],
  343. supTableColumns: [
  344. { title: "序号", type: "index", align: "center", minWidth: 100 },
  345. {
  346. title: "辅料名称",
  347. key: "title",
  348. align: "center",
  349. slot: "combine",
  350. minWidth: 150,
  351. },
  352. { title: "操作", align: "center", slot: "supSet", minWidth: 100 },
  353. ],
  354. supTableData: [], //项目辅料→辅料名称列表
  355. combineList: [], //项目辅料列表
  356. };
  357. },
  358. // 生命周期 - 创建完成(可以访问当前this实例)
  359. created() {
  360. // 获取项目辅料列表
  361. this.axios("/api/material_combination").then((res) => {
  362. this.combineList = res.data.data;
  363. });
  364. // 2编辑 3详情 4变更 5变更记录
  365. this.$route.query.type == 3 ? (this.isChecked = true) : "";
  366. this.$route.query.order_no
  367. ? (this.formData.order_no = this.$route.query.order_no)
  368. : "";
  369. this.$route.query.orders_area_product_detail_id
  370. ? (this.formData.orders_area_product_detail_id = this.$route.query.orders_area_product_detail_id)
  371. : "";
  372. // 获取紧急程度
  373. this.axios.get("/api/warning_list").then((res) => {
  374. this.warningList = res.data.data;
  375. });
  376. // 获取项目辅料
  377. // this.axios
  378. // .get("/api/todo", { params: { order_no: this.formData.order_no } })
  379. // .then((res) => {
  380. // this.supTableData = res.data
  381. // });
  382. },
  383. // 生命周期 - 挂载完成(可以访问DOM元素)
  384. mounted() {
  385. this.axios("/api/user").then((res) => (this.salesmanList = res.data.data));
  386. this.axios("/api/parts_product_list").then((res) => {
  387. this.PDTTypeList = res.data;
  388. });
  389. this.initData(
  390. this.formData.order_no,
  391. this.formData.orders_area_product_detail_id
  392. );
  393. },
  394. methods: {
  395. //项目辅料新增
  396. handleAddSup() {
  397. this.supTableData.push({ id: "" });
  398. },
  399. //项目辅料删除
  400. handleSupSet(row, index) {
  401. this.supTableData.splice(index, 1);
  402. },
  403. handlechange(val) {
  404. console.log("val :>> ", val);
  405. },
  406. initData(order_no, orders_area_product_detail_id) {
  407. this.axios({
  408. method: "get",
  409. url: "/api/order_area_explode",
  410. params: {
  411. order_no,
  412. ...this.searchData,
  413. },
  414. }).then((res) => {
  415. this.formData = res.data;
  416. // this.formData.list.forEach((element) => {
  417. // element.product.forEach((el, index) => {
  418. // el.index = index + 1;
  419. // });
  420. // });
  421. });
  422. },
  423. // 1拆单 2详情
  424. handleSet(row, index, type) {
  425. this.$router.push({
  426. path: "/cms/BidSystem/ProductDeOrder/deorderdetail",
  427. query: {
  428. type,
  429. order_no: this.$route.query.order_no,
  430. orders_area_product_detail_id: row.id,
  431. },
  432. });
  433. },
  434. postData() {
  435. this.axios({
  436. method: "post",
  437. url: "/api/order_area_add",
  438. data: {
  439. ...this.formData,
  440. },
  441. }).then((res) => {
  442. this.$Message.success(res.msg);
  443. });
  444. },
  445. goback() {
  446. this.$router.go(-1);
  447. },
  448. },
  449. // 监听属性 类似于data概念
  450. computed: {},
  451. // 监控data中的数据变化
  452. watch: {},
  453. beforeCreate() {}, // 生命周期 - 创建之前
  454. beforeMount() {}, // 生命周期 - 挂载之前
  455. beforeUpdate() {}, // 生命周期 - 更新之前
  456. updated() {}, // 生命周期 - 更新之后
  457. beforeDestroy() {}, // 生命周期 - 销毁之前
  458. destroyed() {}, // 生命周期 - 销毁完成
  459. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  460. };
  461. </script>
  462. <style lang="scss" scoped>
  463. .BidSystemProductDeOrderEdit {
  464. overflow: hidden;
  465. overflow-y: auto;
  466. .top_search {
  467. display: flex;
  468. justify-content: flex-start;
  469. align-items: center;
  470. flex-wrap: wrap;
  471. width: 100%;
  472. padding: 10px 0;
  473. font-size: 14px;
  474. div {
  475. width: 200px;
  476. padding: 5px;
  477. }
  478. }
  479. .addArea {
  480. .addAreaTable {
  481. padding: 20px 0;
  482. }
  483. position: relative;
  484. padding: 15px;
  485. margin-bottom: 30px;
  486. border-radius: 5px;
  487. box-shadow: 1px 1px 5px 1px #999;
  488. .addAreaBtn {
  489. position: absolute;
  490. right: 20px;
  491. top: 20px;
  492. }
  493. /deep/ .ivu-form-item {
  494. display: inline-block;
  495. width: 220px;
  496. }
  497. }
  498. }
  499. .supModalBtn {
  500. display: flex;
  501. justify-content: flex-end;
  502. margin-bottom: 10px;
  503. }
  504. </style>