功能:完善多店铺登录与首次部署SQL

This commit is contained in:
xiaowang
2026-03-26 10:28:28 +08:00
parent 5601428087
commit 764bfadb51
79 changed files with 6524 additions and 2603 deletions
+26
View File
@@ -64,6 +64,15 @@
<span v-if="getShopBannerImages(record).length === 0" class="no-banner">暂无Banner</span>
</div>
</template>
<template v-else-if="column.key === 'status'">
<a-switch
:checked="record.status !== 0"
:disabled="!hasPermission('shop:edit') || !isAdmin"
checked-children="启用"
un-checked-children="停用"
@change="(checked: any) => handleStatusChange(record, checked === true)"
/>
</template>
<template v-else-if="column.key === 'actions'">
<a-space>
<a-button v-if="hasPermission('shop:view')" type="link" size="small" @click="showViewModal(record)">
@@ -298,6 +307,7 @@ const viewFormState = reactive({
description: '',
address: '',
businessHours: '',
status: 1,
coverImageFileId: '',
imageFileIds: ''
})
@@ -316,6 +326,7 @@ const formState = reactive({
description: '',
address: '',
businessHours: '',
status: 1,
coverImageFileId: '',
imageFileIds: ''
})
@@ -345,6 +356,7 @@ const columns = [
{ title: '店铺描述', dataIndex: 'description', key: 'description' },
{ title: '店铺地址', dataIndex: 'address', key: 'address' },
{ title: '营业时间', dataIndex: 'businessHours', key: 'businessHours' },
{ title: '状态', key: 'status', width: 120 },
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
{ title: '操作', key: 'actions', width: 150, fixed: 'right' as const }
]
@@ -600,6 +612,7 @@ const showAddModal = () => {
description: '',
address: '',
businessHours: '',
status: 1,
coverImageFileId: '',
imageFileIds: ''
})
@@ -619,6 +632,7 @@ const showEditModal = async (record: Shop | Record<string, any>) => {
description: 'description' in record ? record.description : (record as any).description,
address: 'address' in record ? record.address : (record as any).address,
businessHours: 'businessHours' in record ? record.businessHours : (record as any).businessHours,
status: 'status' in record ? (record.status ?? 1) : ((record as any).status ?? 1),
coverImageFileId: 'coverImageFileId' in record ? record.coverImageFileId : (record as any).coverImageFileId,
imageFileIds: 'imageFileIds' in record ? record.imageFileIds : (record as any).imageFileIds
})
@@ -707,6 +721,7 @@ const showViewModal = async (record: Shop | Record<string, any>) => {
description: 'description' in record ? record.description : (record as any).description,
address: 'address' in record ? record.address : (record as any).address,
businessHours: 'businessHours' in record ? record.businessHours : (record as any).businessHours,
status: 'status' in record ? (record.status ?? 1) : ((record as any).status ?? 1),
coverImageFileId: 'coverImageFileId' in record ? record.coverImageFileId : (record as any).coverImageFileId,
imageFileIds: 'imageFileIds' in record ? record.imageFileIds : (record as any).imageFileIds
})
@@ -812,6 +827,17 @@ const handleDelete = async (record: Shop | Record<string, any>) => {
}
}
const handleStatusChange = async (record: Shop | Record<string, any>, enabled: boolean) => {
try {
const shopId = 'id' in record ? record.id : (record as any).id
await adminShopApi.updateShopStatus(shopId, enabled ? 1 : 0)
;(record as any).status = enabled ? 1 : 0
message.success(`店铺已${enabled ? '启用' : '停用'}`)
} catch (error) {
message.error('店铺状态更新失败')
}
}
onMounted(async () => {
await loadUserPermissions()
fetchShopList()