Commit 496b80f0 by cen

fix: 在车架号也识别返回车型

1 parent 372e5c40
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
...@@ -1328,29 +1328,32 @@ export default { ...@@ -1328,29 +1328,32 @@ export default {
if (res.data.code == 0) { if (res.data.code == 0) {
if (res.data.data.status == 1) { if (res.data.data.status == 1) {
this.formData.carBaseReqDTO.vin = res.data.data.vin this.formData.carBaseReqDTO.vin = res.data.data.vin
validateVin(this.formData.carBaseReqDTO.vin) // 只有有 VIN 时才做后续校验和 queryByVin
.then(result => { if (this.formData.carBaseReqDTO.vin) {
console.log('validateVin', result) validateVin(this.formData.carBaseReqDTO.vin)
let { valid } = result.data .then(result => {
this.validateState = valid console.log('validateVin', result)
// 校验成功,所有提示已在公共方法中处理 let { valid } = result.data
console.log('车架号校验成功:', result) this.validateState = valid
}) // 校验成功,所有提示已在公共方法中处理
.catch(err => { console.log('车架号校验成功:', result)
console.log('validateVinErr', result) })
}) .catch(err => {
uni.$api.evaluationApi console.log('validateVinErr', err)
.queryByVin({ })
vin: this.formData.carBaseReqDTO.vin uni.$api.evaluationApi
}) .queryByVin({
.then(res => { vin: this.formData.carBaseReqDTO.vin
console.log('res:', res) })
if (res.data.code == 0) { .then(res => {
this.carTips = res.data.data.base.commonName || '' console.log('res:queryByVin', res)
} else { if (res.data.code == 0) {
this.carTips = '' this.carTips = res.data.data.base.commonName || ''
} } else {
}) this.carTips = ''
}
})
}
uni.showToast({ title: '车架号识别完成并已自动填写到表单中', icon: 'none' }) uni.showToast({ title: '车架号识别完成并已自动填写到表单中', icon: 'none' })
uni.hideLoading() uni.hideLoading()
} else { } else {
...@@ -1486,6 +1489,21 @@ export default { ...@@ -1486,6 +1489,21 @@ export default {
this.formData.carLicenseReqDTO.previousOwnerName = res.data.data.previousOwnerName this.formData.carLicenseReqDTO.previousOwnerName = res.data.data.previousOwnerName
this.formData.carLicenseReqDTO.carSeriesName = res.data.data.carSeriesName this.formData.carLicenseReqDTO.carSeriesName = res.data.data.carSeriesName
this.formData.carLicenseReqDTO.carTypeName = res.data.data.carTypeName this.formData.carLicenseReqDTO.carTypeName = res.data.data.carTypeName
// 行驶证识别到 VIN 后,再调用 queryByVin
if (this.formData.carBaseReqDTO.vin) {
uni.$api.evaluationApi
.queryByVin({
vin: this.formData.carBaseReqDTO.vin
})
.then(res => {
console.log('res:', res)
if (res.data.code == 0) {
this.carTips = res.data.data.base.commonName || ''
} else {
this.carTips = ''
}
})
}
} else { } else {
uni.hideLoading() uni.hideLoading()
uni.showToast({ title: res.data.data.errorMessage, icon: 'none' }) uni.showToast({ title: res.data.data.errorMessage, icon: 'none' })
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="search-box flex"> <view class="search-box flex">
<view :class="['form-item form-item-input', { active: focusIndex == 0 }]"> <view :class="['form-item form-item-input', { active: focusIndex == 0 }]">
<view class="form-item-box flex"> <view class="form-item-box flex">
<input :maxlength="50" v-model="searchText" class="input" placeholder="请输入车架号" @focus="focusIndex = 0" @blur="resetFocusIndex" placeholder-class="placeholder" /> <input :maxlength="20" v-model="searchText" class="input" placeholder="请输入车架号" @focus="focusIndex = 0" @blur="resetFocusIndex" placeholder-class="placeholder" />
<view class="sprite-icon icon-vinScan" @click.stop="scan('vinOcr')"></view> <view class="sprite-icon icon-vinScan" @click.stop="scan('vinOcr')"></view>
</view> </view>
</view> </view>
...@@ -363,6 +363,12 @@ export default { ...@@ -363,6 +363,12 @@ export default {
sizeType: ['original'], sizeType: ['original'],
sourceType: ['camera'], sourceType: ['camera'],
success: async res => { success: async res => {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePaths[0],
success: function () {
console.log('图片保存成功')
}
})
try { try {
const MAX_IMAGE_SIZE = 10 * 1024 * 1024 // 10MB const MAX_IMAGE_SIZE = 10 * 1024 * 1024 // 10MB
for (const file of res.tempFiles) { for (const file of res.tempFiles) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!