|
@@ -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,
|