From 36d06041881c6f9738b25ca7b663d943e14fe9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Sat, 6 Dec 2025 13:05:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0seller=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=82=B9=E5=87=BB=E6=9F=A5=E7=9C=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/seller/index.js | 28 ++++++++++++++++++++++++++++ pages/seller/index.wxml | 6 +++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/pages/seller/index.js b/pages/seller/index.js index c5f37c8..740514f 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -3276,6 +3276,34 @@ Page({ }) }, + // 跳转到商品详情页面 + showGoodsDetail: function (e) { + // 检查用户是否登录 + const openid = wx.getStorageSync('openid'); + const userId = wx.getStorageSync('userId'); + + if (!openid || !userId) { + console.log('用户未登录,显示登录提示和弹窗'); + // 提示登录后才可查看详情 + wx.showToast({ + title: '登录后才可查看详情', + icon: 'none', + duration: 1500 + }); + // 显示登录弹窗 + setTimeout(() => { + this.showOneKeyLogin(); + }); + return; + } + + const goodsItem = e.currentTarget.dataset.item; + // 跳转到商品详情页面,并传递商品数据,使用encodeURIComponent编码JSON字符串 + wx.navigateTo({ + url: '/pages/goods-detail/goods-detail?goodsData=' + encodeURIComponent(JSON.stringify(goodsItem)) + }); + }, + // 关闭图片预览 closeImagePreview() { this.setData({ diff --git a/pages/seller/index.wxml b/pages/seller/index.wxml index 124e0c2..48419aa 100644 --- a/pages/seller/index.wxml +++ b/pages/seller/index.wxml @@ -85,7 +85,7 @@ - + {{item.name}} 已上架 @@ -196,7 +196,7 @@ - + {{item.name}} 审核中 @@ -297,7 +297,7 @@ - + {{item.name}} 审核失败