Commit 1d06801d by Lin

fix(customerPages): 统一性别字段类型并优化日期选择项

- 将性别字段的默认值和选项值从字符串类型改为数字类型,以确保一致性。
- 在 addFiles.vue 和 detailFiles.vue 中新增日期选择项,提升用户体验。
- 更新 radioChange 方法以处理不同类型的值。
1 parent 8c390841
...@@ -227,13 +227,20 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -227,13 +227,20 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'customerSex', valueKey: 'customerSex',
key: 'customerSex', key: 'customerSex',
type: 'radio', type: 'radio',
current: '1', current: 1,
radioList: [ radioList: [
{ value: '1', name: '男' }, { value: 1, name: '男' },
{ value: '2', name: '女' } { value: 2, name: '女' }
] ]
}, },
{ {
label: '到店日期',
valueKey: 'inviteDate',
key: 'inviteDate',
type: 'date',
dateFromToday: true
},
{
label: '车架号', label: '车架号',
valueKey: 'standNo', valueKey: 'standNo',
key: 'standNo', key: 'standNo',
...@@ -242,13 +249,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -242,13 +249,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
maxlength: 17 maxlength: 17
}, },
{ {
label: '到店日期',
valueKey: 'inviteDate',
key: 'inviteDate',
type: 'date',
dateFromToday: true
},
{
label: '建档日期', label: '建档日期',
valueKey: 'filingDate', valueKey: 'filingDate',
key: 'filingDate', key: 'filingDate',
...@@ -315,7 +315,7 @@ export default { ...@@ -315,7 +315,7 @@ export default {
this.customerInfo = { this.customerInfo = {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
customerSex: '1', customerSex: 1,
carTypeName: '', carTypeName: '',
carChildsBrandId: '', carChildsBrandId: '',
carChildsBrandName: '', carChildsBrandName: '',
...@@ -340,8 +340,10 @@ export default { ...@@ -340,8 +340,10 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD") if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
if (!this.customerInfo.customerSex) { if (this.customerInfo.customerSex != null && this.customerInfo.customerSex !== '') {
this.customerInfo.customerSex = '1' this.customerInfo.customerSex = Number(this.customerInfo.customerSex)
} else {
this.customerInfo.customerSex = 1
} }
if (!this.customerInfo.filingDate) { if (!this.customerInfo.filingDate) {
this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD') this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD')
...@@ -399,7 +401,9 @@ export default { ...@@ -399,7 +401,9 @@ export default {
return field.dateUnlimited ? '2099-12-31' : this.endDate return field.dateUnlimited ? '2099-12-31' : this.endDate
}, },
radioChange (e, field) { radioChange (e, field) {
this.customerInfo[field.key] = e.detail.value const raw = e.detail.value
const sampleVal = field.radioList?.[0]?.value
this.customerInfo[field.key] = typeof sampleVal === 'number' ? Number(raw) : raw
}, },
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
const value = e.detail.value const value = e.detail.value
......
...@@ -303,10 +303,10 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -303,10 +303,10 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'customerSex', valueKey: 'customerSex',
key: 'customerSex', key: 'customerSex',
type: 'radio', type: 'radio',
current: '1', current: 1,
radioList: [ radioList: [
{ value: '1', name: '男' }, { value: 1, name: '男' },
{ value: '2', name: '女' } { value: 2, name: '女' }
] ]
}], }],
default_optionalForm = [ default_optionalForm = [
...@@ -387,23 +387,6 @@ export default { ...@@ -387,23 +387,6 @@ export default {
goodsSubOrderList () { goodsSubOrderList () {
return this.displayInfo.goodsSubOrderDTOS.filter(item => item) return this.displayInfo.goodsSubOrderDTOS.filter(item => item)
}, },
upgradeStatusInfo () {
const { customerInfo } = this
if (customerInfo.upgradeStatusName) {
return {
label: customerInfo.upgradeStatusName,
type: this.getUpgradeStatusType(customerInfo.upgradeStatusName)
}
}
const statusMap = {
1: { label: '待跟进', type: 'warning' },
2: { label: '已升级', type: 'success' },
3: { label: '战败', type: 'failed' },
4: { label: '已退款', type: 'refund' }
}
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus
return statusMap[status] || null
},
sceneType () { sceneType () {
const { sceneType } = uni.$storage.get('userInfo') || {} const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType return sceneType
...@@ -415,6 +398,9 @@ export default { ...@@ -415,6 +398,9 @@ export default {
isStartReceptionDisabled () { isStartReceptionDisabled () {
if (this.isRequiredFormIncomplete) return true if (this.isRequiredFormIncomplete) return true
return [2, 3, 4].includes(Number(this.customerInfo.customerStatus)) return [2, 3, 4].includes(Number(this.customerInfo.customerStatus))
},
isRemarkEditable () {
return Number(this.customerInfo.orderStatus) === 3
} }
}, },
data () { data () {
...@@ -681,13 +667,6 @@ export default { ...@@ -681,13 +667,6 @@ export default {
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : [] goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
} }
}, },
getUpgradeStatusType (label) {
if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning'
if (label === '战败') return 'failed'
if (label === '已退款') return 'refund'
return 'default'
},
initForm () { initForm () {
const { sceneType } = uni.$storage.get("userInfo") const { sceneType } = uni.$storage.get("userInfo")
default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50 default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50
...@@ -704,7 +683,7 @@ export default { ...@@ -704,7 +683,7 @@ export default {
this.customerInfo = { this.customerInfo = {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
customerSex: '1', customerSex: 1,
carBrand: '', carBrand: '',
carBrandId: '', carBrandId: '',
carSeriesName: '', carSeriesName: '',
...@@ -738,8 +717,10 @@ export default { ...@@ -738,8 +717,10 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
// 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name) // 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name)
Object.assign(this.customerInfo, res) Object.assign(this.customerInfo, res)
if (!this.customerInfo.customerSex) { if (this.customerInfo.customerSex != null && this.customerInfo.customerSex !== '') {
this.customerInfo.customerSex = '1' this.customerInfo.customerSex = Number(this.customerInfo.customerSex)
} else {
this.customerInfo.customerSex = 1
} }
if (!this.customerInfo.createdDate) { if (!this.customerInfo.createdDate) {
this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD') this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD')
...@@ -888,7 +869,9 @@ export default { ...@@ -888,7 +869,9 @@ export default {
} }
}, },
radioChange (e, field) { radioChange (e, field) {
this.customerInfo[field.key] = e.detail.value const raw = e.detail.value
const sampleVal = field.radioList?.[0]?.value
this.customerInfo[field.key] = typeof sampleVal === 'number' ? Number(raw) : raw
}, },
inputBlur (e, val) { inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo const standNoVal = this.customerInfo.standNo
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!