Commit e963b604 by Lin

修复(Employee, AddFiles, DetailFiles, PrelearnBridge):增强员工管理并优化数据管理

- 在 Employee 组件中新增 localEmployeeList,用于本地管理员工数据。
- 更新 AddFiles 中的员工选择逻辑,采用动态键,并改进显示值。
- 重构 DetailFiles 中的详细显示逻辑,以实现更佳的数据呈现效果。
- 修正 PrelearnBridge 中 merchantId 的使用方式,确保数据检索准确无误。
1 parent c699a62d
...@@ -40,6 +40,7 @@ export default { ...@@ -40,6 +40,7 @@ export default {
}, },
data () { data () {
return { return {
localEmployeeList: null
} }
}, },
watch: { watch: {
...@@ -55,15 +56,22 @@ export default { ...@@ -55,15 +56,22 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
selectedId () { selectedId () {
if (Array.isArray(this.list) || this.employeeType === 'seller') { if (Array.isArray(this.list)) {
return this.salesPropsUuid
}
// 优先使用父组件传入的选中值,避免多表单项共用弹框时与 vuex salesUuid 冲突
if (this.salesPropsUuid) {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid
}, },
displayList () { displayList () {
if (Array.isArray(this.list)) { if (Array.isArray(this.list)) {
return this.list return this.list
} }
if (Array.isArray(this.localEmployeeList)) {
return this.localEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -74,16 +82,24 @@ export default { ...@@ -74,16 +82,24 @@ export default {
this.$refs.employeeBoxVisible.open() this.$refs.employeeBoxVisible.open()
if (Array.isArray(this.list)) return if (Array.isArray(this.list)) return
const userInfo = uni.$storage.get("userInfo"), const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; { shopMerchantId, merchantId } = userInfo
/**获取销售人员 */ const fetchType = this.employeeType
uni.$api.commonApi this.localEmployeeList = []
.getEmployeeList({ const fetchList = fetchType === 'seller'
merchantId: shopMerchantId, ? uni.$api.popupApi.getEmployeeList({
merchantId,
sceneList: ''
}) })
.then((res) => { : uni.$api.commonApi.getEmployeeList({
this.$store.dispatch("setEmployeeList", res); merchantId: shopMerchantId
uni.$storage.set("employeeList", res || []);
}) })
fetchList.then((res) => {
if (fetchType !== this.employeeType) return
const list = res || []
this.localEmployeeList = list
this.$store.dispatch("setEmployeeList", list)
uni.$storage.set("employeeList", list)
})
}, },
handleSelect (item) { handleSelect (item) {
this.close(); this.close();
......
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || `请选择${i.label}` }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -99,9 +99,9 @@ ...@@ -99,9 +99,9 @@
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="popup"> <view class="popup">
<car-brands <car-brands
ref="carBrandVisible" ref="carBrandVisible"
...@@ -131,17 +130,11 @@ ...@@ -131,17 +130,11 @@
></reception-sence> ></reception-sence>
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
title="流量来源" :title="employeePopupTitle"
:salesPropsUuid="customerInfo.userId" :employeeType="employeeSelectKey === 'sellerUserId' ? 'seller' : 'default'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
/> />
<employee
ref="sellerVisible"
title="驻店零售"
employee-type="seller"
:salesPropsUuid="customerInfo.sellerUserId"
@select="handleSelect($event, 'sellerVisible')"
/>
</view> </view>
<uni-popup ref="successRef" type="message"> <uni-popup ref="successRef" type="message">
<uni-popup-message <uni-popup-message
...@@ -152,14 +145,12 @@ ...@@ -152,14 +145,12 @@
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import CarBrands from '@/components/CarBrands.vue' import CarBrands from '@/components/CarBrands.vue'
import dayjs from 'dayjs' 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'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{ default_customerForm = [{
label: '车主姓名', label: '车主姓名',
...@@ -197,11 +188,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -197,11 +188,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
}, },
{ {
label: '流量来源', label: '流量来源',
valueKey: 'residentSaleName', valueKey: 'employeeName',
key: 'residentSaleId', key: 'userId',
type: 'select', type: 'select',
required: true, required: true,
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible',
merchantNameKey: 'merchantName'
} }
// { // {
// label: '接待场景', // label: '接待场景',
...@@ -233,12 +225,11 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -233,12 +225,11 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
type: 'date' type: 'date'
},{ },{
label: '驻店零售', label: '驻店零售',
valueKey: 'residentSaleName', valueKey: 'sellerName',
key: 'residentSaleId', key: 'sellerUserId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible'
}] }]
export default { export default {
name: 'AddFiles', name: 'AddFiles',
components: { CarBrands, ReceptionSence, Employee }, components: { CarBrands, ReceptionSence, Employee },
...@@ -266,6 +257,7 @@ export default { ...@@ -266,6 +257,7 @@ export default {
endDate: '', endDate: '',
validateState: true, validateState: true,
employeeSelectKey: '', employeeSelectKey: '',
employeePopupTitle: '驻店零售',
inviteDateTouched: false inviteDateTouched: false
} }
}, },
...@@ -293,6 +285,8 @@ export default { ...@@ -293,6 +285,8 @@ export default {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
carTypeName: '', carTypeName: '',
carChildsBrandId: '',
carChildsBrandName: '',
receptionScene: '', receptionScene: '',
arrivalDate: '', arrivalDate: '',
receptionSceneName: '', receptionSceneName: '',
...@@ -325,8 +319,16 @@ export default { ...@@ -325,8 +319,16 @@ export default {
animationDuration: 100 animationDuration: 100
}) })
}, },
showPopup (e) { showPopup (item) {
this.$refs[e].open() this.employeeSelectKey = item.key
this.employeePopupTitle = item.label
this.$refs[item.popKey].open()
},
getFieldDisplayValue (field) {
const value = this.customerInfo[field.valueKey]
if (!value) return ''
const merchantName = field.merchantNameKey && this.customerInfo[field.merchantNameKey]
return merchantName ? `${merchantName}-${value}` : value
}, },
handleSelect (item, popkey) { handleSelect (item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
...@@ -335,14 +337,23 @@ export default { ...@@ -335,14 +337,23 @@ export default {
Object.assign(this.customerInfo, { Object.assign(this.customerInfo, {
carTypeName: item.name, carTypeName: item.name,
carTypeId: item.id, carTypeId: item.id,
carChildsBrandName: item.carChildsBrandName,
carChildsBrandId: item.carChildsBrandId,
carBrand: item.carChildsBrandName, carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId, carBrandId: item.carChildsBrandId,
oneCarBrand: item.carBrand, oneCarBrand: item.carBrand,
oneCarBrandId: item.carBrandId oneCarBrandId: item.carBrandId
}) })
} else if (popkey == 'residentSaleVisible') { } else if (popkey == 'residentSaleVisible') {
this.customerInfo.residentSaleName = item.staffName const field = this.customerForm.concat(this.optionalForm).find(e => e.key === this.employeeSelectKey)
this.customerInfo.residentSaleId = item.uuid if (field) {
if (field.merchantNameKey) {
const { shopMerchantName } = uni.$storage.get('userInfo') || {}
this.customerInfo[field.merchantNameKey] = item.merchantName || shopMerchantName || ''
}
this.customerInfo[field.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid
}
} else { } else {
this.customerInfo.receptionSceneName = item.receptionSceneName this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id this.customerInfo.receptionScene = item.id
...@@ -417,10 +428,12 @@ export default { ...@@ -417,10 +428,12 @@ export default {
carTypeId: customerInfo.carTypeId, carTypeId: customerInfo.carTypeId,
carBrand: customerInfo.carBrand, carBrand: customerInfo.carBrand,
carBrandId: customerInfo.carBrandId, carBrandId: customerInfo.carBrandId,
carChildsBrandId: customerInfo.carChildsBrandId,
carChildsBrandName: customerInfo.carChildsBrandName,
oneCarBrand: customerInfo.oneCarBrand, oneCarBrand: customerInfo.oneCarBrand,
oneCarBrandId: customerInfo.oneCarBrandId, oneCarBrandId: customerInfo.oneCarBrandId,
employeeName: uni.$storage.get('userInfo').name, employeeName: customerInfo.employeeName,
userId: uni.$storage.get('userInfo').uuid, userId: customerInfo.userId,
sellerMerchantId: uni.$storage.get('userInfo').merchantId sellerMerchantId: uni.$storage.get('userInfo').merchantId
}) })
uni.showLoading({ uni.showLoading({
...@@ -442,10 +455,13 @@ export default { ...@@ -442,10 +455,13 @@ export default {
customerPhone:params.customerPhone, customerPhone:params.customerPhone,
carBrand:params.carBrand, carBrand:params.carBrand,
carBrandId:params.carBrandId, carBrandId:params.carBrandId,
carChildsBrandId:'', carChildsBrandId: params.carChildsBrandId,
carChildsBrandName:'', carChildsBrandName: params.carChildsBrandName,
standNo:params.standNo,
carSeriesId:params.carTypeId, carSeriesId:params.carTypeId,
carSeriesName:params.carTypeName, carSeriesName:params.carTypeName,
employeeName:params.employeeName,
userId:params.userId,
deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期 deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期
inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期 inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期
createdDate: params.filingDate, //建档日期 createdDate: params.filingDate, //建档日期
...@@ -494,7 +510,6 @@ export default { ...@@ -494,7 +510,6 @@ export default {
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.detail-box { .detail-box {
position: relative; position: relative;
...@@ -505,7 +520,6 @@ export default { ...@@ -505,7 +520,6 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: toRpx(160) toRpx(64) 0; padding: toRpx(160) toRpx(64) 0;
} }
.nav-bar { .nav-bar {
position: fixed; position: fixed;
width: 100%; width: 100%;
...@@ -514,7 +528,6 @@ export default { ...@@ -514,7 +528,6 @@ export default {
top: toRpx(48); top: toRpx(48);
z-index: 999; z-index: 999;
pointer-events: none; pointer-events: none;
.back { .back {
height: 100%; height: 100%;
aspect-ratio: 1/1; aspect-ratio: 1/1;
...@@ -523,7 +536,6 @@ export default { ...@@ -523,7 +536,6 @@ export default {
justify-content: center; justify-content: center;
pointer-events: auto; pointer-events: auto;
} }
.title { .title {
position: absolute; position: absolute;
top: 50%; top: 50%;
...@@ -534,11 +546,9 @@ export default { ...@@ -534,11 +546,9 @@ export default {
color: #1a1a1a; color: #1a1a1a;
} }
} }
.detail-content { .detail-content {
height: calc(100vh - #{toRpx(212)}); height: calc(100vh - #{toRpx(212)});
overflow-y: auto; overflow-y: auto;
.detail-panel { .detail-panel {
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;
...@@ -550,7 +560,6 @@ export default { ...@@ -550,7 +560,6 @@ export default {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.form-header { .form-header {
width: 100%; width: 100%;
height: 28px; height: 28px;
...@@ -564,7 +573,6 @@ export default { ...@@ -564,7 +573,6 @@ export default {
} }
} }
} }
.form-box { .form-box {
flex-shrink: 0; flex-shrink: 0;
flex-wrap: wrap; flex-wrap: wrap;
...@@ -578,18 +586,15 @@ export default { ...@@ -578,18 +586,15 @@ export default {
height: toRpx(80); height: toRpx(80);
font-size: toRpx(28); font-size: toRpx(28);
} }
.label { .label {
width: toRpx(192); width: toRpx(192);
color: #292d33; color: #292d33;
justify-content: center; justify-content: center;
.required { .required {
color: #f24724; color: #f24724;
font-size: toRpx(28); font-size: toRpx(28);
} }
} }
.input, .input,
.select { .select {
width: toRpx(738); width: toRpx(738);
...@@ -603,44 +608,36 @@ export default { ...@@ -603,44 +608,36 @@ export default {
line-height: toRpx(76); line-height: toRpx(76);
padding: 0 toRpx(32) !important; padding: 0 toRpx(32) !important;
font-size: toRpx(28); font-size: toRpx(28);
&::placeholder { &::placeholder {
color: #33333333; color: #33333333;
} }
.value { .value {
max-width: toRpx(598); max-width: toRpx(598);
} }
} }
.placeholderStyle { .placeholderStyle {
color: #33333333; color: #33333333;
} }
.arrow { .arrow {
color: #999 !important; color: #999 !important;
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
} }
.calendar-icon { .calendar-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
} }
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
} }
.btns { .btns {
justify-content: center; justify-content: center;
gap: 0 toRpx(34); gap: 0 toRpx(34);
padding-bottom: toRpx(32); padding-bottom: toRpx(32);
flex-shrink: 0; flex-shrink: 0;
.btn { .btn {
width: toRpx(718); width: toRpx(718);
height: toRpx(80); height: toRpx(80);
...@@ -653,14 +650,12 @@ export default { ...@@ -653,14 +650,12 @@ export default {
font-size: toRpx(32); font-size: toRpx(32);
color: #ffffff; color: #ffffff;
} }
.cancel { .cancel {
background: #dae9ff; background: #dae9ff;
color: #2c66f7; color: #2c66f7;
} }
.disabled { .disabled {
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%); background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%);
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<view class="detail-box"> <view class="detail-box">
<view class="nav-bar"> <view class="nav-bar">
<view class="back" @click="backPage"> <view class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons> <uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="title">客户建档详情</view>
</view> </view>
<view class="detail-content"> <view class="title">客户建档详情</view>
<view class="detail-panel"> </view>
<view class="detail-info"> <view class="detail-content">
<view class="detail-info-bg"></view> <view class="detail-panel">
<view class="detail-info-body flex"> <view class="detail-info">
<view class="detail-info-left flex"> <view class="detail-info-bg"></view>
<view class="user-tag"> <view class="detail-info-body flex">
<text class="user-tag-text">{{ customerSurname }}</text> <view class="detail-info-left flex">
</view> <view class="user-tag">
<view class="user-name">{{ customerInfo.customerName || '-' }}</view> <text class="user-tag-text">{{ customerSurname }}</text>
<view class="active-list flex">
<view
v-for="(tag, index) in goodsSubOrderList"
:key="index"
class="active-item"
>
{{ tag.upgradeGoodsAlias || tag.upgradeGoodsName || tag.packageName }}
</view>
</view>
</view> </view>
<view <view class="user-name">{{ displayInfo.customerName || '-' }}</view>
v-if="getCustomerStatusLabel(customerInfo.customerStatus)" <view class="active-list flex">
:class="['customer-item-status', getCustomerStatusClass(customerInfo.customerStatus)]" <view
> v-for="(tag, index) in goodsSubOrderList"
<text class="customer-item-status-text">{{ getCustomerStatusLabel(customerInfo.customerStatus) }}</text> :key="index"
class="active-item"
>
{{ tag.upgradeGoodsAlias || tag.upgradeGoodsName || tag.packageName }}
</view>
</view> </view>
</view> </view>
</view> <view
<view class="form-header">基本信息</view> v-if="getCustomerStatusLabel(displayInfo.customerStatus)"
<view class="form-box flex"> :class="['customer-item-status', getCustomerStatusClass(displayInfo.customerStatus)]"
<template v-for="(i, index) in customerForm"> >
<view class="form-item flex" :key="index"> <text class="customer-item-status-text">{{ getCustomerStatusLabel(displayInfo.customerStatus) }}</text>
<view class="label flex"> </view>
<view class="required" v-if="i.required">*</view>{{ i.label }} </view>
</view>
<view class="form-header">基本信息</view>
<view class="form-box flex">
<template v-for="(i, index) in customerForm">
<view class="form-item flex" :key="index">
<view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }}
</view>
<template v-if="i.type == 'readonly'">
<view class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
</template>
<template v-else-if="i.type == 'input'">
<input
:type="i.inputType"
:maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]"
placeholder="请选择"
placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done"
@blur="inputBlur($event, i)"
/>
</template>
<template v-else-if="i.type == 'date'">
<picker
mode="date"
fields="day"
:start="startDate"
:end="endDate"
@change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]"
>
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view>
</picker>
</template>
<template v-else>
<view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)"
>
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
<template v-if="i.type == 'input'"> </template>
<input </view>
:type="i.inputType" </template>
:maxlength="i.maxlength" </view>
v-model="customerInfo[i.valueKey]" <view class="form-box form-box--no-top flex">
:class="['input', { error: i.error }]" <template v-for="(i, index) in optionalForm">
placeholder="请选择" <view class="form-item flex" :key="index">
placeholder-style="color:rgba(51, 51, 51, 0.2);" <view class="label flex">
confirm-type="done" <view class="required" v-if="i.required">*</view>{{ i.label }}
/> </view>
</template> <template v-if="i.type == 'input'">
<template v-else-if="i.type == 'date'"> <input
<picker :type="i.inputType"
mode="date" :maxlength="i.maxlength"
fields="day" v-model="customerInfo[i.valueKey]"
:start="startDate" :class="['input', { error: i.error }]"
:end="endDate" placeholder="请选择"
@change="bindDateChange($event, i.valueKey)" placeholder-style="color:rgba(51, 51, 51, 0.2);"
:value="customerInfo[i.valueKey]" confirm-type="done"
> @blur="inputBlur($event, i)"
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"> />
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> </template>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <template v-else-if="i.type == 'date'">
</view> <picker
</picker> mode="date"
</template> fields="day"
<template v-else> :start="startDate"
<view :end="endDate"
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" @change="bindDateChange($event, i.valueKey)"
@click="showPopup(i.popKey)" :value="customerInfo[i.valueKey]"
> >
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </picker>
</template>
<template v-else>
<view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)"
>
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view>
</template>
</view>
</template>
</view>
<view class="form-header">客户群消息</view>
<view class="form-box flex">
<template v-for="(i, index) in groupForm">
<view :class="['form-item flex', { 'form-item--full': i.fullWidth }]" :key="index">
<view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
</template> <template v-if="i.type == 'readonly'">
</view> <view v-if="i.showSync" class="readonly-box flex">
<view class="form-box form-box--no-top flex"> <view class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
<template v-for="(i, index) in optionalForm"> <view class="sync-btn" @click.stop="syncCustomerGroupInfo">同步</view>
<view class="form-item flex" :key="index">
<view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <view v-else class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
</template>
<template v-else-if="i.type == 'input'">
<view class="input-box flex">
<input <input
:type="i.inputType" :type="i.inputType || 'text'"
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]" class="input input--count"
placeholder="请选择" placeholder="请输入"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
/> />
</template> <view v-if="i.showCount" class="input-count">{{ (customerInfo[i.valueKey] || '').length }}/{{ i.maxlength }}</view>
<template v-else-if="i.type == 'date'">
<picker
mode="date"
fields="day"
:start="startDate"
:end="endDate"
@change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]"
>
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view>
</picker>
</template>
<template v-else>
<view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)"
>
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view>
</template>
</view>
</template>
</view>
<view class="form-header">客户群消息</view>
<view class="form-box flex">
<template v-for="(i, index) in groupForm">
<view :class="['form-item flex', { 'form-item--full': i.fullWidth }]" :key="index">
<view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'readonly'"> </template>
<view class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view> <template v-else-if="i.type == 'select'">
</template> <view
<template v-else-if="i.type == 'input'"> :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
<view class="input-box flex"> @click="showPopup(i)"
<input >
:type="i.inputType || 'text'" <view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
:maxlength="i.maxlength" <uni-icons class="arrow" type="right" :size="16"></uni-icons>
v-model="customerInfo[i.valueKey]" </view>
class="input input--count" </template>
placeholder="请输入" </view>
placeholder-style="color:rgba(51, 51, 51, 0.2);" </template>
confirm-type="done" </view>
/> <view class="btns flex">
<view v-if="i.showCount" class="input-count">{{ (customerInfo[i.valueKey] || '').length }}/{{ i.maxlength }}</view> <view class="btn cancel" @click="submitCustomerProfileAPI">提交</view>
</view> <template v-if="sceneType != 7">
</template> <view :class="['btn', { disabled: customerInfo.customerStatus==2?true:false }]" @click="startReception">开始接待</view>
<template v-else-if="i.type == 'select'"> </template>
<view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)"
>
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view>
</template>
</view>
</template>
</view>
<view class="btns flex">
<view class="btn cancel" @click="submitCustomerProfileAPI">提交</view>
<template v-if="sceneType != 7">
<view :class="['btn', { disabled: customerInfo.customerStatus==2?true:false }]" @click="startReception">开始接待</view>
</template>
</view>
</view> </view>
</view> </view>
<view class="popup">
<car-brands
ref="carBrandVisible"
@select="handleSelect($event, 'carBrandVisible')"
:echoData="customerInfo"
carBrandKey="carBrand"
carModelKey="carChildsBrandName"
customBoolean
/>
<reception-sence
ref="receptionSceneVisible"
@select="handleSelect($event, 'receptionSceneVisible')"
:customerInfo="customerInfo"
></reception-sence>
<employee
ref="residentSaleVisible"
title="驻店零售"
:salesPropsUuid="customerInfo.userId"
@select="handleSelect($event, 'residentSaleVisible')"
/>
<employee
ref="groupMemberVisible"
title="群成员关联"
:list="groupMemberList"
label-key="contact_name"
value-key="contact_id"
:salesPropsUuid="customerInfo.groupMemberId"
@select="handleSelect($event, 'groupMemberVisible')"
/>
</view>
<uni-popup ref="successRef" type="message">
<uni-popup-message
type="success"
message="数据保存成功"
:duration="1500"
></uni-popup-message>
</uni-popup>
</view> </view>
</template> <view class="popup">
<car-brands
<script type='text/ecmascript-6'> ref="carBrandVisible"
import CarBrands from '@/components/CarBrands.vue' @select="handleSelect($event, 'carBrandVisible')"
import dayjs from 'dayjs' :echoData="customerInfo"
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue' carBrandKey="carBrand"
import Employee from '@/components/Employee.vue' carModelKey="carChildsBrandName"
customBoolean
const phoneRex = /^[1]([3-9])[0-9]{9}$/, />
default_customerForm = [{ <reception-sence
label: '车主姓名', ref="receptionSceneVisible"
valueKey: 'customerName', @select="handleSelect($event, 'receptionSceneVisible')"
key: 'customerName', :customerInfo="customerInfo"
type: 'input', ></reception-sence>
inputType: 'text', <employee
required: true, ref="residentSaleVisible"
maxlength: 50 :title="employeePopupTitle"
}, :employeeType="employeeSelectKey === 'advanceUserId' ? 'seller' : 'default'"
{ :salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : customerInfo.advanceUserId"
label: '手机号', @select="handleSelect($event, 'residentSaleVisible')"
valueKey: 'customerPhone', />
key: 'customerPhone', <employee
type: 'input', ref="groupMemberVisible"
inputType: 'tel', title="群成员关联"
required: true, :list="groupMemberList"
maxlength: 11, label-key="contact_name"
error: false value-key="contact_id"
}, :salesPropsUuid="customerInfo.contact_id"
{ @select="handleSelect($event, 'groupMemberVisible')"
label: '车型', />
valueKey: 'carChildsBrandName', </view>
key: 'carChildsBrandId', <uni-popup ref="successRef" type="message">
type: 'select', <uni-popup-message
required: true, type="success"
popKey: 'carBrandVisible' message="数据保存成功"
}, :duration="1500"
{ ></uni-popup-message>
label: '交付日期', </uni-popup>
valueKey: 'deliveryDate', </view>
key: 'deliveryDate', </template>
required: true, <script type='text/ecmascript-6'>
type: 'date' import CarBrands from '@/components/CarBrands.vue'
import dayjs from 'dayjs'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{
label: '车主姓名',
valueKey: 'customerName',
key: 'customerName',
type: 'input',
inputType: 'text',
required: true,
maxlength: 50
},
{
label: '手机号',
valueKey: 'customerPhone',
key: 'customerPhone',
type: 'readonly',
required: true
},
{
label: '车型',
valueKey: 'carChildsBrandName',
key: 'carChildsBrandId',
type: 'select',
required: true,
popKey: 'carBrandVisible'
},
{
label: '交付日期',
valueKey: 'deliveryDate',
key: 'deliveryDate',
required: true,
type: 'date'
},
// {
// label: '接待场景',
// valueKey: 'receptionSceneName',
// key: 'receptionScene',
// type: 'select',
// required: true,
// popKey: 'receptionSceneVisible'
// },
{
label: '流量来源',
valueKey: 'employeeName',
key: 'userId',
type: 'readonly',
required: true
}],
default_optionalForm = [{
label: '车架号',
valueKey: 'standNo',
key: 'standNo',
type: 'input',
inputType: 'text',
maxlength: 17
},
{
label: '到店日期',
valueKey: 'inviteDate',
key: 'inviteDate',
type: 'date'
},
{
label: '驻店零售',
valueKey: 'advanceUserName',
key: 'advanceUserId',
type: 'select',
popKey: 'residentSaleVisible'
},
{
label: '建档日期',
valueKey: 'createdDate',
key: 'createdDate',
type: 'date'
}],
default_groupForm = [ {
label: '客户群',
valueKey: 'qwGroupName',
key: 'qwGroupName',
type: 'readonly',
showSync: true
},
{
label: '群成员关联',
valueKey: 'contact_name',
key: 'contact_id',
type: 'select',
popKey: 'groupMemberVisible'
},
{
label: '备注',
valueKey: 'remark',
key: 'remark',
type: 'input',
inputType: 'text',
maxlength: 200,
fullWidth: true,
showCount: true
}]
export default {
name: 'DetailFiles',
components: { CarBrands, ReceptionSence, Employee },
computed: {
customerSurname () {
const name = this.displayInfo.customerName || ''
return name ? name.charAt(0) : ''
}, },
// { activityTagList () {
// label: '接待场景', const { customerInfo } = this
// valueKey: 'receptionSceneName', return [customerInfo.packageName, customerInfo.activityName].filter(Boolean)
// key: 'receptionScene',
// type: 'select',
// required: true,
// popKey: 'receptionSceneVisible'
// },
{
label: '流量来源',
valueKey: 'employeeName',
key: 'userId',
type: 'select',
required: true,
popKey: 'residentSaleVisible'
}],
default_optionalForm = [{
label: '车架号',
valueKey: 'standNo',
key: 'standNo',
type: 'input',
inputType: 'text',
maxlength: 17
}, },
{ goodsSubOrderList () {
label: '到店日期', const list = this.displayInfo.goodsSubOrderDTOS
valueKey: 'createdDate', if (!Array.isArray(list)) return []
key: 'createdDate', return list.filter(item => item)
type: 'date'
}, },
{ upgradeStatusInfo () {
label: '驻店零售', const { customerInfo } = this
valueKey: 'employeeName', if (customerInfo.upgradeStatusName) {
key: 'userId', return {
type: 'select', label: customerInfo.upgradeStatusName,
popKey: 'residentSaleVisible' type: this.getUpgradeStatusType(customerInfo.upgradeStatusName)
}
}
const statusMap = {
1: { label: '待跟进', type: 'warning' },
2: { label: '不升级', type: 'default' },
4: { label: '已升级', type: 'success' }
}
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus
return statusMap[status] || null
}, },
{ sceneType () {
label: '建档日期', const { sceneType } = uni.$storage.get('userInfo') || {}
valueKey: 'createdDate', return sceneType
key: 'createdDate', }
type: 'date' },
}], data () {
default_groupForm = [{ return {
label: '客户群', customerId: '',
valueKey: 'qwGroupName', customerForm: [],
key: 'qwGroupName', optionalForm: [],
type: 'readonly' groupForm: [],
customerInfo: {},
displayInfo: {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
},
groupMemberList: [],
startDate: '',
endDate: '',
validateState: true,
employeeSelectKey: 'advanceUserId',
employeePopupTitle: '驻店零售'
}
},
onLoad (options) {
this.customerId = options.customerId || ''
console.log('customerId**options*', this.customerId)
// this.getCustormDetail()
this.initForm()
},
mounted () {
this.startDate = dayjs(dayjs().subtract(7, 'day')).format("YYYY-MM-DD")
this.endDate = dayjs(dayjs().add(30, 'day')).format("YYYY-MM-DD")
},
methods: {
getCustomerStatusClass(status) {
const map = {
1: 'customer-item-status--warning',
2: 'customer-item-status--success',
3: 'customer-item-status--failed',
4: 'customer-item-status--refund'
}
return map[status] || ''
},
getCustomerStatusLabel(status) {
const map = {
1: '待跟进',
2: '已升级',
3: '战败',
4: '已退款'
}
return map[status] || ''
},
async getCustormDetail() {
console.log('getCustormDetailAPI***', this.customerId)
const res = await uni.$api.customerApi.customerProfileInfoAPI({
id: this.customerId
})
console.log('getCustormDetailAPI***', res)
if(res) {
this.customerForm = res
}
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
}, },
{ async submitCustomerProfileAPI(options = {}) {
label: '群成员关联', const { fromReception = false } = options
valueKey: 'groupMemberName', try {
key: 'groupMemberId', this.customerForm.forEach(e => {
type: 'select', e.error = false
popKey: 'groupMemberVisible' })
const { customerInfo, customerForm } = this
customerForm.forEach(e => {
if (e.required && !customerInfo[e.key]) throw e.key
})
if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone'
} catch (error) {
const index = this.customerForm.findIndex(e => e.key == error)
if (index !== -1) {
this.customerForm[index].error = true
}
return false
}
const carVin = this.customerInfo.standNo
if (carVin) {
this.customerInfo.standNo = formatVinInput(carVin)
if (this.customerInfo.standNo.length !== 17) {
uni.showToast({
title: '请输入 17 位有效字符(支持大写 A-H/J-N/P-Z、0-9)',
icon: 'none'
})
return false
}
if (!this.validateState) {
uni.showToast({
title: '车架号校验不匹配,请核对后重新输入',
icon: 'none'
})
return false
}
}
const requestParams = {
id: this.customerInfo.id,
customerName: this.customerInfo.customerName,
carBrand: this.customerInfo.carBrand,
carBrandId: this.customerInfo.carBrandId,
carChildsBrandName: this.customerInfo.carChildsBrandName,
carChildsBrandId: this.customerInfo.carChildsBrandId,
carSeriesName: this.customerInfo.carSeriesName,
carSeriesId: this.customerInfo.carSeriesId,
deliveryDate: this.formatDateTime(this.customerInfo.deliveryDate),
createdDate: this.formatDateTime(this.customerInfo.createdDate),
inviteDate: this.formatDateTime(this.customerInfo.inviteDate),
merchantId: this.customerInfo.merchantId,
merchantName: this.customerInfo.merchantName,
userId: this.customerInfo.userId,
employeeName: this.customerInfo.employeeName,
remark: this.customerInfo.remark,
advanceUserId: this.customerInfo.advanceUserId,
advanceUserName: this.customerInfo.advanceUserName,
qwGroupId: this.customerInfo.qwGroupId,
qwGroupName: this.customerInfo.qwGroupName,
wxId: this.customerInfo.contact_id,
wxName: this.customerInfo.contact_name,
standNo:this.customerInfo.standNo,
}
console.log('submitCustomerProfileAPI***',requestParams)
uni.showLoading({
mask: true
})
const res = await uni.$api.customerApi.submitCustomerProfileAPI(requestParams),
_this = this
console.log('submitCustomerProfileAPI***', res)
if (res) {
this.syncDisplayInfo()
uni.$emit('refreshCustomerProfileGroupInfo')
if (fromReception) {
uni.hideLoading()
return true
}
if (res == '1') {
this.$refs.successRef.open()
setTimeout(() => {
uni.hideLoading()
this.backPage()
}, 1e3)
} else {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false,
confirmText: '确认',
confirmColor: '#347BFF',
success (res) {
if (res.confirm) {
_this.backPage()
}
}
})
uni.hideLoading()
}
return true
} else {
uni.hideLoading()
return false
}
}, },
{ async getCustomerGroupInfo(showToast = false) {
label: '备注', if (!this.customerInfo.customerName || !this.customerInfo.customerPhone) {
valueKey: 'groupRemark', if (showToast) {
key: 'groupRemark', uni.showToast({
type: 'input', title: '请先填写客户姓名和手机号',
inputType: 'text', icon: 'none'
maxlength: 200, })
fullWidth: true,
showCount: true
}]
export default {
name: 'DetailFiles',
components: { CarBrands, ReceptionSence, Employee },
computed: {
customerSurname () {
const name = this.customerInfo.customerName || ''
return name ? name.charAt(0) : ''
},
activityTagList () {
const { customerInfo } = this
return [customerInfo.packageName, customerInfo.activityName].filter(Boolean)
},
goodsSubOrderList () {
const list = this.customerInfo.goodsSubOrderDTOS
if (!Array.isArray(list)) return []
return list.filter(item => item)
},
upgradeStatusInfo () {
const { customerInfo } = this
if (customerInfo.upgradeStatusName) {
return {
label: customerInfo.upgradeStatusName,
type: this.getUpgradeStatusType(customerInfo.upgradeStatusName)
}
} }
const statusMap = { return false
1: { label: '待跟进', type: 'warning' }, }
2: { label: '不升级', type: 'default' }, let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11)
4: { label: '已升级', type: 'success' } console.log('getCustomerGroupInfo*', customerGroupParam)
const data = await uni.$api.customerApi.getCustomerGroupInfoAPI({
customerGroupParam: customerGroupParam
})
console.log('getCustomerGroupInfoAPI**getCustomerGroupInfo*', data)
// http 层已在 code=0 时 resolve(data.data),此处 data 即为业务数据,无需再取 data.data
const contactId = data && data.contact_id
if (contactId) {
this.customerInfo.qwGroupId = contactId
this.customerInfo.qwGroupName = data.contact_name || data.name || data.qwGroupName || ''
await this.getCustomerGroupMemberInfoAPI(contactId)
return true
}
if (showToast) {
uni.showToast({
title: '未找到客户群',
icon: 'none'
})
}
return false
},
async syncCustomerGroupInfo() {
uni.showLoading({
mask: true,
title: '同步中...'
})
try {
const success = await this.getCustomerGroupInfo(true)
if (success) {
uni.showToast({
title: '同步成功',
icon: 'success'
})
} }
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus } catch (error) {
return statusMap[status] || null uni.showToast({
}, title: '同步失败',
sceneType () { icon: 'none'
const { sceneType } = uni.$storage.get('userInfo') || {} })
return sceneType } finally {
uni.hideLoading()
} }
}, },
data () { async getCustomerGroupMemberInfoAPI(contactId) {
return { const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({
customerId: '', qwGroupId: contactId
customerForm: [], })
optionalForm: [], console.log('群成员getCustomerGroupMemberInfoAPI***', data)
groupForm: [], this.groupMemberList = Array.isArray(data) ? data : []
customerInfo: {}, },
groupMemberList: [], syncDisplayInfo (info = this.customerInfo) {
startDate: '', this.displayInfo = {
endDate: '' customerName: info.customerName || '',
customerStatus: info.customerStatus,
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
} }
}, },
onLoad (options) { getUpgradeStatusType (label) {
this.customerId = options.customerId || '' if (label === '已升级') return 'success'
console.log('customerId**options*', this.customerId) if (label === '待跟进') return 'warning'
// this.getCustormDetail() if (label === '战败') return 'failed'
this.initForm() return 'default'
}, },
mounted () { initForm () {
this.startDate = dayjs(dayjs().subtract(7, 'day')).format("YYYY-MM-DD") const { sceneType } = uni.$storage.get("userInfo")
this.endDate = dayjs(dayjs().add(30, 'day')).format("YYYY-MM-DD") default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50
this.$store.dispatch("clearCustomerInfo")
this.$store.dispatch("clearHistory")
this.customerForm = JSON.parse(JSON.stringify(default_customerForm))
this.optionalForm = JSON.parse(JSON.stringify(default_optionalForm))
this.groupForm = JSON.parse(JSON.stringify(default_groupForm))
this.displayInfo = {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
}
this.customerInfo = {
customerName: '',
customerPhone: '',
carBrand: '',
carBrandId: '',
carSeriesName: '',
carSeriesId: '',
carChildsBrandName: '',
carChildsBrandId: '',
receptionScene: '',
deliveryDate: '',
receptionSceneName: '',
standNo: '',
inviteDate: '',
createdDate: '',
employeeName: '',
userId: '',
advanceUserName: '',
advanceUserId: '',
qwGroupName: '',
contact_id: '',
contact_name: '',
groupRemark: ''
}
if (this.customerId) this.findVisitsInfo()
}, },
methods: { async findVisitsInfo () {
getCustomerStatusClass(status) { const res = await uni.$api.customerApi.customerProfileInfoAPI({
const map = { id: this.customerId
1: 'customer-item-status--warning', })
2: 'customer-item-status--success', if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD")
3: 'customer-item-status--failed', if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD")
4: 'customer-item-status--refund' if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
// 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name)
Object.assign(this.customerInfo, res)
if (!this.customerInfo.contact_id && res.wxId) {
this.customerInfo.contact_id = res.wxId
}
if (!this.customerInfo.contact_name && res.wxName) {
this.customerInfo.contact_name = res.wxName
} }
return map[status] || '' this.syncDisplayInfo(this.customerInfo)
console.log('findVisitsInfo**customerInfo*', this.customerInfo)
await this.getCustomerGroupInfo()
},
backPage () {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100
})
},
async startReception () {
const { sceneType, customerInfo } = this
if (sceneType == 7) return // 二手车无接待功能
if (customerInfo.customerStatus == 2) return
const submitted = await this.submitCustomerProfileAPI({ fromReception: true })
if (!submitted) return
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100,
success: () => {
uni.$emit('startReceptionFromCustomerDetail')
}
})
}, },
getCustomerStatusLabel(status) { showPopup (item) {
const map = { const popKey = typeof item === 'string' ? item : item.popKey
1: '待跟进', if (popKey === 'residentSaleVisible' && typeof item === 'object') {
2: '已升级', this.employeeSelectKey = item.key
3: '战败', this.employeePopupTitle = item.label
4: '已退款'
} }
return map[status] || '' this.$refs[popKey].open()
}, },
async getCustormDetail() { handleSelect (item, popkey) {
console.log('getCustormDetailAPI***', this.customerId) this.$refs[popkey].close()
const res = await uni.$api.customerApi.customerProfileInfoAPI({ if (popkey == 'carBrandVisible') {
id: this.customerId this.$refs.carBrandVisible.close()
Object.assign(this.customerInfo, {
carChildsBrandName: item.name,
carChildsBrandId: item.id,
carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId,
carSeriesName: item.carBrand,
carSeriesId: item.carBrandId
}) })
console.log('getCustormDetailAPI***', res) } else if (popkey == 'residentSaleVisible') {
if(res) { const field = this.optionalForm.find(e => e.key === this.employeeSelectKey)
this.customerForm = res if (field) {
} this.customerInfo[field.valueKey] = item.staffName
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm) this.customerInfo[field.key] = item.uuid
},
async submitCustomerProfileAPI() {
// carModel:问界M7,
// carModelId: 1149147,
// carBrand:AITO 问界,
// carBrandId:3454,
// oneCarBrand:鸿蒙智行,
// oneCarBrandId:2978
let requestParams = this.customerInfo
console.log('submitCustomerProfileAPI***', requestParams)
const res = await uni.$api.customerApi.submitCustomerProfileAPI(requestParams)
console.log('submitCustomerProfileAPI***', res)
},
async getCustomerGroupInfo() {
if (!this.customerInfo.customerName || !this.customerInfo.customerPhone) {
return
} }
let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11) } else if (popkey == 'groupMemberVisible') {
console.log('g张三525235*', customerGroupParam) this.$set(this.customerInfo, 'contact_id', item.contact_id || item.id || '')
const data = await uni.$api.customerApi.getCustomerGroupInfoAPI({ this.$set(this.customerInfo, 'contact_name', item.contact_name || item.name || '')
customerGroupParam: customerGroupParam } else {
this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id
}
},
bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value
},
inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) {
this.customerInfo.standNo = formatVinInput(standNoVal)
validateVin(this.customerInfo.standNo)
.then(result => {
const { valid } = result.data
this.validateState = valid
})
.catch(() => {
this.validateState = false
})
} else if (val.key === 'standNo') {
this.validateState = true
}
},
formatDateTime (value) {
if (!value) return value
return dayjs(value).format('YYYY-MM-DD HH:mm:ss')
},
async submit () {
this.submitCustomerProfileAPI()
try {
this.customerForm.map(e => {
e.error = false
}) })
console.log('getCustomerGroupInfoAPI**getCustomerGroupInfo*', data) let { customerInfo, customerForm, optionalForm, groupForm } = this,
// http 层已在 code=0 时 resolve(data.data),此处 data 即为业务数据,无需再取 data.data { shopMerchantId, sceneType } = uni.$storage.get("userInfo"),
const contactId = data.contact_id targetApi = customerInfo.id ? 'submitCustomerProfileAPI' : 'submitCustomerProfileAPI',
if (contactId) { params = {
await this.getCustomerGroupMemberInfoAPI(contactId) merchantId: shopMerchantId,
} bussinessScene: sceneType == 0 ? 1 : 2
}, }
async getCustomerGroupMemberInfoAPI(contactId) { if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone'
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({ customerForm.map(e => {
qwGroupId: contactId params[e.key] = customerInfo[e.key]
}) })
console.log('群成员getCustomerGroupMemberInfoAPI***', data) optionalForm.map(e => {
this.groupMemberList = Array.isArray(data) ? data : [] params[e.key] = customerInfo[e.key]
},
getUpgradeStatusType (label) {
if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning'
if (label === '战败') return 'failed'
return 'default'
},
initForm () {
const { sceneType } = uni.$storage.get("userInfo")
default_customerForm[0].maxlength = sceneType == 1 ? 20 : 50
this.$store.dispatch("clearCustomerInfo")
this.$store.dispatch("clearHistory")
this.customerForm = JSON.parse(JSON.stringify(default_customerForm))
this.optionalForm = JSON.parse(JSON.stringify(default_optionalForm))
this.groupForm = JSON.parse(JSON.stringify(default_groupForm))
this.customerInfo = {
customerName: '',
customerPhone: '',
carBrand: '',
carBrandId: '',
carSeriesName: '',
carSeriesId: '',
carChildsBrandName: '',
carChildsBrandId: '',
receptionScene: '',
deliveryDate: '',
receptionSceneName: '',
standNo: '',
createdDate: '',
employeeName: '',
userId: '',
qwGroupName: '',
groupMemberName: '',
groupMemberId: '',
groupRemark: ''
}
if (this.customerId) this.findVisitsInfo()
},
async findVisitsInfo () {
const res = await uni.$api.customerApi.customerProfileInfoAPI({
id: this.customerId
}) })
if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD") groupForm.map(e => {
if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD") params[e.key] = customerInfo[e.key]
this.customerInfo = res
console.log('findVisitsInfo**customerInfo*', this.customerInfo)
await this.getCustomerGroupInfo()
},
backPage () {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100
}) })
}, if (customerInfo.id) params.id = customerInfo.id
startReception () { Object.assign(params, {
const { sceneType, customerInfo } = this carBrand: customerInfo.carBrand,
if (sceneType == 7) return // 二手车无接待功能 carBrandId: customerInfo.carBrandId,
if (customerInfo.customerStatus == 2) return carSeriesName: customerInfo.carSeriesName,
uni.navigateBack({ carSeriesId: customerInfo.carSeriesId,
delta: 1, carChildsBrandName: customerInfo.carChildsBrandName,
animationType: 'pop-out', carChildsBrandId: customerInfo.carChildsBrandId
animationDuration: 100,
success: () => {
uni.$emit('startReceptionFromCustomerDetail')
}
}) })
}, uni.showLoading({
showPopup (e) { mask: true
this.$refs[e].open() })
}, const res = await uni.$api.customerApi[targetApi](params),
handleSelect (item, popkey) { _this = this
this.$refs[popkey].close() if (res) {
if (popkey == 'carBrandVisible') { this.syncDisplayInfo()
this.$refs.carBrandVisible.close() uni.$emit('refreshCustomerProfileGroupInfo')
Object.assign(this.customerInfo, { if (res == '1') {
carChildsBrandName: item.name, this.$refs.successRef.open()
carChildsBrandId: item.id, setTimeout(() => {
carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId,
carSeriesName: item.carBrand,
carSeriesId: item.carBrandId
})
} else if (popkey == 'residentSaleVisible') {
this.customerInfo.employeeName = item.staffName
this.customerInfo.userId = item.uuid
} else if (popkey == 'groupMemberVisible') {
this.customerInfo.groupMemberName = item.contact_name
this.customerInfo.groupMemberId = item.contact_id
} else {
this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id
}
},
bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value
},
async submit () {
this.submitCustomerProfileAPI()
try {
this.customerForm.map(e => {
e.error = false
})
let { customerInfo, customerForm, optionalForm, groupForm } = this,
{ shopMerchantId, sceneType } = uni.$storage.get("userInfo"),
targetApi = customerInfo.id ? 'submitCustomerProfileAPI' : 'submitCustomerProfileAPI',
params = {
merchantId: shopMerchantId,
bussinessScene: sceneType == 0 ? 1 : 2
}
if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone'
customerForm.map(e => {
params[e.key] = customerInfo[e.key]
})
optionalForm.map(e => {
params[e.key] = customerInfo[e.key]
})
groupForm.map(e => {
params[e.key] = customerInfo[e.key]
})
if (customerInfo.id) params.id = customerInfo.id
Object.assign(params, {
carBrand: customerInfo.carBrand,
carBrandId: customerInfo.carBrandId,
carSeriesName: customerInfo.carSeriesName,
carSeriesId: customerInfo.carSeriesId,
carChildsBrandName: customerInfo.carChildsBrandName,
carChildsBrandId: customerInfo.carChildsBrandId
})
uni.showLoading({
mask: true
})
const res = await uni.$api.customerApi[targetApi](params),
_this = this
if (res) {
uni.$emit('refreshCustomerProfileGroupInfo')
if (res == '1') {
this.$refs.successRef.open()
setTimeout(() => {
uni.hideLoading()
this.backPage()
}, 1e3)
} else {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false,
confirmText: '确认',
confirmColor: '#347BFF',
success (res) {
if (res.confirm) {
_this.backPage()
}
}
})
uni.hideLoading() uni.hideLoading()
} this.backPage()
}, 1e3)
} else { } else {
uni.showModal({
content: '存在与该手机号相同的接待记录,系统将自动归类到已接待',
showCancel: false,
confirmText: '确认',
confirmColor: '#347BFF',
success (res) {
if (res.confirm) {
_this.backPage()
}
}
})
uni.hideLoading() uni.hideLoading()
} }
} catch (error) { } else {
let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true
uni.hideLoading() uni.hideLoading()
} }
} catch (error) {
let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true
uni.hideLoading()
} }
} }
} }
</script> }
</script>
<style scoped lang="scss"> <style scoped lang="scss">
.detail-box { .detail-box {
position: relative; position: relative;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-image: url('@/assets/images/common/page-bg.webp'); background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%; background-size: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: toRpx(160) toRpx(64) 0; padding: toRpx(160) toRpx(64) 0;
}
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
z-index: 999;
pointer-events: none;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
pointer-events: auto;
} }
.title {
.nav-bar { position: absolute;
position: fixed; top: 50%;
width: 100%; left: 50%;
height: toRpx(96); transform: translate(-50%, -50%);
left: 0; font-weight: 700;
top: toRpx(48); font-size: toRpx(32);
z-index: 999; color: #1a1a1a;
pointer-events: none;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
pointer-events: auto;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
} }
}
.detail-content { .detail-content {
height: calc(100vh - #{toRpx(212)}); height: calc(100vh - #{toRpx(212)});
overflow-y: auto; overflow-y: auto;
.detail-panel {
.detail-panel { width: 100%;
min-height: 100%;
height: auto;
border-radius: toRpx(48);
background: #ffffff59;
box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
padding: toRpx(32) toRpx(48);
box-sizing: border-box;
display: flex;
flex-direction: column;
.detail-info {
position: relative;
width: 100%; width: 100%;
min-height: 100%; height: 64px;
height: auto; border: 2px solid #ffffff;
border-radius: toRpx(48); border-radius: 16px;
background: #ffffff59; overflow: hidden;
box-shadow: inset 0 0 toRpx(16) 0 #ffffff; margin-bottom: 24px;
padding: toRpx(32) toRpx(48); flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
display: flex; .detail-info-bg {
flex-direction: column; position: absolute;
inset: 0;
.detail-info { background: linear-gradient(90deg, rgba(44, 102, 247, 0.08) 0%, rgba(72, 166, 255, 0.12) 100%);
background-color: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);
}
.detail-info-body {
position: relative; position: relative;
width: 100%; z-index: 1;
height: 64px; height: 100%;
border: 2px solid #ffffff; align-items: center;
border-radius: 16px; justify-content: space-between;
overflow: hidden; padding: 0 18px;
margin-bottom: 24px;
flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
}
.detail-info-bg { .detail-info-left {
position: absolute; flex: 1;
inset: 0; min-width: 0;
background: linear-gradient(90deg, rgba(44, 102, 247, 0.08) 0%, rgba(72, 166, 255, 0.12) 100%); align-items: center;
background-color: rgba(255, 255, 255, 0.2); gap: 8px;
backdrop-filter: blur(2px); }
-webkit-backdrop-filter: blur(2px); .customer-item-status {
} padding: 0 8px;
border-radius: 4px;
.detail-info-body { flex-shrink: 0;
position: relative; &--warning {
z-index: 1; background: #FDECE9;
height: 100%; .customer-item-status-text {
align-items: center; color: #F24724;
justify-content: space-between;
padding: 0 18px;
box-sizing: border-box;
}
.detail-info-left {
flex: 1;
min-width: 0;
align-items: center;
gap: 8px;
}
.customer-item-status {
padding: 0 8px;
border-radius: 4px;
flex-shrink: 0;
&--warning {
background: #FDECE9;
.customer-item-status-text {
color: #F24724;
}
}
&--success {
background: #EAF9F1;
.customer-item-status-text {
color: #35C376;
}
}
&--failed {
background: #F5F7FA;
.customer-item-status-text {
color: #999EA8;
}
}
&--refund {
background: #FFF5E6;
.customer-item-status-text {
color: #F7A431;
}
} }
} }
&--success {
.customer-item-status-text { background: #EAF9F1;
font-size: 12px; .customer-item-status-text {
line-height: 22px; color: #35C376;
}
.user-tag {
width: 32px;
height: 32px;
border-radius: 50%;
background: rgba(44, 102, 247, 0.1);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
.user-tag-text {
font-size: 14px;
line-height: 20px;
font-weight: 600;
color: #2c66f7;
} }
} }
&--failed {
.user-name { background: #F5F7FA;
font-size: 16px; .customer-item-status-text {
font-weight: 500; color: #999EA8;
color: #1a1a2e; }
flex-shrink: 0;
white-space: nowrap;
}
.active-list {
flex: 1;
min-width: 0;
align-items: center;
gap: 8px;
overflow: hidden;
} }
&--refund {
.active-item { background: #FFF5E6;
padding: 6px 12px; .customer-item-status-text {
border: 1px solid #dce1e6; color: #F7A431;
border-radius: 4px; }
font-size: 13px;
line-height: normal;
color: #6c6f75;
white-space: nowrap;
flex-shrink: 0;
box-sizing: border-box;
} }
} }
.customer-item-status-text {
.form-header { font-size: 12px;
width: 100%; line-height: 22px;
height: 28px; }
font-size: 13px; .user-tag {
color: #2c66f7; width: 32px;
border-radius: 4px; height: 32px;
background: rgba(44, 102, 247, 0.05); border-radius: 50%;
background: rgba(44, 102, 247, 0.1);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0;
.user-tag-text {
font-size: 14px;
line-height: 20px;
font-weight: 600;
color: #2c66f7;
}
}
.user-name {
font-size: 16px;
font-weight: 500;
color: #1a1a2e;
flex-shrink: 0;
white-space: nowrap;
}
.active-list {
flex: 1;
min-width: 0;
align-items: center;
gap: 8px;
overflow: hidden;
}
.active-item {
padding: 6px 12px;
border: 1px solid #dce1e6;
border-radius: 4px;
font-size: 13px;
line-height: normal;
color: #6c6f75;
white-space: nowrap;
flex-shrink: 0;
box-sizing: border-box;
} }
} }
} .form-header {
width: 100%;
.form-box { height: 28px;
flex-shrink: 0; font-size: 13px;
flex-wrap: wrap; color: #2c66f7;
align-items: flex-start; border-radius: 4px;
align-content: flex-start; background: rgba(44, 102, 247, 0.05);
row-gap: 16px; display: flex;
padding: toRpx(32) toRpx(40); align-items: center;
justify-content: space-between;
&--no-top {
padding-top: 0;
}
.form-item {
width: toRpx(934);
height: toRpx(80);
font-size: toRpx(28);
}
.label {
width: toRpx(192);
color: #292d33;
justify-content: center; justify-content: center;
.required {
color: #f24724;
font-size: toRpx(28);
}
} }
}
.input, }
.select { .form-box {
width: toRpx(738); flex-shrink: 0;
height: toRpx(76); flex-wrap: wrap;
background: #ffffff; align-items: flex-start;
border-radius: toRpx(16); align-content: flex-start;
border: toRpx(2) solid transparent !important; row-gap: 16px;
outline: none; padding: toRpx(32) toRpx(40);
color: #333333; justify-content: space-between;
box-sizing: border-box; &--no-top {
line-height: toRpx(76); padding-top: 0;
padding: 0 toRpx(32) !important; }
.form-item {
width: toRpx(934);
height: toRpx(80);
font-size: toRpx(28);
}
.label {
width: toRpx(192);
color: #292d33;
justify-content: center;
.required {
color: #f24724;
font-size: toRpx(28); font-size: toRpx(28);
&::placeholder {
color: #33333333;
}
.value {
max-width: toRpx(598);
}
} }
}
.placeholderStyle { .input,
.select {
width: toRpx(738);
height: toRpx(76);
background: #ffffff;
border-radius: toRpx(16);
border: toRpx(2) solid transparent !important;
outline: none;
color: #333333;
box-sizing: border-box;
line-height: toRpx(76);
padding: 0 toRpx(32) !important;
font-size: toRpx(28);
&::placeholder {
color: #33333333; color: #33333333;
} }
.value {
.arrow { max-width: toRpx(598);
color: #999 !important;
margin-left: auto;
flex-shrink: 0;
}
.error {
border: toRpx(2) solid #f24724 !important;
} }
}
.placeholderStyle {
color: #33333333;
}
.arrow {
color: #999 !important;
margin-left: auto;
flex-shrink: 0;
}
.error {
border: toRpx(2) solid #f24724 !important;
}
.input--readonly {
color: #666666;
background: #f5f7fa;
}
.readonly-box {
width: toRpx(738);
align-items: center;
gap: toRpx(16);
.input--readonly { .input--readonly {
color: #666666; flex: 1;
background: #f5f7fa; width: 0;
}
.form-item--full {
width: 100%;
.input-box,
.input,
.select,
.input--readonly {
flex: 1;
width: 0;
}
} }
.sync-btn {
.input-box { flex-shrink: 0;
width: toRpx(738); min-width: toRpx(112);
height: toRpx(76); height: toRpx(76);
background: #ffffff; padding: 0 toRpx(24);
background: #dae9ff;
border-radius: toRpx(16); border-radius: toRpx(16);
color: #2c66f7;
font-size: toRpx(28);
font-weight: 500;
line-height: toRpx(76);
text-align: center;
box-sizing: border-box; box-sizing: border-box;
align-items: center;
padding-right: toRpx(24);
.input--count {
flex: 1;
width: 0;
height: 100%;
background: transparent;
border: none !important;
padding: 0 0 0 toRpx(32) !important;
line-height: toRpx(76);
}
.input-count {
flex-shrink: 0;
font-size: toRpx(24);
color: #999999;
line-height: toRpx(76);
white-space: nowrap;
}
} }
} }
.form-item--full {
.btns { width: 100%;
justify-content: center; .input-box,
gap: 0 toRpx(34); .input,
padding-bottom: toRpx(32); .select,
flex-shrink: 0; .input--readonly {
flex: 1;
.btn { width: 0;
width: toRpx(718);
height: toRpx(80);
background-image: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
border-radius: toRpx(48);
display: flex;
justify-content: center;
align-items: center;
font-weight: 500;
font-size: toRpx(32);
color: #ffffff;
} }
}
.cancel { .input-box {
background: #dae9ff; width: toRpx(738);
color: #2c66f7; height: toRpx(76);
background: #ffffff;
border-radius: toRpx(16);
box-sizing: border-box;
align-items: center;
padding-right: toRpx(24);
.input--count {
flex: 1;
width: 0;
height: 100%;
background: transparent;
border: none !important;
padding: 0 0 0 toRpx(32) !important;
line-height: toRpx(76);
} }
.input-count {
.disabled { flex-shrink: 0;
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%); font-size: toRpx(24);
color: #999999;
line-height: toRpx(76);
white-space: nowrap;
} }
} }
</style> }
.btns {
justify-content: center;
gap: 0 toRpx(34);
padding-bottom: toRpx(32);
flex-shrink: 0;
.btn {
width: toRpx(718);
height: toRpx(80);
background-image: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
border-radius: toRpx(48);
display: flex;
justify-content: center;
align-items: center;
font-weight: 500;
font-size: toRpx(32);
color: #ffffff;
}
.cancel {
background: #dae9ff;
color: #2c66f7;
}
.disabled {
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%);
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
activityProductId: '', activityProductId: '',
staffUuid: uni.$storage.get('userInfo').uuid, staffUuid: uni.$storage.get('userInfo').uuid,
staffName: uni.$storage.get('userInfo').name, staffName: uni.$storage.get('userInfo').name,
merchantId: String(uni.$storage.get('userInfo').merchantId ?? ''), merchantId: String(uni.$storage.get('userInfo').shopMerchantId ?? ''),
entrySource: 'home_popup', entrySource: 'home_popup',
skipCount: 0, skipCount: 0,
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!