|
|
|
1
|
+// pack-invitation/pages/detail_owner_invitation10.js
|
|
|
|
2
|
+var mta = require('mta-wechat-analysis')
|
|
|
|
3
|
+import util from '../../utils/util';
|
|
|
|
4
|
+import App from '../../utils/api';
|
|
|
|
5
|
+import TP from '../../utils/tpls';
|
|
|
|
6
|
+import RS from '../../utils/reserveStatus'
|
|
|
|
7
|
+var plugin = requirePlugin("WechatSI");
|
|
|
|
8
|
+import canvas from "../../pages/customer/canvas"
|
|
|
|
9
|
+Page({
|
|
|
|
10
|
+ /**
|
|
|
|
11
|
+ * 页面的初始数据
|
|
|
|
12
|
+ */
|
|
|
|
13
|
+ data: {
|
|
|
|
14
|
+ options: {
|
|
|
|
15
|
+ tplid: ''
|
|
|
|
16
|
+ },
|
|
|
|
17
|
+ tableNum: 0,
|
|
|
|
18
|
+ detail: {},
|
|
|
|
19
|
+ staffinfo: {},
|
|
|
|
20
|
+ chef: {},
|
|
|
|
21
|
+ marketing: {},
|
|
|
|
22
|
+ home: {},
|
|
|
|
23
|
+ reserve: {},
|
|
|
|
24
|
+ signboard: {},
|
|
|
|
25
|
+ store: {},
|
|
|
|
26
|
+ recharge_data: {},
|
|
|
|
27
|
+ coupon_dataList: [],
|
|
|
|
28
|
+ seller: {},
|
|
|
|
29
|
+ priceInfo: '',
|
|
|
|
30
|
+ scoreInfo: '',
|
|
|
|
31
|
+ certificate: '',
|
|
|
|
32
|
+ dataStr: Date.now() * 1 / 1000,
|
|
|
|
33
|
+ swich_phone: '0', //是否显示前台电话
|
|
|
|
34
|
+ is_user_comments: false, //是否评价过 true有评价 false没评价
|
|
|
|
35
|
+ tableinfo: [], //桌子列表
|
|
|
|
36
|
+ roomimage: [], //包间图片列表
|
|
|
|
37
|
+ StyleType: '', //邀请函模板
|
|
|
|
38
|
+ showMoreTip: true, //显示滑动查看更多
|
|
|
|
39
|
+ hasValueOrder: false, //商家是否开通提前点餐功能
|
|
|
|
40
|
+ hasValueCertificate: false, //商家是否开通优惠券功能
|
|
|
|
41
|
+ hasValueRecharge: false, //商家是否开通充值功能
|
|
|
|
42
|
+ hasValueBroadcast: false, //商家是否能播报,只有极速版不能播报
|
|
|
|
43
|
+ _attentionAnim: {},
|
|
|
|
44
|
+ isPlay: '1', //语音播报 1运行 2暂停
|
|
|
|
45
|
+ paymentStatus: '', //定金支付状态 1支付 0未支付
|
|
|
|
46
|
+ reserveData: {}, //自定义图文数据
|
|
|
|
47
|
+ toastBool: false, //支付定金提示框
|
|
|
|
48
|
+ toastText: '', //支付定金提示文字
|
|
|
|
49
|
+ paymentId: '', //定金id
|
|
|
|
50
|
+ wxml: null,
|
|
|
|
51
|
+ imgSrc: '', //canvas图片地址
|
|
|
|
52
|
+ couponData: '', //评价赠送优惠券数据
|
|
|
|
53
|
+ timeList: [], //餐段时间
|
|
|
|
54
|
+ temp_ddate: '', //展示的到店时间
|
|
|
|
55
|
+ lite_style: '', //小程序转发卡片样式
|
|
|
|
56
|
+ isMoreBtn: '', //再次预订按钮
|
|
|
|
57
|
+ isPaymenBtn: '', //支付定金按钮
|
|
|
|
58
|
+ isShareItem: '', //转发客人按钮
|
|
|
|
59
|
+ isVoice: '', //播报按钮
|
|
|
|
60
|
+ openOrder: '', //点餐
|
|
|
|
61
|
+ isComments: '', //券和充值
|
|
|
|
62
|
+ markers: [], //地图标注
|
|
|
|
63
|
+ },
|
|
|
|
64
|
+ tablestr: '', //桌位id拼接
|
|
|
|
65
|
+ urlsValue: [], //包间预览图片列表
|
|
|
|
66
|
+ screenHeight: '',
|
|
|
|
67
|
+ attentionAnim: {},
|
|
|
|
68
|
+ audioCtx: '', //播报
|
|
|
|
69
|
+ timers: null, // 动画定时器
|
|
|
|
70
|
+ n: 0,
|
|
|
|
71
|
+ modal: '',
|
|
|
|
72
|
+ /**
|
|
|
|
73
|
+ * 生命周期函数--监听页面加载
|
|
|
|
74
|
+ */
|
|
|
|
75
|
+ onLoad(options) {
|
|
|
|
76
|
+ this.id = options.id
|
|
|
|
77
|
+ let param = {
|
|
|
|
78
|
+ options: options,
|
|
|
|
79
|
+ hasOwner: options.hasSellerShare == 1, //是否为发起人
|
|
|
|
80
|
+ }
|
|
|
|
81
|
+ param.tpls = [TP.tpls(options.tplid)]
|
|
|
|
82
|
+ console.log('param', param);
|
|
|
|
83
|
+ console.log('options', options);
|
|
|
|
84
|
+ this.setData(param)
|
|
|
|
85
|
+ mta.Page.init({
|
|
|
|
86
|
+ "appID": "500667280",
|
|
|
|
87
|
+ "eventID": "500667287",
|
|
|
|
88
|
+ "statPullDownFresh": true,
|
|
|
|
89
|
+ "statShareApp": true,
|
|
|
|
90
|
+ "statReachBottom": true,
|
|
|
|
91
|
+ "lauchOpts": options, //渠道分析
|
|
|
|
92
|
+ });
|
|
|
|
93
|
+ const systemInfo = wx.getSystemInfoSync();
|
|
|
|
94
|
+ this.screenHeight = systemInfo.windowHeight; // 获取屏幕高度
|
|
|
|
95
|
+ this.modal = this.selectComponent("#payModal"); //通过给组件所起的id调用组件
|
|
|
|
96
|
+ wx.onUserCaptureScreen((res) => {
|
|
|
|
97
|
+ this.modal.showModal()
|
|
|
|
98
|
+ })
|
|
|
|
99
|
+ },
|
|
|
|
100
|
+ //预览图片
|
|
|
|
101
|
+ previewImage(e) {
|
|
|
|
102
|
+ const item = e.target.dataset;
|
|
|
|
103
|
+ wx.previewImage({
|
|
|
|
104
|
+ current: item.url,
|
|
|
|
105
|
+ urls: item.imgs,
|
|
|
|
106
|
+ })
|
|
|
|
107
|
+ },
|
|
|
|
108
|
+ // 打开截屏弹框
|
|
|
|
109
|
+ showModal() {
|
|
|
|
110
|
+ this.modal.showModal()
|
|
|
|
111
|
+ },
|
|
|
|
112
|
+ // 关闭截屏弹框
|
|
|
|
113
|
+ closeModal() {
|
|
|
|
114
|
+ this.modal.closeModal()
|
|
|
|
115
|
+ },
|
|
|
|
116
|
+ // 页面滚动事件
|
|
|
|
117
|
+ onPageScroll: function (event) {
|
|
|
|
118
|
+ const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
|
|
|
|
119
|
+ if (scrollTop < this.screenHeight) {
|
|
|
|
120
|
+ this.setData({
|
|
|
|
121
|
+ showMoreTip: true
|
|
|
|
122
|
+ });
|
|
|
|
123
|
+ } else {
|
|
|
|
124
|
+ this.setData({
|
|
|
|
125
|
+ showMoreTip: false
|
|
|
|
126
|
+ });
|
|
|
|
127
|
+ }
|
|
|
|
128
|
+ },
|
|
|
|
129
|
+ // 点击了解更多会员优惠政策
|
|
|
|
130
|
+ gotoFavourableList() {
|
|
|
|
131
|
+ let url = util.http_build_query({
|
|
|
|
132
|
+ sellerName: this.data.seller.name,
|
|
|
|
133
|
+ sellerid: this.data.seller.sid,
|
|
|
|
134
|
+ oid: this.data.detail.id,
|
|
|
|
135
|
+ types: '1'
|
|
|
|
136
|
+ }, '/pack-cookbook/pages/favourableList')
|
|
|
|
137
|
+ wx.navigateTo({
|
|
|
|
138
|
+ url
|
|
|
|
139
|
+ })
|
|
|
|
140
|
+ },
|
|
|
|
141
|
+ // 去评价
|
|
|
|
142
|
+ evaluateFun() {
|
|
|
|
143
|
+ let url = util.http_build_query({
|
|
|
|
144
|
+ sellerName: this.data.seller.name,
|
|
|
|
145
|
+ sellerid: this.data.seller.sid,
|
|
|
|
146
|
+ oid: this.data.detail.id,
|
|
|
|
147
|
+ types: '1',
|
|
|
|
148
|
+ previousPage: '1',
|
|
|
|
149
|
+ }, '/pages/pinglun/createOpinion')
|
|
|
|
150
|
+ wx.navigateTo({
|
|
|
|
151
|
+ url
|
|
|
|
152
|
+ })
|
|
|
|
153
|
+ },
|
|
|
|
154
|
+ /**
|
|
|
|
155
|
+ * 用户点击右上角分享
|
|
|
|
156
|
+ */
|
|
|
|
157
|
+ onShareAppMessage: function () {
|
|
|
|
158
|
+ return this.sharesetting();
|
|
|
|
159
|
+ },
|
|
|
|
160
|
+ /**
|
|
|
|
161
|
+ * 监听用户点击分享到朋友圈按钮的操作
|
|
|
|
162
|
+ */
|
|
|
|
163
|
+ onShareTimeline() {
|
|
|
|
164
|
+ return this.sharesetting();
|
|
|
|
165
|
+ },
|
|
|
|
166
|
+ /**
|
|
|
|
167
|
+ * 生命周期函数--监听页面显示
|
|
|
|
168
|
+ */
|
|
|
|
169
|
+ onShow: function () {
|
|
|
|
170
|
+ this.getDetail()
|
|
|
|
171
|
+ this.getText()
|
|
|
|
172
|
+ this.getPaymentStatus()
|
|
|
|
173
|
+ },
|
|
|
|
174
|
+ // 复制微信号
|
|
|
|
175
|
+ copyWeChat() {
|
|
|
|
176
|
+ if (this.data.staffinfo.wechat) {
|
|
|
|
177
|
+ wx.setClipboardData({
|
|
|
|
178
|
+ data: this.data.staffinfo.wechat,
|
|
|
|
179
|
+ success(res) {
|
|
|
|
180
|
+ wx.getClipboardData({
|
|
|
|
181
|
+ success(res) {
|
|
|
|
182
|
+ console.log(res.data)
|
|
|
|
183
|
+ }
|
|
|
|
184
|
+ })
|
|
|
|
185
|
+ }
|
|
|
|
186
|
+ })
|
|
|
|
187
|
+ } else {
|
|
|
|
188
|
+ console.log('无微信号')
|
|
|
|
189
|
+ }
|
|
|
|
190
|
+ },
|
|
|
|
191
|
+ // 拨打电话
|
|
|
|
192
|
+ call(e) {
|
|
|
|
193
|
+ const phone = e.currentTarget.dataset['phone'];
|
|
|
|
194
|
+ wx.reportMonitor('1012', 1)
|
|
|
|
195
|
+ wx.makePhoneCall({
|
|
|
|
196
|
+ phoneNumber: phone
|
|
|
|
197
|
+ })
|
|
|
|
198
|
+ },
|
|
|
|
199
|
+ // 跳转到商家入驻页
|
|
|
|
200
|
+ gotoJoinSeller() {
|
|
|
|
201
|
+ wx.navigateTo({
|
|
|
|
202
|
+ url: util.http_build_query({
|
|
|
|
203
|
+ laiyuan: '邀请函'
|
|
|
|
204
|
+ }, '/pages/customer/joinSeller')
|
|
|
|
205
|
+ })
|
|
|
|
206
|
+ },
|
|
|
|
207
|
+ // 导航
|
|
|
|
208
|
+ looklocation: function () {
|
|
|
|
209
|
+ wx.reportMonitor('1015', 1)
|
|
|
|
210
|
+ wx.openLocation({
|
|
|
|
211
|
+ latitude: Number(this.data.seller.lat),
|
|
|
|
212
|
+ longitude: Number(this.data.seller.long),
|
|
|
|
213
|
+ scale: 17,
|
|
|
|
214
|
+ address: this.data.seller.addr,
|
|
|
|
215
|
+ success: function (res) {
|
|
|
|
216
|
+ console.log(res)
|
|
|
|
217
|
+ }
|
|
|
|
218
|
+ })
|
|
|
|
219
|
+ },
|
|
|
|
220
|
+ // 获取包间图片列表
|
|
|
|
221
|
+ getroomimage(sellerid) {
|
|
|
|
222
|
+ App.Tables.GetTablesPhoto({
|
|
|
|
223
|
+ sellerid,
|
|
|
|
224
|
+ tableids: this.tablestr
|
|
|
|
225
|
+ }).then((json) => {
|
|
|
|
226
|
+ if (json.ret == 200) {
|
|
|
|
227
|
+ this.setData({
|
|
|
|
228
|
+ roomimage: json.data
|
|
|
|
229
|
+ })
|
|
|
|
230
|
+ var urlsArr = [];
|
|
|
|
231
|
+ json.data.forEach((v, i) => {
|
|
|
|
232
|
+ urlsArr.push(v.url);
|
|
|
|
233
|
+ })
|
|
|
|
234
|
+ this.urlsValue = urlsArr;
|
|
|
|
235
|
+ console.log('包间图片地址urlsArr', urlsArr)
|
|
|
|
236
|
+ console.log('包间信息数组roomimage', json.data)
|
|
|
|
237
|
+ }
|
|
|
|
238
|
+ })
|
|
|
|
239
|
+ },
|
|
|
|
240
|
+ // 预览包间图片
|
|
|
|
241
|
+ lookroom(e) {
|
|
|
|
242
|
+ const item = e.currentTarget.dataset['item'];
|
|
|
|
243
|
+ wx.previewImage({
|
|
|
|
244
|
+ current: item.url, // 当前显示图片的http链接
|
|
|
|
245
|
+ urls: this.urlsValue, // 需要预览的图片http链接列表
|
|
|
|
246
|
+ })
|
|
|
|
247
|
+ },
|
|
|
|
248
|
+ // 预览其他图片
|
|
|
|
249
|
+ lookImgs(e) {
|
|
|
|
250
|
+ const url = e.currentTarget.dataset['url'];
|
|
|
|
251
|
+ const imgs = e.currentTarget.dataset['imgs'];
|
|
|
|
252
|
+ let urls = imgs ? imgs : [url]
|
|
|
|
253
|
+ wx.previewImage({
|
|
|
|
254
|
+ current: url,
|
|
|
|
255
|
+ urls,
|
|
|
|
256
|
+ })
|
|
|
|
257
|
+ },
|
|
|
|
258
|
+ // 获取店铺详情
|
|
|
|
259
|
+ getDetail() {
|
|
|
|
260
|
+ App.Reserve.Detail({
|
|
|
|
261
|
+ openid: getApp().openid,
|
|
|
|
262
|
+ rid: this.data.options.id
|
|
|
|
263
|
+ }).then(res => {
|
|
|
|
264
|
+ let tablesText = '', //桌子信息
|
|
|
|
265
|
+ deskStr = '',
|
|
|
|
266
|
+ tableNum = 0;
|
|
|
|
267
|
+ let tableinfo = util.determine(res.data.tableinfo);
|
|
|
|
268
|
+ console.log('tableinfo', tableinfo);
|
|
|
|
269
|
+ res.data.tables.forEach((t, i) => {
|
|
|
|
270
|
+ tableNum += t.table_pnum * 1
|
|
|
|
271
|
+ tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
|
|
|
|
272
|
+ deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
|
|
|
|
273
|
+ })
|
|
|
|
274
|
+ let tabaleids = [];
|
|
|
|
275
|
+ res.data.tables.forEach(t => {
|
|
|
|
276
|
+ tabaleids.push(t.id);
|
|
|
|
277
|
+ })
|
|
|
|
278
|
+ this.tablestr = tabaleids.toString();
|
|
|
|
279
|
+ let reserev = RS.reserve(res.data)
|
|
|
|
280
|
+ let dateSmart = util.unixtoTime(reserev.ddate, 'YYYY-MM-DD 星期WW');
|
|
|
|
281
|
+ let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
|
|
|
|
282
|
+ let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
|
|
|
|
283
|
+ let dateStr = util.unixtoTime(reserev.ddate, 'HH点')
|
|
|
|
284
|
+ let dateStrDivide = util.unixtoTime(reserev.ddate, 'II分')
|
|
|
|
285
|
+ console.log('dateSmart', dateSmart);
|
|
|
|
286
|
+ let detail = this.formatDatail(reserev, dateSmart)
|
|
|
|
287
|
+ this.setData({
|
|
|
|
288
|
+ detail,
|
|
|
|
289
|
+ tableNum,
|
|
|
|
290
|
+ tableinfo,
|
|
|
|
291
|
+ is_user_comments: res.data.is_user_comments,
|
|
|
|
292
|
+ temp_ddate: this.data.temp_ddate ? this.data.temp_ddate : reserev.temp_ddate ? util.unixtoTime(reserev.temp_ddate, 'HH:II') : util.unixtoTime(reserev.ddate, 'HH:II'),
|
|
|
|
293
|
+ openOrder: (detail && detail.status != '4' && this.data.options.isOrder != '1' && detail.seller && detail.seller.is_open_order == 1) ? '1' : '0',
|
|
|
|
294
|
+ markers: [{
|
|
|
|
295
|
+ id: 0,
|
|
|
|
296
|
+ name: reserev.seller.sellername,
|
|
|
|
297
|
+ address: reserev.seller.real_address || reserev.seller.map_address,
|
|
|
|
298
|
+ latitude: reserev.seller.lat,
|
|
|
|
299
|
+ longitude: reserev.seller.long,
|
|
|
|
300
|
+ width: 40,
|
|
|
|
301
|
+ height: 60
|
|
|
|
302
|
+ }],
|
|
|
|
303
|
+ seller: {
|
|
|
|
304
|
+ daily: reserev.seller.daily,
|
|
|
|
305
|
+ name: reserev.seller.sellername,
|
|
|
|
306
|
+ sid: reserev.sid,
|
|
|
|
307
|
+ date: dateSmart,
|
|
|
|
308
|
+ tablesText,
|
|
|
|
309
|
+ addr: reserev.seller.real_address || reserev.seller.map_address,
|
|
|
|
310
|
+ image: reserev.image_url,
|
|
|
|
311
|
+ hasOwner: true,
|
|
|
|
312
|
+ type: reserev.type,
|
|
|
|
313
|
+ is_set_ddate: reserev.is_set_ddate,
|
|
|
|
314
|
+ hasUpTime: reserev.type == 1 && reserev.hasRunning && reserev.status != 2,
|
|
|
|
315
|
+ tel: reserev.seller.seller_tel.split(','),
|
|
|
|
316
|
+ soltName: reserev.soltName,
|
|
|
|
317
|
+ dateTime: util.unixtoTime(reserev.ddate, 'HH:II'),
|
|
|
|
318
|
+ time: util.unixtoTime(reserev.ddate, '星期WW HH:II'),
|
|
|
|
319
|
+ lat: reserev.seller.lat,
|
|
|
|
320
|
+ long: reserev.seller.long,
|
|
|
|
321
|
+ yearMonthDay,
|
|
|
|
322
|
+ yearMonth,
|
|
|
|
323
|
+ dateStr,
|
|
|
|
324
|
+ deskStr,
|
|
|
|
325
|
+ dateStrDivide: dateStrDivide == '00分' ? '' : dateStrDivide,
|
|
|
|
326
|
+ seller_tel: reserev.seller.seller_tel,
|
|
|
|
327
|
+ }
|
|
|
|
328
|
+ })
|
|
|
|
329
|
+ console.log('reserev信息', reserev);
|
|
|
|
330
|
+ console.log('seller信息', this.data.seller);
|
|
|
|
331
|
+ console.log('detail信息', this.data.detail);
|
|
|
|
332
|
+ setTimeout(() => {
|
|
|
|
333
|
+ this.getstaffinfo(res.data.uid, reserev.sid);
|
|
|
|
334
|
+ this.getroomimage(reserev.sid)
|
|
|
|
335
|
+ this.getSellerVersionFun(reserev.sid);
|
|
|
|
336
|
+ }, 0);
|
|
|
|
337
|
+ }).catch(res => {
|
|
|
|
338
|
+ console.log(res, '详情请求失败');
|
|
|
|
339
|
+ })
|
|
|
|
340
|
+ },
|
|
|
|
341
|
+ // 获取商家版本,不是超能版或者没有开通对应模块,不显示
|
|
|
|
342
|
+ getSellerVersionFun(sellerid) {
|
|
|
|
343
|
+ App.SellerVersion.GetSellerVersion({
|
|
|
|
344
|
+ sellerid
|
|
|
|
345
|
+ }).then((res) => {
|
|
|
|
346
|
+ let data = res.data;
|
|
|
|
347
|
+ console.log('版本列表', data);
|
|
|
|
348
|
+ if (data && data.length > 0) {
|
|
|
|
349
|
+ data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
|
|
|
|
350
|
+ // 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
|
|
|
|
351
|
+ let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
|
|
|
|
352
|
+ console.log('当前版本', {
|
|
|
|
353
|
+ ...obj
|
|
|
|
354
|
+ });
|
|
|
|
355
|
+ // 提前点餐功能:超能版 || 有提前点餐模块
|
|
|
|
356
|
+ const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
|
|
|
|
357
|
+ // 优惠券功能:超能版 || 高级版 || 有优惠券模块
|
|
|
|
358
|
+ const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
|
|
|
|
359
|
+ // 充值功能:超能版 || 有充值模块
|
|
|
|
360
|
+ const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
|
|
|
|
361
|
+ // 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
|
|
|
|
362
|
+ const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
|
|
|
|
363
|
+ this.setData({
|
|
|
|
364
|
+ hasValueOrder,
|
|
|
|
365
|
+ hasValueCertificate,
|
|
|
|
366
|
+ hasValueRecharge,
|
|
|
|
367
|
+ hasValueBroadcast,
|
|
|
|
368
|
+ })
|
|
|
|
369
|
+ }
|
|
|
|
370
|
+ })
|
|
|
|
371
|
+ },
|
|
|
|
372
|
+ // 通过预订ID查收定金详情
|
|
|
|
373
|
+ getPaymentStatus() {
|
|
|
|
374
|
+ App.Reserve.GetReserveDepositByRid({
|
|
|
|
375
|
+ rid: this.data.options.id
|
|
|
|
376
|
+ }).then(res => {
|
|
|
|
377
|
+ if (res.ret == 200 && res.data && res.data.length > 0) {
|
|
|
|
378
|
+ let data = res.data[0];
|
|
|
|
379
|
+ let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0';
|
|
|
|
380
|
+ let options = this.data.options
|
|
|
|
381
|
+ this.setData({
|
|
|
|
382
|
+ paymentId: data.id,
|
|
|
|
383
|
+ paymentStatus,
|
|
|
|
384
|
+ isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1',
|
|
|
|
385
|
+ })
|
|
|
|
386
|
+ }
|
|
|
|
387
|
+ })
|
|
|
|
388
|
+ },
|
|
|
|
389
|
+ // 获取自定义图文内容
|
|
|
|
390
|
+ getText() {
|
|
|
|
391
|
+ App.Reserve.GetReserveImgText({
|
|
|
|
392
|
+ rid: this.data.options.id
|
|
|
|
393
|
+ }).then(res => {
|
|
|
|
394
|
+ if (res.ret == 200 && res.data) {
|
|
|
|
395
|
+ let data = res.data;
|
|
|
|
396
|
+ let content = util.determine(data.content)
|
|
|
|
397
|
+ console.log('自定义图文内容content', content);
|
|
|
|
398
|
+ this.setData({
|
|
|
|
399
|
+ reserveData: {
|
|
|
|
400
|
+ title: data.title || '',
|
|
|
|
401
|
+ content,
|
|
|
|
402
|
+ }
|
|
|
|
403
|
+ })
|
|
|
|
404
|
+ }
|
|
|
|
405
|
+ })
|
|
|
|
406
|
+ },
|
|
|
|
407
|
+ // 点击支付定金
|
|
|
|
408
|
+ paymentFun() {
|
|
|
|
409
|
+ let that = this;
|
|
|
|
410
|
+ App.PayOnline.CombineTransactionsByDeposit({
|
|
|
|
411
|
+ id: this.data.paymentId,
|
|
|
|
412
|
+ openid: getApp().openid,
|
|
|
|
413
|
+ }).then(res => {
|
|
|
|
414
|
+ if (res.ret == 200) {
|
|
|
|
415
|
+ wx.requestPayment({
|
|
|
|
416
|
+ timeStamp: res.data.timeStamp + '',
|
|
|
|
417
|
+ nonceStr: res.data.nonceStr,
|
|
|
|
418
|
+ package: res.data.package,
|
|
|
|
419
|
+ signType: res.data.signType,
|
|
|
|
420
|
+ paySign: res.data.paySign,
|
|
|
|
421
|
+ success(ress) {
|
|
|
|
422
|
+ console.log('微信支付结果', ress);
|
|
|
|
423
|
+ if (ress.errMsg == 'requestPayment:ok') {
|
|
|
|
424
|
+ console.log('支付成功', ress);
|
|
|
|
425
|
+ that.setData({
|
|
|
|
426
|
+ paymentStatus: '1',
|
|
|
|
427
|
+ toastBool: true,
|
|
|
|
428
|
+ toastText: '支付成功'
|
|
|
|
429
|
+ })
|
|
|
|
430
|
+ that.hideToast();
|
|
|
|
431
|
+ return
|
|
|
|
432
|
+ }
|
|
|
|
433
|
+ console.log('支付失败1', ress);
|
|
|
|
434
|
+ that.setData({
|
|
|
|
435
|
+ toastBool: true,
|
|
|
|
436
|
+ toastText: '支付失败,请重新支付'
|
|
|
|
437
|
+ })
|
|
|
|
438
|
+ that.hideToast();
|
|
|
|
439
|
+ },
|
|
|
|
440
|
+ fail(ress) {
|
|
|
|
441
|
+ console.log('支付失败2', ress);
|
|
|
|
442
|
+ that.setData({
|
|
|
|
443
|
+ toastBool: true,
|
|
|
|
444
|
+ toastText: '支付失败,请重新支付'
|
|
|
|
445
|
+ })
|
|
|
|
446
|
+ that.hideToast();
|
|
|
|
447
|
+ },
|
|
|
|
448
|
+ })
|
|
|
|
449
|
+ } else {
|
|
|
|
450
|
+ wx.showToast({
|
|
|
|
451
|
+ title: res.msg,
|
|
|
|
452
|
+ icon: 'none',
|
|
|
|
453
|
+ })
|
|
|
|
454
|
+ }
|
|
|
|
455
|
+ })
|
|
|
|
456
|
+ },
|
|
|
|
457
|
+ // 关闭支付失败或者成功弹框
|
|
|
|
458
|
+ hideToast() {
|
|
|
|
459
|
+ setTimeout(() => {
|
|
|
|
460
|
+ this.setData({
|
|
|
|
461
|
+ toastBool: false
|
|
|
|
462
|
+ })
|
|
|
|
463
|
+ }, 1500)
|
|
|
|
464
|
+ },
|
|
|
|
465
|
+ // 客户经理获取基本信息
|
|
|
|
466
|
+ getstaffinfo(uid, sid) {
|
|
|
|
467
|
+ App.Activity.GetCustomerActivityBaseinfo({
|
|
|
|
468
|
+ sellerid: this.data.detail.seller.id,
|
|
|
|
469
|
+ uid
|
|
|
|
470
|
+ }).then((json) => {
|
|
|
|
471
|
+ if (json.ret == 200) {
|
|
|
|
472
|
+ console.log('经理信息staffinfo', json.data)
|
|
|
|
473
|
+ this.setData({
|
|
|
|
474
|
+ staffinfo: json.data
|
|
|
|
475
|
+ })
|
|
|
|
476
|
+ this.getSellerTemplateConfFun(sid);
|
|
|
|
477
|
+ }
|
|
|
|
478
|
+ })
|
|
|
|
479
|
+ },
|
|
|
|
480
|
+ // 提前点餐
|
|
|
|
481
|
+ cookbook() {
|
|
|
|
482
|
+ if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
|
|
|
|
483
|
+ let data = {
|
|
|
|
484
|
+ rid: this.id,
|
|
|
|
485
|
+ oid: this.data.detail.order.id,
|
|
|
|
486
|
+ sellerName: this.data.seller.name,
|
|
|
|
487
|
+ sid: this.data.seller.sid,
|
|
|
|
488
|
+ identity: '1',
|
|
|
|
489
|
+ hasSuccess: '1',
|
|
|
|
490
|
+ }
|
|
|
|
491
|
+ wx.navigateTo({
|
|
|
|
492
|
+ url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
|
|
|
|
493
|
+ })
|
|
|
|
494
|
+ } else {
|
|
|
|
495
|
+ App.Advance.CreateOrder({
|
|
|
|
496
|
+ rid: this.id,
|
|
|
|
497
|
+ openid: getApp().openid,
|
|
|
|
498
|
+ }).then(res => {
|
|
|
|
499
|
+ if (res.ret != 200) {
|
|
|
|
500
|
+ return util.toast(res.msg, 'none')
|
|
|
|
501
|
+ }
|
|
|
|
502
|
+ wx.navigateTo({
|
|
|
|
503
|
+ url: util.http_build_query({
|
|
|
|
504
|
+ rid: this.id,
|
|
|
|
505
|
+ oid: res.data.id,
|
|
|
|
506
|
+ sid: res.data.sellerid,
|
|
|
|
507
|
+ sellerName: this.data.seller.name,
|
|
|
|
508
|
+ identity: '1',
|
|
|
|
509
|
+ }, '/pack-cookbook/pages/index_new')
|
|
|
|
510
|
+ });
|
|
|
|
511
|
+ })
|
|
|
|
512
|
+ }
|
|
|
|
513
|
+ },
|
|
|
|
514
|
+ // 生成海报
|
|
|
|
515
|
+ painterBtn(img, sellerName, date, time) {
|
|
|
|
516
|
+ img = img.replace(/^http:/, "https:");
|
|
|
|
517
|
+ this.setData({
|
|
|
|
518
|
+ wxml: canvas({
|
|
|
|
519
|
+ imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
|
|
|
|
520
|
+ sellerName,
|
|
|
|
521
|
+ date,
|
|
|
|
522
|
+ time,
|
|
|
|
523
|
+ })
|
|
|
|
524
|
+ })
|
|
|
|
525
|
+ },
|
|
|
|
526
|
+ onImgOK(e) {
|
|
|
|
527
|
+ this.setData({
|
|
|
|
528
|
+ imgSrc: e.detail.path
|
|
|
|
529
|
+ })
|
|
|
|
530
|
+ console.log('海报生成成功', this.data.imgSrc);
|
|
|
|
531
|
+ },
|
|
|
|
532
|
+ // 分享
|
|
|
|
533
|
+ sharesetting() {
|
|
|
|
534
|
+ wx.reportMonitor('1017', 1)
|
|
|
|
535
|
+ this.closeModal()
|
|
|
|
536
|
+ let parmdata = {
|
|
|
|
537
|
+ id: this.id,
|
|
|
|
538
|
+ fromid: getApp().openid,
|
|
|
|
539
|
+ hasInvitation: 1,
|
|
|
|
540
|
+ tplid: this.data.options.tplid
|
|
|
|
541
|
+ }
|
|
|
|
542
|
+ if (this.data.options.uid) {
|
|
|
|
543
|
+ parmdata.uid = this.data.options.uid;
|
|
|
|
544
|
+ }
|
|
|
|
545
|
+ return {
|
|
|
|
546
|
+ title: '我已订好' + this.data.seller.name + ',点击可查看详情并导航到店',
|
|
|
|
547
|
+ path: util.http_build_query(parmdata, '/pages/customer/detail_owner_invitation_new'),
|
|
|
|
548
|
+ imageUrl: this.data.imgSrc || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
|
|
|
|
549
|
+ }
|
|
|
|
550
|
+ },
|
|
|
|
551
|
+ // 修改detail数据
|
|
|
|
552
|
+ formatDatail(details, dateSmart) {
|
|
|
|
553
|
+ details.rdateStr = dateSmart;
|
|
|
|
554
|
+ details.tableFirst = details.tables[0].name;
|
|
|
|
555
|
+ if (details.tables.length > 1) {
|
|
|
|
556
|
+ details.tableSubInfo = '等' + (details.tables.length) + '个' +
|
|
|
|
557
|
+ (details.tables[0].tid == 2 ? '包间' : '');
|
|
|
|
558
|
+ }
|
|
|
|
559
|
+ details.rname = details.rname.trim()
|
|
|
|
560
|
+ if (details.rname && details.sex != 3) {
|
|
|
|
561
|
+ details.rnameStr = details.rname + (details.sex == 1 ? '先生' : details.sex == 2 ? '女士' : details.sex == 4 ? '贵宾' : '')
|
|
|
|
562
|
+ } else if (!details.rname && details.sex == 4) {
|
|
|
|
563
|
+ details.rnameStr = '贵宾'
|
|
|
|
564
|
+ } else {
|
|
|
|
565
|
+ details.rnameStr = details.rname
|
|
|
|
566
|
+ }
|
|
|
|
567
|
+ details.eatStr = '邀请您共进晚餐';
|
|
|
|
568
|
+ let hi = util.unixtoTime(details.ddate, 'HHII');
|
|
|
|
569
|
+ if (hi < '10:00') {
|
|
|
|
570
|
+ details.eatStr = '邀请您共进早餐';
|
|
|
|
571
|
+ } else if (hi < '15:00') {
|
|
|
|
572
|
+ details.eatStr = '邀请您共进午餐';
|
|
|
|
573
|
+ }
|
|
|
|
574
|
+ return details;
|
|
|
|
575
|
+ },
|
|
|
|
576
|
+ // 获取商家设置营销信息
|
|
|
|
577
|
+ getSellerTemplateConfFun(sid) {
|
|
|
|
578
|
+ App.Seller.GetSellerTemplateConf({
|
|
|
|
579
|
+ sid
|
|
|
|
580
|
+ }).then(res => {
|
|
|
|
581
|
+ let data = res.data
|
|
|
|
582
|
+ let couponList = []
|
|
|
|
583
|
+ let StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
|
|
|
|
584
|
+ chef = util.determine(data.chef);
|
|
|
|
585
|
+ reserve = util.determine(data.reserve);
|
|
|
|
586
|
+ marketing = util.determine(data.marketing);
|
|
|
|
587
|
+ signboard = util.determine(data.signboard);
|
|
|
|
588
|
+ store = util.determine(data.store);
|
|
|
|
589
|
+ home = util.determine(data.home);
|
|
|
|
590
|
+ StyleType = data.type;
|
|
|
|
591
|
+ swich_phone = reserve && reserve.swich_phone ? reserve.swich_phone : '';
|
|
|
|
592
|
+ if (store) store.content = (store.is_introduce_all == '1' && store.content) ? util.determine(store.content) : '';
|
|
|
|
593
|
+ if (chef) chef.content = (chef.is_introduce_all == '1' && chef.content) ? util.determine(chef.content) : '';
|
|
|
|
594
|
+ if (signboard) signboard.content = (signboard.is_introduce_all == '1' && signboard.content) ? util.determine(signboard.content) : '';
|
|
|
|
595
|
+ if (reserve) reserve.content = (reserve.is_introduce_all == '1' && reserve.content) ? util.determine(reserve.content) : '';
|
|
|
|
596
|
+ if (home) home.image = (home && home.image && (!home.id_first_image || home.id_first_image != '0')) ? home.image : '';
|
|
|
|
597
|
+ if (marketing) {
|
|
|
|
598
|
+ marketing.logo = (marketing.logo && (!marketing.is_logo || marketing.is_logo != '0')) ? marketing.logo : '';
|
|
|
|
599
|
+ is_comments = marketing.is_comments ? marketing.is_comments : '';
|
|
|
|
600
|
+ coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
|
|
|
|
601
|
+ let info = marketing.coupon_data_comments ? util.determine(marketing.coupon_data_comments) : '';
|
|
|
|
602
|
+ let couponDataId = info && info.length > 0 ? info[0].id : {}
|
|
|
|
603
|
+ // 根据券ID获取评价赠送的券详情
|
|
|
|
604
|
+ if (couponDataId) this.getEvaluateFun(couponDataId)
|
|
|
|
605
|
+ }
|
|
|
|
606
|
+ // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
607
|
+ if (coupon && util.getType(coupon) == 'object') {
|
|
|
|
608
|
+ couponList.push({
|
|
|
|
609
|
+ id: coupon.id
|
|
|
|
610
|
+ });
|
|
|
|
611
|
+ }
|
|
|
|
612
|
+ if (coupon && util.getType(coupon) == 'array') {
|
|
|
|
613
|
+ if (coupon.length > 0) {
|
|
|
|
614
|
+ coupon.forEach(item => {
|
|
|
|
615
|
+ couponList.push({
|
|
|
|
616
|
+ id: item.id
|
|
|
|
617
|
+ })
|
|
|
|
618
|
+ })
|
|
|
|
619
|
+ }
|
|
|
|
620
|
+ }
|
|
|
|
621
|
+ // 根据券ID获取券详情
|
|
|
|
622
|
+ this.getActivityByIdFun(couponList, couponList.length)
|
|
|
|
623
|
+ // 根据充值ID获取充值详情
|
|
|
|
624
|
+ if (marketing && marketing.is_recharge && marketing.is_recharge == '1' && marketing.recharge_data) {
|
|
|
|
625
|
+ this.getRechargeDetail(marketing.recharge_data.id)
|
|
|
|
626
|
+ }
|
|
|
|
627
|
+ if (store && store.images && store.images.length > 0) store.images = util.determine(store.images);
|
|
|
|
628
|
+ if (reserve && reserve.park_info_images && reserve.park_info_images.length > 0) reserve.park_info_images = util.determine(reserve.park_info_images);
|
|
|
|
629
|
+ if (signboard && signboard.images && signboard.images.length > 0) signboard.images = util.determine(signboard.images);
|
|
|
|
630
|
+ if (reserve) reserve = this.processInfo(reserve, '1')
|
|
|
|
631
|
+ if (store) store = this.processInfo(store, '2')
|
|
|
|
632
|
+ if (signboard) signboard = this.processInfo(signboard, '3')
|
|
|
|
633
|
+ if (chef) chef = this.processInfo(chef, '4')
|
|
|
|
634
|
+ let solt = this.data.detail.ddate_solt;
|
|
|
|
635
|
+ let lunchDis = this.data.seller.daily;
|
|
|
|
636
|
+ let timeList = []
|
|
|
|
637
|
+ var morningStr = lunchDis.morning.split("-");
|
|
|
|
638
|
+ var morningArr = lunchDis.morning ? this.computeHour(morningStr[0], morningStr[1], 30) : [];
|
|
|
|
639
|
+ var noonStr = lunchDis.noon.split("-");
|
|
|
|
640
|
+ var noonArr = lunchDis.noon ? this.computeHour(noonStr[0], noonStr[1], 30) : [];
|
|
|
|
641
|
+ var nightStr = lunchDis.night.split("-");
|
|
|
|
642
|
+ var nightArr = lunchDis.night ? this.computeHour(nightStr[0], nightStr[1], 30) : [];
|
|
|
|
643
|
+ timeList = solt == '1' ? morningArr : solt == '2' ? noonArr : solt == '3' ? nightArr : []
|
|
|
|
644
|
+ let obj = {
|
|
|
|
645
|
+ chef,
|
|
|
|
646
|
+ marketing,
|
|
|
|
647
|
+ home,
|
|
|
|
648
|
+ reserve,
|
|
|
|
649
|
+ signboard,
|
|
|
|
650
|
+ store,
|
|
|
|
651
|
+ swich_phone,
|
|
|
|
652
|
+ StyleType,
|
|
|
|
653
|
+ lite_style: data.lite_style,
|
|
|
|
654
|
+ timeList,
|
|
|
|
655
|
+ isMoreBtn: marketing && marketing.is_online_book == '1' && this.data.options.onlineReserve == '1',
|
|
|
|
656
|
+ isShareItem: this.data.options.isOrder != '1' && marketing && marketing.is_transpond == '1',
|
|
|
|
657
|
+ isComments: is_comments == '1' && marketing && marketing.is_comments_coupon == '1',
|
|
|
|
658
|
+ }
|
|
|
|
659
|
+ console.log('GetSellerTemplateConf----------获取数据', {
|
|
|
|
660
|
+ ...obj
|
|
|
|
661
|
+ });
|
|
|
|
662
|
+ this.setData({
|
|
|
|
663
|
+ ...obj
|
|
|
|
664
|
+ })
|
|
|
|
665
|
+ // 开启语音播报
|
|
|
|
666
|
+ if (reserve && reserve.swich_voice == '1') {
|
|
|
|
667
|
+ this.setData({
|
|
|
|
668
|
+ isPlay: '1',
|
|
|
|
669
|
+ isVoice: '1',
|
|
|
|
670
|
+ })
|
|
|
|
671
|
+ this.textToSpeechFun(reserve.voice_info)
|
|
|
|
672
|
+ }
|
|
|
|
673
|
+ // 获取转发客人卡片设置
|
|
|
|
674
|
+ let detailInfo = this.data.detail;
|
|
|
|
675
|
+ if (data.lite_style == '0') {
|
|
|
|
676
|
+ this.setData({
|
|
|
|
677
|
+ imgSrc: detailInfo.seller.seller_image
|
|
|
|
678
|
+ })
|
|
|
|
679
|
+ } else {
|
|
|
|
680
|
+ let d = detailInfo.ddate_solt;
|
|
|
|
681
|
+ let time1 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '');
|
|
|
|
682
|
+ let time2;
|
|
|
|
683
|
+ if (this.data.temp_ddate) {
|
|
|
|
684
|
+ time2 = util.unixtoTime(detailInfo.ddate, '周WW') + this.data.temp_ddate
|
|
|
|
685
|
+ } else {
|
|
|
|
686
|
+ time2 = util.unixtoTime(detailInfo.ddate, '周WW HH:II')
|
|
|
|
687
|
+ }
|
|
|
|
688
|
+ let time3 = util.unixtoTime(detailInfo.ddate, '周WW') + ' ' + (d == '1' ? '早餐' : d == '2' ? '午餐' : d == '3' ? '晚餐' : '');
|
|
|
|
689
|
+ let time = data.lite_style == '1' ? time1 : data.lite_style == '2' ? time2 : data.lite_style == '3' ? time3 : '';
|
|
|
|
690
|
+ this.painterBtn(
|
|
|
|
691
|
+ detailInfo.seller.seller_image,
|
|
|
|
692
|
+ detailInfo.seller.sellername,
|
|
|
|
693
|
+ util.unixtoTime(detailInfo.ddate, 'MM月DD日'),
|
|
|
|
694
|
+ time
|
|
|
|
695
|
+ );
|
|
|
|
696
|
+ }
|
|
|
|
697
|
+ }).catch(res => {
|
|
|
|
698
|
+ console.log('GetSellerTemplateConf请求失败');
|
|
|
|
699
|
+ })
|
|
|
|
700
|
+ },
|
|
|
|
701
|
+ // 点击商家有礼
|
|
|
|
702
|
+ gotoSellerGift() {
|
|
|
|
703
|
+ let url = util.http_build_query({
|
|
|
|
704
|
+ id: this.data.detail.id,
|
|
|
|
705
|
+ }, '/pages/reserve/sellerGift')
|
|
|
|
706
|
+ wx.navigateTo({
|
|
|
|
707
|
+ url
|
|
|
|
708
|
+ })
|
|
|
|
709
|
+ },
|
|
|
|
710
|
+ // 再次预订
|
|
|
|
711
|
+ secondbook() {
|
|
|
|
712
|
+ wx.reportMonitor('1013', 1)
|
|
|
|
713
|
+ wx.redirectTo({
|
|
|
|
714
|
+ url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
|
|
|
|
715
|
+ })
|
|
|
|
716
|
+ },
|
|
|
|
717
|
+ // 文字转语音的方法
|
|
|
|
718
|
+ textToSpeechFun(voice_info) {
|
|
|
|
719
|
+ console.log('voice_info', voice_info);
|
|
|
|
720
|
+ let that = this;
|
|
|
|
721
|
+ let data = this.data;
|
|
|
|
722
|
+ data.detail.rname = data.detail.rname.trim()
|
|
|
|
723
|
+ let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
|
|
|
|
724
|
+ let charArray = data.seller.deskStr.split('');
|
|
|
|
725
|
+ let modifiedArray = charArray.map(char => char + ' ');
|
|
|
|
726
|
+ let resultString = modifiedArray.join('').slice(0, -1);
|
|
|
|
727
|
+ const replacements = {
|
|
|
|
728
|
+ "{年月日}": data.seller.yearMonthDay,
|
|
|
|
729
|
+ "{月日}": data.seller.yearMonth,
|
|
|
|
730
|
+ "{餐段}": data.seller.soltName,
|
|
|
|
731
|
+ "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
|
|
|
|
732
|
+ "{包间名}": resultString,
|
|
|
|
733
|
+ "{区域名+包间名}": data.seller.tablesText,
|
|
|
|
734
|
+ "{经理名字}": data.staffinfo.name,
|
|
|
|
735
|
+ "{客人姓名}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '',
|
|
|
|
736
|
+ "{预订日期}": data.seller.yearMonthDay,
|
|
|
|
737
|
+ "{桌位}": resultString,
|
|
|
|
738
|
+ };
|
|
|
|
739
|
+ let newStr = voice_info.replace(/{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
|
|
|
|
740
|
+ return replacements[matched];
|
|
|
|
741
|
+ });
|
|
|
|
742
|
+ console.log('文字转语音newStr', newStr);
|
|
|
|
743
|
+ plugin.textToSpeech({
|
|
|
|
744
|
+ lang: "zh_CN",
|
|
|
|
745
|
+ tts: true,
|
|
|
|
746
|
+ content: newStr,
|
|
|
|
747
|
+ success: function (res) {
|
|
|
|
748
|
+ that.filename = res.filename
|
|
|
|
749
|
+ that.speech()
|
|
|
|
750
|
+ },
|
|
|
|
751
|
+ fail: function (res) {
|
|
|
|
752
|
+ console.log("fail tts", res)
|
|
|
|
753
|
+ }
|
|
|
|
754
|
+ })
|
|
|
|
755
|
+ },
|
|
|
|
756
|
+ // 开启语音播报
|
|
|
|
757
|
+ speech() {
|
|
|
|
758
|
+ var attentionAnim = wx.createAnimation({
|
|
|
|
759
|
+ duration: 1000,
|
|
|
|
760
|
+ timingFunction: 'linear',
|
|
|
|
761
|
+ })
|
|
|
|
762
|
+ this.attentionAnim = attentionAnim
|
|
|
|
763
|
+ this.setData({
|
|
|
|
764
|
+ _attentionAnim: attentionAnim,
|
|
|
|
765
|
+ attentionAnim: attentionAnim.export()
|
|
|
|
766
|
+ })
|
|
|
|
767
|
+ this.audioCtx = wx.createInnerAudioContext()
|
|
|
|
768
|
+ this.audioCtx.src = this.filename
|
|
|
|
769
|
+ this.audioCtx.loop = true
|
|
|
|
770
|
+ this.audioCtx.play()
|
|
|
|
771
|
+ this.audioCtx.onPlay((e) => {
|
|
|
|
772
|
+ this.setData({
|
|
|
|
773
|
+ isPlay: this.audioCtx.paused ? '2' : '1'
|
|
|
|
774
|
+ })
|
|
|
|
775
|
+ })
|
|
|
|
776
|
+ this.audioCtx.onPause((e) => {
|
|
|
|
777
|
+ this.setData({
|
|
|
|
778
|
+ isPlay: this.audioCtx.paused ? '2' : '1'
|
|
|
|
779
|
+ })
|
|
|
|
780
|
+ })
|
|
|
|
781
|
+ clearInterval(this.timers)
|
|
|
|
782
|
+ this.animation()
|
|
|
|
783
|
+ },
|
|
|
|
784
|
+ // 持续旋转动画
|
|
|
|
785
|
+ animation() {
|
|
|
|
786
|
+ let that = this;
|
|
|
|
787
|
+ var time = setInterval(function () {
|
|
|
|
788
|
+ this.n = this.n + 1;
|
|
|
|
789
|
+ let attentionAnim = that.data._attentionAnim
|
|
|
|
790
|
+ attentionAnim.rotate(180 * (this.n)).step()
|
|
|
|
791
|
+ that.setData({
|
|
|
|
792
|
+ attentionAnim: attentionAnim.export(),
|
|
|
|
793
|
+ })
|
|
|
|
794
|
+ }.bind(this), 1000)
|
|
|
|
795
|
+ this.timers = time;
|
|
|
|
796
|
+ },
|
|
|
|
797
|
+ // 暂停/继续播放
|
|
|
|
798
|
+ stopMusic() {
|
|
|
|
799
|
+ if (this.data.isPlay == '2') { // 2 暂停状态
|
|
|
|
800
|
+ console.log("开始");
|
|
|
|
801
|
+ clearInterval(this.timers)
|
|
|
|
802
|
+ this.animation()
|
|
|
|
803
|
+ this.audioCtx.play() //开始
|
|
|
|
804
|
+ return;
|
|
|
|
805
|
+ }
|
|
|
|
806
|
+ if (this.data.isPlay == '1') { // 1 运行状态
|
|
|
|
807
|
+ console.log('暂停');
|
|
|
|
808
|
+ if (this.n % 2 != 0) {
|
|
|
|
809
|
+ this.n = this.n + 1;
|
|
|
|
810
|
+ let attentionAnim = this.data._attentionAnim;
|
|
|
|
811
|
+ attentionAnim.rotate(180 * this.n).step();
|
|
|
|
812
|
+ this.setData({
|
|
|
|
813
|
+ attentionAnim: attentionAnim.export(),
|
|
|
|
814
|
+ })
|
|
|
|
815
|
+ }
|
|
|
|
816
|
+ clearInterval(this.timers)
|
|
|
|
817
|
+ this.audioCtx.pause() //暂停
|
|
|
|
818
|
+ return;
|
|
|
|
819
|
+ }
|
|
|
|
820
|
+ },
|
|
|
|
821
|
+ // 根据充值ID获取充值详情
|
|
|
|
822
|
+ getRechargeDetail(id) {
|
|
|
|
823
|
+ App.Activity.GetNewRecharge({
|
|
|
|
824
|
+ id
|
|
|
|
825
|
+ }).then(res => {
|
|
|
|
826
|
+ let detail = res.data
|
|
|
|
827
|
+ let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
|
|
|
|
828
|
+ let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
|
|
|
|
829
|
+ let priceInfo, scoreInfo, certificate;
|
|
|
|
830
|
+ detail.recharge_list = recharge_list;
|
|
|
|
831
|
+ detail.exp_date = exp_date;
|
|
|
|
832
|
+ if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
|
|
|
|
833
|
+ if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
|
|
|
|
834
|
+ if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
|
|
|
|
835
|
+ let recharge_data = (this.data.dataStr < detail.etime * 1 && detail.is_open == '1') ? detail : ''
|
|
|
|
836
|
+ console.log('邀请函--------------充值', recharge_data);
|
|
|
|
837
|
+ this.setData({
|
|
|
|
838
|
+ recharge_data,
|
|
|
|
839
|
+ scoreInfo,
|
|
|
|
840
|
+ priceInfo,
|
|
|
|
841
|
+ certificate
|
|
|
|
842
|
+ })
|
|
|
|
843
|
+ })
|
|
|
|
844
|
+ },
|
|
|
|
845
|
+ // 获取评价赠送的券最新详情
|
|
|
|
846
|
+ getEvaluateFun(id) {
|
|
|
|
847
|
+ App.Activity.GetActivityById({
|
|
|
|
848
|
+ id
|
|
|
|
849
|
+ }).then(res => {
|
|
|
|
850
|
+ if (res.data.length > 0) {
|
|
|
|
851
|
+ let couponData = res.data[0]
|
|
|
|
852
|
+ couponData.use = couponData.use ? util.determine(couponData.use) : '';
|
|
|
|
853
|
+ couponData.exp_date = couponData.exp_date ? util.determine(couponData.exp_date) : '';
|
|
|
|
854
|
+ // showCoupon 代表赠送的券没过有效期 && 是开启状态
|
|
|
|
855
|
+ couponData.showCoupon = (this.data.dataStr < (couponData.etime * 1) && couponData.is_open == '1') ? '1' : '0';
|
|
|
|
856
|
+ console.log('邀请函--------------------评价赠送的优惠券', couponData);
|
|
|
|
857
|
+ this.setData({
|
|
|
|
858
|
+ couponData: res.data[0]
|
|
|
|
859
|
+ })
|
|
|
|
860
|
+ }
|
|
|
|
861
|
+ })
|
|
|
|
862
|
+ },
|
|
|
|
863
|
+ // 根据券ID获取券详情
|
|
|
|
864
|
+ getActivityByIdFun(ids, length) {
|
|
|
|
865
|
+ let coupon_dataList = [];
|
|
|
|
866
|
+ ids.forEach(i => {
|
|
|
|
867
|
+ App.Activity.GetActivityById({
|
|
|
|
868
|
+ id: i.id
|
|
|
|
869
|
+ }).then(res => {
|
|
|
|
870
|
+ if (res.data.length > 0) {
|
|
|
|
871
|
+ let detail = res.data[0];
|
|
|
|
872
|
+ detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
|
|
|
|
873
|
+ detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
|
|
|
|
874
|
+ detail.use = detail.use ? util.determine(detail.use) : '';
|
|
|
|
875
|
+ coupon_dataList.push(detail);
|
|
|
|
876
|
+ if (length === coupon_dataList.length) {
|
|
|
|
877
|
+ coupon_dataList = coupon_dataList.filter(item => {
|
|
|
|
878
|
+ return this.data.dataStr < (item.etime * 1) && item.is_open == '1'
|
|
|
|
879
|
+ })
|
|
|
|
880
|
+ console.log('邀请函--------------------优惠券', coupon_dataList);
|
|
|
|
881
|
+ this.setData({
|
|
|
|
882
|
+ coupon_dataList,
|
|
|
|
883
|
+ })
|
|
|
|
884
|
+ }
|
|
|
|
885
|
+ }
|
|
|
|
886
|
+ })
|
|
|
|
887
|
+ })
|
|
|
|
888
|
+ },
|
|
|
|
889
|
+ /**
|
|
|
|
890
|
+ * 生命周期函数--监听页面隐藏
|
|
|
|
891
|
+ */
|
|
|
|
892
|
+ onHide() {
|
|
|
|
893
|
+ clearInterval(this.timers)
|
|
|
|
894
|
+ if (this.audioCtx) {
|
|
|
|
895
|
+ this.audioCtx.destroy(); // 释放音频资源
|
|
|
|
896
|
+ }
|
|
|
|
897
|
+ },
|
|
|
|
898
|
+
|
|
|
|
899
|
+ /**
|
|
|
|
900
|
+ * 生命周期函数--监听页面卸载
|
|
|
|
901
|
+ */
|
|
|
|
902
|
+ onUnload() {
|
|
|
|
903
|
+ clearInterval(this.timers)
|
|
|
|
904
|
+ if (this.audioCtx) {
|
|
|
|
905
|
+ this.audioCtx.destroy(); // 释放音频资源
|
|
|
|
906
|
+ }
|
|
|
|
907
|
+ },
|
|
|
|
908
|
+ // 设置虚拟到店时间
|
|
|
|
909
|
+ bindPickerChange: function (e) {
|
|
|
|
910
|
+ let index = e.detail.value
|
|
|
|
911
|
+ let temp_ddate = this.data.timeList[index]
|
|
|
|
912
|
+ this.setData({
|
|
|
|
913
|
+ temp_ddate
|
|
|
|
914
|
+ })
|
|
|
|
915
|
+ let detailInfo = this.data.detail;
|
|
|
|
916
|
+ const reserveDate = new Date(detailInfo.ddate * 1000);
|
|
|
|
917
|
+ let reserveTime =
|
|
|
|
918
|
+ reserveDate.getFullYear() +
|
|
|
|
919
|
+ "-" +
|
|
|
|
920
|
+ (reserveDate.getMonth() + 1) +
|
|
|
|
921
|
+ "-" +
|
|
|
|
922
|
+ reserveDate.getDate();
|
|
|
|
923
|
+ let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000
|
|
|
|
924
|
+ App.Reserve.SetReserveTempDdate({
|
|
|
|
925
|
+ rid: this.id,
|
|
|
|
926
|
+ temp_ddate: times,
|
|
|
|
927
|
+ }).then(res => {
|
|
|
|
928
|
+ if (res.ret == 200) {
|
|
|
|
929
|
+ if (this.data.lite_style == '2') {
|
|
|
|
930
|
+ let time = (util.unixtoTime(detailInfo.ddate, '周WW') + temp_ddate) || (util.unixtoTime(detailInfo.ddate, '周WW') + this.data.timeList[index])
|
|
|
|
931
|
+ this.painterBtn(
|
|
|
|
932
|
+ detailInfo.seller.seller_image,
|
|
|
|
933
|
+ detailInfo.seller.sellername,
|
|
|
|
934
|
+ util.unixtoTime(detailInfo.ddate, 'MM月DD日'),
|
|
|
|
935
|
+ time
|
|
|
|
936
|
+ );
|
|
|
|
937
|
+ }
|
|
|
|
938
|
+ }
|
|
|
|
939
|
+ })
|
|
|
|
940
|
+ },
|
|
|
|
941
|
+ // ios 部分机型不兼容new Date() 转换字符串
|
|
|
|
942
|
+ getNewDate(data) {
|
|
|
|
943
|
+ if (typeof data === 'string') {
|
|
|
|
944
|
+ let arr = data.split(/[- : \/]/)
|
|
|
|
945
|
+ if (arr[1] !== undefined || arr[1] !== null) {
|
|
|
|
946
|
+ arr[1] = arr[1] - 1
|
|
|
|
947
|
+ }
|
|
|
|
948
|
+ return new Date(...arr)
|
|
|
|
949
|
+ }
|
|
|
|
950
|
+ return new Date(data || new Date())
|
|
|
|
951
|
+ },
|
|
|
|
952
|
+ //根据起始时间(获取时间时间段)
|
|
|
|
953
|
+ computeHour(time1, time2, interval) {
|
|
|
|
954
|
+ //time1 开始时间 time2结束时间 interval间隔时长
|
|
|
|
955
|
+ function getTimeList(time1, time2, interval) {
|
|
|
|
956
|
+ var timeList = [];
|
|
|
|
957
|
+ time1 = time1.split(":");
|
|
|
|
958
|
+ time2 = time2.split(":");
|
|
|
|
959
|
+ time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
|
|
|
|
960
|
+ time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
|
|
|
|
961
|
+ interval = interval * 60 * 1000;
|
|
|
|
962
|
+ while (time1 <= time2) {
|
|
|
|
963
|
+ timeList.push(time1.format("hh:mm"));
|
|
|
|
964
|
+ time1 = new Date(time1.getTime() + interval);
|
|
|
|
965
|
+ }
|
|
|
|
966
|
+ return timeList;
|
|
|
|
967
|
+ }
|
|
|
|
968
|
+ Date.prototype.format = function (format) {
|
|
|
|
969
|
+ var date = {
|
|
|
|
970
|
+ "M+": this.getMonth() + 1,
|
|
|
|
971
|
+ "d+": this.getDate(),
|
|
|
|
972
|
+ "h+": this.getHours(),
|
|
|
|
973
|
+ "m+": this.getMinutes(),
|
|
|
|
974
|
+ "s+": this.getSeconds(),
|
|
|
|
975
|
+ "q+": Math.floor((this.getMonth() + 3) / 3),
|
|
|
|
976
|
+ S: this.getMilliseconds(),
|
|
|
|
977
|
+ };
|
|
|
|
978
|
+ if (/(y+)/.test(format))
|
|
|
|
979
|
+ format = format.replace(
|
|
|
|
980
|
+ RegExp.$1,
|
|
|
|
981
|
+ (this.getFullYear() + "").substr(4 - RegExp.$1.length)
|
|
|
|
982
|
+ );
|
|
|
|
983
|
+ for (var k in date)
|
|
|
|
984
|
+ if (new RegExp("(" + k + ")").test(format))
|
|
|
|
985
|
+ format = format.replace(
|
|
|
|
986
|
+ RegExp.$1,
|
|
|
|
987
|
+ RegExp.$1.length == 1 ?
|
|
|
|
988
|
+ date[k] :
|
|
|
|
989
|
+ ("00" + date[k]).substr(("" + date[k]).length)
|
|
|
|
990
|
+ );
|
|
|
|
991
|
+ return format;
|
|
|
|
992
|
+ };
|
|
|
|
993
|
+ return getTimeList(time1, time2, interval);
|
|
|
|
994
|
+ },
|
|
|
|
995
|
+ // 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨)
|
|
|
|
996
|
+ processInfo(intel, type) {
|
|
|
|
997
|
+ let imgs = [];
|
|
|
|
998
|
+ intel.textInfo = '';
|
|
|
|
999
|
+ intel.imgsInfo = [];
|
|
|
|
1000
|
+ intel.videoImgsInfo = [];
|
|
|
|
1001
|
+ if (type == '1') {
|
|
|
|
1002
|
+ if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) {
|
|
|
|
1003
|
+ intel.textInfo = intel.park_info;
|
|
|
|
1004
|
+ imgs = intel.park_info_images
|
|
|
|
1005
|
+ }
|
|
|
|
1006
|
+ }
|
|
|
|
1007
|
+ if (type == '2') {
|
|
|
|
1008
|
+ imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : [];
|
|
|
|
1009
|
+ intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : '';
|
|
|
|
1010
|
+ }
|
|
|
|
1011
|
+ if (type == '3') {
|
|
|
|
1012
|
+ imgs = intel.images || []
|
|
|
|
1013
|
+ intel.textInfo = '';
|
|
|
|
1014
|
+ }
|
|
|
|
1015
|
+ if (type == '4') {
|
|
|
|
1016
|
+ imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : []
|
|
|
|
1017
|
+ intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : '';
|
|
|
|
1018
|
+ }
|
|
|
|
1019
|
+ intel.imgsInfo = imgs;
|
|
|
|
1020
|
+ intel.videoImgsInfo = imgs.map(url => ({
|
|
|
|
1021
|
+ type: "1",
|
|
|
|
1022
|
+ content: url,
|
|
|
|
1023
|
+ }));
|
|
|
|
1024
|
+ if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') {
|
|
|
|
1025
|
+ intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n');
|
|
|
|
1026
|
+ intel.imgsInfo = intel.content.filter(item => item.type === "1").map(item => item.content);
|
|
|
|
1027
|
+ intel.videoImgsInfo = intel.content.filter(item => (item.type === "1" || item.type === "3"));
|
|
|
|
1028
|
+ }
|
|
|
|
1029
|
+ return intel
|
|
|
|
1030
|
+ },
|
|
|
|
1031
|
+ /**
|
|
|
|
1032
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
1033
|
+ */
|
|
|
|
1034
|
+ onPullDownRefresh() {
|
|
|
|
1035
|
+
|
|
|
|
1036
|
+ },
|
|
|
|
1037
|
+
|
|
|
|
1038
|
+ /**
|
|
|
|
1039
|
+ * 页面上拉触底事件的处理函数
|
|
|
|
1040
|
+ */
|
|
|
|
1041
|
+ onReachBottom() {
|
|
|
|
1042
|
+
|
|
|
|
1043
|
+ },
|
|
|
|
1044
|
+}) |