feat: 增加店长审核模式与门店经营有效期
This commit is contained in:
@@ -131,6 +131,14 @@
|
||||
<TableEllipsisText :text="record.businessHours" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'businessExpiry'">
|
||||
<a-space direction="vertical" size="small">
|
||||
<a-tag :color="record.businessExpired ? 'red' : 'green'">
|
||||
{{ record.businessExpired ? '已过期' : record.businessExpireTime ? `剩余 ${record.businessRemainingDays ?? 0} 天` : '未设置' }}
|
||||
</a-tag>
|
||||
<span>{{ record.businessExpireTime ? record.businessExpireTime.slice(0, 10) : '未设置' }}</span>
|
||||
</a-space>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space>
|
||||
<a-button v-if="hasPermission('shop:view')" type="link" size="small" @click="showViewModal(record)">
|
||||
@@ -139,6 +147,9 @@
|
||||
<a-button v-if="hasPermission('shop:edit')" type="link" size="small" @click="showEditModal(record)">
|
||||
编辑
|
||||
</a-button>
|
||||
<a-button v-if="hasPermission('shop:edit') && isAdmin" type="link" size="small" @click="openBusinessExpiry(record as Shop)">
|
||||
有效期
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
@@ -172,10 +183,15 @@
|
||||
<span>地址</span>
|
||||
<strong>{{ item.address || '--' }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>经营有效期</span>
|
||||
<strong :class="{ 'expiry-danger': item.businessExpired }">{{ item.businessExpired ? '已过期' : item.businessExpireTime ? `${item.businessExpireTime.slice(0, 10)} · 剩余 ${item.businessRemainingDays ?? 0} 天` : '未设置' }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-mobile-card__actions">
|
||||
<a-button size="small" @click="showViewModal(item)">查看</a-button>
|
||||
<a-button v-if="hasPermission('shop:edit')" size="small" @click="showEditModal(item)">编辑</a-button>
|
||||
<a-button v-if="hasPermission('shop:edit') && isAdmin" size="small" @click="openBusinessExpiry(item)">有效期</a-button>
|
||||
<a-button
|
||||
v-if="hasPermission('shop:edit')"
|
||||
size="small"
|
||||
@@ -559,6 +575,29 @@
|
||||
</a-form>
|
||||
</AdminResponsiveModal>
|
||||
|
||||
<a-modal
|
||||
v-model:open="businessExpiryModalVisible"
|
||||
title="设置门店经营有效期"
|
||||
ok-text="保存到期日"
|
||||
cancel-text="取消"
|
||||
:confirm-loading="savingBusinessExpiry"
|
||||
:mask-closable="false"
|
||||
@ok="saveBusinessExpiry"
|
||||
@cancel="businessExpiryModalVisible = false"
|
||||
>
|
||||
<div class="business-expiry-editor">
|
||||
<strong>{{ expiryShop?.shopName || '门店' }}</strong>
|
||||
<a-date-picker
|
||||
v-model:value="businessExpiryDate"
|
||||
value-format="YYYY-MM-DD"
|
||||
format="YYYY-MM-DD"
|
||||
:disabled-date="disablePastExpiryDate"
|
||||
placeholder="选择到期日期"
|
||||
/>
|
||||
<p>到期日期当天 23:59 前仍可新增预约。到期后只限制新增普通预约,不影响补录历史订单和查询。</p>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<a-modal
|
||||
v-model:open="mapPickerVisible"
|
||||
:title="mapPickerTitle"
|
||||
@@ -801,6 +840,10 @@ const searchText = ref('')
|
||||
const shopList = ref<Shop[]>([])
|
||||
/** modalVisible is a reactive state variable used by the template and event handlers. */
|
||||
const modalVisible = ref(false)
|
||||
const businessExpiryModalVisible = ref(false)
|
||||
const businessExpiryDate = ref<string>()
|
||||
const savingBusinessExpiry = ref(false)
|
||||
const expiryShop = ref<Shop | null>(null)
|
||||
/** viewModalVisible is a reactive state variable used by the template and event handlers. */
|
||||
const viewModalVisible = ref(false)
|
||||
/** modalLoading is a reactive state variable used by the template and event handlers. */
|
||||
@@ -1240,6 +1283,7 @@ const columns = [
|
||||
{ title: '店铺描述', dataIndex: 'description', key: 'description' },
|
||||
{ title: '店铺地址', dataIndex: 'address', key: 'address' },
|
||||
{ title: '营业时间', dataIndex: 'businessHours', key: 'businessHours' },
|
||||
{ title: '经营有效期', key: 'businessExpiry', width: 180 },
|
||||
{ title: '状态', key: 'status', width: 120 },
|
||||
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime' },
|
||||
{ title: '操作', key: 'actions', width: 150, fixed: 'right' as const }
|
||||
@@ -1419,6 +1463,36 @@ const formatAuthorizationExpireTime = (value?: string) => {
|
||||
return value.replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
const openBusinessExpiry = (shop: Shop) => {
|
||||
expiryShop.value = shop
|
||||
businessExpiryDate.value = shop.businessExpireTime ? shop.businessExpireTime.slice(0, 10) : undefined
|
||||
businessExpiryModalVisible.value = true
|
||||
}
|
||||
|
||||
const disablePastExpiryDate = (date: any) => {
|
||||
const today = new Date()
|
||||
const localToday = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`
|
||||
return date.format('YYYY-MM-DD') < localToday
|
||||
}
|
||||
|
||||
const saveBusinessExpiry = async () => {
|
||||
if (!expiryShop.value || !businessExpiryDate.value) {
|
||||
message.warning('请选择门店到期日期')
|
||||
return
|
||||
}
|
||||
savingBusinessExpiry.value = true
|
||||
try {
|
||||
await adminShopApi.updateBusinessExpiry(expiryShop.value.id, businessExpiryDate.value)
|
||||
message.success('门店经营有效期已更新')
|
||||
businessExpiryModalVisible.value = false
|
||||
await fetchShopList()
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '有效期更新失败')
|
||||
} finally {
|
||||
savingBusinessExpiry.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -1658,7 +1732,17 @@ const fetchShopList = async () => {
|
||||
|
||||
const response = await adminShopApi.listShops(params)
|
||||
const res = typeof response === 'object' && 'list' in response ? response : (response as any).data
|
||||
shopList.value = res.list || []
|
||||
const rows = res.list || []
|
||||
let expiryById = new Map<string, Awaited<ReturnType<typeof adminShopApi.listBusinessExpiries>>[number]>()
|
||||
if (rows.length) {
|
||||
try {
|
||||
const expiries = await adminShopApi.listBusinessExpiries(rows.map((shop: Shop) => shop.id))
|
||||
expiryById = new Map(expiries.map(expiry => [String(expiry.shopId), expiry]))
|
||||
} catch {
|
||||
message.warning('门店有效期信息暂时不可用,稍后可刷新重试')
|
||||
}
|
||||
}
|
||||
shopList.value = rows.map((shop: Shop) => ({ ...shop, ...expiryById.get(String(shop.id)) }))
|
||||
pagination.total = res.total || 0
|
||||
|
||||
// 预加载所有图片签名链接
|
||||
@@ -2392,6 +2476,10 @@ onMounted(async () => {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.business-expiry-editor { display: grid; gap: 14px; padding-top: 8px; }
|
||||
.business-expiry-editor p { margin: 0; color: var(--admin-mobile-muted); font-size: 12px; line-height: 1.6; }
|
||||
.expiry-danger { color: #a54141; }
|
||||
|
||||
.shop-images {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -66,7 +66,36 @@
|
||||
<span :class="['status-pill', { 'is-muted': !reviewNoticeEnabled }]">{{ reviewNoticeEnabled ? '启用' : '停用' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="section-footnote">默认密码的强度规则仍按后台账号接口校验;审核入口和数量角标不会受提醒开关影响。</p>
|
||||
|
||||
<div class="setting-group">
|
||||
<div class="setting-group__head setting-group__head--with-action"><strong>店长注册审核</strong><span>WORKBENCH</span><a-button size="small" type="primary" :loading="savingManagerReviewMode" @click="saveManagerReviewMode">保存审核模式</a-button></div>
|
||||
<div class="setting-row setting-row--last">
|
||||
<div class="setting-copy">
|
||||
<strong>内容审核通过后自动批准</strong>
|
||||
<span>开启后仅在店长申请绑定的门店资料内容审核通过时自动通过;关闭后由管理员人工复核。</span>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<a-switch v-model:checked="managerAutoApproveEnabled" checked-children="自动" un-checked-children="人工" />
|
||||
<span class="control-note">{{ managerAutoApproveEnabled ? '自动批准' : '人工复核' }}</span>
|
||||
</div>
|
||||
<span :class="['status-pill', { 'is-muted': !managerAutoApproveEnabled }]">{{ managerAutoApproveEnabled ? '自动审核' : '人工审核' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-group">
|
||||
<div class="setting-group__head setting-group__head--with-action"><strong>门店经营有效期</strong><span>SHOP</span><a-button size="small" type="primary" :loading="savingShopValidity" @click="saveShopValidity">保存有效期</a-button></div>
|
||||
<div class="setting-row setting-row--last">
|
||||
<div class="setting-copy">
|
||||
<strong>新门店默认有效期</strong>
|
||||
<span>店长注册审核通过当天计为第 1 天;单个门店可在门店管理中单独调整到期日。</span>
|
||||
</div>
|
||||
<div class="setting-control setting-control--number">
|
||||
<a-input v-model:value="shopDefaultValidDays" type="number" :min="1" :max="3650" addon-after="天" />
|
||||
</div>
|
||||
<span class="control-note">1–3650 天</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="section-footnote">默认密码仍按后台账号接口校验;员工审核入口和数量角标不受登录提醒开关影响。门店到期只限制新增普通预约。</p>
|
||||
</section>
|
||||
|
||||
<section v-else-if="activeSection === 'services'" class="settings-section-panel">
|
||||
@@ -156,10 +185,14 @@ const activeSection = ref<SettingsSection>(route.query.section === 'account' ? '
|
||||
const loading = ref(false)
|
||||
const savingDefaultPassword = ref(false)
|
||||
const savingReviewNotice = ref(false)
|
||||
const savingManagerReviewMode = ref(false)
|
||||
const savingShopValidity = ref(false)
|
||||
const savingMap = ref(false)
|
||||
const savingSmsProvider = ref(false)
|
||||
const defaultPasswordEnabled = ref(true)
|
||||
const reviewNoticeEnabled = ref(true)
|
||||
const managerAutoApproveEnabled = ref(false)
|
||||
const shopDefaultValidDays = ref('30')
|
||||
const mapEnabled = ref(true)
|
||||
const smsProviderOptions = [
|
||||
{ label: 'Spug 短信', value: 'SPUG' },
|
||||
@@ -188,6 +221,14 @@ const reviewNoticeForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'WORKBENCH', configKey: 'MANAGER_REGISTRATION_REVIEW_NOTICE', configName: '店长员工审核提醒', configValue: 'true', enabled: 1,
|
||||
remark: '控制店长登录小程序后是否显式提示当前门店的待审核员工申请'
|
||||
})
|
||||
const managerReviewModeForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'WORKBENCH', configKey: 'MANAGER_REGISTRATION_AUTO_APPROVE', configName: '店长注册自动审核', configValue: 'false', enabled: 1,
|
||||
remark: '开启后仅在店长申请关联的门店资料内容审核通过时自动批准;关闭后由管理员人工复核'
|
||||
})
|
||||
const shopValidityForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'SHOP', configKey: 'SHOP_DEFAULT_VALID_DAYS', configName: '新门店默认有效期天数', configValue: '30', enabled: 1,
|
||||
remark: '店长注册审核通过后新门店的默认经营有效期天数,范围1-3650'
|
||||
})
|
||||
const smsProviderForm = reactive<SystemParameterConfigVO>({
|
||||
configGroup: 'SMS', configKey: 'SMS_PROVIDER', configName: '短信供应商', configValue: 'SPUG', enabled: 1,
|
||||
remark: '全局切换短信供应商时同步验证码模板和 MessageHub 通道'
|
||||
@@ -204,10 +245,11 @@ const userInfo = ref(loadCachedAdminUserInfo())
|
||||
const load = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const [userConfigs, smsConfigs, workbenchConfigs, mapConfigs] = await Promise.all([
|
||||
const [userConfigs, smsConfigs, workbenchConfigs, shopConfigs, mapConfigs] = await Promise.all([
|
||||
adminSystemParameterConfigApi.listConfigs('USER'),
|
||||
adminSystemParameterConfigApi.listConfigs('SMS'),
|
||||
adminSystemParameterConfigApi.listConfigs('WORKBENCH'),
|
||||
adminSystemParameterConfigApi.listConfigs('SHOP'),
|
||||
adminSystemParameterConfigApi.listConfigs('MAP')
|
||||
])
|
||||
const defaultPassword = userConfigs.find(item => item.configKey === 'DEFAULT_PASSWORD')
|
||||
@@ -222,6 +264,16 @@ const load = async () => {
|
||||
Object.assign(reviewNoticeForm, reviewNotice)
|
||||
reviewNoticeEnabled.value = reviewNotice.enabled === 1 && String(reviewNotice.configValue).toLowerCase() === 'true'
|
||||
}
|
||||
const managerReviewMode = workbenchConfigs.find(item => item.configKey === 'MANAGER_REGISTRATION_AUTO_APPROVE')
|
||||
if (managerReviewMode) {
|
||||
Object.assign(managerReviewModeForm, managerReviewMode)
|
||||
managerAutoApproveEnabled.value = managerReviewMode.enabled === 1 && String(managerReviewMode.configValue).toLowerCase() === 'true'
|
||||
}
|
||||
const shopValidity = shopConfigs.find(item => item.configKey === 'SHOP_DEFAULT_VALID_DAYS')
|
||||
if (shopValidity) {
|
||||
Object.assign(shopValidityForm, shopValidity)
|
||||
shopDefaultValidDays.value = String(shopValidity.configValue || '30')
|
||||
}
|
||||
const mapByKey = Object.fromEntries(mapConfigs.map(item => [item.configKey, item])) as Record<string, SystemParameterConfigVO | undefined>
|
||||
if (mapByKey.MAP_PROVIDER) Object.assign(mapForms.provider, mapByKey.MAP_PROVIDER)
|
||||
if (mapByKey.TENCENT_MAP_KEY) Object.assign(mapForms.tencentWeb, mapByKey.TENCENT_MAP_KEY)
|
||||
@@ -276,6 +328,39 @@ const saveReviewNotice = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const saveManagerReviewMode = async () => {
|
||||
savingManagerReviewMode.value = true
|
||||
try {
|
||||
await adminSystemParameterConfigApi.saveConfig({
|
||||
...managerReviewModeForm,
|
||||
configValue: managerAutoApproveEnabled.value ? 'true' : 'false',
|
||||
enabled: 1
|
||||
})
|
||||
message.success(managerAutoApproveEnabled.value ? '店长注册自动审核已开启' : '店长注册将由管理员人工复核')
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '审核模式保存失败')
|
||||
} finally {
|
||||
savingManagerReviewMode.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const saveShopValidity = async () => {
|
||||
const days = Number(shopDefaultValidDays.value)
|
||||
if (!Number.isInteger(days) || days < 1 || days > 3650) {
|
||||
message.warning('有效期请填写 1–3650 的整数天数')
|
||||
return
|
||||
}
|
||||
savingShopValidity.value = true
|
||||
try {
|
||||
await adminSystemParameterConfigApi.saveConfig({ ...shopValidityForm, configValue: String(days), enabled: 1 })
|
||||
message.success('新门店默认有效期已保存')
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : '有效期设置保存失败')
|
||||
} finally {
|
||||
savingShopValidity.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const saveMapConfig = async () => {
|
||||
savingMap.value = true
|
||||
try {
|
||||
@@ -344,6 +429,7 @@ onMounted(() => {
|
||||
.setting-control > :deep(.ant-select) { width: 100%; }
|
||||
.setting-control--password > :deep(.ant-input-affix-wrapper) { flex: 1; width: auto; min-width: 100px; }
|
||||
.setting-control--password { min-width: 0; }
|
||||
.setting-control--number { width: min(220px, 100%); }
|
||||
.control-note { color: var(--admin-mobile-muted); font-size: 11px; white-space: nowrap; }
|
||||
.setting-row > .control-note { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
|
||||
.setting-value { min-width: 0; color: var(--admin-mobile-ink); font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
{{ statusLabel(record.status) }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'contentModerationStatus'">
|
||||
<a-tag :color="moderationColor(record.contentModerationStatus)">
|
||||
{{ moderationLabel(record.contentModerationStatus) }}
|
||||
</a-tag>
|
||||
<div v-if="record.contentModerationReason" class="moderation-reason">{{ record.contentModerationReason }}</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space v-if="record.status === 'PENDING_ADMIN'">
|
||||
<a-button type="primary" size="small" @click="approve(record.id)">通过</a-button>
|
||||
@@ -49,11 +55,14 @@ const columns = [
|
||||
{ title: '身份', key: 'roleType' },
|
||||
{ title: '店铺', dataIndex: 'shopName', key: 'shopName' },
|
||||
{ title: '地址', dataIndex: 'shopAddress', key: 'shopAddress' },
|
||||
{ title: '资料内容审核', key: 'contentModerationStatus', width: 150 },
|
||||
{ title: '状态', key: 'status' },
|
||||
{ title: '操作', key: 'action', width: 150 }
|
||||
]
|
||||
|
||||
const statusLabel = (status: string) => ({ PENDING_ADMIN: '待管理员审核', PENDING_MANAGER: '待店长审核', APPROVED: '已通过', REJECTED: '已驳回' }[status] || status)
|
||||
const moderationLabel = (status?: string) => ({ APPROVED: '已通过', PENDING: '待审核', RETRY: '重试中', REJECTED: '未通过', MISSING: '未提交' }[status || ''] || '审核中')
|
||||
const moderationColor = (status?: string) => ({ APPROVED: 'green', PENDING: 'processing', RETRY: 'orange', REJECTED: 'red', MISSING: 'default' }[status || ''] || 'processing')
|
||||
|
||||
const load = async () => {
|
||||
loading.value = true
|
||||
@@ -74,3 +83,7 @@ const reject = (id: string | number) => {
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.moderation-reason { max-width: 240px; margin-top: 4px; color: #9a5147; font-size: 12px; line-height: 1.5; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user