diff --git a/src/composables/useStockingForm.ts b/src/composables/useStockingForm.ts index 5b1d284..9cc2d0b 100644 --- a/src/composables/useStockingForm.ts +++ b/src/composables/useStockingForm.ts @@ -541,12 +541,21 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { (it as any).reduction_price_currency, targetCurrency ) - return ( + const profit = unit - - (retrofit + fob + listing + handling + port + ocean + commission + purchaseTax + retention + accessory) + + (retrofit + + fob + + listing + + handling + + port + + ocean + + commission + + purchaseTax + + retention + + accessory) + taxRefund + reduction - ) + return Number(profit.toFixed(2)) } // 新车/里程<=0:保持原有计算(官方指导价与优惠) @@ -560,12 +569,21 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { (it as any).discount_currency, targetCurrency ) - return ( + const profit = unit - - (retrofit + fob + guide + handling + port + ocean + commission + purchaseTax + retention + accessory) + + (retrofit + + fob + + guide + + handling + + port + + ocean + + commission + + purchaseTax + + retention + + accessory) + taxRefund + discount - ) + return Number(profit.toFixed(2)) } // 计算报关价 = 收款价 - 挂账 @@ -597,7 +615,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { ) const base = official - discount const refund = base * 0.115 - return refund < 0 ? 0 : refund + return refund < 0 ? 0 : Number(refund.toFixed(2)) } // 计算车价:车价 = 报关价 - FOB运费 - 港杂费 - 海运费 @@ -857,7 +875,9 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { // 合同字段兼容字符串或数组 baseForm.contract = Array.isArray(res.contract) ? res.contract - : (res.contract ? String(res.contract).split(',') : []) + : res.contract + ? String(res.contract).split(',') + : [] baseForm.biz_date = res.biz_date || '' baseForm.clearance_country_id = res.clearance_country_id || '' baseForm.clearance_country_snapshot = res.clearance_country_snapshot || '' @@ -995,7 +1015,9 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { : String(res.contract).split(',') const contractUrlsArr: string[] = Array.isArray(res.contract_url) ? (res.contract_url as string[]) - : (res.contract_url ? String(res.contract_url).split(',') : []) + : res.contract_url + ? String(res.contract_url).split(',') + : [] baseForm.contract = contractNamesArr baseForm.contract_url = contractUrlsArr contractFiles.value = contractNamesArr.map((fileName: string, index: number) => ({ @@ -1012,7 +1034,9 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { : String(res.pi_doc).split(',') const piUrlsArr: string[] = Array.isArray(res.pi_doc_url) ? (res.pi_doc_url as string[]) - : (res.pi_doc_url ? String(res.pi_doc_url).split(',') : []) + : res.pi_doc_url + ? String(res.pi_doc_url).split(',') + : [] baseForm.pi_doc = piNamesArr baseForm.pi_doc_url = piUrlsArr piFiles.value = piNamesArr.map((fileName: string, index: number) => ({ @@ -1029,7 +1053,9 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { : String(res.transaction_slip).split(',') const slipUrlsArr: string[] = Array.isArray(res.transaction_slip_url) ? (res.transaction_slip_url as string[]) - : (res.transaction_slip_url ? String(res.transaction_slip_url).split(',') : []) + : res.transaction_slip_url + ? String(res.transaction_slip_url).split(',') + : [] baseForm.transaction_slip = slipNamesArr baseForm.transaction_slip_url = slipUrlsArr waterBillFiles.value = slipNamesArr.map((fileName: string, index: number) => ({ @@ -1048,15 +1074,15 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { const handleSubmit = async (type: number, edit?: string, isfinal?: string) => { // 提交校验:最终提交且为提交动作时(type=1),必须填写 VIN const isFinalFlag = isfinal === '1' || (isfinal as any) === true - if(type === 1&&baseForm.contract.length == 0){ + if (type === 1 && baseForm.contract.length == 0) { ElMessage.error('请上传合同文件') return } - if(type === 1&&baseForm.pi_doc.length == 0){ + if (type === 1 && baseForm.pi_doc.length == 0) { ElMessage.error('请上传pi文件') return } - if(type === 1&& baseForm.transaction_slip.length == 0){ + if (type === 1 && baseForm.transaction_slip.length == 0) { ElMessage.error('请上传水单文件') return } @@ -1131,7 +1157,11 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { // 从提交参数中移除 settlement_currency const baseFormWithoutCur = { ...(baseForm as any) } - baseFormWithoutCur.cif_total = wrapMoney(baseFormWithoutCur.cif_total, baseFormWithoutCur.cif_total_currency, '合计') + baseFormWithoutCur.cif_total = wrapMoney( + baseFormWithoutCur.cif_total, + baseFormWithoutCur.cif_total_currency, + '合计' + ) // delete (baseFormWithoutCur as any).cif_total delete (baseFormWithoutCur as any).cif_total_currency