diff --git a/src/composables/useStockingForm.ts b/src/composables/useStockingForm.ts index eed63a3..8860ae3 100644 --- a/src/composables/useStockingForm.ts +++ b/src/composables/useStockingForm.ts @@ -478,6 +478,13 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { return (val * rateFrom) / rateTo } + const getCurrencyName = (code?: string) => { + if (!code) return '' + return ( + (currencyOptions?.value || []).find((c: any) => c.currency_code === code)?.currency_name || '' + ) + } + // 利润=收款价-官方指导价/二手挂牌价+优惠-手续费-改装费-配件费-fob运费-港杂-海运-佣金-挂账-购置税+预估退税 const calcProfit = (it: any): number => { const targetCurrency = 'CNY' // 固定使用人民币 @@ -1271,6 +1278,33 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) { } ) + watch( + () => currencyOptions?.value, + () => { + baseForm.cif_total_currency_snapshot = getCurrencyName(baseForm.cif_total_currency) + }, + { immediate: true } + ) + + watch( + () => baseForm.cif_total_currency, + (newCode, oldCode) => { + baseForm.cif_total_currency_snapshot = getCurrencyName(newCode) + if ( + isPopulating.value || + !oldCode || + !newCode || + newCode === oldCode || + baseForm.cif_total === undefined || + baseForm.cif_total === null + ) { + return + } + const converted = convertCurrency(baseForm.cif_total, oldCode, newCode) + baseForm.cif_total = Number(converted.toFixed(2)) + } + ) + watch( items, (val) => { diff --git a/src/views/crmpc/stocking/stocking_list.vue b/src/views/crmpc/stocking/stocking_list.vue index 4e2d203..d6b0e77 100644 --- a/src/views/crmpc/stocking/stocking_list.vue +++ b/src/views/crmpc/stocking/stocking_list.vue @@ -148,7 +148,11 @@ 作废