Commit 22387562 by 李伟康

Merge branch 'SAAS+V5.5.0' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.5.0

2 parents e0ff3e4f 90a2c2e3
...@@ -39,7 +39,7 @@ import GlCell from '../../../../components/Form/GlCell.vue' ...@@ -39,7 +39,7 @@ import GlCell from '../../../../components/Form/GlCell.vue'
import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant' import { UpdateOrderInfo, popupTypeEnum, payTypeList, titleList } from '../contant'
import { interceptionMixin } from '@/mixin/index' import { interceptionMixin } from '@/mixin/index'
import NoticePopup from '@/components/NoticePopup.vue' import NoticePopup from '@/components/NoticePopup.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
export default { export default {
name: 'CreateOrder', name: 'CreateOrder',
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -65,7 +65,8 @@ export default { ...@@ -65,7 +65,8 @@ export default {
externalData: [], externalData: [],
popupType: 0, popupType: 0,
baseConfigData: {}, baseConfigData: {},
requiredList: [], // 录单设置的必填项 requiredList: [],
validateState: true, // 录单设置的必填项
orderObj: { orderObj: {
owner: '', owner: '',
phone: '', phone: '',
...@@ -123,8 +124,19 @@ export default { ...@@ -123,8 +124,19 @@ export default {
}, },
// 输入框失去焦点事件 // 输入框失去焦点事件
inputBlur(e, val) { inputBlur(e, val) {
console.log(e, val) console.log(e, val, val.value === 'carVin')
this.orderObj[val.value] = this.orderObj[val.value] if (val.value === 'carVin') {
validateVin(this.orderObj.carVin).then(result => {
console.log('validateVin', result)
let { valid } = result.data
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
this.orderObj.carVin = formatVinInput(this.orderObj.carVin)
})
} else {
this.orderObj[val.value] = this.orderObj[val.value]
}
}, },
// 校验必填等规则 // 校验必填等规则
checkRequired() { checkRequired() {
...@@ -151,10 +163,10 @@ export default { ...@@ -151,10 +163,10 @@ export default {
// 如果是customerPhone,添加phoneRex校验 // 如果是customerPhone,添加phoneRex校验
if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}` if (item.value === 'phone' && !phoneRex.test(value)) throw `请输入正确的${item.label}`
} }
if (orderObj.carVin) { // if (orderObj.carVin) {
const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/ // const vinRex = /^(?=.*[A-Za-z])[A-Za-z0-9]{17}$/
if (!vinRex.test(orderObj.carVin)) throw '请输入正确的车架号' // if (!vinRex.test(orderObj.carVin)) throw '请输入正确的车架号'
} // }
if (orderObj.certificateNo && orderObj.certificateNo.length != 18) throw '请输入正确的18位证件号' if (orderObj.certificateNo && orderObj.certificateNo.length != 18) throw '请输入正确的18位证件号'
return true return true
} catch (error) { } catch (error) {
...@@ -169,6 +181,18 @@ export default { ...@@ -169,6 +181,18 @@ export default {
// 提交 // 提交
async submit() { async submit() {
if (!this.checkRequired() || (await this.checkDailyReport())) return if (!this.checkRequired() || (await this.checkDailyReport())) return
if (this.orderObj.carVin) {
// 前置判断
if (this.orderObj.carVin.length !== 17) {
uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false
}
// 根据接口校验结果判断
if (this.orderObj.carVin.length === 17 && !this.validateState) {
uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false
}
}
let params = { let params = {
id: this.orderObj.id, id: this.orderObj.id,
notes: this.orderObj.notes || '', notes: this.orderObj.notes || '',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!