|
|
|
|
@ -184,16 +184,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<u-popup v-model="showUser" mode="center" closeable="true">
|
|
|
|
|
|
|
|
|
|
<u-popup v-model="showPhone" mode="center" closeable="false">
|
|
|
|
|
<view class="userBox" style="padding: 20rpx;">
|
|
|
|
|
<view class="userInfoContent" style="padding: 80rpx;font-size: 28rpx;">
|
|
|
|
|
<text class="">为了更好的提供服务请授权您的微信昵称</text>
|
|
|
|
|
<text class="">为了更好的提供服务请授权您的手机号</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="userBoxBottom">
|
|
|
|
|
<button class="userBoxBottomCol btnuserBoxBottomCol" @click="getUserProfile"
|
|
|
|
|
style="border-radius:0;flex:1;">授权</button>
|
|
|
|
|
<button class="userBoxBottomCol" @click="touserInfoClose"
|
|
|
|
|
style="border-radius:0;flex:1;">关闭</button>
|
|
|
|
|
<button class="userBoxBottomCol btnuserBoxBottomCol" style="border-radius:0;flex:1;"
|
|
|
|
|
open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权手机号</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
|
|
|
|
@ -255,7 +254,8 @@
|
|
|
|
|
shareHeight: 500,
|
|
|
|
|
imgAvatar: "",
|
|
|
|
|
poster: "",
|
|
|
|
|
showUser: false
|
|
|
|
|
showUser: false,
|
|
|
|
|
showPhone: false,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
@ -266,15 +266,26 @@
|
|
|
|
|
imageUrl: this.img
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
var that = this;
|
|
|
|
|
weixin.getOpenidInfo(info => {
|
|
|
|
|
|
|
|
|
|
that.user_info = info.user_info;
|
|
|
|
|
that.openid = that.user_info.openid;
|
|
|
|
|
that.form.member_name = that.user_info.name || that.user_info.wechat_nickname;
|
|
|
|
|
that.form.phone = that.user_info.phone;
|
|
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.loadInfo();
|
|
|
|
|
this.loadPage();
|
|
|
|
|
},
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
var that = this;
|
|
|
|
|
this.id = options.id;
|
|
|
|
|
weixin.getOpenidInfo(info => {
|
|
|
|
|
that.user_info = info.user_info
|
|
|
|
|
}, false)
|
|
|
|
|
this.openid = that.user_info.openid;
|
|
|
|
|
this.form.member_name = that.user_info.name || that.user_info.wechat_nickname;
|
|
|
|
|
this.form.phone = that.user_info.phone;
|
|
|
|
|
|
|
|
|
|
const scene = decodeURIComponent(options.scene);
|
|
|
|
|
console.log(scene)
|
|
|
|
|
if (!weixin.isNull(scene)) {
|
|
|
|
|
@ -293,39 +304,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.loadInfo();
|
|
|
|
|
this.loadPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
bindRegionChange: function(e) {
|
|
|
|
|
this.rindex = e.target.value;
|
|
|
|
|
this.form.region = this.arrRegion[e.target.value];
|
|
|
|
|
},
|
|
|
|
|
bindHospitalChange: function(e) {
|
|
|
|
|
this.hindex = e.target.value;
|
|
|
|
|
if (this.arrHospital[e.target.value] != '其他') {
|
|
|
|
|
this.form.hospital = this.arrHospital[e.target.value];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getUserProfile() {
|
|
|
|
|
var that = this;
|
|
|
|
|
weixin.getUserProfile((res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
weixin.request({
|
|
|
|
|
api: '/api/member/update-wechat-info',
|
|
|
|
|
getPhoneNumber(e) {
|
|
|
|
|
let that = this;
|
|
|
|
|
if (e.detail.iv) {
|
|
|
|
|
weixin.getOpenidInfo(r => {
|
|
|
|
|
var user_info = r.user_info;
|
|
|
|
|
console.log(user_info)
|
|
|
|
|
uni.request({
|
|
|
|
|
url: this.baseUrl + '/api/member/get-phone-by-openid',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: {
|
|
|
|
|
nickname: res.nickName,
|
|
|
|
|
avatar: res.avatarUrl
|
|
|
|
|
sessionKey: user_info.session_key,
|
|
|
|
|
iv: e.detail.iv,
|
|
|
|
|
encryptedData: e.detail.encryptedData,
|
|
|
|
|
openid: user_info.wechat_openid,
|
|
|
|
|
},
|
|
|
|
|
utilSuccess: function(r) {
|
|
|
|
|
console.log(r)
|
|
|
|
|
if (r.status == 1) {
|
|
|
|
|
weixin.getOpenidInfo(openidInfo => {}, true)
|
|
|
|
|
that.showUser = false;
|
|
|
|
|
success: (r) => {
|
|
|
|
|
if (r.data.status == 1) {
|
|
|
|
|
weixin.getOpenidInfo(openidInfo => {
|
|
|
|
|
uni.setStorageSync("userInfo", openidInfo)
|
|
|
|
|
that.form.phone = openidInfo.user_info.phone;
|
|
|
|
|
}, true);
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: r.data.msg,
|
|
|
|
|
@ -333,10 +335,23 @@
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.showPhone = false;
|
|
|
|
|
that.showPop = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
bindRegionChange: function(e) {
|
|
|
|
|
this.rindex = e.target.value;
|
|
|
|
|
this.form.region = this.arrRegion[e.target.value];
|
|
|
|
|
},
|
|
|
|
|
bindHospitalChange: function(e) {
|
|
|
|
|
this.hindex = e.target.value;
|
|
|
|
|
if (this.arrHospital[e.target.value] != '其他') {
|
|
|
|
|
this.form.hospital = this.arrHospital[e.target.value];
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getPoster: function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
@ -348,9 +363,6 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
touserInfoClose() {
|
|
|
|
|
this.showUser = false;
|
|
|
|
|
},
|
|
|
|
|
getAvatar: function() {
|
|
|
|
|
let userProfile = uni.getStorageSync('user_profile');
|
|
|
|
|
|
|
|
|
|
@ -567,8 +579,8 @@
|
|
|
|
|
toBuy() {
|
|
|
|
|
let user_info = weixin.getUserInfoCache();
|
|
|
|
|
|
|
|
|
|
if (weixin.isNull(user_info.user_info.wechat_nickname) || weixin.isNull(user_info.user_info.avatar)) {
|
|
|
|
|
this.showUser = true;
|
|
|
|
|
if (weixin.isNull(user_info.user_info.phone)) {
|
|
|
|
|
this.showPhone = true;
|
|
|
|
|
return false;
|
|
|
|
|
//this.getUserProfile();
|
|
|
|
|
}
|
|
|
|
|
@ -596,7 +608,14 @@
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.form.region == "请选择区域" || weixin.isNull(this.form.region)) {
|
|
|
|
|
this.alert('请选择区域')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.form.hospital == "请选择建卡医院") {
|
|
|
|
|
this.alert('请选择建卡医院')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.toDoBuy();
|
|
|
|
|
|
|
|
|
|
@ -609,7 +628,7 @@
|
|
|
|
|
data: this.form,
|
|
|
|
|
utilSuccess: r => {
|
|
|
|
|
if (parseFloat(r.data.total) == 0) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '../buyMemberSuccess/buyMemberSuccess?id=' +
|
|
|
|
|
this.form.product_id
|
|
|
|
|
})
|
|
|
|
|
@ -633,7 +652,7 @@
|
|
|
|
|
let payParams = JSON.parse(res.jsApiParameters)
|
|
|
|
|
payParams.provider = 'wxpay'
|
|
|
|
|
payParams.success = result => {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '../buyMemberSuccess/buyMemberSuccess?id=' +
|
|
|
|
|
this.form.product_id
|
|
|
|
|
})
|
|
|
|
|
|