fix:sort
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m0s

This commit is contained in:
luo
2026-06-22 11:09:50 +08:00
parent d3b5f55c64
commit ebf9739f06
8 changed files with 86 additions and 59 deletions

View File

@@ -5,8 +5,7 @@
<ArtSearchBar
v-model:filter="searchForm"
:items="searchFormItems"
:show-expand="false"
label-width="90"
:show-expand="true"
@reset="handleReset"
@search="handleSearch"
></ArtSearchBar>
@@ -216,6 +215,7 @@
import { generateEnterpriseCode } from '@/utils/codeGenerator'
import { formatDateTime } from '@/utils/business/format'
import { regionData } from '@/utils/constants/regionData'
import { STATUS_SELECT_OPTIONS } from '@/config/constants'
defineOptions({ name: 'EnterpriseCustomer' })
@@ -236,6 +236,7 @@
const shopLoading = ref(false)
const tableRef = ref()
const currentEnterpriseId = ref<number>(0)
const shopList = ref<any[]>([])
// 店铺级联选择相关
const shopCascadeOptions = ref<any[]>([])
const shopCascadeProps = {
@@ -272,20 +273,15 @@
enterprise_name: '',
login_phone: '',
contact_phone: '',
owner_shop_id: undefined as number | undefined,
status: undefined as number | undefined
}
// 搜索表单
const searchForm = reactive({ ...initialSearchState })
// 状态选项
const statusOptions = [
{ label: '启用', value: 1 },
{ label: '禁用', value: 0 }
]
// 搜索表单配置
const searchFormItems: SearchFormItem[] = [
const searchFormItems = computed<SearchFormItem[]>(() => [
{
label: '企业名称',
prop: 'enterprise_name',
@@ -296,7 +292,7 @@
}
},
{
label: '登录手机',
label: '登录手机',
prop: 'login_phone',
type: 'input',
config: {
@@ -305,7 +301,7 @@
}
},
{
label: '联系电话',
label: '联系电话',
prop: 'contact_phone',
type: 'input',
config: {
@@ -313,17 +309,34 @@
placeholder: '请输入联系人电话'
}
},
{
label: '归属店铺',
prop: 'owner_shop_id',
type: 'select',
options: shopList.value.map((shop) => ({
label: shop.shop_name,
value: shop.id
})),
config: {
clearable: true,
filterable: true,
remote: true,
remoteMethod: handleSearchOwnerShop,
placeholder: '请输入店铺名称搜索',
reserveKeyword: true
}
},
{
label: '状态',
prop: 'status',
type: 'select',
options: STATUS_SELECT_OPTIONS,
config: {
clearable: true,
placeholder: '请选择状态',
options: statusOptions
placeholder: '请选择状态'
}
}
]
])
// 分页
const pagination = reactive({
@@ -517,6 +530,7 @@
}
onMounted(() => {
handleSearchOwnerShop('')
getTableData()
})
@@ -555,6 +569,22 @@
await handleOwnerShopFocus()
}
const handleSearchOwnerShop = async (query: string = '') => {
try {
const res = await ShopService.getShops({
page: 1,
page_size: 20,
shop_name: query || undefined,
status: 1
})
if (res.code === 0) {
shopList.value = res.data.items || []
}
} catch (error) {
console.error('搜索归属店铺失败:', error)
}
}
// 处理店铺选择变化
const handleShopChange = (value: any) => {
if (Array.isArray(value) && value.length > 0) {
@@ -574,6 +604,7 @@
enterprise_name: searchForm.enterprise_name || undefined,
login_phone: searchForm.login_phone || undefined,
contact_phone: searchForm.contact_phone || undefined,
owner_shop_id: searchForm.owner_shop_id ?? undefined,
status: searchForm.status
}
const res = await EnterpriseService.getEnterprises(params)