Browse Source

计划单

zhouhao 2 years ago
parent
commit
23683d787d

+ 2 - 1
src/views/supply/policy/components/retail_form.vue

@@ -976,11 +976,12 @@ export default {
       this.$emit('backListFormDetail')
     },
     handleWarehouseValue(e) {
-      if (!this.goodsList.length) return
       this.correspondName = this.warehouseList.find(k => {
         return k.id === e
       }).name
       this.correspondId = e
+      if (!this.goodsList.length) return
+
       this.goodsList.forEach(k => {
         this.$set(k, 'correspondName', this.correspondName)
         this.$set(k, 'correspondId', this.correspondId)

+ 56 - 13
src/views/supply/retail/components/retail_form.vue

@@ -75,7 +75,7 @@
             <el-input v-model="mainForm.remark" placeholder="请输入表头备注"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="24" :sm="12" :lg="12" >
+        <el-col :span="24" :sm="12" :lg="12">
           <el-form-item label="计划单" prop="isPlanOrder">
             <el-radio-group v-model="mainForm.isPlanOrder">
               <el-radio :label="true">是</el-radio>
@@ -89,12 +89,16 @@
     <div class="main-title">
       <div class="title">货品信息</div>
       <div>
-        <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
+        <el-select v-model="warehouseValue" placeholder="请选择发货仓库"
+                   @change="handleWarehouseValue"
+                   size="small" style="margin-right: 10px"
+        >
           <el-option
             :label="item.name"
             :value="item.id"
             v-for="(item, index) in warehouseList"
             :key="index"
+
           ></el-option>
         </el-select>
         <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
@@ -258,9 +262,9 @@
           <template slot-scope="scope">
             {{
               ((scope.row.price * scope.row.qty * 100 -
-                (((scope.row.price - scope.row.discAmount) * scope.row.qty * (scope.row.rebateRate * 100)) / 100) *
+                  (((scope.row.price - scope.row.discAmount) * scope.row.qty * (scope.row.rebateRate * 100)) / 100) *
                   100 -
-                ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
+                  ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
                 100)
                 | numToFixed
             }}
@@ -283,6 +287,8 @@
             <div>{{ scope.row.status1 | status1Filter }}</div>
           </template>
         </el-table-column> -->
+        <el-table-column align="left" label="仓库" prop="correspondName" min-width="150" show-overflow-tooltip />
+
         <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
             <div>{{ status2Filter(scope.row) }}</div>
@@ -533,16 +539,20 @@ export default {
       let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue
       let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue
       let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue
-      if (val === '' || val === null || val === undefined) return '未检查'
-      else if (val <= 0) return '无货'
-      else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val
-      else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货'
-      else if (val > STOCK_ORDER_ALL_NUM) return '充足'
+      if (val === '' || val === null || val === undefined) {
+        return '未检查'
+      } else if (val <= 0) {
+        return '无货'
+      } else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) {
+        return val
+      } else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) {
+        return '有货'
+      } else if (val > STOCK_ORDER_ALL_NUM) return '充足'
     }
   },
   directives: {
     drag: {
-      bing: function (el) {
+      bing: function(el) {
         console.log(el)
         let oDiv = el
         oDiv.onmousedown = e => {
@@ -614,7 +624,9 @@ export default {
       rightSelection: [],
 
       isFirst: false,
-      salesmanList: []
+      salesmanList: [],
+      correspondName: '',
+      correspondId: ''
     }
   },
 
@@ -662,6 +674,11 @@ export default {
 
         if (newValue && newValue.length) {
           newValue.forEach((item, index) => {
+            console.log(this.correspondName)
+            if (this.correspondId) {
+              this.goodsList[index].correspondName = this.correspondName
+              this.goodsList[index].correspondId = this.correspondId
+            }
             this.goodsList[index].compute_amount = item.price * item.qty
             this.goodsList[index].compute_flAmount =
               ((item.price - item.discAmount) * item.qty * (item.rebateRate * 100)) / 100
@@ -714,8 +731,11 @@ export default {
         this.mainForm.jxsName = data.customerName
         this.mainForm.fileNum = data.fileNo
         this.mainForm.remark = data.remark
-
+        this.correspondName = data.correspondName
+        this.warehouseValue = data.correspondId
         data.retailOrderItemList.forEach(item => {
+          item.correspondName = data.correspondName
+          item.warehouseValue = data.correspondId
           item.status1 = ''
           item.status2 = ''
           item.rebateAmount = item.curRebateAmount
@@ -781,7 +801,19 @@ export default {
         this.stockList = res.data
       })
     },
+    handleWarehouseValue(e) {
+      this.correspondName = this.warehouseList.find(k => {
+        return k.id === e
+      }).name
+      this.correspondId = e
+      if (!this.goodsList.length) return
 
+      this.goodsList.forEach(k => {
+        this.$set(k, 'correspondName', this.correspondName)
+        this.$set(k, 'correspondId', this.correspondId)
+      })
+      console.log(this.goodsList)
+    },
     async getSalesmanList() {
       const res = await getSalesmanList({
         pageNum: 1,
@@ -1052,7 +1084,10 @@ export default {
               return
             }
           }
-
+          if (!this.mainForm.isPlanOrder && !this.correspondId) {
+            this.$errorMsg(`仓库必选`)
+            return
+          }
           let goodsList = JSON.parse(JSON.stringify(this.goodsList))
           goodsList.forEach(item => {
             delete item.rebateWallets
@@ -1071,6 +1106,8 @@ export default {
             // mainName,
             k3ServiceId: this.mainForm.salesMan,
             isPlanOrder: this.mainForm.isPlanOrder,
+            correspondName: this.correspondName,
+            correspondId: this.correspondId,
             k3ServiceName: saleManItem.nickName || '',
             fileNo: this.mainForm.fileNum,
             remark: this.mainForm.remark,
@@ -1103,6 +1140,7 @@ export default {
   width: 100%;
   height: 100%;
 }
+
 .main-title {
   display: flex;
   justify-content: space-between;
@@ -1111,24 +1149,29 @@ export default {
   height: 60px;
   border-bottom: 1px solid #dcdfe6;
   margin-bottom: 20px;
+
   .title {
     font-size: 16px;
     font-weight: 600;
     padding-left: 10px;
   }
 }
+
 .tables {
   display: flex;
   margin-top: 10px;
+
   .table {
     width: 45%;
   }
+
   .buttons {
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
     padding: 0 10px;
+
     button {
       margin: 0;
       margin-top: 10px;