From 9b8964f50bb979fb2e102f1d9a2cab539342a376 Mon Sep 17 00:00:00 2001 From: yangsanTT <812952667@qq.com> Date: Sun, 30 May 2021 22:34:25 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AF=B9=E6=8E=A5H5=E6=8E=A5=E5=8F=A3=202.?= =?UTF-8?q?=E4=BC=98=E5=8C=96H5=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/Api.js | 13 +- components/Authorize.vue | 15 +- manifest.json | 6 +- pages/goods/externalCoupon/externalCoupon.vue | 118 +++++---- pages/goods/goods.vue | 210 ++++++---------- pages/goods/store-list/store-details.vue | 60 ++--- pages/login/register.vue | 237 +++++++++++------- pages/order/confirmation.vue | 46 ++-- pages/tabBar/category/category.vue | 8 +- pages/tabBar/home/home.vue | 10 +- pages/tabBar/user/user.vue | 2 +- pages/user/order_list/order_list.vue | 3 + static/img/share/wxd.png | Bin 0 -> 1506 bytes 13 files changed, 365 insertions(+), 363 deletions(-) create mode 100644 static/img/share/wxd.png diff --git a/Utils/Api.js b/Utils/Api.js index 9bf7034..a1cf68a 100644 --- a/Utils/Api.js +++ b/Utils/Api.js @@ -139,7 +139,18 @@ export const getStoreList = params => { export const getH5UserInfo = params => { return POST('GET', `${base}/wechat/getH5UserInfo`, params).then(res => res.data); } - +//获取验证码 +export const sendSmsCode = params => { + return POST('GET', `${base}/sms/sendSmsCode`, params).then(res => res.data); +} +//绑定手机号 +export const bindUserPhone = params => { + return POST('GET', `${base}/highUser/bindUserPhone`, params).then(res => res.data); +} +//注册 +export const H5login = params => { + return POST('GET', `${base}/user/login`, params).then(res => res.data); +} //**门店// export const userLogin = params => { diff --git a/components/Authorize.vue b/components/Authorize.vue index 421d1ae..46f48dd 100644 --- a/components/Authorize.vue +++ b/components/Authorize.vue @@ -50,7 +50,6 @@ methods: { iscode() { let that = this; - if (!app.globalData.userInfo) { this.isShowAuth = true; } else {} @@ -106,29 +105,17 @@ }); }, fail: res => { - console.log('========' + JSON.stringify(res)); uni.showToast({ title: "微信登录授权失败", icon: "none" }); } }) - - // } else { - // fail: res => { - // uni.showToast({ - // title: "微信登录授权失败", - // icon: "none" - // }); - // } - // } - // } - // }) that.isShowAuth = false }, getH5userinfo(){ uni.navigateTo({ - url:'/pages/login/register' + url:'/pages/login/register?id=1' }) // location.href='https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2Findex.html%23%2F&response_type=code&scope=snsapi_userinfo#wechat_redirect'; }, diff --git a/manifest.json b/manifest.json index b019afe..8c5e513 100644 --- a/manifest.json +++ b/manifest.json @@ -82,12 +82,12 @@ }, "title" : "嗨森逛", "router" : { - "mode" : "", - "base" : "" + "mode" : "hash", + "base" : "/H5" }, "devServer" : { "port" : "", - "https" : false + "https" : true }, "domain" : "https://hsgcs.dctpay.com", "template" : "" diff --git a/pages/goods/externalCoupon/externalCoupon.vue b/pages/goods/externalCoupon/externalCoupon.vue index 1d6e433..fe59e80 100644 --- a/pages/goods/externalCoupon/externalCoupon.vue +++ b/pages/goods/externalCoupon/externalCoupon.vue @@ -14,8 +14,8 @@ - + 去使用 @@ -188,58 +188,67 @@ getuserinfo() { let that = this; // wx.login({ - // success(res) { - // if (res.code) { - //发起网络请求 - // var code = res.code - // 获取微信用户信息 - uni.getUserProfile({ - desc: '登录中...', - success: function(res) { - let params = { - openId: app.globalData.openId, - iv: res.iv, - encryptedData: res.encryptedData - } - getUserInfo(params).then(res => { - if (res.return_code == '000000') { - uni.hideLoading(); - app.globalData.userInfo = res - .return_data - .object - .highUser; - app.globalData.token = res - .return_data.uniqueCode; - uni.setStorage({ - key: "user", - data: res.return_data - .object - .highUser - }) - uni.setStorage({ - key: "token", - data: res.return_data - .uniqueCode - }) - that.receiveDiscount(); - that.userInfo = 2; - } else { - uni.hideLoading(); - uni.showToast({ - title: res.return_msg, - icon: 'none', - duration: 2000 - }) - } - }); - }, - fail: res => { - uni.showToast({ - title: "微信登录授权失败", - icon: "none" - }); - } - }) + // success(res) { + // if (res.code) { + // 发起网络请求 + // var code = res.code; + // 获取微信用户信息 + uni.getUserProfile({ + desc: '登录中...', + success: function(res) { + let params = { + openId: app.globalData.openId, + iv: res.iv, + encryptedData: res.encryptedData + } + getUserInfo(params).then(res => { + if (res.return_code == '000000') { + uni.hideLoading(); + app.globalData.userInfo = res + .return_data + .object + .highUser; + app.globalData.token = res + .return_data.uniqueCode; + uni.setStorage({ + key: "user", + data: res.return_data + .object + .highUser + }) + uni.setStorage({ + key: "token", + data: res.return_data + .uniqueCode + }) + that.receiveDiscount(); + that.userInfo = 2; + } else { + uni.hideLoading(); + uni.showToast({ + title: res.return_msg, + icon: 'none', + duration: 2000 + }) + } + }); + }, + fail: res => { + uni.showToast({ + title: "微信登录授权失败", + icon: "none" + }); + } + }) + // } else { + // uni.showToast({ + // title: "微信登录授权失败", + // icon: "none" + // }); + // } + // } + // }) + }, //商品跳转 toGoods(e) { @@ -261,7 +270,6 @@ diff --git a/pages/order/confirmation.vue b/pages/order/confirmation.vue index c4c20bd..132f96f 100644 --- a/pages/order/confirmation.vue +++ b/pages/order/confirmation.vue @@ -142,9 +142,16 @@ {{paytheprice*100}} + + + + + + + @@ -155,7 +162,8 @@ addOrder, getCouponById, GetPhoneNumber, - getUserNormalDiscountList + getUserNormalDiscountList, + bindUserPhone } from '../../Utils/Api.js'; let app = getApp(); export default { @@ -202,30 +210,6 @@ this.getUserNormalDiscountList(); }, onShow() { - //页面显示时,加载订单信息 - // uni.getStorage({ - // key: 'buylist', - // success: (ret) => { - // this.buylist = ret.data; - // this.goodsPrice = 0; - // //合计 - // let len = this.buylist.length; - // for (let i = 0; i < len; i++) { - // this.goodsPrice = this.goodsPrice + (this.buylist[i].number * this.buylist[i].price); - // } - // this.deduction = this.int / 100; - // this.sumPrice = this.goodsPrice - this.deduction + this.freight; - // } - // }); - // uni.getStorage({ - // key: 'selectAddress', - // success: (e) => { - // this.recinfo = e.data; - // uni.removeStorage({ - // key: 'selectAddress' - // }) - // } - // }) }, onHide() { @@ -303,7 +287,8 @@ if (this.couponList.salesPrice > this.UserNormalDiscountList[i].highDiscount.discountPrice) { //满减价格 this.deductionPrice = this.UserNormalDiscountList[i].highDiscount.discountPrice; - this.paytheprice = (((this.couponList.salesPrice*100) - (this.deductionPrice*100))/100); + this.paytheprice = (((this.couponList.salesPrice * 100) - (this.deductionPrice * 100)) / + 100); } else { uni.showToast({ title: '未满足满减条件', @@ -314,7 +299,7 @@ } else if (this.UserNormalDiscountList[i].highDiscount.discountType == 2) { //抵扣价格 this.deductionPrice = this.UserNormalDiscountList[i].highDiscount.discountPrice; - this.paytheprice = (((this.couponList.salesPrice*100) - (this.deductionPrice*100))/100); + this.paytheprice = (((this.couponList.salesPrice * 100) - (this.deductionPrice * 100)) / 100); } else if (this.UserNormalDiscountList[i].highDiscount.discountType == 3) { // 打折 this.deductionPrice = this.couponList.salesPrice - this.couponList.salesPrice * (this @@ -325,6 +310,13 @@ } } }, + // H5获取手机号 + jumpH5Bding() { + uni.navigateTo({ + url:'/pages/login/register?id=2' + }) + }, + // 微信获取手机号 getPhoneNumber(PhoneNumber) { let params = { openId: app.globalData.openId, diff --git a/pages/tabBar/category/category.vue b/pages/tabBar/category/category.vue index b54d7f3..fc930a0 100644 --- a/pages/tabBar/category/category.vue +++ b/pages/tabBar/category/category.vue @@ -56,9 +56,7 @@ - - - +