修复:用户手机号绑定时 - 手机解码失败

This commit is contained in:
wuhui_zzw 2023-06-16 15:00:19 +08:00
parent 835d0df125
commit 60a5b586a7
9 changed files with 448 additions and 12 deletions

4
app.js
View File

@ -522,7 +522,7 @@ App({
},
getFrogproNetAddresss: function (action) {
let wx_token = this.getWxToken();
var url = this.data.host + "/yhmobile/yun_shop/api.php?i=" + this.data.uniacid + "&session_id=" + wx_token + "&type=12&route=" + action;
var url = this.data.host + "/api/api.php?i=" + this.data.uniacid + "&session_id=" + wx_token + "&type=12&route=" + action;
if(this.globalData.STORE_ID){
url += "&store_id=" + this.globalData.STORE_ID;
}
@ -709,7 +709,7 @@ App({
getNetAddresss: function (action) {
// let wx_token = this.getWxToken();
this.getExtJson();
var url = this.data.host + "/yhmobile/yun_shop/api.php?i=" + this.data.uniacid + "&type=2&route=" + action;
var url = this.data.host + "/api/api.php?i=" + this.data.uniacid + "&type=2&route=" + action;
if (this.globalData.STORE_ID) {
url += "&store_id=" + this.globalData.STORE_ID;
}

View File

@ -283,6 +283,12 @@
"independent_store/store_album/store_album",
"independent_store/search/search"
]
},
{
"root": "packageI",
"pages": [
"pay_back/pay_back"
]
}
],
"permission": {

View File

@ -1,3 +1,4 @@
// var host = 'https://ht.cdwwzc.com/', uniacid = '1'; module.exports = {host, uniacid};
var host = 'https://mp.yhzbkj.com', uniacid = '1',store_id = '14';
//var host = 'https://tsgjx.cdlfjy.com', uniacid = '104',store_id = '258';
var host = 'https://gjx.cdlfjy.com', uniacid = '104',store_id = '258';// 生产环境
module.exports = {host, uniacid,store_id};

View File

@ -128,8 +128,7 @@ Page({
} else {
this.getCurrentOrderLocation();
}
console.log('进入页面获取参数信息:',options);
if (options.editType) {
this.setData({
editType: options.editType
@ -185,8 +184,9 @@ Page({
},
getPhoneNumber(e) {
let info = e.detail;
console.log("手机信息获取",info);
if(info.errMsg == 'getPhoneNumber:ok') {
this.getPhoneM(info.code);
this.getPhoneM(info);
}
},
back() {
@ -201,13 +201,21 @@ Page({
'form.address': val
});
},
getPhoneM(info) {
let urlStr = app.getNetAddresss('member.member.miniMemberMobile');
async getPhoneM(info) {
let keys = await this.getSessionKey(info);
let mobile = await this.getPhone_index(info, keys);
this.setData({
'form.mobile': mobile
},function () {
wx.hideLoading();
});
/* return false;
let that = this;
app._postNetWork({
url: urlStr,
url: app.getNetAddresss('member.member.mobileDecode'),//miniMemberMobile
data: {
code: info,
encryptedData: info.encryptedData,
iv: info.iv,
not_validate_page: '0'
},
showToastIn: false,
@ -225,9 +233,87 @@ Page({
});
}
},
fail: function (res) { }
fail: function (res) {
console.log('手机号解码失败',res);
}
});*/
},
getSessionKey() {
let key = wx.getStorageSync('session');
console.log(key, '缓存的session');
let urlStr = app.getNetAddresss('member.mini-decrypt.getSessionKey');
return new Promise((resolve,reject) => {
app._postNetWork({
url: urlStr,
data: {
session_key_id: key,
not_validate_page: '0'
},
showToastIn: false,
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
console.log(res, '获取session_key');
if (res.result == 1) {
let keys = res.data.session_key_data.session_key;
resolve(keys);
}
} else {
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
reject();
}
},
fail: function (res) {
reject(res);
}
});
});
},
getPhone_index(info, keys) {
wx.showLoading({
title: '加载中',
});
let arr = {
info: info,
session_key: keys
};
let urlStr = app.getNetAddresss('member.mini-decrypt.index');
return new Promise((resolve,reject) => {
app._postNetWork({
url: urlStr,
showToastIn: false,
data: {
para_arr: arr,
not_validate_page: '0'
},
success: function (resdata) {
var res = resdata.data;
if (res.result == 1) {
resolve(res.data.purePhoneNumber);
} else {
wx.hideLoading({
success: (res) => { },
});
wx.showToast({
icon: 'none',
title: res.msg,
duration: 1500
});
reject();
}
},
fail: function (res) {
reject(res);
}
});
});
},
sexSelectBtn(e) {
let val = e.detail.name;
console.log(val);

View File

@ -0,0 +1,236 @@
// packageI/pay_back/pay_back.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
Interval: null,
showPacket: false,
name: '',
is_cps: '',
order_id: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '跳转中',
});
console.log(options);
if (options.is_cps) {
this.setData({
is_cps: options.is_cps
});
}
if (options.name) {
this.setData({
name: options.name
});
}
if (options.ids) {
this.setData({
order_id: options.ids
});
}
if (options.sn) {
this.setData({
order_sn: options.sn
});
}
},
toPacket() {
wx.navigateTo({
url: "/packageE/ConsumePacket/ConsumePacketSuccess/ConsumePacketSuccess?order_id=" + this.data.order_id.toString(),
});
},
onClickHide() {
this.setData({
showPacket: false,
});
this.toRedirect(this.data.redirect);
},
getData() {
let urlStr = app.getNetAddresss('order.merge-pay.check-order-pay');
app._postNetWork({
url: urlStr,
data: {
order_pay_id: this.data.order_id
},
success: (resdata) => {
let res = resdata.data;
if (res.result == 1) {
if (res.data.status == 1) {
this.setData({
redirect: res.data.redirect
});
this.checkoutConsumePacket(res.data.redirect);
clearInterval(this.data.Interval);
this.data.Interval = null;
} else {
if (!this.data.Interval) {
this.data.Interval = setInterval(() => {
this.getData();
}, 1000);
}
}
} else {
app.tips(res.msg);
}
},
fail: function (res) {}
});
},
checkoutConsumePacket(redirect) {
let basicinfo = wx.getStorageSync("yz_basic_info");
if (basicinfo && basicinfo.globalParameter.consume_red_packet_status == 1) {
let urlStr = app.getNetAddresss("plugin.consume-red-packet.Frontend.Modules.Packet.Controllers.has.index");
app._postNetWork({
url: urlStr,
data: {
order_id: this.data.order_id.split(","),
},
success: (resdata) => {
var res = resdata.data;
if (res.result == 1) {
this.setData({
showPacket: true,
});
} else {
this.toRedirect(redirect);
}
},
fail: (res) => {
this.toRedirect(redirect);
},
});
} else {
this.toRedirect(redirect);
}
},
toRedirect(redirect) {
if (this.data.is_cps) {
wx.navigateTo({
url: "/packageH/cpsPwd/cpsPwd?id=" + this.data.order_id,
});
return;
}
if (this.data.name == "Myshaky") {
wx.navigateTo({
url: "/packageC/Myshaky/activityHome/activityHome",
});
return;
}
// if (this.data.name == "blindBox") {
// // 跳转去订单详情 this.data.orderDetail_id
// // wx.redirectTo({
// // url: "/packageA/member/orderdetail/orderdetail?order_id=" + this.data.orderDetail_id + "&orderType=shop",
// // });
// return;
// }
if (this.data.order_sn) {
this.payCallBack(redirect);
}
},
payCallBack(redirect) {
if (app.globalData.store_alone_temp == 1) {
// 开启了门店独立直接跳首页
wx.reLaunch({
url: '/packageG/independent_store/index/index?store_id=' + app.globalData.STORE_ID,
});
return;
}
if (app._isTextEmpty(redirect)) {
wx.reLaunch({
url: "/packageG/index/index",
});
} else {
try {
if (this.data.name == "groups" && redirect.indexOf("group_detail") != -1) {
// 拼团
let str = redirect.match(/group_detail\/(\S*)\?i/)[1];
str = str.split("/");
let id = str[0];
if (str[1]) {
wx.navigateTo({
url: "/packageB/member/group/GroupDetail/GroupDetail?id=" + id + "&store_id=" + str[1],
});
} else {
wx.navigateTo({
url: "/packageB/member/group/GroupDetail/GroupDetail?id=" + id,
});
}
} else {
wx.redirectTo({
url: redirect,
fail: (err) => {
console.log(err);
wx.reLaunch({
url: "/packageG/index/index",
});
},
});
}
} catch (e) {
wx.reLaunch({
url: "/packageG/index/index",
});
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
clearInterval(this.data.Interval);
this.data.Interval = null;
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
clearInterval(this.data.Interval);
this.data.Interval = null;
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,23 @@
<!-- packageI/pay_back/pay_back.wxml -->
<view id="pay_back">
<view class="pay_back">
<image class="pay_succee" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/pay_succee.png" alt="" />
<p style="font-size: 34rpx; font-weight: bold">订单已支付</p>
<view class="loadingStyle">
<view style="font-size: 24rpx">等待处理中</view>
<view class="loadingEx">
<view class="span"></view>
<view class="span"></view>
<view class="span"></view>
</view>
</view>
</view>
<!-- 消费红包 -->
<van-popup show="{{ showPacket }}" bind:close="onClickHide">
<view class="wrapper">
<view class="block">
<image catchtap="toPacket" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/consume_packet.png" />
</view>
</view>
</van-popup>
</view>

View File

@ -0,0 +1,81 @@
/* packageI/pay_back/pay_back.wxss */
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.wrapper .block {
width: 448rpx;
height: 576rpx;
}
.wrapper .block image {
width: 100%;
height: 100%;
}
.pay_back {
min-height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
align-items: center;
}
.loadingStyle {
display: flex;
justify-content: center;
align-items: center;
margin-top: 25.92rpx;
}
.pay_succee {
margin: 40rpx;
width: 250.88rpx;
height: 198.08rpx;
}
.loadingEx {
display: flex;
align-items: center;
justify-content: flex-start;
margin-left: 14.08rpx;
}
.loadingEx .span {
display: inline-block;
width: 10rpx;
height: 10rpx;
margin-right: 10rpx;
border-radius: 50%;
background: #ff4c4c;
-webkit-animation: load 1.04s ease infinite;
}
.loadingEx .span:last-child {
margin-right: 0;
}
@-webkit-keyframes load {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.loadingEx .span:nth-child(1) {
-webkit-animation-delay: 0.13s;
}
.loadingEx .span:nth-child(2) {
-webkit-animation-delay: 0.26s;
}
.loadingEx .span:nth-child(3) {
-webkit-animation-delay: 0.39s;
}

View File

@ -45,7 +45,7 @@
"condition": false
},
"compileType": "miniprogram",
"appid": "wx886b46d12e1a234d",
"appid": "wx0d4eb4bf8fb79811",
"libVersion": "2.21.1",
"projectname": "yunzmall",
"cloudfunctionTemplateRoot": "",