wxy 4 年之前
父節點
當前提交
c453caba7f

+ 45 - 10
src/views/client/addroute.vue

@@ -25,6 +25,7 @@
     </el-row>
     <el-dialog :visible.sync="dialog" title="线路详情" @close="toClose" width="50%">
       <!-- 物流里面的:data要换成v-model -->
+
       <data-form v-model="form" :fields="fields" @save="turnSave" :rules="rules" @filterReturn="choose">
         <template #options="{item}">
           <template v-if="item.model == 's_p'">
@@ -129,26 +130,36 @@ export default {
     },
     //保存
     async turnSave({ data }) {
+      let res;
+      let word;
       if (data.id) {
-        const res = await this.update(data);
-        if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.update(data);
+        word = '修改';
+        // if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
       } else {
         data.item = this.id;
         data.owner = this.user.id;
-        const res = await this.create(data);
-        if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.create(data);
+        word = '创建';
+        // if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
+      }
+      if (this.$checkRes(res, `${word}成功`, res.errmsg || `${word}失败`)) {
+        this.search();
+        this.toClose();
       }
     },
     //编辑
     editor({ data }) {
       this.$set(this, `form`, data);
       this.dialog = true;
+      this.choose({ data: data.s_p, model: 's_p' });
+      this.choose({ data: data.e_p, model: 'e_p' });
     },
     //刪除
     async toDelete({ data }) {
@@ -168,6 +179,20 @@ export default {
       } else {
         this.$set(this, `endCityList`, startCity.children);
       }
+      //显示城市用的代码
+      // if (model === 's_p') {
+      //   if (startCity.children.length !== 0) {
+      //     this.$set(this, `startCityList`, startCity.children);
+      //   } else {
+      //     this.$set(this, `startCityList`, [startCity]);
+      //   }
+      // } else {
+      //   if (startCity.children.length !== 0) {
+      //     this.$set(this, `endCityList`, startCity.children);
+      //   } else {
+      //     this.$set(this, `endCityList`, [startCity]);
+      //   }
+      // }
     },
     //过滤
     roleSelect({ model, value }) {
@@ -175,6 +200,16 @@ export default {
         let arr = this.routeList.find(i => i.id === value);
         if (arr) return arr.label;
       } else if (model == 's_c' || model == 'e_c') {
+        //显示城市用的代码
+        // let arr1 = this.routeList.find(i => i.id === value);
+        // if (arr1) {
+        //   return arr1.label;
+        // } else {
+        //   for (let item of this.routeList) {
+        //     let arr = item.children.find(i => i.id === value);
+        //     if (arr) return arr.label;
+        //   }
+        // }
         for (let item of this.routeList) {
           let arr = item.children.find(i => i.id === value);
           if (arr) return arr.label;

+ 18 - 10
src/views/client/addstyle.vue

@@ -157,20 +157,28 @@ export default {
     },
     //保存
     async turnSave(form) {
+      let res;
+      let word;
       if (form.id) {
-        const res = await this.update(form);
-        if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.update(form);
+        word = '修改';
+        // if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
       } else {
         form.route = this.id;
         form.owner = this.user.id;
-        const res = await this.create(form);
-        if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.create(form);
+        word = '创建';
+        // if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
+      }
+      if (this.$checkRes(res, `${word}成功`, res.errmsg || `${word}失败`)) {
+        this.search();
+        this.toClose();
       }
     },
     //编辑

+ 19 - 10
src/views/client/contract.vue

@@ -137,6 +137,7 @@ export default {
         this.$set(this, `userList`, res1.data);
         // console.log(this.userList);
       }
+      // console.log(this.userList);
     },
     // 查合同 其他参数是...info,都包括在里面,可以输出看看
     async searchTreaty({ skip = 0, limit = 10, ...info } = {}) {
@@ -164,20 +165,28 @@ export default {
     //保存
     async turnSave({ data }) {
       let client = data.client;
+      let word;
+      let res;
       if (data.id) {
-        const res = await this.update(data);
-        if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
-          this.searchTreaty({ client });
-          this.toClose();
-        }
+        res = await this.update(data);
+        word = '修改';
+        // if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
+        //   this.searchTreaty({ client });
+        //   this.toClose();
+        // }
       } else {
         //谁登陆owner就是谁,把id赋予上面就行,创建新的合同的时候必须添加一个owner创始人这是必填的
         // data.owner = this.user.id;
-        const res = await this.create(data);
-        if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
-          this.searchTreaty({ client });
-          this.toClose();
-        }
+        res = await this.create(data);
+        word = '创建';
+        // if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
+        //   this.searchTreaty({ client });
+        //   this.toClose();
+        // }
+      }
+      if (this.$checkRes(res, `${word}成功`, res.errmsg || `${word}失败`)) {
+        this.searchTreaty({ client });
+        this.toClose();
       }
     },
 

+ 18 - 10
src/views/client/project.vue

@@ -113,20 +113,28 @@ export default {
     },
     //保存
     async turnSave({ data }) {
+      let res;
+      let word;
       if (data.id) {
-        const res = await this.update(data);
-        if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.update(data);
+        word = '修改';
+        // if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
       } else {
         data.treaty = this.id;
         data.owner = this.user.id;
-        const res = await this.create(data);
-        if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
-          this.search();
-          this.toClose();
-        }
+        res = await this.create(data);
+        word = '创建';
+        // if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
+        //   this.search();
+        //   this.toClose();
+        // }
+      }
+      if (this.$checkRes(res, `${word}成功`, res.errmsg || `${word}失败`)) {
+        this.search();
+        this.toClose();
       }
     },
     //编辑

+ 21 - 12
src/views/order/goods.vue

@@ -186,6 +186,9 @@ export default {
   },
   async created() {
     await this.search();
+    await this.searchClient();
+    await this.searchUser();
+    await this.searchRoute();
   },
   methods: {
     ...client({ clientQuery: 'query' }),
@@ -218,22 +221,28 @@ export default {
         this.$set(this, `list`, newArray);
         this.$set(this, `total`, total);
       }
-      //查客户列表
-      const res1 = await this.clientQuery({ type: '客户' });
-      if (this.$checkRes(res1)) {
-        const { data, total } = res1;
+    },
+    //查客户列表
+    async searchClient() {
+      const res = await this.clientQuery({ type: '客户' });
+      if (this.$checkRes(res)) {
+        const { data, total } = res;
         this.$set(this, `clientList`, data);
       }
-      //查用户
-      const res2 = await this.getUserList();
-      if (this.$checkRes(res2)) {
-        const { data, total } = res2;
+    },
+    //查用户列表
+    async searchUser() {
+      const res = await this.getUserList();
+      if (this.$checkRes(res)) {
+        const { data, total } = res;
         this.$set(this, `userList`, data);
       }
-      // 查询线路列表
-      const res3 = await this.routeQuery();
-      if (this.$checkRes(res3)) {
-        const { data, total } = res3;
+    },
+    //查询线路列表
+    async searchRoute() {
+      const res = await this.routeQuery();
+      if (this.$checkRes(res)) {
+        const { data, total } = res;
         this.$set(this, `routeList`, data);
       }
     },

+ 7 - 4
src/views/order/in.vue

@@ -108,6 +108,7 @@ export default {
   created() {
     this.search();
     this.searchUser();
+    this.searchCustomer();
   },
   methods: {
     ...client({ clientQuery: 'query' }),
@@ -125,10 +126,12 @@ export default {
         this.$set(this, `list`, data);
         this.$set(this, `total`, total);
       }
-      //查客户列表
-      const res1 = await this.clientQuery({ type: '客户' });
-      if (this.$checkRes(res1)) {
-        const { data, total } = res1;
+    },
+    //查客户
+    async searchCustomer() {
+      const res = await this.clientQuery({ type: '客户' });
+      if (this.$checkRes(res)) {
+        const { data, total } = res;
         this.$set(this, `nameList`, data);
       }
     },

+ 41 - 38
src/views/order/inDetail.vue

@@ -8,10 +8,10 @@
         </el-col>
         <el-col :span="24" class="rate">
           <!-- <el-col :span="24" class="tip"><span>关于长途运费:若是改成 他运且想根据设置的不同方式进行计算 需要重新生成订单,目前还无法处理这种情况</span></el-col> -->
-          <el-col :span="6" class="rateMoney">税前应收:{{ cost1 }}</el-col>
-          <el-col :span="6" class="rateMoney">税后应收:{{ cost2 }}</el-col>
-          <el-col :span="6" class="rateMoney">税前实收:{{ cost3 }}</el-col>
-          <el-col :span="6" class="rateMoney">税后应收:{{ cost4 }}</el-col>
+          <el-col :span="6" class="rateMoney">税前应收:{{ cost.cost1 }}</el-col>
+          <el-col :span="6" class="rateMoney">税后应收:{{ cost.cost2 }}</el-col>
+          <el-col :span="6" class="rateMoney">税前实收:{{ cost.cost3 }}</el-col>
+          <el-col :span="6" class="rateMoney">税后应收:{{ cost.cost4 }}</el-col>
         </el-col>
         <el-col :span="12" class="form">
           <el-form ref="form" :model="detailForm" label-width="90px">
@@ -197,24 +197,24 @@ export default {
       //税率列表
       rateList: [],
       //方式列表
-      wayoptions: [],
-      cost1: 0,
-      cost2: 0,
-      cost3: 0,
-      cost4: 0,
-      name: '',
-      treatyValue: '',
-      routeValue: '',
-      wayValue: '',
-      priceOptions: [],
-      prNumber: '',
       wayList: [],
-      //单价列表
-      priceList: [],
-      number1: 0,
-      weight: 0,
-      volume: 0,
-      projectObj: {},
+      // cost1: 0,
+      // cost2: 0,
+      // cost3: 0,
+      // cost4: 0,
+      cost: {},
+      name: '',
+      // treatyValue: '',
+      // routeValue: '',
+      // wayValue: '',
+      // priceList: [],
+      // number1: 0,
+      // weight: 0,
+      // volume: 0,
+      // projectObj: {},
+      // priceOptions: [],
+      // prNumber: '',
+      // wayoptions: [],
     };
   },
   async created() {
@@ -253,9 +253,11 @@ export default {
       }
     },
     //查项目
-    async searchProject() {
-      let goods = this.detailForm.goods;
-      const res = await this.projectQuery({ treaty: this.treatyValue });
+    async searchProject(data) {
+      // let goods = this.detailForm.goods;
+      // console.log(goods);
+      // const res = await this.projectQuery({ treaty: this.treatyValue });
+      const res = await this.projectQuery({ treaty: data });
       // if (res.data.length == 0) {
       //   this.projectList = [];
       //   this.routeList = [];
@@ -271,8 +273,8 @@ export default {
       }
     },
     //查线路
-    async searchRoute() {
-      const res = await this.routeQuery({ item: this.routeValue });
+    async searchRoute(data) {
+      const res = await this.routeQuery({ item: data });
       if (res.data.length == 0) {
         this.routeList = [];
         this.detailForm.route = '';
@@ -282,9 +284,9 @@ export default {
       }
     },
     //查计费方式列表
-    async searchWay() {
+    async searchWay(data) {
       let test1 = [];
-      const res = await this.modeQuery({ route: this.wayValue });
+      const res = await this.modeQuery({ route: data });
       // console.log(res.data);
       if (res) {
         this.$set(this, `wayList`, res.data);
@@ -373,10 +375,10 @@ export default {
         num7 = _.round(num7 + Number(val.sq_ss), 2);
         num8 = _.round(num8 + val.sh_ss, 2);
       }
-      this.$set(this, `cost1`, _.round(num1 + num5, 2));
-      this.$set(this, `cost2`, _.round(num2 + num6, 2));
-      this.$set(this, `cost3`, _.round(num3 + num7, 2));
-      this.$set(this, `cost4`, _.round(num4 + num8, 2));
+      this.$set(this.cost, `cost1`, _.round(num1 + num5, 2));
+      this.$set(this.cost, `cost2`, _.round(num2 + num6, 2));
+      this.$set(this.cost, `cost3`, _.round(num3 + num7, 2));
+      this.$set(this.cost, `cost4`, _.round(num4 + num8, 2));
     },
     //税前应收
     inputChange(val, index) {
@@ -414,8 +416,9 @@ export default {
     },
     //合同改变
     async treayChange(data, mm) {
-      this.treatyValue = data;
-      await this.searchProject();
+      // this.treatyValue = data;
+      // console.log(data);
+      await this.searchProject(data);
       if (mm) return;
       this.detailForm.item = '';
       this.detailForm.route = '';
@@ -434,8 +437,8 @@ export default {
     },
     //项目改变  项目改变就有税率
     async projectChange(data, mm) {
-      this.$set(this, `routeValue`, data);
-      await this.searchRoute();
+      // this.$set(this, `routeValue`, data);
+      await this.searchRoute(data);
       const res = this.projectList.find(f => f.id == data);
       if (res) {
         const { taxes } = res;
@@ -461,8 +464,8 @@ export default {
     },
     //线路改变
     async routeChange(data, type) {
-      this.wayValue = data;
-      await this.searchWay();
+      // this.wayValue = data;
+      await this.searchWay(data);
       if (type) return;
       for (let item of this.detailForm.goods) {
         item.mode = '';

+ 1 - 1
src/views/order/transport/index.vue

@@ -599,7 +599,7 @@ export default {
       // console.log(data);
       let routeIdList = _.split(data, '至', 2);
       let newArray;
-      console.log(routeIdList);
+      // console.log(routeIdList);
       if (routeIdList) {
         newArray = routeIdList.map(item => {});
       }

+ 16 - 8
src/views/supplier/contract.vue

@@ -144,20 +144,28 @@ export default {
     //保存
     async turnSave({ data }) {
       let client = data.client;
+      let res;
+      let word;
       if (data.id) {
         const res = await this.update(data);
-        if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
-          this.searchTreaty({ client });
-          this.toClose();
-        }
+        word = '修改';
+        // if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
+        //   this.searchTreaty({ client });
+        //   this.toClose();
+        // }
       } else {
         //谁登陆owner就是谁,把id赋予上面就行
         data.owner = this.user.id;
         const res = await this.create(data);
-        if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
-          this.searchTreaty({ client });
-          this.toClose();
-        }
+        word = '创建';
+        // if (this.$checkRes(res, '创建成功', res.errmsg || '创建失败')) {
+        //   this.searchTreaty({ client });
+        //   this.toClose();
+        // }
+      }
+      if (this.$checkRes(res, `${word}成功`, res.errmsg || `${word}失败`)) {
+        this.searchTreaty({ client });
+        this.toClose();
       }
     },