Browse Source

实现seller页面商品点击查看详情功能

pull/1/head
徐飞洋 3 months ago
parent
commit
36d0604188
  1. 28
      pages/seller/index.js
  2. 6
      pages/seller/index.wxml

28
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({

6
pages/seller/index.wxml

@ -85,7 +85,7 @@
</view>
<!-- 信息区域 -->
<view class="card-info-section">
<view class="card-info-section" bindtap="showGoodsDetail" data-item="{{item}}">
<view class="supply-name-row">
<view class="supply-name">{{item.name}}</view>
<view class="supply-status published">已上架</view>
@ -196,7 +196,7 @@
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;" bindtap="showGoodsDetail" data-item="{{item}}">
<view>
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #1677ff; padding: 2rpx 8rpx; border-radius: 10rpx;">审核中</view>
@ -297,7 +297,7 @@
</view>
<!-- 右侧信息区域 50%宽度 -->
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;">
<view style="width: 50%; padding: 15rpx; display: flex; flex-direction: column; justify-content: space-between; background-color: white; border-left: 1rpx solid #f0f0f0;" bindtap="showGoodsDetail" data-item="{{item}}">
<view>
<view style="font-size: 28rpx; font-weight: bold; word-break: break-word;">{{item.name}}
<view style="display: inline-block; margin-left: 10rpx; font-size: 18rpx; color: #fff; background-color: #f5222d; padding: 2rpx 8rpx; border-radius: 10rpx;">审核失败</view>

Loading…
Cancel
Save