Commit e775ae67 by chenwq

车架号校验

1 parent dd7f5652
<template>
<GLDialog class="second-dialog" title="重要提示" width="576px" :visible.sync="secondVisible" :show-close="true" :hasFooter="!isEditVin" :before-close="handleCancel" :close-on-click-modal="false" @onCancel="handleCancel" @onOk="handleOk">
<div class="modal-wrap">
<div class="tips">
<img class="icon-info" src="@/assets/icon_info.png" />
{{secondInfo.tips}}
</div>
<glsx-combi-form :isInline="false" class="edit-form-container" ref="editFormRefSec" labelWidth="154px" defaultWidth="284px" formRef="editChildRef" :isEdit="true" :formObj="editFormSec" :formData="secondInfo.editFormDataSec" :formRules="formRules">
<template slot="vin">
<div v-if="!isEditVin" class="vin-detail">
<div>{{editFormSec.vin?.replace(/(.{4})/g, "$1 ")}}</div>
<img class="icon-edit" src="@/assets/icon_edit.png" @click="handleChangeVin" />
</div>
<div v-else class="vin-edit">
<el-input placeholder="请输入车架号" v-model.trim="editFormSec.vin" maxlength="17" style="width: 284px; margin-right: 10px;"></el-input>
<el-button class="vin-btn" type="text" @click="handleVinConfirm">确认</el-button>
<el-button class="vin-btn" type="text" style="margin-left: 8px;" @click="handleVinCancel">取消</el-button>
</div>
</template>
</glsx-combi-form>
</div>
</GLDialog>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'secondDialog',
props: {
secondVisible: {
type: Boolean,
default: false
},
formRules: {
type: Object,
default: () => { }
},
editForm: {
type: Object,
default: () => { }
}
},
components: {
glsxCombiForm
},
data() {
return {
secondInfo: {
tips: '请核对车架号是否正确,如信息有误后期将无法申请补偿服务!',
editFormDataSec: [
{
label: '车架号',
name: 'vin',
addHtml: 'vin'
}
],
},
isEditVin: false,
editFormSec: {
vin: ''
},
tempVin: ''
}
},
mounted() {
this.editFormSec.vin = this.$common.utils.deepClone(this.editForm?.vehicle.vin)
this.tempVin = this.$common.utils.deepClone(this.editForm?.vehicle.vin)
},
methods: {
resetStatus() {
this.isEditVin = false
},
handleChangeVin() {
this.isEditVin = !this.isEditVin
this.$refs?.editFormRefSec?.$refs?.editChildRef?.clearValidate();
},
// 取消后,vin改回原来的值
handleVinCancel() {
this.editFormSec.vin = this.$common.utils.deepClone(this.tempVin)
this.handleChangeVin()
},
handleVinConfirm() {
this.$refs.editFormRefSec.$refs.editChildRef.validate(valid => {
if (valid) {
this.handleChangeVin()
this.tempVin = this.$common.utils.deepClone(this.editFormSec.vin)
}
})
},
handleCancel() {
this.resetStatus()
this.$emit('handleSecondClose')
},
handleOk() {
this.resetStatus()
this.$emit('handleSecondOk', this.editFormSec.vin)
}
}
}
</script>
<style lang="scss" scoped>
.second-dialog .tips {
margin-bottom: 32px;
padding: 0 16px;
height: 40px;
line-height: 40px;
background: #ffefda;
font-size: 14px;
color: #000000a6;
display: flex;
align-items: center;
}
.second-dialog .icon-info {
width: 16px;
height: 16px;
margin-right: 8px;
}
.second-dialog .icon-edit {
width: 16px;
height: 16px;
margin-left: 10px;
cursor: pointer;
}
.second-dialog .vin-detail {
display: flex;
align-items: center;
}
.second-dialog .vin-edit {
display: flex;
}
.second-dialog .vin-edit .vin-btn {
padding: 0;
}
</style>
......@@ -280,6 +280,8 @@
<el-tab-pane v-for="item in tabsList" :key="item.name" :label="item.label" :name="item.name"></el-tab-pane>
</el-tabs>
</div>
<secondDialog v-if="secondVisible" :secondVisible="secondVisible" :formRules="editRuleCar" :editForm="editForm" @handleSecondClose="handleSecondClose" @handleSecondOk="handleSecondOk"></secondDialog>
</div>
</template>
......@@ -317,6 +319,7 @@ import utils from '../../util/util'
import uploadInfo from './uploadInfo.vue'
import FormatInput from '@/components/FormatInput'
import NP from 'number-precision'
import secondDialog from './components/secondDialog'
export default {
name: 'editEquity',
data() {
......@@ -324,6 +327,7 @@ export default {
size: 'small',
submit: false,
isBlock: true,
secondVisible: false,
curDom: 'cardInfo',
tabsList: [
{ label: '车辆信息', name: 'cardInfo' },
......@@ -968,7 +972,8 @@ export default {
glsxCombiForm,
qrCode,
uploadInfo,
FormatInput
FormatInput,
secondDialog
},
async created() {
......@@ -2411,6 +2416,20 @@ export default {
}
return isEmpty
},
secondChange() {
this.secondVisible = !this.secondVisible
},
handleSecondClose() {
this.secondChange()
this.submit = false
this.params = {}
},
handleSecondOk(val) {
this.secondChange()
this.editForm.vehicle.vin = val
this.params.vehicle.vin = val
this.api()
},
checkRefitInfo() {
if (this.$refs?.refitRef?.$refs?.formRef) {
this.$refs?.refitRef?.$refs.formRef.validate(valid => {
......@@ -2422,6 +2441,26 @@ export default {
this.handleConfirm()
}
},
api() {
this.$apis.beforeSale.checkOrderApi({ vin: this.editForm.vehicle.vin, contractNo: this.routeInfo.contractNo || '' }).then(res => {
if (res.code == '0') {
this.updateEquity(this.params)
} else {
this.submit = false
this.$confirm(res.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.submit = true
this.updateEquity(this.params)
}
}
})
}
})
},
handleConfirm() {
try {
this.vaildGlassParams()
......@@ -2483,24 +2522,8 @@ export default {
params.attachmentList = this.attachmentList || []
}
params.attachmentList = params.attachmentList || []
this.$apis.beforeSale.checkOrderApi({ vin: this.editForm.vehicle.vin, contractNo: this.routeInfo.contractNo || '' }).then(res => {
if (res.code == '0') {
this.updateEquity(params)
} else {
this.submit = false
this.$confirm(res.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.submit = true
this.updateEquity(params)
}
}
})
}
})
this.params = this.$common.utils.deepClone(params)
this.secondChange()
} catch (error) {
console.log(error)
this.submit = false
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!