Commit e963b604 by Lin

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

- 在 Employee 组件中新增 localEmployeeList,用于本地管理员工数据。
- 更新 AddFiles 中的员工选择逻辑,采用动态键,并改进显示值。
- 重构 DetailFiles 中的详细显示逻辑,以实现更佳的数据呈现效果。
- 修正 PrelearnBridge 中 merchantId 的使用方式,确保数据检索准确无误。
1 parent c699a62d
......@@ -40,6 +40,7 @@ export default {
},
data () {
return {
localEmployeeList: null
}
},
watch: {
......@@ -55,15 +56,22 @@ export default {
return this.$store.state.user.historyStatus
},
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.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
return this.$store.state.user.customerInfo.salesUuid
},
displayList () {
if (Array.isArray(this.list)) {
return this.list
}
if (Array.isArray(this.localEmployeeList)) {
return this.localEmployeeList
}
return this.$store.state.user.employeeList
}
},
......@@ -74,16 +82,24 @@ export default {
this.$refs.employeeBoxVisible.open()
if (Array.isArray(this.list)) return
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo;
/**获取销售人员 */
uni.$api.commonApi
.getEmployeeList({
merchantId: shopMerchantId,
{ shopMerchantId, merchantId } = userInfo
const fetchType = this.employeeType
this.localEmployeeList = []
const fetchList = fetchType === 'seller'
? uni.$api.popupApi.getEmployeeList({
merchantId,
sceneList: ''
})
.then((res) => {
this.$store.dispatch("setEmployeeList", res);
uni.$storage.set("employeeList", res || []);
: uni.$api.commonApi.getEmployeeList({
merchantId: shopMerchantId
})
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) {
this.close();
......
......@@ -49,9 +49,9 @@
<template v-else>
<view
: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>
</view>
</template>
......@@ -99,9 +99,9 @@
<template v-else>
<view
: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>
</view>
</template>
......@@ -114,7 +114,6 @@
</view>
</view>
</view>
<view class="popup">
<car-brands
ref="carBrandVisible"
......@@ -131,17 +130,11 @@
></reception-sence>
<employee
ref="residentSaleVisible"
title="流量来源"
:salesPropsUuid="customerInfo.userId"
:title="employeePopupTitle"
:employeeType="employeeSelectKey === 'sellerUserId' ? 'seller' : 'default'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')"
/>
<employee
ref="sellerVisible"
title="驻店零售"
employee-type="seller"
:salesPropsUuid="customerInfo.sellerUserId"
@select="handleSelect($event, 'sellerVisible')"
/>
</view>
<uni-popup ref="successRef" type="message">
<uni-popup-message
......@@ -152,14 +145,12 @@
</uni-popup>
</view>
</template>
<script type='text/ecmascript-6'>
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: '车主姓名',
......@@ -197,11 +188,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
},
{
label: '流量来源',
valueKey: 'residentSaleName',
key: 'residentSaleId',
valueKey: 'employeeName',
key: 'userId',
type: 'select',
required: true,
popKey: 'residentSaleVisible'
popKey: 'residentSaleVisible',
merchantNameKey: 'merchantName'
}
// {
// label: '接待场景',
......@@ -233,12 +225,11 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
type: 'date'
},{
label: '驻店零售',
valueKey: 'residentSaleName',
key: 'residentSaleId',
valueKey: 'sellerName',
key: 'sellerUserId',
type: 'select',
popKey: 'residentSaleVisible'
}]
export default {
name: 'AddFiles',
components: { CarBrands, ReceptionSence, Employee },
......@@ -266,6 +257,7 @@ export default {
endDate: '',
validateState: true,
employeeSelectKey: '',
employeePopupTitle: '驻店零售',
inviteDateTouched: false
}
},
......@@ -293,6 +285,8 @@ export default {
customerName: '',
customerPhone: '',
carTypeName: '',
carChildsBrandId: '',
carChildsBrandName: '',
receptionScene: '',
arrivalDate: '',
receptionSceneName: '',
......@@ -325,8 +319,16 @@ export default {
animationDuration: 100
})
},
showPopup (e) {
this.$refs[e].open()
showPopup (item) {
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) {
this.$refs[popkey].close()
......@@ -335,14 +337,23 @@ export default {
Object.assign(this.customerInfo, {
carTypeName: item.name,
carTypeId: item.id,
carChildsBrandName: item.carChildsBrandName,
carChildsBrandId: item.carChildsBrandId,
carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId,
oneCarBrand: item.carBrand,
oneCarBrandId: item.carBrandId
})
} else if (popkey == 'residentSaleVisible') {
this.customerInfo.residentSaleName = item.staffName
this.customerInfo.residentSaleId = item.uuid
const field = this.customerForm.concat(this.optionalForm).find(e => e.key === this.employeeSelectKey)
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 {
this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id
......@@ -417,10 +428,12 @@ export default {
carTypeId: customerInfo.carTypeId,
carBrand: customerInfo.carBrand,
carBrandId: customerInfo.carBrandId,
carChildsBrandId: customerInfo.carChildsBrandId,
carChildsBrandName: customerInfo.carChildsBrandName,
oneCarBrand: customerInfo.oneCarBrand,
oneCarBrandId: customerInfo.oneCarBrandId,
employeeName: uni.$storage.get('userInfo').name,
userId: uni.$storage.get('userInfo').uuid,
employeeName: customerInfo.employeeName,
userId: customerInfo.userId,
sellerMerchantId: uni.$storage.get('userInfo').merchantId
})
uni.showLoading({
......@@ -442,10 +455,13 @@ export default {
customerPhone:params.customerPhone,
carBrand:params.carBrand,
carBrandId:params.carBrandId,
carChildsBrandId:'',
carChildsBrandName:'',
carChildsBrandId: params.carChildsBrandId,
carChildsBrandName: params.carChildsBrandName,
standNo:params.standNo,
carSeriesId:params.carTypeId,
carSeriesName:params.carTypeName,
employeeName:params.employeeName,
userId:params.userId,
deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期
inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期
createdDate: params.filingDate, //建档日期
......@@ -494,7 +510,6 @@ export default {
}
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
......@@ -505,7 +520,6 @@ export default {
box-sizing: border-box;
padding: toRpx(160) toRpx(64) 0;
}
.nav-bar {
position: fixed;
width: 100%;
......@@ -514,7 +528,6 @@ export default {
top: toRpx(48);
z-index: 999;
pointer-events: none;
.back {
height: 100%;
aspect-ratio: 1/1;
......@@ -523,7 +536,6 @@ export default {
justify-content: center;
pointer-events: auto;
}
.title {
position: absolute;
top: 50%;
......@@ -534,11 +546,9 @@ export default {
color: #1a1a1a;
}
}
.detail-content {
height: calc(100vh - #{toRpx(212)});
overflow-y: auto;
.detail-panel {
width: 100%;
min-height: 100%;
......@@ -550,7 +560,6 @@ export default {
box-sizing: border-box;
display: flex;
flex-direction: column;
.form-header {
width: 100%;
height: 28px;
......@@ -564,7 +573,6 @@ export default {
}
}
}
.form-box {
flex-shrink: 0;
flex-wrap: wrap;
......@@ -578,18 +586,15 @@ export default {
height: toRpx(80);
font-size: toRpx(28);
}
.label {
width: toRpx(192);
color: #292d33;
justify-content: center;
.required {
color: #f24724;
font-size: toRpx(28);
}
}
.input,
.select {
width: toRpx(738);
......@@ -603,44 +608,36 @@ export default {
line-height: toRpx(76);
padding: 0 toRpx(32) !important;
font-size: toRpx(28);
&::placeholder {
color: #33333333;
}
.value {
max-width: toRpx(598);
}
}
.placeholderStyle {
color: #33333333;
}
.arrow {
color: #999 !important;
margin-left: auto;
flex-shrink: 0;
}
.calendar-icon {
width: 16px;
height: 16px;
margin-left: auto;
flex-shrink: 0;
}
.error {
border: toRpx(2) solid #f24724 !important;
}
}
.btns {
justify-content: center;
gap: 0 toRpx(34);
padding-bottom: toRpx(32);
flex-shrink: 0;
.btn {
width: toRpx(718);
height: toRpx(80);
......@@ -653,14 +650,12 @@ export default {
font-size: toRpx(32);
color: #ffffff;
}
.cancel {
background: #dae9ff;
color: #2c66f7;
}
.disabled {
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%);
}
}
</style>
</style>
\ No newline at end of file
<template>
<view class="detail-box">
<view class="nav-bar">
<view class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="title">客户建档详情</view>
<view class="detail-box">
<view class="nav-bar">
<view class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="detail-content">
<view class="detail-panel">
<view class="detail-info">
<view class="detail-info-bg"></view>
<view class="detail-info-body flex">
<view class="detail-info-left flex">
<view class="user-tag">
<text class="user-tag-text">{{ customerSurname }}</text>
</view>
<view class="user-name">{{ customerInfo.customerName || '-' }}</view>
<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 class="title">客户建档详情</view>
</view>
<view class="detail-content">
<view class="detail-panel">
<view class="detail-info">
<view class="detail-info-bg"></view>
<view class="detail-info-body flex">
<view class="detail-info-left flex">
<view class="user-tag">
<text class="user-tag-text">{{ customerSurname }}</text>
</view>
<view
v-if="getCustomerStatusLabel(customerInfo.customerStatus)"
:class="['customer-item-status', getCustomerStatusClass(customerInfo.customerStatus)]"
>
<text class="customer-item-status-text">{{ getCustomerStatusLabel(customerInfo.customerStatus) }}</text>
<view class="user-name">{{ displayInfo.customerName || '-' }}</view>
<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 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
v-if="getCustomerStatusLabel(displayInfo.customerStatus)"
:class="['customer-item-status', getCustomerStatusClass(displayInfo.customerStatus)]"
>
<text class="customer-item-status-text">{{ getCustomerStatusLabel(displayInfo.customerStatus) }}</text>
</view>
</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>
<template v-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"
/>
</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.popKey)"
>
</template>
</view>
</template>
</view>
<view class="form-box form-box--no-top flex">
<template v-for="(i, index) in optionalForm">
<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 == '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>
</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>
</template>
</view>
<view class="form-box form-box--no-top flex">
<template v-for="(i, index) in optionalForm">
<view class="form-item flex" :key="index">
<view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }}
<template v-if="i.type == 'readonly'">
<view v-if="i.showSync" class="readonly-box flex">
<view class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
<view class="sync-btn" @click.stop="syncCustomerGroupInfo">同步</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
:type="i.inputType"
:type="i.inputType || 'text'"
:maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]"
placeholder="请选择"
class="input input--count"
placeholder="请输入"
placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done"
/>
</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.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 v-if="i.showCount" class="input-count">{{ (customerInfo[i.valueKey] || '').length }}/{{ i.maxlength }}</view>
</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'">
<view class="input-box flex">
<input
:type="i.inputType || 'text'"
:maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]"
class="input input--count"
placeholder="请输入"
placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done"
/>
<view v-if="i.showCount" class="input-count">{{ (customerInfo[i.valueKey] || '').length }}/{{ i.maxlength }}</view>
</view>
</template>
<template v-else-if="i.type == 'select'">
<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>
</template>
<template v-else-if="i.type == 'select'">
<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="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 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>
</template>
<script type='text/ecmascript-6'>
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'
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: 'input',
inputType: 'tel',
required: true,
maxlength: 11,
error: false
},
{
label: '车型',
valueKey: 'carChildsBrandName',
key: 'carChildsBrandId',
type: 'select',
required: true,
popKey: 'carBrandVisible'
},
{
label: '交付日期',
valueKey: 'deliveryDate',
key: 'deliveryDate',
required: true,
type: 'date'
<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="employeePopupTitle"
:employeeType="employeeSelectKey === 'advanceUserId' ? 'seller' : 'default'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : customerInfo.advanceUserId"
@select="handleSelect($event, 'residentSaleVisible')"
/>
<employee
ref="groupMemberVisible"
title="群成员关联"
:list="groupMemberList"
label-key="contact_name"
value-key="contact_id"
:salesPropsUuid="customerInfo.contact_id"
@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>
</template>
<script type='text/ecmascript-6'>
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) : ''
},
// {
// label: '接待场景',
// valueKey: 'receptionSceneName',
// 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
activityTagList () {
const { customerInfo } = this
return [customerInfo.packageName, customerInfo.activityName].filter(Boolean)
},
{
label: '到店日期',
valueKey: 'createdDate',
key: 'createdDate',
type: 'date'
goodsSubOrderList () {
const list = this.displayInfo.goodsSubOrderDTOS
if (!Array.isArray(list)) return []
return list.filter(item => item)
},
{
label: '驻店零售',
valueKey: 'employeeName',
key: 'userId',
type: 'select',
popKey: 'residentSaleVisible'
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: 'default' },
4: { label: '已升级', type: 'success' }
}
const status = customerInfo.upgradeStatus ?? customerInfo.orderStatus
return statusMap[status] || null
},
{
label: '建档日期',
valueKey: 'createdDate',
key: 'createdDate',
type: 'date'
}],
default_groupForm = [{
label: '客户群',
valueKey: 'qwGroupName',
key: 'qwGroupName',
type: 'readonly'
sceneType () {
const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType
}
},
data () {
return {
customerId: '',
customerForm: [],
optionalForm: [],
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)
},
{
label: '群成员关联',
valueKey: 'groupMemberName',
key: 'groupMemberId',
type: 'select',
popKey: 'groupMemberVisible'
async submitCustomerProfileAPI(options = {}) {
const { fromReception = false } = options
try {
this.customerForm.forEach(e => {
e.error = false
})
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
}
},
{
label: '备注',
valueKey: 'groupRemark',
key: 'groupRemark',
type: 'input',
inputType: 'text',
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)
}
async getCustomerGroupInfo(showToast = false) {
if (!this.customerInfo.customerName || !this.customerInfo.customerPhone) {
if (showToast) {
uni.showToast({
title: '请先填写客户姓名和手机号',
icon: 'none'
})
}
const statusMap = {
1: { label: '待跟进', type: 'warning' },
2: { label: '不升级', type: 'default' },
4: { label: '已升级', type: 'success' }
return false
}
let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11)
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
return statusMap[status] || null
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo') || {}
return sceneType
} catch (error) {
uni.showToast({
title: '同步失败',
icon: 'none'
})
} finally {
uni.hideLoading()
}
},
data () {
return {
customerId: '',
customerForm: [],
optionalForm: [],
groupForm: [],
customerInfo: {},
groupMemberList: [],
startDate: '',
endDate: ''
async getCustomerGroupMemberInfoAPI(contactId) {
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({
qwGroupId: contactId
})
console.log('群成员getCustomerGroupMemberInfoAPI***', data)
this.groupMemberList = Array.isArray(data) ? data : []
},
syncDisplayInfo (info = this.customerInfo) {
this.displayInfo = {
customerName: info.customerName || '',
customerStatus: info.customerStatus,
goodsSubOrderDTOS: Array.isArray(info.goodsSubOrderDTOS) ? info.goodsSubOrderDTOS : []
}
},
onLoad (options) {
this.customerId = options.customerId || ''
console.log('customerId**options*', this.customerId)
// this.getCustormDetail()
this.initForm()
getUpgradeStatusType (label) {
if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning'
if (label === '战败') return 'failed'
return 'default'
},
mounted () {
this.startDate = dayjs(dayjs().subtract(7, 'day')).format("YYYY-MM-DD")
this.endDate = dayjs(dayjs().add(30, 'day')).format("YYYY-MM-DD")
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.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: {
getCustomerStatusClass(status) {
const map = {
1: 'customer-item-status--warning',
2: 'customer-item-status--success',
3: 'customer-item-status--failed',
4: 'customer-item-status--refund'
async findVisitsInfo () {
const res = await uni.$api.customerApi.customerProfileInfoAPI({
id: this.customerId
})
if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD")
if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD")
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) {
const map = {
1: '待跟进',
2: '已升级',
3: '战败',
4: '已退款'
showPopup (item) {
const popKey = typeof item === 'string' ? item : item.popKey
if (popKey === 'residentSaleVisible' && typeof item === 'object') {
this.employeeSelectKey = item.key
this.employeePopupTitle = item.label
}
return map[status] || ''
this.$refs[popKey].open()
},
async getCustormDetail() {
console.log('getCustormDetailAPI***', this.customerId)
const res = await uni.$api.customerApi.customerProfileInfoAPI({
id: this.customerId
handleSelect (item, popkey) {
this.$refs[popkey].close()
if (popkey == 'carBrandVisible') {
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)
if(res) {
this.customerForm = res
}
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
},
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
} else if (popkey == 'residentSaleVisible') {
const field = this.optionalForm.find(e => e.key === this.employeeSelectKey)
if (field) {
this.customerInfo[field.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid
}
let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11)
console.log('g张三525235*', customerGroupParam)
const data = await uni.$api.customerApi.getCustomerGroupInfoAPI({
customerGroupParam: customerGroupParam
} else if (popkey == 'groupMemberVisible') {
this.$set(this.customerInfo, 'contact_id', item.contact_id || item.id || '')
this.$set(this.customerInfo, 'contact_name', item.contact_name || item.name || '')
} 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)
// http 层已在 code=0 时 resolve(data.data),此处 data 即为业务数据,无需再取 data.data
const contactId = data.contact_id
if (contactId) {
await this.getCustomerGroupMemberInfoAPI(contactId)
}
},
async getCustomerGroupMemberInfoAPI(contactId) {
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({
qwGroupId: contactId
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]
})
console.log('群成员getCustomerGroupMemberInfoAPI***', data)
this.groupMemberList = Array.isArray(data) ? data : []
},
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
optionalForm.map(e => {
params[e.key] = customerInfo[e.key]
})
if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD")
if (res.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD")
this.customerInfo = res
console.log('findVisitsInfo**customerInfo*', this.customerInfo)
await this.getCustomerGroupInfo()
},
backPage () {
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100
groupForm.map(e => {
params[e.key] = customerInfo[e.key]
})
},
startReception () {
const { sceneType, customerInfo } = this
if (sceneType == 7) return // 二手车无接待功能
if (customerInfo.customerStatus == 2) return
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100,
success: () => {
uni.$emit('startReceptionFromCustomerDetail')
}
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
})
},
showPopup (e) {
this.$refs[e].open()
},
handleSelect (item, popkey) {
this.$refs[popkey].close()
if (popkey == 'carBrandVisible') {
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
})
} 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.showLoading({
mask: true
})
const res = await uni.$api.customerApi[targetApi](params),
_this = this
if (res) {
this.syncDisplayInfo()
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()
}
} catch (error) {
let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true
} else {
uni.hideLoading()
}
} catch (error) {
let index = this.customerForm.findIndex(e => e.key == error)
this.customerForm[index].error = true
uni.hideLoading()
}
}
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%;
box-sizing: border-box;
padding: toRpx(160) toRpx(64) 0;
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%;
box-sizing: border-box;
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;
}
.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 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
.detail-content {
height: calc(100vh - #{toRpx(212)});
overflow-y: auto;
.detail-panel {
}
.detail-content {
height: calc(100vh - #{toRpx(212)});
overflow-y: auto;
.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%;
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);
height: 64px;
border: 2px solid #ffffff;
border-radius: 16px;
overflow: hidden;
margin-bottom: 24px;
flex-shrink: 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
.detail-info {
.detail-info-bg {
position: absolute;
inset: 0;
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;
width: 100%;
height: 64px;
border: 2px solid #ffffff;
border-radius: 16px;
overflow: hidden;
margin-bottom: 24px;
flex-shrink: 0;
z-index: 1;
height: 100%;
align-items: center;
justify-content: space-between;
padding: 0 18px;
box-sizing: border-box;
.detail-info-bg {
position: absolute;
inset: 0;
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;
z-index: 1;
height: 100%;
align-items: center;
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;
}
}
.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;
}
}
.customer-item-status-text {
font-size: 12px;
line-height: 22px;
}
.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;
&--success {
background: #EAF9F1;
.customer-item-status-text {
color: #35C376;
}
}
.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;
&--failed {
background: #F5F7FA;
.customer-item-status-text {
color: #999EA8;
}
}
.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;
&--refund {
background: #FFF5E6;
.customer-item-status-text {
color: #F7A431;
}
}
}
.form-header {
width: 100%;
height: 28px;
font-size: 13px;
color: #2c66f7;
border-radius: 4px;
background: rgba(44, 102, 247, 0.05);
.customer-item-status-text {
font-size: 12px;
line-height: 22px;
}
.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;
}
}
.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-box {
flex-shrink: 0;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
row-gap: 16px;
padding: toRpx(32) toRpx(40);
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;
.form-header {
width: 100%;
height: 28px;
font-size: 13px;
color: #2c66f7;
border-radius: 4px;
background: rgba(44, 102, 247, 0.05);
display: flex;
align-items: center;
justify-content: center;
.required {
color: #f24724;
font-size: toRpx(28);
}
}
.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;
}
}
.form-box {
flex-shrink: 0;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
row-gap: 16px;
padding: toRpx(32) toRpx(40);
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;
.required {
color: #f24724;
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;
}
.arrow {
color: #999 !important;
margin-left: auto;
flex-shrink: 0;
}
.error {
border: toRpx(2) solid #f24724 !important;
.value {
max-width: toRpx(598);
}
}
.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 {
color: #666666;
background: #f5f7fa;
}
.form-item--full {
width: 100%;
.input-box,
.input,
.select,
.input--readonly {
flex: 1;
width: 0;
}
flex: 1;
width: 0;
}
.input-box {
width: toRpx(738);
.sync-btn {
flex-shrink: 0;
min-width: toRpx(112);
height: toRpx(76);
background: #ffffff;
padding: 0 toRpx(24);
background: #dae9ff;
border-radius: toRpx(16);
color: #2c66f7;
font-size: toRpx(28);
font-weight: 500;
line-height: toRpx(76);
text-align: center;
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;
}
}
}
.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;
.form-item--full {
width: 100%;
.input-box,
.input,
.select,
.input--readonly {
flex: 1;
width: 0;
}
.cancel {
background: #dae9ff;
color: #2c66f7;
}
.input-box {
width: toRpx(738);
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);
}
.disabled {
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%);
.input-count {
flex-shrink: 0;
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
......@@ -70,7 +70,7 @@ export default {
activityProductId: '',
staffUuid: uni.$storage.get('userInfo').uuid,
staffName: uni.$storage.get('userInfo').name,
merchantId: String(uni.$storage.get('userInfo').merchantId ?? ''),
merchantId: String(uni.$storage.get('userInfo').shopMerchantId ?? ''),
entrySource: 'home_popup',
skipCount: 0,
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!