|
@@ -182,6 +182,16 @@
|
|
|
<a-input v-model:value="formData.placeDelivery" placeholder="请输入交货地点(place of delivery)" allow-clear AutoComplete="off" />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item
|
|
|
+ label="毛利率(grossMargin)"
|
|
|
+ v-bind="validateInfos.grossMarginHead"
|
|
|
+ id="quotationFormForm-grossMarginHead"
|
|
|
+ name="grossMarginHead"
|
|
|
+ >
|
|
|
+ <a-input v-model:value="formData.grossMarginHead" placeholder="" allow-clear AutoComplete="off" disabled/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item
|
|
|
label="客户折扣(custumer discount)"
|
|
@@ -463,6 +473,7 @@
|
|
|
sourceCode: '',
|
|
|
exchangeRate: '',
|
|
|
agreementTerms: '',
|
|
|
+ grossMarginHead:''
|
|
|
});
|
|
|
|
|
|
//表单验证
|
|
@@ -572,8 +583,9 @@
|
|
|
}
|
|
|
//保存
|
|
|
async function submitForm() {
|
|
|
- if (formData.sourceCode == '') {
|
|
|
- message.warning('请添加供应商报价选定');
|
|
|
+ const xTable = saleQuotationFormProductTableRef.value!.getXTable()
|
|
|
+ if (xTable.data.length==0) {
|
|
|
+ message.warning('请添加明细');
|
|
|
} else {
|
|
|
saleQuotationFormProductTableRef.value!.validateTable().then(async (errMap) => {
|
|
|
if (errMap) {
|
|
@@ -861,6 +873,7 @@
|
|
|
formData.currency = '美元';
|
|
|
formData.exchangeRate = '1';
|
|
|
await getShipList(data[0].headId);
|
|
|
+ // countGrossMargin()
|
|
|
// await changeDiscountOrExchangeRate()
|
|
|
}
|
|
|
function getShipList(id) {
|
|
@@ -930,6 +943,7 @@
|
|
|
prop.row.taxAmount = (prop.row.salePrice * prop.row.quantity).toFixed(2);
|
|
|
}
|
|
|
}
|
|
|
+ countGrossMargin()
|
|
|
}
|
|
|
function changeDiscountOrExchangeRate() {
|
|
|
if (saleQuotationFormProductTable.dataSource.length > 0) {
|
|
@@ -958,6 +972,7 @@
|
|
|
// }
|
|
|
});
|
|
|
saleQuotationFormProductTable.dataSource = newArr;
|
|
|
+ countGrossMargin()
|
|
|
}
|
|
|
}
|
|
|
function setSonList(){
|
|
@@ -973,6 +988,21 @@
|
|
|
saleQuotationFormProductTable.dataSource =[...xTable]
|
|
|
changeDiscountOrExchangeRate()
|
|
|
}
|
|
|
+ function countGrossMargin(){
|
|
|
+ var customerCommisionAll = 0,
|
|
|
+ platformCommisionAll=0,
|
|
|
+ salePriceAll=0,
|
|
|
+ purchasePriceAll=0
|
|
|
+ var xTable = (saleQuotationFormProductTableRef.value!.getXTable()).data
|
|
|
+ xTable.map(item=>{
|
|
|
+ customerCommisionAll +=(Number(item.customerCommision)/ 100)*Number(item.taxAmount)
|
|
|
+ platformCommisionAll +=(Number(item.intermediatorCommission)/ 100)*Number(item.taxAmount)
|
|
|
+ salePriceAll+=Number(item.taxAmount)
|
|
|
+ purchasePriceAll+=Number(item.purchaseAmount)
|
|
|
+ })
|
|
|
+ formData.grossMarginHead = (salePriceAll-customerCommisionAll-platformCommisionAll-purchasePriceAll)/salePriceAll
|
|
|
+ formData.grossMarginHead =Number( formData.grossMarginHead).toFixed(2)*100
|
|
|
+ }
|
|
|
return {
|
|
|
saleQuotationFormShipTableRef,
|
|
|
saleQuotationFormShipTable,
|