fix: 修改bug,首页门店没过滤删除的
This commit is contained in:
@@ -109,7 +109,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="购置税凭证" prop="purchaseTaxInvoiceUrls" required>
|
||||
<el-form-item label="购置税凭证" prop="purchaseTaxInvoiceUrls">
|
||||
<UploadImgs v-model="formData.purchaseTaxInvoiceUrls" :limit="10" :file-size="10" :file-type="['image/jpeg', 'image/png', 'image/jpg', 'image/gif']" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -182,6 +182,7 @@
|
||||
placeholder="请选择门店"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="handleStoreChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="store in storeList"
|
||||
@@ -538,14 +539,6 @@ const formRules = reactive({
|
||||
},
|
||||
trigger: 'change'
|
||||
}],
|
||||
purchaseTaxInvoiceUrls: [{
|
||||
required: true,
|
||||
validator: (_: any, val: string[] | undefined, cb: (e?: Error) => void) => {
|
||||
if (!val || !Array.isArray(val) || val.length === 0) cb(new Error('请上传购置税凭证'))
|
||||
else cb()
|
||||
},
|
||||
trigger: 'change'
|
||||
}],
|
||||
idCardFrontUrl: [{ required: true, message: '请上传身份证正面', trigger: 'change' }],
|
||||
idCardBackUrl: [{ required: true, message: '请上传身份证反面', trigger: 'change' }]
|
||||
})
|
||||
@@ -562,6 +555,14 @@ const getStoreList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 选择门店时,服务购买方自动填充为门店名称 */
|
||||
const handleStoreChange = (storeId: number) => {
|
||||
if (storeId) {
|
||||
const store = storeList.value.find(s => s.id === storeId)
|
||||
if (store?.storeName) formData.value.serviceBuyer = store.storeName
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取续保产品列表 */
|
||||
const getProductList = async () => {
|
||||
try {
|
||||
@@ -605,7 +606,7 @@ const open = async (type: string, id?: number) => {
|
||||
resetForm()
|
||||
// 加载门店列表和产品列表
|
||||
await Promise.all([getStoreList(), getProductList()])
|
||||
// 新增:默认选择门店第一项,车辆购买方默认为该门店名称(编辑不覆盖,均可修改)
|
||||
// 新增:默认选择门店第一项,服务购买方默认为门店名称(编辑不覆盖,均可修改)
|
||||
if (!id && storeList.value.length > 0) {
|
||||
if (!formData.value.storeId) {
|
||||
formData.value.storeId = storeList.value[0].id
|
||||
@@ -748,7 +749,31 @@ const openCopy = async (id: number) => {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
defineExpose({ open, openCopy }) // 提供 open / openCopy 方法,用于打开弹窗
|
||||
/** 打开弹窗并预填识别结果(身份证 / 车辆购置发票) */
|
||||
const openWithRecognizedData = async (recognizedData: Record<string, any>) => {
|
||||
await open('create')
|
||||
if (!recognizedData) return
|
||||
// 服务购买方 = 门店名字,不由识别结果填充;车辆购买方 = 身份证上的人名
|
||||
const idCardName = recognizedData.carBuyer || recognizedData.serviceBuyer || recognizedData.name
|
||||
if (idCardName) formData.value.carBuyer = String(idCardName)
|
||||
if (recognizedData.certNo) formData.value.certNo = String(recognizedData.certNo)
|
||||
if (recognizedData.contactAddress) formData.value.contactAddress = String(recognizedData.contactAddress)
|
||||
// 车辆购置发票识别字段
|
||||
if (recognizedData.vin) formData.value.vin = String(recognizedData.vin)
|
||||
if (recognizedData.engineNo) formData.value.engineNo = String(recognizedData.engineNo)
|
||||
if (recognizedData.factoryModel) formData.value.factoryModel = String(recognizedData.factoryModel)
|
||||
if (recognizedData.invoiceDate) formData.value.invoiceDate = String(recognizedData.invoiceDate)
|
||||
if (recognizedData.invoiceAmount != null) formData.value.invoiceAmount = Number(recognizedData.invoiceAmount)
|
||||
if (recognizedData.carModel) formData.value.carModel = String(recognizedData.carModel)
|
||||
// 图片 URL:身份证正反面、购车发票
|
||||
if (recognizedData.idCardFrontUrl) formData.value.idCardFrontUrl = String(recognizedData.idCardFrontUrl)
|
||||
if (recognizedData.idCardBackUrl) formData.value.idCardBackUrl = String(recognizedData.idCardBackUrl)
|
||||
if (recognizedData.carInvoiceUrls && Array.isArray(recognizedData.carInvoiceUrls) && recognizedData.carInvoiceUrls.length > 0) {
|
||||
formData.value.carInvoiceUrls = recognizedData.carInvoiceUrls.map((u: any) => String(u))
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open, openCopy, openWithRecognizedData }) // 提供 open / openCopy / openWithRecognizedData 方法
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
|
||||
Reference in New Issue
Block a user