|
@@ -51,7 +51,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
|
<a-form-item label="币种(currency)" v-bind="validateInfos.currency" id="quotationFormForm-currency" name="currency" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
- <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" />
|
|
|
+ <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" @change="changeExchangeRate"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :span="12">
|
|
@@ -187,7 +187,7 @@
|
|
|
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
|
|
|
- import { querysaleQuotationFormShipListByMainId,querysaleVersonFormShipListByMainId,querySaleQuotationFormProductListByMainId, querySaleVersonProductListByMainId,queryDataById, saveOrUpdate,HistoryQuotation,queryVersonHistoryById } from '../quotationForm.api';
|
|
|
+ import { querysaleQuotationFormShipListByMainId,querysaleVersonFormShipListByMainId,querySaleQuotationFormProductListByMainId, querySaleVersonProductListByMainId,queryDataById, saveOrUpdate,HistoryQuotation,queryVersonHistoryById,queryRate } from '../quotationForm.api';
|
|
|
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
|
|
import {saleQuotationFormShipColumns, saleQuotationFormProductColumns} from '../quotationForm.data';
|
|
|
import SelectShipSModal from '../../../publicComponents/SelectShipSModal.vue';
|
|
@@ -335,6 +335,20 @@
|
|
|
formData.saleDepartmentName = userStore.getUserInfo.orgName
|
|
|
notAllowEdit.value = false
|
|
|
}
|
|
|
+ async function changeExchangeRate(){
|
|
|
+ if(formData.currency!=='美元'){
|
|
|
+ var param={
|
|
|
+ month:moment(new Date()).month()+1,
|
|
|
+ year :moment(new Date()).year(),
|
|
|
+ currency:formData.currency
|
|
|
+ }
|
|
|
+ var info = await queryRate(param)
|
|
|
+ formData.exchangeRate=info
|
|
|
+ }else{
|
|
|
+ formData.exchangeRate=1
|
|
|
+ }
|
|
|
+ changeDiscountOrExchangeRate()
|
|
|
+ }
|
|
|
//编辑方法
|
|
|
async function edit(row) {
|
|
|
//主表数据
|
|
@@ -468,7 +482,9 @@
|
|
|
item.discount= formData.custumerDiscount!==''?formData.custumerDiscount:''
|
|
|
}
|
|
|
var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
|
|
|
- saleQuotationFormProductTable.dataSource=arrProduct
|
|
|
+ saleQuotationFormProductTable.dataSource=arrProduct
|
|
|
+ formData.currency = '美元'
|
|
|
+ formData.exchangeRate = '1'
|
|
|
}
|
|
|
//选择项目
|
|
|
function addProject(data) {
|
|
@@ -481,11 +497,14 @@
|
|
|
formData.quotationCustomer =data[0].customerId
|
|
|
formData.quotationCustomerName =data[0].customerId_dictText
|
|
|
formData.custumerDiscount==data[0].discount
|
|
|
+ formData.currency = '美元'
|
|
|
+ formData.exchangeRate = '1'
|
|
|
customerOption.value.map(item=>{
|
|
|
if(item.value==data[0].customerId){
|
|
|
formData.priority =item.priority
|
|
|
formData.custumerDiscount=item.discount
|
|
|
formData.paymentTerms=item.paymentTerms
|
|
|
+ formData.currency=item.currency
|
|
|
}
|
|
|
})
|
|
|
if(saleQuotationFormProductTable.dataSource.length>0){
|
|
@@ -511,7 +530,8 @@
|
|
|
intermediatorCommission:item.intermediatorCommission,
|
|
|
commission:item.commission,
|
|
|
discount:item.discount,
|
|
|
- paymentTerms:item.paymentTerms
|
|
|
+ paymentTerms:item.paymentTerms,
|
|
|
+ currency:item.currency
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -621,7 +641,7 @@
|
|
|
item.supplierCurrency = item.currency
|
|
|
item.supplierId = item.selectionSupplier
|
|
|
item.supplierName = item.selectionSupplier_dictText
|
|
|
- item.purchasePrice = item.taxPrice
|
|
|
+ item.purchasePrice = item.taxPriceUsd
|
|
|
item.taxAmount = 0
|
|
|
}
|
|
|
var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
|
|
@@ -633,6 +653,7 @@
|
|
|
formData.custumerDiscount=event.discount
|
|
|
item.discount = event.discount
|
|
|
formData.paymentTerms = event.paymentTerms
|
|
|
+ formData.currency=event.currency
|
|
|
}
|
|
|
})
|
|
|
})
|
|
@@ -646,6 +667,17 @@
|
|
|
formData.maker = data[0].maker
|
|
|
formData.productionClass = data[0].productionClass
|
|
|
formData.deliveryDayHead = data[0].deliveryDayChild
|
|
|
+ formData.currency = '美元'
|
|
|
+ formData.exchangeRate = '1'
|
|
|
+ getShipList(data[0].headId)
|
|
|
+ }
|
|
|
+ function getShipList(id){
|
|
|
+ let params = {id:id}
|
|
|
+ defHttp.get({url:'/saleCode/saleInquiryForm/querySaleInquiryFormShipByMainId',params}, { isTransformResponse: false }).then(res=>{
|
|
|
+ if(res){
|
|
|
+ saleQuotationFormShipTable.dataSource = res.result
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
async function getRowRate(row){
|
|
|
var obj= {
|
|
@@ -679,7 +711,7 @@
|
|
|
//汇率默认为1
|
|
|
formData.exchangeRate = (formData.exchangeRate==''||formData.exchangeRate===null)?1:formData.exchangeRate
|
|
|
var num= prop.row.purchasePrice/Number(formData.exchangeRate)*(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)
|
|
|
- prop.row.salePrice = num.toFixed(2)
|
|
|
+ prop.row.salePrice = !isNaN(num)?num.toFixed(2):''
|
|
|
if(prop.row.quantity){
|
|
|
prop.row.taxAmount = (prop.row.salePrice*prop.row.quantity).toFixed(2)
|
|
|
}
|
|
@@ -694,15 +726,15 @@
|
|
|
var newArr = [...xTable.data]
|
|
|
formData.exchangeRate = (formData.exchangeRate==''||formData.exchangeRate===null)?1:formData.exchangeRate
|
|
|
newArr.map(item=>{
|
|
|
- item.discount = formData.custumerDiscount
|
|
|
- if(item.purchasePrice&&item.taxRate&&item.tariff&&item.discount&&item.grossMargin&&item.customerCommision&&item.intermediatorCommission){
|
|
|
+ item.discount = (formData.custumerDiscount==''||formData.custumerDiscount===null)?formData.custumerDiscount:item.discount
|
|
|
//汇率默认为1
|
|
|
var num= item.purchasePrice/Number(formData.exchangeRate)*(1+item.taxRate/100)*(1+item.tariff/100)*(1-item.discount/100)/(1-item.grossMargin/100-item.customerCommision/100-item.intermediatorCommission/100)
|
|
|
- item.salePrice = num.toFixed(2)
|
|
|
+ item.salePrice = !isNaN(num)?num.toFixed(2):''
|
|
|
+
|
|
|
if(item.quantity){
|
|
|
item.taxAmount = (item.salePrice*item.quantity).toFixed(2)
|
|
|
}
|
|
|
- }
|
|
|
+ // }
|
|
|
})
|
|
|
saleQuotationFormProductTable.dataSource = newArr
|
|
|
}
|
|
@@ -759,6 +791,7 @@
|
|
|
changeValues,
|
|
|
getRowRate,
|
|
|
changeDiscountOrExchangeRate,
|
|
|
+ changeExchangeRate
|
|
|
}
|
|
|
}
|
|
|
});
|