7c29b254 by simon

默认提交

1 parent ec3507b2
......@@ -19,6 +19,7 @@ Page({
code: "", // 手输入码 / 扫出的奖金码
memberCode: "", // 扫出的用户码
isVerify: true, // 是否已经认证
options: {}
},
onShareAppMessage() {},
showAuth() {
......@@ -27,6 +28,17 @@ Page({
})
},
onLoad(options) {
this.setData({
options: options
})
},
onShow() {
this.hideMask();
let options = this.data.options;
let q = decodeURIComponent(options.q);
// 获取会员码
......@@ -60,12 +72,7 @@ Page({
if (m || c || sessionId) {
this.initData();
}
},
onShow() {
this.hideMask();
// console.log("onShow memberCode:", this.data.memberCode);
// console.log("onShow code:", this.data.code);
console.log("onLoad");
},
initData() {
......
......@@ -44,44 +44,96 @@ Page({
this.initData();
},
initData() {
// this.queryMember().then((result) => {});
this.initOpenid();
},
/**
* 初始化Openid
* 发红包用 该段代码参考自 user-center.js
*/
initOpenid() {
this.queryMember().then((result) => {
let auditStatus = this.data.userInfo && this.data.userInfo.auditStatus || "";
// console.log("viplogin - auditStatus:", auditStatus);
let isModify = this.data.isModify;
// console.log("isModify:", isModify)
if ((auditStatus == "authorization" || auditStatus == "unauthorized") && !isModify) {
// 未验证和待验证
app.router.push({
openType: "redirect",
path: "vipVerify"
})
let subscriptionOpenid = result.subscriptionOpenid;
if (subscriptionOpenid) {
// member表 已有openid 继续流程
this.initVipLogin(); // 原有业务
} else {
this.getProvince();
this.getMemberType().then((result) => {
app.post({
url: app.api.memberIdQuery,
data: {},
}).then((result) => {
let verifyInfo = result;
this.setData({
name: verifyInfo.realName,
mobile: verifyInfo.phone,
province: verifyInfo.province,
city: verifyInfo.city,
memberTypeCode: verifyInfo.memberTypeCode,
memberTypeName: verifyInfo.memberTypeName,
files: [{
path: verifyInfo.images
}]
})
// member表无openid ,重h5授权回来的local拿,成功就继续往下走
this.querySaveOpenid().then((result) => {
this.queryMember().then((result) => {
this.initVipLogin(); // 原有业务
})
})
}).catch((err) => {
// 如果均没有,则去h5授权
app.router.push({
path: "webview"
})
});
}
});
},
/**
* 初始化VipLogin 原initData内容
*/
initVipLogin() {
let auditStatus = this.data.userInfo && this.data.userInfo.auditStatus || "";
let isModify = this.data.isModify;
if ((auditStatus == "authorization" || auditStatus == "unauthorized") && !isModify) {
// 未验证和待验证
app.router.push({
openType: "redirect",
path: "vipVerify"
})
} else {
this.getProvince();
this.getMemberType().then((result) => {
app.post({
url: app.api.memberIdQuery,
data: {},
}).then((result) => {
let verifyInfo = result;
this.setData({
name: verifyInfo.realName,
mobile: verifyInfo.phone,
province: verifyInfo.province,
city: verifyInfo.city,
memberTypeCode: verifyInfo.memberTypeCode,
memberTypeName: verifyInfo.memberTypeName,
files: [{
path: verifyInfo.images
}]
})
})
})
}
},
})
/**
* 保存openid
*/
querySaveOpenid() {
return new Promise((resolve, reject) => {
let openid = app.store.getItem("openid");
if (openid) {
app.post({
toast: false,
url: app.api.saveOpenid,
data: {
subscriptionOpenid: openid
}
}).then((result) => {
console.log("result:", result);
app.store.clear("openid");
resolve();
}).catch((err) => {
reject();
});
} else {
reject();
}
});
},
/**
......