diff --git a/src/views/miniapp/MiniappAssets.vue b/src/views/miniapp/MiniappAssets.vue index ac49f99..7b9f9f6 100644 --- a/src/views/miniapp/MiniappAssets.vue +++ b/src/views/miniapp/MiniappAssets.vue @@ -16,7 +16,7 @@ -

管事/组长海报合成时的底图,小程序进入海报页自动拉取。

+

管事 / 组长 / 点单端海报合成时的底图,按当前俱乐部独立配置;小程序进入海报页自动拉取。

{{ item.label }}
@@ -206,7 +206,7 @@ const username = ref(localStorage.getItem('username') || '') const REQUIRED_PERMISSION = '8080a' const hasPermission = ref(true) 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 FIGHTER_BANNER_KEYS = new Set(['fighter_recharge_member', 'fighter_recharge_deposit']) const FIGHTER_MINE_PAGE_KEYS = new Set([ diff --git a/src/views/shop/Products.vue b/src/views/shop/Products.vue index fd76d99..e0f345a 100644 --- a/src/views/shop/Products.vue +++ b/src/views/shop/Products.vue @@ -12,6 +12,16 @@ /> 开启后,商家发布的商品需审核才能上架
+
+ 只看审核商品: + + 开启后:未绑店且未注册打手/商家等身份只看审核专用商品;关闭后:未绑店一律看正常商品,绑店仍看店铺商品 +
@@ -213,6 +223,7 @@ import ShopProductList from './components/ShopProductList.vue' // ========== 审核模式 ========== const auditMode = ref(false) +const zhiKanShenhe = ref(true) // 开关前置确认 const beforeSwitchAudit = () => { @@ -223,15 +234,11 @@ const beforeSwitchAudit = () => { { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' } ) .then(() => { - // 用户确认,先保持开关状态(由 v-model 控制),然后发送请求 - // 这里不能直接用 resolve(true),因为需要等待异步请求完成才能决定是否允许切换 - // 使用 before-change 的标准流程:先发请求,成功则 resolve(true),失败 reject handleSwitchAudit() .then(() => resolve(true)) - .catch(() => resolve(false)) // 失败时阻止切换 + .catch(() => resolve(false)) }) .catch(() => { - // 取消操作,阻止切换 resolve(false) }) }) @@ -247,7 +254,42 @@ const handleSwitchAudit = async () => { }) if (res.code === 0) { 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 { ElMessage.error(res.msg || '更新失败') throw new Error('更新失败') @@ -282,6 +324,7 @@ const loadPublicTypes = async () => { // 数据结构:{ code:0, data:{ public_types:[], kaiqi_shenhe: bool } } publicTypes.value = res.data.public_types || [] auditMode.value = res.data.kaiqi_shenhe || false + zhiKanShenhe.value = res.data.zhi_kan_shenhe !== false } else if (res.code === 403) { publicTypes.value = [] ElMessage.error('无访问权限,页面已锁定')