feat: 后台增加点单端海报位与只看审核开关
小程序资源页展示 cuser_poster_bg;店铺商品页增加只看审核商品开关。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<el-card class="section-card" shadow="never">
|
<el-card class="section-card" shadow="never">
|
||||||
<template #header><strong>推广海报背景(按俱乐部)</strong></template>
|
<template #header><strong>推广海报背景(按俱乐部)</strong></template>
|
||||||
<p class="hint">管事/组长海报合成时的底图,小程序进入海报页自动拉取。</p>
|
<p class="hint">管事 / 组长 / 点单端海报合成时的底图,按当前俱乐部独立配置;小程序进入海报页自动拉取。</p>
|
||||||
<div class="icon-grid">
|
<div class="icon-grid">
|
||||||
<div v-for="item in posterIcons" :key="item.icon_key" class="icon-cell">
|
<div v-for="item in posterIcons" :key="item.icon_key" class="icon-cell">
|
||||||
<div class="icon-label">{{ item.label }}</div>
|
<div class="icon-label">{{ item.label }}</div>
|
||||||
@@ -206,7 +206,7 @@ const username = ref(localStorage.getItem('username') || '')
|
|||||||
const REQUIRED_PERMISSION = '8080a'
|
const REQUIRED_PERMISSION = '8080a'
|
||||||
const hasPermission = ref(true)
|
const hasPermission = ref(true)
|
||||||
const icons = ref([])
|
const icons = ref([])
|
||||||
const POSTER_KEYS = new Set(['guanshi_poster_bg', 'zuzhang_poster_bg'])
|
const POSTER_KEYS = new Set(['guanshi_poster_bg', 'zuzhang_poster_bg', 'cuser_poster_bg'])
|
||||||
const COMMON_KEYS = new Set(['mine_pindao', 'icon_refresh'])
|
const COMMON_KEYS = new Set(['mine_pindao', 'icon_refresh'])
|
||||||
const FIGHTER_BANNER_KEYS = new Set(['fighter_recharge_member', 'fighter_recharge_deposit'])
|
const FIGHTER_BANNER_KEYS = new Set(['fighter_recharge_member', 'fighter_recharge_deposit'])
|
||||||
const FIGHTER_MINE_PAGE_KEYS = new Set([
|
const FIGHTER_MINE_PAGE_KEYS = new Set([
|
||||||
|
|||||||
@@ -12,6 +12,16 @@
|
|||||||
/>
|
/>
|
||||||
<span class="switch-desc">开启后,商家发布的商品需审核才能上架</span>
|
<span class="switch-desc">开启后,商家发布的商品需审核才能上架</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="switch-bar" style="margin-top:12px">
|
||||||
|
<span class="switch-label">只看审核商品:</span>
|
||||||
|
<el-switch
|
||||||
|
v-model="zhiKanShenhe"
|
||||||
|
active-text="开启"
|
||||||
|
inactive-text="关闭"
|
||||||
|
:before-change="beforeSwitchZhiKan"
|
||||||
|
/>
|
||||||
|
<span class="switch-desc">开启后:未绑店且未注册打手/商家等身份只看审核专用商品;关闭后:未绑店一律看正常商品,绑店仍看店铺商品</span>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 第一区域:公共商品类型(横排) -->
|
<!-- 第一区域:公共商品类型(横排) -->
|
||||||
@@ -213,6 +223,7 @@ import ShopProductList from './components/ShopProductList.vue'
|
|||||||
|
|
||||||
// ========== 审核模式 ==========
|
// ========== 审核模式 ==========
|
||||||
const auditMode = ref(false)
|
const auditMode = ref(false)
|
||||||
|
const zhiKanShenhe = ref(true)
|
||||||
|
|
||||||
// 开关前置确认
|
// 开关前置确认
|
||||||
const beforeSwitchAudit = () => {
|
const beforeSwitchAudit = () => {
|
||||||
@@ -223,15 +234,11 @@ const beforeSwitchAudit = () => {
|
|||||||
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// 用户确认,先保持开关状态(由 v-model 控制),然后发送请求
|
|
||||||
// 这里不能直接用 resolve(true),因为需要等待异步请求完成才能决定是否允许切换
|
|
||||||
// 使用 before-change 的标准流程:先发请求,成功则 resolve(true),失败 reject
|
|
||||||
handleSwitchAudit()
|
handleSwitchAudit()
|
||||||
.then(() => resolve(true))
|
.then(() => resolve(true))
|
||||||
.catch(() => resolve(false)) // 失败时阻止切换
|
.catch(() => resolve(false))
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// 取消操作,阻止切换
|
|
||||||
resolve(false)
|
resolve(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -247,7 +254,42 @@ const handleSwitchAudit = async () => {
|
|||||||
})
|
})
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
ElMessage.success('审核模式已更新')
|
ElMessage.success('审核模式已更新')
|
||||||
// 请求成功后 v-model 会自动切换到 targetValue,因为 before-change 返回 true 时执行切换
|
} else {
|
||||||
|
ElMessage.error(res.msg || '更新失败')
|
||||||
|
throw new Error('更新失败')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error('请求失败,未修改')
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const beforeSwitchZhiKan = () => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
`确定要${zhiKanShenhe.value ? '关闭' : '开启'}「只看审核商品」吗?`,
|
||||||
|
'提示',
|
||||||
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
handleSwitchZhiKan()
|
||||||
|
.then(() => resolve(true))
|
||||||
|
.catch(() => resolve(false))
|
||||||
|
})
|
||||||
|
.catch(() => resolve(false))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSwitchZhiKan = async () => {
|
||||||
|
const targetValue = !zhiKanShenhe.value
|
||||||
|
try {
|
||||||
|
const res = await request.post('/houtai/htxgdpsplx', {
|
||||||
|
action: 'update_zhi_kan_shenhe',
|
||||||
|
username: localStorage.getItem('username') || '',
|
||||||
|
zhi_kan_shenhe: targetValue
|
||||||
|
})
|
||||||
|
if (res.code === 0) {
|
||||||
|
ElMessage.success('只看审核开关已更新')
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.msg || '更新失败')
|
ElMessage.error(res.msg || '更新失败')
|
||||||
throw new Error('更新失败')
|
throw new Error('更新失败')
|
||||||
@@ -282,6 +324,7 @@ const loadPublicTypes = async () => {
|
|||||||
// 数据结构:{ code:0, data:{ public_types:[], kaiqi_shenhe: bool } }
|
// 数据结构:{ code:0, data:{ public_types:[], kaiqi_shenhe: bool } }
|
||||||
publicTypes.value = res.data.public_types || []
|
publicTypes.value = res.data.public_types || []
|
||||||
auditMode.value = res.data.kaiqi_shenhe || false
|
auditMode.value = res.data.kaiqi_shenhe || false
|
||||||
|
zhiKanShenhe.value = res.data.zhi_kan_shenhe !== false
|
||||||
} else if (res.code === 403) {
|
} else if (res.code === 403) {
|
||||||
publicTypes.value = []
|
publicTypes.value = []
|
||||||
ElMessage.error('无访问权限,页面已锁定')
|
ElMessage.error('无访问权限,页面已锁定')
|
||||||
|
|||||||
Reference in New Issue
Block a user