|
|
@@ -225,7 +225,8 @@ export default {
|
|
|
cityData: [],
|
|
|
channelList: [],
|
|
|
cusFromList: [],
|
|
|
- defaultWhList: [], // 默认仓库
|
|
|
+ canUseWhList: [], // 可用仓库列表
|
|
|
+ defaultWh: null, // 默认仓库
|
|
|
addOrderItemColumns: [
|
|
|
{
|
|
|
field: 'skuModel',
|
|
|
@@ -282,6 +283,7 @@ export default {
|
|
|
return {
|
|
|
skuId: self.currentRow?.skuId,
|
|
|
nonStdCode: self.currentRow?.nonStdCode,
|
|
|
+ orgId: self.formData.orgId,
|
|
|
}
|
|
|
},
|
|
|
fieldUpdate: [
|
|
|
@@ -381,6 +383,7 @@ export default {
|
|
|
return {
|
|
|
skuId: self.currentRow?.skuId,
|
|
|
nonStdCode: self.currentRow?.nonStdCode,
|
|
|
+ orgId: self.formData.orgId,
|
|
|
}
|
|
|
},
|
|
|
fieldUpdate: [
|
|
|
@@ -480,8 +483,8 @@ export default {
|
|
|
this.getChannel();
|
|
|
// 获取数据字典
|
|
|
this.getDictionaryData();
|
|
|
- // 获取默认仓库
|
|
|
- this.getDefaultWh();
|
|
|
+ // 获取可用的仓库列表及默认仓库
|
|
|
+ this.getCanUseWh();
|
|
|
|
|
|
// 设置默认业务员业务部门
|
|
|
this.formData.staffList = []
|
|
|
@@ -529,34 +532,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
- * @desc : 获取默认仓库
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2024-03-02 11:15
|
|
|
- */
|
|
|
- getDefaultWh(orgId) {
|
|
|
- if (!orgId) {
|
|
|
- orgId = this.$store.state.user.orgId
|
|
|
- }
|
|
|
- let params = {orgId: orgId}
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getOrgWh, params, false).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- let list = res.data.filter(it => it.flgDefault)
|
|
|
- if (list.length > 0) {
|
|
|
- this.defaultWhList = list
|
|
|
- } else {
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getWarehouse, {}, false).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- let list = res.data.filter(it => it.flgDefault)
|
|
|
- if (list.length > 0) {
|
|
|
- this.defaultWhList = list
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
* @desc : 业务部门OK
|
|
|
* @date : 2022/5/28 10:43
|
|
|
* @author : 付斌
|
|
|
@@ -571,7 +546,8 @@ export default {
|
|
|
this.formData.orgCode = i.orgCode
|
|
|
this.formData.orgName = i.orgName
|
|
|
this.formData.allocationRatio = i.allocationRatio
|
|
|
- this.getDefaultWh(i.orgId);
|
|
|
+ // 获取可用的仓库列表及默认仓库
|
|
|
+ this.getCanUseWh(i.orgId);
|
|
|
}
|
|
|
//存放从部门id和分配比
|
|
|
this.formData.orgList.push({
|
|
|
@@ -582,18 +558,6 @@ export default {
|
|
|
ownerFlag: i.ownerFlag
|
|
|
})
|
|
|
}
|
|
|
- // 设置默认仓库
|
|
|
- if (this.defaultWhList && this.defaultWhList.length > 0) {
|
|
|
- let table = this.$refs['goodsTable'].tableData
|
|
|
- if (table && table.length > 0) {
|
|
|
- table.forEach(row => {
|
|
|
- if (!row["whId"] || row["whId"] == '') {
|
|
|
- this.$set(row, 'whId', this.defaultWhList[0].whId);
|
|
|
- this.$set(row, 'whName', this.defaultWhList[0].whName);
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
@@ -682,7 +646,8 @@ export default {
|
|
|
this.formData.addressGcj02 = value.addressGcj02;
|
|
|
this.formData.addressFull = value.addressFull + (this.formData.addressNo ? this.formData.addressNo : '');
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
/**
|
|
|
* @desc : 拼写详细地址
|
|
|
* @date : 2022/6/9 10:08
|
|
|
@@ -733,18 +698,20 @@ export default {
|
|
|
let sumStandard = 0; // 标价总额
|
|
|
if (table && table.length > 0) {
|
|
|
table.forEach(row => {
|
|
|
- if (row["itemQty"]) {
|
|
|
- sumQuantity += parseFloat(row["itemQty"]);
|
|
|
+ if (!row["itemQty"] || row["itemQty"] == '') {
|
|
|
+ this.$set(row, 'itemQty', 0);
|
|
|
}
|
|
|
- if (row["itemAmt"]) {
|
|
|
- sumAmount += parseFloat(row["itemAmt"]);
|
|
|
+ if (!row["itemAmt"] || row["itemQty"] == '') {
|
|
|
+ this.$set(row, 'itemAmt', 0);
|
|
|
}
|
|
|
+ sumQuantity += parseFloat(row["itemQty"]);
|
|
|
+ sumAmount += parseFloat(row["itemAmt"]);
|
|
|
this.$set(row, 'amtStd', parseFloat(row["itemQty"]) * parseFloat(row["priceStd"]));
|
|
|
sumStandard += parseFloat(row["amtStd"]);
|
|
|
|
|
|
if (!row["whId"] || row["whId"] == '') {
|
|
|
- this.$set(row, 'whId', this.defaultWhList[0].whId);
|
|
|
- this.$set(row, 'whName', this.defaultWhList[0].whName);
|
|
|
+ this.$set(row, 'whId', this.defaultWh.whId);
|
|
|
+ this.$set(row, 'whName', this.defaultWh.whName);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -930,19 +897,69 @@ export default {
|
|
|
return true;
|
|
|
}
|
|
|
},
|
|
|
- // /**
|
|
|
- // * @desc : 修改客户电话后,清除当前客户信息
|
|
|
- // * @author : 付斌
|
|
|
- // * @date : 2022-08-01 14:39
|
|
|
- // */
|
|
|
- // customerPhoneChange(e, change) {
|
|
|
- // // 文本改变时不清空数据
|
|
|
- // if (!change && this.formData.cusId) {
|
|
|
- // this.clearCutomer()
|
|
|
- // }
|
|
|
- // },
|
|
|
- }
|
|
|
- ,
|
|
|
+
|
|
|
+ // region 私有方法
|
|
|
+ /**
|
|
|
+ * @desc : 获取可用的仓库列表及默认仓库
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-03-02 11:15
|
|
|
+ */
|
|
|
+ getCanUseWh(orgId) {
|
|
|
+ if (!orgId) {
|
|
|
+ orgId = this.$store.state.user.orgId
|
|
|
+ }
|
|
|
+ let params = {orgId: orgId}
|
|
|
+ this.excute(this.$service.commonService, this.$service.commonService.getOrgWh, params, false).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.canUseWhList = [...res.data]
|
|
|
+ let list = res.data.filter(it => it.flgDefault)
|
|
|
+ if (list.length > 0) {
|
|
|
+ this.defaultWh = list[0]
|
|
|
+ // 设置默认仓库
|
|
|
+ this.setDefaultWh()
|
|
|
+ } else {
|
|
|
+ this.excute(this.$service.commonService, this.$service.commonService.getWarehouse, {}, false).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.canUseWhList = [...res.data]
|
|
|
+ let list = res.data.filter(it => it.flgDefault)
|
|
|
+ if (list.length > 0) {
|
|
|
+ this.defaultWh = list[0]
|
|
|
+ // 设置默认仓库
|
|
|
+ this.setDefaultWh()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 设置默认仓库
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2024-04-11 13:56
|
|
|
+ */
|
|
|
+ setDefaultWh() {
|
|
|
+ let table = this.$refs['goodsTable'].tableData
|
|
|
+ if (table && table.length > 0) {
|
|
|
+ table.forEach(row => {
|
|
|
+ if (row.skuId) {
|
|
|
+ if (row.whId) {
|
|
|
+ let list2 = this.canUseWhList.filter(it => it.whId === row.whId)
|
|
|
+ if (list2.length == 0) {
|
|
|
+ this.$set(row, 'whId', this.defaultWh.whId);
|
|
|
+ this.$set(row, 'whName', this.defaultWh.whName);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$set(row, 'whId', this.defaultWh.whId);
|
|
|
+ this.$set(row, 'whName', this.defaultWh.whName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // endregion 私有方法
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 在实例创建完成后被立即同步调用
|
|
|
* @author : 付斌
|