Commit 3d76bac9 by Lin

feat(employee):增强卖家用户的员工筛选功能

- 在 Employee 组件中新增了 `sellerUser` 属性,用于处理卖家专用逻辑。
- 引入了 `sellerEmployeeList`,用于管理卖家用户的员工数据。
- 更新了选择逻辑,以支持 Employee 组件中的卖家用户。
- 修改了相关组件,使用新的 `getFieldDisplayValue` 函数,以提升客户信息的显示效果。
- 优化了 addFiles 和 detailFiles 组件的数据处理,以支持新增的员工选择功能。
1 parent cf13e7f2
......@@ -31,10 +31,16 @@ export default {
valueKey: {
type: String,
default: 'uuid'
},
/** 转化人员(驻店零售)模式,与 OrderPopup 转化人员选择项一致 */
sellerUser: {
type: Boolean,
default: false
}
},
data () {
return {
sellerEmployeeList: []
}
},
watch: {
......@@ -50,7 +56,7 @@ export default {
return this.$store.state.user.historyStatus
},
selectedId () {
if (Array.isArray(this.list)) {
if (Array.isArray(this.list) || this.sellerUser) {
return this.salesPropsUuid
}
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
......@@ -59,6 +65,9 @@ export default {
if (Array.isArray(this.list)) {
return this.list
}
if (this.sellerUser) {
return this.sellerEmployeeList
}
return this.$store.state.user.employeeList
}
},
......@@ -68,8 +77,19 @@ export default {
open () {
this.$refs.employeeBoxVisible.open()
if (Array.isArray(this.list)) return
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo;
const userInfo = uni.$storage.get("userInfo")
if (this.sellerUser) {
const { sceneType, merchantId } = userInfo
const apiTargetName = sceneType == 1 ? 'getEmployeeList' : 'getOrderScreenEmployeeList'
uni.$api.popupApi[apiTargetName]({
merchantId,
sceneList: ''
}).then((res) => {
this.sellerEmployeeList = res || []
})
return
}
const { shopMerchantId } = userInfo
/**获取销售人员 */
uni.$api.commonApi
.getEmployeeList({
......
......@@ -51,7 +51,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@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>
......@@ -101,7 +101,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@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>
......@@ -132,6 +132,7 @@
<employee
ref="residentSaleVisible"
title="驻店零售"
:sellerUser="employeeSelectKey === 'sellerUserId'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')"
/>
......@@ -194,7 +195,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
key: 'userId',
type: 'select',
required: true,
popKey: 'residentSaleVisible'
popKey: 'residentSaleVisible',
merchantNameKey: 'merchantName'
}
// {
// label: '接待场景',
......@@ -293,6 +295,7 @@ export default {
standNo: '',
employeeName: '',
userId: '',
merchantName: '',
sellerName: '',
sellerUserId: '',
filingDate: ''
......@@ -318,6 +321,12 @@ export default {
this.employeeSelectKey = item.key
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()
if (popkey == 'carBrandVisible') {
......@@ -335,6 +344,10 @@ export default {
} else if (popkey == 'residentSaleVisible') {
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
}
......
......@@ -192,6 +192,7 @@
<employee
ref="residentSaleVisible"
title="驻店零售"
seller-user
:salesPropsUuid="customerInfo.advanceUserId"
@select="handleSelect($event, 'residentSaleVisible')"
/>
......@@ -667,8 +668,8 @@
carSeriesId: item.carBrandId
})
} else if (popkey == 'residentSaleVisible') {
this.customerInfo.employeeName = item.staffName
this.customerInfo.userId = item.uuid
this.customerInfo.advanceUserName = item.staffName
this.customerInfo.advanceUserId = item.uuid
} 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 || '')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!