浏览代码

Merge branch 'master' of 121.41.102.225:Nidong/jiufang into hw

mushencc 3 年之前
父节点
当前提交
09c4d44095
共有 1 个文件被更改,包括 88 次插入58 次删除
  1. 88 58
      src/views/OrderMannage/BusinessOrderlist/edit.vue

+ 88 - 58
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -11,14 +11,14 @@
         style="margin-right: 10px"
         >打印</Button
       >
-       <Button
+      <Button
         @click="quoteRoughDraft"
         type="primary"
         v-show="type == 1"
         style="margin-right: 10px"
         >引用草稿</Button
       >
-       <Button
+      <Button
         @click="saveRoughDraft"
         type="primary"
         v-show="type == 1"
@@ -778,7 +778,12 @@
                   <div
                     v-for="(sub_part_detail, idx) in part_detail.sub_part"
                     :key="idx + '999'"
-                    v-show="sub_part_detail.title.indexOf('线条') > 0"
+                    v-show="
+                      (
+                        sub_part_detail.title ||
+                        sub_part_detail.material_detail_title
+                      ).indexOf('线条') > 0
+                    "
                     :style="
                       idx != part_detail.sub_part.length - 1
                         ? {
@@ -788,7 +793,10 @@
                         : { padding: '10px 0' }
                     "
                   >
-                    {{ sub_part_detail.title }}
+                    {{
+                      sub_part_detail.title ||
+                        sub_part_detail.material_detail_title
+                    }}
                   </div>
                 </div>
               </div>
@@ -805,7 +813,10 @@
                   <div
                     v-for="(sub_part_detail, idx) in part_detail.part_detail"
                     :key="idx + 'part_detail'"
-                    v-show="sub_part_detail.title.indexOf('线条') > 0"
+                    v-show="
+                      sub_part_detail.title &&
+                        sub_part_detail.title.indexOf('线条') > 0
+                    "
                     :style="
                       idx != part_detail.part_detail.length - 1
                         ? {
@@ -836,7 +847,10 @@
                   <div
                     v-for="(sub_part_detail, idx) in part_detail.part_detail"
                     :key="idx + 'part_detail'"
-                    v-show="sub_part_detail.title.indexOf('线条') > 0"
+                    v-show="
+                      sub_part_detail.title &&
+                        sub_part_detail.title.indexOf('线条') > 0
+                    "
                     :style="
                       idx != part_detail.part_detail.length - 1
                         ? {
@@ -877,7 +891,10 @@
                   <div
                     v-for="(sub_part_detail, idx) in part_detail.part_detail"
                     :key="idx + 'part_detail'"
-                    v-show="sub_part_detail.title.indexOf('线条') > 0"
+                    v-show="
+                      sub_part_detail.title &&
+                        sub_part_detail.title.indexOf('线条') > 0
+                    "
                     :style="
                       idx != part_detail.part_detail.length - 1
                         ? {
@@ -902,7 +919,10 @@
                   <div
                     v-for="(sub_part_detail, idx) in part_detail.part_detail"
                     :key="idx + 'part_detail'"
-                    v-show="sub_part_detail.title.indexOf('线条') > 0"
+                    v-show="
+                      sub_part_detail.title &&
+                        sub_part_detail.title.indexOf('线条') > 0
+                    "
                     :style="
                       idx != part_detail.part_detail.length - 1
                         ? {
@@ -1255,7 +1275,7 @@
       <div label="线条:" style="margin-left:20px;width:95%">
         <div style="font-size:20px">
           <span>线条:</span>
-          <span>{{print_line_data===''?'无':print_line_data}}</span>
+          <span>{{ print_line_data === "" ? "无" : print_line_data }}</span>
           <!-- <span v-if="wood_title_count.length < 1">无</span>
           <span
             v-else
@@ -1278,7 +1298,7 @@
             v-else
             v-for="(item, index) in parts_title_count"
             :key="item.title + '' + index"
-            v-show="item.title.indexOf('线条') == -1"
+            v-show="item.title && item.title.indexOf('线条') == -1"
             >{{ item.title }}:{{ item.num }}{{ item.unit }}
             <span v-show="index < parts_title_count.length - 1">;</span>
           </span>
@@ -1484,6 +1504,7 @@
                       size="small"
                       :disabled="isCheck"
                       v-model="modalData.unit_price"
+                      @on-focus="handleUnitPriceFocus"
                       @on-change="
                         (e) => handleProductUnit_priceChange(e, modalData)
                       "
@@ -1495,6 +1516,7 @@
                     <Input
                       size="small"
                       :disabled="isCheck"
+                      @on-focus="handleExtPriceFocus"
                       v-model="modalData.ext_price"
                       @on-change="
                         (e) => handleProductExt_priceChange(e, modalData)
@@ -1507,6 +1529,7 @@
                     <Input
                       :disabled="isCheck"
                       size="small"
+                      @on-focus="handleOverPriceFocus"
                       @on-change="
                         (e) => handleProductOver_priceChange(e, modalData)
                       "
@@ -1519,7 +1542,7 @@
                     <Input
                       :disabled="isCheck"
                       size="small"
-                      @on-focus="handlePriceFocus(modalData.price)"
+                      @on-focus="handlePriceFocus"
                       v-model="modalData.price"
                       style="width: 120px"
                       placeholder="自动带出"
@@ -2426,7 +2449,7 @@ export default {
       timeout: null,
       copiedLinePart: {},
       mentoubanList: [],
-      print_line_data:'',
+      print_line_data: "",
     };
   },
   computed: {
@@ -2439,12 +2462,11 @@ export default {
   created() {
     //获取部件分类
     this.axios.get("/api/basics_parts_index").then((res) => {
-      res.data.data.map((v, k) => {
-        if (v.title == "门头板") {
-          // this.mentoubanList = res.data.data.splice(k, 1)[0];
-        }
-      });
-      console.log(`this.mentoubanList`, this.mentoubanList);
+      // res.data.data.map((v, k) => {
+      //   if (v.title == "门头板") {
+      //     // this.mentoubanList = res.data.data.splice(k, 1)[0];
+      //   }
+      // });
       this.part_type_total = res.data.data;
     });
     // 获取测量字段
@@ -2534,8 +2556,8 @@ export default {
       this.initData(this.order_no);
     }
     this.getProducts();
-    if(this.$route.query.type != 1){
-       this.print_line();
+    if (this.$route.query.type != 1) {
+      this.print_line();
     }
     addEventListener("resize", (e) => {
       this.tableWidth = e.target.innerWidth - 300;
@@ -2543,18 +2565,20 @@ export default {
     });
   },
   methods: {
-    quoteRoughDraft(){
-          this.axios
-        .post("/api/update/get_table", { id: "businessorderlist_detail_roughDraft" })
-        .then((res) => {
-           this.post_formSetTableData = res.data.table.post_formSetTableData;
-           this.info = res.data.table.info;
-           this.formSetTableData = res.data.table.formSetTableData;
-           this.handleClientChargeChange(res.data.table.info.custom_detail_name);
-           this.tableData = res.data.table.tableData;
+    quoteRoughDraft() {
+      this.axios
+        .post("/api/update/get_table", {
+          id: "businessorderlist_detail_roughDraft",
         })
+        .then((res) => {
+          this.post_formSetTableData = res.data.table.post_formSetTableData;
+          this.info = res.data.table.info;
+          this.formSetTableData = res.data.table.formSetTableData;
+          this.handleClientChargeChange(res.data.table.info.custom_detail_name);
+          this.tableData = res.data.table.tableData;
+        });
     },
-    saveRoughDraft(){
+    saveRoughDraft() {
       this.axios({
         method: "post",
         url: "/api/update/table",
@@ -2562,9 +2586,9 @@ export default {
           id: "businessorderlist_detail_roughDraft",
           result: {
             post_formSetTableData: this.post_formSetTableData,
-            info:this.info,
-            formSetTableData:this.formSetTableData,
-            tableData:this.tableData
+            info: this.info,
+            formSetTableData: this.formSetTableData,
+            tableData: this.tableData,
           },
         },
       }).then((res) => {
@@ -2574,17 +2598,17 @@ export default {
         }
       });
     },
-    print_line(){
-          this.axios({
-            method:'get',
-            url:'/api/printe_order_detail',
-            params:{
-                order_no:this.$route.query.order_no,
-                box_id:'',
-            }
-        }).then(res=>{
-            this.print_line_data = res.msg.foot.amount_detail
-        })
+    print_line() {
+      this.axios({
+        method: "get",
+        url: "/api/printe_order_detail",
+        params: {
+          order_no: this.$route.query.order_no,
+          box_id: "",
+        },
+      }).then((res) => {
+        this.print_line_data = res.msg.foot.amount_detail;
+      });
     },
     handleFaxPriceChange(e) {
       this.info.fax_price = e.target.value;
@@ -2658,7 +2682,6 @@ export default {
       });
     },
     postData() {
-      
       let sendData = JSON.parse(JSON.stringify(this.info));
       // sendData.custom_detail_id = sendData.custom_id
       // let sendList = JSON.parse(JSON.stringify(this.tableData));
@@ -2673,7 +2696,7 @@ export default {
           v.material_id = v.product_id;
           v.ext_id = v.product_id;
         });
-        console.log(sendList)
+      console.log(sendList);
       sendList.length > 0 &&
         sendList.map((element, index) => {
           element.ext = element.extArray;
@@ -2688,7 +2711,7 @@ export default {
               });
             }
           });
-          console.log(2)
+          console.log(2);
           if (!element.measurement) {
             element.measurement = "";
           }
@@ -2915,15 +2938,8 @@ export default {
               this.info.service_id = re.data.detail.service_id;
               this.info.predict_price = sum.toFixed(2);
               this.info.order_price = (
-                (this.info.predict_price * this.fax) /
-                100
+                this.info.predict_price - this.info.fax_price
               ).toFixed(2);
-              const temp_fax_price =
-                (this.info.predict_price - this.info.order_price).toFixed(2) ||
-                0;
-              if (!this.info.fax_price) {
-                this.info.fax_price = temp_fax_price;
-              }
               this.$forceUpdate();
             });
         }
@@ -3146,7 +3162,6 @@ export default {
                                     .wide || 0}*${__temp[0].high || 0}`,
                                 }));
                             });
-                            console.log(this.tableData)
                           } else {
                             this.wood_title_count.map((v) => {
                               v.title == el.material_detail_title &&
@@ -5419,11 +5434,26 @@ export default {
       }
       this.$forceUpdate();
     },
-    handlePriceFocus(price) {
-      if (price == 0.0 || price == 0) {
+    handlePriceFocus() {
+      if (this.modalData.price == 0.0 || this.modalData.price == 0) {
         this.modalData.price = "";
       }
     },
+    handleUnitPriceFocus() {
+      if (this.modalData.unit_price == 0.0 || this.modalData.unit_price == 0) {
+        this.modalData.unit_price = "";
+      }
+    },
+    handleExtPriceFocus() {
+      if (this.modalData.ext_price == 0.0 || this.modalData.ext_price == 0) {
+        this.modalData.ext_price = "";
+      }
+    },
+    handleOverPriceFocus() {
+      if (this.modalData.over_price == 0.0 || this.modalData.over_price == 0) {
+        this.modalData.over_price = "";
+      }
+    },
     handleMaterialChange(val, row) {
       if (val) {
         let tempRow = row.material_detail_list.filter(