Commit 3debe636 by 李伟康

fix(equity-tool): 修复创建订单组件中的支付时间处理逻辑与VIN校验问题

- 调整了 `pay2Time` 的赋值逻辑,避免在特定支付类型下错误格式化时间戳
- 新增 `validateVin` 方法用于独立处理车架号校验,提升代码复用性
- 修复上传凭证弹窗关闭后未清空支付文档列表的问题
- 统一优化了部分变量命名及缩进格式,提高代码可读性
- 在客户信息设置中补充车辆颜色和车架号字段绑定
- 点击入口时增加组件名称判断,防止重复加载相同组件

此外,在多个工具页面中增加对重复点击入口的拦截处理,提升用户体验。
1 parent 1830e006
...@@ -110,6 +110,7 @@ export default { ...@@ -110,6 +110,7 @@ export default {
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
async entranceClick (item) { async entranceClick (item) {
if(this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<template v-if="showUpload"> <template v-if="showUpload">
<view class="upload-box"> <view class="upload-box">
<upload-proof-of-payment <upload-proof-of-payment
@back="showUpload = false" @back="clearPayMentDocList"
@confirm="uploadConfirm" @confirm="uploadConfirm"
/> />
</view> </view>
...@@ -203,7 +203,7 @@ export default { ...@@ -203,7 +203,7 @@ export default {
popupTitle: '', popupTitle: '',
pointsMultiRole: 'Y', pointsMultiRole: 'Y',
formKey: Date.now(), formKey: Date.now(),
validateState:null validateState: null
} }
...@@ -451,7 +451,7 @@ export default { ...@@ -451,7 +451,7 @@ export default {
}, },
// 弹窗确认回调 // 弹窗确认回调
onConfirm (val, flag) { onConfirm (val, flag) {
console.log(val, 'onConfirm') console.log(JSON.parse(JSON.stringify(val)), 'onConfirm')
this.externalData = [] this.externalData = []
// // const { chooseContent } = val // // const { chooseContent } = val
const chooseContent = utils.deepClone(val.chooseContent) const chooseContent = utils.deepClone(val.chooseContent)
...@@ -476,7 +476,7 @@ export default { ...@@ -476,7 +476,7 @@ export default {
} else { } else {
// 过滤出已选的goodFlag为2的对象 // 过滤出已选的goodFlag为2的对象
const selectedGoods = this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 2) const selectedGoods = this.orderObj[_typeValue.key].filter(item => item.goodsFlag === 2)
const singleGoods = flag ? this.orderObj[_typeValue.key].filter(item => item.goodsFlag != 2) : chooseContent.filter(item => item.goodsFlag != 2) const singleGoods = flag ? this.orderObj[_typeValue.key].filter(item => item.goodsFlag != 2) : chooseContent.filter(item => item.goodsFlag != 2)
const moreGoods = chooseContent const moreGoods = chooseContent
.filter(item => item.goodsFlag === 2) .filter(item => item.goodsFlag === 2)
.filter(item => { .filter(item => {
...@@ -508,27 +508,30 @@ export default { ...@@ -508,27 +508,30 @@ export default {
}, },
// 输入框失去焦点事件 // 输入框失去焦点事件
inputBlur (e, val) { inputBlur (e, val) {
console.log("SSSSSS"); console.log("SSSSSS");
console.log(e, val) console.log(e, val)
if (val.value == 'price') { if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value] this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value]
return return
} }
this.orderObj[val.value] = this.orderObj[val.value] this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写 // VIN车架号动态校验:车架号字段,动态转换为大写
let carVinVal = this.orderObj.carVin; if (val.value === 'carVin') this.validateVin()
if (val.value === 'carVin' && carVinVal) { },
this.orderObj.carVin = formatVinInput(carVinVal) validateVin () {
validateVin(this.orderObj.carVin).then(result => { let carVinVal = this.orderObj.carVin;
console.log("validateVin",result); if (carVinVal) {
let { valid } = result.data; this.orderObj.carVin = formatVinInput(carVinVal)
this.validateState = valid validateVin(this.orderObj.carVin).then(result => {
// 校验成功,所有提示已在公共方法中处理 console.log("validateVin", result);
console.log('车架号校验成功:', result) let { valid } = result.data;
}).catch(err => { this.validateState = valid
console.log("validateVinErr",result); // 校验成功,所有提示已在公共方法中处理
}) console.log('车架号校验成功:', result)
} }).catch(err => {
console.log("validateVinErr", result);
})
}
}, },
// 校验必填等规则 // 校验必填等规则
checkRequired () { checkRequired () {
...@@ -548,19 +551,19 @@ export default { ...@@ -548,19 +551,19 @@ export default {
}) })
// VIN车架号-动态校验 // VIN车架号-动态校验
const carVin = this.orderObj.carVin const carVin = this.orderObj.carVin
console.log("validateState",this.validateState); console.log("validateState", this.validateState);
if (carVin) { if (carVin) {
// 前置判断 // 前置判断
if (carVin.length !== 17) { if (carVin.length !== 17) {
uni.showToast({title:'请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',icon:'none'}) uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false return false
} }
// 根据接口校验结果判断 // 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) { if (carVin.length === 17 && !this.validateState) {
uni.showToast({title:'车架号校验不匹配,请核对后重新输入',icon:'none'}) uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false return false
} }
} }
// 遍历requiredArr,检查orderObj中是否有对应的值 // 遍历requiredArr,检查orderObj中是否有对应的值
for (let i = 0; i < requiredArr.length; i++) { for (let i = 0; i < requiredArr.length; i++) {
const item = requiredArr[i] const item = requiredArr[i]
...@@ -606,7 +609,9 @@ export default { ...@@ -606,7 +609,9 @@ export default {
([2, 5, 6, 7].includes(+payType)) && ([2, 5, 6, 7].includes(+payType)) &&
!(orderInfo.transactionNo && orderInfo.paymentDocList.length) !(orderInfo.transactionNo && orderInfo.paymentDocList.length)
) return this.showUpload = true ) return this.showUpload = true
if (orderInfo.pay2Time) orderInfo.pay2Time = dayjs(orderInfo.pay2Time).format('YYYY-MM-DD HH:mm:ss')
if (orderInfo.pay2Time && ![1, 3].includes(+payType)) orderInfo.pay2Time = dayjs(orderInfo.pay2Time).format('YYYY-MM-DD HH:mm:ss')
else delete orderInfo.pay2Time
uni.showLoading({ uni.showLoading({
title: `${check ? '报价' : '保存'}中...`, title: `${check ? '报价' : '保存'}中...`,
mask: true mask: true
...@@ -616,6 +621,7 @@ export default { ...@@ -616,6 +621,7 @@ export default {
const data = await uni.$api.equityApi[apiName](orderInfo) const data = await uni.$api.equityApi[apiName](orderInfo)
this.saveStatus = false this.saveStatus = false
if (data) { if (data) {
this.showUpload = false
wx.hideLoading() wx.hideLoading()
if (check) { if (check) {
if ([2, 5, 6, 7].includes(+payType)) return this.$emit('jump', 'OrderManagement') if ([2, 5, 6, 7].includes(+payType)) return this.$emit('jump', 'OrderManagement')
...@@ -731,7 +737,7 @@ export default { ...@@ -731,7 +737,7 @@ export default {
) )
let keyList = ['mode', 'payee', 'payType', 'referrerId', 'referrer', let keyList = ['mode', 'payee', 'payType', 'referrerId', 'referrer',
'deliveryId', 'deliveryName', 'total', 'notes', 'tradeNo', 'deliveryId', 'deliveryName', 'total', 'notes', 'tradeNo',
'transactionNo', 'paymentDocList', 'pay2Time', 'id', 'orderId' 'transactionNo', 'paymentDocList', 'id', 'orderId', 'pay2Time'
], ],
customerKeyList = [ customerKeyList = [
'owner', 'phone', 'certificateNo', 'carVin', 'seat', 'price', 'owner', 'phone', 'certificateNo', 'carVin', 'seat', 'price',
...@@ -896,7 +902,6 @@ export default { ...@@ -896,7 +902,6 @@ export default {
this.orderObj.transactionNo = outTradeNo this.orderObj.transactionNo = outTradeNo
this.orderObj.tradeNo = outTradeNo this.orderObj.tradeNo = outTradeNo
this.orderObj.paymentDocList = paymentDocList this.orderObj.paymentDocList = paymentDocList
this.showUpload = false
this.submit() this.submit()
}, },
setCustomerInfo (customerInfo) { setCustomerInfo (customerInfo) {
...@@ -914,9 +919,10 @@ export default { ...@@ -914,9 +919,10 @@ export default {
hobby: customerInfo.customerHobby, hobby: customerInfo.customerHobby,
companion: customerInfo.customerCompanion, companion: customerInfo.customerCompanion,
certificateNo: customerInfo.customerCertificateNo || '', certificateNo: customerInfo.customerCertificateNo || '',
salesType salesType,
carVin: customerInfo.carVin || '',
carColor: customerInfo.carColor || '',
}) })
this.formList[1].map(e => { this.formList[1].map(e => {
if (e.value == 'salesType') e.current = salesType if (e.value == 'salesType') e.current = salesType
if (e.value == 'ownerGender') e.current = ownerGender if (e.value == 'ownerGender') e.current = ownerGender
...@@ -950,6 +956,7 @@ export default { ...@@ -950,6 +956,7 @@ export default {
} }
this.orderObj = orderObj this.orderObj = orderObj
this.formKey = Date.now() this.formKey = Date.now()
this.validateVin()
console.log(this.orderObj) console.log(this.orderObj)
}, },
jumpSuccess (params) { jumpSuccess (params) {
...@@ -980,8 +987,13 @@ export default { ...@@ -980,8 +987,13 @@ export default {
} }
return parseFloat(strVal) return parseFloat(strVal)
}, },
closePopup(){ closePopup () {
this.$emit('jump', 'OrderManagement') this.$emit('jump', 'OrderManagement')
},
clearPayMentDocList () {
this.showUpload = false
this.orderInfo.paymentDocList = []
this.orderInfo.transactionNo = ''
} }
} }
} }
......
...@@ -77,6 +77,7 @@ export default { ...@@ -77,6 +77,7 @@ export default {
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
async entranceClick(item) { async entranceClick(item) {
if(this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()) || (await this.inspectionOfProhibitionBill()))) return
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
......
...@@ -111,6 +111,7 @@ export default { ...@@ -111,6 +111,7 @@ export default {
this.currentMonth = dayjs(currentDate).format('YYYY-MM') this.currentMonth = dayjs(currentDate).format('YYYY-MM')
}, },
async entranceClick (item) { async entranceClick (item) {
if(this.toolComponentName == item.name) return
const noInterceptPage = ['DailyReport'] const noInterceptPage = ['DailyReport']
if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()))) return if (!noInterceptPage.includes(item.name) && ((await this.checkDailyReport()))) return
// 保存当前选择的组件信息,但不立即切换 // 保存当前选择的组件信息,但不立即切换
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!