|
@@ -610,7 +610,9 @@ import {
|
|
|
sellingCal,
|
|
|
amountCal,
|
|
|
transformCal,
|
|
|
- grossProfitCal
|
|
|
+ grossProfitCal,
|
|
|
+ STGPCal,
|
|
|
+ numCal
|
|
|
} from "@/util/calculate";
|
|
|
export default {
|
|
|
name: "detailsPageEdit",
|
|
@@ -1106,7 +1108,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
cnameChange(row) {
|
|
|
- this.goodsoptions.forEach(e => {
|
|
|
+ this.goodsoptions.forEach(e => {
|
|
|
if (e.id == row.itemId) {
|
|
|
row.cname = e.cname;
|
|
|
row.code = e.code;
|
|
@@ -1385,6 +1387,7 @@ export default {
|
|
|
e.price,
|
|
|
this.form.exchangeRate
|
|
|
);
|
|
|
+ e.exchangeRate = this.form.exchangeRate;
|
|
|
});
|
|
|
}
|
|
|
this.oldExchange = this.deepClone(this.form.exchangeRate);
|
|
@@ -1408,6 +1411,7 @@ export default {
|
|
|
e.price,
|
|
|
this.form.exchangeRate
|
|
|
);
|
|
|
+ e.exchangeRate = this.form.exchangeRate;
|
|
|
});
|
|
|
}
|
|
|
this.oldExchange = this.deepClone(row);
|
|
@@ -1521,6 +1525,7 @@ export default {
|
|
|
);
|
|
|
item.unit = e.unit;
|
|
|
item.remarks = this.reData.remarks;
|
|
|
+ item.exchangeRate = this.reData.exchangeRate;
|
|
|
item.$cellEdit = true;
|
|
|
}
|
|
|
});
|
|
@@ -1557,6 +1562,7 @@ export default {
|
|
|
unit: e.unit,
|
|
|
itemMargin: 0,
|
|
|
remarks: null,
|
|
|
+ exchangeRate: this.form.exchangeRate,
|
|
|
$cellEdit: true
|
|
|
});
|
|
|
});
|
|
@@ -1644,6 +1650,7 @@ export default {
|
|
|
this.form.exchangeRate
|
|
|
),
|
|
|
remarks: null,
|
|
|
+ exchangeRate: this.form.exchangeRate,
|
|
|
$cellEdit: true
|
|
|
});
|
|
|
});
|
|
@@ -1680,11 +1687,32 @@ export default {
|
|
|
this.$refs["form"].validate((valid, done) => {
|
|
|
done();
|
|
|
if (valid) {
|
|
|
+ let amountSum = 0;
|
|
|
+ let reSum = 0;
|
|
|
+ let costSum = 0;
|
|
|
+ let paySum = 0;
|
|
|
if (this.data.length > 0) {
|
|
|
for (let i = 0; i < this.data.length; i++) {
|
|
|
if (this.data[i].corpId == null) {
|
|
|
return this.$message.error(`请输入第${i + 1}行的供应商`);
|
|
|
}
|
|
|
+ amountSum = _.add(
|
|
|
+ amountSum,
|
|
|
+ _.multiply(
|
|
|
+ numCal(this.data[i].amount),
|
|
|
+ numCal(this.data[i].exchangeRate)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ costSum = _.add(
|
|
|
+ costSum,
|
|
|
+ _.multiply(
|
|
|
+ _.add(
|
|
|
+ numCal(this.data[i].purchaseAmount),
|
|
|
+ numCal(this.data[i].partsPrice)
|
|
|
+ ),
|
|
|
+ numCal(this.data[i].orderQuantity)
|
|
|
+ )
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
const orderFeesList = this.$refs.feeInfo.submitData();
|
|
@@ -1698,7 +1726,37 @@ export default {
|
|
|
if (orderFeesList[i].quantity == 0) {
|
|
|
return this.$message.error(`请正确输入第${i + 1}行的数量`);
|
|
|
}
|
|
|
+ if (!orderFeesList[i].currency) {
|
|
|
+ return this.$message.error(`请正确选择第${i + 1}行的币别`);
|
|
|
+ }
|
|
|
+ if (!orderFeesList[i].exchangeRate) {
|
|
|
+ return this.$message.error(`请正确输入第${i + 1}行的汇率`);
|
|
|
+ }
|
|
|
+ if (orderFeesList[i].feesType == 1) {
|
|
|
+ reSum = _.add(
|
|
|
+ reSum,
|
|
|
+ _.multiply(
|
|
|
+ numCal(orderFeesList[i].amount),
|
|
|
+ numCal(orderFeesList[i].exchangeRate)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (orderFeesList[i].feesType == 2) {
|
|
|
+ paySum = _.add(
|
|
|
+ paySum,
|
|
|
+ _.multiply(
|
|
|
+ numCal(orderFeesList[i].amount),
|
|
|
+ numCal(orderFeesList[i].exchangeRate)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
+ this.form.singleTicketMargin = STGPCal(
|
|
|
+ amountSum,
|
|
|
+ reSum,
|
|
|
+ costSum,
|
|
|
+ paySum
|
|
|
+ );
|
|
|
const orderFilesList = this.$refs.uploadFile.submitData();
|
|
|
this.subLoading = true;
|
|
|
submit({
|
|
@@ -1794,7 +1852,7 @@ export default {
|
|
|
e.srcId = e.id;
|
|
|
e.specificationAndModel = e.itemType;
|
|
|
e.productDesc = e.itemDescription;
|
|
|
- delete e.id;
|
|
|
+ (e.exRate0 = e.exchangeRate), delete e.id;
|
|
|
delete e.version;
|
|
|
delete e.status;
|
|
|
delete e.createUser;
|