Browse Source

提货列表新增流程

zhouhao 2 năm trước cách đây
mục cha
commit
f25ff3fadd
1 tập tin đã thay đổi với 89 bổ sung45 xóa
  1. 89 45
      src/views/supply/pickup/components/pickup_form.vue

+ 89 - 45
src/views/supply/pickup/components/pickup_form.vue

@@ -107,28 +107,27 @@
         <el-table ref="table" v-loading="listLoading" :data="deliverList" element-loading-text="Loading" border fit
           highlight-current-row stripe @select="handleSelect" @select-all="handleSelectAll">
           <el-table-column align="center" type="selection" width="55"></el-table-column>
-        
+
           <template v-if="logisticsNumber === '001' && mainForm.pickupWay == 2">
-            <el-table-column align="left" label="仓库" prop="invoiceId" min-width="160" show-overflow-tooltip v-if="isFront!==null">
-            <template v-slot="{row}">
-              <el-select v-model="row.warehouseFlag" value-key="" placeholder="" clearable filterable size="mini" @change="">
-              <el-option v-for="item in storeList"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">
-              </el-option>
-            </el-select>
-            </template>
-          </el-table-column>
+            <el-table-column align="left" label="仓库" prop="invoiceId" min-width="160" show-overflow-tooltip
+              v-if="isFront !== null">
+              <template v-slot="{ row }">
+                <el-select v-model="row.warehouseFlag" value-key="" placeholder="" clearable filterable size="mini"
+                  @change="storeChange($event, row)">
+                  <el-option v-for="item in storeList" :key="item.value" :label="item.label" :value="item.value">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
             <el-table-column align="left" label="收货客户" prop="orderTime" min-width="100" show-overflow-tooltip>
               <template slot-scope="scope">
                 <el-input v-if="!(scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME')" :disabled="flag"
                   v-model="scope.row.receivingName" size="mini"
                   @input="handleInput($event, scope.row.invoiceId, 1)"></el-input>
-                <template v-else> 
-                  <el-input  :disabled="flag ||(isFront!==null && (scope.row.warehouseFlag==0 || scope.row.warehouseFlag == null))"
-                  v-model="scope.row.refLinkman " size="mini"
-                 ></el-input>
+                <template v-else>
+                  <el-input
+                    :disabled="flag || (isFront !== null && (scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null))"
+                    v-model="scope.row.refLinkman" size="mini"></el-input>
                 </template>
               </template>
             </el-table-column>
@@ -137,9 +136,9 @@
                 <el-input v-if="!(scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME')" :disabled="flag"
                   v-model="scope.row.phone" size="mini" @input="handleInput($event, scope.row.invoiceId, 2)"></el-input>
                 <template v-else>
-                  <el-input  :disabled="flag ||(isFront!==null && (scope.row.warehouseFlag==0 || scope.row.warehouseFlag == null))"
-                  v-model="scope.row.refPhone " size="mini"
-                 ></el-input>
+                  <el-input
+                    :disabled="flag || (isFront !== null && (scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null))"
+                    v-model="scope.row.refPhone" size="mini"></el-input>
                 </template>
               </template>
             </el-table-column>
@@ -149,9 +148,9 @@
                   v-model="scope.row.address" size="mini"
                   @input="handleInput($event, scope.row.invoiceId, 3)"></el-input>
                 <template v-else>
-                  <el-input  :disabled="flag || (isFront!==null && (scope.row.warehouseFlag==0 || scope.row.warehouseFlag == null))"
-                  v-model="scope.row.refInstallAddress " size="mini"
-                 ></el-input>
+                  <el-input
+                    :disabled="flag || (isFront !== null && (scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null))"
+                    v-model="scope.row.refInstallAddress" size="mini"></el-input>
                 </template>
               </template>
             </el-table-column>
@@ -269,20 +268,20 @@ export default {
       companyList: [],
       logisticsNumber: '',
       isFront: null,
-      storeList:[
+      storeList: [
         {
-          label:'前置仓',
-          value:'0'
+          label: '前置仓',
+          value: '0'
         },
         {
-          label:'工程机',
-          value:'1'
+          label: '工程机',
+          value: '1'
         },
         {
-          label:'商家仓',
-          value:'2'
+          label: '商家仓',
+          value: '2'
         }
-        
+
       ]
     }
   },
@@ -339,6 +338,46 @@ export default {
     goBack() {
       this.$emit('backListFormDetail')
     },
+
+    storeChange(e, row) {
+      console.log(e, row);
+
+      if (e == 0) {
+        if (!(row.orderType === 'TRADE' || row.orderType === 'HOME')) {
+          if ((row.receivingName && row.phone && row.address)) {
+            row.copyReceivingName = row.receivingName
+            row.copyPhone = row.phone
+            row.copyAddress = row.address
+            row.receivingName = ''
+            row.phone = ''
+            row.address = ''
+          }
+        } else {
+          if ((row.refLinkman && row.refPhone && row.refInstallAddress)) {
+            row.copyRefLinkman = row.refLinkman
+            row.copyRefPhone = row.refPhone
+            row.copyRefInstallAddress = row.refInstallAddress
+            row.refLinkman = ''
+            row.refPhone = ''
+            row.refInstallAddress = ''
+          }
+
+        }
+
+      }
+      if (e == 1) {
+        row.refLinkman = row.copyRefLinkman
+        row.refPhone = row.copyRefPhone
+        row.refInstallAddress = row.copyRefInstallAddress
+
+
+      }
+      if (e == 2) {
+        row.receivingName = row.copyReceivingName
+        row.phone = row.copyPhone
+        row.address = row.copyAddress
+      }
+    },
     handleInput(e, id, type) {
       console.log(e)
       this.deliverList.forEach(k => {
@@ -479,6 +518,11 @@ export default {
       this.listLoading = true
       getDeliverList({ correspondId: this.mainForm.warehouse }).then(res => {
         this.deliverList = res.data
+        this.deliverList.forEach(k => {
+          if (k.refLinkman || k.refPhone || k.refInstallAddress) {
+            this.$set(k, 'warehouseFlag', '1')
+          }
+        })
         this.listLoading = false
       })
     },
@@ -505,22 +549,22 @@ export default {
             return this.$errorMsg('请选择发货申请单')
           }
 
-            for (let i = 0; i < this.tableSelection.length; i++) {
-                  if (this.tableSelection[i].warehouseFlag == 2) {
-                    let el = this.tableSelection[i]
-                    if (!(el.orderType === 'TRADE' || el.orderType === 'HOME')) {
-                        if (!(el.receivingName && el.phone && el.address)) {
-                          return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
-                        }
-                    }else{
-                      if (!(el.refLinkman && el.refPhone && el.refInstallAddress)) {
-                        return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
-
-                      }
-                    }
-                    
-                  }              
+          for (let i = 0; i < this.tableSelection.length; i++) {
+            if (this.tableSelection[i].warehouseFlag == 2) {
+              let el = this.tableSelection[i]
+              if (!(el.orderType === 'TRADE' || el.orderType === 'HOME')) {
+                if (!(el.receivingName && el.phone && el.address)) {
+                  return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
+                }
+              } else {
+                if (!(el.refLinkman && el.refPhone && el.refInstallAddress)) {
+                  return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
+
+                }
+              }
+
             }
+          }
 
           let orderList = []
           this.tableSelection.forEach(item => {