Commit 375d17db by Lin

feat: 权益提单动态校验车架号

1 parent 22387562
......@@ -96,7 +96,6 @@
:type="noticeObj.type || 'success'"
:buttons="noticeObj.buttons"
></NoticePopup>
<EquityVinCheck ref="vinCheckRef" />
</view>
</template>
......@@ -122,8 +121,7 @@ import EquityUpload from './EquityForm/EquityUpload.vue'
import EquityConversion from './EquityForm/EquityConversion.vue'
import NP from 'number-precision'
import NoticePopup from '@/components/NoticePopup.vue'
import EquityVinCheck from './EquityForm/EquityVinCheck.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const codeToAttr = {
YB0001: 'invoice',
YB0003: 'driveFront',
......@@ -162,8 +160,7 @@ export default {
EquityTire,
EquityUpload,
EquityConversion,
NoticePopup,
EquityVinCheck
NoticePopup
},
props: {
transmissionOfData: {
......@@ -203,10 +200,25 @@ export default {
}
},
mounted () {
// this.$refs.vinCheckRef.open()
},
methods: {
// 车架号动态校验
validateVin () {
let carVinVal = this.orderObj.vin;
if (carVinVal) {
this.orderObj.carVin = formatVinInput(carVinVal)
validateVin(this.orderObj.carVin).then(result => {
console.log("validateVin", result);
let { valid } = result.data;
this.validateState = valid
// 校验成功,所有提示已在公共方法中处理
console.log('车架号校验成功:', result)
}).catch(err => {
console.log("validateVinErr", result);
})
}
},
// 单选框change事件
radioChange (e, val) {
this.$set(this.orderObj, val.value, e.detail.value)
......@@ -243,6 +255,8 @@ export default {
},
inputBlur (e, val) {
this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
if (val.value === 'vin') this.validateVin()
},
async getServiceInfoDetail (contractNo) {
try {
......@@ -401,6 +415,21 @@ export default {
this.viewKey = Date.now()
},
async submit (operationType) {
// VIN车架号-动态校验
const carVin = this.orderObj.vin
console.log("validateState", this.orderObj);
if (carVin) {
// 前置判断
if (carVin.length !== 17) {
uni.showToast({ title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)', icon: 'none' })
return false
}
// 根据接口校验结果判断
if (carVin.length === 17 && !this.validateState) {
uni.showToast({ title: '车架号校验不匹配,请核对后重新输入', icon: 'none' })
return false
}
}
uni.showLoading({
title: '提交中...',
mask: true
......@@ -531,7 +560,6 @@ export default {
if (res && res.message) throw res.message
}
}
})
}
})
......@@ -591,44 +619,38 @@ export default {
this.$emit('jump', 'EquityManagement')
}, 1500)
} else {
uni.showLoading({
mask: true
})
setTimeout(async () => {
// 从URL获取文件名
const getFileNameFromUrl = (url) => {
return url.split('/').pop().split('?')[0] || '未知文件'
}
const { contractNo } = params,
url = await uni.$api.equityApi.printContract({ contractNo }),
fileName = getFileNameFromUrl(url),
type = 3
if (!url) throw '获取合同失败'
this.noticeObj = {
title: '提单成功',
text: '提单合同支持分享或保存',
type: 'success',
buttons: [
{
text: '查看合同',
type: 'primary',
callback: _ => {
this.$refs.reportNotice.close()
this.$emit('jump', 'EquityManagement')
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
// 从URL获取文件名
const getFileNameFromUrl = (url) => {
return url.split('/').pop().split('?')[0] || '未知文件'
}
const { contractNo } = params,
url = await uni.$api.equityApi.printContract({ contractNo }),
fileName = getFileNameFromUrl(url),
type = 3
if (!url) throw '获取合同失败'
this.noticeObj = {
title: '提单成功',
text: '提单合同支持分享或保存',
type: 'success',
buttons: [
{
text: '查看合同',
type: 'primary',
callback: _ => {
this.$refs.reportNotice.close()
this.$emit('jump', 'EquityManagement')
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
]
}
setTimeout(() => {
uni.hideLoading()
this.$refs.reportNotice.open()
}, 100)
}, 1500)
}
]
}
setTimeout(() => {
uni.hideLoading()
this.$refs.reportNotice.open()
}, 100)
}
} else throw message
......
......@@ -508,7 +508,6 @@ export default {
},
// 输入框失去焦点事件
inputBlur (e, val) {
console.log("SSSSSS");
console.log(e, val)
if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!