gxd-uni-library-editx 1.0.111 → 1.0.112

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": "gxd-uni-library-editx",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -446,11 +446,25 @@ export default {
446
446
  // #endif
447
447
 
448
448
  //获取卡券列表
449
- callThis.getSettleListCards((cardList) => {
449
+ callThis.getSettleListCards(async (cardList) => {
450
450
  this.$xdLog.setARMSInfo(this.filterMGinfo(cardList), 'init_binded_list');
451
451
  this.cardList = cardList;
452
+
453
+ //如果有自动选中,则自动选中卡片,并且调用选卡接口,
454
+ let autoCardList = cardList.filter(item => item.is_auto_use === 'Y');
455
+ if(autoCardList.length > 0){
456
+ await this.autoUseCard(autoCardList, 0);
457
+ }
452
458
  })
453
459
  },
460
+ async autoUseCard(tickets, i){
461
+ let ticket = tickets[i];
462
+ if(!ticket) return Promise.resolve();
463
+ await this.handlerTicketSelect(true, ticket, {});
464
+ this.doTicketPay();
465
+ if(this.needPayPrice <= 0) return Promise.resolve();;
466
+ return this.autoUseCard(tickets, i + 1);
467
+ },
454
468
  //选卡弹出项
455
469
  useCardPop(data){
456
470
  return new Promise((resolve, reject) => {
@@ -480,85 +494,89 @@ export default {
480
494
 
481
495
  //选择卡券
482
496
  handlerTicketSelect(flat, ticket, options){
483
- if(this.cardIsDisabled(ticket)) return;
497
+ if(this.cardIsDisabled(ticket)) return Promise.reject('卡片禁用');
484
498
 
485
- if(flat){ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
486
- const {submitCardList, total_price} = this;
487
- let callThis = this;
488
- // #ifdef MP
489
- callThis = this.$parent;
490
- // #endif
491
- this.$xdShowLoading({})
492
- callThis.setSettleSelectCard({
493
- total_price,
494
- card_number: ticket.card_number,
495
- selected_card_list_json: JSON.stringify(submitCardList),
496
- selected_wallet_list_json: JSON.stringify(this.selected_wallet_list),
497
- ...options
498
- }, (res) => {
499
- let resOptions = JSON.parse(JSON.stringify(res));
500
- if(resOptions['selected_card_list1']) delete resOptions['selected_card_list1'];
501
- if (resOptions['selected_card_list']){
502
- resOptions['selected_card_list'] = this.filterMGinfo(resOptions['selected_card_list']);
503
- }
504
- this.$xdLog.setARMSInfo({
499
+ return new Promise((resolve, reject) => {
500
+ if(flat){ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
501
+ const {submitCardList, total_price} = this;
502
+ let callThis = this;
503
+ // #ifdef MP
504
+ callThis = this.$parent;
505
+ // #endif
506
+ this.$xdShowLoading({})
507
+ callThis.setSettleSelectCard({
508
+ total_price,
505
509
  card_number: ticket.card_number,
506
- selected_card_list_json: this.filterMGinfo(submitCardList),
507
- ...options,
508
- res: resOptions
509
- },'select_binded_card');
510
- this.$xdHideLoading();
511
- const {selected_card_list, need_pay_price, is_need_pop, card_total_use_price, card_total_use_point} = res;
512
- if(is_need_pop){
513
- this.useCardPop(res).then((select_content) => {
514
- if(select_content){
515
- this.handlerTicketSelect(true, ticket, {select_content})
516
- }else{
517
- this.handlerTicketSelect(false, ticket);
518
- }
519
- }).catch(() => {})
520
- }else{
521
- this.selectedCardList = selected_card_list;
522
- this.needPayPrice = need_pay_price;
523
- this.cardPayPrice = card_total_use_price;
524
- this.cardPayPoint = card_total_use_point;
525
- this.lastUseUnit = ticket.unit == '次' ? '次' : "";
510
+ selected_card_list_json: JSON.stringify(submitCardList),
511
+ selected_wallet_list_json: JSON.stringify(this.selected_wallet_list),
512
+ ...options
513
+ }, (res) => {
514
+ let resOptions = JSON.parse(JSON.stringify(res));
515
+ if(resOptions['selected_card_list1']) delete resOptions['selected_card_list1'];
516
+ if (resOptions['selected_card_list']){
517
+ resOptions['selected_card_list'] = this.filterMGinfo(resOptions['selected_card_list']);
518
+ }
519
+ this.$xdLog.setARMSInfo({
520
+ card_number: ticket.card_number,
521
+ selected_card_list_json: this.filterMGinfo(submitCardList),
522
+ ...options,
523
+ res: resOptions
524
+ },'select_binded_card');
525
+ this.$xdHideLoading();
526
+ const {selected_card_list, need_pay_price, is_need_pop, card_total_use_price, card_total_use_point} = res;
527
+ if(is_need_pop){
528
+ this.useCardPop(res).then((select_content) => {
529
+ if(select_content){
530
+ this.handlerTicketSelect(true, ticket, {select_content})
531
+ }else{
532
+ this.handlerTicketSelect(false, ticket);
533
+ }
534
+ }).catch(() => {})
535
+ }else{
536
+ this.selectedCardList = selected_card_list;
537
+ this.needPayPrice = need_pay_price;
538
+ this.cardPayPrice = card_total_use_price;
539
+ this.cardPayPoint = card_total_use_point;
540
+ this.lastUseUnit = ticket.unit == '次' ? '次' : "";
541
+ this.renderChecked = Date.now();
542
+ }
543
+ resolve();
544
+ }, (err) => {
545
+ this.$xdHideLoading();
526
546
  this.renderChecked = Date.now();
547
+ reject(err);
548
+ })
549
+ }else{
550
+ this.$xdLog.setARMSInfo({
551
+ ticket: this.filterMGinfo(ticket),
552
+ ...options,
553
+ },'cancel_card');
554
+ //不走接口, selectedCardList不是真实选中的
555
+ this.selectedCardList = this.selectedCardList.map(item => {
556
+ if(item.card_number == ticket.card_number){
557
+ this.needPayPrice = +this.needPayPrice + item['card_use_price']
558
+ item['card_use_price'] = 0;
559
+ item['card_use_point'] = 0;
560
+ }
561
+ return item;
562
+ });
563
+ if(ticket.is_new){
564
+ this.cardList = this.cardList.filter(item => item.card_number != ticket.card_number);
565
+ this.selectedCardList = this.selectedCardList.filter(item => item.card_number != ticket.card_number);
527
566
  }
528
- }, (err) => {
529
- this.$xdHideLoading();
567
+ // #ifdef MP
568
+ if(ticket.card_use_price) this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
569
+ if(ticket.card_use_point) this.cardPayPoint = this.cardPayPoint - ticket.card_use_point;
570
+ // #endif
571
+ // #ifdef H5
572
+ this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
573
+ this.cardPayPoint = this.cardPayPoint - ticket.card_use_point;
574
+ // #endif
575
+
530
576
  this.renderChecked = Date.now();
531
- })
532
- }else{
533
- this.$xdLog.setARMSInfo({
534
- ticket: this.filterMGinfo(ticket),
535
- ...options,
536
- },'cancel_card');
537
- //不走接口, selectedCardList不是真实选中的
538
- this.selectedCardList = this.selectedCardList.map(item => {
539
- if(item.card_number == ticket.card_number){
540
- this.needPayPrice = +this.needPayPrice + item['card_use_price']
541
- item['card_use_price'] = 0;
542
- item['card_use_point'] = 0;
543
- }
544
- return item;
545
- });
546
- if(ticket.is_new){
547
- this.cardList = this.cardList.filter(item => item.card_number != ticket.card_number);
548
- this.selectedCardList = this.selectedCardList.filter(item => item.card_number != ticket.card_number);
577
+ resolve();
549
578
  }
550
- // #ifdef MP
551
- if(ticket.card_use_price) this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
552
- if(ticket.card_use_point) this.cardPayPoint = this.cardPayPoint - ticket.card_use_point;
553
- // #endif
554
- // #ifdef H5
555
- this.cardPayPrice = this.cardPayPrice - ticket.card_use_price;
556
- this.cardPayPoint = this.cardPayPoint - ticket.card_use_point;
557
- // #endif
558
-
559
- this.renderChecked = Date.now();
560
- }
561
-
579
+ })
562
580
  },
563
581
 
564
582
  filterMGinfo(list){