Commit 375d17db by Lin

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

1 parent 22387562
...@@ -96,7 +96,6 @@ ...@@ -96,7 +96,6 @@
:type="noticeObj.type || 'success'" :type="noticeObj.type || 'success'"
:buttons="noticeObj.buttons" :buttons="noticeObj.buttons"
></NoticePopup> ></NoticePopup>
<EquityVinCheck ref="vinCheckRef" />
</view> </view>
</template> </template>
...@@ -122,8 +121,7 @@ import EquityUpload from './EquityForm/EquityUpload.vue' ...@@ -122,8 +121,7 @@ import EquityUpload from './EquityForm/EquityUpload.vue'
import EquityConversion from './EquityForm/EquityConversion.vue' import EquityConversion from './EquityForm/EquityConversion.vue'
import NP from 'number-precision' import NP from 'number-precision'
import NoticePopup from '@/components/NoticePopup.vue' import NoticePopup from '@/components/NoticePopup.vue'
import EquityVinCheck from './EquityForm/EquityVinCheck.vue' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const codeToAttr = { const codeToAttr = {
YB0001: 'invoice', YB0001: 'invoice',
YB0003: 'driveFront', YB0003: 'driveFront',
...@@ -162,8 +160,7 @@ export default { ...@@ -162,8 +160,7 @@ export default {
EquityTire, EquityTire,
EquityUpload, EquityUpload,
EquityConversion, EquityConversion,
NoticePopup, NoticePopup
EquityVinCheck
}, },
props: { props: {
transmissionOfData: { transmissionOfData: {
...@@ -203,10 +200,25 @@ export default { ...@@ -203,10 +200,25 @@ export default {
} }
}, },
mounted () { mounted () {
// this.$refs.vinCheckRef.open()
}, },
methods: { 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事件 // 单选框change事件
radioChange (e, val) { radioChange (e, val) {
this.$set(this.orderObj, val.value, e.detail.value) this.$set(this.orderObj, val.value, e.detail.value)
...@@ -243,6 +255,8 @@ export default { ...@@ -243,6 +255,8 @@ export default {
}, },
inputBlur (e, val) { inputBlur (e, val) {
this.orderObj[val.value] = this.orderObj[val.value] this.orderObj[val.value] = this.orderObj[val.value]
// VIN车架号动态校验:车架号字段,动态转换为大写
if (val.value === 'vin') this.validateVin()
}, },
async getServiceInfoDetail (contractNo) { async getServiceInfoDetail (contractNo) {
try { try {
...@@ -401,6 +415,21 @@ export default { ...@@ -401,6 +415,21 @@ export default {
this.viewKey = Date.now() this.viewKey = Date.now()
}, },
async submit (operationType) { 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({ uni.showLoading({
title: '提交中...', title: '提交中...',
mask: true mask: true
...@@ -531,7 +560,6 @@ export default { ...@@ -531,7 +560,6 @@ export default {
if (res && res.message) throw res.message if (res && res.message) throw res.message
} }
} }
}) })
} }
}) })
...@@ -591,44 +619,38 @@ export default { ...@@ -591,44 +619,38 @@ export default {
this.$emit('jump', 'EquityManagement') this.$emit('jump', 'EquityManagement')
}, 1500) }, 1500)
} else { } else {
uni.showLoading({ // 从URL获取文件名
mask: true const getFileNameFromUrl = (url) => {
}) return url.split('/').pop().split('?')[0] || '未知文件'
setTimeout(async () => { }
// 从URL获取文件名 const { contractNo } = params,
const getFileNameFromUrl = (url) => { url = await uni.$api.equityApi.printContract({ contractNo }),
return url.split('/').pop().split('?')[0] || '未知文件' fileName = getFileNameFromUrl(url),
} type = 3
const { contractNo } = params, if (!url) throw '获取合同失败'
url = await uni.$api.equityApi.printContract({ contractNo }), this.noticeObj = {
fileName = getFileNameFromUrl(url), title: '提单成功',
type = 3 text: '提单合同支持分享或保存',
if (!url) throw '获取合同失败' type: 'success',
this.noticeObj = { buttons: [
title: '提单成功', {
text: '提单合同支持分享或保存', text: '查看合同',
type: 'success', type: 'primary',
buttons: [ callback: _ => {
{ this.$refs.reportNotice.close()
text: '查看合同', this.$emit('jump', 'EquityManagement')
type: 'primary', // 跳转到预览页面
callback: _ => { uni.navigateTo({
this.$refs.reportNotice.close() url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
this.$emit('jump', 'EquityManagement') })
// 跳转到预览页面
uni.navigateTo({
url: `/pages/common/filePreview?fileUrl=${encodeURIComponent(url)}&fileType=${type}&fileName=${encodeURIComponent(fileName)}`
})
}
} }
] }
} ]
setTimeout(() => { }
uni.hideLoading() setTimeout(() => {
this.$refs.reportNotice.open() uni.hideLoading()
}, 100) this.$refs.reportNotice.open()
}, 1500) }, 100)
} }
} else throw message } else throw message
......
...@@ -508,7 +508,6 @@ export default { ...@@ -508,7 +508,6 @@ export default {
}, },
// 输入框失去焦点事件 // 输入框失去焦点事件
inputBlur (e, val) { inputBlur (e, val) {
console.log("SSSSSS");
console.log(e, val) console.log(e, val)
if (val.value == 'price') { if (val.value == 'price') {
this.orderObj[val.value] = parseFloat(this.orderObj[val.value]) > 2000000 ? 2000000 : this.orderObj[val.value] 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!