jufubao-movie 1.0.39-beta14 → 1.0.39-beta16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-movie",
3
- "version": "1.0.39-beta14",
3
+ "version": "1.0.39-beta16",
4
4
  "private": false,
5
5
  "description": "聚福宝在线选座业务组件插件包",
6
6
  "main": "index.js",
@@ -56,6 +56,7 @@
56
56
  :is_not_show_price="is_not_show_price"
57
57
  @onGetFilm="handleGetFilm"
58
58
  @onGetSeatList="handleGetSeatList"
59
+ @onGetFilmPaiqi="handleGetFilmPaiqi"
59
60
  @onBuy="handleBuy"></xd-online-seat>
60
61
  </view>
61
62
  </view>
@@ -125,6 +126,37 @@
125
126
  }
126
127
  },
127
128
 
129
+ /**
130
+ * @description 获取排期数据
131
+ * @param resolve
132
+ */
133
+ handleGetFilmPaiqi(resolve){
134
+ const {filmId, cinemaId} = this;
135
+ this.$xdShowLoading({});
136
+ jfbRootExec("getCinemaSchedule", {
137
+ vm: this,
138
+ data: {cinema_id: cinemaId, film_id: filmId}
139
+ }).then(res=>{
140
+ this.paiQiData = res.schedule_data.map(item => {
141
+ item['name'] = item['date_name'];
142
+ item['paiqi_data'] = item['paiqi'].map(pp => {
143
+ pp['price'] = pp['sale_price'];
144
+ pp['jfb_film_id'] = pp['film_id'];
145
+ pp['jfb_cinema_id'] = pp['cinema_id'];
146
+ pp['data_id'] = pp['schedule_id'];
147
+ return pp;
148
+ });
149
+ return item;
150
+ });
151
+ resolve(this.paiQiData);
152
+ this.$xdHideLoading();
153
+ })
154
+ .catch(err=>{
155
+ console.error(err);
156
+ this.$xdHideLoading();
157
+ })
158
+ },
159
+
128
160
  getSeatStatus(request_seat_id) {
129
161
  this.$xdShowLoading({});
130
162
  jfbRootExec("getCinemaSeatsStatus", {
@@ -133,6 +165,10 @@
133
165
  request_seat_id: request_seat_id
134
166
  }
135
167
  }).then(res => {
168
+ // res['seat_code'] = 'P0007';
169
+ // res['seat_message'] = '当前场次有误,请您重新选择影片';
170
+ // res['seat_status'] = 'N'
171
+
136
172
  if (res.seat_status === 'Y') {
137
173
  this.$xdHideLoading()
138
174
  clearTimeout(this.timer)
@@ -140,17 +176,21 @@
140
176
  url: this.moviePayPath + `?order_id=${res.temp_order_id}`
141
177
  },true);
142
178
  return
143
- } else if (res.seat_status === 'N') {
179
+ }
180
+
181
+ //有错处理res.seat_status
182
+ else if (res.seat_status === 'N') {
144
183
  clearTimeout(this.timer)
145
184
  this.$xdHideLoading();
146
- this.$xdAlert({
147
- content: res.seat_message,
148
- time: 2500,
149
- isClose: false,
150
- zIndex: 5000
151
- })
152
- return
153
- }else{
185
+
186
+ if(res['seat_message']) res['error_msg'] = res['error_msg'] || res['seat_message'];
187
+ if(res['seat_code']) res['error_code'] = res['error_code'] || res['seat_code']
188
+
189
+ //检查是否报错
190
+ this.handleCheckStatusIsError(res);
191
+ return;
192
+ }
193
+ else{
154
194
  this.timer = setTimeout(() => {
155
195
  this.getSeatStatus(request_seat_id);
156
196
  }, ++this.time > 5 ? (Math.pow(2, (this.time - 4)) * 1000) : 3000)
@@ -160,6 +200,7 @@
160
200
  this.$xdHideLoading()
161
201
  })
162
202
  },
203
+
163
204
  /**
164
205
  * @description 监听事件变化
165
206
  * @param container {object} 业务组件对象自己
@@ -171,8 +212,12 @@
171
212
  if(this.isShowTitle === 'Y') this.yItem = 7;
172
213
  else this.yItem = 10;
173
214
  },
215
+
216
+ /**
217
+ * @description 获取排期与影片基础信息数据
218
+ * @param resolve
219
+ */
174
220
  handleGetFilm(resolve) {
175
- // console.log('11111', paiqi.result);
176
221
  const {filmId, cinemaId} = this;
177
222
  this.$xdShowLoading({});
178
223
  Promise.all([
@@ -195,7 +240,6 @@
195
240
  return item;
196
241
  });
197
242
  this.paiQiData = paiqi_data;
198
- // const {cinema_data, film_data} = res1;
199
243
  resolve({
200
244
  paiqi_data: paiqi_data,
201
245
  film_data: [{
@@ -225,6 +269,10 @@
225
269
  request_ident: this.request_ident
226
270
  }
227
271
  }).then(res => {
272
+ // res['error_code'] = 'P0002';
273
+ // res['error_msg'] = '当前场次有更新 <br/> 请您手动切换或由系统自动切换到下一场次。';
274
+ // res['status'] = 'E'
275
+
228
276
  if(res.status === "P"){
229
277
  if(!this.$root.$isShow) return;
230
278
  this.request_ident = res.request_ident;
@@ -234,32 +282,36 @@
234
282
  }, ++this.seatTime > 5 ? (Math.pow(2, (this.seatTime - 4)) * 1000) : 2000)
235
283
  return;
236
284
  }
285
+
237
286
  if(res.status === "E"){
238
- uni.showToast({
239
- title: res.error_message,
240
- icon: "none"
241
- })
287
+ this.handleCheckStatusIsError(res, ()=>{
288
+ resolve(null);
289
+ });
242
290
  this.$xdHideLoading();
243
291
  return;
244
292
  }
293
+
245
294
  let seatData = Object.assign({}, res, {
246
295
  seat: res.seat_data.map(item => {
247
296
  return item.seat_columns;
248
297
  })
249
- })
298
+ });
299
+
250
300
  resolve(seatData);
251
301
  this.$xdHideLoading();
252
302
  })
253
303
  },
304
+
254
305
  //去支付未完成订单
255
306
  handleToPay(res){
256
307
  const { temp_order_id, oms_order_id, pay_order_id } = res;
257
308
  this.$xdConfirm({
258
309
  styles: this.styles,
259
310
  width: '90%',
260
- content: '有未完成的订单',
261
- confirmText: '去支付',
262
- cancelText: '继续选座',
311
+ content: '您当前有一笔未即付款订单,<br/>请先处理!',
312
+ confirmText: '立即付款',
313
+ isHtml: true,
314
+ cancelText: '取消订单',
263
315
  showClose: false,
264
316
  success: (res) => {
265
317
  if (res.confirm) {
@@ -288,6 +340,60 @@
288
340
  })
289
341
  },
290
342
 
343
+ handleCheckStatusIsError({error_msg,error_message,error_code}, cb=null){
344
+ let msg = error_message || error_msg;
345
+ if(!msg) return false;
346
+
347
+ //是否切换场次
348
+ if(error_code === 'P0002') {
349
+ this.$xdConfirm({
350
+ content: msg,
351
+ zIndex: 5000,
352
+ isHtml: true,
353
+ isTitle:false,
354
+ cancelText:'手动切换',
355
+ confirmText:'自动切换',
356
+ msgIcon:'iconinformation',
357
+ success:(res)=>{
358
+ if(res.confirm) {
359
+ if(typeof cb === 'function') cb();
360
+ }
361
+ }
362
+ })
363
+ return true
364
+ }
365
+
366
+ //当前场次有误,请您重新选择影片
367
+ if(error_code === 'P0007') {
368
+ this.$xdConfirm({
369
+ content: msg,
370
+ zIndex: 5000,
371
+ cancel:false,
372
+ isHtml: true,
373
+ isTitle:false,
374
+ confirmText:'返回首页',
375
+ msgIcon:'iconinformation',
376
+ success:(res)=>{
377
+ if(res.confirm) {
378
+ this.$xdUniHelper.redirectTo({
379
+ url: this.$settings.index
380
+ })
381
+ }
382
+ }
383
+ })
384
+ return true
385
+ }
386
+
387
+ this.$xdAlert({
388
+ content: msg,
389
+ type: 'error',
390
+ time: 3000,
391
+ zIndex: 5000
392
+ })
393
+ this.$xdHideLoading({})
394
+ return true;
395
+ },
396
+
291
397
  handleBuy(item) {
292
398
  let postData = {
293
399
  schedule_id: this.scheduleId,
@@ -301,16 +407,28 @@
301
407
  vm: this,
302
408
  data: postData
303
409
  }).then(res => {
304
- console.log("锁座成功", res);
410
+ //检查是否有错误信息并且弹层
411
+ if(this.handleCheckStatusIsError(res)){
412
+ this.$xdHideLoading()
413
+ return;
414
+ }
415
+
416
+ //未获取到锁座ID
417
+ if(!res.request_seat_id) {
418
+ this.$xdHideLoading();
419
+ this.$xdAlert({
420
+ content: '未获取到锁座ID',
421
+ type: 'error',
422
+ time: 3000
423
+ })
424
+ return;
425
+ }
426
+
305
427
  this.timer = setTimeout(() => {
306
428
  this.getSeatStatus(res.request_seat_id);
307
429
  }, 2000)
308
430
  }).catch(error=>{
309
431
  console.error(error);
310
- uni.showToast({
311
- title: '锁座失败!',
312
- icon: "none"
313
- })
314
432
  this.$xdHideLoading()
315
433
  })
316
434
  },
@@ -319,16 +437,18 @@
319
437
  this.$xdUniHelper.navigateBack();
320
438
  },
321
439
  onJfbShow(options) {
322
- console.log('onJfbShow', options)
323
440
  this.onJfbLoad(options);
324
441
  this.cinemaSeatKey = Date.now()
325
442
  },
443
+
326
444
  onJfbUnload(){
327
445
  this.unmount();
328
446
  },
447
+
329
448
  onJfbHide(){
330
449
  this.unmount();
331
450
  },
451
+
332
452
  unmount(){
333
453
  if(this.seatTimer) clearTimeout(this.seatTimer);
334
454
  if(this.timer) clearTimeout(this.timer);
@@ -257,6 +257,7 @@ export default {
257
257
  mainColorToArray: null,
258
258
  paiqiStatus: false, //影院信息与排期信息状态
259
259
  cinemaInfo: null, //影院信息
260
+ paiqiData:null, //排期数据
260
261
  filmInfo: null, //电影信息
261
262
  height: null, //内容区域高度
262
263
  show: false, //是否显示返回
@@ -454,6 +455,21 @@ export default {
454
455
  */
455
456
  getSeat(item) {
456
457
  this.$emit("onGetSeatList", item, (seat) => {
458
+
459
+ //排期有更新自动选中下一场
460
+ if(seat === null) {
461
+ this.$emit('onGetFilmPaiqi',(paiqiData)=>{
462
+ let list = [];
463
+ paiqiData.map(item => {
464
+ list.push(item["paiqi_data"]);
465
+ });
466
+ this.replaceParams(this.getFirst(list));
467
+ });
468
+ return;
469
+ }
470
+
471
+ //正常数据
472
+ this.selectedSeatInfo = seat;
457
473
  this.selectedSeatList = seat["seat"];
458
474
  this.areaPrices = (seat['area_price'] || []).map(item=>{
459
475
  return {
@@ -467,13 +483,13 @@ export default {
467
483
  },
468
484
 
469
485
  /**
470
- * @description 获取排期数据
486
+ * @description 获取排期与影院信息数据
471
487
  */
472
488
  getFilm() {
473
489
  this.$emit("onGetFilm", (film) => {
474
490
  this.cinemaInfo = film["cinema_data"];
491
+ this.paiqiData = film["paiqi_data"];
475
492
  this.filmInfo = this.getFilmInfo(film["film_data"]);
476
- debugger
477
493
  this.getScheduleList(film["paiqi_data"]);
478
494
  console.log("getFilm", film);
479
495
  this.paiqiStatus = true;
@@ -559,9 +575,13 @@ export default {
559
575
  console.warn(`params.seatId:${this.seatId}`);
560
576
  console.warn(`all.seatId:${JSON.stringify(allPaiqiId)}`);
561
577
  this.$xdConfirm({
562
- content:'当前排期已过期,请您手动切换或由系统自动切换到下一排期。',
578
+ content:'当前场次有更新<br/>请您手动切换或由系统自动切换到下一场次。',
563
579
  confirmText:'自动切换',
564
580
  cancelText:'手动切换',
581
+ msgIcon:'iconinformation',
582
+ zIndex:5000,
583
+ isHtml: true,
584
+ isTitle:false,
565
585
  styles: this.$parent.$parent.$parent.styles,
566
586
  success:(status)=>{
567
587
  if(status.confirm) {
@@ -585,9 +605,16 @@ export default {
585
605
  this.scheduleListIndex
586
606
  );
587
607
  },
608
+
588
609
  replaceParams(selectPaiqi) {
589
- let parseUrl = this.$xdUniHelper.parseURL();
590
- let { params, path } = parseUrl;
610
+ let { params, path } = this.$xdUniHelper.parseURL();
611
+
612
+ //#ifdef H5
613
+ let pathArr = path.split("/");
614
+ pathArr.splice(0,2)
615
+ path = `/${pathArr.join('/')}`
616
+ //#endif
617
+
591
618
  params["scheduleId"] = selectPaiqi["data_id"];
592
619
  let searchParams = this.$xdUniHelper.jsonToParams(params);
593
620
  this.$xdUniHelper.redirectTo({