杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
@@ -233,6 +233,10 @@ import {
UserOutlined
} from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
/**
* Purpose: UserVO supports AdminLayout.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAuthApi, type UserVO } from '@/api/admin'
import { DEFAULT_AVATAR } from '@/constants'
import { usePermission } from '@/utils/permission'
@@ -246,6 +250,10 @@ import {
isBootstrapAdminUser
} from './admin-helpers'
/**
* Purpose: AdminMenuItem supports AdminLayout.vue by holding or executing the admin menu item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type AdminMenuItem = {
key: string
icon: any
@@ -253,7 +261,15 @@ type AdminMenuItem = {
permissionCode: string
}
/**
* Purpose: router supports AdminLayout.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: route supports AdminLayout.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
const { isMobile } = useAdminViewport()
@@ -261,8 +277,20 @@ const { isMobile } = useAdminViewport()
const collapsed = ref(false)
/** mobileDrawerOpen is a reactive state variable used by the template and event handlers. */
const mobileDrawerOpen = ref(false)
/**
* Purpose: userInfo supports AdminLayout.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: selectedKeys supports AdminLayout.vue by holding or executing the selected keys page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedKeys = ref<string[]>([route.path])
/**
* Purpose: selectedShopId supports AdminLayout.vue by holding or executing the selected shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedShopId = ref<string>()
/** shopSwitchLoading is a reactive state variable used by the template and event handlers. */
const shopSwitchLoading = ref(false)
@@ -288,6 +316,10 @@ const menuItems: AdminMenuItem[] = [
{ key: '/admin/legal-agreements', icon: SafetyCertificateOutlined, label: '协议管理', permissionCode: 'legal_agreement:manage' }
]
/**
* Purpose: mobileTabs supports AdminLayout.vue by holding or executing the mobile tabs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mobileTabs = [
{ key: 'workbench', label: '工作台', path: '/admin', icon: HomeOutlined },
{ key: 'orders', label: '订单', path: '/admin/orders', icon: ShoppingOutlined },
@@ -86,18 +86,34 @@ import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { UserOutlined, LockOutlined } from '@ant-design/icons-vue'
/**
* Purpose: LoginShopSelectionResponse supports AdminLoginView.vue by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAuthApi, type LoginShopSelectionResponse } from '@/api/admin'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
import type { IdType } from '@/utils/id'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports AdminLoginView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: formRef supports AdminLoginView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/** shopLoading is a reactive state variable used by the template and event handlers. */
const shopLoading = ref(false)
/**
* Purpose: shops supports AdminLoginView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Array<{ id: IdType; shopName: string }>>([])
/** allowShoplessLogin is a reactive state variable used by the template and event handlers. */
const allowShoplessLogin = ref(false)
@@ -105,6 +121,10 @@ const allowShoplessLogin = ref(false)
const loginShopMessage = ref('')
const { loadUserPermissions } = usePermission()
/**
* Purpose: formState supports AdminLoginView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
account: '',
password: '',
@@ -150,6 +170,10 @@ const shopPlaceholder = computed(() => {
return '请先输入账号'
})
/**
* Purpose: formRules supports AdminLoginView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
account: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
@@ -57,6 +57,10 @@
*/
import { computed, onMounted, reactive, ref } from 'vue'
import { message, Modal } from 'ant-design-vue'
/**
* Purpose: AnnouncementVO supports AnnouncementsView.vue by holding or executing the announcement vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminAnnouncementApi, type AnnouncementVO, type MessageTargetOptionsVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -65,10 +69,26 @@ const loading = ref(false)
const saving = ref(false)
/** formOpen is a reactive state variable used by the template and event handlers. */
const formOpen = ref(false)
/**
* Purpose: announcements supports AnnouncementsView.vue by holding or executing the announcements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const announcements = ref<AnnouncementVO[]>([])
/**
* Purpose: options supports AnnouncementsView.vue by holding or executing the options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const options = ref<MessageTargetOptionsVO>({ shops: [], users: [] })
/**
* Purpose: form supports AnnouncementsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({ title: '', content: '', targetType: 'PLATFORM_ALL', shopIds: [], userIds: [], sortOrder: 0 })
/**
* Purpose: columns supports AnnouncementsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '内容', dataIndex: 'content', key: 'content' },
@@ -79,6 +99,10 @@ const columns = [
{ title: '操作', key: 'action', width: 150 }
]
/**
* Purpose: targetOptions supports AnnouncementsView.vue by holding or executing the target options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetOptions = [
{ label: '全平台', value: 'PLATFORM_ALL' },
{ label: '当前门店全部用户', value: 'CURRENT_SHOP_ALL' },
@@ -43,17 +43,53 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: AdminCommentVO supports CommentsView.vue by holding or executing the admin comment vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminCommentApi, type AdminCommentVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports CommentsView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: keyword supports CommentsView.vue by holding or executing the keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const keyword = ref('')
/**
* Purpose: shopKeyword supports CommentsView.vue by holding or executing the shop keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopKeyword = ref('')
/**
* Purpose: productKeyword supports CommentsView.vue by holding or executing the product keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productKeyword = ref('')
/**
* Purpose: userKeyword supports CommentsView.vue by holding or executing the user keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userKeyword = ref('')
/**
* Purpose: createdRange supports CommentsView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: comments supports CommentsView.vue by holding or executing the comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const comments = ref<AdminCommentVO[]>([])
/**
* Purpose: columns supports CommentsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '评论内容', dataIndex: 'commentContent', key: 'commentContent' },
{ title: '用户', dataIndex: 'userNickname', key: 'userNickname', width: 140 },
@@ -63,6 +99,10 @@ const columns = [
{ title: '操作', key: 'action', width: 100 }
]
/**
* Purpose: filteredComments supports CommentsView.vue by holding or executing the filtered comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filteredComments = computed(() => comments.value.filter(comment => {
if (!matchText(shopKeyword.value, [comment.shopName, comment.shopId])) return false
if (!matchText(productKeyword.value, [comment.productTitle, comment.productId])) return false
@@ -70,12 +110,20 @@ const filteredComments = computed(() => comments.value.filter(comment => {
return matchRange(comment.createTime, createdRange.value)
}))
/**
* Purpose: matchText supports CommentsView.vue by holding or executing the match text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchText = (needle: string, values: any[]) => {
const normalized = needle.trim().toLowerCase()
if (!normalized) return true
return values.some(value => String(value ?? '').toLowerCase().includes(normalized))
}
/**
* Purpose: matchRange supports CommentsView.vue by holding or executing the match range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchRange = (value?: string, range?: [string, string]) => {
if (!range?.length) return true
if (!value) return false
@@ -83,6 +131,10 @@ const matchRange = (value?: string, range?: [string, string]) => {
return time >= new Date(range[0]).getTime() && time <= new Date(range[1]).getTime()
}
/**
* Purpose: loadComments supports CommentsView.vue by holding or executing the load comments page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadComments = async () => {
loading.value = true
try {
@@ -94,12 +146,20 @@ const loadComments = async () => {
}
}
/**
* Purpose: deleteComment supports CommentsView.vue by holding or executing the delete comment page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const deleteComment = async (id: IdType) => {
await adminCommentApi.deleteComment(id)
message.success('评论已删除')
await loadComments()
}
/**
* Purpose: resetFilters supports CommentsView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
keyword.value = ''
shopKeyword.value = ''
@@ -338,6 +338,10 @@ import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: Dayjs supports CouponsView.vue by holding or executing the dayjs page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import dayjs, { type Dayjs } from 'dayjs'
import {
adminCouponApi,
@@ -372,6 +376,10 @@ const currentUserInfo = (() => {
}
})()
/**
* Purpose: CouponFormState supports CouponsView.vue by holding or executing the coupon form state page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface CouponFormState {
couponCode: string
couponName: string
@@ -404,22 +412,66 @@ const modalLoading = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: formRef supports CouponsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: distributeFormRef supports CouponsView.vue by holding or executing the distribute form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormRef = ref<FormInstance>()
/**
* Purpose: currentCoupon supports CouponsView.vue by holding or executing the current coupon page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentCoupon = ref<Coupon | null>(null)
/**
* Purpose: draftSavedAt supports CouponsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: couponList supports CouponsView.vue by holding or executing the coupon list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const couponList = ref<Coupon[]>([])
/**
* Purpose: tagList supports CouponsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<Tag[]>([])
/**
* Purpose: userList supports CouponsView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: shops supports CouponsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports CouponsView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/** distributeModalVisible is a reactive state variable used by the template and event handlers. */
const distributeModalVisible = ref(false)
/** distributeLoading is a reactive state variable used by the template and event handlers. */
const distributeLoading = ref(false)
/**
* Purpose: currentDistributeCoupon supports CouponsView.vue by holding or executing the current distribute coupon page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentDistributeCoupon = ref<Coupon | null>(null)
/**
* Purpose: pagination supports CouponsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -429,6 +481,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports CouponsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive<CouponFormState>({
couponCode: '',
couponName: '',
@@ -447,12 +503,20 @@ const formState = reactive<CouponFormState>({
autoMatch: 0
})
/**
* Purpose: distributeFormState supports CouponsView.vue by holding or executing the distribute form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormState = reactive({
couponName: '',
userIds: [] as number[],
quantity: 1
})
/**
* Purpose: formRules supports CouponsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
couponName: [{ required: true, message: '请输入优惠券名称', trigger: 'blur' }],
couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'change' }],
@@ -464,11 +528,19 @@ const formRules = {
shopId: [{ required: true, message: '请选择所属店铺', trigger: 'change' }]
} as any
/**
* Purpose: distributeFormRules supports CouponsView.vue by holding or executing the distribute form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const distributeFormRules = {
userIds: [{ required: true, message: '请选择要发放的用户', trigger: 'change' }],
quantity: [{ required: true, message: '请输入发放数量', trigger: 'blur' }]
} as any
/**
* Purpose: columns supports CouponsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '优惠券名称', dataIndex: 'couponName', key: 'couponName' },
{ title: '所属店铺', key: 'shop', width: 140 },
@@ -597,9 +669,17 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: isSameTagSelection supports CouponsView.vue by holding or executing the is same tag selection page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isSameTagSelection = (left: number[], right: number[]) =>
left.length === right.length && left.every((id, index) => Number(id) === Number(right[index]))
/**
* Purpose: removeSelectedTags supports CouponsView.vue by holding or executing the remove selected tags page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const removeSelectedTags = (target: number[], selected: number[]) => {
const selectedIds = new Set(selected.map(Number))
return target.filter(id => !selectedIds.has(Number(id)))
@@ -878,6 +958,10 @@ const handleDistributeCancel = () => {
distributeFormRef.value?.resetFields()
}
/**
* Purpose: fetchVipLevelOptions supports CouponsView.vue by holding or executing the fetch vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchVipLevelOptions = async () => {
try {
const levels = await adminVipRechargePlanApi.listVipLevelOptions(currentUserInfo?.shopId)
@@ -111,13 +111,29 @@ import {
TeamOutlined,
UserOutlined
} from '@ant-design/icons-vue'
/**
* Purpose: DashboardStats supports DashboardView.vue by holding or executing the dashboard stats page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminDashboardApi, type DashboardStats } from '@/api/admin'
import { useAdminViewport } from '@/composables/useAdminViewport'
/**
* Purpose: router supports DashboardView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { isMobile } = useAdminViewport()
/**
* Purpose: loading supports DashboardView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: stats supports DashboardView.vue by holding or executing the stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const stats = reactive<DashboardStats>({
totalUsers: 0,
totalProducts: 0,
@@ -137,6 +153,10 @@ const stats = reactive<DashboardStats>({
recentActivities: []
})
/**
* Purpose: getCurrentUserInfo supports DashboardView.vue by holding or executing the get current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getCurrentUserInfo = () => {
try {
const cache = localStorage.getItem('adminUserInfo')
@@ -147,8 +167,20 @@ const getCurrentUserInfo = () => {
}
}
/**
* Purpose: currentUser supports DashboardView.vue by holding or executing the current user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUser = computed(() => getCurrentUserInfo())
/**
* Purpose: isAdmin supports DashboardView.vue by holding or executing the is admin page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAdmin = computed(() => currentUser.value?.type === 4)
/**
* Purpose: pageSubtitle supports DashboardView.vue by holding or executing the page subtitle page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pageSubtitle = computed(() => {
if (isAdmin.value) {
return '查看全平台经营情况、订单增长与待处理事项'
@@ -156,9 +188,21 @@ const pageSubtitle = computed(() => {
return currentUser.value?.shopName ? `当前店铺:${currentUser.value.shopName}` : '查看当前账号可管理范围内的经营情况'
})
/**
* Purpose: money supports DashboardView.vue by holding or executing the money page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const money = (value?: number) => Number(value || 0)
/**
* Purpose: numberText supports DashboardView.vue by holding or executing the number text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const numberText = (value?: number) => String(Number(value || 0))
/**
* Purpose: primaryStats supports DashboardView.vue by holding or executing the primary stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const primaryStats = computed(() => [
{ key: 'amount', title: '订单总额', value: money(stats.totalOrderAmount), precision: 2, suffix: '元', icon: ShoppingOutlined },
{ key: 'todayAmount', title: '今日订单额', value: money(stats.todayOrderAmount), precision: 2, suffix: '元', icon: ShoppingOutlined },
@@ -166,6 +210,10 @@ const primaryStats = computed(() => [
{ key: 'artists', title: '美甲师数量', value: stats.totalArtists || 0, icon: TeamOutlined }
])
/**
* Purpose: overviewItems supports DashboardView.vue by holding or executing the overview items page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const overviewItems = computed(() => [
{ label: '近 7 日订单额', value: `¥${money(stats.weekOrderAmount).toFixed(2)}` },
{ label: '今日订单数', value: numberText(stats.todayOrders) },
@@ -177,6 +225,10 @@ const overviewItems = computed(() => [
{ label: isAdmin.value ? '店铺数量' : '作品数量', value: numberText(isAdmin.value ? stats.totalShops : stats.totalProducts) }
])
/**
* Purpose: quickLinks supports DashboardView.vue by holding or executing the quick links page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const quickLinks = computed(() => [
{ label: '订单管理', path: '/admin/orders', icon: ShoppingOutlined },
{ label: '用户管理', path: '/admin/users', icon: UserOutlined },
@@ -186,6 +238,10 @@ const quickLinks = computed(() => [
{ label: isAdmin.value ? '店铺管理' : '美甲师管理', path: isAdmin.value ? '/admin/shops' : '/admin/nail-artists', icon: HomeOutlined }
])
/**
* Purpose: formatTime supports DashboardView.vue by holding or executing the format time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatTime = (timeStr: string) => {
if (!timeStr) return ''
const time = new Date(timeStr)
@@ -201,6 +257,10 @@ const formatTime = (timeStr: string) => {
return time.toLocaleDateString('zh-CN')
}
/**
* Purpose: fetchStats supports DashboardView.vue by holding or executing the fetch stats page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchStats = async () => {
loading.value = true
try {
@@ -169,7 +169,15 @@ import {
TeamOutlined,
UserOutlined
} from '@ant-design/icons-vue'
/**
* Purpose: UserVO supports HomeView.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type UserVO } from '@/api/admin'
/**
* Purpose: PermissionVO supports HomeView.vue by holding or executing the permission vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { permissionApi, type PermissionVO } from '@/api/permission'
import { DEFAULT_AVATAR } from '@/constants'
import { message } from 'ant-design-vue'
@@ -177,11 +185,23 @@ import { useAdminViewport } from '@/composables/useAdminViewport'
import { isBootstrapAdminUser } from './admin-helpers'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
/**
* Purpose: router supports HomeView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { isMobile } = useAdminViewport()
/** currentTime is a reactive state variable used by the template and event handlers. */
const currentTime = ref('')
/**
* Purpose: userInfo supports HomeView.vue by holding or executing the user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userInfo = ref<UserVO | null>(null)
/**
* Purpose: userPermissions supports HomeView.vue by holding or executing the user permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userPermissions = ref<PermissionVO[]>([])
let timer: number | null = null
@@ -54,14 +54,42 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: LegalAgreementAdminVO supports LegalAgreementsView.vue by holding or executing the legal agreement admin vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminLegalAgreementApi, type LegalAgreementAdminVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports LegalAgreementsView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: saving supports LegalAgreementsView.vue by holding or executing the saving page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saving = ref(false)
/**
* Purpose: modalOpen supports LegalAgreementsView.vue by holding or executing the modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const modalOpen = ref(false)
/**
* Purpose: editingId supports LegalAgreementsView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<IdType | null>(null)
/**
* Purpose: agreements supports LegalAgreementsView.vue by holding or executing the agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const agreements = ref<LegalAgreementAdminVO[]>([])
/**
* Purpose: form supports LegalAgreementsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive({
agreementType: 'USER_TERMS' as 'USER_TERMS' | 'PRIVACY_POLICY',
title: '',
@@ -69,6 +97,10 @@ const form = reactive({
content: ''
})
/**
* Purpose: columns supports LegalAgreementsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '类型', dataIndex: 'agreementTypeName', key: 'agreementTypeName' },
{ title: '标题', dataIndex: 'title', key: 'title' },
@@ -78,6 +110,10 @@ const columns = [
{ title: '操作', key: 'action', width: 220 }
]
/**
* Purpose: loadAgreements supports LegalAgreementsView.vue by holding or executing the load agreements page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadAgreements = async () => {
loading.value = true
try {
@@ -87,6 +123,10 @@ const loadAgreements = async () => {
}
}
/**
* Purpose: resetForm supports LegalAgreementsView.vue by holding or executing the reset form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetForm = () => {
editingId.value = null
form.agreementType = 'USER_TERMS'
@@ -95,11 +135,19 @@ const resetForm = () => {
form.content = ''
}
/**
* Purpose: openCreate supports LegalAgreementsView.vue by holding or executing the open create page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openCreate = () => {
resetForm()
modalOpen.value = true
}
/**
* Purpose: openEdit supports LegalAgreementsView.vue by holding or executing the open edit page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openEdit = (record: Record<string, any>) => {
const agreement = record as LegalAgreementAdminVO
editingId.value = agreement.id
@@ -110,6 +158,10 @@ const openEdit = (record: Record<string, any>) => {
modalOpen.value = true
}
/**
* Purpose: saveAgreement supports LegalAgreementsView.vue by holding or executing the save agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saveAgreement = async () => {
if (!form.title || !form.version || !form.content) {
message.warning('请填写完整协议信息')
@@ -130,12 +182,20 @@ const saveAgreement = async () => {
}
}
/**
* Purpose: publishAgreement supports LegalAgreementsView.vue by holding or executing the publish agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const publishAgreement = async (id: IdType) => {
await adminLegalAgreementApi.publish(id)
message.success('发布成功')
await loadAgreements()
}
/**
* Purpose: disableAgreement supports LegalAgreementsView.vue by holding or executing the disable agreement page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const disableAgreement = async (id: IdType) => {
await adminLegalAgreementApi.disable(id)
message.success('已停用')
@@ -68,6 +68,10 @@ import {
loadCachedAdminUserInfo
} from './admin-helpers'
/**
* Purpose: router supports ManageView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { hasPermission, loadUserPermissions } = usePermission()
@@ -115,6 +115,10 @@
*/
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: MessageHubPushConfigVO supports MessageHubPushConfigsView.vue by holding or executing the message hub push config vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminMessageHubPushConfigApi, adminSystemParameterConfigApi, type MessageHubPushConfigVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -127,15 +131,47 @@ const testing = ref(false)
const formOpen = ref(false)
/** testOpen is a reactive state variable used by the template and event handlers. */
const testOpen = ref(false)
/**
* Purpose: editingId supports MessageHubPushConfigsView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<any>()
/**
* Purpose: testingId supports MessageHubPushConfigsView.vue by holding or executing the testing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const testingId = ref<any>()
/** testPhone is a reactive state variable used by the template and event handlers. */
const testPhone = ref('')
/**
* Purpose: configs supports MessageHubPushConfigsView.vue by holding or executing the configs page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const configs = ref<MessageHubPushConfigVO[]>([])
/**
* Purpose: savingMap supports MessageHubPushConfigsView.vue by holding or executing the saving map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const savingMap = ref(false)
/**
* Purpose: mapEnabled supports MessageHubPushConfigsView.vue by holding or executing the map enabled page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapEnabled = ref(true)
/**
* Purpose: mapProvider supports MessageHubPushConfigsView.vue by holding or executing the map provider page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
/**
* Purpose: mapRemark supports MessageHubPushConfigsView.vue by holding or executing the map remark page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapRemark = ref('地图渠道由平台管理员选择;高德 Web Key 与高德小程序 Key 分开填写。')
/**
* Purpose: createMapForm supports MessageHubPushConfigsView.vue by holding or executing the create map form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createMapForm = (configKey: string, configName: string, remark: string) => ({
configGroup: 'MAP',
configKey,
@@ -144,6 +180,10 @@ const createMapForm = (configKey: string, configName: string, remark: string) =>
enabled: 1,
remark
})
/**
* Purpose: mapForms supports MessageHubPushConfigsView.vue by holding or executing the map forms page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapForms = reactive({
provider: createMapForm('MAP_PROVIDER', '当前地图渠道', 'TENCENT 或 AMAP;决定后台店铺选点默认使用哪个地图渠道'),
tencentWeb: createMapForm('TENCENT_MAP_KEY', '腾讯 Web Key', '用于后台腾讯地图选点和 Web 展示'),
@@ -151,6 +191,10 @@ const mapForms = reactive({
amapMini: createMapForm('AMAP_MINI_KEY', '高德小程序 Key', '用于后续小程序端高德 SDK / API 调用')
})
/**
* Purpose: sceneOptions supports MessageHubPushConfigsView.vue by holding or executing the scene options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sceneOptions = [
{ label: '用户注册验证码', value: 'USER_REGISTER_SMS_CODE' },
{ label: '手机号登录验证码', value: 'USER_LOGIN_SMS_CODE' },
@@ -160,11 +204,19 @@ const sceneOptions = [
{ label: '修改密码验证码', value: 'USER_CHANGE_PASSWORD_SMS_CODE' }
]
/**
* Purpose: sendMethodOptions supports MessageHubPushConfigsView.vue by holding or executing the send method options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sendMethodOptions = [
{ label: 'SPUG', value: 'SPUG' },
{ label: 'OTHER', value: 'OTHER' }
]
/**
* Purpose: form supports MessageHubPushConfigsView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({
sceneCode: 'USER_LOGIN_SMS_CODE',
sceneName: '手机号登录验证码',
@@ -179,6 +231,10 @@ const form = reactive<any>({
remark: ''
})
/**
* Purpose: columns supports MessageHubPushConfigsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '业务场景', key: 'scene' },
{ title: 'MessageHub', key: 'messagehub' },
@@ -214,6 +270,10 @@ const load = async () => {
}
}
/**
* Purpose: saveMapConfig supports MessageHubPushConfigsView.vue by holding or executing the save map config page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saveMapConfig = async () => {
savingMap.value = true
try {
@@ -259,8 +259,20 @@ import { ref, reactive, onMounted } from 'vue'
import { message } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: NailArtistInfoVO supports NailArtistsView.vue by holding or executing the nail artist info vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminNailArtistApi, type NailArtistInfoVO } from '@/api/admin'
/**
* Purpose: Tag supports NailArtistsView.vue by holding or executing the tag page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminTagApi, type Tag } from '@/api/admin'
/**
* Purpose: Product supports NailArtistsView.vue by holding or executing the product page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminProductApi, type Product } from '@/api/admin'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -296,8 +308,20 @@ const tagLoading = ref(false)
const productLoading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: nailArtistList supports NailArtistsView.vue by holding or executing the nail artist list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const nailArtistList = ref<NailArtistInfoVO[]>([])
/**
* Purpose: tagList supports NailArtistsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<Tag[]>([])
/**
* Purpose: productList supports NailArtistsView.vue by holding or executing the product list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productList = ref<Product[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -309,11 +333,31 @@ const viewModalVisible = ref(false)
const isAdmin = ref(false)
/** isShopOwner is a reactive state variable used by the template and event handlers. */
const isShopOwner = ref(false)
/**
* Purpose: formRef supports NailArtistsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentNailArtist supports NailArtistsView.vue by holding or executing the current nail artist page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentNailArtist = ref<NailArtistInfoVO | null>(null)
/**
* Purpose: currentUserInfo supports NailArtistsView.vue by holding or executing the current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserInfo = getCurrentUserInfo()
/**
* Purpose: draftSavedAt supports NailArtistsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: viewFormState supports NailArtistsView.vue by holding or executing the view form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewFormState = reactive({
nickname: '',
shopName: '',
@@ -327,6 +371,10 @@ const viewFormState = reactive({
portfolioText: ''
})
/**
* Purpose: pagination supports NailArtistsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -336,6 +384,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports NailArtistsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
userId: 0,
identity: '',
@@ -406,6 +458,10 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports NailArtistsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
identity: [{ required: true, message: '请输入身份', trigger: 'blur' }],
experience: [{ required: true, message: '请输入从业年限', trigger: 'blur' }],
@@ -414,6 +470,10 @@ const formRules = {
portfolio: [{ required: true, message: '请选择作品作品', trigger: 'change' }]
} as any
/**
* Purpose: columns supports NailArtistsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '美甲师姓名', dataIndex: 'nickname', key: 'nickname' },
{ title: '所属店铺', dataIndex: 'shopName', key: 'shopName' },
@@ -219,6 +219,10 @@
*/
import { computed, onMounted, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: Shop supports OrdersView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminOrderApi, adminShopApi, type Shop } from '@/api/admin'
import { usePermission } from '@/utils/permission'
import type { IdType } from '@/utils/id'
@@ -229,12 +233,32 @@ import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
/**
* Purpose: orders supports OrdersView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: shopLoading supports OrdersView.vue by holding or executing the shop loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopLoading = ref(false)
/**
* Purpose: currentOrder supports OrdersView.vue by holding or executing the current order page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentOrder = ref<any | null>(null)
/**
* Purpose: currentUserType supports OrdersView.vue by holding or executing the current user type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserType = ref<number | null>(null)
/**
* Purpose: currentUserInfo supports OrdersView.vue by holding or executing the current user info page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUserInfo = (() => {
try {
const cached = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
@@ -246,14 +270,50 @@ const currentUserInfo = (() => {
})()
/** keyword is a reactive state variable used by the template and event handlers. */
const keyword = ref('')
/**
* Purpose: statusFilter supports OrdersView.vue by holding or executing the status filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusFilter = ref<'all' | string>('all')
/**
* Purpose: shopList supports OrdersView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/**
* Purpose: shopFilter supports OrdersView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<string | undefined>()
/**
* Purpose: artistKeyword supports OrdersView.vue by holding or executing the artist keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artistKeyword = ref('')
/**
* Purpose: userKeyword supports OrdersView.vue by holding or executing the user keyword page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userKeyword = ref('')
/**
* Purpose: createRange supports OrdersView.vue by holding or executing the create range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createRange = ref<[string, string] | undefined>()
/**
* Purpose: appointmentRange supports OrdersView.vue by holding or executing the appointment range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const appointmentRange = ref<[string, string] | undefined>()
/**
* Purpose: minAmount supports OrdersView.vue by holding or executing the min amount page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const minAmount = ref<number | undefined>()
/**
* Purpose: maxAmount supports OrdersView.vue by holding or executing the max amount page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const maxAmount = ref<number | undefined>()
const { hasPermission, loadUserPermissions } = usePermission()
@@ -266,6 +326,10 @@ const detailVisible = computed({
const canProcessOrders = computed(() => hasPermission('order:process'))
/** isArtist is a reactive state variable used by the template and event handlers. */
const isArtist = computed(() => currentUserType.value === 3)
/**
* Purpose: statusOptions supports OrdersView.vue by holding or executing the status options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusOptions = [
{ label: '全部状态', value: 'all' },
{ label: '待处理', value: '1' },
@@ -301,12 +365,20 @@ const filteredOrders = computed(() => {
})
})
/**
* Purpose: matchText supports OrdersView.vue by holding or executing the match text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchText = (needle: string, values: any[]) => {
const normalized = needle.trim().toLowerCase()
if (!normalized) return true
return values.some(value => String(value ?? '').toLowerCase().includes(normalized))
}
/**
* Purpose: matchRange supports OrdersView.vue by holding or executing the match range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchRange = (value: string | undefined, range?: [string, string], candidates?: string[]) => {
if (!range?.length) return true
const values = candidates?.length ? candidates : [value]
@@ -319,6 +391,10 @@ const matchRange = (value: string | undefined, range?: [string, string], candida
})
}
/**
* Purpose: resetFilters supports OrdersView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
keyword.value = ''
statusFilter.value = 'all'
@@ -332,6 +408,10 @@ const resetFilters = () => {
void loadOrders()
}
/**
* Purpose: columns supports OrdersView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '订单编号', dataIndex: 'orderNo', key: 'orderNo' },
{ title: '用户ID', dataIndex: 'userId', key: 'userId', width: 100 },
@@ -343,6 +423,10 @@ const columns = [
{ title: '操作', key: 'actions', width: 180 }
]
/**
* Purpose: itemColumns supports OrdersView.vue by holding or executing the item columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const itemColumns = [
{ title: '商品ID', dataIndex: 'productId', key: 'productId', width: 100 },
{ title: '商品名称', dataIndex: 'productTitle', key: 'productTitle' },
@@ -361,6 +445,10 @@ const statusColor = (status: number) => {
return 'default'
}
/**
* Purpose: normalizeUserType supports OrdersView.vue by holding or executing the normalize user type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeUserType = (value: unknown) => {
const type = Number(value)
return Number.isFinite(type) ? type : null
@@ -371,6 +459,10 @@ const resolveCurrentUserType = () => {
currentUserType.value = normalizeUserType(currentUserInfo?.type)
}
/**
* Purpose: normalizeShopId supports OrdersView.vue by holding or executing the normalize shop id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeShopId = (value: unknown) => {
if (value === undefined || value === null || value === '') {
return undefined
@@ -378,8 +470,16 @@ const normalizeShopId = (value: unknown) => {
return String(value)
}
/**
* Purpose: getShopOptionValue supports OrdersView.vue by holding or executing the get shop option value page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getShopOptionValue = (shop: Shop) => normalizeShopId((shop as any).id) || ''
/**
* Purpose: loadShopOptions supports OrdersView.vue by holding or executing the load shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadShopOptions = async () => {
shopLoading.value = true
try {
@@ -343,7 +343,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_AVATAR } from '@/constants'
/**
* Purpose: UserVO supports PermissionsView.vue by holding or executing the user vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type UserVO } from '@/api/admin'
/**
* Purpose: PermissionVO supports PermissionsView.vue by holding or executing the permission vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { permissionApi, type PermissionVO } from '@/api/permission'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -362,6 +370,10 @@ const { isMobile } = useAdminViewport()
const activeTab = ref('permissions')
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
/**
* Purpose: permissionList supports PermissionsView.vue by holding or executing the permission list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionList = ref<PermissionVO[]>([])
/** permissionModalVisible is a reactive state variable used by the template and event handlers. */
const permissionModalVisible = ref(false)
@@ -369,10 +381,26 @@ const permissionModalVisible = ref(false)
const permissionModalLoading = ref(false)
/** isEditPermission is a reactive state variable used by the template and event handlers. */
const isEditPermission = ref(false)
/**
* Purpose: permissionFormRef supports PermissionsView.vue by holding or executing the permission form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionFormRef = ref<FormInstance>()
/**
* Purpose: currentPermission supports PermissionsView.vue by holding or executing the current permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentPermission = ref<PermissionVO | null>(null)
/**
* Purpose: draftSavedAt supports PermissionsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: permissionPagination supports PermissionsView.vue by holding or executing the permission pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionPagination = reactive({
current: 1,
pageSize: 20,
@@ -382,6 +410,10 @@ const permissionPagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: permissionFormState supports PermissionsView.vue by holding or executing the permission form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionFormState = reactive({
permissionCode: '',
permissionName: '',
@@ -435,6 +467,10 @@ const permissionFormRules: Record<string, Rule[]> = {
description: [{ required: true, message: '请输入权限描述', trigger: 'blur' }]
}
/**
* Purpose: permissionColumns supports PermissionsView.vue by holding or executing the permission columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionColumns = [
{ title: '权限编码', dataIndex: 'permissionCode', key: 'permissionCode' },
{ title: '权限名称', dataIndex: 'permissionName', key: 'permissionName' },
@@ -448,14 +484,42 @@ const permissionColumns = [
const userLoading = ref(false)
/** userSearchText is a reactive state variable used by the template and event handlers. */
const userSearchText = ref('')
/**
* Purpose: userList supports PermissionsView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: selectedUser supports PermissionsView.vue by holding or executing the selected user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedUser = ref<UserVO | null>(null)
/** assignLoading is a reactive state variable used by the template and event handlers. */
const assignLoading = ref(false)
/**
* Purpose: selectedPermissions supports PermissionsView.vue by holding or executing the selected permissions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedPermissions = ref<IdType[]>([])
/**
* Purpose: assignablePermissionIds supports PermissionsView.vue by holding or executing the assignable permission ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assignablePermissionIds = ref<IdType[]>([])
/**
* Purpose: activeCollapseKeys supports PermissionsView.vue by holding or executing the active collapse keys page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeCollapseKeys = ref<string[]>(['作品管理', '店铺管理', '用户管理', '权限管理'])
/**
* Purpose: currentLoginUser supports PermissionsView.vue by holding or executing the current login user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentLoginUser = ref<UserVO | null>(null)
/**
* Purpose: mobilePermissionStep supports PermissionsView.vue by holding or executing the mobile permission step page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mobilePermissionStep = ref<'users' | 'assign'>('users')
// 权限 ID 同样可能以字符串形式返回,所以这里统一转成字符串集合做包含判断。
@@ -512,7 +512,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
/**
* Purpose: Product supports ProductsView.vue by holding or executing the product page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminProductApi, type Product, adminShopApi, type Shop, adminFileApi, adminTagApi, adminArtistApi, adminCouponApi } from '@/api/admin'
/**
* Purpose: ChunkUploadTask supports ProductsView.vue by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -531,11 +539,35 @@ const { isMobile } = useAdminViewport()
const loading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopFilter supports ProductsView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<IdType | undefined>()
/**
* Purpose: tagFilter supports ProductsView.vue by holding or executing the tag filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagFilter = ref<IdType | undefined>()
/**
* Purpose: minPriceFilter supports ProductsView.vue by holding or executing the min price filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const minPriceFilter = ref<number | undefined>()
/**
* Purpose: maxPriceFilter supports ProductsView.vue by holding or executing the max price filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const maxPriceFilter = ref<number | undefined>()
/**
* Purpose: createdRange supports ProductsView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: productList supports ProductsView.vue by holding or executing the product list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const productList = ref<Product[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -545,16 +577,36 @@ const viewModalVisible = ref(false)
const modalLoading = ref(false)
/** isEdit is a reactive state variable used by the template and event handlers. */
const isEdit = ref(false)
/**
* Purpose: currentProduct supports ProductsView.vue by holding or executing the current product page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentProduct = ref<Product | null>(null)
/**
* Purpose: shops supports ProductsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: tags supports ProductsView.vue by holding or executing the tags page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tags = ref<any[]>([])
/** loadingTags is a reactive state variable used by the template and event handlers. */
const loadingTags = ref(false)
/**
* Purpose: artists supports ProductsView.vue by holding or executing the artists page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const artists = ref<any[]>([])
/** loadingArtists is a reactive state variable used by the template and event handlers. */
const loadingArtists = ref(false)
/**
* Purpose: coupons supports ProductsView.vue by holding or executing the coupons page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const coupons = ref<any[]>([])
/** loadingCoupons is a reactive state variable used by the template and event handlers. */
const loadingCoupons = ref(false)
@@ -562,20 +614,56 @@ const loadingCoupons = ref(false)
const previewVisible = ref(false)
/** previewImage is a reactive state variable used by the template and event handlers. */
const previewImage = ref('')
/**
* Purpose: imageFileList supports ProductsView.vue by holding or executing the image file list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageFileList = ref<any[]>([])
/**
* Purpose: uploadedFileIds supports ProductsView.vue by holding or executing the uploaded file ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedFileIds = ref<string[]>([])
/**
* Purpose: imageUrls supports ProductsView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUrls = ref<Record<string, string[]>>({})
/**
* Purpose: viewImageUrls supports ProductsView.vue by holding or executing the view image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewImageUrls = ref<string[]>([])
/**
* Purpose: imageIdCache supports ProductsView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/** isAdmin is a reactive state variable used by the template and event handlers. */
const isAdmin = ref(false)
/**
* Purpose: formRef supports ProductsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<any>(null)
/**
* Purpose: uploadTaskMap supports ProductsView.vue by holding or executing the upload task map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadTaskMap = new Map<string, ChunkUploadTask<any>>()
/** activeUploadCount is a reactive state variable used by the template and event handlers. */
const activeUploadCount = ref(0)
/** isUploadPending is a reactive state variable used by the template and event handlers. */
const isUploadPending = computed(() => activeUploadCount.value > 0)
/**
* Purpose: draftSavedAt supports ProductsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: requestTokens supports ProductsView.vue by holding or executing the request tokens page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const requestTokens = reactive({
shops: 0,
tags: 0,
@@ -602,6 +690,10 @@ const formatDuration = (value?: string | number | null) => {
return text.includes('分钟') ? text : `${text}分钟`
}
/**
* Purpose: viewFormState supports ProductsView.vue by holding or executing the view form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewFormState = reactive({
shopId: undefined,
title: '',
@@ -616,6 +708,10 @@ const viewFormState = reactive({
availableCoupons: [] as string[]
})
/**
* Purpose: pagination supports ProductsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -625,6 +721,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports ProductsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
shopId: undefined,
title: '',
@@ -661,6 +761,10 @@ const formRules: any = {
bookableArtists: [{ required: true, message: '请选择美甲师', trigger: 'change' }]
}
/**
* Purpose: columns supports ProductsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '图片', key: 'image', width: 150 },
{ title: '作品名称', dataIndex: 'title', key: 'title' },
@@ -892,6 +996,10 @@ const fetchProductList = async () => {
}
}
/**
* Purpose: resetFilters supports ProductsView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
searchText.value = ''
shopFilter.value = undefined
@@ -96,6 +96,10 @@ import {
loadCachedAdminUserInfo
} from './admin-helpers'
/**
* Purpose: router supports ProfileView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { userPermissions, loadUserPermissions, clearPermissions } = usePermission()
@@ -108,6 +112,10 @@ const shopSwitchLoading = ref(false)
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => getAdminCurrentShopName(userInfo.value))
/**
* Purpose: isPlatformOverview supports ProfileView.vue by holding or executing the is platform overview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isPlatformOverview = computed(() => isBootstrapAdminUser(userInfo.value))
/** roleLabel is a reactive state variable used by the template and event handlers. */
const roleLabel = computed(() => getAdminRoleLabel(userInfo.value?.type))
@@ -587,7 +587,15 @@ import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
import TableEllipsisText from '@/components/TableEllipsisText.vue'
import { DEFAULT_SHOP_IMAGE } from '@/constants'
/**
* Purpose: Shop supports ShopsView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminShopApi, adminFileApi, adminSystemParameterConfigApi, type Shop } from '@/api/admin'
/**
* Purpose: ChunkUploadTask supports ShopsView.vue by holding or executing the chunk upload task page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
@@ -601,6 +609,10 @@ import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { hasPermission, loadUserPermissions } = usePermission()
const { isMobile } = useAdminViewport()
/**
* Purpose: ShopThemeTemplateColors supports ShopsView.vue by holding or executing the shop theme template colors page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ShopThemeTemplateColors {
themePrimaryColor: string
themeSecondaryColor: string
@@ -609,6 +621,10 @@ interface ShopThemeTemplateColors {
themeCardBgColor: string
}
/**
* Purpose: ShopThemeTemplate supports ShopsView.vue by holding or executing the shop theme template page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
interface ShopThemeTemplate extends ShopThemeTemplateColors {
id: string
name: string
@@ -616,7 +632,15 @@ interface ShopThemeTemplate extends ShopThemeTemplateColors {
createdAt?: number
}
/**
* Purpose: CUSTOM_THEME_TEMPLATE_STORAGE_KEY supports ShopsView.vue by holding or executing the custom theme template storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const CUSTOM_THEME_TEMPLATE_STORAGE_KEY = 'yuminail:admin:shop-theme-templates'
/**
* Purpose: CUSTOM_THEME_TEMPLATE_LIMIT supports ShopsView.vue by holding or executing the custom theme template limit page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const CUSTOM_THEME_TEMPLATE_LIMIT = 20
const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
@@ -726,6 +750,10 @@ const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
const loading = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopList supports ShopsView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/** modalVisible is a reactive state variable used by the template and event handlers. */
const modalVisible = ref(false)
@@ -735,18 +763,50 @@ const viewModalVisible = ref(false)
const modalLoading = ref(false)
/** isEdit is a reactive state variable used by the template and event handlers. */
const isEdit = ref(false)
/**
* Purpose: mapPickerVisible supports ShopsView.vue by holding or executing the map picker visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerVisible = ref(false)
/**
* Purpose: mapPickerKey supports ShopsView.vue by holding or executing the map picker key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerKey = ref('')
/**
* Purpose: mapPickerUrl supports ShopsView.vue by holding or executing the map picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerUrl = ref('')
/**
* Purpose: mapPickerProvider supports ShopsView.vue by holding or executing the map picker provider page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerProvider = ref<'TENCENT' | 'AMAP'>('TENCENT')
/**
* Purpose: locating supports ShopsView.vue by holding or executing the locating page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const locating = ref(false)
/**
* Purpose: formRef supports ShopsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentShop supports ShopsView.vue by holding or executing the current shop page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentShop = ref<Shop | null>(null)
/** isAdmin is a reactive state variable used by the template and event handlers. */
const isAdmin = ref(false)
// Banner图片相关
const bannerFileList = ref<any[]>([])
/**
* Purpose: uploadedBannerIds supports ShopsView.vue by holding or executing the uploaded banner ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedBannerIds = ref<string[]>([])
/** bannerPreviewVisible is a reactive state variable used by the template and event handlers. */
const bannerPreviewVisible = ref(false)
@@ -755,13 +815,45 @@ const bannerPreviewImage = ref('')
// 店铺图片相关
const imageFileList = ref<any[]>([])
/**
* Purpose: uploadedFileIds supports ShopsView.vue by holding or executing the uploaded file ids page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedFileIds = ref<string[]>([])
/**
* Purpose: themeBackgroundFileList supports ShopsView.vue by holding or executing the theme background file list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeBackgroundFileList = ref<any[]>([])
/**
* Purpose: uploadedThemeBackgroundId supports ShopsView.vue by holding or executing the uploaded theme background id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadedThemeBackgroundId = ref('')
/**
* Purpose: imageIdCache supports ShopsView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: shopImageUrls supports ShopsView.vue by holding or executing the shop image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopImageUrls = ref<Record<string, string[]>>({})
/**
* Purpose: shopBannerUrls supports ShopsView.vue by holding or executing the shop banner urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopBannerUrls = ref<Record<string, string[]>>({})
/**
* Purpose: viewImageUrls supports ShopsView.vue by holding or executing the view image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewImageUrls = ref<string[]>([])
/**
* Purpose: viewBannerUrls supports ShopsView.vue by holding or executing the view banner urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewBannerUrls = ref<string[]>([])
/** previewVisible is a reactive state variable used by the template and event handlers. */
const previewVisible = ref(false)
@@ -771,14 +863,34 @@ const previewImage = ref('')
const businessStartTime = ref('')
/** businessEndTime is a reactive state variable used by the template and event handlers. */
const businessEndTime = ref('')
/**
* Purpose: uploadTaskMap supports ShopsView.vue by holding or executing the upload task map page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const uploadTaskMap = new Map<string, ChunkUploadTask<any>>()
/** activeUploadCount is a reactive state variable used by the template and event handlers. */
const activeUploadCount = ref(0)
/** isUploadPending is a reactive state variable used by the template and event handlers. */
const isUploadPending = computed(() => activeUploadCount.value > 0)
/**
* Purpose: draftSavedAt supports ShopsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/**
* Purpose: customThemeTemplates supports ShopsView.vue by holding or executing the custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const customThemeTemplates = ref<ShopThemeTemplate[]>([])
/**
* Purpose: themeTemplateSaveVisible supports ShopsView.vue by holding or executing the theme template save visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplateSaveVisible = ref(false)
/**
* Purpose: themeTemplateName supports ShopsView.vue by holding or executing the theme template name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplateName = ref('')
// 查看店铺相关状态
@@ -805,6 +917,10 @@ const viewFormState = reactive({
themeBackgroundImageFileId: ''
})
/**
* Purpose: pagination supports ShopsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -814,6 +930,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports ShopsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
shopName: '',
description: '',
@@ -836,19 +956,35 @@ const formState = reactive({
themeBackgroundImageFileId: ''
})
/**
* Purpose: selectedLocationText supports ShopsView.vue by holding or executing the selected location text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedLocationText = computed(() => {
if (formState.address) return formState.address
if (formState.longitude && formState.latitude) return '已选择地图位置'
return '暂未选择地图位置'
})
/**
* Purpose: selectedCoordinateText supports ShopsView.vue by holding or executing the selected coordinate text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedCoordinateText = computed(() => {
if (!formState.longitude || !formState.latitude) return '点击“地图选点”搜索店铺名称或地址'
return '已选择地图位置,可重新选点'
})
/**
* Purpose: mapPickerTitle supports ShopsView.vue by holding or executing the map picker title page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const mapPickerTitle = computed(() => mapPickerProvider.value === 'AMAP' ? '高德地图选点' : '腾讯地图选点')
/**
* Purpose: computedAuthorizationExpireTime supports ShopsView.vue by holding or executing the computed authorization expire time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const computedAuthorizationExpireTime = computed(() => {
if (!formState.authorizationStartDate || !formState.authorizationDays || formState.authorizationDays <= 0) {
return formState.authorizationExpireTime || ''
@@ -861,29 +997,69 @@ const computedAuthorizationExpireTime = computed(() => {
return `${yyyy}-${mm}-${dd} 23:59:59`
})
/**
* Purpose: computedAuthorizationExpireTimeText supports ShopsView.vue by holding or executing the computed authorization expire time text page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const computedAuthorizationExpireTimeText = computed(() => formatAuthorizationExpireTime(computedAuthorizationExpireTime.value))
/**
* Purpose: themePreview supports ShopsView.vue by holding or executing the theme preview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreview = computed(() => resolveShopTheme(formState))
/**
* Purpose: viewThemePreview supports ShopsView.vue by holding or executing the view theme preview page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewThemePreview = computed(() => resolveShopTheme(viewFormState))
/**
* Purpose: themePreviewStyle supports ShopsView.vue by holding or executing the theme preview style page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreviewStyle = computed(() => ({
color: themePreview.value.textPrimary,
borderColor: themePreview.value.borderColor,
background: themePreview.value.softGradient
}))
/**
* Purpose: themePreviewButtonStyle supports ShopsView.vue by holding or executing the theme preview button style page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themePreviewButtonStyle = computed(() => ({
color: '#ffffff',
background: themePreview.value.gradient,
boxShadow: themePreview.value.cssVars['--theme-button-shadow']
}))
/**
* Purpose: themeTemplates supports ShopsView.vue by holding or executing the theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeTemplates = computed(() => [...PRESET_THEME_TEMPLATES, ...customThemeTemplates.value])
/**
* Purpose: currentThemeTemplateColors supports ShopsView.vue by holding or executing the current theme template colors page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentThemeTemplateColors = computed(() => buildThemeTemplateColors(formState))
/**
* Purpose: currentThemeTemplateSwatches supports ShopsView.vue by holding or executing the current theme template swatches page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentThemeTemplateSwatches = computed(() => getThemeTemplateSwatches(currentThemeTemplateColors.value))
/**
* Purpose: normalizeTemplateColor supports ShopsView.vue by holding or executing the normalize template color page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeTemplateColor = (value?: string) => {
const normalized = String(value || '').trim().toUpperCase()
return /^#[0-9A-F]{6}$/.test(normalized) ? normalized : ''
}
/**
* Purpose: buildThemeTemplateColors supports ShopsView.vue by holding or executing the build theme template colors page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplateColors => {
const resolvedTheme = resolveShopTheme(source)
return {
@@ -895,6 +1071,10 @@ const buildThemeTemplateColors = (source: Record<string, any>): ShopThemeTemplat
}
}
/**
* Purpose: getThemeTemplateSwatches supports ShopsView.vue by holding or executing the get theme template swatches page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
template.themePrimaryColor,
template.themeSecondaryColor,
@@ -903,6 +1083,10 @@ const getThemeTemplateSwatches = (template: ShopThemeTemplateColors) => [
template.themeCardBgColor
]
/**
* Purpose: normalizeThemeTemplate supports ShopsView.vue by holding or executing the normalize theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
if (!value || typeof value !== 'object') {
return null
@@ -927,6 +1111,10 @@ const normalizeThemeTemplate = (value: any): ShopThemeTemplate | null => {
}
}
/**
* Purpose: persistCustomThemeTemplates supports ShopsView.vue by holding or executing the persist custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const persistCustomThemeTemplates = () => {
if (typeof window === 'undefined') {
return
@@ -934,6 +1122,10 @@ const persistCustomThemeTemplates = () => {
window.localStorage.setItem(getThemeTemplateStorageKey(), JSON.stringify(customThemeTemplates.value))
}
/**
* Purpose: loadCustomThemeTemplates supports ShopsView.vue by holding or executing the load custom theme templates page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadCustomThemeTemplates = () => {
if (typeof window === 'undefined') {
return
@@ -949,11 +1141,19 @@ const loadCustomThemeTemplates = () => {
}
}
/**
* Purpose: isThemeTemplateActive supports ShopsView.vue by holding or executing the is theme template active page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isThemeTemplateActive = (template: ShopThemeTemplateColors) => {
const currentColors = currentThemeTemplateColors.value
return getThemeTemplateSwatches(template).every((color, index) => color === getThemeTemplateSwatches(currentColors)[index])
}
/**
* Purpose: themeColorValidator supports ShopsView.vue by holding or executing the theme color validator page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const themeColorValidator = async (_rule: any, value?: string) => {
if (!value) {
return Promise.resolve()
@@ -996,6 +1196,10 @@ const formRules: any = {
themeCardBgColor: [{ validator: themeColorValidator, trigger: 'blur' }]
}
/**
* Purpose: columns supports ShopsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '图片', key: 'image', width: 150 },
{ title: 'Banner', key: 'banner', width: 200 },
@@ -1025,6 +1229,10 @@ const getCurrentUserInfo = () => {
return null
}
/**
* Purpose: getThemeTemplateStorageKey supports ShopsView.vue by holding or executing the get theme template storage key page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getThemeTemplateStorageKey = () => {
const currentUser = getCurrentUserInfo()
const userKey = currentUser?.id ?? currentUser?.userId ?? currentUser?.account ?? currentUser?.username ?? 'default'
@@ -1122,12 +1330,20 @@ const formatAuthorizationExpireTime = (value?: string) => {
return value.replace('T', ' ').slice(0, 16)
}
/**
* Purpose: formatLocation supports ShopsView.vue by holding or executing the format location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatLocation = (shop?: Partial<Shop> | Record<string, any>) => {
const locationName = shop?.address || shop?.shopName || ''
if (!locationName) return '未设置地图位置'
return locationName || '未设置地图位置'
}
/**
* Purpose: buildTencentLocationPickerUrl supports ShopsView.vue by holding or executing the build tencent location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildTencentLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
const params = new URLSearchParams({
search: '1',
@@ -1144,6 +1360,10 @@ const buildTencentLocationPickerUrl = (options: { latitude?: string | number; lo
return `https://apis.map.qq.com/tools/locpicker?${params.toString()}`
}
/**
* Purpose: buildAmapLocationPickerUrl supports ShopsView.vue by holding or executing the build amap location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildAmapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
const params = new URLSearchParams({
key: mapPickerKey.value,
@@ -1158,19 +1378,35 @@ const buildAmapLocationPickerUrl = (options: { latitude?: string | number; longi
return `https://m.amap.com/picker/?${params.toString()}`
}
/**
* Purpose: buildMapLocationPickerUrl supports ShopsView.vue by holding or executing the build map location picker url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const buildMapLocationPickerUrl = (options: { latitude?: string | number; longitude?: string | number } = {}) => {
return mapPickerProvider.value === 'AMAP'
? buildAmapLocationPickerUrl(options)
: buildTencentLocationPickerUrl(options)
}
/**
* Purpose: closeTencentLocationPicker supports ShopsView.vue by holding or executing the close tencent location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeTencentLocationPicker = () => {
mapPickerVisible.value = false
window.removeEventListener('message', handleMapLocationMessage)
}
/**
* Purpose: closeMapLocationPicker supports ShopsView.vue by holding or executing the close map location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeMapLocationPicker = closeTencentLocationPicker
/**
* Purpose: applyTencentLocation supports ShopsView.vue by holding or executing the apply tencent location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyTencentLocation = (data: any) => {
const location = data.loclatlng || data.latlng || data.location
if (!location) return
@@ -1194,6 +1430,10 @@ const applyTencentLocation = (data: any) => {
closeTencentLocationPicker()
}
/**
* Purpose: applyAmapLocation supports ShopsView.vue by holding or executing the apply amap location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyAmapLocation = (data: any) => {
const rawLocation = data.location || data.lnglat || data.position
let longitude = ''
@@ -1227,6 +1467,10 @@ const applyAmapLocation = (data: any) => {
closeTencentLocationPicker()
}
/**
* Purpose: handleMapLocationMessage supports ShopsView.vue by holding or executing the handle map location message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleMapLocationMessage = (event: MessageEvent) => {
const data = event.data || {}
if (!data || typeof data !== 'object') return
@@ -1239,6 +1483,10 @@ const handleMapLocationMessage = (event: MessageEvent) => {
}
}
/**
* Purpose: openMapLocationPicker supports ShopsView.vue by holding or executing the open map location picker page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openMapLocationPicker = async () => {
const response = await adminSystemParameterConfigApi.getMapConfig()
const provider = response?.provider === 'AMAP' ? 'AMAP' : 'TENCENT'
@@ -1258,10 +1506,18 @@ const openMapLocationPicker = async () => {
window.addEventListener('message', handleMapLocationMessage)
}
/**
* Purpose: handleMapPickerFrameLoad supports ShopsView.vue by holding or executing the handle map picker frame load page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleMapPickerFrameLoad = () => {
// 高德/腾讯选点页均通过 postMessage 回传结果,此处保留钩子便于后续接入加载态。
}
/**
* Purpose: useCurrentLocation supports ShopsView.vue by holding or executing the use current location page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const useCurrentLocation = () => {
if (!navigator.geolocation) {
message.warning('当前浏览器不支持定位')
@@ -1937,6 +2193,10 @@ const syncUploadedThemeBackgroundId = (fileId: string) => {
}
}
/**
* Purpose: handleResetTheme supports ShopsView.vue by holding or executing the handle reset theme page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleResetTheme = () => {
Object.assign(formState, {
themePrimaryColor: '',
@@ -1950,6 +2210,10 @@ const handleResetTheme = () => {
syncUploadedThemeBackgroundId('')
}
/**
* Purpose: applyThemeTemplate supports ShopsView.vue by holding or executing the apply theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const applyThemeTemplate = (template: ShopThemeTemplate) => {
Object.assign(formState, {
themePrimaryColor: template.themePrimaryColor,
@@ -1961,16 +2225,28 @@ const applyThemeTemplate = (template: ShopThemeTemplate) => {
message.success(`已应用「${template.name}」配色`)
}
/**
* Purpose: openSaveThemeTemplate supports ShopsView.vue by holding or executing the open save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openSaveThemeTemplate = () => {
themeTemplateName.value = formState.shopName ? `${formState.shopName}主题` : '我的配色模板'
themeTemplateSaveVisible.value = true
}
/**
* Purpose: handleCancelSaveThemeTemplate supports ShopsView.vue by holding or executing the handle cancel save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleCancelSaveThemeTemplate = () => {
themeTemplateSaveVisible.value = false
themeTemplateName.value = ''
}
/**
* Purpose: handleConfirmSaveThemeTemplate supports ShopsView.vue by holding or executing the handle confirm save theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleConfirmSaveThemeTemplate = () => {
const name = themeTemplateName.value.trim()
if (!name) {
@@ -2000,6 +2276,10 @@ const handleConfirmSaveThemeTemplate = () => {
message.success(existedIndex >= 0 ? '已更新同名配色模板' : '已保存配色模板')
}
/**
* Purpose: handleDeleteCustomThemeTemplate supports ShopsView.vue by holding or executing the handle delete custom theme template page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleDeleteCustomThemeTemplate = (id: string) => {
customThemeTemplates.value = customThemeTemplates.value.filter(template => template.id !== id)
persistCustomThemeTemplates()
@@ -164,19 +164,63 @@ import {
SendOutlined
} from '@ant-design/icons-vue'
import SystemMessageCard from '@/components/SystemMessageCard.vue'
/**
* Purpose: SystemMessageCreateRequest supports SystemMessagesView.vue by holding or executing the system message create request page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminFileApi, adminSystemMessageApi, type SystemMessageCreateRequest, type SystemMessageVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: loading supports SystemMessagesView.vue by holding or executing the loading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loading = ref(false)
/**
* Purpose: saving supports SystemMessagesView.vue by holding or executing the saving page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const saving = ref(false)
/**
* Purpose: imageUploading supports SystemMessagesView.vue by holding or executing the image uploading page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageUploading = ref(false)
/**
* Purpose: messages supports SystemMessagesView.vue by holding or executing the messages page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const messages = ref<SystemMessageVO[]>([])
/**
* Purpose: targetOptions supports SystemMessagesView.vue by holding or executing the target options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetOptions = ref({ shops: [] as any[], users: [] as any[] })
/**
* Purpose: popupEnabled supports SystemMessagesView.vue by holding or executing the popup enabled page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const popupEnabled = ref(true)
/**
* Purpose: previewVisible supports SystemMessagesView.vue by holding or executing the preview visible page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewVisible = ref(false)
/**
* Purpose: currentMessage supports SystemMessagesView.vue by holding or executing the current message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentMessage = ref<SystemMessageVO | null>(null)
/**
* Purpose: imagePreviewUrl supports SystemMessagesView.vue by holding or executing the image preview url page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imagePreviewUrl = ref('')
/**
* Purpose: form supports SystemMessagesView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<SystemMessageCreateRequest>({
title: '',
content: '',
@@ -187,6 +231,10 @@ const form = reactive<SystemMessageCreateRequest>({
popupEnabled: 1
})
/**
* Purpose: currentAdminUser supports SystemMessagesView.vue by holding or executing the current admin user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentAdminUser = computed(() => {
try {
const cache = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
@@ -195,21 +243,57 @@ const currentAdminUser = computed(() => {
return null
}
})
/**
* Purpose: isPlatformAdmin supports SystemMessagesView.vue by holding or executing the is platform admin page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isPlatformAdmin = computed(() => Number(currentAdminUser.value?.type) === 4)
/**
* Purpose: targetTypes supports SystemMessagesView.vue by holding or executing the target types page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const targetTypes = computed(() => [
...(isPlatformAdmin.value ? [{ label: '全平台', value: 'PLATFORM_ALL' }] : []),
{ label: isPlatformAdmin.value ? '指定店铺全员' : '本店全员', value: isPlatformAdmin.value ? 'SELECTED_SHOPS' : 'CURRENT_SHOP_ALL' },
{ label: '指定用户', value: 'SELECTED_USERS' }
])
/**
* Purpose: needsShopSelection supports SystemMessagesView.vue by holding or executing the needs shop selection page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const needsShopSelection = computed(() => form.targetType === 'SELECTED_SHOPS' || form.targetType === 'SHOP_ALL')
/**
* Purpose: shopOptions supports SystemMessagesView.vue by holding or executing the shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopOptions = computed(() => targetOptions.value.shops.map(shop => ({ label: shop.shopName, value: shop.id })))
/**
* Purpose: userOptions supports SystemMessagesView.vue by holding or executing the user options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userOptions = computed(() => targetOptions.value.users.map(user => ({
label: `${user.nickname || user.account} ${user.shopName ? `(${user.shopName})` : ''}`,
value: user.id
})))
/**
* Purpose: previewTitle supports SystemMessagesView.vue by holding or executing the preview title page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewTitle = computed(() => form.title.trim() || '消息标题预览')
/**
* Purpose: previewContent supports SystemMessagesView.vue by holding or executing the preview content page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewContent = computed(() => form.content.trim() || (imagePreviewUrl.value ? '' : '这里会显示消息正文。支持纯文本,也可以配合一张图片展示给用户。'))
/**
* Purpose: previewMeta supports SystemMessagesView.vue by holding or executing the preview meta page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewMeta = computed(() => `系统消息 · ${popupEnabled.value ? '弹窗预览' : '列表预览'}`)
/**
* Purpose: currentMessageMeta supports SystemMessagesView.vue by holding or executing the current message meta page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentMessageMeta = computed(() => {
if (!currentMessage.value) return ''
return [
@@ -218,6 +302,10 @@ const currentMessageMeta = computed(() => {
].filter(Boolean).join(' · ')
})
/**
* Purpose: columns supports SystemMessagesView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '图片', key: 'image', width: 84 },
@@ -229,6 +317,10 @@ const columns = [
{ title: '操作', key: 'action', width: 120 }
]
/**
* Purpose: syncDefaultTargetType supports SystemMessagesView.vue by holding or executing the sync default target type page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const syncDefaultTargetType = () => {
if (isPlatformAdmin.value && form.targetType === 'CURRENT_SHOP_ALL') {
form.targetType = 'PLATFORM_ALL'
@@ -238,6 +330,10 @@ const syncDefaultTargetType = () => {
}
}
/**
* Purpose: loadData supports SystemMessagesView.vue by holding or executing the load data page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadData = async () => {
loading.value = true
try {
@@ -255,16 +351,28 @@ const loadData = async () => {
}
}
/**
* Purpose: handleTargetTypeChange supports SystemMessagesView.vue by holding or executing the handle target type change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleTargetTypeChange = () => {
form.shopIds = []
form.userIds = []
}
/**
* Purpose: removeImage supports SystemMessagesView.vue by holding or executing the remove image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const removeImage = () => {
form.imageFileId = undefined
imagePreviewUrl.value = ''
}
/**
* Purpose: resetForm supports SystemMessagesView.vue by holding or executing the reset form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetForm = () => {
form.title = ''
form.content = ''
@@ -276,6 +384,10 @@ const resetForm = () => {
imagePreviewUrl.value = ''
}
/**
* Purpose: handleImageUpload supports SystemMessagesView.vue by holding or executing the handle image upload page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleImageUpload = async (options: any) => {
const file = options.file as File
if (!file?.type?.startsWith('image/')) {
@@ -302,6 +414,10 @@ const handleImageUpload = async (options: any) => {
}
}
/**
* Purpose: handlePublish supports SystemMessagesView.vue by holding or executing the handle publish page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handlePublish = async () => {
if (!form.title.trim()) return message.warning('请填写消息标题')
if (!form.content.trim() && !form.imageFileId) return message.warning('请填写消息内容或上传消息图片')
@@ -321,12 +437,20 @@ const handlePublish = async () => {
}
}
/**
* Purpose: handleRevoke supports SystemMessagesView.vue by holding or executing the handle revoke page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleRevoke = async (id: IdType) => {
await adminSystemMessageApi.revokeMessage(id)
message.success('消息已撤回')
await loadData()
}
/**
* Purpose: previewMessage supports SystemMessagesView.vue by holding or executing the preview message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const previewMessage = (record: SystemMessageVO) => {
currentMessage.value = record
previewVisible.value = true
@@ -243,6 +243,10 @@ import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import DraftActions from '@/components/DraftActions.vue'
/**
* Purpose: Shop supports TagsView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminTagApi, adminShopApi, type Shop } from '@/api/admin'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import type { IdType } from '@/utils/id'
@@ -282,8 +286,20 @@ const modalLoading = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: formRef supports TagsView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: currentTag supports TagsView.vue by holding or executing the current tag page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentTag = ref<any>(null)
/**
* Purpose: draftSavedAt supports TagsView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
// 查看标签相关状态
@@ -295,11 +311,23 @@ const viewFormState = reactive({
borderColor: '#E5E5E5'
})
/**
* Purpose: tagList supports TagsView.vue by holding or executing the tag list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const tagList = ref<any[]>([])
/**
* Purpose: shops supports TagsView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/** loadingShops is a reactive state variable used by the template and event handlers. */
const loadingShops = ref(false)
/**
* Purpose: pagination supports TagsView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -309,6 +337,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports TagsView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
tagName: '',
shopId: undefined as number | undefined,
@@ -357,11 +389,19 @@ const handleClearDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports TagsView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
tagName: [{ required: true, message: '请输入标签名称', trigger: 'blur' }],
shopId: [{ required: true, message: '请选择所属店铺', trigger: 'change' }]
} as any
/**
* Purpose: columns supports TagsView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标签名称', dataIndex: 'tagName', key: 'tagName' },
{ title: '所属店铺', key: 'shop', width: 150 },
@@ -497,6 +497,10 @@ import DraftActions from '@/components/DraftActions.vue'
import { DEFAULT_AVATAR } from '@/constants'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
/**
* Purpose: AvailabilityCheckResponse supports UsersView.vue by holding or executing the availability check response page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { userApi, type AvailabilityCheckResponse } from '@/api/user'
import {
adminShopApi,
@@ -552,19 +556,75 @@ const viewModalVisible = ref(false)
const isEdit = ref(false)
/** searchText is a reactive state variable used by the template and event handlers. */
const searchText = ref('')
/**
* Purpose: shopFilter supports UsersView.vue by holding or executing the shop filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopFilter = ref<string | undefined>()
/**
* Purpose: typeFilter supports UsersView.vue by holding or executing the type filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const typeFilter = ref<number | undefined>()
/**
* Purpose: vipLevelFilter supports UsersView.vue by holding or executing the vip level filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelFilter = ref<string | undefined>()
/**
* Purpose: statusFilter supports UsersView.vue by holding or executing the status filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const statusFilter = ref<number | undefined>()
/**
* Purpose: createdRange supports UsersView.vue by holding or executing the created range page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
/**
* Purpose: hasPhoneFilter supports UsersView.vue by holding or executing the has phone filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasPhoneFilter = ref<'true' | 'false' | undefined>()
/**
* Purpose: hasOrderFilter supports UsersView.vue by holding or executing the has order filter page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const hasOrderFilter = ref<'true' | 'false' | undefined>()
/**
* Purpose: formRef supports UsersView.vue by holding or executing the form ref page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRef = ref<FormInstance>()
/**
* Purpose: userList supports UsersView.vue by holding or executing the user list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const userList = ref<UserVO[]>([])
/**
* Purpose: shopList supports UsersView.vue by holding or executing the shop list page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopList = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports UsersView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/**
* Purpose: currentUser supports UsersView.vue by holding or executing the current user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const currentUser = ref<UserVO | null>(null)
/**
* Purpose: viewRecord supports UsersView.vue by holding or executing the view record page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const viewRecord = ref<UserVO | null>(null)
/**
* Purpose: draftSavedAt supports UsersView.vue by holding or executing the draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const draftSavedAt = ref<number | null>(null)
/** assetModalVisible is a reactive state variable used by the template and event handlers. */
@@ -573,10 +633,30 @@ const assetModalVisible = ref(false)
const assetLoading = ref(false)
/** assetSaving is a reactive state variable used by the template and event handlers. */
const assetSaving = ref(false)
/**
* Purpose: assetTargetUser supports UsersView.vue by holding or executing the asset target user page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assetTargetUser = ref<UserVO | null>(null)
/**
* Purpose: assetData supports UsersView.vue by holding or executing the asset data page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const assetData = ref<UserAssetVO | null>(null)
/**
* Purpose: balanceHistory supports UsersView.vue by holding or executing the balance history page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceHistory = ref<UserBalanceHistoryItem[]>([])
/**
* Purpose: balanceDraftSavedAt supports UsersView.vue by holding or executing the balance draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceDraftSavedAt = ref<number | null>(null)
/**
* Purpose: vipDraftSavedAt supports UsersView.vue by holding or executing the vip draft saved at page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipDraftSavedAt = ref<number | null>(null)
/** canOpenAssetPanel is a reactive state variable used by the template and event handlers. */
@@ -620,8 +700,16 @@ const canDeleteUser = computed(() =>
const canUnbindUser = computed(() =>
hasPermission('user:unbind')
)
/**
* Purpose: PHONE_REGEX supports UsersView.vue by holding or executing the phone regex page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const PHONE_REGEX = /^1[3-9]\d{9}$/
/**
* Purpose: pagination supports UsersView.vue by holding or executing the pagination page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pagination = reactive({
current: 1,
pageSize: 10,
@@ -631,6 +719,10 @@ const pagination = reactive({
showTotal: (total: number) => `共 ${total} 条`
})
/**
* Purpose: formState supports UsersView.vue by holding or executing the form state page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formState = reactive({
account: '',
nickname: '',
@@ -681,6 +773,10 @@ const validatePhoneUniqueness = async (value: string) => {
}
}
/**
* Purpose: balanceForm supports UsersView.vue by holding or executing the balance form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const balanceForm = reactive<AdminUserBalanceChangeRequest>({
changeScene: 'RECHARGE',
amount: undefined as unknown as number,
@@ -689,6 +785,10 @@ const balanceForm = reactive<AdminUserBalanceChangeRequest>({
remark: ''
})
/**
* Purpose: vipForm supports UsersView.vue by holding or executing the vip form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipForm = reactive<AdminUserVipOverrideRequest>({
vipLevel: '普通',
remark: ''
@@ -773,6 +873,10 @@ const handleClearVipDraft = (showMessage = true) => {
}
}
/**
* Purpose: formRules supports UsersView.vue by holding or executing the form rules page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formRules = {
account: [
{ required: true, message: '请输入账号', trigger: 'blur' },
@@ -808,6 +912,10 @@ const formRules = {
type: [{ required: true, message: '请选择用户类型', trigger: 'change' }]
} as any
/**
* Purpose: columns supports UsersView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '头像', key: 'avatar', width: 80 },
{ title: '账号', dataIndex: 'account', key: 'account' },
@@ -821,6 +929,10 @@ const columns = [
{ title: '操作', key: 'actions', width: 280, fixed: 'right' as const }
]
/**
* Purpose: historyColumns supports UsersView.vue by holding or executing the history columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const historyColumns = [
{ title: '场景', key: 'changeScene', width: 120 },
{ title: '金额', key: 'amount', width: 110 },
@@ -1032,6 +1144,10 @@ const fetchUserList = async () => {
}
}
/**
* Purpose: resetFilters supports UsersView.vue by holding or executing the reset filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resetFilters = () => {
searchText.value = ''
shopFilter.value = currentUserType.value !== 4 ? normalizeShopId(currentUserInfo?.shopId) : undefined
@@ -1465,6 +1581,10 @@ const handleVipRecalculate = () => {
})
}
/**
* Purpose: fetchVipLevelOptions supports UsersView.vue by holding or executing the fetch vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const fetchVipLevelOptions = async () => {
try {
const levels = await adminVipRechargePlanApi.listVipLevelOptions(currentUserInfo?.shopId)
@@ -60,6 +60,10 @@
*/
import { onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
/**
* Purpose: Shop supports VipRechargePlansView.vue by holding or executing the shop page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { adminShopApi, adminVipRechargePlanApi, type Shop, type VipRechargePlanVO } from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
@@ -68,12 +72,36 @@ const loading = ref(false)
const saving = ref(false)
/** formOpen is a reactive state variable used by the template and event handlers. */
const formOpen = ref(false)
/**
* Purpose: editingId supports VipRechargePlansView.vue by holding or executing the editing id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const editingId = ref<any>()
/**
* Purpose: plans supports VipRechargePlansView.vue by holding or executing the plans page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const plans = ref<VipRechargePlanVO[]>([])
/**
* Purpose: shops supports VipRechargePlansView.vue by holding or executing the shops page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shops = ref<Shop[]>([])
/**
* Purpose: vipLevelOptions supports VipRechargePlansView.vue by holding or executing the vip level options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const vipLevelOptions = ref<string[]>(['普通', '青铜', '白银', '黄金'])
/**
* Purpose: form supports VipRechargePlansView.vue by holding or executing the form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const form = reactive<any>({ shopId: undefined, title: '', rechargeAmount: 0, giftAmount: 0, vipLevel: '', description: '', sortOrder: 0, status: 1 })
/**
* Purpose: columns supports VipRechargePlansView.vue by holding or executing the columns page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '店铺', dataIndex: 'shopName', key: 'shopName' },
@@ -84,6 +112,10 @@ const columns = [
{ title: '操作', key: 'action', width: 100 }
]
/**
* Purpose: shopOptions supports VipRechargePlansView.vue by holding or executing the shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const shopOptions = ref<Array<{ label: string; value: any }>>([])
/** money is a local helper used by this page script. */
const money = (value: number | string) => Number(value || 0).toFixed(2)
@@ -1,8 +1,16 @@
/**
* Purpose: AdminCachedUserInfo supports admin-helpers.ts by holding or executing the admin cached user info page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { loadCachedAdminUserInfo, isBootstrapAdminUser, type AdminCachedUserInfo } from '@/utils/admin-session'
export { loadCachedAdminUserInfo, isBootstrapAdminUser }
export type { AdminCachedUserInfo }
/**
* Purpose: getAdminRoleLabel supports admin-helpers.ts by holding or executing the get admin role label page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminRoleLabel = (type?: number) => {
switch (type) {
case 4:
@@ -16,6 +24,10 @@ export const getAdminRoleLabel = (type?: number) => {
}
}
/**
* Purpose: getAdminShopOptions supports admin-helpers.ts by holding or executing the get admin shop options page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminShopOptions = (userInfo?: AdminCachedUserInfo | null) => {
const ids = userInfo?.shopIds || []
const names = userInfo?.shopNames || []
@@ -25,5 +37,9 @@ export const getAdminShopOptions = (userInfo?: AdminCachedUserInfo | null) => {
}))
}
/**
* Purpose: getAdminCurrentShopName supports admin-helpers.ts by holding or executing the get admin current shop name page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const getAdminCurrentShopName = (userInfo?: AdminCachedUserInfo | null) =>
userInfo?.shopName || (isBootstrapAdminUser(userInfo) ? '平台总览模式' : '游客模式')