Commit 565096a8 by Lin

feat(Employee, AddFiles, DetailFiles):增强员工管理与数据处理功能

- 更新 Employee 组件,新增 employeeType 和 sellerEmployeeList,以实现更完善的员工分类。
- 优化 AddFiles 组件,动态设置员工选择标题,并改进邀请日期的逻辑管理。
- 重构 DetailFiles,提升客户信息的显示效果,并确保数据处理的准确性。
1 parent 450b9d2d
...@@ -32,15 +32,15 @@ export default { ...@@ -32,15 +32,15 @@ export default {
type: String, type: String,
default: 'uuid' default: 'uuid'
}, },
/** 转化人员(驻店零售)模式,与 OrderPopup 转化人员选择项一致 */ // default: 销售顾问;seller: 转化人员/驻店零售
sellerUser: { employeeType: {
type: Boolean, type: String,
default: false default: 'default'
} }
}, },
data () { data () {
return { return {
localEmployeeList: null sellerEmployeeList: []
} }
}, },
watch: { watch: {
...@@ -56,21 +56,17 @@ export default { ...@@ -56,21 +56,17 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
selectedId () { selectedId () {
if (Array.isArray(this.list)) { if (Array.isArray(this.list) || this.employeeType === 'seller') {
return this.salesPropsUuid
}
// 优先使用父组件传入的选中值,避免多表单项共用弹框时与 vuex salesUuid 冲突
if (this.salesPropsUuid) {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
}, },
displayList () { displayList () {
if (Array.isArray(this.list)) { if (Array.isArray(this.list)) {
return this.list return this.list
} }
if (Array.isArray(this.localEmployeeList)) { if (this.employeeType === 'seller') {
return this.localEmployeeList return this.sellerEmployeeList
} }
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
...@@ -81,24 +77,28 @@ export default { ...@@ -81,24 +77,28 @@ export default {
open () { open () {
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, merchantId } = userInfo if (this.employeeType === 'seller') {
const fetchType = this.employeeType const { merchantId } = userInfo
this.localEmployeeList = [] uni.$api.popupApi
const fetchList = fetchType === 'seller' .getEmployeeList({
? uni.$api.popupApi.getEmployeeList({
merchantId, merchantId,
sceneList: '' sceneList: ''
}) })
: uni.$api.commonApi.getEmployeeList({ .then((res) => {
merchantId: shopMerchantId this.sellerEmployeeList = res || []
})
return
}
const { shopMerchantId } = userInfo
/**获取销售人员 */
uni.$api.commonApi
.getEmployeeList({
merchantId: shopMerchantId,
}) })
fetchList.then((res) => { .then((res) => {
if (fetchType !== this.employeeType) return this.$store.dispatch("setEmployeeList", res);
const list = res || [] uni.$storage.set("employeeList", res || []);
this.localEmployeeList = list
this.$store.dispatch("setEmployeeList", list)
uni.$storage.set("employeeList", list)
}) })
}, },
handleSelect (item) { handleSelect (item) {
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
></reception-sence> ></reception-sence>
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
:title="employeePopupTitle" :title="employeeSelectKey === 'sellerUserId' ? '驻店零售' : '流量来源'"
:employeeType="employeeSelectKey === 'sellerUserId' ? 'seller' : 'default'" :employeeType="employeeSelectKey === 'sellerUserId' ? 'seller' : 'default'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''" :salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
...@@ -214,8 +214,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -214,8 +214,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
}, },
{ {
label: '到店日期', label: '到店日期',
valueKey: 'arrivalDate', valueKey: 'inviteDate',
key: 'arrivalDate', key: 'inviteDate',
type: 'date' type: 'date'
}, },
{ {
...@@ -257,7 +257,6 @@ export default { ...@@ -257,7 +257,6 @@ export default {
endDate: '', endDate: '',
validateState: true, validateState: true,
employeeSelectKey: '', employeeSelectKey: '',
employeePopupTitle: '驻店零售',
inviteDateTouched: false inviteDateTouched: false
} }
}, },
...@@ -296,8 +295,10 @@ export default { ...@@ -296,8 +295,10 @@ export default {
merchantName: '', merchantName: '',
sellerName: '', sellerName: '',
sellerUserId: '', sellerUserId: '',
inviteDate: '',
filingDate: '' filingDate: ''
} }
this.inviteDateTouched = false
if (this.customerId) this.findVisitsInfo() if (this.customerId) this.findVisitsInfo()
}, },
async findVisitsInfo () { async findVisitsInfo () {
...@@ -305,8 +306,10 @@ export default { ...@@ -305,8 +306,10 @@ export default {
id: this.customerId id: this.customerId
}) })
if (res.arrivalDate) res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD") if (res.arrivalDate) res.arrivalDate = dayjs(res.arrivalDate).format("YYYY-MM-DD")
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD") if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
this.inviteDateTouched = !!res.inviteDate
}, },
backPage () { backPage () {
uni.navigateBack({ uni.navigateBack({
...@@ -317,7 +320,6 @@ export default { ...@@ -317,7 +320,6 @@ export default {
}, },
showPopup (item) { showPopup (item) {
this.employeeSelectKey = item.key this.employeeSelectKey = item.key
this.employeePopupTitle = item.label
this.$refs[item.popKey].open() this.$refs[item.popKey].open()
}, },
getFieldDisplayValue (field) { getFieldDisplayValue (field) {
...@@ -356,7 +358,14 @@ export default { ...@@ -356,7 +358,14 @@ export default {
} }
}, },
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value const value = e.detail.value
this.customerInfo[valueKey] = value
if (valueKey === 'arrivalDate' && !this.inviteDateTouched) {
this.customerInfo.inviteDate = value
}
if (valueKey === 'inviteDate') {
this.inviteDateTouched = true
}
}, },
inputBlur (e, val) { inputBlur (e, val) {
const standNoVal = this.customerInfo.standNo const standNoVal = this.customerInfo.standNo
...@@ -434,6 +443,8 @@ export default { ...@@ -434,6 +443,8 @@ export default {
merchantId:params.merchantId, merchantId:params.merchantId,
employeeName:params.employeeName, employeeName:params.employeeName,
sellerMerchantId:params.sellerMerchantId, sellerMerchantId:params.sellerMerchantId,
sellerUserId: params.sellerUserId,
sellerName: customerInfo.sellerName,
preliminaryOrders: [ preliminaryOrders: [
{ {
sceneType:1, sceneType:1,
...@@ -450,7 +461,7 @@ export default { ...@@ -450,7 +461,7 @@ export default {
employeeName:params.employeeName, employeeName:params.employeeName,
userId:params.userId, 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.filingDate ? params.filingDate + ' 00:00:00' : params.filingDate, //到店日期 inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期
createdDate: params.filingDate, //建档日期 createdDate: params.filingDate, //建档日期
sellerUserld: params.sellerUserId, sellerUserld: params.sellerUserId,
sellerName: customerInfo.sellerName, sellerName: customerInfo.sellerName,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view class="user-tag"> <view class="user-tag">
<text class="user-tag-text">{{ customerSurname }}</text> <text class="user-tag-text">{{ customerSurname }}</text>
</view> </view>
<view class="user-name">{{ customerInfo.customerName || '-' }}</view> <view class="user-name">{{ displayInfo.customerName || '-' }}</view>
<view class="active-list flex"> <view class="active-list flex">
<view <view
v-for="(tag, index) in goodsSubOrderList" v-for="(tag, index) in goodsSubOrderList"
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
</view> </view>
</view> </view>
<view <view
v-if="getCustomerStatusLabel(customerInfo.customerStatus)" v-if="getCustomerStatusLabel(displayInfo.customerStatus)"
:class="['customer-item-status', getCustomerStatusClass(customerInfo.customerStatus)]" :class="['customer-item-status', getCustomerStatusClass(displayInfo.customerStatus)]"
> >
<text class="customer-item-status-text">{{ getCustomerStatusLabel(customerInfo.customerStatus) }}</text> <text class="customer-item-status-text">{{ getCustomerStatusLabel(displayInfo.customerStatus) }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -41,7 +41,10 @@ ...@@ -41,7 +41,10 @@
<view class="label flex"> <view class="label flex">
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <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 <input
:type="i.inputType" :type="i.inputType"
:maxlength="i.maxlength" :maxlength="i.maxlength"
...@@ -50,6 +53,7 @@ ...@@ -50,6 +53,7 @@
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"
@blur="inputBlur($event, i)"
/> />
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
...@@ -94,6 +98,7 @@ ...@@ -94,6 +98,7 @@
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"
@blur="inputBlur($event, i)"
/> />
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
...@@ -131,7 +136,11 @@ ...@@ -131,7 +136,11 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'readonly'"> <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="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
<view class="sync-btn" @click.stop="syncCustomerGroupInfo">同步</view>
</view>
<view v-else class="input input--readonly text-hide">{{ customerInfo[i.valueKey] || '-' }}</view>
</template> </template>
<template v-else-if="i.type == 'input'"> <template v-else-if="i.type == 'input'">
<view class="input-box flex"> <view class="input-box flex">
...@@ -167,7 +176,6 @@ ...@@ -167,7 +176,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="popup"> <view class="popup">
<car-brands <car-brands
ref="carBrandVisible" ref="carBrandVisible"
...@@ -185,7 +193,8 @@ ...@@ -185,7 +193,8 @@
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
title="驻店零售" title="驻店零售"
:salesPropsUuid="customerInfo.userId" employee-type="seller"
:salesPropsUuid="customerInfo.advanceUserId"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
/> />
<employee <employee
...@@ -194,7 +203,7 @@ ...@@ -194,7 +203,7 @@
:list="groupMemberList" :list="groupMemberList"
label-key="contact_name" label-key="contact_name"
value-key="contact_id" value-key="contact_id"
:salesPropsUuid="customerInfo.groupMemberId" :salesPropsUuid="customerInfo.contact_id"
@select="handleSelect($event, 'groupMemberVisible')" @select="handleSelect($event, 'groupMemberVisible')"
/> />
</view> </view>
...@@ -206,15 +215,14 @@ ...@@ -206,15 +215,14 @@
></uni-popup-message> ></uni-popup-message>
</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'
const phoneRex = /^[1]([3-9])[0-9]{9}$/,
const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{ default_customerForm = [{
label: '车主姓名', label: '车主姓名',
valueKey: 'customerName', valueKey: 'customerName',
...@@ -228,11 +236,8 @@ ...@@ -228,11 +236,8 @@
label: '手机号', label: '手机号',
valueKey: 'customerPhone', valueKey: 'customerPhone',
key: 'customerPhone', key: 'customerPhone',
type: 'input', type: 'readonly',
inputType: 'tel', required: true
required: true,
maxlength: 11,
error: false
}, },
{ {
label: '车型', label: '车型',
...@@ -249,21 +254,20 @@ ...@@ -249,21 +254,20 @@
required: true, required: true,
type: 'date' type: 'date'
}, },
// { // {
// label: '接待场景', // label: '接待场景',
// valueKey: 'receptionSceneName', // valueKey: 'receptionSceneName',
// key: 'receptionScene', // key: 'receptionScene',
// type: 'select', // type: 'select',
// required: true, // required: true,
// popKey: 'receptionSceneVisible' // popKey: 'receptionSceneVisible'
// }, // },
{ {
label: '流量来源', label: '流量来源',
valueKey: 'employeeName', valueKey: 'employeeName',
key: 'userId', key: 'userId',
type: 'select', type: 'readonly',
required: true, required: true
popKey: 'residentSaleVisible'
}], }],
default_optionalForm = [{ default_optionalForm = [{
label: '车架号', label: '车架号',
...@@ -275,14 +279,14 @@ ...@@ -275,14 +279,14 @@
}, },
{ {
label: '到店日期', label: '到店日期',
valueKey: 'createdDate', valueKey: 'inviteDate',
key: 'createdDate', key: 'inviteDate',
type: 'date' type: 'date'
}, },
{ {
label: '驻店零售', label: '驻店零售',
valueKey: 'employeeName', valueKey: 'advanceUserName',
key: 'userId', key: 'advanceUserId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible'
}, },
...@@ -292,36 +296,36 @@ ...@@ -292,36 +296,36 @@
key: 'createdDate', key: 'createdDate',
type: 'date' type: 'date'
}], }],
default_groupForm = [{ default_groupForm = [ {
label: '客户群', label: '客户群',
valueKey: 'qwGroupName', valueKey: 'qwGroupName',
key: 'qwGroupName', key: 'qwGroupName',
type: 'readonly' type: 'readonly',
showSync: true
}, },
{ {
label: '群成员关联', label: '群成员关联',
valueKey: 'groupMemberName', valueKey: 'contact_name',
key: 'groupMemberId', key: 'contact_id',
type: 'select', type: 'select',
popKey: 'groupMemberVisible' popKey: 'groupMemberVisible'
}, },
{ {
label: '备注', label: '备注',
valueKey: 'groupRemark', valueKey: 'remark',
key: 'groupRemark', key: 'remark',
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
maxlength: 200, maxlength: 200,
fullWidth: true, fullWidth: true,
showCount: true showCount: true
}] }]
export default {
export default {
name: 'DetailFiles', name: 'DetailFiles',
components: { CarBrands, ReceptionSence, Employee }, components: { CarBrands, ReceptionSence, Employee },
computed: { computed: {
customerSurname () { customerSurname () {
const name = this.customerInfo.customerName || '' const name = this.displayInfo.customerName || ''
return name ? name.charAt(0) : '' return name ? name.charAt(0) : ''
}, },
activityTagList () { activityTagList () {
...@@ -329,7 +333,7 @@ ...@@ -329,7 +333,7 @@
return [customerInfo.packageName, customerInfo.activityName].filter(Boolean) return [customerInfo.packageName, customerInfo.activityName].filter(Boolean)
}, },
goodsSubOrderList () { goodsSubOrderList () {
const list = this.customerInfo.goodsSubOrderDTOS const list = this.displayInfo.goodsSubOrderDTOS
if (!Array.isArray(list)) return [] if (!Array.isArray(list)) return []
return list.filter(item => item) return list.filter(item => item)
}, },
...@@ -361,9 +365,15 @@ ...@@ -361,9 +365,15 @@
optionalForm: [], optionalForm: [],
groupForm: [], groupForm: [],
customerInfo: {}, customerInfo: {},
displayInfo: {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
},
groupMemberList: [], groupMemberList: [],
startDate: '', startDate: '',
endDate: '' endDate: '',
validateState: true
} }
}, },
onLoad (options) { onLoad (options) {
...@@ -406,32 +416,159 @@ ...@@ -406,32 +416,159 @@
} }
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm) console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
}, },
async submitCustomerProfileAPI() { async submitCustomerProfileAPI(options = {}) {
// carModel:问界M7, const { fromReception = false } = options
// carModelId: 1149147, try {
// carBrand:AITO 问界, this.customerForm.forEach(e => {
// carBrandId:3454, e.error = false
// oneCarBrand:鸿蒙智行, })
// oneCarBrandId:2978 const { customerInfo, customerForm } = this
let requestParams = this.customerInfo customerForm.forEach(e => {
console.log('submitCustomerProfileAPI***', requestParams) if (e.required && !customerInfo[e.key]) throw e.key
const res = await uni.$api.customerApi.submitCustomerProfileAPI(requestParams) })
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) 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() { async getCustomerGroupInfo(showToast = false) {
if (!this.customerInfo.customerName || !this.customerInfo.customerPhone) { if (!this.customerInfo.customerName || !this.customerInfo.customerPhone) {
return if (showToast) {
uni.showToast({
title: '请先填写客户姓名和手机号',
icon: 'none'
})
}
return false
} }
let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11) let customerGroupParam = this.customerInfo.customerName + this.customerInfo.customerPhone.slice(7,11)
console.log('g张三525235*', customerGroupParam) console.log('getCustomerGroupInfo*', customerGroupParam)
const data = await uni.$api.customerApi.getCustomerGroupInfoAPI({ const data = await uni.$api.customerApi.getCustomerGroupInfoAPI({
customerGroupParam: customerGroupParam customerGroupParam: customerGroupParam
}) })
console.log('getCustomerGroupInfoAPI**getCustomerGroupInfo*', data) console.log('getCustomerGroupInfoAPI**getCustomerGroupInfo*', data)
// http 层已在 code=0 时 resolve(data.data),此处 data 即为业务数据,无需再取 data.data // http 层已在 code=0 时 resolve(data.data),此处 data 即为业务数据,无需再取 data.data
const contactId = data.contact_id const contactId = data && data.contact_id
if (contactId) { if (contactId) {
this.customerInfo.qwGroupId = contactId
this.customerInfo.qwGroupName = data.contact_name || data.name || data.qwGroupName || ''
await this.getCustomerGroupMemberInfoAPI(contactId) 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'
})
}
} catch (error) {
uni.showToast({
title: '同步失败',
icon: 'none'
})
} finally {
uni.hideLoading()
} }
}, },
async getCustomerGroupMemberInfoAPI(contactId) { async getCustomerGroupMemberInfoAPI(contactId) {
...@@ -441,6 +578,13 @@ ...@@ -441,6 +578,13 @@
console.log('群成员getCustomerGroupMemberInfoAPI***', data) console.log('群成员getCustomerGroupMemberInfoAPI***', data)
this.groupMemberList = Array.isArray(data) ? 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 : []
}
},
getUpgradeStatusType (label) { getUpgradeStatusType (label) {
if (label === '已升级') return 'success' if (label === '已升级') return 'success'
if (label === '待跟进') return 'warning' if (label === '待跟进') return 'warning'
...@@ -455,6 +599,11 @@ ...@@ -455,6 +599,11 @@
this.customerForm = JSON.parse(JSON.stringify(default_customerForm)) this.customerForm = JSON.parse(JSON.stringify(default_customerForm))
this.optionalForm = JSON.parse(JSON.stringify(default_optionalForm)) this.optionalForm = JSON.parse(JSON.stringify(default_optionalForm))
this.groupForm = JSON.parse(JSON.stringify(default_groupForm)) this.groupForm = JSON.parse(JSON.stringify(default_groupForm))
this.displayInfo = {
customerName: '',
customerStatus: '',
goodsSubOrderDTOS: []
}
this.customerInfo = { this.customerInfo = {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
...@@ -468,12 +617,15 @@ ...@@ -468,12 +617,15 @@
deliveryDate: '', deliveryDate: '',
receptionSceneName: '', receptionSceneName: '',
standNo: '', standNo: '',
inviteDate: '',
createdDate: '', createdDate: '',
employeeName: '', employeeName: '',
userId: '', userId: '',
advanceUserName: '',
advanceUserId: '',
qwGroupName: '', qwGroupName: '',
groupMemberName: '', contact_id: '',
groupMemberId: '', contact_name: '',
groupRemark: '' groupRemark: ''
} }
if (this.customerId) this.findVisitsInfo() if (this.customerId) this.findVisitsInfo()
...@@ -484,7 +636,16 @@ ...@@ -484,7 +636,16 @@
}) })
if (res.deliveryDate) res.deliveryDate = dayjs(res.deliveryDate).format("YYYY-MM-DD") 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.createdDate) res.createdDate = dayjs(res.createdDate).format("YYYY-MM-DD")
this.customerInfo = res 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
}
this.syncDisplayInfo(this.customerInfo)
console.log('findVisitsInfo**customerInfo*', this.customerInfo) console.log('findVisitsInfo**customerInfo*', this.customerInfo)
await this.getCustomerGroupInfo() await this.getCustomerGroupInfo()
}, },
...@@ -495,10 +656,12 @@ ...@@ -495,10 +656,12 @@
animationDuration: 100 animationDuration: 100
}) })
}, },
startReception () { async startReception () {
const { sceneType, customerInfo } = this const { sceneType, customerInfo } = this
if (sceneType == 7) return // 二手车无接待功能 if (sceneType == 7) return // 二手车无接待功能
if (customerInfo.customerStatus == 2) return if (customerInfo.customerStatus == 2) return
const submitted = await this.submitCustomerProfileAPI({ fromReception: true })
if (!submitted) return
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
animationType: 'pop-out', animationType: 'pop-out',
...@@ -524,11 +687,11 @@ ...@@ -524,11 +687,11 @@
carSeriesId: item.carBrandId carSeriesId: item.carBrandId
}) })
} else if (popkey == 'residentSaleVisible') { } else if (popkey == 'residentSaleVisible') {
this.customerInfo.employeeName = item.staffName this.customerInfo.advanceUserName = item.staffName
this.customerInfo.userId = item.uuid this.customerInfo.advanceUserId = item.uuid
} else if (popkey == 'groupMemberVisible') { } else if (popkey == 'groupMemberVisible') {
this.customerInfo.groupMemberName = item.contact_name this.$set(this.customerInfo, 'contact_id', item.contact_id || item.id || '')
this.customerInfo.groupMemberId = item.contact_id this.$set(this.customerInfo, 'contact_name', item.contact_name || item.name || '')
} else { } else {
this.customerInfo.receptionSceneName = item.receptionSceneName this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id this.customerInfo.receptionScene = item.id
...@@ -537,6 +700,26 @@ ...@@ -537,6 +700,26 @@
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value 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 () { async submit () {
this.submitCustomerProfileAPI() this.submitCustomerProfileAPI()
try { try {
...@@ -569,13 +752,13 @@ ...@@ -569,13 +752,13 @@
carChildsBrandName: customerInfo.carChildsBrandName, carChildsBrandName: customerInfo.carChildsBrandName,
carChildsBrandId: customerInfo.carChildsBrandId carChildsBrandId: customerInfo.carChildsBrandId
}) })
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
const res = await uni.$api.customerApi[targetApi](params), const res = await uni.$api.customerApi[targetApi](params),
_this = this _this = this
if (res) { if (res) {
this.syncDisplayInfo()
uni.$emit('refreshCustomerProfileGroupInfo') uni.$emit('refreshCustomerProfileGroupInfo')
if (res == '1') { if (res == '1') {
this.$refs.successRef.open() this.$refs.successRef.open()
...@@ -607,11 +790,10 @@ ...@@ -607,11 +790,10 @@
} }
} }
} }
} }
</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;
...@@ -619,9 +801,8 @@ ...@@ -619,9 +801,8 @@
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 {
.nav-bar {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: toRpx(96); height: toRpx(96);
...@@ -629,7 +810,6 @@ ...@@ -629,7 +810,6 @@
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;
...@@ -638,7 +818,6 @@ ...@@ -638,7 +818,6 @@
justify-content: center; justify-content: center;
pointer-events: auto; pointer-events: auto;
} }
.title { .title {
position: absolute; position: absolute;
top: 50%; top: 50%;
...@@ -648,12 +827,10 @@ ...@@ -648,12 +827,10 @@
font-size: toRpx(32); font-size: toRpx(32);
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%;
...@@ -665,7 +842,6 @@ ...@@ -665,7 +842,6 @@
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.detail-info { .detail-info {
position: relative; position: relative;
width: 100%; width: 100%;
...@@ -676,7 +852,6 @@ ...@@ -676,7 +852,6 @@
margin-bottom: 24px; margin-bottom: 24px;
flex-shrink: 0; flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
.detail-info-bg { .detail-info-bg {
position: absolute; position: absolute;
inset: 0; inset: 0;
...@@ -685,7 +860,6 @@ ...@@ -685,7 +860,6 @@
backdrop-filter: blur(2px); backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
} }
.detail-info-body { .detail-info-body {
position: relative; position: relative;
z-index: 1; z-index: 1;
...@@ -695,57 +869,45 @@ ...@@ -695,57 +869,45 @@
padding: 0 18px; padding: 0 18px;
box-sizing: border-box; box-sizing: border-box;
} }
.detail-info-left { .detail-info-left {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
} }
.customer-item-status { .customer-item-status {
padding: 0 8px; padding: 0 8px;
border-radius: 4px; border-radius: 4px;
flex-shrink: 0; flex-shrink: 0;
&--warning { &--warning {
background: #FDECE9; background: #FDECE9;
.customer-item-status-text { .customer-item-status-text {
color: #F24724; color: #F24724;
} }
} }
&--success { &--success {
background: #EAF9F1; background: #EAF9F1;
.customer-item-status-text { .customer-item-status-text {
color: #35C376; color: #35C376;
} }
} }
&--failed { &--failed {
background: #F5F7FA; background: #F5F7FA;
.customer-item-status-text { .customer-item-status-text {
color: #999EA8; color: #999EA8;
} }
} }
&--refund { &--refund {
background: #FFF5E6; background: #FFF5E6;
.customer-item-status-text { .customer-item-status-text {
color: #F7A431; color: #F7A431;
} }
} }
} }
.customer-item-status-text { .customer-item-status-text {
font-size: 12px; font-size: 12px;
line-height: 22px; line-height: 22px;
} }
.user-tag { .user-tag {
width: 32px; width: 32px;
height: 32px; height: 32px;
...@@ -755,7 +917,6 @@ ...@@ -755,7 +917,6 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
.user-tag-text { .user-tag-text {
font-size: 14px; font-size: 14px;
line-height: 20px; line-height: 20px;
...@@ -763,7 +924,6 @@ ...@@ -763,7 +924,6 @@
color: #2c66f7; color: #2c66f7;
} }
} }
.user-name { .user-name {
font-size: 16px; font-size: 16px;
font-weight: 500; font-weight: 500;
...@@ -771,7 +931,6 @@ ...@@ -771,7 +931,6 @@
flex-shrink: 0; flex-shrink: 0;
white-space: nowrap; white-space: nowrap;
} }
.active-list { .active-list {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
...@@ -779,7 +938,6 @@ ...@@ -779,7 +938,6 @@
gap: 8px; gap: 8px;
overflow: hidden; overflow: hidden;
} }
.active-item { .active-item {
padding: 6px 12px; padding: 6px 12px;
border: 1px solid #dce1e6; border: 1px solid #dce1e6;
...@@ -792,7 +950,6 @@ ...@@ -792,7 +950,6 @@
box-sizing: border-box; box-sizing: border-box;
} }
} }
.form-header { .form-header {
width: 100%; width: 100%;
height: 28px; height: 28px;
...@@ -805,9 +962,8 @@ ...@@ -805,9 +962,8 @@
justify-content: center; justify-content: center;
} }
} }
} }
.form-box {
.form-box {
flex-shrink: 0; flex-shrink: 0;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; align-items: flex-start;
...@@ -815,7 +971,6 @@ ...@@ -815,7 +971,6 @@
row-gap: 16px; row-gap: 16px;
padding: toRpx(32) toRpx(40); padding: toRpx(32) toRpx(40);
justify-content: space-between; justify-content: space-between;
&--no-top { &--no-top {
padding-top: 0; padding-top: 0;
} }
...@@ -824,18 +979,15 @@ ...@@ -824,18 +979,15 @@
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);
...@@ -849,38 +1001,53 @@ ...@@ -849,38 +1001,53 @@
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;
} }
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
.input--readonly { .input--readonly {
color: #666666; color: #666666;
background: #f5f7fa; background: #f5f7fa;
} }
.readonly-box {
width: toRpx(738);
align-items: center;
gap: toRpx(16);
.input--readonly {
flex: 1;
width: 0;
}
.sync-btn {
flex-shrink: 0;
min-width: toRpx(112);
height: toRpx(76);
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;
}
}
.form-item--full { .form-item--full {
width: 100%; width: 100%;
.input-box, .input-box,
.input, .input,
.select, .select,
...@@ -889,7 +1056,6 @@ ...@@ -889,7 +1056,6 @@
width: 0; width: 0;
} }
} }
.input-box { .input-box {
width: toRpx(738); width: toRpx(738);
height: toRpx(76); height: toRpx(76);
...@@ -898,7 +1064,6 @@ ...@@ -898,7 +1064,6 @@
box-sizing: border-box; box-sizing: border-box;
align-items: center; align-items: center;
padding-right: toRpx(24); padding-right: toRpx(24);
.input--count { .input--count {
flex: 1; flex: 1;
width: 0; width: 0;
...@@ -908,7 +1073,6 @@ ...@@ -908,7 +1073,6 @@
padding: 0 0 0 toRpx(32) !important; padding: 0 0 0 toRpx(32) !important;
line-height: toRpx(76); line-height: toRpx(76);
} }
.input-count { .input-count {
flex-shrink: 0; flex-shrink: 0;
font-size: toRpx(24); font-size: toRpx(24);
...@@ -917,14 +1081,12 @@ ...@@ -917,14 +1081,12 @@
white-space: nowrap; white-space: nowrap;
} }
} }
} }
.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);
...@@ -937,14 +1099,12 @@ ...@@ -937,14 +1099,12 @@
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!