Commit f8d38454 by 张立顺

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/saas_plus/dj-car-boutiqu…

…e-work-wechat into SAAS+V5.5.0
2 parents f1fb0d51 43fdc4f6
...@@ -147,11 +147,17 @@ Component({ ...@@ -147,11 +147,17 @@ Component({
thisPage.setData({ thisPage.setData({
[dataAttrName + '.carVin']: upperVin [dataAttrName + '.carVin']: upperVin
}) })
// 当输入满17位时,进行实时校验(防抖500ms) // 当输入满17位时,进行实时校验(防抖500ms)
if (upperVin.length === 17) { if (upperVin.length === 17) {
validateVin(upperVin).catch(() => { validateVin(upperVin).then(res => {
// 校验失败,validateVin 内部已经显示了错误提示 let { valid } = res.data.data;
console.log("upperVinRes",valid);
// 保存 valid 值到组件 data 中
this.setData({
vinValid: valid
});
}).catch(() => {
console.log("upperVinErr",upperVin);
}) })
} }
} }
...@@ -251,8 +257,10 @@ Component({ ...@@ -251,8 +257,10 @@ Component({
var { var {
dataAttrName, dataAttrName,
formRule, formRule,
pointsMultiRole pointsMultiRole,
vinValid
} = this.data } = this.data
// let thisPage = this.$router.getCurrentPage() // let thisPage = this.$router.getCurrentPage()
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
// console.log(thisPage.data['orderInfo']['actualSalesPersonId']) // console.log(thisPage.data['orderInfo']['actualSalesPersonId'])
...@@ -270,7 +278,21 @@ Component({ ...@@ -270,7 +278,21 @@ Component({
return false return false
} }
} }
// 车架号校验
const carVin = thisPage.data[dataAttrName]?.carVin
if (carVin) {
const isCarVinRequired = formRule?.carVin?.some(rule => rule.required === true) // 再次判断一下车架号是否必填项
// 前置判断
if (carVin.length !== 17 && isCarVinRequired) {
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 validObj = fn.checkRequired(thisPage.data[dataAttrName], formRule) let validObj = fn.checkRequired(thisPage.data[dataAttrName], formRule)
if (validObj) { if (validObj) {
wx.$util.showToast(validObj.message) wx.$util.showToast(validObj.message)
......
...@@ -9,12 +9,15 @@ Component({ ...@@ -9,12 +9,15 @@ Component({
properties: { properties: {
show: { show: {
type: Boolean, type: Boolean,
value: true value: true,
// observer: function (n) { observer: function (n) {
// if (n) { if (n) {
// this.checkCoupon() // this.checkCoupon()
// } this.setData({
// } selectedMerchantList: []
})
}
}
}, },
title: String, title: String,
tips: String, tips: String,
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<view class="name_box"> <view class="name_box">
<view class="item name text-hide">{{userInfo.name}}</view> <view class="item name text-hide">{{userInfo.name}}</view>
<view class="point-box" wx:if="{{isForbidden}}"> <view class="point-box" wx:if="{{isForbidden}}">
<view class="change_btn" bind:tap="toPoint">我的积分</view> <view class="change_btn" bind:tap="toPoint">我的积分</view>
<image class="icon_card" bindtap="jumpAccount" src="{{IMG_URL}}bank-card.png" mode="" /> <image class="icon_card" bindtap="jumpAccount" src="{{IMG_URL}}bank-card.png" mode="" />
</view> </view>
<!-- <view class="change_btn" bindtap="changeAccount">切换账号</view> --> <!-- <view class="change_btn" bindtap="changeAccount">切换账号</view> -->
</view> </view>
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
</view> </view>
</block> </block>
<!-- isYqdSuper --> <!-- isYqdSuper -->
<switch-popup show="{{showMerchantPop}}" height="{{'80%'}}" title="{{merchantPopConfig.title}}" isYqdSuper="{{isYqdSuper}}" tips="{{merchantPopConfig.tips}}" /> <switch-popup wx:if="{{showMerchantPop}}" show="{{showMerchantPop}}" height="{{'80%'}}" title="{{merchantPopConfig.title}}" isYqdSuper="{{isYqdSuper}}" tips="{{merchantPopConfig.tips}}" />
</block> </block>
<!-- 提现账号 --> <!-- 提现账号 -->
<van-popup show="{{showAccountModal}}" round position="bottom" bind:click-overlay="toCloseModal" custom-class="popclass" data-name="showAccountModal"> <van-popup show="{{showAccountModal}}" round position="bottom" bind:click-overlay="toCloseModal" custom-class="popclass" data-name="showAccountModal">
...@@ -219,6 +219,6 @@ ...@@ -219,6 +219,6 @@
<view class="modal_error">原因:手机号非银行预留手机号</view> <view class="modal_error">原因:手机号非银行预留手机号</view>
<view class="btns"> <view class="btns">
<button class="modal_btn default" catchtap="toCloseModal" data-name="showAccountErrorModal">我知道了</button> <button class="modal_btn default" catchtap="toCloseModal" data-name="showAccountErrorModal">我知道了</button>
<button class="modal_btn" catchtap="toEditBankAccount" >去编辑</button> <button class="modal_btn" catchtap="toEditBankAccount">去编辑</button>
</view> </view>
</van-popup> </van-popup>
\ No newline at end of file \ No newline at end of file
...@@ -26,6 +26,7 @@ let toastList = { ...@@ -26,6 +26,7 @@ let toastList = {
payeeType: "收款方不能为空", payeeType: "收款方不能为空",
selectPayType: "支付方式不能为空" selectPayType: "支付方式不能为空"
}; };
import { validateVin, formatVinInput } from '~/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
// orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单) // orderSource 订单来源(1后台录入,2移动端预录客户,3移动端升级下单,4再次下单)
...@@ -253,10 +254,16 @@ Page({ ...@@ -253,10 +254,16 @@ Page({
let { let {
orderObj orderObj
} = this.data; } = this.data;
orderObj.customer[type] = data; // 车架号字段特殊处理
this.setData({ if (type === 'standNo') {
orderObj, const prop = `orderObj.customer[${type}]`
}); this.handleVinInput(data, prop, true) // 扫描时立即校验
} else {
orderObj.customer[type] = data;
this.setData({
orderObj,
});
}
}, },
navOcr(e) { navOcr(e) {
let { let {
...@@ -321,6 +328,7 @@ Page({ ...@@ -321,6 +328,7 @@ Page({
let { let {
name name
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
let prop = `orderObj.${name}`
if (name == "customer.customerPhone" && phoneRex.test(value)) { if (name == "customer.customerPhone" && phoneRex.test(value)) {
// 如果手机号有变动 需清订单的空礼券和商品 // 如果手机号有变动 需清订单的空礼券和商品
let deleteName = [ let deleteName = [
...@@ -343,6 +351,12 @@ Page({ ...@@ -343,6 +351,12 @@ Page({
}); });
this.setGoodsTotal(goodsList); this.setGoodsTotal(goodsList);
} }
// 车架号字段特殊处理
if (name === 'customer.standNo') {
console.log("车架号校验",prop);
this.handleVinInput(value, prop) // 手动输入时需达到17位才校验
return;
}
this.setData({ this.setData({
[`orderObj.${name}`]: value.trim(), [`orderObj.${name}`]: value.trim(),
}); });
...@@ -1589,6 +1603,24 @@ Page({ ...@@ -1589,6 +1603,24 @@ Page({
}); });
this.setGoodsTotal(chooseList); this.setGoodsTotal(chooseList);
}, },
handleVinInput(value, prop, autoValidate = false) {
const formattedValue = formatVinInput(value || '')
this.setData({
[prop]: formattedValue
})
// 扫描时立即校验,手动输入时需达到17位才校验
if (formattedValue && (autoValidate || formattedValue.length === 17)) {
validateVin(formattedValue)
.then(result => {
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
})
.catch(error => {
// 校验失败,所有提示已在公共方法中处理
console.log('车架号校验失败:', error)
})
}
},
handleSpecificationsEcho(item) { handleSpecificationsEcho(item) {
let skuArr = []; let skuArr = [];
let { let {
...@@ -1658,7 +1690,6 @@ Page({ ...@@ -1658,7 +1690,6 @@ Page({
// app . // app .
getYQorderInfo() getYQorderInfo()
.then((merchantSettingInfo) => { .then((merchantSettingInfo) => {
console.log(merchantSettingInfo, 'merchantSettingInfo');
let dictionaryObj = { let dictionaryObj = {
carTypeRequiredFlag: "carBrand", carTypeRequiredFlag: "carBrand",
standNoRequiredFlag: "standNo", standNoRequiredFlag: "standNo",
...@@ -1867,7 +1898,7 @@ Page({ ...@@ -1867,7 +1898,7 @@ Page({
} }
// 是订单补录跳转进来的 // 是订单补录跳转进来的
if (res?.orderCreateType == "additionRecordOrder") { if (res?.orderCreateType == "additionRecordOrder") {
let { supplementId, selectOutTradeNoArr } = res let {supplementId, selectOutTradeNoArr} = res
if (supplementId) { if (supplementId) {
return this.checkShowOrderInfo() return this.checkShowOrderInfo()
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!