7c29b254 by simon

默认提交

1 parent ec3507b2
...@@ -19,6 +19,7 @@ Page({ ...@@ -19,6 +19,7 @@ Page({
19 code: "", // 手输入码 / 扫出的奖金码 19 code: "", // 手输入码 / 扫出的奖金码
20 memberCode: "", // 扫出的用户码 20 memberCode: "", // 扫出的用户码
21 isVerify: true, // 是否已经认证 21 isVerify: true, // 是否已经认证
22 options: {}
22 }, 23 },
23 onShareAppMessage() {}, 24 onShareAppMessage() {},
24 showAuth() { 25 showAuth() {
...@@ -27,6 +28,17 @@ Page({ ...@@ -27,6 +28,17 @@ Page({
27 }) 28 })
28 }, 29 },
29 onLoad(options) { 30 onLoad(options) {
31 this.setData({
32 options: options
33 })
34
35
36 },
37
38 onShow() {
39 this.hideMask();
40 let options = this.data.options;
41
30 let q = decodeURIComponent(options.q); 42 let q = decodeURIComponent(options.q);
31 43
32 // 获取会员码 44 // 获取会员码
...@@ -60,12 +72,7 @@ Page({ ...@@ -60,12 +72,7 @@ Page({
60 if (m || c || sessionId) { 72 if (m || c || sessionId) {
61 this.initData(); 73 this.initData();
62 } 74 }
63 }, 75 console.log("onLoad");
64
65 onShow() {
66 this.hideMask();
67 // console.log("onShow memberCode:", this.data.memberCode);
68 // console.log("onShow code:", this.data.code);
69 }, 76 },
70 77
71 initData() { 78 initData() {
......
...@@ -44,44 +44,96 @@ Page({ ...@@ -44,44 +44,96 @@ Page({
44 this.initData(); 44 this.initData();
45 }, 45 },
46 initData() { 46 initData() {
47 // this.queryMember().then((result) => {});
48 this.initOpenid();
49 },
50
51 /**
52 * 初始化Openid
53 * 发红包用 该段代码参考自 user-center.js
54 */
55 initOpenid() {
47 this.queryMember().then((result) => { 56 this.queryMember().then((result) => {
48 let auditStatus = this.data.userInfo && this.data.userInfo.auditStatus || ""; 57 let subscriptionOpenid = result.subscriptionOpenid;
49 // console.log("viplogin - auditStatus:", auditStatus); 58 if (subscriptionOpenid) {
50 let isModify = this.data.isModify; 59 // member表 已有openid 继续流程
51 // console.log("isModify:", isModify) 60 this.initVipLogin(); // 原有业务
52 if ((auditStatus == "authorization" || auditStatus == "unauthorized") && !isModify) {
53 // 未验证和待验证
54 app.router.push({
55 openType: "redirect",
56 path: "vipVerify"
57 })
58 } else { 61 } else {
59 this.getProvince(); 62 // member表无openid ,重h5授权回来的local拿,成功就继续往下走
60 this.getMemberType().then((result) => { 63 this.querySaveOpenid().then((result) => {
61 app.post({ 64 this.queryMember().then((result) => {
62 url: app.api.memberIdQuery, 65 this.initVipLogin(); // 原有业务
63 data: {},
64 }).then((result) => {
65 let verifyInfo = result;
66 this.setData({
67 name: verifyInfo.realName,
68 mobile: verifyInfo.phone,
69 province: verifyInfo.province,
70 city: verifyInfo.city,
71 memberTypeCode: verifyInfo.memberTypeCode,
72 memberTypeName: verifyInfo.memberTypeName,
73 files: [{
74 path: verifyInfo.images
75 }]
76 })
77 }) 66 })
78 }) 67 }).catch((err) => {
68 // 如果均没有,则去h5授权
69 app.router.push({
70 path: "webview"
71 })
72 });
79 } 73 }
74 });
75 },
80 76
77 /**
78 * 初始化VipLogin 原initData内容
79 */
80 initVipLogin() {
81 let auditStatus = this.data.userInfo && this.data.userInfo.auditStatus || "";
82 let isModify = this.data.isModify;
83 if ((auditStatus == "authorization" || auditStatus == "unauthorized") && !isModify) {
84 // 未验证和待验证
85 app.router.push({
86 openType: "redirect",
87 path: "vipVerify"
88 })
89 } else {
90 this.getProvince();
91 this.getMemberType().then((result) => {
92 app.post({
93 url: app.api.memberIdQuery,
94 data: {},
95 }).then((result) => {
96 let verifyInfo = result;
97 this.setData({
98 name: verifyInfo.realName,
99 mobile: verifyInfo.phone,
100 province: verifyInfo.province,
101 city: verifyInfo.city,
102 memberTypeCode: verifyInfo.memberTypeCode,
103 memberTypeName: verifyInfo.memberTypeName,
104 files: [{
105 path: verifyInfo.images
106 }]
107 })
108 })
109 })
110 }
111 },
81 112
82 113 /**
83 }) 114 * 保存openid
84 115 */
116 querySaveOpenid() {
117 return new Promise((resolve, reject) => {
118 let openid = app.store.getItem("openid");
119 if (openid) {
120 app.post({
121 toast: false,
122 url: app.api.saveOpenid,
123 data: {
124 subscriptionOpenid: openid
125 }
126 }).then((result) => {
127 console.log("result:", result);
128 app.store.clear("openid");
129 resolve();
130 }).catch((err) => {
131 reject();
132 });
133 } else {
134 reject();
135 }
136 });
85 }, 137 },
86 138
87 /** 139 /**
......