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