Commit 3debe636 by 李伟康

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

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

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