From e6f6447c30f52a3a4fd82c96bcba8d55dd8951a6 Mon Sep 17 00:00:00 2001 From: XingQue Date: Tue, 21 Jul 2026 02:37:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=82=B9=E5=8D=95=E7=AB=AF=E6=B5=B7=E6=8A=A5=E4=BD=8D=E4=B8=8E?= =?UTF-8?q?=E5=8F=AA=E7=9C=8B=E5=AE=A1=E6=A0=B8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 小程序资源页展示 cuser_poster_bg;店铺商品页增加只看审核商品开关。 Co-authored-by: Cursor --- src/views/miniapp/MiniappAssets.vue | 4 +-- src/views/shop/Products.vue | 55 +++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 8 deletions(-) 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('无访问权限,页面已锁定')