From f38fa69985f4a108a3e54f7c4eda8477666f393d Mon Sep 17 00:00:00 2001 From: Wik-T <812952667@qq.com> Date: Wed, 17 Nov 2021 10:17:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/Api.js | 6 +- pages/goods/externalCoupon/externalCoupon.vue | 46 +- pages/goods/goods.vue | 1 - pages/order/confirmation.vue | 32 +- pages/tabBar/user/user.vue | 65 +- pages/userLogin/userLogin.vue | 50 +- subPages/recharge-centre/recharge-centre.vue | 16 +- .../unionComfirmation/unionComfirmation.vue | 1672 +++++++++-------- 8 files changed, 989 insertions(+), 899 deletions(-) diff --git a/Utils/Api.js b/Utils/Api.js index 7cd973d..87c9c63 100644 --- a/Utils/Api.js +++ b/Utils/Api.js @@ -30,7 +30,11 @@ export const updateUserPayPwd = params => { //获取用户信息 export const findUser = params => { return POST('GET', `${base}/highUser/findUser`, params).then(res => res.data); -} +} +//绑定用户电话 +export const loginByPhone = params => { + return POST('GET', `${base}/wechat/loginByPhone`, params).then(res => res.data); +}; //微信登录 export const WXlogin = params => { return POST('GET', `${base}/wechat/login`, params).then(res => res.data); diff --git a/pages/goods/externalCoupon/externalCoupon.vue b/pages/goods/externalCoupon/externalCoupon.vue index ca2caaa..01b1913 100644 --- a/pages/goods/externalCoupon/externalCoupon.vue +++ b/pages/goods/externalCoupon/externalCoupon.vue @@ -14,7 +14,7 @@ - 去使用 @@ -62,7 +62,8 @@ getDiscountByQrCode, receiveDiscount, HandleCode, - getUserInfo + getUserInfo, + loginByPhone } from '../../../Utils/Api.js'; // import authorize from '../../../components/Authorize'; let app = getApp(); @@ -249,6 +250,47 @@ // }) }, + // 微信获取手机号 + loginByPhone(PhoneNumber) { + if(PhoneNumber.detail.iv == undefined){ + uni.showToast({ + title: "用户取消授权", + icon: "none" + }); + return; + } + let params = { + openId: app.globalData.openId, + iv: PhoneNumber.detail.iv, + encryptedData: PhoneNumber.detail.encryptedData + } + loginByPhone(params).then(res => { + if (res.return_code == '000000') { + uni.showToast({ + title: '手机号授权成功', + icon: 'none', + duration: 2000 + }) + this.user = res.return_data.object.highUser; + app.globalData.token = res.return_data.uniqueCode; + app.globalData.userInfo = res.return_data + .object + .highUser; + uni.setStorage({ + key: "user", + data: res.return_data + .object + .highUser + }) + uni.setStorage({ + key: "token", + data: res.return_data.uniqueCode + }) + this.receiveDiscount(); + this.userInfo = 2; + } + }); + }, //商品跳转 toGoods(e) { if (app.globalData.userInfo) { diff --git a/pages/goods/goods.vue b/pages/goods/goods.vue index d8c4afa..e45aed8 100644 --- a/pages/goods/goods.vue +++ b/pages/goods/goods.vue @@ -119,7 +119,6 @@ - -