|
@@ -76,7 +76,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="客户折扣(custumer discount)" v-bind="validateInfos.custumerDiscount" id="quotationFormForm-custumerDiscount" name="custumerDiscount" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
- <a-input v-model:value="formData.custumerDiscount" placeholder="请输入客户折扣(custumer discount)" allow-clear AutoComplete="off"></a-input>
|
|
|
+ <a-input v-model:value="formData.custumerDiscount" placeholder="请输入客户折扣(custumer discount)" allow-clear AutoComplete="off" @change="changeDiscount"></a-input>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
@@ -445,14 +445,17 @@
|
|
|
saleQuotationFormShipTable.dataSource=arr
|
|
|
}
|
|
|
//增行-产品明细
|
|
|
- function addProduct(data){
|
|
|
- data.map(item=>{
|
|
|
+ async function addProduct(data){
|
|
|
+ for (const item of data){
|
|
|
item.productClass = item.classId_dictText
|
|
|
item.productCode = item.code
|
|
|
// item.unit = item.measurementUnit
|
|
|
item.deliveryTime = formData.deliveryTime
|
|
|
item.productId = item.id
|
|
|
- })
|
|
|
+ var obj = await getRowRate(item)
|
|
|
+ item.taxRate = obj.rateNumber
|
|
|
+ item.grossMargin = obj.grossMargin
|
|
|
+ }
|
|
|
var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
|
|
|
saleQuotationFormProductTable.dataSource=arrProduct
|
|
|
}
|
|
@@ -466,11 +469,20 @@
|
|
|
formData.quotationProjectName = data[0].name
|
|
|
formData.quotationCustomer =data[0].customerId
|
|
|
formData.quotationCustomerName =data[0].customerId_dictText
|
|
|
+ formData.custumerDiscount==data[0].discount
|
|
|
customerOption.value.map(item=>{
|
|
|
if(item.value==data[0].customerId){
|
|
|
formData.priority =item.priority
|
|
|
+ formData.custumerDiscount=item.discount
|
|
|
}
|
|
|
})
|
|
|
+ if(saleQuotationFormProductTable.dataSourc.length>0){
|
|
|
+ var newArr = [...saleQuotationFormProductTable.dataSource]
|
|
|
+ newArr.map(item=>{
|
|
|
+ item.discount = formData.custumerDiscount
|
|
|
+ })
|
|
|
+ saleQuotationFormProductTable.dataSource = newArr
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//获取客户列表
|
|
@@ -485,7 +497,8 @@
|
|
|
value: item.id,
|
|
|
priority:item.priority,
|
|
|
intermediatorCommission:item.intermediatorCommission,
|
|
|
- commission:item.commission
|
|
|
+ commission:item.commission,
|
|
|
+ discount:item.discount
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -517,7 +530,9 @@
|
|
|
res.result.records.forEach(element => {
|
|
|
var obj = {
|
|
|
label: element.name?element.name:'无名称请维护',
|
|
|
- value: element.id?element.id:''
|
|
|
+ value: element.id?element.id:'',
|
|
|
+ taxRate: element.taxRate?element.taxRate:0,
|
|
|
+ grossMargin: element.grossMargin?element.grossMargin:0
|
|
|
};
|
|
|
classOption.value.push( obj)
|
|
|
});
|
|
@@ -534,11 +549,12 @@
|
|
|
formData.quotationPeriodEnd = data[1].format('YYYY-MM-DD')
|
|
|
}
|
|
|
//修改主表交期
|
|
|
- function changeDelivertTime(prop){
|
|
|
+ function changeDelivertTime(){
|
|
|
if(saleQuotationFormProductTable.dataSource.length>0){
|
|
|
- var newArr = [...saleQuotationFormProductTable.dataSource]
|
|
|
+ const xTable = saleQuotationFormProductTableRef.value!.getXTable();
|
|
|
+ var newArr = [...xTable.data]
|
|
|
newArr.map(item=>{
|
|
|
- item.deliveryTime = prop
|
|
|
+ item.deliveryTime = formData.deliveryTime
|
|
|
})
|
|
|
saleQuotationFormProductTable.dataSource = newArr
|
|
|
}
|
|
@@ -579,7 +595,10 @@
|
|
|
var obj = await SelectProjectModalRef.value.getCustom(data[0].inquiryProject)
|
|
|
formData.quotationCustomer =obj.length==0?'':obj[0].customerId
|
|
|
formData.quotationCustomerName =obj.length==0?'':obj[0].customerId_dictText
|
|
|
- data.map(item=>{
|
|
|
+ for (const item of data){
|
|
|
+ var obj = await getRowRate(item)
|
|
|
+ item.taxRate = obj.rateNumber
|
|
|
+ item.grossMargin = obj.grossMargin
|
|
|
item.productClass = item.productClass
|
|
|
item.productCode = item.productCode
|
|
|
item.sourceId = item.childId
|
|
@@ -594,9 +613,11 @@
|
|
|
if(event.value==formData.quotationCustomer){
|
|
|
item.intermediatorCommission = event.intermediatorCommission,
|
|
|
item.customerCommision = event.commission
|
|
|
+ formData.custumerDiscount=event.discount
|
|
|
+ item.discount = event.discount
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
|
|
|
saleQuotationFormProductTable.dataSource=arrProduct
|
|
|
notAllowEdit.value=true
|
|
@@ -604,15 +625,43 @@
|
|
|
formData.quotationProjectName = data[0].projectName
|
|
|
formData.sourceCode = data[0].billCode
|
|
|
formData.priority = data[0].priority
|
|
|
- formData.model = data[0].headModel
|
|
|
+ formData.model = data[0].model
|
|
|
formData.maker = data[0].maker
|
|
|
formData.productionClass = data[0].productionClass
|
|
|
|
|
|
}
|
|
|
+ async function getRowRate(row){
|
|
|
+ var obj= {
|
|
|
+ rateNumber:0,
|
|
|
+ grossMargin:0
|
|
|
+ }
|
|
|
+ let params = {pageSize:'-1',status:1,code:row.productCode}
|
|
|
+ await defHttp.get({url:'/baseCode/baseProductArchive/list',params}, { isTransformResponse: false }).then(res=>{
|
|
|
+ if(res){
|
|
|
+ if(res.result.records[0].taxRate&&res.result.records[0].taxRate!==''){
|
|
|
+ obj.rateNumber= res.result.records[0].taxRate
|
|
|
+ }else{
|
|
|
+ classOption.value.map(event=>{
|
|
|
+ if(event.value==row.productionClass){
|
|
|
+ obj.rateNumber = event.taxRate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ classOption.value.map(event=>{
|
|
|
+ if(event.value==row.productionClass){
|
|
|
+ obj.grossMargin = event.grossMargin
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return obj
|
|
|
+ }
|
|
|
function changeValues(prop){
|
|
|
if(prop.col.key=='purchasePrice'||prop.col.key=='taxRate'||prop.col.key=='tariff'||prop.col.key=='discount'||prop.col.key=='grossMargin'||prop.col.key=='customerCommision'||prop.col.key=='intermediatorCommission'){
|
|
|
if(prop.row.purchasePrice&&prop.row.taxRate&&prop.row.tariff&&prop.row.discount&&prop.row.grossMargin&&prop.row.customerCommision&&prop.row.intermediatorCommission){
|
|
|
- var num= prop.row.purchasePrice/1*(1+prop.row.taxRate/100)*(1+prop.row.tariff/100)*(1-prop.row.discount/100)/(1-prop.row.grossMargin/100-prop.row.customerCommision/100-prop.row.intermediatorCommission/100)
|
|
|
+ //汇率默认为1
|
|
|
+ var num= prop.row.purchasePrice/1*(1+prop.row.taxRate/100)*(1+prop.row.tariff/100)*(prop.row.discount/100)/(1-prop.row.grossMargin/100-prop.row.customerCommision/100-prop.row.intermediatorCommission/100)
|
|
|
prop.row.salePrice = num.toFixed(2)
|
|
|
if(prop.row.quantity){
|
|
|
prop.row.taxAmount = (prop.row.salePrice*prop.row.quantity).toFixed(2)
|
|
@@ -623,6 +672,25 @@
|
|
|
prop.row.taxAmount = (prop.row.salePrice*prop.row.quantity).toFixed(2)
|
|
|
}
|
|
|
}
|
|
|
+ function changeDiscount(){
|
|
|
+ if(saleQuotationFormProductTable.dataSource.length>0){
|
|
|
+ const xTable = saleQuotationFormProductTableRef.value!.getXTable();
|
|
|
+ var newArr = [...xTable.data]
|
|
|
+ newArr.map(item=>{
|
|
|
+ item.discount = formData.custumerDiscount
|
|
|
+ if(item.purchasePrice&&item.taxRate&&item.tariff&&item.discount&&item.grossMargin&&item.customerCommision&&item.intermediatorCommission){
|
|
|
+ //汇率默认为1
|
|
|
+ var num= item.purchasePrice/1*(1+item.taxRate/100)*(1+item.tariff/100)*(item.discount/100)/(1-item.grossMargin/100-item.customerCommision/100-item.intermediatorCommission/100)
|
|
|
+ item.salePrice = num.toFixed(2)
|
|
|
+ if(item.quantity){
|
|
|
+ item.taxAmount = (item.salePrice*item.quantity).toFixed(2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ saleQuotationFormProductTable.dataSource = newArr
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return {
|
|
|
saleQuotationFormShipTableRef,
|
|
|
saleQuotationFormShipTable,
|
|
@@ -671,7 +739,9 @@
|
|
|
queryVersonHistoryData,
|
|
|
addProductFromSupplier,
|
|
|
notAllowEdit,
|
|
|
- changeValues
|
|
|
+ changeValues,
|
|
|
+ getRowRate,
|
|
|
+ changeDiscount
|
|
|
}
|
|
|
}
|
|
|
});
|