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