Commit 586eb745 by Lin

feature(FinishStep、HomeFrame、boutique):改进表单处理和接收逻辑

- 更新了 FinishStep.vue,通过新增方法优化字段禁用逻辑。
- 在 HomeFrame.vue 中移除了未使用的事件监听器,以提升性能。
- 优化了精品页面的接待处理功能,包括客户数据管理以及个人资料接待时的事件发射。
- 改进 CustomerSide 组件的样式设计,以更好地处理文本溢出问题。
- 重构接待逻辑,确保在接待过程中正确传递和处理客户数据。
1 parent e3d6f1b6
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
:key="index" :key="index"
> >
<view :class="['label', { required: i.required }]">{{ i.label }}</view> <view :class="['label', { required: i.required }]">{{ i.label }}</view>
<view :class="['value', { error: showError(i.key) && i.required }, { disabled: customerType == 0 || i.disabled }]"> <view :class="['value', { error: showError(i.key) && i.required }, { disabled: isFieldDisabled(i) }]">
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <input
:type="i.inputType" :type="i.inputType"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
v-model="formData[i.key]" v-model="formData[i.key]"
class="input" class="input"
:placeholder="i.placeholder" :placeholder="i.placeholder"
:disabled="customerType == 0" :disabled="isFieldDisabled(i)"
@input="inputCustomer" @input="inputCustomer"
placeholder-style="color:#c9c9c9;" placeholder-style="color:#c9c9c9;"
/> />
...@@ -252,10 +252,15 @@ export default { ...@@ -252,10 +252,15 @@ export default {
if (key == 'phoneNumber' && this.formData[key]) flag = !phoneRex.test(this.formData[key]) if (key == 'phoneNumber' && this.formData[key]) flag = !phoneRex.test(this.formData[key])
return this.errorTip && flag return this.errorTip && flag
}, },
showPopup ({ popKey, disabled }) { isFieldDisabled (field) {
let { customerType } = this if (this.customerType == 0) return true
if (customerType == 0 || disabled) return if (field.disabled) return true
this.$refs[popKey].open(); if (this.formData.profilePrefilled && field.key === 'carModel') return true
return false
},
showPopup (field) {
if (this.isFieldDisabled(field)) return
this.$refs[field.popKey].open();
}, },
// 取消 // 取消
cancel () { cancel () {
...@@ -310,6 +315,7 @@ export default { ...@@ -310,6 +315,7 @@ export default {
} }
}, },
success (receptionStatus) { success (receptionStatus) {
this.$store.dispatch('setCustomerInfo', this.formData)
this.$refs.successRef.open(); this.$refs.successRef.open();
this.$emit('submit', receptionStatus) this.$emit('submit', receptionStatus)
}, },
...@@ -342,6 +348,8 @@ export default { ...@@ -342,6 +348,8 @@ export default {
this.$emit('back') this.$emit('back')
return return
} }
} else if (customerInfo.profilePrefilled) {
step = 1
} }
if (step == 2 && !this.check()) { if (step == 2 && !this.check()) {
this.errorTip = true this.errorTip = true
......
...@@ -421,7 +421,11 @@ export default { ...@@ -421,7 +421,11 @@ export default {
line-height: 22px; line-height: 22px;
font-weight: 500; font-weight: 500;
color: #1A1A2E; color: #1A1A2E;
flex-shrink: 0; min-width: 0;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
.customer-item-car-tag { .customer-item-car-tag {
......
...@@ -396,7 +396,6 @@ export default { ...@@ -396,7 +396,6 @@ export default {
uni.$off('levelStudyPopup') uni.$off('levelStudyPopup')
uni.$off('pageBack') uni.$off('pageBack')
uni.$off('refreshCustomerProfileGroupInfo') uni.$off('refreshCustomerProfileGroupInfo')
uni.$off('startReceptionFromCustomerDetail')
}, },
async mounted() { async mounted() {
console.log('sessionId**', uni.$storage.get('sessionId')) console.log('sessionId**', uni.$storage.get('sessionId'))
...@@ -499,9 +498,6 @@ export default { ...@@ -499,9 +498,6 @@ export default {
uni.$on('refreshCustomerProfileGroupInfo', () => { uni.$on('refreshCustomerProfileGroupInfo', () => {
this.getCustomerProfileGroupInfo() this.getCustomerProfileGroupInfo()
}) })
uni.$on('startReceptionFromCustomerDetail', () => {
this.start()
})
/** /**
* 获取员工场景小分类 * 获取员工场景小分类
*/ */
......
...@@ -223,11 +223,9 @@ export default { ...@@ -223,11 +223,9 @@ export default {
}, },
/**是否有选装项目 */ /**是否有选装项目 */
hasOptionals() { hasOptionals() {
let flag = false if (!this.show || !this.currentCarId) return false
if (this.show) { const optionals = this.boutiqueMediaConfig?.[this.currentCarId]?.optionals
flag = this.boutiqueMediaConfig[this.currentCarId].optionals && this.boutiqueMediaConfig[this.currentCarId].optionals.length return !!(optionals && optionals.length)
}
return flag
}, },
carList() { carList() {
return this.$store.state.user.boutiqueCarList return this.$store.state.user.boutiqueCarList
......
...@@ -175,7 +175,9 @@ export default { ...@@ -175,7 +175,9 @@ export default {
} }
]), ]),
loadComplete: false, loadComplete: false,
requested: false requested: false,
profileReceptionCustomer: null,
profileReceptionProcessing: false
} }
}, },
onBackPress (options) { onBackPress (options) {
...@@ -195,6 +197,10 @@ export default { ...@@ -195,6 +197,10 @@ export default {
this.requested = true this.requested = true
this.$refs.home.updateApp(true) this.$refs.home.updateApp(true)
this.getMerchantCarBrand() this.getMerchantCarBrand()
uni.$on('startProfileReception', this.handleProfileReception)
},
onUnload () {
uni.$off('startProfileReception', this.handleProfileReception)
}, },
async onShow () { async onShow () {
const userInfo = uni.$storage.get("userInfo") const userInfo = uni.$storage.get("userInfo")
...@@ -208,6 +214,7 @@ export default { ...@@ -208,6 +214,7 @@ export default {
} }
if (this.requested && !this.id) this.$refs.home.updateApp() if (this.requested && !this.id) this.$refs.home.updateApp()
this.getBoutiquePackageList() //套餐列表 this.getBoutiquePackageList() //套餐列表
this.tryStartPendingProfileReception()
}, },
computed: { computed: {
}, },
...@@ -362,6 +369,7 @@ export default { ...@@ -362,6 +369,7 @@ export default {
this.currentCarId = '' this.currentCarId = ''
this.bannerAutoplay = true this.bannerAutoplay = true
this.customerType = -1 this.customerType = -1
this.profileReceptionCustomer = null
this.clearHistory(); this.clearHistory();
this.recording = false this.recording = false
this.setReceptionStatus(-1); this.setReceptionStatus(-1);
...@@ -369,12 +377,73 @@ export default { ...@@ -369,12 +377,73 @@ export default {
if (this.requested) this.$refs.home.updateApp() if (this.requested) this.$refs.home.updateApp()
this.getBoutiquePackageList() //套餐列表 this.getBoutiquePackageList() //套餐列表
}, },
handleProfileReception (customer) {
const pendingCustomer = customer || uni.$storage.get('pendingProfileReception')
if (!pendingCustomer || this.profileReceptionProcessing) return
this.profileReceptionProcessing = true
uni.$storage.rm('pendingProfileReception')
this.$nextTick(async () => {
try {
await this.startReceptionFromProfile(pendingCustomer)
} finally {
this.profileReceptionProcessing = false
}
})
},
tryStartPendingProfileReception () {
let customer = ''
try {
customer = uni.$storage.get('pendingProfileReception')
} catch (e) {
return
}
if (!customer) return
this.handleProfileReception()
},
waitForHomeRef (retry = 20) {
return new Promise(resolve => {
const check = (count) => {
if (this.$refs.home) resolve(true)
else if (count >= retry) resolve(false)
else setTimeout(() => check(count + 1), 50)
}
check(0)
})
},
async startReceptionFromProfile (customer) {
if (!customer) return
const homeReady = await this.waitForHomeRef()
if (!homeReady) {
uni.$storage.set('pendingProfileReception', customer)
uni.showToast({
title: '页面未就绪,请重试',
icon: 'none'
})
return
}
if (!this.moduleList.length) {
await this.getSoure()
}
uni.$track.add({ eventCode: 'app_reception_begins' })
const isReturnCustomer = !!customer.customerCouponId
this.customerType = isReturnCustomer ? 0 : 1
this.clearHistory()
this.jumpPage()
this.fillReceptionCustomer(customer)
const flag = await this.start(false)
if (!flag) return
this.recording = true
setTimeout(() => {
this.setReceptionStatus(1)
}, 1000)
},
async start (before = true) { async start (before = true) {
const isPermision = await this.$refs.home.isPermission() const isPermision = await this.$refs.home.isPermission()
if (!isPermision) return false if (!isPermision) return false
uni.$logger.local.info('〖接待管理Recorder〗 == 开始接待 ') uni.$logger.local.info('〖接待管理Recorder〗 == 开始接待 ')
if (before) this.clearHistory(); if (before) this.clearHistory();
this.$refs.home.startAudio(false) const started = await this.$refs.home.startAudio(false)
if (!started) return false
this.recording = true this.recording = true
return true return true
}, },
...@@ -382,9 +451,9 @@ export default { ...@@ -382,9 +451,9 @@ export default {
let { carBannerList } = this, let { carBannerList } = this,
carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId) carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId)
if (carBannerList.length == 1 || carIndex < 0) carIndex = 0 //只有一个车型或者默认车型没有时 if (carBannerList.length == 1 || carIndex < 0) carIndex = 0 //只有一个车型或者默认车型没有时
this.id = id ? id : this.moduleList[0].id this.id = id || (this.moduleList[0] && this.moduleList[0].id) || 1
this.tabId = 1 this.tabId = 1
this.currentCarId = carBannerList[carIndex].carModelId this.currentCarId = carBannerList[carIndex]?.carModelId || ''
this.type = "edit" this.type = "edit"
}, },
clearHistory () { clearHistory () {
...@@ -402,17 +471,29 @@ export default { ...@@ -402,17 +471,29 @@ export default {
if (!flag) return if (!flag) return
this.customerType = index this.customerType = index
if (index == 0) { if (index == 0) {
this.profileReceptionCustomer = null
const { id } = moduleList[2] const { id } = moduleList[2]
this.jumpPage(id) this.jumpPage(id)
} else {
this.jumpPage()
if (this.profileReceptionCustomer) {
this.fillReceptionCustomer(this.profileReceptionCustomer)
this.profileReceptionCustomer = null
}
} }
else this.jumpPage()
setTimeout(() => { setTimeout(() => {
this.setReceptionStatus(1); this.setReceptionStatus(1);
}, 1000); }, 1000);
}, },
async done (e) { async done (e) {
this.$refs.home.finishRef.close(); this.$refs.home.finishRef.close();
if (this.recording) await this.$refs.home.stopAudio(); if (this.recording) {
if (e !== undefined && e !== null && e !== -1) {
this.setReceptionStatus(e)
}
this.$refs.home.updateCustomerInfo(this.$store.state.user.customerInfo)
await this.$refs.home.stopAudio();
}
this.recording = false this.recording = false
setTimeout(() => { setTimeout(() => {
this.id = ""; this.id = "";
...@@ -420,26 +501,20 @@ export default { ...@@ -420,26 +501,20 @@ export default {
this.currentCarId = '' this.currentCarId = ''
this.bannerAutoplay = true this.bannerAutoplay = true
this.customerType = -1 this.customerType = -1
this.profileReceptionCustomer = null
this.$store.dispatch("clearHistory") this.$store.dispatch("clearHistory")
this.$store.dispatch('clearReceptionTrack') this.$store.dispatch('clearReceptionTrack')
this.getBoutiquePackageList() //套餐列表 this.getBoutiquePackageList() //套餐列表
this.setReceptionStatus(-1); this.setReceptionStatus(-1);
}, 1500); }, 1500);
}, },
/**客户邀约接待 */ fillReceptionCustomer (customer) {
reception (customer) { this.$nextTick(() => {
this.currentCarId = '' uni.$logger.local.info('index-reception:客户接待回填〗 == ' + JSON.stringify(customer))
this.$nextTick(async () => { this.$store.dispatch('setCustomerInfo', customer)
let { customerType } = this this.$nextTick(() => {
if (customerType == -1) {
const flag = await this.start(false)
if (!flag) return
} //开始接待
this.customerType = 0
this.jumpPage()
uni.$logger.local.info('index-reception:回店客户〗 == ' + JSON.stringify(customer))
this.$refs.home.updateCustomerInfo(customer) this.$refs.home.updateCustomerInfo(customer)
this.$nextTick(() => this.$store.dispatch('setCustomerInfo', customer)) })
let { carBannerList } = this, let { carBannerList } = this,
currentCarId = '', currentCarId = '',
carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId) carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId)
...@@ -452,6 +527,19 @@ export default { ...@@ -452,6 +527,19 @@ export default {
this.currentCarId = currentCarId this.currentCarId = currentCarId
}) })
}, },
/**客户邀约接待 */
reception (customer) {
this.$nextTick(async () => {
let { customerType } = this
if (customerType == -1) {
const flag = await this.start(false)
if (!flag) return
} //开始接待
this.customerType = 0
this.jumpPage()
this.fillReceptionCustomer(customer)
})
},
swiperChange (e) { swiperChange (e) {
this.currentIndex = e.detail.current this.currentIndex = e.detail.current
this.bannerTabId = `car-banner-${e.detail.current}` this.bannerTabId = `car-banner-${e.detail.current}`
......
...@@ -232,6 +232,7 @@ import dayjs from 'dayjs' ...@@ -232,6 +232,7 @@ import dayjs from 'dayjs'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue' import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
import RecordService from '@/utils/recordManager/RecordService'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{ default_customerForm = [{
label: '车主姓名', label: '车主姓名',
...@@ -327,7 +328,7 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -327,7 +328,7 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
placeholder: '请选择群成员' placeholder: '请选择群成员'
}, },
{ {
label: '备注', label: '订单备注',
valueKey: 'remark', valueKey: 'remark',
key: 'remark', key: 'remark',
type: 'input', type: 'input',
...@@ -719,7 +720,7 @@ export default { ...@@ -719,7 +720,7 @@ export default {
} }
this.syncInviteDateFromDelivery() this.syncInviteDateFromDelivery()
this.syncDisplayInfo(this.customerInfo) this.syncDisplayInfo(this.customerInfo)
console.log('findVisitsInfo**customerInfo*', this.customerInfo) console.log('客户详情**customerInfo*', this.customerInfo)
await this.getCustomerGroupInfo() await this.getCustomerGroupInfo()
}, },
backPage () { backPage () {
...@@ -739,8 +740,45 @@ export default { ...@@ -739,8 +740,45 @@ export default {
} }
this.submitCustomerProfileAPI() this.submitCustomerProfileAPI()
}, },
buildReceptionCustomer () {
const item = this.customerInfo
const { customerInviteRecordDTO = {} } = item
const { customerCouponId, customerCoupon = {} } = customerInviteRecordDTO
console.log('跳转开始接待**item*', item);
console.log('跳转开始接待**customerInviteRecordDTO*', customerCoupon.createdDate);
console.log('跳转开始接待**customerCouponId*', customerCouponId);
// let customer = {
// customerName: item.customerName,
// carModel: item.carSeriesName || '',
// phoneNumber: item.customerPhone,
// salesUuid: item.userId,
// staffName: item.employeeName,
// receiveCouponDate: item.receiveCouponDate,
// customerCouponId: item.customerCouponId,
// carSeriesId: item.carSeriesId || '',
// carBrand: item.carChildsBrandName || '',
// carBrandId: item.carChildsBrandId || '',
// oneCarBrand: item.carBrand || '',
// oneCarBrandId: item.carBrandId || ''
// }
return {
customerName: item.customerName,
carModel: item.carSeriesName || item.carChildsBrandName || '',
phoneNumber: item.customerPhone,
salesUuid: item.userId,
staffName: item.employeeName,
carSeriesId: item.carSeriesId || '',
carBrand: item.carChildsBrandName || '',
carBrandId: item.carChildsBrandId || '',
oneCarBrand: item.carBrand || '',
oneCarBrandId: item.carBrandId || '',
receiveCouponDate: customerCoupon.createdDate,
customerCouponId,
profilePrefilled: true
}
},
async startReception () { async startReception () {
const { sceneType, customerInfo } = this const { sceneType } = this
if (sceneType == 7) return // 二手车无接待功能 if (sceneType == 7) return // 二手车无接待功能
if (this.isRequiredFormIncomplete) { if (this.isRequiredFormIncomplete) {
uni.showToast({ uni.showToast({
...@@ -750,14 +788,19 @@ export default { ...@@ -750,14 +788,19 @@ export default {
return return
} }
if (this.isStartReceptionDisabled) return if (this.isStartReceptionDisabled) return
const recordService = RecordService.getInstance()
const hasPermission = await recordService.isPermission()
if (!hasPermission) return
const submitted = await this.submitCustomerProfileAPI({ fromReception: true }) const submitted = await this.submitCustomerProfileAPI({ fromReception: true })
if (!submitted) return if (!submitted) return
const customer = this.buildReceptionCustomer()
uni.$storage.set('pendingProfileReception', customer)
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
animationType: 'pop-out', animationType: 'pop-out',
animationDuration: 100, animationDuration: 100,
success: () => { success: () => {
uni.$emit('startReceptionFromCustomerDetail') uni.$emit('startProfileReception', customer)
} }
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!