Commit d3dc8f1b by cen

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

…e-work-wechat into SAAS+V5.5.1
2 parents 0ca876ed 6721e7f9
...@@ -176,11 +176,13 @@ Component({ ...@@ -176,11 +176,13 @@ Component({
value = number value = number
} }
} }
if(!item.isAgreeTrim) {
const diffValue = value.toString() const diffValue = value.toString()
const trimValue = value.toString().trim() const trimValue = value.toString().trim()
if (diffValue != trimValue) { if (diffValue != trimValue) {
value = trimValue value = trimValue
} }
}
thisPage.setData({ thisPage.setData({
[dataAttrName + '.' + attr]: value + '' [dataAttrName + '.' + attr]: value + ''
......
...@@ -90,7 +90,8 @@ Component({ ...@@ -90,7 +90,8 @@ Component({
textNameObj: { textNameObj: {
confirmName: '下一步(1/4)', confirmName: '下一步(1/4)',
cancelName: '存草稿' cancelName: '存草稿'
} },
vinValid:true
}, },
lifetimes: { lifetimes: {
...@@ -131,7 +132,6 @@ Component({ ...@@ -131,7 +132,6 @@ Component({
// }) // })
// }, // },
inputEvent(e) { inputEvent(e) {
console.log(e, 'inputEvent');
let { let {
attr attr
} = e.detail } = e.detail
......
// packageEquity/pages/carQuotation/components/VinSecDialog/VinSecDialog.js // packageEquity/pages/carQuotation/components/VinSecDialog/VinSecDialog.js
import { validateVin } from '~/utils/vinVaildate'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -19,24 +20,64 @@ Component({ ...@@ -19,24 +20,64 @@ Component({
disable: true, disable: true,
that: this, that: this,
beforeClose: null, beforeClose: null,
vinValid:true
}, },
lifetimes: { lifetimes: {
attached() { attached() {
let { carVin } = this.data.secFormData let { carVin } = this.data.secFormData
const vinValue = carVin || ''
this.setData({ this.setData({
'formData.carVin': carVin || '', 'formData.carVin': vinValue,
vinFormat: carVin.replace(/(.{4})/g, "$1 ") vinFormat: vinValue ? vinValue.replace(/(.{4})/g, "$1 ") : ''
}) })
} }
}, },
/** /**
* 数据监听器
*/
observers: {
'formData.carVin': function(carVin) {
// 当 carVin 值发生变化时,会触发这个函数
console.log('carVin 值变化了:', carVin)
if (carVin.length === 17) {
validateVin(carVin).then(res => {
let { valid } = res.data.data
console.log("upperVinRes", valid)
// 保存 valid 值到组件 data 中
this.setData({
vinValid: valid
})
}).catch(() => {
console.log("upperVinErr", carVin)
// 校验失败时,设置为 false
this.setData({
vinValid: false
})
})
}
// 在这里可以执行你需要的逻辑
// 例如:格式化显示、验证、触发事件等
// 如果需要格式化显示,可以更新 vinFormat
// this.setData({
// vinFormat: carVin ? carVin.replace(/(.{4})/g, "$1 ") : ''
// })
// 你可以在这里添加其他监听逻辑,例如:
// - 实时验证车架号格式
// - 触发自定义事件通知父组件
// - 更新其他相关的数据状态
}
},
/**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
handleInput(e) { handleInput(e) {
let inputValue = e.detail let inputValue = e.detail.toUpperCase()
this.setData({ this.setData({
'formData.carVin': inputValue 'formData.carVin': inputValue
}) })
...@@ -66,16 +107,20 @@ Component({ ...@@ -66,16 +107,20 @@ Component({
}, },
onConfirm(e) { onConfirm(e) {
let { carVin } = this.data.formData let { carVin } = this.data.formData
if (!carVin) { let { vinValid } = this.data
wx.$util.showToast('车架号不能为空') console.log("onConfirm",vinValid);
return this.dialogClost(false) // 表单校验不通过 console.log("onConfirm",carVin);
if (!carVin || !(/^[a-zA-Z0-9]{17}$/.test(carVin))) {
wx.$util.showToast('请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)')
return this.dialogClost(false)
} }
if (!(/^[a-zA-Z0-9]{17}$/.test(carVin))) { if(!vinValid) {
wx.$util.showToast('车架号请输入17位数字和字母') console.log("表单校验不通过");
return this.dialogClost(false) // 表单校验不通过 return this.dialogClost(false) // 表单校验不通过
} } else {
this.triggerEvent('onConfirm', { carVin: carVin }) this.triggerEvent('onConfirm', { carVin: carVin })
this.dialogClost(true) // 表单校验通过 this.dialogClost(true) // 表单校验通过
} }
} }
}
}) })
...@@ -517,7 +517,7 @@ Page({ ...@@ -517,7 +517,7 @@ Page({
reWrite(type, data) { reWrite(type, data) {
let { formData } = this.data; let { formData } = this.data;
console.log("ASCSAC",type);
if (type === "licensePlate") { if (type === "licensePlate") {
// 行驶证识别 // 行驶证识别
// 根据返回数据结构映射到表单字段 // 根据返回数据结构映射到表单字段
...@@ -588,6 +588,68 @@ Page({ ...@@ -588,6 +588,68 @@ Page({
this.checkLicensePlateRepeat(licensePlate); this.checkLicensePlateRepeat(licensePlate);
} }
}); });
const upperVin = formatVinInput(vin);
// 先验证车架号
validateVin(upperVin)
.then((result) => {
// validateVin 返回 { success, message, data, vin }
// data 中包含后端接口返回的完整数据
let { valid } = result.data.data || {};
// 将 valid 值赋值到 FirstStep 组件的 vinValid 属性
const firstStepComponent = this.selectComponent("#FirstStep");
if (firstStepComponent) {
firstStepComponent.setData({
vinValid: valid,
});
}
if (valid) {
// 验证通过,赋值到表单
this.setData(
{
"formData.carBaseReqDTO.vin": upperVin,
},
() => {
wx.showToast({
title: "车架号识别完成并已自动填写到表单中",
icon: "none",
duration: 2000,
});
}
);
} else {
// 验证未通过,仍然赋值但提示用户
this.setData(
{
"formData.carBaseReqDTO.vin": upperVin,
},
() => {
wx.showToast({
title: "车架号识别完成,但校验未通过,请检查",
icon: "none",
duration: 2000,
});
}
);
}
})
.catch((error) => {
// 验证失败(接口异常等),仍然赋值但提示用户
this.setData(
{
"formData.carBaseReqDTO.vin": upperVin,
},
() => {
wx.showToast({
title: "车架号识别完成,但校验异常,请检查",
icon: "none",
duration: 2000,
});
}
);
});
} else if (type === "vin") { } else if (type === "vin") {
// 车架号识别 // 车架号识别
// vinOcr API 返回的数据结构中包含 vin 字段 // vinOcr API 返回的数据结构中包含 vin 字段
...@@ -604,6 +666,14 @@ Page({ ...@@ -604,6 +666,14 @@ Page({
// data 中包含后端接口返回的完整数据 // data 中包含后端接口返回的完整数据
let { valid } = result.data.data || {}; let { valid } = result.data.data || {};
// 将 valid 值赋值到 FirstStep 组件的 vinValid 属性
const firstStepComponent = this.selectComponent("#FirstStep");
if (firstStepComponent) {
firstStepComponent.setData({
vinValid: valid,
});
}
if (valid) { if (valid) {
// 验证通过,赋值到表单 // 验证通过,赋值到表单
this.setData( this.setData(
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<view class="service-tag">服务</view> <view class="service-tag">服务</view>
<view style="width: calc(100% - var(--fontSize80));"> <view style="width: calc(100% - var(--fontSize80));">
<block wx:for="{{ li.serviceItemsDetailList }}" wx:key="sindex" wx:for-item="i" wx:for-index="sindex"> <block wx:for="{{ li.serviceItemsDetailList }}" wx:key="sindex" wx:for-item="i" wx:for-index="sindex">
<view class="services" hidden="{{ li.showAllServiceListFlag ? false : sindex > 2 }}"> <view class="services" wx:if="{{ li.showAllServiceListFlag || sindex <= 2 }}">
<view class="services-name text-hide">{{i.itemsConfigName}}-{{i.serviceItemsName}}</view> <view class="services-name text-hide">{{i.itemsConfigName}}-{{i.serviceItemsName}}</view>
<view class="counr" wx:if="{{ i.useNum }}">x{{i.useNum}}</view> <view class="counr" wx:if="{{ i.useNum }}">x{{i.useNum}}</view>
</view> </view>
......
...@@ -438,7 +438,7 @@ Page({ ...@@ -438,7 +438,7 @@ Page({
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -448,7 +448,7 @@ Page({ ...@@ -448,7 +448,7 @@ Page({
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -473,7 +473,8 @@ Page({ ...@@ -473,7 +473,8 @@ Page({
['orderObj.merchantName']: merchantRange[value].merchantName, ['orderObj.merchantName']: merchantRange[value].merchantName,
['orderObj.staffUuid']: '', ['orderObj.staffUuid']: '',
['orderObj.staffName']: '', ['orderObj.staffName']: '',
staffCurrent: 0 staffCurrent: 0,
tabIndex: 0, // 重新设置为默认第一个
// ['orderObj.yqMerchantId']: merchantRange[value].yqMerchantId, // ['orderObj.yqMerchantId']: merchantRange[value].yqMerchantId,
// ['orderObj.yqMerchantName']: merchantRange[value].yqMerchantName // ['orderObj.yqMerchantName']: merchantRange[value].yqMerchantName
}) })
...@@ -579,7 +580,7 @@ Page({ ...@@ -579,7 +580,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -718,7 +719,7 @@ Page({ ...@@ -718,7 +719,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -1441,7 +1442,7 @@ Page({ ...@@ -1441,7 +1442,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => {}) .catch(err => { })
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1650,7 +1651,7 @@ Page({ ...@@ -1650,7 +1651,7 @@ Page({
} }
// } // }
}) })
.catch(err => {}) .catch(err => { })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1772,5 +1773,5 @@ Page({ ...@@ -1772,5 +1773,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {} onReady: function () { }
}) })
...@@ -520,6 +520,7 @@ Page({ ...@@ -520,6 +520,7 @@ Page({
type: frontConfig.type, type: frontConfig.type,
labelWidth: frontConfig.labelWidth, labelWidth: frontConfig.labelWidth,
maxlength: frontConfig.maxlength || '140', maxlength: frontConfig.maxlength || '140',
isAgreeTrim: frontConfig.isAgreeTrim || false,
isLabelNoLine: frontConfig.isLabelNoLine, isLabelNoLine: frontConfig.isLabelNoLine,
inputAlign: frontConfig.inputAlign || 'right', inputAlign: frontConfig.inputAlign || 'right',
optionList: frontConfig.optionList || [], optionList: frontConfig.optionList || [],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!