diff --git a/manager/LoginManager.js b/manager/LoginManager.js index 539839c..ba8cf02 100644 --- a/manager/LoginManager.js +++ b/manager/LoginManager.js @@ -1,45 +1,49 @@ -import { wxLogin, bindUserPhone, checkUserPhone } from "../request/api/LoginApi"; +import { + wxLogin, + bindUserPhone, + checkUserPhone, +} from "../request/api/LoginApi"; import { getWeChatAuthCode } from "./AuthManager"; const loginAuth = async () => { try { const openIdCode = await getWeChatAuthCode(); - console.log('获取到的微信授权code:', openIdCode); + console.log("获取到的微信授权code:", openIdCode); const response = await wxLogin({ openIdCode: [openIdCode], - grant_type: 'wechat', - scope: 'server', - clientId: '2' + grant_type: "wechat", + scope: "server", + clientId: "2", }); - console.log('获取到的微信授权response:', response); + console.log("获取到的微信授权response:", response); if (response.access_token) { - uni.setStorageSync('token', response.access_token) + uni.setStorageSync("token", response.access_token); return response; } else { - throw new Error(response.message || '登录失败'); + throw new Error(response.message || "登录失败"); } } catch (err) { throw err; } -} +}; -const bindPhone = async (params) => { +const bindPhone = async (params) => { try { - const response = await bindUserPhone(params) + const response = await bindUserPhone(params); return response; } catch (error) { throw err; } -} +}; -const checkPhone = async (phone) => { +const checkPhone = async (phone) => { try { - const response = await checkUserPhone(phone) + const response = await checkUserPhone(phone); return response; } catch (error) { throw err; } -} +}; -export { loginAuth, bindPhone, checkPhone } +export { loginAuth, bindPhone, checkPhone }; diff --git a/pages/goods/index.vue b/pages/goods/index.vue index bca105d..cc801af 100644 --- a/pages/goods/index.vue +++ b/pages/goods/index.vue @@ -152,12 +152,46 @@ const handleConfirmOrder = async (orderData) => { const res = await orderPay(params); console.log("确认订单---2:", res); - // 仅作为示例,非真实参数信息。 + // 检查接口返回数据 + if (!res || !res.data) { + uni.showToast({ + title: "订单创建失败,请重试", + icon: "none", + duration: 2000, + }); + return; + } + + const { data } = res; + const { nonceStr, packageVal, paySign, signType, timeStamp } = data; + + // 验证支付参数是否完整 + if (!nonceStr || !packageVal || !paySign || !signType || !timeStamp) { + console.error("支付参数不完整:", { + nonceStr: !!nonceStr, + packageVal: !!packageVal, + paySign: !!paySign, + signType: !!signType, + timeStamp: !!timeStamp, + }); + uni.showToast({ + title: "支付参数错误,请重试", + icon: "none", + duration: 2000, + }); + return; + } + + // 调用微信支付 uni.requestPayment({ provider: "wxpay", - ...res.data, + timeStamp: String(timeStamp), // 确保为字符串类型 + nonceStr: String(nonceStr), + package: String(packageVal), // 确保为字符串类型 + signType: String(signType), + paySign: String(paySign), success: (res) => { - console.log("success:" + JSON.stringify(res)); + console.log("支付成功:" + JSON.stringify(res)); uni.showToast({ title: "支付成功", icon: "success", @@ -165,7 +199,12 @@ const handleConfirmOrder = async (orderData) => { }); }, fail: (err) => { - console.log("fail:" + JSON.stringify(err)); + console.error("支付失败:" + JSON.stringify(err)); + uni.showToast({ + title: "支付失败,请重试", + icon: "none", + duration: 2000, + }); }, }); }; diff --git a/pages/login/components/AgreePopup/index.vue b/pages/login/components/AgreePopup/index.vue index c1c37b8..766ba74 100644 --- a/pages/login/components/AgreePopup/index.vue +++ b/pages/login/components/AgreePopup/index.vue @@ -12,15 +12,7 @@ - - 您在使用朵花温泉服务前,请仔细阅读用户隐私条款及用户注册须知,当您点击同意,即表示您已经理解并同意该条款,该条款将构成对您具有法律约束力的文件。 - - - - - - 请您注意:如果您不同意上述用户注册须知、隐私政策或其中任何约定,请您停止注册。如您阅读并点击同意即表示您已充分阅读理解并接受其全部内容,并表明您也同意朵花温泉可以依据以上隐私政策来处理您的个人信息。 - + @@ -45,6 +37,10 @@ const props = defineProps({ type: String, default: "温馨提示", }, + agreement: { + type: String, + default: "", + }, }); // Events定义 diff --git a/pages/login/components/AgreePopup/styles/index.scss b/pages/login/components/AgreePopup/styles/index.scss index 754aa97..da4fefe 100644 --- a/pages/login/components/AgreePopup/styles/index.scss +++ b/pages/login/components/AgreePopup/styles/index.scss @@ -39,32 +39,20 @@ // 弹窗内容 .popup-content { - padding: 20px; + padding: 12px; + max-height: 400px; // 设置最大高度 + overflow-y: auto; // 启用垂直滚动 - .content-text { - margin-bottom: 16px; - - .main-text { - font-size: 14px; - color: #333; - line-height: 22px; - display: block; - } - } - - .notice-text { - text { - font-size: 13px; - color: #333; - line-height: 20px; - display: block; - } + // 自定义滚动条样式 + &::-webkit-scrollbar { + display: none; } } // 按钮区域 .button-area { - padding: 0 20px 20px 20px; + padding: 20px; + box-sizing: border-box; display: flex; justify-content: center; align-items: center; diff --git a/pages/login/index.vue b/pages/login/index.vue index 909cee8..84b0916 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -55,20 +55,33 @@ - +