修改备货单 等页面
This commit is contained in:
+140
-107
@@ -37,41 +37,19 @@
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.clearance_country_snapshot =
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addr || '')
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addrs || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in countryOptions"
|
||||
:key="item.id"
|
||||
:label="item.cn_addr"
|
||||
:label="item.cn_addrs"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<ElInput v-model="baseForm.clearance_country_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="客户来源" label-width="114px">
|
||||
<el-select
|
||||
v-model="baseForm.customer_source_id"
|
||||
filterable
|
||||
placeholder="请选择客户渠道"
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.customer_source_snapshot =
|
||||
(channelOptions || []).find((x: any) => x.id === val)?.name || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in channelOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<ElInput v-model="baseForm.customer_source_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="客户名称" label-width="114px">
|
||||
<ElInput
|
||||
@@ -87,25 +65,53 @@
|
||||
<ElInput v-model="baseForm.customer_id" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="客户来源" label-width="114px">
|
||||
<el-tooltip class="box-item" content="如需修改客户来源,请先编辑修改客户资料">
|
||||
<el-select
|
||||
v-model="baseForm.customer_source_id"
|
||||
filterable
|
||||
disabled
|
||||
placeholder="请选择客户渠道"
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.customer_source_snapshot =
|
||||
(channelOptions || []).find((x: any) => x.id === val)?.name || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in channelOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
<ElInput v-model="baseForm.customer_source_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="客户所在国" label-width="114px">
|
||||
<el-select
|
||||
v-model="baseForm.customer_country_id"
|
||||
filterable
|
||||
placeholder="请选择国家"
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.customer_country_snapshot =
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addr || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in countryOptions"
|
||||
:key="item.id"
|
||||
:label="item.cn_addr"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-tooltip class="box-item" content="如需修改客户所在国,请先编辑修改客户资料">
|
||||
<el-select
|
||||
v-model="baseForm.customer_country_id"
|
||||
filterable
|
||||
placeholder="请选择国家"
|
||||
disabled
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.customer_country_snapshot =
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addrs || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in countryOptions"
|
||||
:key="item.id"
|
||||
:label="item.cn_addrs"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
<ElInput v-model="baseForm.customer_country_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
@@ -120,7 +126,7 @@
|
||||
</div>
|
||||
<ElForm class="items-wrap" label-position="right">
|
||||
<div class="item-row form-box" v-for="(item, idx) in items" :key="idx">
|
||||
<ElRow :gutter="12">
|
||||
<ElRow :gutter="12" class="item-row-wrap">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="车型" label-width="85px">
|
||||
<ElInput
|
||||
@@ -205,18 +211,18 @@
|
||||
</el-select>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="里程" label-width="85px">
|
||||
<ElInput v-model="item.mileage" placeholder="请输入里程" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-if="(item.mileage ?? 0) <= 0">
|
||||
</ElRow>
|
||||
<ElRow :gutter="12" class="item-row-wrap">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4" v-if="(item.mileage ?? 0) <= 0">
|
||||
<ElFormItem label="官方指导价" label-width="85px">
|
||||
<ElInput v-model="item.official_price" placeholder="请输入官方指导价">
|
||||
<template #suffix>
|
||||
<ElSelect v-model="item.guide_price_currency" style="width: 64px;border: none;">
|
||||
<ElSelect v-model="item.guide_price_currency" style="width: 64px; border: none">
|
||||
<ElOption
|
||||
v-for="c in currencyOptions"
|
||||
:key="c.currency_code"
|
||||
@@ -229,7 +235,7 @@
|
||||
<ElInput v-model="item.guide_price_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-else>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4" v-else>
|
||||
<ElFormItem label="二手挂牌价" label-width="85px">
|
||||
<ElInput v-model="item.listing_price" placeholder="请输入二手挂牌价">
|
||||
<template #suffix>
|
||||
@@ -246,7 +252,7 @@
|
||||
<ElInput v-model="item.listing_price_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-if="(item.mileage ?? 0) <= 0">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4" v-if="(item.mileage ?? 0) <= 0">
|
||||
<ElFormItem label="优惠" label-width="85px">
|
||||
<ElInput v-model="item.discount_price" placeholder="请输入优惠额">
|
||||
<template #suffix>
|
||||
@@ -263,7 +269,7 @@
|
||||
<ElInput v-model="item.discount_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6" v-else>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4" v-else>
|
||||
<ElFormItem label="优惠" label-width="85px">
|
||||
<ElInput v-model="item.reduction_price" placeholder="请输入优惠">
|
||||
<template #suffix>
|
||||
@@ -280,7 +286,9 @@
|
||||
<ElInput v-model="item.reduction_price_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
</ElRow>
|
||||
<ElRow :gutter="12" class="item-row-wrap">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="手续费" label-width="85px">
|
||||
<ElInput v-model="item.handling_fee" placeholder="请输入手续费">
|
||||
<template #suffix>
|
||||
@@ -297,7 +305,7 @@
|
||||
<ElInput v-model="item.helper_fee_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="改装费" label-width="85px">
|
||||
<ElInput v-model="item.retrofit_fee" placeholder="请输入改装费">
|
||||
<template #suffix>
|
||||
@@ -314,7 +322,7 @@
|
||||
<ElInput v-model="item.modify_fee_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="FOB段运费" label-width="85px">
|
||||
<ElInput v-model="item.fob_transport_fee" placeholder="请输入FOB段运费">
|
||||
<template #suffix>
|
||||
@@ -331,7 +339,7 @@
|
||||
<ElInput v-model="item.fob_fee_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="港杂费" label-width="85px">
|
||||
<ElInput v-model="item.port_misc_fee" placeholder="请输入港杂费">
|
||||
<template #suffix>
|
||||
@@ -348,7 +356,7 @@
|
||||
<ElInput v-model="item.port_fee_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="海运费" label-width="85px">
|
||||
<ElInput v-model="item.ocean_freight" placeholder="请输入海运费">
|
||||
<template #suffix>
|
||||
@@ -365,7 +373,9 @@
|
||||
<ElInput v-model="item.ocean_freight_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
</ElRow>
|
||||
<ElRow :gutter="12" class="item-row-wrap">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="成交价" label-width="85px">
|
||||
<ElInput v-model="item.unit_price" placeholder="请输入成交价">
|
||||
<template #suffix>
|
||||
@@ -382,7 +392,7 @@
|
||||
<ElInput v-model="item.unit_price_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="总价" label-width="85px">
|
||||
<ElInput v-model="item.total_price" placeholder="请输入总价">
|
||||
<template #suffix>
|
||||
@@ -399,7 +409,7 @@
|
||||
<ElInput v-model="item.total_price_currency_snapshot" type="hidden" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="4">
|
||||
<ElFormItem label="利润" label-width="85px">
|
||||
<ElInput
|
||||
v-model="item.profit"
|
||||
@@ -413,9 +423,9 @@
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :span="24" class="row-actions">
|
||||
<el-tag effect="light" type="success" @click="copyRow(idx)"> 复制 </el-tag>
|
||||
<el-tag effect="light" @click="addRowAfter(idx)" v-if="idx == items.length - 1">
|
||||
<ElCol :span="24" style="text-align: right">
|
||||
<el-tag effect="light" type="success" @click="copyRow(idx)" class="row-actions"> 复制 </el-tag>
|
||||
<el-tag effect="light" @click="addRowAfter(idx)" v-if="idx == items.length - 1" class="row-actions">
|
||||
新增
|
||||
</el-tag>
|
||||
<el-tag type="danger" effect="light" @click="removeRow(idx)" v-if="items.length > 1">
|
||||
@@ -423,7 +433,6 @@
|
||||
</el-tag>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
|
||||
</div>
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
@@ -510,7 +519,8 @@
|
||||
@change="
|
||||
(val) =>
|
||||
(baseForm.shipping_method_snapshot =
|
||||
(transportOptions || []).find((x: any) => x.item_value === val)?.item_label || '')
|
||||
(transportOptions || []).find((x: any) => x.item_value === val)?.item_label ||
|
||||
'')
|
||||
"
|
||||
>
|
||||
<ElOption
|
||||
@@ -591,21 +601,26 @@
|
||||
<ElForm :model="payment" label-width="55px" class="payment-form" label-position="right">
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :sm="12" :md="12" :lg="6" :xl="6">
|
||||
<ElFormItem label="汇款人">
|
||||
<ElFormItem label="汇款人" label-width="55px">
|
||||
<ElInput v-model="payment.remitter_name" placeholder="请选择汇款人" />
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
|
||||
<ElFormItem label="汇款国">
|
||||
<el-select v-model="payment.remit_country_id" filterable placeholder="请选择汇款国" @change="
|
||||
<ElFormItem label="汇款国" label-width="55px">
|
||||
<el-select
|
||||
v-model="payment.remit_country_id"
|
||||
filterable
|
||||
placeholder="请选择汇款国"
|
||||
@change="
|
||||
(val) =>
|
||||
(payment.remit_country_name_snapshot =
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addr || '')
|
||||
">
|
||||
(countryOptions || []).find((x: any) => x.id === val)?.cn_addrs || '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in countryOptions"
|
||||
:key="item.id"
|
||||
:label="item.cn_addr"
|
||||
:label="item.cn_addrs"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
@@ -613,7 +628,7 @@
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="4" :xl="4">
|
||||
<ElFormItem label="日期">
|
||||
<ElFormItem label="日期" label-width="55px">
|
||||
<ElDatePicker
|
||||
v-model="payment.remit_date"
|
||||
type="date"
|
||||
@@ -625,12 +640,17 @@
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="5" :xl="5">
|
||||
<ElFormItem label="账户">
|
||||
<ElSelect v-model="payment.account_id" placeholder="请选择账户" @change="
|
||||
<ElFormItem label="账户" label-width="55px">
|
||||
<ElSelect
|
||||
v-model="payment.account_id"
|
||||
placeholder="请选择账户"
|
||||
@change="
|
||||
(val) =>
|
||||
(payment.account_name_snapshot =
|
||||
(accountOptions || []).find((x: any) => x.id === val)?.account_number || '')
|
||||
">
|
||||
(accountOptions || []).find((x: any) => x.id === val)?.account_number ||
|
||||
'')
|
||||
"
|
||||
>
|
||||
<ElOption
|
||||
v-for="item in accountOptions"
|
||||
:key="item.id"
|
||||
@@ -642,7 +662,7 @@
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :sm="12" :md="12" :lg="5" :xl="5">
|
||||
<ElFormItem label="金额">
|
||||
<ElFormItem label="金额" label-width="55px">
|
||||
<ElInput v-model="payment.amount" placeholder="请输入金额">
|
||||
<template #suffix>
|
||||
<ElSelect
|
||||
@@ -650,7 +670,9 @@
|
||||
style="width: 64px"
|
||||
@change="
|
||||
(val) => {
|
||||
const found = (currencyOptions || []).find((x: any) => x.currency_code === val)
|
||||
const found = (currencyOptions || []).find(
|
||||
(x: any) => x.currency_code === val
|
||||
)
|
||||
payment.currency_name_snapshot = found?.currency_name || ''
|
||||
}
|
||||
"
|
||||
@@ -669,9 +691,21 @@
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
<ElRow :gutter="12">
|
||||
<ElCol :span="24" style="text-align: right;">
|
||||
<ElButton type="danger" size="small" @click="removePaymentItem(idx)" :disabled="paymentItems.length === 1">删除</ElButton>
|
||||
<ElButton type="primary" size="small" @click="addPaymentItem" v-if="idx === paymentItems.length - 1">添加收款信息</ElButton>
|
||||
<ElCol :span="24" style="text-align: right">
|
||||
<ElButton
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="removePaymentItem(idx)"
|
||||
:disabled="paymentItems.length === 1"
|
||||
>删除</ElButton
|
||||
>
|
||||
<ElButton
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="addPaymentItem"
|
||||
v-if="idx === paymentItems.length - 1"
|
||||
>添加收款信息</ElButton
|
||||
>
|
||||
</ElCol>
|
||||
</ElRow>
|
||||
</ElForm>
|
||||
@@ -821,11 +855,15 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { CrmService } from '@/api/crmApi'
|
||||
import { useStockingForm } from '@/composables/useStockingForm'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
|
||||
defineOptions({ name: 'StockingAdd' }) // 定义组件名称,用于 KeepAlive 缓存控制
|
||||
|
||||
const { getUserInfo } = useUserStore()
|
||||
|
||||
const route = useRoute()
|
||||
const stocking_id = route.query.id
|
||||
// 使用公共的备货单表单逻辑
|
||||
const {
|
||||
// 数据
|
||||
@@ -835,7 +873,7 @@
|
||||
contractFile,
|
||||
customerDialog,
|
||||
vehicleDialog,
|
||||
|
||||
|
||||
// 选项数据
|
||||
channelOptions,
|
||||
countryOptions,
|
||||
@@ -849,41 +887,42 @@
|
||||
ncolorOptions,
|
||||
transportOptions,
|
||||
trade_termsOptions,
|
||||
|
||||
|
||||
// 上传相关
|
||||
actionImageUplode,
|
||||
uploadHeaders,
|
||||
|
||||
|
||||
// 方法
|
||||
initializeForm,
|
||||
populateFromDetail,
|
||||
handleSubmit,
|
||||
getCurrencyRate,
|
||||
validateContractRate,
|
||||
wrapMoney,
|
||||
calcProfit,
|
||||
|
||||
|
||||
// 合同文件方法
|
||||
isImageFile,
|
||||
beforeContractUpload,
|
||||
handleContractUpload,
|
||||
removeContractFile,
|
||||
|
||||
|
||||
// 订单项方法
|
||||
copyRow,
|
||||
addRowAfter,
|
||||
removeRow,
|
||||
|
||||
|
||||
// 收款项方法
|
||||
addPaymentItem,
|
||||
removePaymentItem,
|
||||
|
||||
|
||||
// 客户选择方法
|
||||
openCustomerDialog,
|
||||
getCustomerList,
|
||||
handleCustomerSizeChange,
|
||||
handleCustomerCurrentChange,
|
||||
chooseCustomer,
|
||||
|
||||
|
||||
// 车辆选择方法
|
||||
openVehicleDialog,
|
||||
getVehicleList,
|
||||
@@ -891,10 +930,19 @@
|
||||
handleVehicleCurrentChange,
|
||||
chooseVehicle
|
||||
} = useStockingForm(false) // isFinal = false
|
||||
// 获取详情数据
|
||||
const getdetilfn = async () => {
|
||||
const res = await CrmService.getStockDetail({ id: stocking_id })
|
||||
populateFromDetail(res)
|
||||
}
|
||||
|
||||
// 初始化表单
|
||||
onMounted(async () => {
|
||||
await initializeForm()
|
||||
// 如果有ID,代表复制 加载详情数据
|
||||
if (stocking_id) {
|
||||
await getdetilfn()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -944,10 +992,7 @@
|
||||
}
|
||||
|
||||
.row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
/* 利润为负数时,输入文字变红(兼容 Element Plus disabled 样式) */
|
||||
@@ -962,18 +1007,6 @@
|
||||
background-color: var(--el-fill-color-blank) !important;
|
||||
box-shadow: 0 0 0 1px var(--el-input-border-color, #dcdfe6) inset !important;
|
||||
}
|
||||
.row-actions span {
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.row-actions .primary {
|
||||
color: var(--el-color-primary);
|
||||
cursor: pointer;
|
||||
}
|
||||
.row-actions .danger {
|
||||
color: var(--el-color-danger);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.submit-wrap {
|
||||
display: flex;
|
||||
@@ -1042,7 +1075,7 @@
|
||||
text-align: right;
|
||||
}
|
||||
.form-box {
|
||||
border-bottom: 1px solid #F2F4F6;
|
||||
border-bottom: 1px solid #f2f4f6;
|
||||
margin-bottom: 20px;
|
||||
padding: 8px 0px 20px;
|
||||
}
|
||||
@@ -1050,4 +1083,4 @@
|
||||
// :deep(.el-form-item__label) {
|
||||
// text-align: right;
|
||||
// }
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user