1.调试用户注册

yj-dev
杨杰 3 years ago
parent e2b626f3df
commit 417eb0e7d8
  1. 3
      Utils/Api.js
  2. 17
      pages/login/register.vue
  3. 5
      pages/order/confirmation.vue
  4. 3
      pages/pay/payment/payment.vue
  5. 42
      pages/tabBar/home/home.vue

@ -151,6 +151,9 @@ export const bindUserPhone = params => {
export const H5login = params => { export const H5login = params => {
return POST('GET', `${base}/user/login`, params).then(res => res.data); return POST('GET', `${base}/user/login`, params).then(res => res.data);
} }
export const getH5AccessToken = params => {
return POSTBREST('GET', `${base}/wechat/getH5AccessToken`, params).then(res => res.data);
}
//**门店// //**门店//
export const userLogin = params => { export const userLogin = params => {

@ -24,7 +24,7 @@
<view @tap="toLogin">已有账号立即登录</view> <view @tap="toLogin">已有账号立即登录</view>
</view> --> </view> -->
<image v-if="Typeid == 1" @click="openWx" src='../../static/img/share/wx.png' class="wximg"></image> <image v-if="Typeid == 1" @click="openWx" src='../../static/img/share/wx.png' class="wximg"></image>
</view> </view>
</view> </view>
@ -145,9 +145,9 @@
key: "token", key: "token",
data: res.return_data.uniqueCode data: res.return_data.uniqueCode
}) })
uni.reLaunch({ location.href =
url: '/pages/tabBar/home/home' '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_base&state=1#wechat_redirect'
});
} else { } else {
uni.showToast({ uni.showToast({
title: res.return_msg, title: res.return_msg,
@ -173,9 +173,7 @@
key: "token", key: "token",
data: res.return_data.uniqueCode data: res.return_data.uniqueCode
}) })
uni.navigateBack({ uni.navigateBack({})
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.return_msg, title: res.return_msg,
@ -189,7 +187,7 @@
// //
openWx() { openWx() {
location.href = 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'; '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() { toLogin() {
uni.hideKeyboard() uni.hideKeyboard()
@ -204,7 +202,8 @@
<style lang="scss"> <style lang="scss">
@import "../../static/css/login.scss"; @import "../../static/css/login.scss";
.wximg{
.wximg {
width: 50px; width: 50px;
height: 50px; height: 50px;
margin-left: 40%; margin-left: 40%;

@ -148,8 +148,8 @@
<button class="btn" v-else @tap="toPay">实际支付</button> <button class="btn" v-else @tap="toPay">实际支付</button>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<button class="btn" v-if="user.phone == null" @click="jumpH5Bding">实际..支付</button> <button class="btn" v-if="user.phone == null" @click="jumpH5Bding">实际支付</button>
<button class="btn" v-else @tap="toPay">实际++支付</button> <button class="btn" v-else @tap="toPay">实际支付</button>
<!-- #endif --> <!-- #endif -->
</view> </view>
@ -205,6 +205,7 @@
}, },
onLoad(option) { onLoad(option) {
this.couponId = option.id; this.couponId = option.id;
this.user = app.globalData.userInfo;
this.getCouponById(); this.getCouponById();
this.getUserNormalDiscountList(); this.getUserNormalDiscountList();
}, },

@ -120,8 +120,7 @@
} }
orderToPay(params).then(res => { orderToPay(params).then(res => {
if (res.return_code == '000000') { if (res.return_code == '000000') {
alert('=============================')
uni.pay
uni.requestPayment({ uni.requestPayment({
"appId": res.return_data.appId, "appId": res.return_data.appId,
"nonceStr": res.return_data.nonceStr, "nonceStr": res.return_data.nonceStr,

@ -114,7 +114,8 @@
HandleCode, HandleCode,
WXlogin, WXlogin,
getCouponList, getCouponList,
getH5UserInfo getH5UserInfo,
getH5AccessToken
} from "../../../Utils/Api.js"; //api } from "../../../Utils/Api.js"; //api
let app = getApp(); let app = getApp();
export default { export default {
@ -174,10 +175,13 @@
// #ifdef H5 // #ifdef H5
var arr1 = window.location.href; var arr1 = window.location.href;
var arr2 = arr1.split('='); var arr2 = arr1.split('=');
console.log(arr2); if (!app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '2#/') {
if (!app.globalData.userInfo && arr2[1] != undefined) {
this.getH5UserInfo(arr2[1]); this.getH5UserInfo(arr2[1]);
} }
if (app.globalData.userInfo && arr2[1] != undefined && arr2[2] == '1#/') {
this.getH5AccessToken(arr2[1]);
}
// #endif // #endif
}, },
onLoad() { onLoad() {
@ -185,7 +189,6 @@
// //
} }
// 1.wxcode // 1.wxcode
// #ifdef MP // #ifdef MP
uni.login({ uni.login({
@ -219,6 +222,15 @@
}, },
fail: res => {} fail: res => {}
}) })
// #ifdef H5
uni.getStorage({
key: "openId",
success(e) {
app.globalData.openId = e.data
},
fail: res => {}
})
// #endif
}, },
methods: { methods: {
@ -258,6 +270,22 @@
} }
}) })
}, },
//H5 openId
getH5AccessToken(item) {
let params = {
code: item
}
getH5AccessToken(params).then(res => {
if (res.return_code == '000000') {
app.globalData.openId = res.return_data.openid;
uni.setStorage({
key: "openId",
data: res.return_data.openid
})
}
});
},
// //
isWeiXinLogin() { isWeiXinLogin() {
var ua = navigator.userAgent.toLowerCase(); var ua = navigator.userAgent.toLowerCase();
@ -288,6 +316,12 @@
key: "token", key: "token",
data: res.return_data.uniqueCode data: res.return_data.uniqueCode
}) })
uni.setStorage({
key: "openId",
data: res.return_data
.object
.highUser.openIdH5
})
app.globalData.openId = res.return_data app.globalData.openId = res.return_data
.object .object
.highUser.openIdH5; .highUser.openIdH5;

Loading…
Cancel
Save