Commit 3d76bac9 by Lin

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

- 在 Employee 组件中新增了 `sellerUser` 属性,用于处理卖家专用逻辑。
- 引入了 `sellerEmployeeList`,用于管理卖家用户的员工数据。
- 更新了选择逻辑,以支持 Employee 组件中的卖家用户。
- 修改了相关组件,使用新的 `getFieldDisplayValue` 函数,以提升客户信息的显示效果。
- 优化了 addFiles 和 detailFiles 组件的数据处理,以支持新增的员工选择功能。
1 parent cf13e7f2
...@@ -31,10 +31,16 @@ export default { ...@@ -31,10 +31,16 @@ export default {
valueKey: { valueKey: {
type: String, type: String,
default: 'uuid' default: 'uuid'
},
/** 转化人员(驻店零售)模式,与 OrderPopup 转化人员选择项一致 */
sellerUser: {
type: Boolean,
default: false
} }
}, },
data () { data () {
return { return {
sellerEmployeeList: []
} }
}, },
watch: { watch: {
...@@ -50,7 +56,7 @@ export default { ...@@ -50,7 +56,7 @@ 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.sellerUser) {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
...@@ -59,6 +65,9 @@ export default { ...@@ -59,6 +65,9 @@ export default {
if (Array.isArray(this.list)) { if (Array.isArray(this.list)) {
return this.list return this.list
} }
if (this.sellerUser) {
return this.sellerEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -68,8 +77,19 @@ export default { ...@@ -68,8 +77,19 @@ 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 } = 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 uni.$api.commonApi
.getEmployeeList({ .getEmployeeList({
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)" @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>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)" @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>
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
title="驻店零售" title="驻店零售"
:sellerUser="employeeSelectKey === 'sellerUserId'"
:salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''" :salesPropsUuid="employeeSelectKey ? customerInfo[employeeSelectKey] : ''"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
/> />
...@@ -194,7 +195,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -194,7 +195,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
key: 'userId', key: 'userId',
type: 'select', type: 'select',
required: true, required: true,
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible',
merchantNameKey: 'merchantName'
} }
// { // {
// label: '接待场景', // label: '接待场景',
...@@ -293,6 +295,7 @@ export default { ...@@ -293,6 +295,7 @@ export default {
standNo: '', standNo: '',
employeeName: '', employeeName: '',
userId: '', userId: '',
merchantName: '',
sellerName: '', sellerName: '',
sellerUserId: '', sellerUserId: '',
filingDate: '' filingDate: ''
...@@ -318,6 +321,12 @@ export default { ...@@ -318,6 +321,12 @@ export default {
this.employeeSelectKey = item.key this.employeeSelectKey = item.key
this.$refs[item.popKey].open() 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()
if (popkey == 'carBrandVisible') { if (popkey == 'carBrandVisible') {
...@@ -335,6 +344,10 @@ export default { ...@@ -335,6 +344,10 @@ export default {
} else if (popkey == 'residentSaleVisible') { } else if (popkey == 'residentSaleVisible') {
const field = this.customerForm.concat(this.optionalForm).find(e => e.key === this.employeeSelectKey) const field = this.customerForm.concat(this.optionalForm).find(e => e.key === this.employeeSelectKey)
if (field) { 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.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid this.customerInfo[field.key] = item.uuid
} }
......
...@@ -192,6 +192,7 @@ ...@@ -192,6 +192,7 @@
<employee <employee
ref="residentSaleVisible" ref="residentSaleVisible"
title="驻店零售" title="驻店零售"
seller-user
:salesPropsUuid="customerInfo.advanceUserId" :salesPropsUuid="customerInfo.advanceUserId"
@select="handleSelect($event, 'residentSaleVisible')" @select="handleSelect($event, 'residentSaleVisible')"
/> />
...@@ -667,8 +668,8 @@ ...@@ -667,8 +668,8 @@
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.$set(this.customerInfo, 'contact_id', item.contact_id || item.id || '') this.$set(this.customerInfo, 'contact_id', item.contact_id || item.id || '')
this.$set(this.customerInfo, 'contact_name', item.contact_name || item.name || '') 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!