Переглянути джерело

Merge tag 'Hotfix-mo-161' into develop

Finish Hotfix-mo-161
莫绍宝 3 роки тому
батько
коміт
b317ce6f79

+ 1 - 1
src/views/supply/engin/components/commerce_detail.vue

@@ -253,7 +253,7 @@
         <el-table :data="deliverGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
           <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
           <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>

+ 40 - 10
src/views/supply/reserve/components/reserve_form.vue

@@ -175,7 +175,7 @@
         <el-table-column align="center" label="预留仓库" prop="correspondId" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
             <el-select v-model="scope.row.correspondId" placeholder="选择预留仓库" size="small" clearable @change="changeWarehouse(scope.$index)">
-              <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
+              <el-option :label="item.name" :value="item.id" v-for="(item, index) in scope.row.warehouseList" :key="index"></el-option>
             </el-select>
           </template>
         </el-table-column>
@@ -391,7 +391,7 @@ export default {
   },
 
   async created() {
-    await this.getWarehouseList();
+    // await this.getWarehouseList();
     // await this.getListStock()
     if(this.listItem) {
       this.getDetail();
@@ -402,11 +402,6 @@ export default {
   },
 
   methods: {
-    getListStock(){
-      getListStock({customerId:JSON.parse(localStorage.getItem("supply_user")).customerId}).then(res=>{
-        console.log(res,'123');
-      })
-    },
     getDate() {
       var date = new Date();
       var seperator1 = "-";
@@ -452,6 +447,11 @@ export default {
         this.mainForm.createMan = data.createBy;
         this.mainForm.createDate = data.createTime;
         this.mainForm.remark = data.remark;
+
+        data.reservedOrderItems.forEach(async item => {
+          item.warehouseList = await this.getListStock(item.customerId);
+        })
+
         this.goodsList = data.reservedOrderItems;
       })
     },
@@ -542,8 +542,28 @@ export default {
       this.dialogSelection = val;
     },
 
+    async getListStock(customerId){
+      const result = await new Promise((resolve, reject) => {
+        getListStock({
+          pageNum: 1,
+          pageSize: -1,
+          customerId: customerId
+        }).then(res => {
+          resolve(res.data.records);
+        }).catch(res => {
+          resolve([]);
+        });
+      });
+      return result;
+      // this.warehouseList = res.data.records;
+    },
+
     // 确定 添加产品
     submitAddGoods() {
+      this.dialogSelection.forEach(async item => {
+        item.warehouseList = await this.getListStock(item.customerId);
+      })
+
       this.goodsList = this.goodsList.concat(this.dialogSelection);
       this.isShowDialog = false;
       this.dialogGoodsList = [];
@@ -595,7 +615,8 @@ export default {
     addGoods() {
       this.goodsList.push({
         reservedStatus: 2,
-        status: 1
+        status: 1,
+        warehouseList: [],
       })
     },
 
@@ -614,15 +635,17 @@ export default {
     },
 
     // 更改经销商
-    changeDealer(index) {
+    async changeDealer(index) {
       console.log(444,index,this.goodsList, this.goodsList[index].customerNumber);
       if(this.goodsList[index].customerNumber) {
         let obj = this.dealerList.find(o => o.number == this.goodsList[index].customerNumber);
         this.goodsList[index].customerName = obj.name;
         this.goodsList[index].customerId = obj.id;
+        this.goodsList[index].warehouseList = await this.getListStock(obj.id);
       }else {
         this.goodsList[index].customerName = '';
         this.goodsList[index].customerId = '';
+        this.goodsList[index].warehouseList = [];
       }
     },
 
@@ -659,7 +682,7 @@ export default {
     // 修改仓库
     changeWarehouse(index) {
       if(this.goodsList[index].correspondId) {
-        let obj = this.warehouseList.find(o => o.id == this.goodsList[index].correspondId);
+        let obj = this.goodsList[index].warehouseList.find(o => o.id == this.goodsList[index].correspondId);
         this.goodsList[index].correspondName = obj.name;
       }else {
         this.goodsList[index].correspondName = '';
@@ -670,6 +693,13 @@ export default {
     clickSubmitForm() {
       this.$refs.mainForm.validate((valid) => {
         if (valid) {
+          for(let i=0; i<this.goodsList.length; i++) {
+            if(!this.goodsList[i].correspondId) {
+              this.$errorMsg('请选择预留仓库');
+              return;
+            }
+          }
+
           let params = {
             // orderTime: this.mainForm.orderDate + ' 00:00:00',
             remark: this.mainForm.remark,

+ 1 - 0
src/views/supply/retail/components/retail_form.vue

@@ -477,6 +477,7 @@ export default {
         data.retailOrderItemList.forEach(item => {
           item.status1 = '';
           item.status2 = '';
+          item.rebateAmount = item.curRebateAmount;
         })
         this.goodsList = data.retailOrderItemList;
       })