Commit e963b604 by Lin

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

- 在 Employee 组件中新增 localEmployeeList,用于本地管理员工数据。
- 更新 AddFiles 中的员工选择逻辑,采用动态键,并改进显示值。
- 重构 DetailFiles 中的详细显示逻辑,以实现更佳的数据呈现效果。
- 修正 PrelearnBridge 中 merchantId 的使用方式,确保数据检索准确无误。
1 parent c699a62d
...@@ -40,6 +40,7 @@ export default { ...@@ -40,6 +40,7 @@ export default {
}, },
data () { data () {
return { return {
localEmployeeList: null
} }
}, },
watch: { watch: {
...@@ -55,15 +56,22 @@ export default { ...@@ -55,15 +56,22 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
selectedId () { selectedId () {
if (Array.isArray(this.list) || this.employeeType === 'seller') { if (Array.isArray(this.list)) {
return this.salesPropsUuid
}
// 优先使用父组件传入的选中值,避免多表单项共用弹框时与 vuex salesUuid 冲突
if (this.salesPropsUuid) {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid
}, },
displayList () { displayList () {
if (Array.isArray(this.list)) { if (Array.isArray(this.list)) {
return this.list return this.list
} }
if (Array.isArray(this.localEmployeeList)) {
return this.localEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -74,16 +82,24 @@ export default { ...@@ -74,16 +82,24 @@ export default {
this.$refs.employeeBoxVisible.open() this.$refs.employeeBoxVisible.open()
if (Array.isArray(this.list)) return if (Array.isArray(this.list)) return
const userInfo = uni.$storage.get("userInfo"), const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo; { shopMerchantId, merchantId } = userInfo
/**获取销售人员 */ const fetchType = this.employeeType
uni.$api.commonApi this.localEmployeeList = []
.getEmployeeList({ const fetchList = fetchType === 'seller'
merchantId: shopMerchantId, ? uni.$api.popupApi.getEmployeeList({
merchantId,
sceneList: ''
}) })
.then((res) => { : uni.$api.commonApi.getEmployeeList({
this.$store.dispatch("setEmployeeList", res); merchantId: shopMerchantId
uni.$storage.set("employeeList", res || []);
}) })
fetchList.then((res) => {
if (fetchType !== this.employeeType) return
const list = res || []
this.localEmployeeList = list
this.$store.dispatch("setEmployeeList", list)
uni.$storage.set("employeeList", list)
})
}, },
handleSelect (item) { handleSelect (item) {
this.close(); this.close();
......
...@@ -49,9 +49,9 @@ ...@@ -49,9 +49,9 @@
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || `请选择${i.label}` }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -99,9 +99,9 @@ ...@@ -99,9 +99,9 @@
<template v-else> <template v-else>
<view <view
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="popup"> <view class="popup">
<car-brands <car-brands
ref="carBrandVisible" ref="carBrandVisible"
...@@ -131,17 +130,11 @@ ...@@ -131,17 +130,11 @@
></reception-sence> ></reception-sence>
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
title="流量来源" :title="employeePopupTitle"
:salesPropsUuid="customerInfo.userId" :employeeType="employeeSelectKey === 'sellerUserId' ? 'seller' : 'default'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
/> />
<employee
ref="sellerVisible"
title="驻店零售"
employee-type="seller"
:salesPropsUuid="customerInfo.sellerUserId"
@select="handleSelect($event, 'sellerVisible')"
/>
</view> </view>
<uni-popup ref="successRef" type="message"> <uni-popup ref="successRef" type="message">
<uni-popup-message <uni-popup-message
...@@ -152,14 +145,12 @@ ...@@ -152,14 +145,12 @@
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import CarBrands from '@/components/CarBrands.vue' import CarBrands from '@/components/CarBrands.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue' import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
default_customerForm = [{ default_customerForm = [{
label: '车主姓名', label: '车主姓名',
...@@ -197,11 +188,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -197,11 +188,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
}, },
{ {
label: '流量来源', label: '流量来源',
valueKey: 'residentSaleName', valueKey: 'employeeName',
key: 'residentSaleId', key: 'userId',
type: 'select', type: 'select',
required: true, required: true,
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible',
merchantNameKey: 'merchantName'
} }
// { // {
// label: '接待场景', // label: '接待场景',
...@@ -233,12 +225,11 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -233,12 +225,11 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
type: 'date' type: 'date'
},{ },{
label: '驻店零售', label: '驻店零售',
valueKey: 'residentSaleName', valueKey: 'sellerName',
key: 'residentSaleId', key: 'sellerUserId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible'
}] }]
export default { export default {
name: 'AddFiles', name: 'AddFiles',
components: { CarBrands, ReceptionSence, Employee }, components: { CarBrands, ReceptionSence, Employee },
...@@ -266,6 +257,7 @@ export default { ...@@ -266,6 +257,7 @@ export default {
endDate: '', endDate: '',
validateState: true, validateState: true,
employeeSelectKey: '', employeeSelectKey: '',
employeePopupTitle: '驻店零售',
inviteDateTouched: false inviteDateTouched: false
} }
}, },
...@@ -293,6 +285,8 @@ export default { ...@@ -293,6 +285,8 @@ export default {
customerName: '', customerName: '',
customerPhone: '', customerPhone: '',
carTypeName: '', carTypeName: '',
carChildsBrandId: '',
carChildsBrandName: '',
receptionScene: '', receptionScene: '',
arrivalDate: '', arrivalDate: '',
receptionSceneName: '', receptionSceneName: '',
...@@ -325,8 +319,16 @@ export default { ...@@ -325,8 +319,16 @@ export default {
animationDuration: 100 animationDuration: 100
}) })
}, },
showPopup (e) { showPopup (item) {
this.$refs[e].open() this.employeeSelectKey = item.key
this.employeePopupTitle = item.label
this.$refs[item.popKey].open()
},
getFieldDisplayValue (field) {
const value = this.customerInfo[field.valueKey]
if (!value) return ''
const merchantName = field.merchantNameKey && this.customerInfo[field.merchantNameKey]
return merchantName ? `${merchantName}-${value}` : value
}, },
handleSelect (item, popkey) { handleSelect (item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
...@@ -335,14 +337,23 @@ export default { ...@@ -335,14 +337,23 @@ export default {
Object.assign(this.customerInfo, { Object.assign(this.customerInfo, {
carTypeName: item.name, carTypeName: item.name,
carTypeId: item.id, carTypeId: item.id,
carChildsBrandName: item.carChildsBrandName,
carChildsBrandId: item.carChildsBrandId,
carBrand: item.carChildsBrandName, carBrand: item.carChildsBrandName,
carBrandId: item.carChildsBrandId, carBrandId: item.carChildsBrandId,
oneCarBrand: item.carBrand, oneCarBrand: item.carBrand,
oneCarBrandId: item.carBrandId oneCarBrandId: item.carBrandId
}) })
} else if (popkey == 'residentSaleVisible') { } else if (popkey == 'residentSaleVisible') {
this.customerInfo.residentSaleName = item.staffName const field = this.customerForm.concat(this.optionalForm).find(e => e.key === this.employeeSelectKey)
this.customerInfo.residentSaleId = item.uuid if (field) {
if (field.merchantNameKey) {
const { shopMerchantName } = uni.$storage.get('userInfo') || {}
this.customerInfo[field.merchantNameKey] = item.merchantName || shopMerchantName || ''
}
this.customerInfo[field.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid
}
} else { } else {
this.customerInfo.receptionSceneName = item.receptionSceneName this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id this.customerInfo.receptionScene = item.id
...@@ -417,10 +428,12 @@ export default { ...@@ -417,10 +428,12 @@ export default {
carTypeId: customerInfo.carTypeId, carTypeId: customerInfo.carTypeId,
carBrand: customerInfo.carBrand, carBrand: customerInfo.carBrand,
carBrandId: customerInfo.carBrandId, carBrandId: customerInfo.carBrandId,
carChildsBrandId: customerInfo.carChildsBrandId,
carChildsBrandName: customerInfo.carChildsBrandName,
oneCarBrand: customerInfo.oneCarBrand, oneCarBrand: customerInfo.oneCarBrand,
oneCarBrandId: customerInfo.oneCarBrandId, oneCarBrandId: customerInfo.oneCarBrandId,
employeeName: uni.$storage.get('userInfo').name, employeeName: customerInfo.employeeName,
userId: uni.$storage.get('userInfo').uuid, userId: customerInfo.userId,
sellerMerchantId: uni.$storage.get('userInfo').merchantId sellerMerchantId: uni.$storage.get('userInfo').merchantId
}) })
uni.showLoading({ uni.showLoading({
...@@ -442,10 +455,13 @@ export default { ...@@ -442,10 +455,13 @@ export default {
customerPhone:params.customerPhone, customerPhone:params.customerPhone,
carBrand:params.carBrand, carBrand:params.carBrand,
carBrandId:params.carBrandId, carBrandId:params.carBrandId,
carChildsBrandId:'', carChildsBrandId: params.carChildsBrandId,
carChildsBrandName:'', carChildsBrandName: params.carChildsBrandName,
standNo:params.standNo,
carSeriesId:params.carTypeId, carSeriesId:params.carTypeId,
carSeriesName:params.carTypeName, carSeriesName:params.carTypeName,
employeeName:params.employeeName,
userId:params.userId,
deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期 deliveryDate: params.arrivalDate ? params.arrivalDate + ' 00:00:00' : params.arrivalDate, //交付日期
inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期 inviteDate: params.inviteDate ? params.inviteDate + ' 00:00:00' : params.inviteDate, //到店日期
createdDate: params.filingDate, //建档日期 createdDate: params.filingDate, //建档日期
...@@ -494,7 +510,6 @@ export default { ...@@ -494,7 +510,6 @@ export default {
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.detail-box { .detail-box {
position: relative; position: relative;
...@@ -505,7 +520,6 @@ export default { ...@@ -505,7 +520,6 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: toRpx(160) toRpx(64) 0; padding: toRpx(160) toRpx(64) 0;
} }
.nav-bar { .nav-bar {
position: fixed; position: fixed;
width: 100%; width: 100%;
...@@ -514,7 +528,6 @@ export default { ...@@ -514,7 +528,6 @@ export default {
top: toRpx(48); top: toRpx(48);
z-index: 999; z-index: 999;
pointer-events: none; pointer-events: none;
.back { .back {
height: 100%; height: 100%;
aspect-ratio: 1/1; aspect-ratio: 1/1;
...@@ -523,7 +536,6 @@ export default { ...@@ -523,7 +536,6 @@ export default {
justify-content: center; justify-content: center;
pointer-events: auto; pointer-events: auto;
} }
.title { .title {
position: absolute; position: absolute;
top: 50%; top: 50%;
...@@ -534,11 +546,9 @@ export default { ...@@ -534,11 +546,9 @@ export default {
color: #1a1a1a; color: #1a1a1a;
} }
} }
.detail-content { .detail-content {
height: calc(100vh - #{toRpx(212)}); height: calc(100vh - #{toRpx(212)});
overflow-y: auto; overflow-y: auto;
.detail-panel { .detail-panel {
width: 100%; width: 100%;
min-height: 100%; min-height: 100%;
...@@ -550,7 +560,6 @@ export default { ...@@ -550,7 +560,6 @@ export default {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.form-header { .form-header {
width: 100%; width: 100%;
height: 28px; height: 28px;
...@@ -564,7 +573,6 @@ export default { ...@@ -564,7 +573,6 @@ export default {
} }
} }
} }
.form-box { .form-box {
flex-shrink: 0; flex-shrink: 0;
flex-wrap: wrap; flex-wrap: wrap;
...@@ -578,18 +586,15 @@ export default { ...@@ -578,18 +586,15 @@ export default {
height: toRpx(80); height: toRpx(80);
font-size: toRpx(28); font-size: toRpx(28);
} }
.label { .label {
width: toRpx(192); width: toRpx(192);
color: #292d33; color: #292d33;
justify-content: center; justify-content: center;
.required { .required {
color: #f24724; color: #f24724;
font-size: toRpx(28); font-size: toRpx(28);
} }
} }
.input, .input,
.select { .select {
width: toRpx(738); width: toRpx(738);
...@@ -603,44 +608,36 @@ export default { ...@@ -603,44 +608,36 @@ export default {
line-height: toRpx(76); line-height: toRpx(76);
padding: 0 toRpx(32) !important; padding: 0 toRpx(32) !important;
font-size: toRpx(28); font-size: toRpx(28);
&::placeholder { &::placeholder {
color: #33333333; color: #33333333;
} }
.value { .value {
max-width: toRpx(598); max-width: toRpx(598);
} }
} }
.placeholderStyle { .placeholderStyle {
color: #33333333; color: #33333333;
} }
.arrow { .arrow {
color: #999 !important; color: #999 !important;
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
} }
.calendar-icon { .calendar-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
} }
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
} }
.btns { .btns {
justify-content: center; justify-content: center;
gap: 0 toRpx(34); gap: 0 toRpx(34);
padding-bottom: toRpx(32); padding-bottom: toRpx(32);
flex-shrink: 0; flex-shrink: 0;
.btn { .btn {
width: toRpx(718); width: toRpx(718);
height: toRpx(80); height: toRpx(80);
...@@ -653,14 +650,12 @@ export default { ...@@ -653,14 +650,12 @@ export default {
font-size: toRpx(32); font-size: toRpx(32);
color: #ffffff; color: #ffffff;
} }
.cancel { .cancel {
background: #dae9ff; background: #dae9ff;
color: #2c66f7; color: #2c66f7;
} }
.disabled { .disabled {
background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%); background-image: linear-gradient(0deg, #2c66f799 0%, #48a6ff99 100%);
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
activityProductId: '', activityProductId: '',
staffUuid: uni.$storage.get('userInfo').uuid, staffUuid: uni.$storage.get('userInfo').uuid,
staffName: uni.$storage.get('userInfo').name, staffName: uni.$storage.get('userInfo').name,
merchantId: String(uni.$storage.get('userInfo').merchantId ?? ''), merchantId: String(uni.$storage.get('userInfo').shopMerchantId ?? ''),
entrySource: 'home_popup', entrySource: 'home_popup',
skipCount: 0, skipCount: 0,
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!