fix: 店铺列表代理不显示平台业务员
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m33s

This commit is contained in:
luo
2026-08-04 16:44:11 +08:00
parent 06f39815db
commit 81d52892f5

View File

@@ -127,7 +127,7 @@
</ElCol> </ElCol>
</ElRow> </ElRow>
<ElRow :gutter="20"> <ElRow v-if="!isAgentAccount" :gutter="20">
<ElCol :span="12"> <ElCol :span="12">
<ElFormItem label="平台业务员"> <ElFormItem label="平台业务员">
<ElSelect <ElSelect
@@ -331,6 +331,7 @@
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import { useCheckedColumns } from '@/composables/useCheckedColumns' import { useCheckedColumns } from '@/composables/useCheckedColumns'
import { useAuth } from '@/composables/useAuth' import { useAuth } from '@/composables/useAuth'
import { useUserStore } from '@/store/modules/user'
import { generateShopCode } from '@/utils/codeGenerator' import { generateShopCode } from '@/utils/codeGenerator'
import { CommissionService, ShopService, RoleService } from '@/api/modules' import { CommissionService, ShopService, RoleService } from '@/api/modules'
import ShopCreditLimitDialog from '@/components/business/ShopCreditLimitDialog.vue' import ShopCreditLimitDialog from '@/components/business/ShopCreditLimitDialog.vue'
@@ -353,6 +354,8 @@
defineOptions({ name: 'Shop' }) defineOptions({ name: 'Shop' })
const { hasAuth } = useAuth() const { hasAuth } = useAuth()
const userStore = useUserStore()
const isAgentAccount = computed(() => Number(userStore.info.user_type) === 3)
const canModifyShopStatus = hasAuth('shop:modify_status') const canModifyShopStatus = hasAuth('shop:modify_status')
const router = useRouter() const router = useRouter()
@@ -573,23 +576,27 @@
placeholder: '请选择状态' placeholder: '请选择状态'
} }
}, },
{ ...(!isAgentAccount.value
label: '平台业务员', ? [
prop: 'business_owner_account_id', {
type: 'select', label: '平台业务员',
config: { prop: 'business_owner_account_id',
clearable: true, type: 'select' as const,
filterable: true, config: {
remote: true, clearable: true,
remoteMethod: (query: string) => searchPlatformSalespeople(query), filterable: true,
placeholder: '请选择或搜索平台业务员' remote: true,
}, remoteMethod: (query: string) => searchPlatformSalespeople(query),
options: () => placeholder: '请选择或搜索平台业务员'
salespersonOptions.value.map((salesperson) => ({ },
label: `${salesperson.username} (${salesperson.phone_summary})`, options: () =>
value: salesperson.id salespersonOptions.value.map((salesperson) => ({
})) label: `${salesperson.username} (${salesperson.phone_summary})`,
} value: salesperson.id
}))
}
]
: [])
]) ])
// 列配置 // 列配置
@@ -972,7 +979,9 @@
loadTopLevelShops() // 加载顶级店铺用于级联选择 loadTopLevelShops() // 加载顶级店铺用于级联选择
searchDefaultRoles('') // 加载初始默认角色列表 searchDefaultRoles('') // 加载初始默认角色列表
searchParentShops('') // 加载上级店铺选项 searchParentShops('') // 加载上级店铺选项
searchPlatformSalespeople('') // 加载启用的平台业务员选项 if (!isAgentAccount.value) {
searchPlatformSalespeople('') // 加载启用的平台业务员选项
}
}) })
// 获取店铺列表 // 获取店铺列表
@@ -989,7 +998,9 @@
parent_id: searchForm.parent_id, parent_id: searchForm.parent_id,
level: searchForm.level, level: searchForm.level,
status: searchForm.status, status: searchForm.status,
business_owner_account_id: searchForm.business_owner_account_id ...(!isAgentAccount.value && {
business_owner_account_id: searchForm.business_owner_account_id
})
} }
const res = await ShopService.getShops(params) const res = await ShopService.getShops(params)
if (res.code === 0) { if (res.code === 0) {
@@ -1060,9 +1071,11 @@
init_password: formData.init_password, init_password: formData.init_password,
init_phone: formData.init_phone, init_phone: formData.init_phone,
default_role_id: formData.default_role_id!, default_role_id: formData.default_role_id!,
business_owner_account_id: formData.business_owner_account_id,
client_login_disabled: formData.client_login_disabled client_login_disabled: formData.client_login_disabled
} }
if (!isAgentAccount.value) {
data.business_owner_account_id = formData.business_owner_account_id
}
// 可选字段 - parent_id 可能是数组(级联选择器)或数字 // 可选字段 - parent_id 可能是数组(级联选择器)或数字
if (formData.parent_id) { if (formData.parent_id) {
@@ -1083,9 +1096,11 @@
const data: UpdateShopParams = { const data: UpdateShopParams = {
shop_name: formData.shop_name, shop_name: formData.shop_name,
status: formData.status, status: formData.status,
business_owner_account_id: formData.business_owner_account_id,
client_login_disabled: formData.client_login_disabled client_login_disabled: formData.client_login_disabled
} }
if (!isAgentAccount.value) {
data.business_owner_account_id = formData.business_owner_account_id
}
// 可选字段 // 可选字段
if (formData.province) data.province = formData.province if (formData.province) data.province = formData.province