Commit e92ccbeb by Lin

feat: 精品升级-新增工单/战败下单车架号校验

1 parent f8d38454
...@@ -686,7 +686,8 @@ Page({ ...@@ -686,7 +686,8 @@ Page({
isErrorOrder, isErrorOrder,
isAlreadyExistOrder, isAlreadyExistOrder,
submitStatus, submitStatus,
orderCreateType orderCreateType,
vinValid
} = this.data; } = this.data;
orderObj = wx.$util.deepClone(orderObj); orderObj = wx.$util.deepClone(orderObj);
if (scene && !orderObj.customerCouponId) { if (scene && !orderObj.customerCouponId) {
...@@ -705,7 +706,23 @@ Page({ ...@@ -705,7 +706,23 @@ Page({
}); });
return; return;
} }
// 车架号动态校验
const carVin = orderObj.customer.standNo
if (carVin) {
// 判断standNo是否为表单必传:1. 在requiredList中
// const { requiredList } = this.data;
// const isCarVinRequired = requiredList.includes('standNo');// 再次判断一下车架号是否必填项
// 前置判断
if (carVin.length !== 17) {
wx.$util.showToast('请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)')
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !vinValid) {
wx.$util.showToast('车架号校验不匹配,请核对后重新输入')
return false
}
}
let subOrderList = []; let subOrderList = [];
let priceDisabled = true; let priceDisabled = true;
let goodsKey = this.checkGoods( let goodsKey = this.checkGoods(
...@@ -783,6 +800,7 @@ Page({ ...@@ -783,6 +800,7 @@ Page({
// }) // })
// 请求中就不给再重复提交了 // 请求中就不给再重复提交了
if (submitStatus) return; if (submitStatus) return;
this.setData({ this.setData({
submitStatus: true, submitStatus: true,
...@@ -1612,8 +1630,12 @@ Page({ ...@@ -1612,8 +1630,12 @@ Page({
if (formattedValue && (autoValidate || formattedValue.length === 17)) { if (formattedValue && (autoValidate || formattedValue.length === 17)) {
validateVin(formattedValue) validateVin(formattedValue)
.then(result => { .then(result => {
let { valid } = result.data.data;
// 校验成功,所有提示已在公共方法中处理 // 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result) this.setData({
vinValid: valid
})
console.log('车架号校验成功:', valid)
}) })
.catch(error => { .catch(error => {
// 校验失败,所有提示已在公共方法中处理 // 校验失败,所有提示已在公共方法中处理
......
...@@ -93,6 +93,10 @@ Page({ ...@@ -93,6 +93,10 @@ Page({
if (formattedValue && (autoValidate || formattedValue.length === 17)) { if (formattedValue && (autoValidate || formattedValue.length === 17)) {
validateVin(formattedValue) validateVin(formattedValue)
.then(result => { .then(result => {
let { valid } = result.data.data;
this.setData({
vinValid: valid
})
// 校验成功,所有提示已在公共方法中处理 // 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result) console.log('车架号校验成功:', result)
}) })
...@@ -690,6 +694,7 @@ Page({ ...@@ -690,6 +694,7 @@ Page({
orderObj, orderObj,
notUpgradeOrderList, notUpgradeOrderList,
dateObj, dateObj,
vinValid,
isStandNo, isStandNo,
isCarBrand, isCarBrand,
isPlateNumber, isPlateNumber,
...@@ -715,11 +720,24 @@ Page({ ...@@ -715,11 +720,24 @@ Page({
if (isCarBrand && !notUpgradeOrderList[index].customer.carSeriesName) { if (isCarBrand && !notUpgradeOrderList[index].customer.carSeriesName) {
return this.showToast(`请输入第${index + 1}位客户车型`) return this.showToast(`请输入第${index + 1}位客户车型`)
} }
if (isStandNo && !notUpgradeOrderList[index].customer.standNo) { // 非动态校验车架号-abandon
return this.showToast(`请输入第${index + 1}位客户车架号`) // if (isStandNo && !notUpgradeOrderList[index].customer.standNo) {
} // return this.showToast(`请输入第${index + 1}位客户车架号`)
if (isPlateNumber && !notUpgradeOrderList[index].customer.plateNumber) { // }
return this.showToast(`请输入第${index + 1}位客户车牌号`)
// 动态校验车架号
const carVin = notUpgradeOrderList[index].customer?.standNo
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
wx.$util.showToast('请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)')
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !vinValid) {
wx.$util.showToast('车架号校验不匹配,请核对后重新输入')
return false
}
} }
if ( if (
!notUpgradeOrderList[index].subOrderList?.length && !notUpgradeOrderList[index].subOrderList?.length &&
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!