lrf402788946 4 gadi atpakaļ
vecāks
revīzija
5e1fd03592
2 mainītis faili ar 83 papildinājumiem un 16 dzēšanām
  1. 81 16
      src/views/order/out.vue
  2. 2 0
      src/views/order/transport/index.vue

+ 81 - 16
src/views/order/out.vue

@@ -67,19 +67,42 @@
               </el-row>
               <el-row>
                 <el-col :span="24" class="rate">
-                  <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 :span="24" class="tip">
+                  <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 :span="24" class="tip">
                     <span>关于长途运费:若是改成 他运且想根据设置的不同方式进行计算 需要重新生成订单,目前还无法处理这种情况</span>
-                  </el-col> -->
+                  </el-col>
+                </el-col>
+              </el-row>
+              <el-row>
+                <el-col :span="24">
+                  <el-card class="box-card">
+                    <div slot="header" class="clearfix">
+                      <span>已生成的运费</span>
+                    </div>
+                    <div class="text item">
+                      <el-table :data="tranGoodsList" border>
+                        <el-table-column align="center" label="货物名" prop="name"></el-table-column>
+                        <el-table-column align="center" label="运输单号" prop="no"></el-table-column>
+                        <el-table-column align="center" label="供应商信息">
+                          <template v-slot="{ row }">
+                            {{ getSupplier(row) }}
+                          </template>
+                        </el-table-column>
+                        <el-table-column align="center" label="税率" prop="taxes"></el-table-column>
+                        <el-table-column align="center" label="税前应付" prop="sq_ys"></el-table-column>
+                        <el-table-column align="center" label="税后应付" prop="sh_ys"></el-table-column>
+                      </el-table>
+                    </div>
+                  </el-card>
                 </el-col>
               </el-row>
               <el-row>
                 <span v-if="detailForm.is_js == false">
                   <el-button size="small" @click="addTab(editableTabsValue)" style="margin:10px 0px">
-                    + 添加支出
+                    + 额外添加支出
                   </el-button>
                 </span>
                 <el-tabs v-model="editableTabsValue" type="card" :closable="!detailForm.is_js" @tab-remove="removeTab">
@@ -227,6 +250,8 @@ const { mapActions: project } = createNamespacedHelpers('project');
 const { mapActions: treaty } = createNamespacedHelpers('treaty');
 // 车牌表
 const { mapActions: car } = createNamespacedHelpers('car');
+//运输表
+const { mapActions: transport } = createNamespacedHelpers('transport');
 // 分页
 import page from '@f/components/pagination.vue';
 //查询search
@@ -274,19 +299,17 @@ export default {
       costList: [],
       //税率列表
       rateList: [],
-      // cost1: 0,
-      // cost2: 0,
-      // cost3: 0,
-      // cost4: 0,
       cost: {},
       detailForm: {},
       //判断是否结算
       judge: true,
+      //运费部分
+      tranGoodsList: [],
     };
   },
   async created() {
-    await this.search();
     await this.searchOther();
+    await this.search();
   },
   methods: {
     ...order(['query', 'create', 'update', 'delete', 'fetch']),
@@ -297,6 +320,7 @@ export default {
     ...car({ carQuery: 'query' }),
     ...treaty({ treatyQuery: 'query' }),
     ...project({ projectQuery: 'query' }),
+    ...transport(['getOrderTransport']),
 
     async search({ skip = 0, limit = this.limit } = {}) {
       this.limit = limit;
@@ -315,6 +339,9 @@ export default {
         this.$set(this, `list`, data);
         this.$set(this, `total`, total);
       }
+    },
+    // 查询车牌号
+    async searchOther() {
       //查客户列表
       const res1 = await this.clientQuery({ type: '客户' });
       if (this.$checkRes(res1)) {
@@ -344,9 +371,6 @@ export default {
         const { data, total } = res5;
         this.$set(this, `supClientList`, data);
       }
-    },
-    // 查询车牌号
-    async searchOther() {
       let res = await this.carQuery();
       if (this.$checkRes(res)) {
         this.$set(this, `carnoList`, res.data);
@@ -356,6 +380,22 @@ export default {
     async see(data) {
       const res = await this.fetch(data.id);
       if (res) this.$set(this, `detailForm`, res);
+      // 查运输单,显示货物运费
+      const send = _.get(res, 'send_time', []);
+      if (send.length > 0) {
+        const nos = send.map(i => i.no);
+        const tr = await this.getOrderTransport(nos);
+        const arr = [];
+        // 组织数据
+        for (const tran of tr) {
+          const { no, goods, supplier, supply_type } = tran;
+          for (const good of goods) {
+            arr.push({ no, ...good, supplier, supply_type });
+          }
+        }
+        this.$set(this, 'tranGoodsList', arr);
+        this.computRate();
+      }
       if (this.detailForm.out_bill.length > 0) {
         this.computRate();
       }
@@ -363,7 +403,7 @@ export default {
       await this.isTreaty();
     },
     //添加选项卡
-    addTab(value) {
+    addTab() {
       if (this.editableTabsValue == '0') {
         this.editableTabsValue = '1';
       }
@@ -417,6 +457,13 @@ export default {
         num3 = _.round(num3 + Number(row1.sq_ss), 2);
         num4 = _.round(num4 + row1.sh_ss, 2);
       }
+      // 加上货物运费
+      const sq = this.tranGoodsList.reduce((p, n) => p + n.sq_ys, 0);
+      const sh = this.tranGoodsList.reduce((p, n) => p + n.sh_ys, 0);
+      num1 += sq;
+      num3 += sq;
+      num2 += sh;
+      num4 += sh;
       this.$set(this.cost, `cost1`, num1);
       this.$set(this.cost, `cost2`, num2);
       this.$set(this.cost, `cost3`, num3);
@@ -494,6 +541,24 @@ export default {
         if (item.item) this.changeItem(item.item, true);
       }
     },
+    // 已生成的运费列表获取供应商
+    getSupplier(data) {
+      const { supply_type, supplier } = data;
+      if (supply_type === '0') {
+        // TODO自运,换车号
+        const { car_no } = supplier;
+        const r = this.carnoList.find(f => f._id === car_no);
+        if (r) return `自运:${r.car_no}`;
+      } else if (supply_type === '1') {
+        // 他运,找供应商
+        const { client } = supplier;
+        const r = this.supClientList.find(f => f._id === client);
+        if (r) return `他运:${r.name}`;
+      } else {
+        // 第三方,直接拿车号
+        return `第三方:${_.get(supplier, 'car_no')}`;
+      }
+    },
   },
   computed: {
     ...mapState(['user']),

+ 2 - 0
src/views/order/transport/index.vue

@@ -356,7 +356,9 @@ export default {
         }
         // 处理路线
         let route = goods[0];
+        console.log(route);
         let newRoute = this.list.find(i => i.split.find(f => f._id == route._id));
+        console.log(newRoute);
         let routeData = this.routeList.find(i => i._id == newRoute.route);
         if (!routeData) {
           // TODO 此处主要是没有填写路线,导致不知道这单去哪里