Commit fc6778821a4f9b50e51e6f2a63a081e77672d807

Authored by pengye
1 parent b06748ed

邀请函无法进入问题处理

Showing 1 changed file with 247 additions and 245 deletions
@@ -6,16 +6,16 @@ import util from '../../utils/util' @@ -6,16 +6,16 @@ import util from '../../utils/util'
6 const {regeneratorRuntime} = global 6 const {regeneratorRuntime} = global
7 Page({ 7 Page({
8 8
9 - /**  
10 - * 页面的初始数据  
11 - */  
12 - data: {  
13 - loadHidden: false,  
14 - }, 9 + /**
  10 + * 页面的初始数据
  11 + */
  12 + data: {
  13 + loadHidden: false,
  14 + },
15 15
16 - /**  
17 - * 生命周期函数--监听页面加载  
18 - */ 16 + /**
  17 + * 生命周期函数--监听页面加载
  18 + */
19 islove: '',//用户在哪端 19 islove: '',//用户在哪端
20 enter_params: '',//商户入口参数 20 enter_params: '',//商户入口参数
21 isInvitation: false,//客户经理 21 isInvitation: false,//客户经理
@@ -24,109 +24,110 @@ Page({ @@ -24,109 +24,110 @@ Page({
24 //转化场景值到opt 24 //转化场景值到opt
25 this.selectComponent("#network").debug(opt, 'opt'); 25 this.selectComponent("#network").debug(opt, 'opt');
26 if (opt.scene) {//扫码进入 26 if (opt.scene) {//扫码进入
27 - let query = decodeURIComponent(opt.scene);  
28 - query.split('&').forEach(q => {  
29 - let _q = q.split('=');  
30 - opt[_q[0]] = _q[1];  
31 - })  
32 - this.selectComponent("#network").debug(opt, 'scene');  
33 - }  
34 - if (opt.act == 'tobook') {//消息跳入运营处理预订  
35 - delete opt.act  
36 - console.log('optopt',opt);  
37 - return this.redirectTo({url: util.http_build_query(opt, '/pack-book/pages/book/b_index')});  
38 - }  
39 - mta.Page.init({  
40 - "appID": "500667280",  
41 - "eventID": "500667287",  
42 - "statPullDownFresh": true,  
43 - "statShareApp": true,  
44 - "statReachBottom": true,  
45 - "lauchOpts": opt, //渠道分析  
46 - });  
47 - opt.openid = await this.getOpenid();  
48 - if (!opt.openid) {  
49 - console.log('App.Orders.CheckOrder no openid');  
50 - this.selectComponent("#network").refresh();  
51 - return;  
52 - }  
53 - if(opt.act=='coupon'){  
54 - return wx.redirectTo({  
55 - url:'../me/coupon_news'  
56 - })  
57 - }  
58 - if(opt.act=='order'){  
59 - return wx.redirectTo({  
60 - url:'../me/list'  
61 - })  
62 - }  
63 - if (opt.islove) {  
64 - util.cache('islove', opt.islove);  
65 - this.islove = opt.islove  
66 - } else {  
67 - this.islove = await util.cache('islove')  
68 - }  
69 - this.usi = {data: {seller: {}, invitation: {}}}  
70 - try {  
71 - this.usi = await App.Invitation.UserIdentity({openid: opt.openid});  
72 - } catch (e) {  
73 - console.log('App.Invitation.UserIdentity no usi');  
74 - }  
75 - this.options = opt  
76 - setTimeout(() => {  
77 - this.initRun();  
78 - }, 2000)  
79 - },  
80 - async initRun() {  
81 - let opt = this.options  
82 - let usi=this.usi  
83 - if (usi.data.seller.flag) {//商户  
84 - util.cache('sellerid',usi.data.data.seller_id)  
85 - //获得商户数据  
86 - //this.enter_params=await this.SellerForOpenid(opt.openid);  
87 - this.enter_params = usi.data.data;  
88 - util.cache('enter_params',this.enter_params)  
89 - }  
90 - if (usi.data.invitation.flag) {//已是客户经理  
91 - this.isInvitation = true;  
92 - }  
93 - //console.log('this.enter_params',this.enter_params)  
94 - let url = '/pages/reserve/index_new';  
95 - if (opt.id > 0 || opt.sms_code) {  
96 - if (opt.invite_name) {  
97 - let invite_names = wx.getStorageSync('invite_names') || {};  
98 - invite_names[opt.id] = opt.invite_name;  
99 - wx.setStorage({  
100 - key: 'invite_names',  
101 - data: invite_names 27 + let query = decodeURIComponent(opt.scene);
  28 + query.split('&').forEach(q => {
  29 + let _q = q.split('=');
  30 + opt[_q[0]] = _q[1];
  31 + })
  32 + this.selectComponent("#network").debug(opt, 'scene');
  33 + }
  34 + if (opt.act == 'tobook') {//消息跳入运营处理预订
  35 + delete opt.act
  36 + console.log('optopt',opt);
  37 + return this.redirectTo({url: util.http_build_query(opt, '/pack-book/pages/book/b_index')});
  38 + }
  39 + mta.Page.init({
  40 + "appID": "500667280",
  41 + "eventID": "500667287",
  42 + "statPullDownFresh": true,
  43 + "statShareApp": true,
  44 + "statReachBottom": true,
  45 + "lauchOpts": opt, //渠道分析
102 }); 46 });
103 - }  
104 - let param = {  
105 - openid: opt.openid,  
106 - }  
107 - if (opt.sms_code) {  
108 - param.code = opt.sms_code;  
109 - } else {  
110 - param.rid = opt.id  
111 - }  
112 -  
113 - App.Reserve.Detail(param).then(res => {  
114 - console.log(res.data.note_openid, this.enter_params.seller_openid)  
115 - if (this.enter_params) {//商户  
116 - //if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的  
117 - if (res.data.note_openid == this.enter_params.seller_openid && opt.hasSellerShare == 1) {//不是客户端分享,且是记录人  
118 - util.cache('enter_params', this.enter_params)  
119 - //url = '/pages/book/b_detail';  
120 - url = '/pack-book/pages/book/b_invitation';  
121 - } 47 + opt.openid = await this.getOpenid();
  48 + if (!opt.openid) {
  49 + console.log('App.Orders.CheckOrder no openid');
  50 + this.selectComponent("#network").refresh();
  51 + return;
  52 + }
  53 + if(opt.act=='coupon'){
  54 + return wx.redirectTo({
  55 + url:'../me/coupon_news'
  56 + })
  57 + }
  58 + if(opt.act=='order'){
  59 + return wx.redirectTo({
  60 + url:'../me/list'
  61 + })
  62 + }
  63 + if (opt.islove) {
  64 + util.cache('islove', opt.islove);
  65 + this.islove = opt.islove
  66 + } else {
  67 + this.islove = await util.cache('islove')
122 } 68 }
123 - if (url != '/pack-book/pages/book/b_invitation') {  
124 - //设置关系  
125 - App.Reserve.SetRelaOpenid({  
126 - rid: res.data.id,  
127 - openid: opt.openid,  
128 - fromid: opt.fromid ? opt.fromid : ''  
129 - }) 69 + this.usi = {data: {seller: {}, invitation: {}}}
  70 + try {
  71 + this.usi = await App.Invitation.UserIdentity({openid: opt.openid});
  72 + } catch (e) {
  73 + console.log('App.Invitation.UserIdentity no usi');
  74 + }
  75 + this.options = opt
  76 + setTimeout(() => {
  77 + this.initRun();
  78 + }, 2000)
  79 + },
  80 + async initRun() {
  81 + let opt = this.options
  82 + let usi=this.usi
  83 + if (usi.data.seller.flag) {//商户
  84 + util.cache('sellerid',usi.data.data.seller_id)
  85 + //获得商户数据
  86 + //this.enter_params=await this.SellerForOpenid(opt.openid);
  87 + this.enter_params = usi.data.data;
  88 + util.cache('enter_params',this.enter_params)
  89 + }
  90 + if (usi.data.invitation.flag) {//已是客户经理
  91 + this.isInvitation = true;
  92 + }
  93 + //console.log('this.enter_params',this.enter_params)
  94 + let url = '/pages/reserve/index_new';
  95 + if (opt.id > 0 || opt.sms_code) {
  96 + if (opt.invite_name) {
  97 + let invite_names = wx.getStorageSync('invite_names') || {};
  98 + invite_names[opt.id] = opt.invite_name;
  99 + wx.setStorage({
  100 + key: 'invite_names',
  101 + data: invite_names
  102 + });
  103 + }
  104 + let param = {
  105 + openid: opt.openid,
  106 + }
  107 + if (opt.sms_code) {
  108 + param.code = opt.sms_code;
  109 + } else {
  110 + param.rid = opt.id
  111 + }
  112 +
  113 + App.Reserve.Detail(param).then(res => {
  114 + let configType = res.data.seller.temp_config_type
  115 + console.log(res.data.note_openid, this.enter_params.seller_openid)
  116 + if (this.enter_params) {//商户
  117 + //if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的
  118 + if (res.data.note_openid == this.enter_params.seller_openid && opt.hasSellerShare == 1) {//不是客户端分享,且是记录人
  119 + util.cache('enter_params', this.enter_params)
  120 + //url = '/pages/book/b_detail';
  121 + url = '/pack-book/pages/book/b_invitation';
  122 + }
  123 + }
  124 + if (url != '/pack-book/pages/book/b_invitation') {
  125 + //设置关系
  126 + App.Reserve.SetRelaOpenid({
  127 + rid: res.data.id,
  128 + openid: opt.openid,
  129 + fromid: opt.fromid ? opt.fromid : ''
  130 + })
130 if(opt.uid && opt.uid!=''){ 131 if(opt.uid && opt.uid!=''){
131 App.Activity.SetRelation({ 132 App.Activity.SetRelation({
132 uid:opt.uid, 133 uid:opt.uid,
@@ -144,157 +145,158 @@ Page({ @@ -144,157 +145,158 @@ Page({
144 console.log('type',res.data.seller.temp_config_type); 145 console.log('type',res.data.seller.temp_config_type);
145 let configType=res.data.seller.temp_config_type 146 let configType=res.data.seller.temp_config_type
146 console.log('configType',configType); 147 console.log('configType',configType);
147 - let arr = [9, 10, 11, 12, 13, 14, 15, 16, 17];  
148 - if (!res.data.openid) {//无预订人  
149 - if (opt.hasInvitation == 1 && configType) {  
150 - let style =arr.includes(parseInt(configType))  
151 - if (!style) {  
152 - url = '/pack-invitation/pages/detail_owner_invitation' + configType;  
153 - } else {  
154 - url = '/pack-invitation/pages/detail_owner_invitation9';  
155 - }  
156 - if(configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';  
157 - if(configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';  
158 - if(configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';  
159 - } else {  
160 - url = '/pack-invitation/pages/detail_owner_invitation1'; 148 + let arr = [9, 10, 11, 12, 13, 14, 15, 16, 17];
  149 + if (!res.data.openid) {//无预订人
  150 + if (opt.hasInvitation == 1 && configType) {
  151 + let style =arr.includes(parseInt(configType))
  152 + if (!style) {
  153 + url = '/pack-invitation/pages/detail_owner_invitation' + configType;
  154 + } else {
  155 + url = '/pack-invitation/pages/detail_owner_invitation9';
  156 + }
  157 + if(configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';
  158 + if(configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';
  159 + if(configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';
  160 + } else {
  161 + url = '/pack-invitation/pages/detail_owner_invitation1';
  162 + }
  163 + } else {
  164 + if (opt.hasInvitation == 1 && configType) {
  165 + let style =arr.includes(parseInt(configType))
  166 + if (!style) {
  167 + url = '/pack-invitation/pages/detail_owner_invitation' + configType;
  168 + } else {
  169 + url = '/pack-invitation/pages/detail_owner_invitation9';
  170 + }
  171 + if (configType == '18' || configType == '21') url = '/pack-invitation/pages/detail_owner_invitation11';
  172 + if (configType == '19' || configType == '22') url = '/pack-invitation/pages/detail_owner_invitation12';
  173 + if (configType == '20') url = '/pack-invitation/pages/detail_owner_invitation10';
  174 + } else if (res.data.openid == opt.openid) {
  175 + url = '/pages/customer/detail_owner';
  176 + } else {
  177 + url = '/pages/customer/detail_invitation';
  178 + }
  179 + }
  180 + }
  181 + if (!opt.tplid || typeof opt.tplid == 'undefined' || opt.tplid == 'undefined') {
  182 + opt.tplid = 1
  183 + }
  184 + console.log(opt,'hhhhh')
  185 + url += '?id=' + res.data.id + '&tplid=' + opt.tplid;
  186 + if(opt.uid && opt.uid!=''){
  187 + url+='&uid='+opt.uid;
  188 + }
  189 + if(configType == '18' || configType == '19') url += '&bookType=1';
  190 + if(configType == '21' || configType == '22') url += '&bookType=2';
  191 + console.log('wx.redirectTo', url, res);
  192 + this.redirectTo({url: url});
  193 + })
  194 + } else {
  195 + if (this.enter_params && this.islove != 'customer' && this.islove != 'invitation') {
  196 + //商户且未手动切换到顾客端或客户经理
  197 + wx.reLaunch({
  198 + url: util.http_build_query(this.enter_params, '/pack-book/pages/reservation/reservation')
  199 + })
  200 + return;
161 } 201 }
162 - } else {  
163 - if (opt.hasInvitation == 1 && configType) {  
164 - let style =arr.includes(parseInt(configType))  
165 - if (!style) {  
166 - url = '/pack-invitation/pages/detail_owner_invitation' + configType;  
167 - } else {  
168 - url = '/pack-invitation/pages/detail_owner_invitation9';  
169 - }  
170 - } else if (res.data.openid == opt.openid) {  
171 - url = '/pages/customer/detail_owner';  
172 - } else {  
173 - url = '/pages/customer/detail_invitation'; 202 + if (this.isInvitation && this.islove != 'customer' && this.islove != 'book') {
  203 + //客户经理且未手动切换到顾客端或商户
  204 + wx.reLaunch({
  205 + url: '/pages/manager-invitation/review'
  206 + })
  207 + return;
174 } 208 }
175 - } 209 + console.log('url', url);
  210 + this.redirectTo({url: url});
176 } 211 }
177 - if (!opt.tplid || typeof opt.tplid == 'undefined' || opt.tplid == 'undefined') {  
178 - opt.tplid = 1 212 + },
  213 + redirectTo(red) {
  214 + console.log('this.redirectTo', red);
  215 + if (red.url.indexOf('me/list') > 0
  216 + || red.url.indexOf('reserve/search') > 0
  217 + || red.url.indexOf('reserve/index_new') > 0) {
  218 + wx.redirectTo(red);
  219 + } else {
  220 + wx.redirectTo(red);
179 } 221 }
180 - console.log(opt,'hhhhh')  
181 - url += '?id=' + res.data.id + '&tplid=' + opt.tplid;  
182 - if(opt.uid && opt.uid!=''){  
183 - url+='&uid='+opt.uid;  
184 - }  
185 - if(configType == '18' || configType == '19') url += '&bookType=1';  
186 - if(configType == '21' || configType == '22') url += '&bookType=2';  
187 - console.log('wx.redirectTo', url, res);  
188 - this.redirectTo({url: url});  
189 - }).catch(res => {  
190 - this.redirectTo({url: url});  
191 - })  
192 - } else {  
193 - if (this.enter_params && this.islove != 'customer' && this.islove != 'invitation') {  
194 - //商户且未手动切换到顾客端或客户经理  
195 - wx.reLaunch({  
196 - url: util.http_build_query(this.enter_params, '/pack-book/pages/reservation/reservation')  
197 - })  
198 - return;  
199 - }  
200 - if (this.isInvitation && this.islove != 'customer' && this.islove != 'book') {  
201 - //客户经理且未手动切换到顾客端或商户  
202 - wx.reLaunch({  
203 - url: '/pages/manager-invitation/review'  
204 - })  
205 - return;  
206 - }  
207 - console.log('url', url);  
208 - this.redirectTo({url: url});  
209 - }  
210 - },  
211 - redirectTo(red) {  
212 - console.log('this.redirectTo', red);  
213 - if (red.url.indexOf('me/list') > 0  
214 - || red.url.indexOf('reserve/search') > 0  
215 - || red.url.indexOf('reserve/index_new') > 0) {  
216 - wx.redirectTo(red);  
217 - } else {  
218 - wx.redirectTo(red);  
219 - }  
220 - },  
221 - /**  
222 - * 生命周期函数--监听页面初次渲染完成  
223 - */  
224 - onReady: function () { 222 + },
  223 + /**
  224 + * 生命周期函数--监听页面初次渲染完成
  225 + */
  226 + onReady: function () {
225 227
226 - }, 228 + },
227 229
228 - /**  
229 - * 生命周期函数--监听页面显示  
230 - */  
231 - onShow: function () { 230 + /**
  231 + * 生命周期函数--监听页面显示
  232 + */
  233 + onShow: function () {
232 234
233 - }, 235 + },
234 236
235 - /**  
236 - * 生命周期函数--监听页面隐藏  
237 - */  
238 - onHide: function () { 237 + /**
  238 + * 生命周期函数--监听页面隐藏
  239 + */
  240 + onHide: function () {
239 241
240 - }, 242 + },
241 243
242 - /**  
243 - * 生命周期函数--监听页面卸载  
244 - */  
245 - onUnload: function () { 244 + /**
  245 + * 生命周期函数--监听页面卸载
  246 + */
  247 + onUnload: function () {
246 248
247 - }, 249 + },
248 250
249 - /**  
250 - * 页面相关事件处理函数--监听用户下拉动作  
251 - */  
252 - onPullDownRefresh: function () { 251 + /**
  252 + * 页面相关事件处理函数--监听用户下拉动作
  253 + */
  254 + onPullDownRefresh: function () {
253 255
254 - }, 256 + },
255 257
256 - /**  
257 - * 页面上拉触底事件的处理函数  
258 - */  
259 - onReachBottom: function () { 258 + /**
  259 + * 页面上拉触底事件的处理函数
  260 + */
  261 + onReachBottom: function () {
260 262
261 - }, 263 + },
262 264
263 - /**  
264 - * 用户点击右上角分享  
265 - */  
266 - onShareAppMessage: function () { 265 + /**
  266 + * 用户点击右上角分享
  267 + */
  268 + onShareAppMessage: function () {
267 269
268 - },  
269 - async getOpenid() {  
270 - let openid = await getApp().getOpenid();  
271 - return openid;  
272 - },  
273 - async SellerForOpenid(openid) {  
274 - let enter_params = '';  
275 - let res = await App.Reserve.SellerForOpenid({openid: openid});  
276 - if (res.data && res.data.seller_id) {  
277 - enter_params = res.data;  
278 - }  
279 - if (enter_params) {  
280 - return enter_params;  
281 - }  
282 - // if(enter_params) {  
283 - // console.log('seller_enter_params', enter_params)  
284 - // wx.reLaunch({  
285 - // url:util.http_build_query(enter_params,'/pages/book/b_index')  
286 - // })  
287 - // return true  
288 - // }  
289 - return false  
290 - },  
291 - networkEvent(e) {  
292 - console.log('networkEvent', e.detail);  
293 - if (!e.detail.hasWork) {  
294 - this.setData({  
295 - loadHidden: true,  
296 - })  
297 - } 270 + },
  271 + async getOpenid() {
  272 + let openid = await getApp().getOpenid();
  273 + return openid;
  274 + },
  275 + async SellerForOpenid(openid) {
  276 + let enter_params = '';
  277 + let res = await App.Reserve.SellerForOpenid({openid: openid});
  278 + if (res.data && res.data.seller_id) {
  279 + enter_params = res.data;
  280 + }
  281 + if (enter_params) {
  282 + return enter_params;
  283 + }
  284 + // if(enter_params) {
  285 + // console.log('seller_enter_params', enter_params)
  286 + // wx.reLaunch({
  287 + // url:util.http_build_query(enter_params,'/pages/book/b_index')
  288 + // })
  289 + // return true
  290 + // }
  291 + return false
  292 + },
  293 + networkEvent(e) {
  294 + console.log('networkEvent', e.detail);
  295 + if (!e.detail.hasWork) {
  296 + this.setData({
  297 + loadHidden: true,
  298 + })
  299 + }
298 300
299 - }, 301 + },
300 }) 302 })