wxy 4 роки тому
батько
коміт
287e5e3272
1 змінених файлів з 45 додано та 6 видалено
  1. 45 6
      src/views/order/inDetail.vue

+ 45 - 6
src/views/order/inDetail.vue

@@ -257,12 +257,16 @@ export default {
     async searchProject() {
       let goods = this.detailForm.goods;
       const res = await this.projectQuery({ treaty: this.treatyValue });
-      if (res.data.length == 0) {
-        this.projectList = [];
-        this.routeList = [];
-        this.detailForm.item = '';
-        this.detailForm.route = '';
-      } else {
+      // if (res.data.length == 0) {
+      //   this.projectList = [];
+      //   this.routeList = [];
+      //   this.detailForm.item = '';
+      //   this.detailForm.route = '';
+      // } else {
+      //   const { data, total } = res;
+      //   this.$set(this, `projectList`, data);
+      // }
+      if (res) {
         const { data, total } = res;
         this.$set(this, `projectList`, data);
       }
@@ -354,6 +358,7 @@ export default {
       let goods = this.detailForm.goods; //goods是个数组
       let in_bill = this.detailForm.in_bill; //in_bill是个数组
       for (let row1 of goods) {
+        console.log(row1);
         if (row1.sq_ys) {
           num1 = _.round(num1 + row1.sq_ys, 2);
           num2 = _.round(num2 + row1.sh_ys, 2);
@@ -407,9 +412,23 @@ export default {
     async treayChange(data, mm) {
       this.treatyValue = data;
       await this.searchProject();
+      // console.log(this.detailForm);
       if (mm) return;
       this.detailForm.item = '';
       this.detailForm.route = '';
+      // this.projectList = [];
+      // this.routeList = [];
+      for (let item of this.detailForm.goods) {
+        item.mode = '';
+        item.price = 0;
+        item.cvalue = 0;
+        item.taxes = 0;
+        item.sq_ss = 0;
+        item.sh_ss = 0;
+        item.sq_ys = 0;
+        item.sh_ys = 0;
+      }
+      this.computRate();
     },
     //项目改变  项目改变就有税率
     async projectChange(data, mm) {
@@ -427,6 +446,18 @@ export default {
       }
       if (mm) return;
       this.detailForm.route = '';
+      // this.projectList = [];
+      // this.routeList = [];
+      for (let item of this.detailForm.goods) {
+        item.mode = '';
+        item.price = 0;
+        item.cvalue = 0;
+        item.sq_ss = 0;
+        item.sh_ss = 0;
+        item.sq_ys = 0;
+        item.sh_ys = 0;
+      }
+      this.computRate();
     },
     //线路改变
     routeChange(data, type) {
@@ -435,7 +466,15 @@ export default {
       if (type) return;
       for (let item of this.detailForm.goods) {
         item.mode = '';
+        item.mode = '';
+        item.price = 0;
+        item.cvalue = 0;
+        item.sq_ss = 0;
+        item.sh_ss = 0;
+        item.sq_ys = 0;
+        item.sh_ys = 0;
       }
+      this.computRate();
     },
     //是否有合同
     async isTreaty() {