|
|
@@ -72,26 +72,19 @@
|
|
|
<el-form-item
|
|
|
style="margin-bottom: 20px"
|
|
|
:prop="'datasource.' + scope.$index + '.sendTotalWeight'"
|
|
|
- :rules="[
|
|
|
- {
|
|
|
- required: [2, 3].includes(Number(sourceType)) && pricingWay == 2,
|
|
|
- message: '请输入数字',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]"
|
|
|
>
|
|
|
- {{ scope.row.sendTotalWeight1 }}
|
|
|
<el-input-number
|
|
|
:controls="false"
|
|
|
v-model="scope.row.sendTotalWeight"
|
|
|
- @blur="changeSendTotalWeight(scope.$index)"
|
|
|
+ @blur="setIcreaseTotalWeight(scope.$index)"
|
|
|
style="width: 60%; margin-right: 10px"
|
|
|
+ :disabled="!outsourceSendCode"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
- v-if="[2, 3].includes(Number(sourceType)) && outsourceSendCode"
|
|
|
+ v-if="outsourceSendCode"
|
|
|
@click.native="(e) => handleOutBound(e, scope.row, scope.$index)"
|
|
|
>选择
|
|
|
</el-button>
|
|
|
@@ -104,8 +97,7 @@
|
|
|
<el-input-number
|
|
|
:controls="false"
|
|
|
v-model="scope.row.receiveTotalWeight"
|
|
|
- @blur="changeSendTotalWeight(scope.$index)"
|
|
|
-
|
|
|
+ @blur="setIcreaseTotalWeight(scope.$index)"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
@@ -118,8 +110,7 @@
|
|
|
<el-input-number
|
|
|
:controls="false"
|
|
|
v-model="scope.row.increaseTotalWeight"
|
|
|
- @blur="changeSendTotalWeight(scope.$index)"
|
|
|
-
|
|
|
+ :disabled="true"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
</el-input-number>
|
|
|
@@ -702,17 +693,7 @@
|
|
|
const data = this.warehouseList.find(
|
|
|
(item) => item.id == row.warehouseId
|
|
|
);
|
|
|
- // if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
|
|
|
- // row.warehouseId = '';
|
|
|
- // return this.$message.error('同一个产品不能选择相同的仓库');
|
|
|
- // }
|
|
|
- // this.form.datasource.forEach((item, i) => {
|
|
|
- // if (row.productCode == item.productCode && !item.warehouseId) {
|
|
|
- // this.$set(this.form.datasource[i], 'warehouseName', data.name);
|
|
|
- // this.$set(this.form.datasource[i], 'warehouseCode', data.code);
|
|
|
- // this.$set(this.form.datasource[i], 'warehouseId', data.id);
|
|
|
- // }
|
|
|
- // });
|
|
|
+
|
|
|
this.$set(this.form.datasource[index], 'warehouseName', data.name);
|
|
|
this.$set(this.form.datasource[index], 'warehouseCode', data.code);
|
|
|
this.$set(this.form.datasource[index], 'warehouseId', data.id);
|
|
|
@@ -732,7 +713,7 @@
|
|
|
this.$set(this.form.datasource[i], 'warehouseId', data.id);
|
|
|
}
|
|
|
});
|
|
|
- this.warehouseShow=false
|
|
|
+ this.warehouseShow = false;
|
|
|
},
|
|
|
handleTaskinstance(row, index) {
|
|
|
this.taskinstanceDialogFlag = true;
|
|
|
@@ -749,11 +730,7 @@
|
|
|
row.produceRoutingId
|
|
|
);
|
|
|
},
|
|
|
- //修改发货总重
|
|
|
- changeSendTotalWeight(index) {
|
|
|
- this.curIndex = index;
|
|
|
- this.setIcreaseTotalWeight();
|
|
|
- },
|
|
|
+
|
|
|
//出库单详情
|
|
|
handleOutBound(e, rows, index) {
|
|
|
this.curIndex = index;
|
|
|
@@ -773,7 +750,6 @@
|
|
|
num += Number(row.weight);
|
|
|
return num;
|
|
|
}, 0);
|
|
|
- console.log(totalWeight, 'totalWeight');
|
|
|
this.$set(
|
|
|
this.form.datasource[this.curIndex],
|
|
|
'sendTotalWeight',
|
|
|
@@ -782,103 +758,77 @@
|
|
|
this.$forceUpdate();
|
|
|
this.$refs.table.reload();
|
|
|
|
|
|
- console.log(
|
|
|
- this.form.datasource[this.curIndex],
|
|
|
- 'this.form.datasource[this.curIndex]'
|
|
|
- );
|
|
|
- // this.setIcreaseTotalWeight();
|
|
|
+ this.setIcreaseTotalWeight(this.curIndex);
|
|
|
},
|
|
|
//修改数量更新合计/总重
|
|
|
changeNum(val, index, row) {
|
|
|
- this.curIndex = index;
|
|
|
- if (row.pricingWay == 2) {
|
|
|
- if (val != this.form.datasource[index].orderTotalCount) {
|
|
|
- this.$set(this.form.datasource[index], 'sendTotalWeight', '');
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'receiveTotalWeight',
|
|
|
- Number(val) * Number(this.form.datasource[index].singleWeight)
|
|
|
- );
|
|
|
- } else {
|
|
|
- let find =
|
|
|
- this.oldSendTotalWeightList.find(
|
|
|
- (key) =>
|
|
|
- key.productCode == this.form.datasource[index].productCode
|
|
|
- ) || {};
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'sendTotalWeight',
|
|
|
- find.oldSendTotalWeight || ''
|
|
|
- );
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'receiveTotalWeight',
|
|
|
- Number(val) * Number(this.form.datasource[index].singleWeight)
|
|
|
- );
|
|
|
- }
|
|
|
- this.setIcreaseTotalWeight();
|
|
|
- this.getWeightPrice();
|
|
|
- } else {
|
|
|
+ this.setWeight(index);
|
|
|
+ this.getTotalPrice(index);
|
|
|
+ },
|
|
|
+ setWeight(index) {
|
|
|
+ let data = this.form.datasource[index];
|
|
|
+ let totalCount = data.totalCount;
|
|
|
+ let singleWeight = data.singleWeight;
|
|
|
+ let sendTotalWeight = data.sendTotalWeight;
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'receiveTotalWeight',
|
|
|
+ totalCount * singleWeight || 0
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'increaseTotalWeight',
|
|
|
+ Number(this.form.datasource[index].receiveTotalWeight) -
|
|
|
+ Number(sendTotalWeight)
|
|
|
+ );
|
|
|
+ },
|
|
|
+ getTotalPrice(index) {
|
|
|
+ let data = this.form.datasource[index];
|
|
|
+ let singlePrice = data.singlePrice;
|
|
|
+ let discountSinglePrice = data.discountSinglePrice;
|
|
|
+ let totalCount = data.totalCount;
|
|
|
+ if (data['pricingWay'] == 2) {
|
|
|
+ let increaseTotalWeight = data.increaseTotalWeight;
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
'totalPrice',
|
|
|
- (Number(this.form.datasource[index].singlePrice) * val).toFixed(2)
|
|
|
+ (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
|
|
|
);
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
'discountTotalPrice',
|
|
|
- (
|
|
|
- Number(this.form.datasource[index].discountSinglePrice) * val
|
|
|
- ).toFixed(2)
|
|
|
+ (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(
|
|
|
+ 2
|
|
|
+ )
|
|
|
);
|
|
|
+ }
|
|
|
+ if (this.form.datasource[index]['pricingWay'] == 1) {
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
- 'receiveTotalWeight',
|
|
|
- Number(this.form.datasource[index].totalCount) *
|
|
|
- Number(this.form.datasource[index].singleWeight)
|
|
|
+ 'totalPrice',
|
|
|
+ (Number(totalCount) * Number(singlePrice)).toFixed(2)
|
|
|
);
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
- 'increaseTotalWeight',
|
|
|
- Number(this.form.datasource[index].totalCount) *
|
|
|
- Number(this.form.datasource[index].singleWeight)
|
|
|
+ 'discountTotalPrice',
|
|
|
+ (Number(totalCount) * Number(discountSinglePrice)).toFixed(2)
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
- getWeightPrice() {
|
|
|
- if (this.form.datasource[this.curIndex]['pricingWay'] != 2) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let increaseTotalWeight =
|
|
|
- this.form.datasource[this.curIndex].increaseTotalWeight;
|
|
|
- let singlePrice = this.form.datasource[this.curIndex].singlePrice;
|
|
|
- let discountSinglePrice =
|
|
|
- this.form.datasource[this.curIndex].discountSinglePrice;
|
|
|
- this.$set(
|
|
|
- this.form.datasource[this.curIndex],
|
|
|
- 'totalPrice',
|
|
|
- (Number(increaseTotalWeight) * Number(singlePrice)).toFixed(2)
|
|
|
- );
|
|
|
- this.$set(
|
|
|
- this.form.datasource[this.curIndex],
|
|
|
- 'discountTotalPrice',
|
|
|
- (Number(discountSinglePrice) * Number(increaseTotalWeight)).toFixed(2)
|
|
|
- );
|
|
|
- },
|
|
|
//设置增重总重
|
|
|
- setIcreaseTotalWeight() {
|
|
|
+ setIcreaseTotalWeight(index) {
|
|
|
let receiveTotalWeight = Number(
|
|
|
- this.form.datasource[this.curIndex].receiveTotalWeight
|
|
|
+ this.form.datasource[index].receiveTotalWeight
|
|
|
);
|
|
|
let sendTotalWeight = Number(
|
|
|
- this.form.datasource[this.curIndex].sendTotalWeight
|
|
|
+ this.form.datasource[index].sendTotalWeight
|
|
|
);
|
|
|
this.$set(
|
|
|
- this.form.datasource[this.curIndex],
|
|
|
+ this.form.datasource[index],
|
|
|
'increaseTotalWeight',
|
|
|
(receiveTotalWeight - sendTotalWeight).toFixed(2)
|
|
|
);
|
|
|
- this.getWeightPrice();
|
|
|
+ this.getTotalPrice(index);
|
|
|
this.$refs.table.reload();
|
|
|
},
|
|
|
//选择产品回调
|
|
|
@@ -890,36 +840,6 @@
|
|
|
this.form.datasource.length,
|
|
|
copyObj(obj)
|
|
|
);
|
|
|
- this.form.datasource.forEach((item, index) => {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'receiveTotalWeight',
|
|
|
- item.receiveTotalWeight ||
|
|
|
- Number(item.totalCount) * Number(item.singleWeight) ||
|
|
|
- 0
|
|
|
- );
|
|
|
-
|
|
|
- if (this.outsourceSendCode) {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'increaseTotalWeight',
|
|
|
- Number(item.receiveTotalWeight) - Number(item.sendTotalWeight)
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'increaseTotalWeight',
|
|
|
- item.increaseTotalWeight || item.receiveTotalWeight || 0
|
|
|
- );
|
|
|
- }
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'sendTotalWeight',
|
|
|
- item.sendTotalWeight || 0
|
|
|
- );
|
|
|
- item.pricingWay = item.pricingWay || this.pricingWay;
|
|
|
- this.changeNum(item.totalCount, index, item);
|
|
|
- });
|
|
|
},
|
|
|
changeParentMain(obj) {
|
|
|
obj.forEach(async (item, index) => {
|
|
|
@@ -945,6 +865,8 @@
|
|
|
this.$set(parasm, 'pricingWay', item.pricingWay || 1);
|
|
|
this.$set(parasm, 'singlePrice', 0);
|
|
|
this.$set(parasm, 'discountSinglePrice', 0);
|
|
|
+ this.$set(parasm, 'sendTotalWeight', 0);
|
|
|
+ this.$set(parasm, 'increaseTotalWeight', 0);
|
|
|
|
|
|
this.$set(
|
|
|
parasm,
|
|
|
@@ -1000,38 +922,43 @@
|
|
|
};
|
|
|
});
|
|
|
this.form.datasource.forEach((item, index) => {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'receiveTotalWeight',
|
|
|
- item.receiveTotalWeight ||
|
|
|
- Number(item.totalCount) * Number(item.singleWeight) ||
|
|
|
- 0
|
|
|
- );
|
|
|
- if (this.outsourceSendCode) {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'increaseTotalWeight',
|
|
|
- Number(item.receiveTotalWeight) - Number(item.sendTotalWeight)
|
|
|
- );
|
|
|
- } else {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'increaseTotalWeight',
|
|
|
- item.increaseTotalWeight || item.receiveTotalWeight || 0
|
|
|
- );
|
|
|
- }
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'sendTotalWeight',
|
|
|
- item.sendTotalWeight || 0
|
|
|
- );
|
|
|
- item.pricingWay = item.pricingWay || this.pricingWay;
|
|
|
- this.changeNum(item.totalCount, index, item);
|
|
|
+ this.init(item, index);
|
|
|
+ this.getTotalPrice(index);
|
|
|
});
|
|
|
this.$refs.table.reload();
|
|
|
this.$forceUpdate();
|
|
|
});
|
|
|
},
|
|
|
+ init(item, index) {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'receiveTotalWeight',
|
|
|
+ item.receiveTotalWeight ||
|
|
|
+ item.totalWeight ||
|
|
|
+ Number(item.totalCount) * Number(item.singleWeight) ||
|
|
|
+ 0
|
|
|
+ );
|
|
|
+ if (this.outsourceSendCode) {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'sendTotalWeight',
|
|
|
+ item.totalWeight || 0
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'increaseTotalWeight',
|
|
|
+ Number(this.form.datasource[index].receiveTotalWeight) -
|
|
|
+ Number(this.form.datasource[index].sendTotalWeight)
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'increaseTotalWeight',
|
|
|
+ item.increaseTotalWeight || item.receiveTotalWeight || 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ this.$set(this.form.datasource[index], 'pricingWay', 2);
|
|
|
+ },
|
|
|
|
|
|
remove(i) {
|
|
|
this.form.datasource.splice(i, 1);
|