Commit 200f23df by cen

fix: 车型bug修复

1 parent fe6a8a7d
...@@ -109,6 +109,8 @@ ...@@ -109,6 +109,8 @@
background-position: calc(100vmin * (1173 / 768) * -0.578005115089514) calc(100vmin * (1173 / 768) * -0.5400682011935208);} background-position: calc(100vmin * (1173 / 768) * -0.578005115089514) calc(100vmin * (1173 / 768) * -0.5400682011935208);}
.icon-feedback { width: calc(100vmin * (1173 / 768) * 0.027280477408354646); height: calc(100vmin * (1173 / 768) * 0.027280477408354646); .icon-feedback { width: calc(100vmin * (1173 / 768) * 0.027280477408354646); height: calc(100vmin * (1173 / 768) * 0.027280477408354646);
background-position: calc(100vmin * (1173 / 768) * -0.6547314578005116) calc(100vmin * (1173 / 768) * -0.526001705029838);} background-position: calc(100vmin * (1173 / 768) * -0.6547314578005116) calc(100vmin * (1173 / 768) * -0.526001705029838);}
.icon-feedbackIcon { width: calc(100vmin * (1173 / 768) * 0.011082693947144074); height: calc(100vmin * (1173 / 768) * 0.011082693947144074);
background-position: calc(100vmin * (1173 / 768) * -0.5473145780051151) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
.icon-ffdyj-icon { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655); .icon-ffdyj-icon { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655);
background-position: calc(100vmin * (1173 / 768) * -0.6952259164535379) calc(100vmin * (1173 / 768) * -0.3034953111679454);} background-position: calc(100vmin * (1173 / 768) * -0.6952259164535379) calc(100vmin * (1173 / 768) * -0.3034953111679454);}
.icon-filter { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323); .icon-filter { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
...@@ -394,6 +396,4 @@ ...@@ -394,6 +396,4 @@
.icon-yw-icon { width: calc(100vmin * (1173 / 768) * 0.015345268542199489); height: calc(100vmin * (1173 / 768) * 0.015345268542199489); .icon-yw-icon { width: calc(100vmin * (1173 / 768) * 0.015345268542199489); height: calc(100vmin * (1173 / 768) * 0.015345268542199489);
background-position: calc(100vmin * (1173 / 768) * -0.5221653878942881) calc(100vmin * (1173 / 768) * -0.45865302642796246);} background-position: calc(100vmin * (1173 / 768) * -0.5221653878942881) calc(100vmin * (1173 / 768) * -0.45865302642796246);}
.icon-zj-icon { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323); .icon-zj-icon { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
background-position: calc(100vmin * (1173 / 768) * -0.44075021312872975) calc(100vmin * (1173 / 768) * -0.6717817561807332);}
.icon-feedbackIcon { width: calc(100vmin * (1173 / 768) * 0.011082693947144074); height: calc(100vmin * (1173 / 768) * 0.011082693947144074);
background-position: calc(100vmin * (1173 / 768) * -0.5473145780051151) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
\ No newline at end of file \ No newline at end of file
background-position: calc(100vmin * (1173 / 768) * -0.44075021312872975) calc(100vmin * (1173 / 768) * -0.6717817561807332);}
\ No newline at end of file \ No newline at end of file
...@@ -155,8 +155,10 @@ export default { ...@@ -155,8 +155,10 @@ export default {
index: 0, index: 0,
carList: [], carList: [],
selectDate: '', selectDate: '',
currentIdentifiedBrandName: null,
popupTypeEnum, popupTypeEnum,
title: '新增评估单', title: '新增评估单',
selectedCarInfo: null,
endDate: dayjs().format('YYYY-MM-DD'), endDate: dayjs().format('YYYY-MM-DD'),
isExistSamePlate: false, isExistSamePlate: false,
formData: { formData: {
...@@ -234,7 +236,7 @@ export default { ...@@ -234,7 +236,7 @@ export default {
{ key: 'registrationCity', label: '上牌城市', required: true, fullWidth: false, targetNameKey: 'cityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationCityName', targetObj: 'carBaseReqDTO', type: 'select', showText: 'shopMerchantName', isCity: true }, { key: 'registrationCity', label: '上牌城市', required: true, fullWidth: false, targetNameKey: 'cityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationCityName', targetObj: 'carBaseReqDTO', type: 'select', showText: 'shopMerchantName', isCity: true },
{ key: 'registrationDate', label: '上牌时间', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationDate', targetObj: 'carBaseReqDTO', type: 'calendar', showText: 'shopMerchantName', endDate: true }, { key: 'registrationDate', label: '上牌时间', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'registrationDate', targetObj: 'carBaseReqDTO', type: 'calendar', showText: 'shopMerchantName', endDate: true },
{ key: 'carCity', label: '车辆所在地', required: true, fullWidth: false, targetNameKey: 'carCityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'carCityName', targetObj: 'carBaseReqDTO', type: 'select', isCarCity: true }, { key: 'carCity', label: '车辆所在地', required: true, fullWidth: false, targetNameKey: 'carCityName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'carCityName', targetObj: 'carBaseReqDTO', type: 'select', isCarCity: true },
{ key: 'mileage', label: '表显里程', inputType: 'number', min: 0, max: 999999, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'mileage', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '^[0-9]{0,6}$', cell: '公里', isCell: true }, { key: 'mileage', label: '表显里程', inputType: 'number', min: 0, max: 999999, maxlength: 6, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'mileage', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '^[0-9]{0,6}$', cell: '公里', isCell: true },
{ {
key: 'usageType', key: 'usageType',
label: '使用性质', label: '使用性质',
...@@ -383,7 +385,7 @@ export default { ...@@ -383,7 +385,7 @@ export default {
] ]
}, },
{ key: 'productionDate', label: '生产日期', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'productionDate', targetObj: 'carBaseReqDTO', type: 'calendar', endDate: true }, { key: 'productionDate', label: '生产日期', required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'productionDate', targetObj: 'carBaseReqDTO', type: 'calendar', endDate: true },
{ key: 'guidePrice', label: '指导价', inputType: 'number', min: 0, max: 999999.99, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'guidePrice', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '^[0-9]{0,6}$', cell: '元', isCell: true }, { key: 'guidePrice', label: '指导价', inputType: 'number', min: 0, max: 9999999.99, maxlength: 10, required: true, fullWidth: false, targetNameKey: 'sellerName', sourceNameKey: 'staffName', sourceKey: 'uuid', targetKey: 'guidePrice', targetObj: 'carBaseReqDTO', type: 'input', showText: 'shopMerchantName', pattern: '/^\d+(\.\d{1,2})?$/', cell: '元', isCell: true },
{ {
key: 'buyNewCar', key: 'buyNewCar',
label: '是否购买新车', label: '是否购买新车',
...@@ -464,8 +466,8 @@ export default { ...@@ -464,8 +466,8 @@ export default {
} }
], ],
licenseFormFields: [ licenseFormFields: [
{ key: 'keyCount', label: '钥匙数', required: true, fullWidth: false, targetKey: 'keyCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$' }, { key: 'keyCount', label: '钥匙数', required: true, fullWidth: false, targetKey: 'keyCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$', maxlength: 1 },
{ key: 'transferCount', label: '过户次数', required: true, fullWidth: false, targetKey: 'transferCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$' }, { key: 'transferCount', label: '过户次数', required: true, fullWidth: false, targetKey: 'transferCount', targetObj: 'carLicenseReqDTO', type: 'input', inputType: 'number', min: 0, max: 9, pattern: '^[0-9]{1}$', maxlength: 1 },
{ key: 'compulsoryInsuranceExpiry', label: '交强险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'compulsoryInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false }, { key: 'compulsoryInsuranceExpiry', label: '交强险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'compulsoryInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
{ key: 'annualInspectionExpiry', label: '年审到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'annualInspectionExpiry', targetObj: 'carLicenseReqDTO', endDate: false }, { key: 'annualInspectionExpiry', label: '年审到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'annualInspectionExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
{ key: 'commercialInsuranceExpiry', label: '商业险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'commercialInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false }, { key: 'commercialInsuranceExpiry', label: '商业险到期', required: true, fullWidth: false, type: 'calendar', targetKey: 'commercialInsuranceExpiry', targetObj: 'carLicenseReqDTO', endDate: false },
...@@ -586,7 +588,24 @@ export default { ...@@ -586,7 +588,24 @@ export default {
that.formData.carLicenseReqDTO = { ...carLicense } that.formData.carLicenseReqDTO = { ...carLicense }
that.formData.imageList = [...images] that.formData.imageList = [...images]
that.formData.evalOrderNo = evalOrderNo that.formData.evalOrderNo = evalOrderNo
that.selectedCarInfo = {
brand: {
id: that.formData.carBaseReqDTO.carBrandId,
name: that.formData.carBaseReqDTO.carBrand
},
series: {
id: that.formData.carBaseReqDTO.carChildsBrandId,
name: that.formData.carBaseReqDTO.carChildsBrandName
},
model: {
id: that.formData.carBaseReqDTO.carSeriesId,
name: that.formData.carBaseReqDTO.carSeriesName
},
year: {
id: that.formData.carBaseReqDTO.carTypeId,
name: that.formData.carBaseReqDTO.carTypeName
}
}
that.formImagesData = {} that.formImagesData = {}
that.certificateImagesData = {} that.certificateImagesData = {}
that.carVideoData = {} that.carVideoData = {}
...@@ -706,10 +725,10 @@ export default { ...@@ -706,10 +725,10 @@ export default {
// 指导价验证 - 数字,0-999999 // 指导价验证 - 数字,0-999999
const guidePrice = this.formData.carBaseReqDTO.guidePrice const guidePrice = this.formData.carBaseReqDTO.guidePrice
const priceRegex = /^[0-9]{1,6}$/ const priceRegex = /^\d+(\.\d{1,2})?$/
if (!priceRegex.test(guidePrice) || guidePrice < 0 || guidePrice > 999999.99) { if (!priceRegex.test(guidePrice) || guidePrice < 0 || guidePrice > 9999999.99) {
uni.showToast({ uni.showToast({
title: '指导价必须为0-999999.99之间的数字', title: '指导价必须为0-9999999.99之间的数字',
icon: 'none' icon: 'none'
}) })
return return
...@@ -783,17 +802,23 @@ export default { ...@@ -783,17 +802,23 @@ export default {
}, },
handleCell(field) { handleCell(field) {
const that = this const that = this
console.log('handleCell', field) if (field.isCar) {
this.currentField = field // 处理车型选择
if (field.key === 'brandModel') { if (this.currentIdentifiedBrandName) {
this.$refs.selectCar.open() // 识别场景:传入品牌名称
} else if (field.key === 'sellerUserId' && field.type == 'select') { this.$refs.selectCar.open(this.currentIdentifiedBrandName)
this.$refs.orderPopup.open() this.currentIdentifiedBrandName = null
} else if (field.key === 'registrationCity') { } else {
// 新增/编辑场景:传入完整车型信息或null
this.$refs.selectCar.open(this.selectedCarInfo || null)
}
} else if (field.isCity) {
// 处理城市选择
this.$refs.selectCity.open() this.$refs.selectCity.open()
} else if (field.key === 'carCity') { } else if (field.isCarCity) {
this.$refs.selectCarCity.open() this.$refs.selectCarCity.open()
} else if (field.type === 'calendar') { } else if (field.type === 'calendar') {
this.currentField = field
if (field.endDate) { if (field.endDate) {
this.endDate = dayjs().format('YYYY-MM-DD') this.endDate = dayjs().format('YYYY-MM-DD')
} else { } else {
...@@ -808,10 +833,14 @@ export default { ...@@ -808,10 +833,14 @@ export default {
.catch(() => { .catch(() => {
console.log('日期取消') console.log('日期取消')
}) })
} else if (field.type === 'select' && field.targetObj === 'evalOrderBasicReqDTO' && field.targetKey === 'sellerUserId') {
this.currentField = field
this.$refs.orderPopup.open()
} }
}, },
handleCarSelected(date) { handleCarSelected(date) {
console.log('handleCarSelected', date) console.log('handleCarSelected', date)
this.selectedCarInfo = date
this.$set(this.formData.carBaseReqDTO, 'carBrandId', date.brand.id) this.$set(this.formData.carBaseReqDTO, 'carBrandId', date.brand.id)
this.$set(this.formData.carBaseReqDTO, 'carBrand', date.brand.name) this.$set(this.formData.carBaseReqDTO, 'carBrand', date.brand.name)
this.$set(this.formData.carBaseReqDTO, 'carChildsBrandId', date.series.id) this.$set(this.formData.carBaseReqDTO, 'carChildsBrandId', date.series.id)
......
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
methods: { methods: {
open() { open() {
this.$nextTick(() => { this.$nextTick(() => {
console.log(this.$refs) console.log(this.$refs.publishPopup)
if (this.$refs.publishPopup) { if (this.$refs.publishPopup) {
this.$refs.publishPopup.open() this.$refs.publishPopup.open()
} }
...@@ -112,6 +112,7 @@ export default { ...@@ -112,6 +112,7 @@ export default {
this.$emit('close') this.$emit('close')
}, },
confirm() { confirm() {
console.log('confirm', this.autoClose)
if (this.resolve) { if (this.resolve) {
if (this.autoClose) { if (this.autoClose) {
this.$refs.publishPopup.close() this.$refs.publishPopup.close()
......
<template> <template>
<GeneralPopup ref="carPopup" popupClass="carPopup" :list="list" :title="title" @confirm="confirm"> <GeneralPopup ref="carPopup" popupClass="carPopup" :list="list" :title="title" @confirm="confirm">
<template v-slot:content> <template v-slot:content>
<StepTab :steps="steps" :currentStep="currentStep" :clickable="true" @step-change="onStepChange" :isShowStepNumber="false"></StepTab> <StepTab
:steps="
steps.map(step => ({
label: step.selectedText || step.label,
number: step.number
}))
"
:currentStep="currentStep"
:clickable="true"
@step-change="onStepChange"
:isShowStepNumber="false"
></StepTab>
<view class="list-component"> <view class="list-component">
<SortByNameList :items="currentStepData" :activeValue="currentSelectedId" :activeField="'id'" :itemNameField="'name'" :groupKeyField="'letter'" :itemsPerRow="3" :itemSpacing="32" @item-click="handleItemClick" :enableFastScroll="false" /> <SortByNameList :items="currentStepData" :activeValue="currentStep === 0 ? stepSelectedIds[0] || null : currentSelectedId" :activeField="'id'" :itemNameField="'name'" :groupKeyField="'letter'" :itemsPerRow="3" :itemSpacing="32" @item-click="handleItemClick" :enableFastScroll="false" />
</view> </view>
</template> </template>
</GeneralPopup> </GeneralPopup>
...@@ -33,20 +44,24 @@ export default { ...@@ -33,20 +44,24 @@ export default {
data() { data() {
return { return {
currentStep: 0, currentStep: 0,
currentSelectedId: null, stepSelectedIds: [null, null, null, null],
steps: [ steps: [
{ label: '品牌选择', number: 1 }, { label: '品牌选择', number: 1, selectedText: '' },
{ label: '系列选择', number: 2 }, { label: '系列选择', number: 2, selectedText: '' },
{ label: '车型选择', number: 3 }, { label: '车型选择', number: 3, selectedText: '' },
{ label: '年份选择', number: 4 } { label: '年份选择', number: 4, selectedText: '' }
], ],
carBrandData: [], carBrandData: [],
selectedBrand: null, selectedBrand: null,
selectedSeries: null, selectedSeries: null,
selectedModel: null, selectedModel: null,
selectedYear: null, selectedYear: null,
loadingYearData: false, // 添加加载状态标记 loadingYearData: false,
selectionResult: null selectionResult: null,
// 新增:保存上次选择结果,用于重复打开时回显
lastSelectedResult: null,
// 新增:标记当前是否为编辑模式
isEditMode: false
} }
}, },
created() { created() {
...@@ -55,9 +70,13 @@ export default { ...@@ -55,9 +70,13 @@ export default {
computed: { computed: {
currentStepData() { currentStepData() {
let data = [] let data = []
console.log(this.carBrandData)
console.log(this.selectedBrand)
console.log(this.selectedSeries)
console.log(this.selectedModel)
switch (this.currentStep) { switch (this.currentStep) {
case 0: case 0:
data = this.carBrandData data = this.carBrandData || []
break break
case 1: case 1:
data = this.selectedBrand?.childs || [] data = this.selectedBrand?.childs || []
...@@ -72,8 +91,15 @@ export default { ...@@ -72,8 +91,15 @@ export default {
data = [] data = []
} }
console.log(`Step ${this.currentStep} data:`, data.length, 'items') // 确保数据始终是数组
if (!Array.isArray(data)) {
data = []
}
return data return data
},
currentSelectedId() {
return this.stepSelectedIds[this.currentStep]
} }
}, },
methods: { methods: {
...@@ -89,7 +115,6 @@ export default { ...@@ -89,7 +115,6 @@ export default {
} }
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b' const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const signature = sign(params, secret) const signature = sign(params, secret)
console.log('签名结果:', signature)
uni.request({ uni.request({
url: 'http://qcdidicb.glsx.com.cn/router?method=glsx.accounts.base.car.brand.complete', url: 'http://qcdidicb.glsx.com.cn/router?method=glsx.accounts.base.car.brand.complete',
...@@ -100,9 +125,7 @@ export default { ...@@ -100,9 +125,7 @@ export default {
...params ...params
}, },
success(result) { success(result) {
console.log('请求结果:', result)
if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) { if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) {
// 不再预先添加所有车型的年份数据
that.carBrandData = result.data.data.carinfos that.carBrandData = result.data.data.carinfos
} else { } else {
console.error('Invalid car data format:', result) console.error('Invalid car data format:', result)
...@@ -114,10 +137,7 @@ export default { ...@@ -114,10 +137,7 @@ export default {
}) })
}, },
// 加载指定车型的年份数据
loadYearDataForModel(model) { loadYearDataForModel(model) {
console.log('loadYearDataForModel', model)
// 如果已经加载过数据,则不再重复加载
if (model.childs && model.childs.length > 0) { if (model.childs && model.childs.length > 0) {
return Promise.resolve(model.childs) return Promise.resolve(model.childs)
} }
...@@ -146,44 +166,187 @@ export default { ...@@ -146,44 +166,187 @@ export default {
...params ...params
}, },
success(result) { success(result) {
console.log('请求结果:', result) that.loadingYearData = false
if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) { if (result.data && result.data.code === '0' && result.data.data && result.data.data.carinfos) {
model.childs = result.data.data.carinfos || [] model.childs = result.data.data.carinfos || []
this.loadingYearData = false
resolve(model.childs) resolve(model.childs)
} else { } else {
reject(new Error('Invalid car data format')) console.error('无效的车型数据格式:', result)
model.childs = []
resolve([])
} }
}, },
fail(error) { fail(error) {
console.log(error, 'error') that.loadingYearData = false
model.childs = []
resolve([])
} }
}) })
}) })
}, },
open() { open(carInfo = null) {
console.log('Opening car selector popup') this.selectedBrand = null
this.$refs.carPopup.open() this.selectedSeries = null
return new Promise((resolve, reject) => { this.selectedModel = null
this.resolve = resolve this.selectedYear = null
this.reject = reject this.stepSelectedIds = [null, null, null, null]
this.steps.forEach(step => (step.selectedText = ''))
this.currentStep = 0
this.isEditMode = false
const ensureCarDataLoaded = () => {
return new Promise(resolve => {
if (this.carBrandData.length > 0) {
resolve()
} else {
const checkInterval = setInterval(() => {
if (this.carBrandData.length > 0) {
clearInterval(checkInterval)
resolve()
}
}, 100)
setTimeout(() => {
clearInterval(checkInterval)
resolve()
}, 3000)
}
})
}
ensureCarDataLoaded().then(() => {
// 编辑模式 - 传入了完整的车型信息对象
if (carInfo && typeof carInfo === 'object' && carInfo.brand) {
this.isEditMode = true
this._handleEditMode(carInfo)
}
// 识别模式 - 传入了品牌名称字符串
else if (carInfo && typeof carInfo === 'string') {
this._handleIdentifyMode(carInfo)
}
//重复打开/新增模式 - 无参数或使用上次选择结果
else if (!carInfo && this.lastSelectedResult) {
this._handleRepeatOpenMode()
}
return this.$refs.carPopup.open()
}) })
}, },
async _handleEditMode(carInfo) {
// 设置品牌信息
if (carInfo.brand && this.carBrandData && Array.isArray(this.carBrandData)) {
const fullBrand = this.carBrandData.find(item => item.id === carInfo.brand.id || item.name === carInfo.brand.name)
if (fullBrand) {
this.selectedBrand = fullBrand
this.stepSelectedIds[0] = fullBrand.id
this.steps[0].selectedText = fullBrand.name
} else {
this.selectedBrand = { ...carInfo.brand, childs: [] }
this.stepSelectedIds[0] = carInfo.brand.id
this.steps[0].selectedText = carInfo.brand.name
}
}
// 设置系列信息
if (carInfo.series && this.selectedBrand && this.selectedBrand.childs && Array.isArray(this.selectedBrand.childs)) {
const fullSeries = this.selectedBrand.childs.find(item => item.id === carInfo.series.id || item.name === carInfo.series.name)
if (fullSeries) {
this.selectedSeries = fullSeries
this.stepSelectedIds[1] = fullSeries.id
this.steps[1].selectedText = fullSeries.name
this.currentStep = 1
} else {
this.selectedSeries = { ...carInfo.series, childs: [] }
this.stepSelectedIds[1] = carInfo.series.id
this.steps[1].selectedText = carInfo.series.name
this.currentStep = 1
}
}
// 设置车型信息
if (carInfo.model && this.selectedSeries && this.selectedSeries.childs && Array.isArray(this.selectedSeries.childs)) {
const fullModel = this.selectedSeries.childs.find(item => item.id === carInfo.model.id || item.name === carInfo.model.name)
if (fullModel) {
this.selectedModel = fullModel
this.stepSelectedIds[2] = fullModel.id
this.steps[2].selectedText = fullModel.name
this.currentStep = 2
// 加载年份数据
if (!this.selectedModel.childs || this.selectedModel.childs.length === 0) {
await this.loadYearDataForModel(this.selectedModel)
}
} else {
this.selectedModel = { ...carInfo.model, childs: [] }
this.stepSelectedIds[2] = carInfo.model.id
this.steps[2].selectedText = carInfo.model.name
this.currentStep = 2
}
}
console.log('carInfo', carInfo)
console.log('this.selectedModel:', this.selectedModel)
// 设置年份信息
if (carInfo.year && this.selectedModel && this.selectedModel.childs && Array.isArray(this.selectedModel.childs)) {
const fullYear = this.selectedModel.childs.find(item => item.id === carInfo.year.id || item.name === carInfo.year.name)
if (fullYear) {
this.selectedYear = fullYear
this.stepSelectedIds[3] = fullYear.id
this.steps[3].selectedText = fullYear.name
this.currentStep = 3
} else {
this.selectedYear = { ...carInfo.year }
this.stepSelectedIds[3] = carInfo.year.id
this.steps[3].selectedText = carInfo.year.name
this.currentStep = 3
}
}
console.log('this.currentStep:', this.currentStep)
},
// 新增:处理识别模式
_handleIdentifyMode(brandName) {
const matchedBrand = this.carBrandData.find(item => (item.name && brandName && item.name.includes(brandName)) || item.name === brandName)
if (matchedBrand) {
this.selectedBrand = matchedBrand
this.stepSelectedIds[0] = matchedBrand.id
this.steps[0].selectedText = matchedBrand.name
this.selectedSeries = null
this.selectedModel = null
this.selectedYear = null
this.stepSelectedIds[1] = this.stepSelectedIds[2] = this.stepSelectedIds[3] = null
this.steps[1].selectedText = this.steps[2].selectedText = this.steps[3].selectedText = ''
}
},
// 新增:处理重复打开模式
_handleRepeatOpenMode() {
this._handleEditMode(this.lastSelectedResult)
},
confirm() { confirm() {
console.log(this.selectionResult) this.lastSelectedResult = this.selectionResult
this.$emit('car-selected', this.selectionResult) this.$emit('car-selected', this.selectionResult)
this.$refs.carPopup.close()
}, },
onStepChange(index) { onStepChange(index) {
console.log(`Changing step from ${this.currentStep} to ${index}`)
// 限制只能前进到已选择的下一级 // 限制只能前进到已选择的下一级
if (index === 0) { if (index === 0) {
this.currentStep = 0 this.currentStep = 0
} else if (index === 1 && this.selectedBrand) { } else if (index === 1 && this.selectedBrand) {
this.currentStep = 1 this.currentStep = 1
// 确保selectedBrand有childs属性
if (!this.selectedBrand.childs) {
this.selectedBrand.childs = []
}
} else if (index === 2 && this.selectedSeries) { } else if (index === 2 && this.selectedSeries) {
this.currentStep = 2 this.currentStep = 2
// 确保selectedSeries有childs属性
if (!this.selectedSeries.childs) {
this.selectedSeries.childs = []
}
} else if (index === 3 && this.selectedModel) { } else if (index === 3 && this.selectedModel) {
// 如果还没有年份数据,则加载 // 如果还没有年份数据,则加载
if (!this.selectedModel.childs || this.selectedModel.childs.length === 0) { if (!this.selectedModel.childs || this.selectedModel.childs.length === 0) {
...@@ -194,57 +357,58 @@ export default { ...@@ -194,57 +357,58 @@ export default {
this.currentStep = 3 this.currentStep = 3
} }
} }
// 重置当前步骤的选中ID
this.currentSelectedId = null
}, },
// 处理项目点击事件 // 处理项目点击事件
handleItemClick(item) { handleItemClick(item) {
console.log('Item clicked:', item) const isSameItem = this.stepSelectedIds[this.currentStep] === item.id
this.currentSelectedId = item.id this.stepSelectedIds[this.currentStep] = item.id
if (this.currentStep === 0) {
this.selectedBrand = item
this.selectedSeries = null
this.selectedModel = null
this.selectedYear = null
this.currentStep = 1
this.$emit('brand-selected', item)
} else if (this.currentStep === 1) {
this.selectedSeries = item
this.selectedModel = null
this.selectedYear = null
this.currentStep = 2
this.$emit('series-selected', item)
} else if (this.currentStep === 2) {
this.selectedModel = item
this.selectedYear = null
// 当点击第三层车型选择时,才去请求第四级数据 if (!isSameItem) {
this.loadYearDataForModel(item).then(years => { if (this.currentStep === 0) {
if (years && years.length > 0) { this.selectedBrand = item
this.currentStep = 3 this.selectedSeries = null
this.selectedModel = null
this.selectedYear = null
this.steps[1].selectedText = ''
this.steps[2].selectedText = ''
this.steps[3].selectedText = ''
} else if (this.currentStep === 1) {
this.selectedSeries = item
this.selectedModel = null
this.selectedYear = null
this.steps[2].selectedText = ''
this.steps[3].selectedText = ''
} else if (this.currentStep === 2) {
this.selectedModel = item
this.selectedYear = null
this.steps[3].selectedText = ''
} else if (this.currentStep === 3) {
this.selectedYear = item
this.selectionResult = {
brand: this.selectedBrand,
series: this.selectedSeries,
model: this.selectedModel,
year: this.selectedYear
} }
this.$emit('model-selected', item)
})
} else if (this.currentStep === 3) {
this.selectedYear = item
this.selectionResult = {
brand: this.selectedBrand,
series: this.selectedSeries,
model: this.selectedModel,
year: this.selectedYear
} }
}
// 可选:关闭弹窗 this.steps[this.currentStep].selectedText = item.name
// this.$refs.carPopup.close();
if (this.currentStep < 3) {
this.currentStep++
// 如果是第三步,需要加载年份数据
if (this.currentStep === 3 && this.selectedModel && (!this.selectedModel.childs || this.selectedModel.childs.length === 0)) {
this.loadYearDataForModel(this.selectedModel)
}
} }
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .carPopup { ::v-deep .carPopup {
.content { .content {
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</view> </view>
<view v-else-if="activeTabKey == 'contract'"> <view v-else-if="activeTabKey == 'contract'">
<view class="mb-32 upload-box" v-if="detailsInfo.signingInfo.saleContract"> <view class="mb-32 upload-box" v-if="detailsInfo.signingInfo.saleContract">
<view class="tab-panel-title">车辆买卖协议</view> <view class="tab-panel-title">二手车转让协议</view>
<view class="gridBoxNoPadding"> <view class="gridBoxNoPadding">
<view v-for="(item, index) in vehicleItems" :key="index" :class="['flex align-start', { 'full-width': item.fullWidth }, { 'align-center': item.type == 'link' }]"> <view v-for="(item, index) in vehicleItems" :key="index" :class="['flex align-start', { 'full-width': item.fullWidth }, { 'align-center': item.type == 'link' }]">
<view class="title-label-see mr-16">{{ item.label }}</view> <view class="title-label-see mr-16">{{ item.label }}</view>
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
</view> </view>
</view> </view>
<view class="mb-32 upload-box" v-if="detailsInfo.signingInfo.custodyContract"> <view class="mb-32 upload-box" v-if="detailsInfo.signingInfo.custodyContract">
<view class="tab-panel-title">车辆代管协议</view> <view class="tab-panel-title">车辆代保管协议</view>
<view class="gridBoxNoPadding"> <view class="gridBoxNoPadding">
<template v-for="(item, index) in vehicleManagementItems"> <template v-for="(item, index) in vehicleManagementItems">
<view v-if="formatValue(item, detailsInfo)" :key="index" :class="['flex align-start', { 'full-width': item.fullWidth }, { 'align-center': item.type == 'link' }]"> <view v-if="formatValue(item, detailsInfo)" :key="index" :class="['flex align-start', { 'full-width': item.fullWidth }, { 'align-center': item.type == 'link' }]">
...@@ -685,9 +685,9 @@ export default { ...@@ -685,9 +685,9 @@ export default {
if (item.map && this[item.map]) { if (item.map && this[item.map]) {
return this[item.map][rawValue] || rawValue return this[item.map][rawValue] || rawValue
} }
console.log('rawValue:', rawValue, item.key) console.log('rawValue:', rawValue, rawValue == 0, item.key)
return rawValue == 0 ? 0 : rawValue || '' return rawValue === 0 ? 0 : rawValue || '-'
}, },
getImageBySubtype(subtype) { getImageBySubtype(subtype) {
if (!this.detailsInfo.images) return [] if (!this.detailsInfo.images) return []
......
...@@ -628,6 +628,7 @@ export default { ...@@ -628,6 +628,7 @@ export default {
font-weight: 400; font-weight: 400;
padding: toRpx(16) toRpx(64); padding: toRpx(16) toRpx(64);
line-height: toRpx(48); line-height: toRpx(48);
text-align: center;
text { text {
color: #347bff; color: #347bff;
} }
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
</view> </view>
<view class="checkbox-name">{{ item.name }}</view> <view class="checkbox-name">{{ item.name }}</view>
<input class="checkbox-input" v-if="item.isShowInput && item.key != 'other'" v-model="formData[item.inputValue]" placeholder="请输入" type="number" maxlength="1" /> <input class="checkbox-input" v-if="item.isShowInput && item.key != 'other'" v-model="formData[item.inputValue]" placeholder="请输入" type="number" maxlength="1" />
<input class="checkbox-input" v-if="item.isShowInput && item.key == 'other'" v-model="formData[item.inputValue]" placeholder="请输入" maxlength="100" /> <input class="checkbox-input" @click.stop="" v-if="item.isShowInput && item.key == 'other'" v-model="formData[item.inputValue]" placeholder="请输入" maxlength="100" />
</label> </label>
</checkbox-group> </checkbox-group>
</template> </template>
...@@ -259,11 +259,6 @@ ...@@ -259,11 +259,6 @@
</view> </view>
</view> </view>
<order-popup ref="openDate" popupType="13" @onConfirm="confirmDate" /> <order-popup ref="openDate" popupType="13" @onConfirm="confirmDate" />
<GeneralPopup ref="calendarGeneralPopup" popupClass="calendarGeneralPopup" :showClose="false" :showTitle="false" @confirm="confirmCalendar">
<template #content>
<uni-calendar class="calendar" :showMonth="false" :endDate="endDate" @change="calendarChange" />
</template>
</GeneralPopup>
<NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup> <NoticePopup ref="notice" title="重要提示" text="当前页面暂未保存,是否确认退出" type="warning"></NoticePopup>
</view> </view>
</template> </template>
...@@ -363,7 +358,8 @@ export default { ...@@ -363,7 +358,8 @@ export default {
value: 'transferPhoto', value: 'transferPhoto',
name: '过户授权委托书照片', name: '过户授权委托书照片',
key: 'transferPhoto', key: 'transferPhoto',
checked: false checked: true,
disabled: true
}, },
{ {
value: 'other', value: 'other',
...@@ -598,6 +594,8 @@ export default { ...@@ -598,6 +594,8 @@ export default {
targetObj: '', targetObj: '',
type: 'input', type: 'input',
cell: '元', cell: '元',
inputType: 'number',
disabled: false,
isCell: true, isCell: true,
pattern: '^\\d*$' // 只允许数字输入 pattern: '^\\d*$' // 只允许数字输入
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!