Commit c392edee by Lin

feat(员工):添加默认员工列表处理及更新选择逻辑

- 为 defaultEmployeeList 引入了新的数据属性,用于管理默认员工数据。
- 更新了 selectedId 方法,以支持“默认”员工类型。
- 优化了员工列表获取逻辑,可根据用户信息和场景类型获取默认员工。
- 确保仅在必要时才获取默认员工列表,提升了效率。
1 parent e880ecc8
...@@ -40,7 +40,8 @@ export default { ...@@ -40,7 +40,8 @@ export default {
}, },
data () { data () {
return { return {
sellerEmployeeList: [] sellerEmployeeList: [],
defaultEmployeeList: []
} }
}, },
watch: { watch: {
...@@ -56,7 +57,7 @@ export default { ...@@ -56,7 +57,7 @@ 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) || this.employeeType === 'seller' || this.employeeType === 'default') {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
...@@ -68,6 +69,9 @@ export default { ...@@ -68,6 +69,9 @@ export default {
if (this.employeeType === 'seller') { if (this.employeeType === 'seller') {
return this.sellerEmployeeList return this.sellerEmployeeList
} }
if (this.employeeType === 'default') {
return this.defaultEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -94,6 +98,17 @@ export default { ...@@ -94,6 +98,17 @@ export default {
this.sellerEmployeeList = res || [] this.sellerEmployeeList = res || []
return return
} }
if (this.employeeType === 'default') {
if (this.defaultEmployeeList.length) return
const { shopMerchantId, sceneType } = userInfo
const apiTargetName = sceneType == 1 ? 'getEmployeeList' : 'getOrderScreenEmployeeList'
const res = await uni.$api.popupApi[apiTargetName]({
merchantId: shopMerchantId,
sceneList: [sceneType]
})
this.defaultEmployeeList = res || []
return
}
const employeeList = this.$store.state.user.employeeList const employeeList = this.$store.state.user.employeeList
if (employeeList && employeeList.length) return if (employeeList && employeeList.length) return
const { shopMerchantId } = userInfo const { shopMerchantId } = userInfo
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!