diff --git a/App.vue b/App.vue index c85253e..751aaba 100644 --- a/App.vue +++ b/App.vue @@ -5,15 +5,15 @@ // brestUrl: 'http://192.168.3.4:9302/brest', // imgUrl: 'https://192.168.3.4:9301/filesystem/', //正式 - // url: 'https://hsg.dctpay.com/crest', - // imgUrl: 'https://hsg.dctpay.com/filesystem/', - // brestUrl : 'https://hsg.dctpay.com/brest', - // imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', + url: 'https://hsg.dctpay.com/crest', + imgUrl: 'https://hsg.dctpay.com/filesystem/', + brestUrl : 'https://hsg.dctpay.com/brest', + imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', //测试 - url: 'https://hsgcs.dctpay.com/crest', - brestUrl : 'https://hsgcs.dctpay.com/brest', - imgUrl: 'https://hsgcs.dctpay.com/filesystem/', - imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', + // url: 'https://hsgcs.dctpay.com/crest', + // brestUrl : 'https://hsgcs.dctpay.com/brest', + // imgUrl: 'https://hsgcs.dctpay.com/filesystem/', + // imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', userInfo: "", brestUserInfo : '', openId: '', diff --git a/manifest.json b/manifest.json index eacb442..ad3a13f 100644 --- a/manifest.json +++ b/manifest.json @@ -83,11 +83,11 @@ "title" : "嗨加油", "router" : { "mode" : "hash", - "base" : "/hsg-h5" + "base" : "/hsgH5" }, "devServer" : { "port" : "", - "https" : false + "https" : true }, "domain" : "https://hsgcs.dctpay.com", "template" : "" diff --git a/pages/goods/refuel-confirm/refuel-confirm.vue b/pages/goods/refuel-confirm/refuel-confirm.vue index a289b14..588450e 100644 --- a/pages/goods/refuel-confirm/refuel-confirm.vue +++ b/pages/goods/refuel-confirm/refuel-confirm.vue @@ -269,12 +269,22 @@ }) return; } - if (that.paytype == 'weixin') { - let params = { - "orderId": that.orderNo, - "openId": app.globalData.openId, - "orderScene": "GOODS_ORDER" - } + if (that.paytype == 'weixin') { + // #ifdef H5 + let params = { + "orderId": that.orderNo, + "openId": app.globalData.openId, + "orderScene": "GOODS_ORDER", + "openIdType": 2 + } + // #endif + // #ifdef MP + let params = { + "orderId": that.orderNo, + "openId": app.globalData.openId, + "orderScene": "GOODS_ORDER" + } + // #endif orderToPay(params).then(res => { if (res.return_code == '000000') { // #ifdef MP diff --git a/pages/login/register.vue b/pages/login/register.vue index beb98cc..167d15b 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -15,16 +15,7 @@ - 立即注册 - - - - @@ -52,6 +43,7 @@ } }, onLoad() { + }, methods: { Timer() {}, @@ -74,6 +66,7 @@ phone: this.phoneNumber } sendSmsCode(params).then(res => { + uni.hideLoading(); if (res.return_code == '000000') { this.getCodeisWaiting = true; this.getCodeBtnColor = "rgba(255,255,255,0.5)" @@ -82,8 +75,6 @@ icon: "none" }); this.setTimer(); - } else { - uni.hideLoading() } }) }, @@ -127,9 +118,8 @@ phone: this.phoneNumber, code: this.code } - // if (this.Typeid == 1) { H5login(params).then(res => { - uni.hideLoading() + uni.hideLoading(); if (res.return_code == '000000') { app.globalData.userInfo = res.return_data .object @@ -145,7 +135,9 @@ key: "token", data: res.return_data.uniqueCode }) - uni.navigateBack({}) + uni.navigateBack({ + delta:2 + }); } else { uni.showToast({ title: res.return_msg, @@ -153,55 +145,7 @@ }); } }) - // } else { - // bindUserPhone(params).then(res => { - // uni.hideLoading() - // if (res.return_code == '000000') { - // 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 - // }) - // uni.navigateBack({}) - // } else { - // uni.showToast({ - // title: res.return_msg, - // icon: "none" - // }); - // } - // }) - // } - }, - //微信内核浏览器 - isWeiXinLogin() { - var ua = navigator.userAgent.toLowerCase(); - if (ua.search(/MicroMessenger/i) > -1) { - return true; - } else { - return false; - } - }, - //微信登录 - openWx() { - 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&state=2#wechat_redirect'; - }, - toLogin() { - uni.hideKeyboard() - uni.redirectTo({ - url: 'login' - }); - uni.navigateBack(); } } } diff --git a/pages/login/updatePas/updatePas.vue b/pages/login/updatePas/updatePas.vue index 3173c93..9038572 100644 --- a/pages/login/updatePas/updatePas.vue +++ b/pages/login/updatePas/updatePas.vue @@ -76,7 +76,13 @@ uni.showToast({ title: '设置成功', icon: "none", - duration: 2000 + duration: 2000, + success() { + setTimeout(() => { + uni.navigateBack({ + }) + }, 800); + } }); app.globalData.userInfo = res.return_data .object @@ -87,12 +93,17 @@ .object .highUser }) - uni.navigateBack({}) } else { uni.hideLoading(); uni.showToast({ title: res.return_msg, - icon: "none" + icon: "none", + success() { + setTimeout(() => { + uni.navigateBack({ + }) + }, 800); + } }) } }) diff --git a/pages/order/confirmation.vue b/pages/order/confirmation.vue index bbb604d..fe698e1 100644 --- a/pages/order/confirmation.vue +++ b/pages/order/confirmation.vue @@ -295,13 +295,11 @@ let params = { couponId: this.couponId } - getCouponById(params).then(res => { + getCouponById(params).then(res => { + uni.hideLoading(); if (res.return_code == '000000') { this.couponList = res.return_data; this.paytheprice = res.return_data.discountPrice; - uni.hideLoading() - } else { - uni.hideLoading() } }) }, @@ -436,9 +434,9 @@ "storeId": this.storeId }] } - addOrder(goods).then(res => { + addOrder(goods).then(res => { + uni.hideLoading(); if (res.return_code == '000000') { - uni.hideLoading(); // uni.redirectTo({ // url: '../pay/payment/payment?amount=' + res.return_data.payPrice + // '&paytype=' + this.couponList.payType + '&orderId=' + res.return_data.id + @@ -450,7 +448,6 @@ this.orderDetails = res.return_data; this.orderToPay(res.return_data); } else { - uni.hideLoading(); uni.showToast({ title: res.return_msg, icon: 'none', @@ -495,7 +492,7 @@ "openId": app.globalData.openId, "orderScene": "GOODS_ORDER" } - // #endif + // #endif orderToPay(params).then(res => { if (res.return_code == '000000') { // #ifdef MP diff --git a/pages/pay/payment/payment.vue b/pages/pay/payment/payment.vue index 56dea76..2224e8a 100644 --- a/pages/pay/payment/payment.vue +++ b/pages/pay/payment/payment.vue @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -111,15 +111,34 @@ this.paytype = 'jinbi' } else { this.paytype = '' + } + if (!app.globalData.userInfo) { + this.findUser() } this.amount = parseFloat(e.amount).toFixed(2); }, onShow() { let that = this; that.user = app.globalData.userInfo; - that.getHuiLianTongCardBalance(); + that.getHuiLianTongCardBalance(); + if (app.globalData.userInfo) { + this.findUser(); + } }, - methods: { + methods: { + findUser() { + let params; + findUser(params).then(res => { + if (res.return_code == '000000') { + app.globalData.userInfo = res.return_data; + this.user = res.return_data; + uni.setStorage({ + key: "user", + data: res.return_data + }) + } + }); + }, //获取选择支付方式 changeRiado() { if (!this.user.isSetHltCard) { @@ -155,12 +174,21 @@ orderToPay() { let that = this; if (that.paytype == 'wxpay') { - + // #ifdef H5 + let params = { + "orderId": that.orderNo, + "openId": app.globalData.openId, + "orderScene": "GOODS_ORDER", + "openIdType": 2 + } + // #endif + // #ifdef MP let params = { "orderId": that.orderNo, "openId": app.globalData.openId, "orderScene": "GOODS_ORDER" - } + } + // #endif orderToPay(params).then(res => { if (res.return_code == '000000') { // #ifdef MP @@ -344,7 +372,7 @@ title: '支付中...' }) jweixin.config({ - // debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + // debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: self.return_data.appId, // 必填,公众号的唯一标识 timestamp: self.return_data.timeStamp, // 必填,生成签名的时间戳 nonceStr: self.return_data.nonceStr, // 必填,生成签名的随机串 diff --git a/pages/qianZhuPay/qianZhuPay.vue b/pages/qianZhuPay/qianZhuPay.vue index 544b80c..948b8d1 100644 --- a/pages/qianZhuPay/qianZhuPay.vue +++ b/pages/qianZhuPay/qianZhuPay.vue @@ -31,11 +31,21 @@ //获取订单数据 orderToPay() { let that = this; + // #ifdef H5 + let params = { + "orderId": that.orderNo, + "openId": app.globalData.openId, + "orderScene": that.source, + "openIdType": 2 + } + // #endif + // #ifdef MP let params = { "orderNo": that.orderNo, "openId": app.globalData.openId, "source": that.source } + // #endif qzOrderToPay(params).then(res => { if (res.return_code == '000000') { // #ifdef MP diff --git a/pages/tabBar/category/category.vue b/pages/tabBar/category/category.vue index cca8c1c..5e1d1a8 100644 --- a/pages/tabBar/category/category.vue +++ b/pages/tabBar/category/category.vue @@ -61,11 +61,11 @@ --> - - - + + + @@ -267,6 +267,27 @@ url: '../../goods/HM-search/HM-search' }) // uni.showToast({title: "建议跳转到新页面做搜索功能"}); + }, + //拨打客服电话 + playPhone() { + uni.showModal({ + title: '客服', + content: '4006780738', + success: function(res) { + if (res.confirm) { + uni.makePhoneCall({ + phoneNumber: '4006780738', //电话号码 + success: function(e) { + console.log(e); + }, + fail: function(e) { + console.log(e); + + } + }) + } + } + }) } } } @@ -275,14 +296,13 @@ page { background-color: #f1f3f5; } - - .H5xfimg { - width: 80rpx; - bottom: 140rpx; - position: fixed; - right: 40rpx; + + .h5xfimg { + width: 80rpx; + bottom: 140rpx; + position: fixed; + right: 40rpx; } - .xfimg { width: 80rpx; bottom: 60rpx; diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index c727994..8680892 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -85,14 +85,14 @@ - + + + + @@ -105,7 +105,6 @@ HandleCode, WXlogin, getCouponList, - getH5UserInfo, getH5AccessToken, getTPigKFCToken, getTPigCinemaToken, @@ -168,17 +167,6 @@ }, onShow() { - // #ifdef H5 - var arr1 = window.location.href; - var arr2 = arr1.split('='); - if (!app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '2#/') { - this.getH5UserInfo(arr2[1]); - } - - if (app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '1#/') { - this.getH5AccessToken(arr2[1]); - } - // #endif if (app.globalData.cityName != '') { this.city = app.globalData.cityName; this.getCouponListArea(); @@ -192,8 +180,21 @@ } }, onLoad(options) { - app.globalData.accountId = options.accountId; let that = this; + // #ifdef H5 + var arr1 = window.location.href; + var arr2 = arr1.split('='); + if (arr2[1] != undefined && arr2[2] == '1#/') { + app.globalData.h5code = arr2[1]; + } else { + // 获取openid + this.jumpcdx(); + } + if (app.globalData.h5code) { + this.getH5AccessToken(); + } + // #endif + app.globalData.accountId = options.accountId; // 1.wx获取登录用户code // #ifdef MP uni.login({ @@ -227,15 +228,6 @@ }, fail: res => {} }) - // #ifdef H5 - uni.getStorage({ - key: "openId", - success(e) { - app.globalData.openId = e.data - }, - fail: res => {} - }) - // #endif if (JSON.stringify(options.id)) { app.globalData.identificationCode = options.id; return; @@ -250,6 +242,10 @@ }, methods: { + jumpcdx() { + location.href = + 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsg.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; + }, //获取首页功能 getCmsContentcmsContent() { let params = { @@ -420,55 +416,19 @@ }); }, //H5 获取openId - getH5AccessToken(item) { + getH5AccessToken() { let params = { - code: item + code: app.globalData.h5code } getH5AccessToken(params).then(res => { - if (res.return_code == '000000') { + if (res.return_code == '000000' && res.return_data.openid) { app.globalData.openId = res.return_data.openid; uni.setStorage({ key: "openId", data: res.return_data.openid }) - } - }); - }, - - //获取H5用户信息 - getH5UserInfo(item) { - let params = { - code: item - } - getH5UserInfo(params).then(res => { - if (res.return_code == '000000') { - 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 - }) - uni.setStorage({ - key: "openId", - data: res.return_data - .object - .highUser.openIdH5 - }) - app.globalData.openId = res.return_data - .object - .highUser.openIdH5; } else { - uni.showToast({ - title: res.return_msg - }) + this.jumpcdx(); } }); }, @@ -488,19 +448,19 @@ // app.globalData.cityId = res.result.ad_info.adcode; // vm.getCouponListArea(); // vm.getCouponListgold(); - // uni.hideLoading() - - uni.hideLoading(); - that.city = res.result.address_component.city; - app.globalData.cityName = res.result.address_component - .city; - app.globalData.cityId = res.result.ad_info.adcode; - // app.globalData.cityId = '500100'; - that.getCouponListArea(); - that.getCouponListgold(); - that.getCmsContent(); - that.getCmsAactibity(); - that.getCmsContentcmshome(); + // uni.hideLoading() + + uni.hideLoading(); + that.city = res.result.address_component.city; + app.globalData.cityName = res.result.address_component + .city; + app.globalData.cityId = res.result.ad_info.adcode; + // app.globalData.cityId = '500100'; + that.getCouponListArea(); + that.getCouponListgold(); + that.getCmsContent(); + that.getCmsAactibity(); + that.getCmsContentcmshome(); that.getCmsContentcmsContent(); }) .catch(err => { @@ -746,6 +706,27 @@ url: '/pages/goods/goods-list/goods-list?id=' + item }) }, + //拨打客服电话 + playPhone() { + uni.showModal({ + title: '客服', + content: '4006780738', + success: function(res) { + if (res.confirm) { + uni.makePhoneCall({ + phoneNumber: '4006780738', //电话号码 + success: function(e) { + console.log(e); + }, + fail: function(e) { + console.log(e); + + } + }) + } + } + }) + } }, }; @@ -759,13 +740,13 @@ .popImg { width: 300px; height: 440px; - } - - .H5xfimg{ - width: 80rpx; - bottom: 140rpx; - position: fixed; - right: 40rpx; + } + + .h5xfimg { + width: 80rpx; + bottom: 140rpx; + position: fixed; + right: 40rpx; } .xfimg { diff --git a/pages/tabBar/user/user.vue b/pages/tabBar/user/user.vue index 530bfb8..db30dca 100644 --- a/pages/tabBar/user/user.vue +++ b/pages/tabBar/user/user.vue @@ -13,9 +13,14 @@ - - 点击获取信息 - {{user.name}} + + + 点击获取信息 + {{user.name}} + + + {{user.name}} + 积分: 0 积分: {{user.gold}} 个 @@ -366,10 +371,10 @@ }) }, //跳转用户信息 - jumplogin() { + jumplogin() { uni.navigateTo({ url: '../../userLogin/userLogin' - }) + }) }, //消息列表 toMsg() { @@ -418,7 +423,28 @@ url: url }) } - + // #ifdef H5 + if (item == '客服') { + uni.showModal({ + title: '客服', + content: '4006780738', + success: function(res) { + if (res.confirm) { + uni.makePhoneCall({ + phoneNumber: '4006780738', //电话号码 + success: function(e) { + console.log(e); + }, + fail: function(e) { + console.log(e); + + } + }) + } + } + }) + } + // #endif } } } diff --git a/pages/user/coupon/coupon.vue b/pages/user/coupon/coupon.vue index 7512244..bbc1e71 100644 --- a/pages/user/coupon/coupon.vue +++ b/pages/user/coupon/coupon.vue @@ -1,22 +1,19 @@