From 4945cc505468a88f32fe50bf2ec52b7ed2122406 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: Thu, 4 Dec 2025 10:33:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=87=AA=E5=8A=A8=E8=AE=BE=E7=BD=AE=EF=BC=9A?= =?UTF-8?q?=E7=82=B9=E5=87=BB'=E6=88=91=E6=83=B3=E8=A6=81'=E8=AE=BE?= =?UTF-8?q?=E4=B8=BAbuyer=EF=BC=8C=E7=82=B9=E5=87=BB'=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=96=B0=E8=B4=A7=E6=BA=90'=E8=AE=BE=E4=B8=BAseller=EF=BC=8C?= =?UTF-8?q?=E9=83=BD=E7=82=B9=E5=87=BB=E8=BF=87=E8=AE=BE=E4=B8=BAboth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/buyer/index.js | 3 ++ pages/seller/index.js | 4 +++ utils/api.js | 71 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/pages/buyer/index.js b/pages/buyer/index.js index 37d4270..2be6d92 100644 --- a/pages/buyer/index.js +++ b/pages/buyer/index.js @@ -132,6 +132,9 @@ Page({ return; } + // 更新用户类型为买家 + API.updateUserType('buyer'); + // 1. 前置验证 if (!goodsId) { console.error('商品ID为空,无法预约'); diff --git a/pages/seller/index.js b/pages/seller/index.js index 32272fb..50e9b2b 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -1226,6 +1226,10 @@ Page({ e.stopPropagation(); } + // 更新用户类型为卖家 + const API = require('../../utils/api.js'); + API.updateUserType('seller'); + // 从本地存储加载之前保存的货源数据 const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] }; diff --git a/utils/api.js b/utils/api.js index b75649c..0625985 100644 --- a/utils/api.js +++ b/utils/api.js @@ -2049,6 +2049,75 @@ module.exports = { }); }); }, - + + // 更新用户类型 + updateUserType: async (typeToAdd) => { + try { + const userId = wx.getStorageSync('userId'); + const openid = wx.getStorageSync('openid'); + const userInfo = wx.getStorageSync('userInfo'); + + if (!userId || !openid) { + console.log('用户未登录,无法更新用户类型'); + return; + } + + // 获取当前用户类型 + let users = wx.getStorageSync('users') || {}; + let currentType = users[userId] && users[userId].type ? users[userId].type : ''; + + // 计算新的用户类型 + let newType = currentType; + + if (typeToAdd === 'buyer') { + if (currentType === 'seller') { + newType = 'both'; + } else { + newType = 'buyer'; + } + } else if (typeToAdd === 'seller') { + if (currentType === 'buyer') { + newType = 'both'; + } else { + newType = 'seller'; + } + } + + // 如果类型没有变化,不需要更新 + if (newType === currentType) { + return; + } + + // 更新本地存储 + if (!users[userId]) { + users[userId] = {}; + } + users[userId].type = newType; + wx.setStorageSync('users', users); + + // 更新全局数据 + const app = getApp(); + app.globalData.userType = newType; + + // 上传到服务器 + const uploadData = { + userId, + openid, + ...userInfo, + type: newType, + timestamp: Date.now() + }; + + return API.request({ + url: '/api/user/update', + method: 'POST', + data: uploadData + }); + + } catch (error) { + console.error('更新用户类型失败:', error); + throw error; + } + }, }; \ No newline at end of file From eecdc357c40807b9535db405bc6e10a9360215cb 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: Thu, 4 Dec 2025 10:54:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dseller=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E8=A1=A8=E5=8D=95=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/seller/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/seller/index.js b/pages/seller/index.js index 579dae6..f4ed25e 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -1211,10 +1211,12 @@ Page({ wx.switchTab({ url: '/pages/buyer/index' }) } else { // 卖家登录成功后,重新显示创建货源弹窗 + // 从本地存储加载保存的表单数据 + const savedSupply = wx.getStorageSync('newSupplyDraft') || { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] }; this.setData({ showImagePreview: false, showModal: true, - newSupply: { name: '', price: '', minOrder: '', yolk: '', spec: '', imageUrls: [] } + newSupply: savedSupply }); this.disablePageScroll(); } @@ -1401,6 +1403,8 @@ Page({ if (!userId || !openid || !userInfo) { console.log('用户未登录,显示登录提示'); + // 登录前保存当前表单数据到本地存储 + wx.setStorageSync('newSupplyDraft', this.data.newSupply); // 用户未登录,显示未授权提示弹窗 wx.showModal({ title: '登录提示', From 86ab589429863c199cd1d3b57b55f6c9fbb21e84 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: Thu, 4 Dec 2025 10:57:39 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=B8=BA=E5=88=9B=E5=BB=BA=E6=96=B0?= =?UTF-8?q?=E8=B4=A7=E6=BA=90=E5=8A=9F=E8=83=BD=E7=9A=84=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=B7=BB=E5=8A=A0=E5=8F=8C=E5=87=BB=E9=80=89=E6=8B=A9?= =?UTF-8?q?=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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pages/seller/index.js b/pages/seller/index.js index f4ed25e..f581ad8 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -2903,6 +2903,29 @@ Page({ }); }, + // 双击检测变量 + lastTapTime: {}, + tapCount: {}, + + // 通用双击检测函数 + handleDoubleTap: function(e, type, callback) { + const currentTime = Date.now(); + const tapKey = `${type}-${e.currentTarget.dataset.index}`; + const lastTap = this.lastTapTime[tapKey] || 0; + const tapInterval = currentTime - lastTap; + + if (tapInterval < 300 && tapInterval > 0) { + // 双击事件触发,执行确认选择 + callback(); + } else { + // 单击事件触发,执行选择操作 + this.lastTapTime[tapKey] = currentTime; + setTimeout(() => { + delete this.lastTapTime[tapKey]; + }, 300); + } + }, + // 弹窗中选择规格 onModalSpecSelect: function (e) { const index = e.currentTarget.dataset.index; @@ -2911,6 +2934,11 @@ Page({ selectedModalSpecIndex: index, modalSpecSearchKeyword: selectedSpec // 自动填充搜索框为当前选择的规格 }); + + // 检测双击 + this.handleDoubleTap(e, 'spec', () => { + this.confirmSpecSelection(); + }); }, // 确认规格选择 @@ -3401,6 +3429,11 @@ Page({ this.setData({ selectedNameIndex: index }); + + // 检测双击 + this.handleDoubleTap(e, 'name', () => { + this.confirmNameSelection(); + }); }, confirmNameSelection() { @@ -3477,6 +3510,11 @@ Page({ this.setData({ selectedYolkIndex: index }); + + // 检测双击 + this.handleDoubleTap(e, 'yolk', () => { + this.confirmYolkSelection(); + }); }, confirmYolkSelection() { From 9960795e11f6e70d6580e204e2b72dc66a2dd533 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: Thu, 4 Dec 2025 11:09:14 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=89=80=E6=9C=89?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8E=88=E6=9D=83=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/buyer/goods-detail.js | 0 pages/buyer/goods-detail.json | 0 pages/buyer/goods-detail.wxml | 0 pages/buyer/goods-detail.wxss | 0 pages/buyer/index.wxml | 36 ++++++++------------ pages/buyer/index.wxss | 63 +++++++++++++++++++++++++++++++++++ pages/index/index.wxml | 40 ++++++++-------------- pages/index/index.wxss | 50 ++++++++++++++++++--------- pages/seller/index.wxml | 12 ++----- pages/seller/index.wxss | 47 +++++++++++--------------- pages/settlement/index.js | 14 ++++++++ pages/settlement/index.wxml | 39 +++++++++++----------- pages/settlement/index.wxss | 63 +++++++++++++++++++++++++++-------- 13 files changed, 230 insertions(+), 134 deletions(-) create mode 100644 pages/buyer/goods-detail.js create mode 100644 pages/buyer/goods-detail.json create mode 100644 pages/buyer/goods-detail.wxml create mode 100644 pages/buyer/goods-detail.wxss diff --git a/pages/buyer/goods-detail.js b/pages/buyer/goods-detail.js new file mode 100644 index 0000000..e69de29 diff --git a/pages/buyer/goods-detail.json b/pages/buyer/goods-detail.json new file mode 100644 index 0000000..e69de29 diff --git a/pages/buyer/goods-detail.wxml b/pages/buyer/goods-detail.wxml new file mode 100644 index 0000000..e69de29 diff --git a/pages/buyer/goods-detail.wxss b/pages/buyer/goods-detail.wxss new file mode 100644 index 0000000..e69de29 diff --git a/pages/buyer/index.wxml b/pages/buyer/index.wxml index d9d22aa..74c404d 100644 --- a/pages/buyer/index.wxml +++ b/pages/buyer/index.wxml @@ -137,33 +137,25 @@ - - - - 提示 - - - 请先登录后再预约商品 - - - - + + + 提示 + 请先登录后再操作 + + + - - - - 授权登录 - - - 请授权获取您的手机号用于登录 - - - - + + + 授权登录 + 请授权获取您的手机号用于登录 + + + diff --git a/pages/buyer/index.wxss b/pages/buyer/index.wxss index f2a7f32..a4bd8c9 100644 --- a/pages/buyer/index.wxss +++ b/pages/buyer/index.wxss @@ -475,4 +475,67 @@ button:after { height: 32vh; width: 100%; box-sizing: border-box; +} + +/* 统一登录授权弹窗样式 */ +.auth-modal-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 1002; +} + +.auth-modal-container { + background-color: #fff; + border-radius: 20rpx; + width: 80%; + max-width: 500rpx; + padding: 40rpx; + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15); +} + +.auth-modal-title { + font-size: 36rpx; + font-weight: bold; + color: #333; + text-align: center; + margin-bottom: 30rpx; +} + +.auth-modal-content { + font-size: 32rpx; + line-height: 1.5; + color: #666; + text-align: center; + margin-bottom: 40rpx; +} + +.auth-modal-buttons { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.auth-primary-button { + background-color: #1677ff; + color: #fff; + font-size: 32rpx; + line-height: 1.5; + border-radius: 8rpx; + padding: 20rpx 0; +} + +.auth-cancel-button { + background-color: #f5f5f5; + color: #666; + font-size: 32rpx; + line-height: 1.5; + border-radius: 8rpx; + padding: 20rpx 0; } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 7466c01..a07ec97 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -19,37 +19,25 @@ - - - - 提示 - - - 您还没有授权登录 - - - - + + + 提示 + 请先登录后再操作 + + + - - - - 授权登录 - - - 请授权获取您的手机号用于登录 - - - - + + + 授权登录 + 请授权获取您的手机号用于登录 + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index e792b37..8568058 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -109,7 +109,7 @@ page { } /* 弹窗样式 */ -.modal-overlay { +.auth-modal-overlay { position: fixed; top: 0; left: 0; @@ -119,38 +119,56 @@ page { display: flex; justify-content: center; align-items: center; - z-index: 999; + z-index: 1002; } -.modal-container { - background-color: white; - border-radius: 16rpx; +.auth-modal-container { + background-color: #fff; + border-radius: 20rpx; width: 80%; + max-width: 500rpx; padding: 40rpx; + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15); } -.modal-title { - text-align: center; - margin-bottom: 30rpx; -} - -.modal-title text { +.auth-modal-title { font-size: 36rpx; font-weight: bold; + color: #333; + text-align: center; + margin-bottom: 30rpx; } -.modal-content { +.auth-modal-content { + font-size: 32rpx; + line-height: 1.5; + color: #666; text-align: center; margin-bottom: 40rpx; - color: #666; } -.modal-content text { +.auth-modal-buttons { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.auth-primary-button { + background-color: #1677ff; + color: #fff; font-size: 32rpx; + line-height: 1.5; + border-radius: 8rpx; + padding: 20rpx 0; } -.modal-buttons { - text-align: center; +.auth-cancel-button { + background-color: #f5f5f5; + color: #666; + font-size: 32rpx; + line-height: 1.5; + border-radius: 8rpx; + padding: 20rpx 0; } .primary-button { diff --git a/pages/seller/index.wxml b/pages/seller/index.wxml index d7fa512..d81f1dc 100644 --- a/pages/seller/index.wxml +++ b/pages/seller/index.wxml @@ -803,16 +803,10 @@ - - 提示 - - - 您还没有授权登录 - + 提示 + 请先登录后再操作 - + diff --git a/pages/seller/index.wxss b/pages/seller/index.wxss index ddf5b6f..5daf727 100644 --- a/pages/seller/index.wxss +++ b/pages/seller/index.wxss @@ -529,38 +529,35 @@ button { left: 0; right: 0; bottom: 0; - background-color: rgba(0, 0, 0, 0.5); + background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; - z-index: 999; + z-index: 9999; } .auth-modal-container { - background-color: white; + background: white; + padding: 40rpx; border-radius: 16rpx; width: 80%; - padding: 40rpx; -} - -.auth-modal-title { + max-width: 500rpx; text-align: center; - margin-bottom: 30rpx; + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1); } -.auth-modal-title text { - font-size: 36rpx; +.auth-modal-title { + font-size: 32rpx; font-weight: bold; + margin-bottom: 30rpx; + color: #333; } .auth-modal-content { - text-align: center; - margin-bottom: 40rpx; + font-size: 28rpx; color: #666; -} - -.auth-modal-content text { - font-size: 32rpx; + margin-bottom: 40rpx; + line-height: 1.5; } .auth-modal-buttons { @@ -570,22 +567,18 @@ button { .auth-primary-button { background-color: #1677ff; color: white; - width: 100%; + font-size: 28rpx; + line-height: 80rpx; border-radius: 8rpx; margin-bottom: 20rpx; - border: none; - font-size: 32rpx; - font-weight: 600; - text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2); } .auth-cancel-button { - background: none; - color: #666; - border: none; - font-size: 32rpx; - font-weight: 600; - text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1); + background-color: #f5f5f5; + color: #333; + font-size: 28rpx; + line-height: 80rpx; + border-radius: 8rpx; } /* 头像选择样式 */ diff --git a/pages/settlement/index.js b/pages/settlement/index.js index 9bc1034..9d339db 100644 --- a/pages/settlement/index.js +++ b/pages/settlement/index.js @@ -37,6 +37,7 @@ Page({ // 登录弹窗相关 showAuthModal: false, + showOneKeyLoginModal: false, loginModalTitle: '请先登录', loginModalContent: '为了您的账户安全,请先完成手机号登录', showLoginButton: true @@ -825,6 +826,19 @@ Page({ }); }, + // 显示一键登录弹窗 + showOneKeyLogin() { + this.setData({ + showAuthModal: false, + showOneKeyLoginModal: true + }) + }, + + // 关闭一键登录弹窗 + closeOneKeyLoginModal() { + this.setData({ showOneKeyLoginModal: false }) + }, + // 处理手机号授权 async onGetPhoneNumber(e) { console.log('用户点击了手机号授权按钮', e.detail); diff --git a/pages/settlement/index.wxml b/pages/settlement/index.wxml index 46fc908..63e07e5 100644 --- a/pages/settlement/index.wxml +++ b/pages/settlement/index.wxml @@ -341,27 +341,26 @@ - - - - - 登录授权 - × + + + + 提示 + 请先登录后再操作 + + + - - 📱 - 为了提供更好的服务,需要获取您的手机号进行身份验证 - - - - - 授权后即可完成入驻申请 + + + + + + + 授权登录 + 请授权获取您的手机号用于登录 + + + \ No newline at end of file diff --git a/pages/settlement/index.wxss b/pages/settlement/index.wxss index 2eae155..5a46991 100644 --- a/pages/settlement/index.wxss +++ b/pages/settlement/index.wxss @@ -1552,28 +1552,63 @@ picker { } /* 登录授权弹窗 */ -.auth-modal { +/* 统一的授权登录弹窗样式 */ +.auth-modal-overlay { position: fixed; top: 0; left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - z-index: 1002; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; + z-index: 9999; } -.auth-content { - background-color: white; - border-radius: 20rpx; - width: 85%; - max-width: 520rpx; - overflow: hidden; - display: flex; - flex-direction: column; - animation: modalSlideIn 0.3s ease-out; +.auth-modal-container { + background: white; + padding: 40rpx; + border-radius: 16rpx; + width: 80%; + max-width: 500rpx; + text-align: center; + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1); +} + +.auth-modal-title { + font-size: 32rpx; + font-weight: bold; + margin-bottom: 30rpx; + color: #333; +} + +.auth-modal-content { + font-size: 28rpx; + color: #666; + margin-bottom: 40rpx; + line-height: 1.5; +} + +.auth-modal-buttons { + text-align: center; +} + +.auth-primary-button { + background-color: #1677ff; + color: white; + font-size: 28rpx; + line-height: 80rpx; + border-radius: 8rpx; + margin-bottom: 20rpx; +} + +.auth-cancel-button { + background-color: #f5f5f5; + color: #333; + font-size: 28rpx; + line-height: 80rpx; + border-radius: 8rpx; } @keyframes modalSlideIn {