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
......@@ -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!