备货单 添加 加价 将内勤专属 移到打印查看里面
This commit is contained in:
@@ -125,6 +125,9 @@ export interface ItemRow {
|
||||
car_price: number | undefined
|
||||
car_price_currency: string
|
||||
car_price_currency_snapshot: string
|
||||
increase_price?: number | undefined
|
||||
increase_price_currency?: string
|
||||
increase_price_currency_snapshot?: string
|
||||
}
|
||||
|
||||
export interface PaymentItem {
|
||||
@@ -193,10 +196,10 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
clearance_port_snapshot: '',
|
||||
latest_arrival_date: '',
|
||||
contract_exchange_rate: '',
|
||||
settlement_currency: 'USD',
|
||||
settlement_currency: 'CNY',
|
||||
remark: '',
|
||||
cif_total: undefined,
|
||||
cif_total_currency: 'USD',
|
||||
cif_total_currency: 'CNY',
|
||||
cif_total_currency_snapshot: '',
|
||||
is_final: isFinal ? '1' : '0',
|
||||
object_id: stockingId || '0',
|
||||
@@ -217,11 +220,11 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
_echo_vin: false,
|
||||
mileage: 0,
|
||||
listing_price: undefined,
|
||||
listing_price_currency: 'USD',
|
||||
listing_price_currency_snapshot: '美元',
|
||||
listing_price_currency: 'CNY',
|
||||
listing_price_currency_snapshot: '人民币',
|
||||
reduction_price: undefined,
|
||||
reduction_price_currency: 'USD',
|
||||
reduction_price_currency_snapshot: '美元',
|
||||
reduction_price_currency: 'CNY',
|
||||
reduction_price_currency_snapshot: '人民币',
|
||||
color_interior_code: '',
|
||||
color_interior_snapshot: '',
|
||||
color_exterior_code: '',
|
||||
@@ -232,62 +235,65 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
port_misc_fee: '',
|
||||
remark: '',
|
||||
ocean_freight: '',
|
||||
ocean_freight_currency: 'USD',
|
||||
ocean_freight_currency_snapshot: '美元',
|
||||
ocean_freight_currency: 'CNY',
|
||||
ocean_freight_currency_snapshot: '人民币',
|
||||
commission: '',
|
||||
commission_currency: 'USD',
|
||||
commission_currency_snapshot: '美元',
|
||||
commission_currency: 'CNY',
|
||||
commission_currency_snapshot: '人民币',
|
||||
purchase_tax: '',
|
||||
purchase_tax_currency: 'USD',
|
||||
purchase_tax_currency_snapshot: '美元',
|
||||
purchase_tax_currency: 'CNY',
|
||||
purchase_tax_currency_snapshot: '人民币',
|
||||
tax_refund: '',
|
||||
tax_refund_currency: 'CNY',
|
||||
tax_refund_currency_snapshot: '人民币',
|
||||
clearance_price: undefined,
|
||||
clearance_price_currency: 'USD',
|
||||
clearance_price_currency_snapshot: '美元',
|
||||
clearance_price_currency: 'CNY',
|
||||
clearance_price_currency_snapshot: '人民币',
|
||||
retrofit_fee: '',
|
||||
total_price: undefined,
|
||||
official_price: undefined,
|
||||
discount_price: undefined,
|
||||
fob_fee: undefined,
|
||||
fob_fee_currency: 'USD',
|
||||
fob_fee_currency_snapshot: '美元',
|
||||
fob_fee_currency: 'CNY',
|
||||
fob_fee_currency_snapshot: '人民币',
|
||||
helper_fee: undefined,
|
||||
helper_fee_currency: 'USD',
|
||||
helper_fee_currency_snapshot: '美元',
|
||||
helper_fee_currency: 'CNY',
|
||||
helper_fee_currency_snapshot: '人民币',
|
||||
domestic_freight: undefined,
|
||||
domestic_freight_currency: 'USD',
|
||||
domestic_freight_currency_snapshot: '美元',
|
||||
domestic_freight_currency: 'CNY',
|
||||
domestic_freight_currency_snapshot: '人民币',
|
||||
port_fee: undefined,
|
||||
port_fee_currency: 'USD',
|
||||
port_fee_currency_snapshot: '美元',
|
||||
unit_price_currency: 'USD',
|
||||
unit_price_currency_snapshot: '美元',
|
||||
total_price_currency: 'USD',
|
||||
total_price_currency_snapshot: '美元',
|
||||
guide_price_currency: 'USD',
|
||||
guide_price_currency_snapshot: '美元',
|
||||
port_fee_currency: 'CNY',
|
||||
port_fee_currency_snapshot: '人民币',
|
||||
unit_price_currency: 'CNY',
|
||||
unit_price_currency_snapshot: '人民币',
|
||||
total_price_currency: 'CNY',
|
||||
total_price_currency_snapshot: '人民币',
|
||||
guide_price_currency: 'CNY',
|
||||
guide_price_currency_snapshot: '人民币',
|
||||
discount: undefined,
|
||||
discount_currency: 'USD',
|
||||
discount_currency_snapshot: '美元',
|
||||
discount_currency: 'CNY',
|
||||
discount_currency_snapshot: '人民币',
|
||||
contract_rate: 7.16,
|
||||
profit: undefined,
|
||||
profit_currency: 'CNY',
|
||||
profit_currency_snapshot: '人民币',
|
||||
modify_ids: [],
|
||||
modify_list: [],
|
||||
modify_fee_currency: 'USD',
|
||||
modify_fee_currency_snapshot: '美元',
|
||||
modify_fee_currency: 'CNY',
|
||||
modify_fee_currency_snapshot: '人民币',
|
||||
accessory_price: undefined,
|
||||
accessory_price_currency: 'USD',
|
||||
accessory_price_currency_snapshot: '美元',
|
||||
accessory_price_currency: 'CNY',
|
||||
accessory_price_currency_snapshot: '人民币',
|
||||
retention_price: undefined,
|
||||
retention_price_currency: 'USD',
|
||||
retention_price_currency_snapshot: '美元',
|
||||
retention_price_currency: 'CNY',
|
||||
retention_price_currency_snapshot: '人民币',
|
||||
car_price: undefined,
|
||||
car_price_currency: 'USD',
|
||||
car_price_currency_snapshot: '美元'
|
||||
car_price_currency: 'CNY',
|
||||
car_price_currency_snapshot: '人民币',
|
||||
increase_price: undefined,
|
||||
increase_price_currency: 'CNY',
|
||||
increase_price_currency_snapshot: '人民币'
|
||||
})
|
||||
|
||||
// 创建新的收款项
|
||||
@@ -295,8 +301,8 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
remit_country_id: '',
|
||||
remit_country_name_snapshot: '',
|
||||
remit_date: '',
|
||||
currency_code: 'USD',
|
||||
currency_name_snapshot: '美元',
|
||||
currency_code: 'CNY',
|
||||
currency_name_snapshot: '人民币',
|
||||
account_id: '',
|
||||
account_name_snapshot: '',
|
||||
remitter_name: '',
|
||||
@@ -433,7 +439,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
}
|
||||
|
||||
const validateContractRate = () => {
|
||||
const code = baseForm.settlement_currency || items.value[0]?.unit_price_currency || 'USD'
|
||||
const code = baseForm.settlement_currency || items.value[0]?.unit_price_currency || 'CNY'
|
||||
const { min, max } = getCurrencyBounds(code)
|
||||
const val = Number(baseForm.contract_exchange_rate)
|
||||
if (Number.isNaN(val)) return
|
||||
@@ -463,8 +469,8 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
const convertCurrency = (amount: any, fromCode?: string, toCode?: string): number => {
|
||||
const val = amount === undefined || amount === null || amount === '' ? 0 : Number(amount)
|
||||
if (Number.isNaN(val)) return 0
|
||||
const from = fromCode || 'USD'
|
||||
const to = toCode || 'USD'
|
||||
const from = fromCode || 'CNY'
|
||||
const to = toCode || 'CNY'
|
||||
if (from === to) return val
|
||||
const rateFrom = getRateNumber(from)
|
||||
const rateTo = getRateNumber(to) || 1
|
||||
@@ -528,6 +534,12 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
(it as any).accessory_price_currency,
|
||||
targetCurrency
|
||||
)
|
||||
//加价
|
||||
const increase = convertCurrency(
|
||||
it.increase_price ?? (it as any).increase_price,
|
||||
(it as any).increase_price_currency,
|
||||
targetCurrency
|
||||
)
|
||||
const mileageVal = Number(it.mileage ?? 0)
|
||||
if (mileageVal > 0) {
|
||||
// 二手车:用挂牌价与二手减价替代官方指导价与优惠
|
||||
@@ -552,6 +564,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
commission +
|
||||
purchaseTax +
|
||||
retention +
|
||||
increase +
|
||||
accessory) +
|
||||
taxRefund +
|
||||
reduction
|
||||
@@ -580,6 +593,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
commission +
|
||||
purchaseTax +
|
||||
retention +
|
||||
increase +
|
||||
accessory) +
|
||||
taxRefund +
|
||||
discount
|
||||
@@ -588,7 +602,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
|
||||
// 计算报关价 = 收款价 - 挂账
|
||||
const calcClearanceFee = (it: any): number => {
|
||||
const targetCurrency = it.clearance_price_currency || baseForm.settlement_currency || 'USD'
|
||||
const targetCurrency = it.clearance_price_currency || baseForm.settlement_currency || 'CNY'
|
||||
const unit = convertCurrency(it.unit_price, it.unit_price_currency, targetCurrency)
|
||||
const retention = convertCurrency(
|
||||
it.retention_price ?? (it as any).retention_price,
|
||||
@@ -620,7 +634,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
|
||||
// 计算车价:车价 = 报关价 - FOB运费 - 港杂费 - 海运费
|
||||
const calcCarPrice = (it: any): number => {
|
||||
const targetCurrency = it.car_price_currency || baseForm.settlement_currency || 'USD'
|
||||
const targetCurrency = it.car_price_currency || baseForm.settlement_currency || 'CNY'
|
||||
const clearance = convertCurrency(
|
||||
it.clearance_price ?? (it as any).clearance_price,
|
||||
(it as any).clearance_price_currency,
|
||||
@@ -899,10 +913,10 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
baseForm.clearance_port_snapshot = res.clearance_port_snapshot || ''
|
||||
baseForm.latest_arrival_date = res.latest_arrival_date || ''
|
||||
baseForm.remark = res.remark || ''
|
||||
baseForm.settlement_currency = res.settlement_currency || 'USD'
|
||||
baseForm.settlement_currency = res.settlement_currency || 'CNY'
|
||||
// 合计与汇率
|
||||
baseForm.cif_total = res.cif_total.amount ? Number(res.cif_total.amount) : undefined
|
||||
baseForm.cif_total_currency = res.cif_total.currency || 'USD'
|
||||
baseForm.cif_total_currency = res.cif_total.currency || 'CNY'
|
||||
baseForm.contract_exchange_rate = res.contract_exchange_rate
|
||||
// 明细
|
||||
const list = Array.isArray(res.veh_list) ? res.veh_list : []
|
||||
@@ -913,10 +927,10 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
mileage: it.mileage ?? 0,
|
||||
model_snapshot: it.model_snapshot || '',
|
||||
listing_price: it.listing_price?.amount ? Number(it.listing_price.amount) : undefined,
|
||||
listing_price_currency: it.listing_price?.currency || 'USD',
|
||||
listing_price_currency: it.listing_price?.currency || 'CNY',
|
||||
listing_price_currency_snapshot: '',
|
||||
reduction_price: it.reduction_price?.amount ? Number(it.reduction_price.amount) : undefined,
|
||||
reduction_price_currency: it.reduction_price?.currency || 'USD',
|
||||
reduction_price_currency: it.reduction_price?.currency || 'CNY',
|
||||
reduction_price_currency_snapshot: '',
|
||||
color_interior_code: it.color_interior_code || '',
|
||||
color_interior_snapshot: it.color_interior_snapshot || '',
|
||||
@@ -930,38 +944,38 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
port_misc_fee: it.port_misc_fee?.amount ?? '',
|
||||
remark: it.remark || '',
|
||||
ocean_freight: it.ocean_freight?.amount ?? '',
|
||||
ocean_freight_currency: it.ocean_freight?.currency || 'USD',
|
||||
ocean_freight_currency: it.ocean_freight?.currency || 'CNY',
|
||||
ocean_freight_currency_snapshot: '',
|
||||
commission: it.commission?.amount ?? '',
|
||||
commission_currency: it.commission?.currency || 'USD',
|
||||
commission_currency: it.commission?.currency || 'CNY',
|
||||
commission_currency_snapshot: '',
|
||||
purchase_tax: it.purchase_tax?.amount ?? '',
|
||||
purchase_tax_currency: it.purchase_tax?.currency || 'USD',
|
||||
purchase_tax_currency: it.purchase_tax?.currency || 'CNY',
|
||||
purchase_tax_currency_snapshot: '',
|
||||
retrofit_fee: it.retrofit_fee?.amount ?? '',
|
||||
total_price: it.total_price?.amount ? Number(it.total_price.amount) : undefined,
|
||||
official_price: it.official_price?.amount ? Number(it.official_price.amount) : undefined,
|
||||
discount_price: it.discount_price?.amount ? Number(it.discount_price.amount) : undefined,
|
||||
fob_fee: undefined,
|
||||
fob_fee_currency: it.fob_transport_fee?.currency || 'USD',
|
||||
fob_fee_currency: it.fob_transport_fee?.currency || 'CNY',
|
||||
fob_fee_currency_snapshot: '',
|
||||
helper_fee: undefined,
|
||||
helper_fee_currency: it.handling_fee?.currency || 'USD',
|
||||
helper_fee_currency: it.handling_fee?.currency || 'CNY',
|
||||
helper_fee_currency_snapshot: '',
|
||||
domestic_freight: undefined,
|
||||
domestic_freight_currency: it.domestic_freight?.currency || 'USD',
|
||||
domestic_freight_currency: it.domestic_freight?.currency || 'CNY',
|
||||
domestic_freight_currency_snapshot: '',
|
||||
port_fee: undefined,
|
||||
port_fee_currency: it.port_misc_fee?.currency || 'USD',
|
||||
port_fee_currency: it.port_misc_fee?.currency || 'CNY',
|
||||
port_fee_currency_snapshot: '',
|
||||
unit_price_currency: it.unit_price?.currency || 'USD',
|
||||
unit_price_currency: it.unit_price?.currency || 'CNY',
|
||||
unit_price_currency_snapshot: '',
|
||||
total_price_currency: it.total_price?.currency || 'USD',
|
||||
total_price_currency: it.total_price?.currency || 'CNY',
|
||||
total_price_currency_snapshot: '',
|
||||
guide_price_currency: it.official_price?.currency || 'USD',
|
||||
guide_price_currency: it.official_price?.currency || 'CNY',
|
||||
guide_price_currency_snapshot: '',
|
||||
discount: undefined,
|
||||
discount_currency: it.discount_price?.currency || 'USD',
|
||||
discount_currency: it.discount_price?.currency || 'CNY',
|
||||
discount_currency_snapshot: '',
|
||||
contract_rate: baseForm.contract_exchange_rate
|
||||
? Number(baseForm.contract_exchange_rate)
|
||||
@@ -969,7 +983,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
profit: it.profit?.amount ? Number(it.profit.amount) : undefined,
|
||||
profit_type_snapshot: '',
|
||||
clearance_price: it.clearance_price?.amount ? Number(it.clearance_price.amount) : undefined,
|
||||
clearance_price_currency: it.clearance_price?.currency || 'USD',
|
||||
clearance_price_currency: it.clearance_price?.currency || 'CNY',
|
||||
clearance_price_currency_snapshot: '',
|
||||
modify_ids: Array.isArray(it.modify_list)
|
||||
? it.modify_list.map((m: any) => Number(m.option_id))
|
||||
@@ -980,20 +994,23 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
option_name_snapshot: m.option_name_snapshot
|
||||
}))
|
||||
: [],
|
||||
modify_fee_currency: it.retrofit_fee?.currency || 'USD',
|
||||
modify_fee_currency: it.retrofit_fee?.currency || 'CNY',
|
||||
modify_fee_currency_snapshot: '',
|
||||
tax_refund: it.tax_refund?.amount ?? '',
|
||||
tax_refund_currency: it.tax_refund?.currency || 'USD',
|
||||
tax_refund_currency: it.tax_refund?.currency || 'CNY',
|
||||
tax_refund_currency_snapshot: '',
|
||||
accessory_price: it.accessory_price?.amount ? Number(it.accessory_price.amount) : undefined,
|
||||
accessory_price_currency: it.accessory_price?.currency || 'USD',
|
||||
accessory_price_currency: it.accessory_price?.currency || 'CNY',
|
||||
accessory_price_currency_snapshot: '',
|
||||
retention_price: it.retention_price?.amount ? Number(it.retention_price.amount) : undefined,
|
||||
retention_price_currency: it.retention_price?.currency || 'USD',
|
||||
retention_price_currency: it.retention_price?.currency || 'CNY',
|
||||
retention_price_currency_snapshot: '',
|
||||
car_price: it.car_price?.amount ? Number(it.car_price.amount) : undefined,
|
||||
car_price_currency: it.car_price?.currency || 'USD',
|
||||
car_price_currency_snapshot: ''
|
||||
car_price_currency: it.car_price?.currency || 'CNY',
|
||||
car_price_currency_snapshot: '',
|
||||
increase_price: it.increase_price?.amount ? Number(it.increase_price.amount) : undefined,
|
||||
increase_price_currency: it.increase_price?.currency || 'CNY',
|
||||
increase_price_currency_snapshot: ''
|
||||
}))
|
||||
// 计划收款
|
||||
const pays = Array.isArray(res.account_list) ? res.account_list : []
|
||||
@@ -1152,7 +1169,8 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
'配件价'
|
||||
),
|
||||
retention_price: wrapMoney(it.retention_price, (it as any).retention_price_currency, '挂账'),
|
||||
car_price: wrapMoney(it.car_price, (it as any).car_price_currency, '车价')
|
||||
car_price: wrapMoney(it.car_price, (it as any).car_price_currency, '车价'),
|
||||
increase_price: wrapMoney(it.increase_price, (it as any).increase_price_currency, '加价')
|
||||
}))
|
||||
|
||||
// 从提交参数中移除 settlement_currency
|
||||
@@ -1221,13 +1239,13 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
// // 确保报关价货币单位与计算结果一致
|
||||
// if (items.value[index]) {
|
||||
// ;(items.value[index] as any).clearance_price_currency =
|
||||
// it.clearance_price_currency || baseForm.settlement_currency || 'USD'
|
||||
// it.clearance_price_currency || baseForm.settlement_currency || 'CNY'
|
||||
// }
|
||||
// }
|
||||
// const refund = calcTaxRefund(it)
|
||||
// if (items.value[index]) {
|
||||
// items.value[index].tax_refund = isNaN(refund) ? 0 : (Number(refund.toFixed(2)) as any)
|
||||
// ;(items.value[index] as any).tax_refund_currency = baseForm.settlement_currency || 'USD'
|
||||
// ;(items.value[index] as any).tax_refund_currency = baseForm.settlement_currency || 'CNY'
|
||||
// }
|
||||
// })
|
||||
}
|
||||
@@ -1265,7 +1283,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
// 确保报关价货币单位与计算结果一致
|
||||
if (items.value[index]) {
|
||||
;(items.value[index] as any).clearance_price_currency =
|
||||
it.clearance_price_currency || baseForm.settlement_currency || 'USD'
|
||||
it.clearance_price_currency || baseForm.settlement_currency || 'CNY'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1281,7 +1299,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
if (items.value[index]) {
|
||||
items.value[index].car_price = isNaN(carPrice) ? 0 : Number(carPrice.toFixed(2))
|
||||
;(items.value[index] as any).car_price_currency =
|
||||
it.car_price_currency || baseForm.settlement_currency || 'USD'
|
||||
it.car_price_currency || baseForm.settlement_currency || 'CNY'
|
||||
}
|
||||
})
|
||||
// 合计到岸价 = 所有报关价相加
|
||||
@@ -1351,7 +1369,7 @@ export function useStockingForm(isFinal = false, stockingId?: string | number) {
|
||||
])
|
||||
|
||||
// 设置默认汇率
|
||||
baseForm.contract_exchange_rate = getCurrencyRate('USD')
|
||||
baseForm.contract_exchange_rate = getCurrencyRate('CNY')
|
||||
|
||||
// 设置预计发送日默认为当天
|
||||
const today = new Date()
|
||||
|
||||
Reference in New Issue
Block a user