完成Salon小程序合规整改
This commit is contained in:
@@ -2001,5 +2001,74 @@ export const adminWorkbenchRegistrationApi = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface AccountClosureRequestVO {
|
||||
id: IdType
|
||||
userId: IdType
|
||||
nickname: string
|
||||
userType?: number
|
||||
shopIds?: IdType[]
|
||||
shopNames?: string[]
|
||||
status: string
|
||||
requestedAt?: string
|
||||
processingTargetText?: string
|
||||
processedAt?: string
|
||||
reviewerNote?: string
|
||||
}
|
||||
|
||||
export interface ClosureSuccessorManagerVO {
|
||||
id: IdType
|
||||
nickname?: string
|
||||
shopId?: IdType
|
||||
}
|
||||
|
||||
export interface ContentModerationRecordVO {
|
||||
id: IdType
|
||||
contentType: string
|
||||
businessId?: IdType
|
||||
userId?: IdType
|
||||
status: string
|
||||
provider: string
|
||||
resultCode?: string
|
||||
reason?: string
|
||||
payloadJson?: string
|
||||
attemptCount?: number
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface PhoneBackfillReportVO {
|
||||
dryRun: boolean
|
||||
userRowsToUpdate: number
|
||||
orderRowsToUpdate: number
|
||||
userRowsUpdated: number
|
||||
orderRowsUpdated: number
|
||||
accountConflictRows: number
|
||||
phoneConflictRows: number
|
||||
conflictingUserIds: IdType[]
|
||||
}
|
||||
|
||||
export const adminPrivacyComplianceApi = {
|
||||
listClosures() {
|
||||
return adminApi.get<AccountClosureRequestVO[]>('/privacy/account-closure/pending') as unknown as Promise<AccountClosureRequestVO[]>
|
||||
},
|
||||
listSuccessorManagers() {
|
||||
return adminApi.get<ClosureSuccessorManagerVO[]>('/privacy/account-closure/successor-managers') as unknown as Promise<ClosureSuccessorManagerVO[]>
|
||||
},
|
||||
processClosure(id: IdType, data: { decision: string; successorManagerId?: IdType; archiveShopIds?: IdType[]; note?: string }) {
|
||||
return adminApi.post<boolean>(`/privacy/account-closure/${id}/process`, data)
|
||||
},
|
||||
listModeration() {
|
||||
return adminApi.get<ContentModerationRecordVO[]>('/privacy/content-moderation/pending') as unknown as Promise<ContentModerationRecordVO[]>
|
||||
},
|
||||
reviewContent(id: IdType, data: { approved: boolean; reason: string }) {
|
||||
return adminApi.post<boolean>(`/privacy/content-moderation/${id}/review`, data)
|
||||
},
|
||||
phoneBackfillReport() {
|
||||
return adminApi.get<PhoneBackfillReportVO>('/privacy/phone-backfill/report') as unknown as Promise<PhoneBackfillReportVO>
|
||||
},
|
||||
runPhoneBackfill() {
|
||||
return adminApi.post<PhoneBackfillReportVO>('/privacy/phone-backfill/run') as unknown as Promise<PhoneBackfillReportVO>
|
||||
}
|
||||
}
|
||||
|
||||
export { adminApi }
|
||||
export default adminApi
|
||||
|
||||
@@ -155,15 +155,6 @@ export interface GrowthSummaryVO {
|
||||
reviewCount?: number
|
||||
}
|
||||
|
||||
export const paymentApi = {
|
||||
prepareOrderPayment: async (orderId: IdType): Promise<PaymentOrderVO> => {
|
||||
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/prepare`) as unknown as PaymentOrderVO
|
||||
},
|
||||
mockSuccess: async (orderId: IdType): Promise<PaymentOrderVO> => {
|
||||
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/mock-success`) as unknown as PaymentOrderVO
|
||||
}
|
||||
}
|
||||
|
||||
export const afterSaleApi = {
|
||||
apply: async (data: AfterSaleApplyRequest): Promise<AfterSaleVO> => {
|
||||
return await api.post<AfterSaleVO>('/after-sale/apply', data) as unknown as AfterSaleVO
|
||||
|
||||
@@ -202,7 +202,6 @@ export interface InviteCodeVO {
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface UpdatePhoneRequest {
|
||||
oldPhone: string
|
||||
newPhone: string
|
||||
verificationCode: string
|
||||
}
|
||||
@@ -388,6 +387,9 @@ export const userApi = {
|
||||
sendVerificationCode: (data: { phone: string; sceneCode?: string }) => {
|
||||
return api.post('/user/send-verification-code', data)
|
||||
},
|
||||
sendCurrentPasswordVerificationCode: () => {
|
||||
return api.post('/user/send-current-password-code')
|
||||
},
|
||||
/**
|
||||
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
@@ -464,6 +466,14 @@ export const userApi = {
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
*/
|
||||
deactivateAccount: () => {
|
||||
return api.delete('/user/deactivate')
|
||||
}
|
||||
return api.post('/user/account-closure', {})
|
||||
},
|
||||
getAccountClosure: async () => await api.get('/user/account-closure/me') as unknown as Promise<{
|
||||
id: IdType
|
||||
status: string
|
||||
requestedAt?: string
|
||||
processingTargetText?: string
|
||||
reviewerNote?: string
|
||||
} | null>,
|
||||
withdrawAccountClosure: () => api.delete('/user/account-closure/me')
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ export const adminNavigationItems: AdminNavigationItem[] = [
|
||||
{ path: ADMIN_HOME_PATH, iconKey: 'home', label: '首页', permissionCode: '' },
|
||||
{ path: '/admin/users', iconKey: 'user', label: '店长账号', permissionCode: 'user:view' },
|
||||
{ path: '/admin/registrations', iconKey: 'team', label: '注册审核', permissionCode: 'user:view' },
|
||||
{ path: '/admin/privacy', iconKey: 'security', label: '隐私与内容复核', permissionCode: 'legal_agreement:manage' },
|
||||
{ path: '/admin/shops', iconKey: 'home', label: '店铺管理', permissionCode: 'shop:view' },
|
||||
{ path: '/admin/settings', iconKey: 'tool', label: '系统设置', permissionCode: 'messagehub:config:manage' },
|
||||
{ path: '/admin/profile', iconKey: 'user', label: '个人设置', permissionCode: '' }
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
|
||||
const pageNames = [
|
||||
['', 'HomeView', 'admin', undefined],
|
||||
['users', 'UsersView', 'admin-users', 'user:view'], ['registrations', 'WorkbenchRegistrationView', 'admin-registrations', 'user:view'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
|
||||
['users', 'UsersView', 'admin-users', 'user:view'], ['registrations', 'WorkbenchRegistrationView', 'admin-registrations', 'user:view'], ['privacy', 'PrivacyComplianceView', 'admin-privacy', 'legal_agreement:manage'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
|
||||
['profile', 'ProfileView', 'admin-profile', undefined], ['settings', 'SystemSettingsView', 'admin-settings', 'messagehub:config:manage']
|
||||
] as const
|
||||
|
||||
|
||||
@@ -20,16 +20,6 @@ const HEADER_SIGNATURE = 'X-Signature'
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const HEADER_SIGNATURE_VERSION = 'X-Sign-Version'
|
||||
/**
|
||||
* Purpose: DEVICE_ID_HEADER supports request-signature.ts by holding or executing the device id header page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const DEVICE_ID_HEADER = 'X-Device-Id'
|
||||
/**
|
||||
* Purpose: DEVICE_ID_STORAGE_KEY supports request-signature.ts by holding or executing the device id 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 DEVICE_ID_STORAGE_KEY = 'jayucloud-salon-device-id'
|
||||
/**
|
||||
* Purpose: SIGNATURE_VERSION supports request-signature.ts by holding or executing the signature version page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -245,20 +235,6 @@ function randomNonce() {
|
||||
* Purpose: getDeviceId supports request-signature.ts by holding or executing the get device id page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export function getDeviceId() {
|
||||
try {
|
||||
const stored = localStorage.getItem(DEVICE_ID_STORAGE_KEY)
|
||||
if (stored) {
|
||||
return stored
|
||||
}
|
||||
const next = `web-${randomNonce()}`
|
||||
localStorage.setItem(DEVICE_ID_STORAGE_KEY, next)
|
||||
return next
|
||||
} catch {
|
||||
return `web-${randomNonce()}`
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setHeader supports request-signature.ts by holding or executing the set header page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -448,8 +424,6 @@ export async function attachRequestSignature(
|
||||
accessToken?: string | null,
|
||||
options: RequestSignatureOptions = {}
|
||||
) {
|
||||
setHeader(config, DEVICE_ID_HEADER, getDeviceId())
|
||||
|
||||
const method = String(config.method || 'GET').toUpperCase()
|
||||
if (!accessToken || options.authFree || isSafeMethod(method)) {
|
||||
return config
|
||||
|
||||
@@ -353,6 +353,7 @@ const handleClearChangePasswordDraft = (showMessage = true) => {
|
||||
// 倒计时
|
||||
/** countdown is a reactive state variable used by the template and event handlers. */
|
||||
const countdown = ref(0)
|
||||
const closureRequest = ref<{ id: string | number; status: string; requestedAt?: string; processingTargetText?: string; reviewerNote?: string } | null>(null)
|
||||
|
||||
// 账号设置选项
|
||||
/** accountSettings is a reactive state variable used by the template and event handlers. */
|
||||
@@ -421,7 +422,14 @@ const updateAccountSettings = () => {
|
||||
key: 'deactivateAccount',
|
||||
title: '注销账号',
|
||||
icon: LockOutlined,
|
||||
bgColor: '#fff1f0'
|
||||
bgColor: '#fff1f0',
|
||||
desc: closureRequest.value?.status === 'PENDING'
|
||||
? '申请处理中,点击查看或撤回'
|
||||
: closureRequest.value?.status === 'REJECTED'
|
||||
? `上次申请未通过:${closureRequest.value.reviewerNote || '可重新申请'}`
|
||||
: closureRequest.value?.status === 'APPROVED'
|
||||
? '资料清理已完成'
|
||||
: '申请注销账号,处理前可撤回'
|
||||
})
|
||||
|
||||
accountSettings.value = settings
|
||||
@@ -431,8 +439,12 @@ const updateAccountSettings = () => {
|
||||
/** fetchUserInfo is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const fetchUserInfo = async () => {
|
||||
try {
|
||||
const response = await userApi.getUserInfo() as any
|
||||
const [response, closure] = await Promise.all([
|
||||
userApi.getUserInfo() as Promise<any>,
|
||||
userApi.getAccountClosure().catch(() => null)
|
||||
])
|
||||
userInfo.value = response
|
||||
closureRequest.value = closure || null
|
||||
// 检查是否绑定手机号
|
||||
hasPhone.value = !!userInfo.value.phone
|
||||
// 检查是否设置密码(通过localStorage中的标识)
|
||||
@@ -546,18 +558,8 @@ const handleSendChangePasswordVerificationCode = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
const phone = userInfo.value.phone
|
||||
const phoneRegex = /^1[3-9]\d{9}$/
|
||||
if (!phoneRegex.test(phone)) {
|
||||
message.error('手机号格式不正确')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await runWithGlobalLoading(() => userApi.sendVerificationCode({
|
||||
phone,
|
||||
sceneCode: 'USER_CHANGE_PASSWORD_SMS_CODE'
|
||||
}))
|
||||
await runWithGlobalLoading(() => userApi.sendCurrentPasswordVerificationCode())
|
||||
message.success('验证码发送成功')
|
||||
startCountdown()
|
||||
} catch (error) {
|
||||
@@ -626,7 +628,6 @@ const handleChangePhoneSubmit = async () => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await userApi.updatePhone({
|
||||
oldPhone: userInfo.value.phone!,
|
||||
newPhone: changePhoneForm.newPhone,
|
||||
verificationCode: changePhoneForm.verificationCode
|
||||
})
|
||||
@@ -697,34 +698,30 @@ const handleChangePasswordCancel = () => {
|
||||
// 处理注销账号
|
||||
/** handleDeactivateAccount is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const handleDeactivateAccount = async () => {
|
||||
const pending = closureRequest.value?.status === 'PENDING'
|
||||
Modal.confirm({
|
||||
title: '确认注销账号',
|
||||
content: '注销账号后,您的所有数据将被删除且无法恢复。确定要注销账号吗?',
|
||||
okText: '确认注销',
|
||||
okType: 'danger',
|
||||
title: pending ? '撤回注销申请' : '申请注销账号',
|
||||
content: pending
|
||||
? '申请仍在处理中。确定撤回后,账号将继续保持可用。'
|
||||
: '提交后由管理人员处理。完成后会清理账号资料,必要业务记录会匿名化保留;处理前可在此撤回。目标处理期限为15个工作日。',
|
||||
okText: pending ? '撤回申请' : '提交申请',
|
||||
okType: pending ? 'default' : 'danger',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
await runWithGlobalLoading(async () => {
|
||||
try {
|
||||
await userApi.deactivateAccount()
|
||||
message.success('账号注销成功')
|
||||
if (pending) {
|
||||
await userApi.withdrawAccountClosure()
|
||||
message.success('注销申请已撤回')
|
||||
} else {
|
||||
await userApi.deactivateAccount()
|
||||
message.success('注销申请已提交')
|
||||
}
|
||||
closureRequest.value = await userApi.getAccountClosure() || null
|
||||
updateAccountSettings()
|
||||
} catch (error) {
|
||||
console.error('注销账号失败:', error)
|
||||
message.error('注销账号失败')
|
||||
} finally {
|
||||
// 无论成功或失败,都清除本地存储的用户信息
|
||||
localStorage.removeItem('accessToken')
|
||||
localStorage.removeItem('refreshToken')
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('adminAccessToken')
|
||||
localStorage.removeItem('adminRefreshToken')
|
||||
localStorage.removeItem('adminUserInfo')
|
||||
localStorage.removeItem('needSetPassword')
|
||||
localStorage.removeItem('userPermissions')
|
||||
sessionStorage.removeItem('accessToken')
|
||||
sessionStorage.removeItem('adminAccessToken')
|
||||
// 跳转到登录页
|
||||
router.push('/')
|
||||
console.error('处理注销申请失败:', error)
|
||||
message.error(error instanceof Error ? error.message : '处理注销申请失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { LeftOutlined } from '@ant-design/icons-vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { afterSaleApi, orderApi, paymentApi } from '../api/order'
|
||||
import { afterSaleApi, orderApi } from '../api/order'
|
||||
import type { AfterSaleVO, OrderArtistChangeRequestVO, OrderArtistReviewVO } from '../api/order'
|
||||
import { userApi, type ContactInfoVO } from '@/api/user'
|
||||
import type { IdType } from '@/utils/id'
|
||||
@@ -35,10 +35,7 @@ const formatDateTime = (value?: string) => value ? String(value).replace('T', '
|
||||
const isQuoteStatus = (status?: unknown) => Number(status) === 0
|
||||
const isQuoteConfirming = computed(() => isQuoteStatus(order.value?.status))
|
||||
const statusClass = (status?: number) => isQuoteStatus(status) ? 'quote' : status === 2 ? 'done' : status === 3 ? 'cancelled' : status === 4 ? 'in-service' : 'pending'
|
||||
const isOrderPaid = (target: any) => String(target?.paymentStatus || '').toUpperCase() === 'PAID'
|
||||
const canPreparePayment = computed(() => !isQuoteConfirming.value && Number(order.value?.status) === 1 && !isOrderPaid(order.value))
|
||||
const canMockPay = computed(() => !isQuoteConfirming.value && Number(order.value?.status) === 1 && String(order.value?.paymentStatus || '').toUpperCase() === 'PAYING')
|
||||
const canApplyAfterSale = computed(() => !isQuoteConfirming.value && (Number(order.value?.status) === 2 || isOrderPaid(order.value)))
|
||||
const canApplyAfterSale = computed(() => !isQuoteConfirming.value && Number(order.value?.status) === 2)
|
||||
|
||||
const timeline = computed(() => {
|
||||
const current = order.value || {}
|
||||
@@ -197,24 +194,6 @@ const confirmQuote = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const preparePayment = async () => {
|
||||
if (!order.value?.id) return
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.prepareOrderPayment(order.value.id)
|
||||
await loadOrder()
|
||||
})
|
||||
message.success('支付单已准备')
|
||||
}
|
||||
|
||||
const mockPay = async () => {
|
||||
if (!order.value?.id) return
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.mockSuccess(order.value.id)
|
||||
await loadOrder()
|
||||
})
|
||||
message.success('模拟支付成功')
|
||||
}
|
||||
|
||||
const cancelOrder = () => {
|
||||
if (!order.value?.id) return
|
||||
Modal.confirm({
|
||||
@@ -357,8 +336,6 @@ onMounted(loadOrder)
|
||||
</section>
|
||||
|
||||
<section class="action-bar">
|
||||
<a-button v-if="canPreparePayment" @click="preparePayment">准备支付</a-button>
|
||||
<a-button v-if="canMockPay" type="primary" @click="mockPay">模拟支付</a-button>
|
||||
<a-button v-if="canApplyAfterSale" @click="router.push({ path: '/after-sale/apply', query: { orderId } })">申请售后</a-button>
|
||||
<a-button v-if="order.status === 1" danger @click="cancelOrder">取消订单</a-button>
|
||||
</section>
|
||||
|
||||
@@ -200,8 +200,6 @@
|
||||
|
||||
<div class="order-card__actions">
|
||||
<button v-if="orderNeedsReview(order)" type="button" class="order-action order-action--primary" @click="openReviewModal(firstPendingReview(order))">去评价</button>
|
||||
<button v-if="canPreparePayment(order)" type="button" class="order-action order-action--primary" @click="preparePayment(order)">立即支付</button>
|
||||
<button v-if="canMockPay(order)" type="button" class="order-action order-action--primary" @click="mockPay(order)">立即支付</button>
|
||||
<button type="button" class="order-action" @click="router.push(`/orders/${order.id}`)">查看详情</button>
|
||||
<button v-if="canApplyAfterSale(order)" type="button" class="order-action" @click="openAfterSaleModal(order)">申请售后</button>
|
||||
<button v-if="hasRebookableItems(order)" type="button" class="order-action order-action--primary" @click="rebookOrder(order)">复刻同款</button>
|
||||
@@ -301,7 +299,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { LeftOutlined, ShoppingOutlined, UserOutlined } from '@ant-design/icons-vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { cartApi } from '../api/cart'
|
||||
import { afterSaleApi, orderApi, paymentApi } from '../api/order'
|
||||
import { afterSaleApi, orderApi } from '../api/order'
|
||||
import type { OrderArtistChangeRequestVO, OrderArtistReviewVO } from '../api/order'
|
||||
import { userApi } from '@/api/user'
|
||||
import type { IdType } from '@/utils/id'
|
||||
@@ -337,8 +335,8 @@ const orderReviews = ref<Record<string, OrderArtistReviewVO[]>>({})
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const pendingChangeRequests = ref<OrderArtistChangeRequestVO[]>([])
|
||||
type OrderStatusFilter = 'all' | 'priceConfirming' | 'pendingPayment' | 'active' | 'pendingReview' | 'completed'
|
||||
const ORDER_STATUS_FILTER_VALUES: OrderStatusFilter[] = ['all', 'priceConfirming', 'pendingPayment', 'active', 'pendingReview', 'completed']
|
||||
type OrderStatusFilter = 'all' | 'priceConfirming' | 'pendingService' | 'active' | 'pendingReview' | 'completed'
|
||||
const ORDER_STATUS_FILTER_VALUES: OrderStatusFilter[] = ['all', 'priceConfirming', 'pendingService', 'active', 'pendingReview', 'completed']
|
||||
const normalizeRouteStatusFilter = (value: unknown): OrderStatusFilter | undefined => {
|
||||
const raw = Array.isArray(value) ? value[0] : value
|
||||
return ORDER_STATUS_FILTER_VALUES.includes(raw as OrderStatusFilter) ? raw as OrderStatusFilter : undefined
|
||||
@@ -421,7 +419,7 @@ const statusTabs = computed(() => {
|
||||
const tabs: Array<{ label: string, value: OrderStatusFilter }> = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '确认价格中', value: 'priceConfirming' },
|
||||
{ label: '待支付', value: 'pendingPayment' },
|
||||
{ label: '待服务', value: 'pendingService' },
|
||||
{ label: '预约中', value: 'active' },
|
||||
{ label: '待评价', value: 'pendingReview' },
|
||||
{ label: '已完成', value: 'completed' }
|
||||
@@ -467,12 +465,7 @@ const focusedOrderItemId = ref('')
|
||||
const focusedReviewId = ref('')
|
||||
|
||||
const isQuoteConfirming = (order: any) => Number(order?.status) === 0
|
||||
const orderPaymentStatus = (order: any) => String(order.paymentStatus || order.payStatus || '').toUpperCase()
|
||||
const isOrderPaid = (order: any) => orderPaymentStatus(order) === 'PAID'
|
||||
const orderNeedsPayment = (order: any) => Number(order.status) === 1 && !isOrderPaid(order)
|
||||
const canPreparePayment = (order: any) => orderNeedsPayment(order) && orderPaymentStatus(order) !== 'PAYING'
|
||||
const canMockPay = (order: any) => Number(order.status) === 1 && orderPaymentStatus(order) === 'PAYING'
|
||||
const canApplyAfterSale = (order: any) => !isQuoteConfirming(order) && (Number(order.status) === 2 || isOrderPaid(order))
|
||||
const canApplyAfterSale = (order: any) => !isQuoteConfirming(order) && Number(order.status) === 2
|
||||
|
||||
/**
|
||||
* Purpose: sameId supports OrderView.vue by holding or executing the same id page or API role.
|
||||
@@ -554,14 +547,12 @@ const orderNeedsReview = (order: any) => {
|
||||
return Number(order.status) === 2 && Boolean(firstPendingReview(order))
|
||||
}
|
||||
|
||||
const orderIsActive = (order: any) => {
|
||||
return Number(order.status) === 1 && !orderNeedsPayment(order)
|
||||
}
|
||||
const orderIsActive = (order: any) => Number(order.status) === 1
|
||||
|
||||
const orderMatchesStatus = (order: any, status: OrderStatusFilter) => {
|
||||
if (status === 'all') return true
|
||||
if (status === 'priceConfirming') return isQuoteConfirming(order)
|
||||
if (status === 'pendingPayment') return orderNeedsPayment(order)
|
||||
if (status === 'pendingService') return Number(order.status) === 1
|
||||
if (status === 'active') return orderIsActive(order)
|
||||
if (status === 'pendingReview') return orderNeedsReview(order)
|
||||
if (status === 'completed') return Number(order.status) === 2
|
||||
@@ -571,9 +562,8 @@ const orderMatchesStatus = (order: any, status: OrderStatusFilter) => {
|
||||
const orderDisplayStatus = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return order.statusText || '确认价格中'
|
||||
if (Number(order.status) === 3) return '已取消'
|
||||
if (orderNeedsPayment(order)) return '待支付'
|
||||
if (orderNeedsReview(order)) return '待评价'
|
||||
if (Number(order.status) === 1) return order.statusText || '预约中'
|
||||
if (Number(order.status) === 1) return order.statusText || '待服务'
|
||||
if (Number(order.status) === 2) return '已完成'
|
||||
return order.statusText || '订单状态'
|
||||
}
|
||||
@@ -581,7 +571,6 @@ const orderDisplayStatus = (order: any) => {
|
||||
const orderStatusClass = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return 'price-confirming'
|
||||
if (Number(order.status) === 3) return 'cancelled'
|
||||
if (orderNeedsPayment(order)) return 'pending-payment'
|
||||
if (orderNeedsReview(order)) return 'pending-review'
|
||||
if (Number(order.status) === 1) return 'active'
|
||||
if (Number(order.status) === 2) return 'completed'
|
||||
@@ -608,7 +597,7 @@ const orderTimeText = (order: any) => {
|
||||
|
||||
const orderAmountLabel = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return '参考金额'
|
||||
return orderNeedsPayment(order) ? '订单金额' : '实付金额'
|
||||
return Number(order.status) === 0 ? '参考金额' : '订单金额'
|
||||
}
|
||||
|
||||
const orderExtensionItems = (order: any) => {
|
||||
@@ -767,30 +756,6 @@ const resetFilters = () => {
|
||||
filters.maxAmount = undefined
|
||||
}
|
||||
|
||||
const preparePayment = async (order: any) => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.prepareOrderPayment(order.id)
|
||||
await loadOrders()
|
||||
})
|
||||
message.success('支付已准备,请继续完成支付')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '支付准备失败')
|
||||
}
|
||||
}
|
||||
|
||||
const mockPay = async (order: any) => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.mockSuccess(order.id)
|
||||
await loadOrders()
|
||||
})
|
||||
message.success('支付成功')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '支付失败')
|
||||
}
|
||||
}
|
||||
|
||||
const submitQuoteReply = async (order: any) => {
|
||||
const key = quoteOrderKey(order)
|
||||
const remark = String(quoteReplyForms[key] || '').trim()
|
||||
|
||||
@@ -237,10 +237,7 @@ const handleSendVerificationCode = async () => {
|
||||
}
|
||||
|
||||
try {
|
||||
await runWithGlobalLoading(() => userApi.sendVerificationCode({
|
||||
phone: userPhone.value,
|
||||
sceneCode: 'USER_CHANGE_PASSWORD_SMS_CODE'
|
||||
}))
|
||||
await runWithGlobalLoading(() => userApi.sendCurrentPasswordVerificationCode())
|
||||
message.success('验证码发送成功')
|
||||
startCountdown()
|
||||
} catch (error: any) {
|
||||
|
||||
@@ -2,31 +2,22 @@
|
||||
import { computed, onMounted, ref, shallowRef } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
CreditCardOutlined,
|
||||
CrownOutlined,
|
||||
GiftOutlined,
|
||||
HistoryOutlined,
|
||||
LeftOutlined,
|
||||
PayCircleOutlined,
|
||||
PercentageOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
ScissorOutlined,
|
||||
ShoppingOutlined,
|
||||
StarFilled,
|
||||
TrophyOutlined
|
||||
} from '@ant-design/icons-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { userApi, type BalanceHistoryItem, type UserAssetVO, type VipRechargePlanVO } from '@/api/user'
|
||||
import { userApi, type BalanceHistoryItem, type UserAssetVO } from '@/api/user'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = shallowRef(false)
|
||||
const rechargeOpen = shallowRef(false)
|
||||
const visibleHistoryCount = shallowRef(3)
|
||||
const asset = ref<UserAssetVO | null>(null)
|
||||
const history = ref<BalanceHistoryItem[]>([])
|
||||
const plans = ref<VipRechargePlanVO[]>([])
|
||||
const selectedPlan = ref<VipRechargePlanVO | null>(null)
|
||||
const rechargeSectionRef = ref<HTMLElement | null>(null)
|
||||
|
||||
interface LevelStep {
|
||||
name: string
|
||||
@@ -74,10 +65,6 @@ const sceneIcon = (item: BalanceHistoryItem) => {
|
||||
const memberLevel = computed(() => asset.value?.vipLevel || '普通会员')
|
||||
const totalRecharge = computed(() => Number(asset.value?.totalRechargeAmount || 0))
|
||||
const balanceAmount = computed(() => Number(asset.value?.balance || 0))
|
||||
const sortedPlans = computed(() => [...plans.value].sort((left, right) => {
|
||||
const sortDelta = Number(left.sortOrder || 0) - Number(right.sortOrder || 0)
|
||||
return sortDelta || Number(left.rechargeAmount || 0) - Number(right.rechargeAmount || 0)
|
||||
}))
|
||||
const visibleHistory = computed(() => history.value.slice(0, visibleHistoryCount.value))
|
||||
const canLoadMoreHistory = computed(() => visibleHistoryCount.value < history.value.length)
|
||||
const currentStep = computed(() => {
|
||||
@@ -93,9 +80,7 @@ const levelProgress = computed(() => {
|
||||
})
|
||||
const nextLevelText = computed(() => nextStep.value ? `下一等级:${nextStep.value.name}` : '已达最高等级')
|
||||
const remainingAmountText = computed(() => {
|
||||
const next = nextStep.value
|
||||
if (!next) return '继续保持你的专属礼遇'
|
||||
return `再充值 ¥${money(Math.max(next.amount - totalRecharge.value, 0))} 可升级`
|
||||
return nextStep.value ? '等级按已有业务记录自动计算' : '当前等级已达最高等级'
|
||||
})
|
||||
const validityText = computed(() => {
|
||||
const start = formatTime(asset.value?.vipStartTime)
|
||||
@@ -104,48 +89,6 @@ const validityText = computed(() => {
|
||||
if (expire === '--') return `${start} 起生效`
|
||||
return `${start} - ${expire}`
|
||||
})
|
||||
const benefitCards = computed(() => [
|
||||
{
|
||||
icon: GiftOutlined,
|
||||
title: '生日礼遇',
|
||||
desc: '生日月专属美甲套装',
|
||||
tone: 'rose'
|
||||
},
|
||||
{
|
||||
icon: SafetyCertificateOutlined,
|
||||
title: '优先预约',
|
||||
desc: '热门时段优先锁定档期',
|
||||
tone: 'gold'
|
||||
},
|
||||
{
|
||||
icon: PercentageOutlined,
|
||||
title: '专属优惠',
|
||||
desc: asset.value?.benefitInfo || '会员专属折扣权益',
|
||||
tone: 'slate'
|
||||
},
|
||||
{
|
||||
icon: CrownOutlined,
|
||||
title: '护理礼遇',
|
||||
desc: '精选护理权益持续更新',
|
||||
tone: 'cream'
|
||||
}
|
||||
])
|
||||
|
||||
const planTag = (index: number) => {
|
||||
if (index === 0) return '超值'
|
||||
if (index === 1) return '最佳选择'
|
||||
return '尊享'
|
||||
}
|
||||
|
||||
const openPlan = (plan: VipRechargePlanVO) => {
|
||||
selectedPlan.value = plan
|
||||
rechargeOpen.value = true
|
||||
}
|
||||
|
||||
const scrollToRecharge = () => {
|
||||
rechargeSectionRef.value?.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
||||
}
|
||||
|
||||
const loadMoreHistory = () => {
|
||||
visibleHistoryCount.value += 3
|
||||
}
|
||||
@@ -159,7 +102,6 @@ const loadData = async () => {
|
||||
])
|
||||
asset.value = assetRes
|
||||
history.value = historyRes || []
|
||||
plans.value = await userApi.listMyVipRechargePlans().catch(() => [])
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取 VIP 信息失败')
|
||||
} finally {
|
||||
@@ -176,10 +118,8 @@ onMounted(loadData)
|
||||
<button class="topbar-button" type="button" aria-label="返回" @click="router.back()">
|
||||
<LeftOutlined />
|
||||
</button>
|
||||
<h1>VIP中心</h1>
|
||||
<button class="topbar-button" type="button" aria-label="购物车" @click="router.push('/cart')">
|
||||
<ShoppingOutlined />
|
||||
</button>
|
||||
<h1>会员权益</h1>
|
||||
<span class="topbar-button-placeholder" aria-hidden="true"></span>
|
||||
</header>
|
||||
|
||||
<a-spin :spinning="loading">
|
||||
@@ -223,27 +163,6 @@ onMounted(loadData)
|
||||
<TrophyOutlined class="hero-watermark" />
|
||||
</section>
|
||||
|
||||
<section class="vip-section">
|
||||
<div class="section-head">
|
||||
<h3>会员特权</h3>
|
||||
<button type="button" @click="scrollToRecharge">查看全部</button>
|
||||
</div>
|
||||
<div class="benefit-grid">
|
||||
<article
|
||||
v-for="item in benefitCards"
|
||||
:key="item.title"
|
||||
class="benefit-card"
|
||||
:class="`benefit-card--${item.tone}`"
|
||||
>
|
||||
<span class="benefit-icon">
|
||||
<component :is="item.icon" />
|
||||
</span>
|
||||
<strong>{{ item.title }}</strong>
|
||||
<p>{{ item.desc }}</p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="vip-section member-info-section">
|
||||
<div class="section-head">
|
||||
<h3>会员信息</h3>
|
||||
@@ -268,30 +187,11 @@ onMounted(loadData)
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section ref="rechargeSectionRef" class="vip-section recharge-section">
|
||||
<section class="vip-section account-notice">
|
||||
<div class="section-head">
|
||||
<h3>快速充值</h3>
|
||||
<h3>权益说明</h3>
|
||||
</div>
|
||||
<div v-if="sortedPlans.length" class="plan-grid">
|
||||
<article
|
||||
v-for="(plan, index) in sortedPlans"
|
||||
:key="String(plan.id)"
|
||||
class="plan-card"
|
||||
:class="{ 'plan-card--featured': index === 1 }"
|
||||
>
|
||||
<div class="plan-tag" :class="{ 'plan-tag--featured': index === 1 }">
|
||||
{{ planTag(index) }}
|
||||
</div>
|
||||
<span class="plan-title">{{ plan.title || plan.vipLevel }}</span>
|
||||
<div class="plan-price">
|
||||
<small>¥</small>
|
||||
<strong>{{ money(plan.rechargeAmount).replace('.00', '') }}</strong>
|
||||
</div>
|
||||
<p>赠送 <b>¥{{ money(plan.giftAmount) }}</b> 奖励金</p>
|
||||
<button type="button" @click="openPlan(plan)">立即充值</button>
|
||||
</article>
|
||||
</div>
|
||||
<a-empty v-else description="暂无可展示充值档位" />
|
||||
<p>当前页面仅展示已有会员权益、余额和历史记录,不提供在线充值或订阅操作。</p>
|
||||
</section>
|
||||
|
||||
<section class="vip-section history-section">
|
||||
@@ -328,14 +228,6 @@ onMounted(loadData)
|
||||
</main>
|
||||
</a-spin>
|
||||
|
||||
<a-modal v-model:open="rechargeOpen" title="充值档位说明" :footer="null">
|
||||
<div class="plan-modal" v-if="selectedPlan">
|
||||
<span class="modal-icon"><CreditCardOutlined /></span>
|
||||
<h3>{{ selectedPlan.title || selectedPlan.vipLevel }}</h3>
|
||||
<p>充值 ¥{{ money(selectedPlan.rechargeAmount) }},赠送 ¥{{ money(selectedPlan.giftAmount) }} 奖励金。</p>
|
||||
<p>{{ selectedPlan.description || '该档位仅展示,暂不发起支付。' }}</p>
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -414,6 +306,11 @@ onMounted(loadData)
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
.topbar-button-placeholder {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.vip-main {
|
||||
display: grid;
|
||||
gap: 32px;
|
||||
@@ -734,84 +631,18 @@ onMounted(loadData)
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.plan-grid {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.plan-card {
|
||||
position: relative;
|
||||
display: grid;
|
||||
gap: 13px;
|
||||
padding: 24px;
|
||||
.account-notice {
|
||||
padding: 18px;
|
||||
border: 1px solid var(--vip-outline-soft);
|
||||
border-radius: 24px;
|
||||
background: color-mix(in srgb, var(--vip-surface) 86%, transparent);
|
||||
}
|
||||
|
||||
.plan-card--featured {
|
||||
border-color: rgba(119, 90, 25, 0.24);
|
||||
background: linear-gradient(135deg, rgba(255, 250, 240, 0.92), rgba(254, 212, 136, 0.28));
|
||||
}
|
||||
|
||||
.plan-tag {
|
||||
justify-self: start;
|
||||
padding: 5px 11px;
|
||||
border-radius: 999px;
|
||||
color: var(--vip-primary);
|
||||
background: var(--vip-blush-soft);
|
||||
font-size: 10px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.plan-tag--featured {
|
||||
position: absolute;
|
||||
top: -11px;
|
||||
right: 22px;
|
||||
color: var(--vip-hero-text);
|
||||
background: var(--vip-gold);
|
||||
}
|
||||
|
||||
.plan-title {
|
||||
color: var(--vip-muted);
|
||||
}
|
||||
|
||||
.plan-price {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 5px;
|
||||
color: var(--vip-primary);
|
||||
}
|
||||
|
||||
.plan-price strong {
|
||||
font-family: Georgia, 'Times New Roman', serif;
|
||||
font-size: 40px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.plan-card p {
|
||||
.account-notice p {
|
||||
margin: 0;
|
||||
color: var(--vip-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.plan-card p b {
|
||||
color: var(--vip-primary);
|
||||
}
|
||||
|
||||
.plan-card button {
|
||||
width: 100%;
|
||||
min-height: 46px;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
color: var(--vip-hero-text);
|
||||
background: var(--vip-primary);
|
||||
font-size: 14px;
|
||||
font-weight: 850;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 14px 28px rgba(124, 83, 87, 0.2);
|
||||
}
|
||||
|
||||
.plan-card--featured button {
|
||||
background: var(--vip-gold);
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.history-card {
|
||||
@@ -897,36 +728,6 @@ onMounted(loadData)
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.plan-modal {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-icon {
|
||||
display: grid;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
margin: 0 auto;
|
||||
place-items: center;
|
||||
border-radius: 999px;
|
||||
color: var(--vip-primary);
|
||||
background: var(--vip-blush-soft);
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.plan-modal h3 {
|
||||
margin: 4px 0 0;
|
||||
font-size: 18px;
|
||||
font-weight: 850;
|
||||
}
|
||||
|
||||
.plan-modal p {
|
||||
margin: 0;
|
||||
color: var(--vip-muted);
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
@media (max-width: 370px) {
|
||||
.vip-main {
|
||||
padding-right: 14px;
|
||||
@@ -950,8 +751,5 @@ onMounted(loadData)
|
||||
border-top-right-radius: 32px;
|
||||
}
|
||||
|
||||
.plan-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -173,15 +173,6 @@ const visibleModules = computed(() => {
|
||||
icon: MessageOutlined,
|
||||
permissionCode: 'announcement:view'
|
||||
},
|
||||
{
|
||||
key: 'vip-plans',
|
||||
title: 'VIP充值配置',
|
||||
description: '维护充值档位和 VIP 等级来源。',
|
||||
path: '/admin/vip-recharge-plans',
|
||||
icon: GiftOutlined,
|
||||
permissionCode: 'user:vip:manage',
|
||||
requireShopContext: true
|
||||
},
|
||||
{
|
||||
key: 'parameters',
|
||||
title: '参数管理',
|
||||
|
||||
@@ -0,0 +1,277 @@
|
||||
<template>
|
||||
<div class="privacy-page">
|
||||
<a-alert
|
||||
type="warning"
|
||||
show-icon
|
||||
message="内容审核当前为本地模拟流程,不会调用微信内容安全接口。正式上线前需接入审核服务并复核隐私指引。"
|
||||
class="page-notice"
|
||||
/>
|
||||
|
||||
<a-tabs v-model:active-key="activeTab" @change="loadActiveTab">
|
||||
<a-tab-pane key="closures" tab="账号注销申请">
|
||||
<a-table :columns="closureColumns" :data-source="closures" :loading="closureLoading" row-key="id" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'account'">{{ record.nickname }}({{ record.userType === 2 ? '店长' : '员工' }})</template>
|
||||
<template v-else-if="column.key === 'shops'">{{ (record.shopNames || []).join('、') || '无关联门店' }}</template>
|
||||
<template v-else-if="column.key === 'time'">{{ record.requestedAt || '-' }}</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link" @click="openClosure(record as AccountClosureRequestVO, 'APPROVE')">处理</a-button>
|
||||
<a-button type="link" danger @click="openClosure(record as AccountClosureRequestVO, 'REJECT')">驳回</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="moderation" tab="内容复核">
|
||||
<a-table :columns="moderationColumns" :data-source="moderation" :loading="moderationLoading" row-key="id" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'type'">{{ moderationType(record.contentType) }}</template>
|
||||
<template v-else-if="column.key === 'content'">
|
||||
<pre class="payload-preview">{{ formatPayload(record.payloadJson) }}</pre>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">{{ record.status === 'RETRY' ? '待复核(模拟服务故障)' : '待复核' }}</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button type="link" @click="openModeration(record as ContentModerationRecordVO, true)">通过</a-button>
|
||||
<a-button type="link" danger @click="openModeration(record as ContentModerationRecordVO, false)">拒绝</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane key="backfill" tab="手机号加密回填">
|
||||
<a-space direction="vertical" size="middle" class="backfill-panel">
|
||||
<p>先查看冲突和待处理记录数。正式回填仅在 Nacos 显式启用后可执行;检测到重复数据时会整批停止,不覆盖冲突记录。</p>
|
||||
<a-space>
|
||||
<a-button :loading="backfillLoading" @click="loadBackfillReport">检查数据</a-button>
|
||||
<a-button type="primary" danger :disabled="!backfillReport || hasBackfillConflicts" :loading="backfillLoading" @click="runBackfill">执行回填</a-button>
|
||||
</a-space>
|
||||
<a-descriptions v-if="backfillReport" bordered :column="2" size="small">
|
||||
<a-descriptions-item label="待处理账号">{{ backfillReport.userRowsToUpdate }}</a-descriptions-item>
|
||||
<a-descriptions-item label="待处理订单">{{ backfillReport.orderRowsToUpdate }}</a-descriptions-item>
|
||||
<a-descriptions-item label="账号冲突">{{ backfillReport.accountConflictRows }}</a-descriptions-item>
|
||||
<a-descriptions-item label="手机号冲突">{{ backfillReport.phoneConflictRows }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-alert v-if="backfillReport?.conflictingUserIds?.length" type="error" show-icon message="发现冲突,已禁止执行回填" :description="`涉及账号 ID:${backfillReport.conflictingUserIds.join('、')}`" />
|
||||
</a-space>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
<a-modal v-model:open="closureOpen" :title="closureDecision === 'APPROVE' ? '处理注销申请' : '驳回注销申请'" :confirm-loading="actionLoading" :mask-closable="false" @ok="submitClosure">
|
||||
<template v-if="closureTarget && closureDecision === 'APPROVE'">
|
||||
<div v-if="closureTarget.userType === 2 && closureTarget.shopIds?.length" class="closure-shops">
|
||||
<p>关联门店:{{ (closureTarget.shopNames || []).join('、') }}</p>
|
||||
<a-radio-group v-model:value="closureMode">
|
||||
<a-radio value="transfer">移交门店</a-radio>
|
||||
<a-radio value="archive">归档全部门店</a-radio>
|
||||
</a-radio-group>
|
||||
<a-select v-if="closureMode === 'transfer'" v-model:value="successorManagerId" class="full-width" placeholder="选择接手店长" :options="successorOptions" />
|
||||
</div>
|
||||
<p v-else>确认清理该账号资料并撤销其会话?必要业务记录会保留并去除账号身份关联。</p>
|
||||
</template>
|
||||
<a-form-item :label="closureDecision === 'REJECT' ? '驳回原因' : '处理说明'">
|
||||
<a-textarea v-model:value="closureNote" :rows="3" :placeholder="closureDecision === 'REJECT' ? '请填写驳回原因' : '可填写处理说明'" />
|
||||
</a-form-item>
|
||||
</a-modal>
|
||||
|
||||
<a-modal v-model:open="moderationOpen" :title="moderationApproved ? '通过内容复核' : '拒绝内容'" :confirm-loading="actionLoading" :mask-closable="false" @ok="submitModeration">
|
||||
<p v-if="moderationTarget">{{ moderationType(moderationTarget.contentType) }}内容,记录号 {{ moderationTarget.id }}</p>
|
||||
<a-form-item label="复核说明"><a-textarea v-model:value="moderationReason" :rows="3" placeholder="说明本次模拟复核结果" /></a-form-item>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import {
|
||||
adminPrivacyComplianceApi,
|
||||
type AccountClosureRequestVO,
|
||||
type ClosureSuccessorManagerVO,
|
||||
type ContentModerationRecordVO,
|
||||
type PhoneBackfillReportVO
|
||||
} from '@/api/admin'
|
||||
|
||||
const activeTab = ref('closures')
|
||||
const closures = ref<AccountClosureRequestVO[]>([])
|
||||
const moderation = ref<ContentModerationRecordVO[]>([])
|
||||
const successorManagers = ref<ClosureSuccessorManagerVO[]>([])
|
||||
const backfillReport = ref<PhoneBackfillReportVO | null>(null)
|
||||
const closureLoading = ref(false)
|
||||
const moderationLoading = ref(false)
|
||||
const backfillLoading = ref(false)
|
||||
const actionLoading = ref(false)
|
||||
const closureOpen = ref(false)
|
||||
const closureTarget = ref<AccountClosureRequestVO | null>(null)
|
||||
const closureDecision = ref<'APPROVE' | 'REJECT'>('APPROVE')
|
||||
const closureMode = ref<'transfer' | 'archive'>('transfer')
|
||||
const successorManagerId = ref<string | number>()
|
||||
const closureNote = ref('')
|
||||
const moderationOpen = ref(false)
|
||||
const moderationTarget = ref<ContentModerationRecordVO | null>(null)
|
||||
const moderationApproved = ref(false)
|
||||
const moderationReason = ref('')
|
||||
const hasBackfillConflicts = computed(() => Boolean(backfillReport.value?.accountConflictRows || backfillReport.value?.phoneConflictRows))
|
||||
const successorOptions = computed(() => successorManagers.value.map(manager => ({ label: `${manager.nickname || '店长'}(${manager.id})`, value: manager.id })))
|
||||
|
||||
const closureColumns = [
|
||||
{ title: '申请人', key: 'account' },
|
||||
{ title: '关联门店', key: 'shops' },
|
||||
{ title: '申请时间', key: 'time' },
|
||||
{ title: '处理', key: 'action', width: 140 }
|
||||
]
|
||||
const moderationColumns = [
|
||||
{ title: '类型', key: 'type', width: 120 },
|
||||
{ title: '隔离内容', key: 'content', width: 420 },
|
||||
{ title: '状态', key: 'status', width: 180 },
|
||||
{ title: '提交时间', dataIndex: 'createTime', key: 'createTime' },
|
||||
{ title: '复核', key: 'action', width: 140 }
|
||||
]
|
||||
|
||||
async function loadClosures() {
|
||||
closureLoading.value = true
|
||||
try {
|
||||
const [items, managers] = await Promise.all([
|
||||
adminPrivacyComplianceApi.listClosures(),
|
||||
adminPrivacyComplianceApi.listSuccessorManagers()
|
||||
])
|
||||
closures.value = items || []
|
||||
successorManagers.value = managers || []
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '获取注销申请失败')
|
||||
} finally {
|
||||
closureLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadModeration() {
|
||||
moderationLoading.value = true
|
||||
try { moderation.value = await adminPrivacyComplianceApi.listModeration() || [] }
|
||||
catch (error) { message.error(error instanceof Error ? error.message : '获取复核列表失败') }
|
||||
finally { moderationLoading.value = false }
|
||||
}
|
||||
|
||||
function loadActiveTab() {
|
||||
if (activeTab.value === 'closures') void loadClosures()
|
||||
if (activeTab.value === 'moderation') void loadModeration()
|
||||
if (activeTab.value === 'backfill') void loadBackfillReport()
|
||||
}
|
||||
|
||||
function openClosure(record: AccountClosureRequestVO, decision: 'APPROVE' | 'REJECT') {
|
||||
closureTarget.value = record
|
||||
closureDecision.value = decision
|
||||
closureMode.value = 'transfer'
|
||||
successorManagerId.value = undefined
|
||||
closureNote.value = decision === 'REJECT' ? '' : '已完成门店交接或归档,并按要求清理账号资料。'
|
||||
closureOpen.value = true
|
||||
}
|
||||
|
||||
async function submitClosure() {
|
||||
if (!closureTarget.value) return
|
||||
if (closureDecision.value === 'REJECT' && !closureNote.value.trim()) {
|
||||
message.warning('请填写驳回原因')
|
||||
return
|
||||
}
|
||||
const managerHasShops = closureDecision.value === 'APPROVE' && closureTarget.value.userType === 2 && (closureTarget.value.shopIds || []).length > 0
|
||||
if (managerHasShops && closureMode.value === 'transfer' && !successorManagerId.value) {
|
||||
message.warning('请选择接手店长')
|
||||
return
|
||||
}
|
||||
if (managerHasShops && closureMode.value === 'archive' && !(await confirmArchive())) return
|
||||
actionLoading.value = true
|
||||
try {
|
||||
await adminPrivacyComplianceApi.processClosure(closureTarget.value.id, {
|
||||
decision: closureDecision.value,
|
||||
successorManagerId: managerHasShops && closureMode.value === 'transfer' ? successorManagerId.value : undefined,
|
||||
archiveShopIds: managerHasShops && closureMode.value === 'archive' ? closureTarget.value.shopIds : undefined,
|
||||
note: closureNote.value.trim() || undefined
|
||||
})
|
||||
message.success(closureDecision.value === 'APPROVE' ? '账号资料已处理' : '申请已驳回')
|
||||
closureOpen.value = false
|
||||
await loadClosures()
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '处理失败') }
|
||||
finally { actionLoading.value = false }
|
||||
}
|
||||
|
||||
function confirmArchive() {
|
||||
return new Promise<boolean>(resolve => Modal.confirm({
|
||||
title: '确认归档全部门店?',
|
||||
content: '归档后关联门店将停止营业,请确认已完成必要交接。',
|
||||
okText: '确认归档',
|
||||
cancelText: '返回',
|
||||
onOk: () => resolve(true),
|
||||
onCancel: () => resolve(false)
|
||||
}))
|
||||
}
|
||||
|
||||
function openModeration(record: ContentModerationRecordVO, approved: boolean) {
|
||||
moderationTarget.value = record
|
||||
moderationApproved.value = approved
|
||||
moderationReason.value = approved ? '本地模拟复核通过。' : ''
|
||||
moderationOpen.value = true
|
||||
}
|
||||
|
||||
async function submitModeration() {
|
||||
if (!moderationTarget.value) return
|
||||
if (!moderationReason.value.trim()) {
|
||||
message.warning('请填写复核说明')
|
||||
return
|
||||
}
|
||||
actionLoading.value = true
|
||||
try {
|
||||
await adminPrivacyComplianceApi.reviewContent(moderationTarget.value.id, { approved: moderationApproved.value, reason: moderationReason.value.trim() })
|
||||
message.success(moderationApproved.value ? '内容已通过复核' : '内容已拒绝')
|
||||
moderationOpen.value = false
|
||||
await loadModeration()
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '复核失败') }
|
||||
finally { actionLoading.value = false }
|
||||
}
|
||||
|
||||
async function loadBackfillReport() {
|
||||
backfillLoading.value = true
|
||||
try { backfillReport.value = await adminPrivacyComplianceApi.phoneBackfillReport() }
|
||||
catch (error) { message.error(error instanceof Error ? error.message : '检查失败') }
|
||||
finally { backfillLoading.value = false }
|
||||
}
|
||||
|
||||
function runBackfill() {
|
||||
Modal.confirm({
|
||||
title: '执行手机号加密回填?',
|
||||
content: '该操作只更新无重复冲突的历史账号和订单手机号。请确认已在目标环境 Nacos 显式开启回填开关。',
|
||||
okText: '执行回填',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
backfillLoading.value = true
|
||||
try {
|
||||
backfillReport.value = await adminPrivacyComplianceApi.runPhoneBackfill()
|
||||
message.success(`回填完成:账号 ${backfillReport.value.userRowsUpdated} 条,订单 ${backfillReport.value.orderRowsUpdated} 条`)
|
||||
} catch (error) { message.error(error instanceof Error ? error.message : '回填失败') }
|
||||
finally { backfillLoading.value = false }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function moderationType(type: string) {
|
||||
return ({ USER_PROFILE: '个人资料', USER_AVATAR: '头像', PRODUCT: '作品', COMMENT: '评论' } as Record<string, string>)[type] || type
|
||||
}
|
||||
|
||||
function formatPayload(value?: string) {
|
||||
if (!value) return '无待复核载荷'
|
||||
try { return JSON.stringify(JSON.parse(value), null, 2) } catch { return value }
|
||||
}
|
||||
|
||||
onMounted(loadActiveTab)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.privacy-page { display: grid; gap: 16px; }
|
||||
.page-notice { border-radius: 8px; }
|
||||
.payload-preview { max-width: 420px; max-height: 180px; margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
|
||||
.backfill-panel { width: 100%; padding: 8px 0; }
|
||||
.closure-shops { display: grid; gap: 12px; margin-bottom: 16px; }
|
||||
.closure-shops p { margin: 0; }
|
||||
.full-width { width: 100%; margin-top: 12px; }
|
||||
</style>
|
||||
@@ -220,7 +220,7 @@
|
||||
<a-form-item label="账号" name="account">
|
||||
<a-input
|
||||
v-model:value="formState.account"
|
||||
placeholder="请输入账号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.account) ? '已设置账号,留空保持不变' : '请输入账号'"
|
||||
@input="handleAccountInput"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -230,7 +230,7 @@
|
||||
<a-form-item label="手机号" name="phone">
|
||||
<a-input
|
||||
v-model:value="formState.phone"
|
||||
placeholder="请输入手机号"
|
||||
:placeholder="isEdit && isMaskedSensitiveValue(currentUser?.phone) ? '已设置手机号,留空保持不变' : '请输入手机号'"
|
||||
:maxlength="11"
|
||||
inputmode="numeric"
|
||||
autocomplete="off"
|
||||
@@ -964,6 +964,8 @@ const validatePhoneUniqueness = async (value: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const isMaskedSensitiveValue = (value?: string | null) => /^1[3-9]\d\*{4}\d{4}$/.test(String(value || '').trim())
|
||||
|
||||
const validateOptionalPasswordStrength = (value?: string) => {
|
||||
const password = value?.trim()
|
||||
if (!password) {
|
||||
@@ -1089,14 +1091,21 @@ const handleClearVipDraft = (showMessage = true) => {
|
||||
*/
|
||||
const formRules = {
|
||||
account: [
|
||||
{ required: true, message: '请输入账号', trigger: 'blur' },
|
||||
{ pattern: ACCOUNT_REGEX, message: ACCOUNT_RULE_MESSAGE, trigger: 'blur' }
|
||||
{
|
||||
validator: (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
if (!value?.trim()) return Promise.reject('请输入账号')
|
||||
if (!ACCOUNT_REGEX.test(value.trim())) return Promise.reject(ACCOUNT_RULE_MESSAGE)
|
||||
return Promise.resolve()
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
|
||||
phone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
validator: async (_rule: unknown, value: string) => {
|
||||
if (isEdit.value && !value?.trim()) return Promise.resolve()
|
||||
await validatePhoneUniqueness(value)
|
||||
return Promise.resolve()
|
||||
},
|
||||
@@ -1480,10 +1489,10 @@ const showEditModal = (record: any) => {
|
||||
isEdit.value = true
|
||||
currentUser.value = record
|
||||
Object.assign(formState, {
|
||||
account: record.account,
|
||||
account: isMaskedSensitiveValue(record.account) ? '' : record.account,
|
||||
nickname: record.nickname,
|
||||
phone: record.phone || record.contactPhone || '',
|
||||
contactPhone: record.phone || record.contactPhone || '',
|
||||
phone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
contactPhone: isMaskedSensitiveValue(record.phone || record.contactPhone) ? '' : (record.phone || record.contactPhone || ''),
|
||||
birthday: record.birthday || '',
|
||||
wechatId: record.wechatId || '',
|
||||
wechatQrCode: record.wechatQrCode || '',
|
||||
@@ -1492,6 +1501,11 @@ const showEditModal = (record: any) => {
|
||||
shopIds: resolveEditableShopIds(record)
|
||||
})
|
||||
restoreDraft()
|
||||
if (isMaskedSensitiveValue(formState.account)) formState.account = ''
|
||||
if (isMaskedSensitiveValue(formState.phone)) {
|
||||
formState.phone = ''
|
||||
formState.contactPhone = ''
|
||||
}
|
||||
modalVisible.value = true
|
||||
}
|
||||
|
||||
@@ -1584,6 +1598,12 @@ const handleModalOk = async () => {
|
||||
...(formState.password.trim() ? { password: formState.password.trim() } : {})
|
||||
}
|
||||
|
||||
if (isEdit.value && !formState.account.trim()) delete requestData.account
|
||||
if (isEdit.value && !primaryPhone) {
|
||||
delete requestData.phone
|
||||
delete requestData.contactPhone
|
||||
}
|
||||
|
||||
if (isEdit.value && currentUserType.value !== 4) {
|
||||
delete requestData.shopIds
|
||||
delete requestData.shopId
|
||||
|
||||
Reference in New Issue
Block a user