Commit b3a5c504 by 李伟康

feat(recorder): 集成业务数据记录服务到车辆品牌选择和客户信息组件

- 在 CarBrands 组件中引入 recordService 并替换原有的 dispatch 状态管理
- 使用 recordService.updateBusinessData 替代 dispatch('setCustomerInfo')
- 在 FinishStep 组件中添加 recordService 导入并更新客户信息处理逻辑
- 修改 inputCustomer 函数以支持字段级别的数据更新
- 将销售员工选择逻辑迁移到 recordService 数据管理
- 更新页面打开时从 recordService 获取业务数据的逻辑
- 移除不再使用的 store dispatch 调用和相关监听器
- 在权益详情页中简化音频停止逻辑并移除冗余的业务数据更新
1 parent 037b08db
......@@ -51,6 +51,7 @@
import { getMerchantCarBrandList,getCarBrandsListApi } from '@/api/common-api.uts'
import { state, dispatch } from "@/store/index.uts"
import { ComponentPublicInstance } from 'vue'
import { recordService } from '@/services/recorder/index.uts'
......@@ -166,7 +167,15 @@
stateCustomerInfo.carModel = (item as UTSJSONObject).name
stateCustomerInfo.carModelId = (item as UTSJSONObject).id
if (props.linkage) {
dispatch('setCustomerInfo', stateCustomerInfo)
recordService.updateBusinessData({
carBrand: selectItemVal.carChildsBrandName,
carBrandId: selectItemVal.carChildsBrandId,
oneCarBrand: selectItemVal.carBrand,
oneCarBrandId: selectItemVal.carBrandId,
carModel: (item as UTSJSONObject).name,
carModelId: (item as UTSJSONObject).id
})
// dispatch('setCustomerInfo', stateCustomerInfo)
dispatch('updateViewKey')
dispatch('setCurrentCarInfo', selectItemVal)
}
......
......@@ -46,7 +46,7 @@
class="input"
:placeholder="i.placeholder"
:disabled="customerType == 0"
@input="inputCustomer"
@input="inputCustomer(i.key)"
placeholder-style="color:#c9c9c9;"
/>
</template>
......@@ -116,9 +116,10 @@
import { ref, computed, watch } from 'vue'
import Employee from '@/components/Employee.uvue'
import CarBrands from '@/components/CarBrands.uvue'
import { state, dispatch } from '@/store/index.uts'
import { state } from '@/store/index.uts'
import MessageBox from './MessageBox.uvue'
import { ComponentPublicInstance } from 'vue'
import { recordService } from '@/services/recorder/index.uts'
type FormObjectItem = {
label: string
......@@ -291,9 +292,6 @@
(formRef.value as ComponentPublicInstance).$callMethod('close')
}
}, { immediate: true })
watch(errorTip, () => {
console.log('errorTip', errorTip.value)
})
function showError(key: string): boolean {
const value = formData.value
let flag = (value as UTSJSONObject)[key] == ''
......@@ -387,17 +385,23 @@
}
function inputCustomer(): void {
dispatch('setCustomerInfo', formData.value as any)
function inputCustomer(key: string): void {
const value = (formData.value as UTSJSONObject)[key] as string
recordService.updateBusinessData({
[key]: value
})
}
function handleSelect(item: IUTSObject, popkey: string): void {
const customerInfo = dispatch('getCustomerInfo') as IUTSObject
const value = formData.value as UTSJSONObject
const value = formData.value as UTSJSONObject
if (popkey == "employeeBoxVisible") {
(value as UTSJSONObject).salesUuid = item['uuid'] as string
(value as UTSJSONObject).staffName = item['staffName'] as string
dispatch("setCustomerInfo", { ...customerInfo, salesUuid: item['uuid'] as string, staffName: item['staffName'] as string })
recordService.updateBusinessData({
salesUuid: item['uuid'] as string,
staffName: item['staffName'] as string
})
} else {
if (carBrandListVisible.value != null) {
(carBrandListVisible.value as ComponentPublicInstance).$callMethod('close')
......@@ -410,10 +414,17 @@
}
function open(): void {
const customerInfo = dispatch('getCustomerInfo')
recordService.getBusinessData().then(data =>{
const customerInfo = data as UTSJSONObject
if (customerInfo != null) {
formData.value = customerInfo as UTSJSONObject
formData.value = {
customerName: customerInfo.customerName != null && customerInfo.customerName != 'null' ? customerInfo.customerName : '',
carModel: customerInfo.carModel != null && customerInfo.carModel != 'null' ? customerInfo.carModel : '',
carModelId: customerInfo.carModelId != null && customerInfo.carModelId != 'null' ? customerInfo.carModelId : '',
phoneNumber: customerInfo.phoneNumber != null && customerInfo.phoneNumber != 'null' ? customerInfo.phoneNumber : '',
staffName: customerInfo.staffName != null && customerInfo.staffName != 'null' ? customerInfo.staffName : '',
salesUuid: customerInfo.salesUuid != null && customerInfo.salesUuid != 'null' ? customerInfo.salesUuid : '',
}
let _sceneType = props.sceneType
let _customerType = props.customerType
let stepValue = 1
......@@ -421,7 +432,7 @@
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
const value = customerInfo[key] as string | null
const value = formData.value[key] as string | null
if (value == null || value == '') {
stepValue = 1
break
......@@ -452,30 +463,12 @@
}
updateViewKey.value = Date.now()
}
})
}
function chooseResult(val: string): void {
receptionStatus.value = val
dispatch('setReceptionStatus', val)
}
function updateStep(): void {
const customerInfo = dispatch('getCustomerInfo') as IUTSObject
let stepValue = 1
const keys = ['customerName', 'carModel', 'phoneNumber']
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
const value = customerInfo[key]
if (value == null || value === '') {
stepValue = 1
break
}
stepValue = 2
}
step.value = stepValue
recordService.updateBusinessData({ receptionStatus: val })
}
defineExpose({ open, close })
......
......@@ -164,7 +164,8 @@
import { state , dispatch} from "@/store/index.uts"
import { getSoureData } from '@/api/system-api.uts'
import { findPayInfo as findPayInfoApi } from '@/api/common-api.uts'
import { recordService, BusinessDataType } from '@/services/recorder/index.uts'
import { recordService } from '@/services/recorder/index.uts'
type BackPressEvent = {
from: string
}
......@@ -513,15 +514,8 @@ const currentCarInfo = computed(() => {
if (stepRef.value != null) {
(stepRef.value as ComponentPublicInstance).$callMethod('close')
}
const customerInfo = state.user.customerInfo as UTSJSONObject
customerInfo.receptionStatus = val
console.log(JSON.stringify(customerInfo))
recordService.updateBusinessData(
'customer',
customerInfo
)
recordService.stopAudio()
const customerInfo = state.user.customerInfo as UTSJSONObject
recordService.stopAudio()
uni.navigateBack()
// receptionTrackLeave()
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!