ts-glitter 21.1.6 → 21.1.8

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.
Files changed (61) hide show
  1. package/create.js +1 -0
  2. package/lowcode/Entry.js +1 -1
  3. package/lowcode/Entry.ts +1 -1
  4. package/lowcode/backend-manager/bg-product.js +39 -18
  5. package/lowcode/backend-manager/bg-product.ts +54 -23
  6. package/lowcode/cms-plugin/pos-pages/payment-page.js +37 -29
  7. package/lowcode/cms-plugin/pos-pages/payment-page.ts +61 -49
  8. package/lowcode/cms-plugin/pos-pages/pos-function.js +6 -1
  9. package/lowcode/cms-plugin/pos-pages/pos-function.ts +8 -1
  10. package/lowcode/cms-plugin/stock-history.js +1 -0
  11. package/lowcode/cms-plugin/stock-history.ts +1 -10
  12. package/lowcode/css/editor.css +2 -2
  13. package/lowcode/editor-components/global-widget/bridge.js +43 -0
  14. package/lowcode/editor-components/global-widget/bridge.ts +46 -0
  15. package/lowcode/editor-components/global-widget/global-widget.js +1 -1
  16. package/lowcode/editor-components/global-widget/global-widget.ts +1 -1
  17. package/lowcode/form-view/e-commerce/product-select.js +13 -11
  18. package/lowcode/form-view/e-commerce/product-select.ts +14 -12
  19. package/lowcode/glitterBundle/plugins/editor-elem.js +14 -4
  20. package/lowcode/glitterBundle/plugins/editor-elem.ts +13 -4
  21. package/lowcode/jspage/function-page/main_editor.js +14 -10
  22. package/lowcode/jspage/function-page/main_editor.ts +14 -10
  23. package/lowcode/jspage/function-page/tool-setting.js +259 -223
  24. package/lowcode/jspage/function-page/tool-setting.ts +349 -311
  25. package/lowcode/modules/tool.js +9 -0
  26. package/lowcode/modules/tool.ts +12 -0
  27. package/lowcode/official_view_component/official/component.ts +1 -0
  28. package/lowcode/public-components/checkout/index.js +216 -207
  29. package/lowcode/public-components/checkout/index.ts +1315 -1309
  30. package/package.json +3 -1
  31. package/src/api-public/models/glitter-finance.js +1 -2
  32. package/src/api-public/models/glitter-finance.js.map +1 -5
  33. package/src/api-public/services/checkout-event.js +17 -7
  34. package/src/api-public/services/checkout-event.js.map +1 -1
  35. package/src/api-public/services/data-analyze.d.ts +1 -1
  36. package/src/api-public/services/fb-service.js +4 -4
  37. package/src/api-public/services/fb-service.js.map +1 -1
  38. package/src/api-public/services/schedule.d.ts +1 -1
  39. package/src/api-public/services/schedule.js +18 -14
  40. package/src/api-public/services/schedule.js.map +1 -1
  41. package/src/api-public/services/schedule.ts +18 -14
  42. package/src/api-public/services/user.js +17 -7
  43. package/src/api-public/services/user.js.map +1 -1
  44. package/src/config.d.ts +1 -1
  45. package/src/modules/AWSLib.js +2 -3
  46. package/src/modules/AWSLib.js.map +1 -1
  47. package/src/modules/database.d.ts +1 -1
  48. package/src/modules/redis.d.ts +1 -1
  49. package/src/modules/tool.d.ts +4 -4
  50. package/src/modules/tool.js +1 -2
  51. package/src/modules/tool.js.map +1 -1
  52. package/src/services/app.js +17 -7
  53. package/src/services/app.js.map +1 -1
  54. package/src/services/backend-service.js +17 -7
  55. package/src/services/backend-service.js.map +1 -1
  56. package/src/services/create-instance.js +3 -4
  57. package/src/services/create-instance.js.map +1 -1
  58. package/src/services/saas-table-check.js +2 -2
  59. package/src/services/saas-table-check.js.map +1 -5
  60. package/src/services/tool.js +2 -3
  61. package/src/services/tool.js.map +1 -1
@@ -40,7 +40,7 @@ export class CheckoutIndex {
40
40
  return '';
41
41
  }
42
42
  let onlineData: any = {};
43
- function getCartData(){
43
+ function getCartData() {
44
44
  if (gvc.glitter.getUrlParameter('page') !== 'checkout') {
45
45
  ApiCart.checkoutCart = ApiCart.globalCart;
46
46
  return new ApiCart(ApiCart.globalCart);
@@ -49,7 +49,7 @@ export class CheckoutIndex {
49
49
  }
50
50
  }
51
51
  //取得要顯示的購物車
52
- let apiCart = getCartData()
52
+ let apiCart = getCartData();
53
53
 
54
54
  const check_out_sub = JSON.parse(localStorage.getItem('checkout_sub_' + ApiCart.checkoutCart) ?? '{}');
55
55
 
@@ -112,7 +112,7 @@ export class CheckoutIndex {
112
112
  role="status"
113
113
  ></div>
114
114
  <span class="mt-3 ${textAttr.visible ? '' : 'd-none'}" style="font-size: ${textAttr.fontSize}px;"
115
- >${textAttr.value}</span
115
+ >${textAttr.value}</span
116
116
  >
117
117
  </div>`;
118
118
  }
@@ -144,7 +144,7 @@ export class CheckoutIndex {
144
144
 
145
145
  function refreshCartData() {
146
146
  //重取購物車資料
147
- apiCart=getCartData()
147
+ apiCart = getCartData();
148
148
  const dialog = new ShareDialog(gvc.glitter);
149
149
  dialog.dataLoading({ visible: true });
150
150
  const beta = false;
@@ -505,28 +505,28 @@ export class CheckoutIndex {
505
505
  })(),
506
506
  item.usePass
507
507
  ? html` <button
508
- class="${gClass('button-bgr')} my-2"
509
- style="max-width: 150px;"
510
- onclick="${gvc.event(() => {
511
- apiCart.setCart(cartItem => {
512
- cartItem.code = item.code;
513
- refreshCartData();
514
- gvc.closeDialog();
515
- });
516
- })}"
517
- >
508
+ class="${gClass('button-bgr')} my-2"
509
+ style="max-width: 150px;"
510
+ onclick="${gvc.event(() => {
511
+ apiCart.setCart(cartItem => {
512
+ cartItem.code = item.code;
513
+ refreshCartData();
514
+ gvc.closeDialog();
515
+ });
516
+ })}"
517
+ >
518
518
  <span class="${gClass('button-text')}"
519
- >${Language.text('select_to_use')}</span
519
+ >${Language.text('select_to_use')}</span
520
520
  >
521
- </button>`
521
+ </button>`
522
522
  : html` <button
523
- class="${gClass('button-bgr-disable')} my-2"
524
- style="max-width: 150px; cursor: not-allowed"
525
- >
523
+ class="${gClass('button-bgr-disable')} my-2"
524
+ style="max-width: 150px; cursor: not-allowed"
525
+ >
526
526
  <span class="${gClass('button-text')}"
527
- >${Language.text('not_meet_usage_criteria')}</span
527
+ >${Language.text('not_meet_usage_criteria')}</span
528
528
  >
529
- </button>`,
529
+ </button>`,
530
530
  ];
531
531
  }
532
532
 
@@ -565,7 +565,7 @@ export class CheckoutIndex {
565
565
  <div>
566
566
  <div class="d-flex align-items-center mb-2">
567
567
  <label class="${gClass('label')} mb-0 me-2" style="min-width: 80px;"
568
- >${Language.text('enter_code')}</label
568
+ >${Language.text('enter_code')}</label
569
569
  >
570
570
  <input
571
571
  class="${gClass('input')}"
@@ -576,38 +576,49 @@ export class CheckoutIndex {
576
576
  />
577
577
  </div>
578
578
  </div>
579
- <div class="w-100 d-sm-flex py-4 um-th-bar">
580
- ${header
581
- .map((item, index) => {
582
- return html` <div class="um-th" style="flex: ${flexList[index]};">
583
- ${item.title}
584
- </div>`;
585
- })
586
- .join('')}
587
- </div>
588
- ${vmi.dataList
589
- .map((item, t1) => {
590
- const fText = formatText(item.content);
591
- return html` <div class="w-100 d-sm-flex py-1 align-items-center">
592
- ${fText
593
- .map((dd, t2) => {
594
- return html` <div
595
- class="um-td ${t2 === fText.length - 1 ? 'text-center' : ''}"
596
- style="flex: ${flexList[t2]}"
597
- >
598
- ${dd}
579
+ ${vmi.dataList.length > 0
580
+ ? html`<div class="w-100 d-sm-flex py-4 um-th-bar">
581
+ ${header
582
+ .map((item, index) => {
583
+ return html` <div
584
+ class="um-th"
585
+ style="flex: ${flexList[index]};"
586
+ >
587
+ ${item.title}
588
+ </div>`;
589
+ })
590
+ .join('')}
591
+ </div>
592
+ ${vmi.dataList
593
+ .map(item => {
594
+ const fText = formatText(item.content);
595
+ return html` <div class="w-100 d-sm-flex py-1 align-items-center">
596
+ ${fText
597
+ .map((dd, t2) => {
598
+ return html` <div
599
+ class="um-td ${t2 === fText.length - 1
600
+ ? 'text-center'
601
+ : ''}"
602
+ style="flex: ${flexList[t2]}"
603
+ >
604
+ ${dd}
605
+ </div>`;
606
+ })
607
+ .join('')}
599
608
  </div>`;
600
609
  })
601
- .join('')}
602
- </div>`;
603
- })
604
- .join('')}
610
+ .join('')}`
611
+ : html`<div
612
+ class="d-flex justify-content-center align-items-center"
613
+ style="height: 250px;"
614
+ >
615
+ 尚無可使用的優惠券
616
+ </div>`}
605
617
  `;
606
618
  }
607
619
 
608
- return html` <div>
609
- <div class="d-flex flex-column flex-sm-row align-items-center ">
610
- <div class="d-flex align-items-center">
620
+ return html`<div class="d-flex flex-column flex-sm-row align-items-center">
621
+ <div class="d-flex align-items-center w-100">
611
622
  <input
612
623
  class="${gClass('input')}"
613
624
  type="text"
@@ -622,30 +633,36 @@ export class CheckoutIndex {
622
633
  })}"
623
634
  >
624
635
  <span class="${gClass('button-text')}"
625
- >${Language.text('confirm')}</span
636
+ >${Language.text('confirm')}</span
626
637
  >
627
638
  </button>
628
639
  </div>
629
640
  </div>
630
641
  <div class="w-100 d-sm-none mb-3 s162413">
631
- ${vmi.dataList
632
- .map(item => {
633
- return html` <div class="um-mobile-area">
634
- ${formatText(item.content)
635
- .map((dd, index) => {
636
- if (header[index].title === '') {
637
- return dd;
638
- }
639
- return html` <div class="um-mobile-text">
640
- ${header[index].title} : ${dd}
641
- </div>`;
642
- })
643
- .join('')}
644
- </div>`;
645
- })
646
- .join('')}
647
- </div>
648
- </div>`;
642
+ ${vmi.dataList.length > 0
643
+ ? vmi.dataList
644
+ .map(item => {
645
+ return html` <div class="um-mobile-area">
646
+ ${formatText(item.content)
647
+ .map((dd, index) => {
648
+ if (header[index].title === '') {
649
+ return dd;
650
+ }
651
+ return html` <div class="um-mobile-text">
652
+ ${header[index].title} : ${dd}
653
+ </div>`;
654
+ })
655
+ .join('')}
656
+ </div>`;
657
+ })
658
+ .join('')
659
+ : html`<div
660
+ class="d-flex justify-content-center align-items-center"
661
+ style="height: 200px;"
662
+ >
663
+ 尚無可使用的優惠券
664
+ </div>`}
665
+ </div>`;
649
666
  }
650
667
  } catch (e) {
651
668
  return '';
@@ -653,18 +670,6 @@ export class CheckoutIndex {
653
670
  },
654
671
  onCreate: () => {
655
672
  if (loading) {
656
- function isNowBetweenDates(startIso: string, endIso: string): boolean {
657
- const now = new Date();
658
- const startDate = new Date(startIso);
659
- const endDate = new Date(endIso);
660
-
661
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
662
- return true;
663
- }
664
-
665
- return now >= startDate && now <= endDate;
666
- }
667
-
668
673
  gvc.addMtScript(
669
674
  [
670
675
  {
@@ -680,8 +685,9 @@ export class CheckoutIndex {
680
685
  if (res.result && res.response.data) {
681
686
  vmi.dataList = res.response.data.filter((item: Voucher) => {
682
687
  return (
688
+ item.content.status === 1 &&
683
689
  item.content.trigger === 'code' &&
684
- isNowBetweenDates(
690
+ Tool.isNowBetweenDates(
685
691
  item.content.start_ISO_Date,
686
692
  item.content.end_ISO_Date
687
693
  )
@@ -750,16 +756,16 @@ export class CheckoutIndex {
750
756
  >
751
757
  ${vm.cartData.code
752
758
  ? html`${vm.cartData.code}<i
753
- class="fa-solid fa-xmark-large ms-2"
754
- style="cursor: pointer;"
755
- onclick="${gvc.event((e, event) => {
756
- event.stopPropagation();
757
- apiCart.setCart(cartItem => {
758
- cartItem.code = '';
759
- refreshCartData();
760
- });
761
- })}"
762
- ></i>`
759
+ class="fa-solid fa-xmark-large ms-2"
760
+ style="cursor: pointer;"
761
+ onclick="${gvc.event((e, event) => {
762
+ event.stopPropagation();
763
+ apiCart.setCart(cartItem => {
764
+ cartItem.code = '';
765
+ refreshCartData();
766
+ });
767
+ })}"
768
+ ></i>`
763
769
  : Language.text('add')}
764
770
  </div>
765
771
  </div>
@@ -768,46 +774,88 @@ export class CheckoutIndex {
768
774
  return '';
769
775
  } else {
770
776
  return html` ${(() => {
771
- let tempRebate: number = 0;
772
- const dialog = new ShareDialog(gvc.glitter);
773
- return html` <div class="${gClass(['price-row', 'text-2'])}">
774
- <div>${vm.rebateConfig.title}${Language.text('discount')}</div>
775
- <div>- ${Currency.convertCurrencyText(vm.cartData.use_rebate)}</div>
776
- </div>
777
- <div class="${gClass(['price-row', 'text-2'])}">
778
- <div>${vm.rebateConfig.title}${Language.text('reback_text')}</div>
779
- <div>+ ${vm.cartData.rebate.toLocaleString()}</div>
780
- </div>
777
+ let tempRebate: number = 0;
778
+ const dialog = new ShareDialog(gvc.glitter);
779
+ return html` <div class="${gClass(['price-row', 'text-2'])}">
780
+ <div>${vm.rebateConfig.title}${Language.text('discount')}</div>
781
+ <div>- ${Currency.convertCurrencyText(vm.cartData.use_rebate)}</div>
782
+ </div>
783
+ <div class="${gClass(['price-row', 'text-2'])}">
784
+ <div>${vm.rebateConfig.title}${Language.text('reback_text')}</div>
785
+ <div>+ ${vm.cartData.rebate.toLocaleString()}</div>
786
+ </div>
781
787
 
782
- <div class="${gClass(['price-row', 'text-2'])}">
783
- <div
784
- style=" justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
785
- .body.clientWidth > 768
786
- ? 'gap: 18px;'
787
- : 'gap: 0px;'}"
788
- class="w-100"
789
- >
790
- <input
791
- class="flex-fill ${gClass('group-input')}"
792
- placeholder="${Language.text('please_enter')}${vm.rebateConfig.title}"
793
- style="${document.body.clientWidth < 800
794
- ? `width:calc(100% - 150px) !important;`
795
- : ''}"
796
- value="${vm.cartData.use_rebate || ''}"
797
- onchange="${gvc.event((e, event) => {
798
- if (CheckInput.isNumberString(e.value)) {
799
- tempRebate = parseInt(e.value, 10);
800
- } else {
801
- dialog.errorMessage({ text: Language.text('enter_value') });
802
- gvc.notifyDataChange(ids.page);
803
- }
804
- })}"
805
- />
806
- <div class="${gClass('group-button')}">
788
+ <div class="${gClass(['price-row', 'text-2'])}">
807
789
  <div
808
- class="${gClass('button-text')}"
809
- onclick="${gvc.event(async () => {
810
- const sum: number = await new Promise((resolve, reject) => {
790
+ style=" justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
791
+ .body.clientWidth > 768
792
+ ? 'gap: 18px;'
793
+ : 'gap: 0px;'}"
794
+ class="w-100"
795
+ >
796
+ <input
797
+ class="flex-fill ${gClass('group-input')}"
798
+ placeholder="${Language.text('please_enter')}${vm.rebateConfig.title}"
799
+ style="${document.body.clientWidth < 800
800
+ ? `width:calc(100% - 150px) !important;`
801
+ : ''}"
802
+ value="${vm.cartData.use_rebate || ''}"
803
+ onchange="${gvc.event((e, event) => {
804
+ if (CheckInput.isNumberString(e.value)) {
805
+ tempRebate = parseInt(e.value, 10);
806
+ } else {
807
+ dialog.errorMessage({ text: Language.text('enter_value') });
808
+ gvc.notifyDataChange(ids.page);
809
+ }
810
+ })}"
811
+ />
812
+ <div class="${gClass('group-button')}">
813
+ <div
814
+ class="${gClass('button-text')}"
815
+ onclick="${gvc.event(async () => {
816
+ const sum: number = await new Promise((resolve, reject) => {
817
+ ApiShop.getRebate({}).then(async res => {
818
+ if (res.result && res.response.sum) {
819
+ resolve(res.response.sum);
820
+ } else {
821
+ resolve(0);
822
+ }
823
+ });
824
+ });
825
+ const limit =
826
+ vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
827
+ if (sum === 0) {
828
+ dialog.errorMessage({
829
+ text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
830
+ });
831
+ return;
832
+ }
833
+ if (tempRebate > Math.min(sum, limit)) {
834
+ dialog.errorMessage({
835
+ text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
836
+ });
837
+ return;
838
+ }
839
+
840
+ apiCart.setCart(cartItem => {
841
+ cartItem.use_rebate = tempRebate;
842
+ refreshCartData();
843
+ });
844
+ })}"
845
+ >
846
+ ${Language.text('apply')}
847
+ </div>
848
+ </div>
849
+ </div>
850
+ </div>`;
851
+ })()}
852
+ <div class="${gClass(['price-row', 'text-2'])}">
853
+ ${(() => {
854
+ return gvc.bindView(() => {
855
+ return {
856
+ bind: gvc.glitter.getUUID(),
857
+ view: async () => {
858
+ const sum = await new Promise((resolve, reject) => {
811
859
  ApiShop.getRebate({}).then(async res => {
812
860
  if (res.result && res.response.sum) {
813
861
  resolve(res.response.sum);
@@ -816,74 +864,32 @@ export class CheckoutIndex {
816
864
  }
817
865
  });
818
866
  });
819
- const limit =
820
- vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
821
- if (sum === 0) {
822
- dialog.errorMessage({
823
- text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
824
- });
825
- return;
826
- }
827
- if (tempRebate > Math.min(sum, limit)) {
828
- dialog.errorMessage({
829
- text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
830
- });
831
- return;
867
+ if (!vm.cartData.useRebateInfo) {
868
+ return '';
832
869
  }
833
870
 
834
- apiCart.setCart(cartItem => {
835
- cartItem.use_rebate = tempRebate;
836
- refreshCartData();
837
- });
838
- })}"
839
- >
840
- ${Language.text('apply')}
841
- </div>
842
- </div>
843
- </div>
871
+ const info = vm.cartData.useRebateInfo;
872
+ if (info.condition) {
873
+ return html`${Language.text('distance_from_target_amount')}$
874
+ ${info.condition.toLocaleString()} ${Language.text('can_use_now')}
875
+ ${vm.rebateConfig.title} ${Language.text('discount')}`;
876
+ }
877
+ if (info.limit) {
878
+ return html`${Language.text('remaining_balance')} ${sum || 0}
879
+ ${Language.text('point')} ${vm.rebateConfig.title} <br />${Language.text(
880
+ 'max_discount_order'
881
+ )}
882
+ ${info.limit.toLocaleString()} ${Language.text('point')} ${vm.rebateConfig.title}`;
883
+ } else {
884
+ return `${Language.text('remaining_balance')} ${sum || 0} ${Language.text('point')} ${
885
+ vm.rebateConfig.title
886
+ }`;
887
+ }
888
+ },
889
+ };
890
+ });
891
+ })()}
844
892
  </div>`;
845
- })()}
846
- <div class="${gClass(['price-row', 'text-2'])}">
847
- ${(() => {
848
- return gvc.bindView(() => {
849
- return {
850
- bind: gvc.glitter.getUUID(),
851
- view: async () => {
852
- const sum = await new Promise((resolve, reject) => {
853
- ApiShop.getRebate({}).then(async res => {
854
- if (res.result && res.response.sum) {
855
- resolve(res.response.sum);
856
- } else {
857
- resolve(0);
858
- }
859
- });
860
- });
861
- if (!vm.cartData.useRebateInfo) {
862
- return '';
863
- }
864
-
865
- const info = vm.cartData.useRebateInfo;
866
- if (info.condition) {
867
- return html`${Language.text('distance_from_target_amount')}$
868
- ${info.condition.toLocaleString()} ${Language.text('can_use_now')}
869
- ${vm.rebateConfig.title} ${Language.text('discount')}`;
870
- }
871
- if (info.limit) {
872
- return html`${Language.text('remaining_balance')} ${sum || 0}
873
- ${Language.text('point')} ${vm.rebateConfig.title} <br />${Language.text(
874
- 'max_discount_order'
875
- )}
876
- ${info.limit.toLocaleString()} ${Language.text('point')} ${vm.rebateConfig.title}`;
877
- } else {
878
- return `${Language.text('remaining_balance')} ${sum || 0} ${Language.text('point')} ${
879
- vm.rebateConfig.title
880
- }`;
881
- }
882
- },
883
- };
884
- });
885
- })()}
886
- </div>`;
887
893
  }
888
894
  })()}
889
895
  <div class="${gClass(['price-row', 'text-2', 'bold'])}">
@@ -1000,20 +1006,20 @@ export class CheckoutIndex {
1000
1006
  style="height: 68px; overflow: auto hidden;"
1001
1007
  >
1002
1008
  ${ProductModule.tab(
1003
- filterLogiGroup.map(item => {
1004
- return {
1005
- title: item.name,
1006
- key: item.key,
1007
- };
1008
- }),
1009
- gvc,
1010
- localStorage.getItem('logistics-group') ?? filterLogiGroup[0].key,
1011
- text => {
1012
- localStorage.setItem('logistics-group', text);
1013
- refreshCartData();
1014
- },
1015
- 'justify-content: flex-start;'
1016
- )}
1009
+ filterLogiGroup.map(item => {
1010
+ return {
1011
+ title: item.name,
1012
+ key: item.key,
1013
+ };
1014
+ }),
1015
+ gvc,
1016
+ localStorage.getItem('logistics-group') ?? filterLogiGroup[0].key,
1017
+ text => {
1018
+ localStorage.setItem('logistics-group', text);
1019
+ refreshCartData();
1020
+ },
1021
+ 'justify-content: flex-start;'
1022
+ )}
1017
1023
  </div>`;
1018
1024
  })()}
1019
1025
  <div class="rounded-3 bg-white w-100 mt-3">
@@ -1076,8 +1082,8 @@ export class CheckoutIndex {
1076
1082
  <span
1077
1083
  class="fw-bold pe-4"
1078
1084
  style="gap:5px;font-size:${document.body.clientWidth > 800
1079
- ? `16`
1080
- : `14`}px;max-width:calc(100% - 10px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; "
1085
+ ? `16`
1086
+ : `14`}px;max-width:calc(100% - 10px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; "
1081
1087
  >${title}</span
1082
1088
  >
1083
1089
  <div class="${gClass(['66text'])} fs-sm">
@@ -1087,24 +1093,24 @@ export class CheckoutIndex {
1087
1093
  <div class="d-flex flex-column align-items-start " style="gap:2px;">
1088
1094
  <div class="fw-bold fs-6 ${gClass('price-text')}">
1089
1095
  ${(() => {
1090
- if (item.is_gift) {
1091
- return Currency.convertCurrencyText(0);
1092
- }
1093
- return Currency.convertCurrencyText(
1094
- parseFloat(item.sale_price)
1095
- );
1096
- })()}
1096
+ if (item.is_gift) {
1097
+ return Currency.convertCurrencyText(0);
1098
+ }
1099
+ return Currency.convertCurrencyText(
1100
+ parseFloat(item.sale_price)
1101
+ );
1102
+ })()}
1097
1103
  </div>
1098
1104
  ${(() => {
1099
- if (item.is_gift || item.sale_price >= item.origin_price) {
1100
- return '';
1101
- }
1102
- return html` <div
1105
+ if (item.is_gift || item.sale_price >= item.origin_price) {
1106
+ return '';
1107
+ }
1108
+ return html` <div
1103
1109
  style="text-decoration: line-through; font-size: 12px;"
1104
1110
  >
1105
1111
  ${Currency.convertCurrencyText(parseFloat(item.origin_price))}
1106
1112
  </div>`;
1107
- })()}
1113
+ })()}
1108
1114
  </div>
1109
1115
  <div class="w-100 d-flex">
1110
1116
  <div class="flex-fill"></div>
@@ -1114,23 +1120,23 @@ export class CheckoutIndex {
1114
1120
  >
1115
1121
  <div
1116
1122
  class="${item.is_gift
1117
- ? `d-none`
1118
- : `d-flex`} align-items-center justify-content-center"
1123
+ ? `d-none`
1124
+ : `d-flex`} align-items-center justify-content-center"
1119
1125
  style="width:38px;height: 38px;cursor: pointer;"
1120
1126
  onclick="${gvc.event(() => {
1121
- apiCart.setCart(cartItem => {
1122
- const find = cartItem.line_items.find(dd => {
1123
- return (
1124
- dd.id === item.id &&
1125
- item.spec.join('') === dd.spec.join('')
1126
- );
1127
- })!;
1128
- if (find.count - 1 > 0) {
1129
- find.count = find.count - 1;
1130
- refreshCartData();
1131
- }
1132
- });
1133
- })}"
1127
+ apiCart.setCart(cartItem => {
1128
+ const find = cartItem.line_items.find(dd => {
1129
+ return (
1130
+ dd.id === item.id &&
1131
+ item.spec.join('') === dd.spec.join('')
1132
+ );
1133
+ })!;
1134
+ if (find.count - 1 > 0) {
1135
+ find.count = find.count - 1;
1136
+ refreshCartData();
1137
+ }
1138
+ });
1139
+ })}"
1134
1140
  >
1135
1141
  <i class="fa-solid fa-minus" style="color:black;"></i>
1136
1142
  </div>
@@ -1139,69 +1145,69 @@ export class CheckoutIndex {
1139
1145
  style="
1140
1146
 
1141
1147
  ${item.is_gift
1142
- ? `border:none;`
1143
- : `border-top:none;border-bottom: none;`}
1148
+ ? `border:none;`
1149
+ : `border-top:none;border-bottom: none;`}
1144
1150
  border-radius: 0px; color: #575757; width: 50px;height:38px;background-image:none;${parseInt(
1145
- vm.quantity,
1146
- 10
1147
- ) < 10
1148
- ? `text-indent: 43%;`
1149
- : `text-indent: 40%;`}"
1151
+ vm.quantity,
1152
+ 10
1153
+ ) < 10
1154
+ ? `text-indent: 43%;`
1155
+ : `text-indent: 40%;`}"
1150
1156
  onchange="${gvc.event(e => {
1151
- apiCart.setCart(cartItem => {
1152
- cartItem.line_items.find(dd => {
1153
- return (
1154
- dd.id === item.id &&
1155
- item.spec.join('') === dd.spec.join('')
1156
- );
1157
- })!.count = parseInt(e.value, 10);
1158
- refreshCartData();
1159
- });
1160
- })}"
1157
+ apiCart.setCart(cartItem => {
1158
+ cartItem.line_items.find(dd => {
1159
+ return (
1160
+ dd.id === item.id &&
1161
+ item.spec.join('') === dd.spec.join('')
1162
+ );
1163
+ })!.count = parseInt(e.value, 10);
1164
+ refreshCartData();
1165
+ });
1166
+ })}"
1161
1167
  ${item.is_gift ? `disabled` : ''}
1162
1168
  >
1163
1169
  ${[
1164
- ...new Array(
1165
- (() => {
1166
- if (item.show_understocking === 'false') {
1167
- return 50;
1168
- }
1169
- return item.stock < 50 ? item.stock : 50;
1170
- })()
1171
- ),
1172
- ]
1173
- .map((_, index) => {
1174
- return html` <option
1170
+ ...new Array(
1171
+ (() => {
1172
+ if (item.show_understocking === 'false') {
1173
+ return 50;
1174
+ }
1175
+ return item.stock < 50 ? item.stock : 50;
1176
+ })()
1177
+ ),
1178
+ ]
1179
+ .map((_, index) => {
1180
+ return html` <option
1175
1181
  value="${index + 1}"
1176
1182
  ${index + 1 === item.count ? `selected` : ''}
1177
1183
  >
1178
1184
  ${index + 1}
1179
1185
  </option>`;
1180
- })
1181
- .join('')}
1186
+ })
1187
+ .join('')}
1182
1188
  </select>
1183
1189
  <div
1184
1190
  class=" align-items-center justify-content-center ${item.is_gift
1185
- ? `d-none`
1186
- : `d-flex`}"
1191
+ ? `d-none`
1192
+ : `d-flex`}"
1187
1193
  style="width:38px;height: 38px;cursor: pointer;"
1188
1194
  onclick="${gvc.event(() => {
1189
- apiCart.setCart(cartItem => {
1190
- const find = cartItem.line_items.find(dd => {
1191
- return (
1192
- dd.id === item.id &&
1193
- item.spec.join('') === dd.spec.join('')
1194
- );
1195
- })!;
1196
- if (
1197
- item.show_understocking === 'false' ||
1198
- find.count + 1 < item.stock
1199
- ) {
1200
- find.count = find.count + 1;
1201
- refreshCartData();
1202
- }
1203
- });
1204
- })}"
1195
+ apiCart.setCart(cartItem => {
1196
+ const find = cartItem.line_items.find(dd => {
1197
+ return (
1198
+ dd.id === item.id &&
1199
+ item.spec.join('') === dd.spec.join('')
1200
+ );
1201
+ })!;
1202
+ if (
1203
+ item.show_understocking === 'false' ||
1204
+ find.count + 1 < item.stock
1205
+ ) {
1206
+ find.count = find.count + 1;
1207
+ refreshCartData();
1208
+ }
1209
+ });
1210
+ })}"
1205
1211
  >
1206
1212
  <i class="fa-solid fa-plus" style="color:black;"></i>
1207
1213
  </div>
@@ -1215,74 +1221,74 @@ export class CheckoutIndex {
1215
1221
  class="fa-solid fa-xmark-large"
1216
1222
  style="cursor: pointer;color:gray;"
1217
1223
  onclick="${gvc.event(() => {
1218
- apiCart.setCart(cartItem => {
1219
- cartItem.line_items = cartItem.line_items.filter(dd => {
1220
- return !(
1221
- dd.id === item.id &&
1222
- item.spec.join('') === dd.spec.join('')
1223
- );
1224
- });
1225
- refreshCartData();
1226
- });
1227
- })}"
1224
+ apiCart.setCart(cartItem => {
1225
+ cartItem.line_items = cartItem.line_items.filter(dd => {
1226
+ return !(
1227
+ dd.id === item.id &&
1228
+ item.spec.join('') === dd.spec.join('')
1229
+ );
1230
+ });
1231
+ refreshCartData();
1232
+ });
1233
+ })}"
1228
1234
  ></i>
1229
1235
  </div>
1230
1236
  </div>
1231
1237
  </div>
1232
1238
  <div>
1233
1239
  ${vm.cartData.voucherList
1234
- .filter((dd: any) => {
1235
- return (
1236
- dd.bind.find((d2: any) => {
1237
- return d2.id === item.id;
1238
- }) &&
1239
- dd.reBackType !== 'giveaway' &&
1240
- dd.reBackType !== 'add_on_items'
1241
- );
1242
- })
1243
- .map((dd: any) => {
1244
- return html`<div
1240
+ .filter((dd: any) => {
1241
+ return (
1242
+ dd.bind.find((d2: any) => {
1243
+ return d2.id === item.id;
1244
+ }) &&
1245
+ dd.reBackType !== 'giveaway' &&
1246
+ dd.reBackType !== 'add_on_items'
1247
+ );
1248
+ })
1249
+ .map((dd: any) => {
1250
+ return html`<div
1245
1251
  class="w-100"
1246
1252
  style="${document.body.clientWidth < 800
1247
- ? `font-size:12px;`
1248
- : `font-size:14px;`}"
1253
+ ? `font-size:12px;`
1254
+ : `font-size:14px;`}"
1249
1255
  >
1250
1256
  <i class="fa-solid fa-tickets-perforated me-2"></i>${dd.title}
1251
1257
  </div>`;
1252
- })
1253
- .join('<div class="my-1"></div>')}
1258
+ })
1259
+ .join('<div class="my-1"></div>')}
1254
1260
  ${(() => {
1255
- let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
1256
- let count = 0;
1257
- for (const b of vm.cartData.lineItems) {
1258
- if (b.id === item.id) {
1259
- count += b.count;
1260
- }
1261
- }
1262
- if (count < min) {
1263
- return `<div class="text-danger">${Language.text('min_p_count').replace('_c_', min)}</div>`;
1264
- } else {
1265
- return '';
1266
- }
1267
- })()}
1261
+ let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
1262
+ let count = 0;
1263
+ for (const b of vm.cartData.lineItems) {
1264
+ if (b.id === item.id) {
1265
+ count += b.count;
1266
+ }
1267
+ }
1268
+ if (count < min) {
1269
+ return `<div class="text-danger">${Language.text('min_p_count').replace('_c_', min)}</div>`;
1270
+ } else {
1271
+ return '';
1272
+ }
1273
+ })()}
1268
1274
  ${(() => {
1269
- let max_qty =
1270
- (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
1271
- let count = 0;
1272
- for (const b of vm.cartData.lineItems) {
1273
- if (b.id === item.id) {
1274
- count += b.count;
1275
- }
1276
- }
1275
+ let max_qty =
1276
+ (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
1277
+ let count = 0;
1278
+ for (const b of vm.cartData.lineItems) {
1279
+ if (b.id === item.id) {
1280
+ count += b.count;
1281
+ }
1282
+ }
1277
1283
 
1278
- if (count > max_qty) {
1279
- return html`<div class="text-danger">
1284
+ if (count > max_qty) {
1285
+ return html`<div class="text-danger">
1280
1286
  ${Language.text('max_p_count').replace('_c_', max_qty)}
1281
1287
  </div>`;
1282
- } else {
1283
- return '';
1284
- }
1285
- })()}
1288
+ } else {
1289
+ return '';
1290
+ }
1291
+ })()}
1286
1292
  </div>
1287
1293
  </div>
1288
1294
  `;
@@ -1406,7 +1412,7 @@ export class CheckoutIndex {
1406
1412
  titleFontColor:
1407
1413
  glitter.share.globalValue[
1408
1414
  'theme_color.0.title'
1409
- ] ?? '#333333',
1415
+ ] ?? '#333333',
1410
1416
  prod: pd,
1411
1417
  vm: {
1412
1418
  specs: pd.specs.map(
@@ -1436,7 +1442,7 @@ export class CheckoutIndex {
1436
1442
  });
1437
1443
  }
1438
1444
  );
1439
-
1445
+
1440
1446
  if (find) {
1441
1447
  apiCart.setCart(cartItem => {
1442
1448
  cartItem.line_items.map(dd => {
@@ -1473,11 +1479,11 @@ export class CheckoutIndex {
1473
1479
  })}"
1474
1480
  >
1475
1481
  <span class="${gClass('button-text')}"
1476
- >${isSelected
1477
- ? isSelected.id === pd.id
1478
- ? Language.text('selected')
1479
- : Language.text('change_gift')
1480
- : Language.text('select_gift')}</span
1482
+ >${isSelected
1483
+ ? isSelected.id === pd.id
1484
+ ? Language.text('selected')
1485
+ : Language.text('change_gift')
1486
+ : Language.text('select_gift')}</span
1481
1487
  >
1482
1488
  </button>
1483
1489
  </div>
@@ -1526,8 +1532,8 @@ export class CheckoutIndex {
1526
1532
  style="overflow-x:auto;gap:10px;"
1527
1533
  >
1528
1534
  ${add_products.response.data
1529
- .map((dd: any) => {
1530
- return html` <div
1535
+ .map((dd: any) => {
1536
+ return html` <div
1531
1537
  class="d-flex py-3 align-items-center"
1532
1538
  style="gap:10px;"
1533
1539
  >
@@ -1545,29 +1551,29 @@ export class CheckoutIndex {
1545
1551
  <button
1546
1552
  class="${gClass('button-bgr')} mb-0 mt-2"
1547
1553
  onclick="${gvc.event(() => {
1548
- const titleFontColor =
1549
- glitter.share.globalValue['theme_color.0.title'] ??
1550
- '#333333';
1551
- gvc.glitter.innerDialog(
1552
- (gvc: GVC) => {
1553
- return html` <div
1554
+ const titleFontColor =
1555
+ glitter.share.globalValue['theme_color.0.title'] ??
1556
+ '#333333';
1557
+ gvc.glitter.innerDialog(
1558
+ (gvc: GVC) => {
1559
+ return html` <div
1554
1560
  class=" bg-white shadow ${document.body.clientWidth >
1555
- 768
1556
- ? `rounded-3`
1557
- : ` position-absolute bottom-0`}"
1561
+ 768
1562
+ ? `rounded-3`
1563
+ : ` position-absolute bottom-0`}"
1558
1564
  style=" ${document.body.clientWidth > 768
1559
- ? `min-width: 400px; width: 1000px;max-height:calc(100% - 150px);overflow-y: auto;`
1560
- : 'width:calc(100vw);height:100%;'}"
1565
+ ? `min-width: 400px; width: 1000px;max-height:calc(100% - 150px);overflow-y: auto;`
1566
+ : 'width:calc(100vw);height:100%;'}"
1561
1567
  >
1562
1568
  <div
1563
1569
  class="bg-white shadow ${document.body
1564
- .clientWidth > 768
1565
- ? `rounded-3`
1566
- : `h-100`}"
1570
+ .clientWidth > 768
1571
+ ? `rounded-3`
1572
+ : `h-100`}"
1567
1573
  style="width: 100%; position: relative;${document
1568
- .body.clientWidth > 768
1569
- ? ''
1570
- : `overflow-y: auto;`}"
1574
+ .body.clientWidth > 768
1575
+ ? ''
1576
+ : `overflow-y: auto;`}"
1571
1577
  >
1572
1578
  <div
1573
1579
  class="w-100 d-flex align-items-center p-3 border-bottom"
@@ -1584,75 +1590,75 @@ export class CheckoutIndex {
1584
1590
  class="fa-regular fa-circle-xmark fs-5 text-dark"
1585
1591
  style="cursor: pointer"
1586
1592
  onclick="${gvc.event(() => {
1587
- gvc.closeDialog();
1588
- })}"
1593
+ gvc.closeDialog();
1594
+ })}"
1589
1595
  ></i>
1590
1596
  </div>
1591
1597
  <div
1592
1598
  class="c_dialog_main"
1593
1599
  style="gap: 24px; max-height: calc(100% - 100px); ${document
1594
- .body.clientWidth < 800
1595
- ? `padding: 12px 20px;`
1596
- : `padding: 30px;`}"
1600
+ .body.clientWidth < 800
1601
+ ? `padding: 12px 20px;`
1602
+ : `padding: 30px;`}"
1597
1603
  >
1598
1604
  ${PdClass.selectSpec({
1599
- gvc,
1600
- titleFontColor:
1601
- glitter.share.globalValue[
1602
- 'theme_color.0.title'
1603
- ] ?? '#333333',
1604
- prod: dd.content,
1605
- vm: {
1606
- specs: dd.content.specs.map(
1607
- (spec: {
1608
- option: {
1609
- title: string;
1610
- }[];
1611
- }) => {
1612
- return spec.option[0].title;
1613
- }
1614
- ),
1615
- quantity: '1',
1616
- wishStatus: (
1617
- glitter.share.wishList ?? []
1618
- ).some((item: { id: number }) => {
1619
- return item.id === dd.id;
1620
- }),
1621
- },
1622
- preview: true,
1623
- with_qty: false,
1624
- is_gift: true,
1625
- callback: () => {
1626
- gvc.closeDialog();
1627
- let find = vm.cartData.lineItems.find(
1628
- (d1: any) => {
1629
- return dd.add_on_products.find(
1630
- (d2: any) => {
1631
- return d2.id === d1.id;
1632
- }
1633
- );
1634
- }
1635
- );
1636
- if (find) {
1637
- apiCart.setCart(cartItem => {
1638
- cartItem.line_items.map(dd => {
1639
- if (dd.id === find.id) {
1640
- dd.count--;
1641
- }
1642
- });
1643
- cartItem.line_items =
1644
- cartItem.line_items.filter(dd => {
1645
- return dd.count > 0;
1646
- });
1647
- refreshCartData();
1648
- gvc.closeDialog();
1649
- });
1650
- } else {
1651
- refreshCartData();
1652
- gvc.closeDialog();
1653
- }
1654
- },
1655
- })}
1605
+ gvc,
1606
+ titleFontColor:
1607
+ glitter.share.globalValue[
1608
+ 'theme_color.0.title'
1609
+ ] ?? '#333333',
1610
+ prod: dd.content,
1611
+ vm: {
1612
+ specs: dd.content.specs.map(
1613
+ (spec: {
1614
+ option: {
1615
+ title: string;
1616
+ }[];
1617
+ }) => {
1618
+ return spec.option[0].title;
1619
+ }
1620
+ ),
1621
+ quantity: '1',
1622
+ wishStatus: (
1623
+ glitter.share.wishList ?? []
1624
+ ).some((item: { id: number }) => {
1625
+ return item.id === dd.id;
1626
+ }),
1627
+ },
1628
+ preview: true,
1629
+ with_qty: false,
1630
+ is_gift: true,
1631
+ callback: () => {
1632
+ gvc.closeDialog();
1633
+ let find = vm.cartData.lineItems.find(
1634
+ (d1: any) => {
1635
+ return dd.add_on_products.find(
1636
+ (d2: any) => {
1637
+ return d2.id === d1.id;
1638
+ }
1639
+ );
1640
+ }
1641
+ );
1642
+ if (find) {
1643
+ apiCart.setCart(cartItem => {
1644
+ cartItem.line_items.map(dd => {
1645
+ if (dd.id === find.id) {
1646
+ dd.count--;
1647
+ }
1648
+ });
1649
+ cartItem.line_items =
1650
+ cartItem.line_items.filter(dd => {
1651
+ return dd.count > 0;
1652
+ });
1653
+ refreshCartData();
1654
+ gvc.closeDialog();
1655
+ });
1656
+ } else {
1657
+ refreshCartData();
1658
+ gvc.closeDialog();
1659
+ }
1660
+ },
1661
+ })}
1656
1662
  <div
1657
1663
  class="d-sm-none"
1658
1664
  style="height:100px;"
@@ -1660,16 +1666,16 @@ export class CheckoutIndex {
1660
1666
  </div>
1661
1667
  </div>
1662
1668
  </div>`;
1663
- },
1664
- Tool.randomString(7),
1665
- {
1666
- animation:
1667
- document.body.clientWidth < 768
1668
- ? Animation.popup
1669
- : Animation.fade,
1670
- }
1671
- );
1672
- })}"
1669
+ },
1670
+ Tool.randomString(7),
1671
+ {
1672
+ animation:
1673
+ document.body.clientWidth < 768
1674
+ ? Animation.popup
1675
+ : Animation.fade,
1676
+ }
1677
+ );
1678
+ })}"
1673
1679
  >
1674
1680
  <span class="${gClass('button-text')}"
1675
1681
  >${Language.text('add_to_cart')}</span
@@ -1677,8 +1683,8 @@ export class CheckoutIndex {
1677
1683
  </button>
1678
1684
  </div>
1679
1685
  </div>`;
1680
- })
1681
- .join('')}
1686
+ })
1687
+ .join('')}
1682
1688
  </div>
1683
1689
  </div>
1684
1690
  `;
@@ -1759,18 +1765,18 @@ export class CheckoutIndex {
1759
1765
  >
1760
1766
  ${shipmentList.length > 0
1761
1767
  ? shipmentList
1762
- .map((dd: { name: string; value: string }) => {
1763
- return html` <option
1764
- value="${dd.value}"
1765
- ${vm.cartData.user_info.shipment === dd.value
1766
- ? `selected`
1767
- : ''}
1768
- >
1769
- ${Language.text(`ship_${dd.value}`) ||
1770
- Language.getLanguageCustomText(dd.name)}
1771
- </option>`;
1772
- })
1773
- .join('')
1768
+ .map((dd: { name: string; value: string }) => {
1769
+ return html` <option
1770
+ value="${dd.value}"
1771
+ ${vm.cartData.user_info.shipment === dd.value
1772
+ ? `selected`
1773
+ : ''}
1774
+ >
1775
+ ${Language.text(`ship_${dd.value}`) ||
1776
+ Language.getLanguageCustomText(dd.name)}
1777
+ </option>`;
1778
+ })
1779
+ .join('')
1774
1780
  : html` <option selected>(${Language.text('disable_ship')})</option>`}
1775
1781
  </select>
1776
1782
  </div>`;
@@ -1790,9 +1796,9 @@ export class CheckoutIndex {
1790
1796
  ).response.value;
1791
1797
  if (log_config.content) {
1792
1798
  return html` <label class="${gClass('label')}"
1793
- >${Language.text('shipping_instructions')}</label
1794
- >
1795
- <div class="border rounded-3 p-2">${log_config.content}</div>`;
1799
+ >${Language.text('shipping_instructions')}</label
1800
+ >
1801
+ <div class="border rounded-3 p-2">${log_config.content}</div>`;
1796
1802
  }
1797
1803
  return '';
1798
1804
  },
@@ -1815,8 +1821,8 @@ export class CheckoutIndex {
1815
1821
  );
1816
1822
  })()
1817
1823
  ? gvc.bindView(() => {
1818
- const id = gvc.glitter.getUUID();
1819
- gvc.addStyle(`
1824
+ const id = gvc.glitter.getUUID();
1825
+ gvc.addStyle(`
1820
1826
  .city-selector select {
1821
1827
  -webkit-appearance: none;
1822
1828
  -moz-appearance: none;
@@ -1829,157 +1835,157 @@ export class CheckoutIndex {
1829
1835
  flex: 1;
1830
1836
  }
1831
1837
  `);
1832
- let select_id = '';
1833
- return {
1834
- bind: id,
1835
- view: () => {
1836
- select_id = gvc.glitter.getUUID();
1837
- return html`<label
1838
- class="${gClass('label')} w-100 d-flex align-items-center"
1839
- >${Language.text('shipping_address')}
1840
- <div class="flex-fill"></div>
1841
- <div
1842
- class="fs-sm fw-500 ${!GlobalUser.token ? `d-none` : ''}"
1843
- style="cursor: pointer; color: #3366bb;"
1844
- onclick="${gvc.event(() => {
1845
- ApiUser.getUserData(GlobalUser.token, 'me').then(res => {
1846
- vm.cartData.user_info.address =
1847
- res.response.userData.consignee_address;
1848
- this.storeLocalData(vm.cartData);
1849
- gvc.notifyDataChange(id);
1838
+ let select_id = '';
1839
+ return {
1840
+ bind: id,
1841
+ view: () => {
1842
+ select_id = gvc.glitter.getUUID();
1843
+ return html`<label
1844
+ class="${gClass('label')} w-100 d-flex align-items-center"
1845
+ >${Language.text('shipping_address')}
1846
+ <div class="flex-fill"></div>
1847
+ <div
1848
+ class="fs-sm fw-500 ${!GlobalUser.token ? `d-none` : ''}"
1849
+ style="cursor: pointer; color: #3366bb;"
1850
+ onclick="${gvc.event(() => {
1851
+ ApiUser.getUserData(GlobalUser.token, 'me').then(res => {
1852
+ vm.cartData.user_info.address =
1853
+ res.response.userData.consignee_address;
1854
+ this.storeLocalData(vm.cartData);
1855
+ gvc.notifyDataChange(id);
1856
+ });
1857
+ })}"
1858
+ >
1859
+ ${Language.text('quick_input')}
1860
+ </div>
1861
+ </label>
1862
+ <div class="row">
1863
+ <div class="col-12 mb-3">
1864
+ <div
1865
+ role="tw-city-selector"
1866
+ id="select_id_${id}"
1867
+ class="w-100 city-selector d-flex d_${select_id}"
1868
+ style="gap:15px;"
1869
+ ></div>
1870
+ </div>
1871
+ <div class="col-12">
1872
+ <input
1873
+ class="${gClass('input')}"
1874
+ type="address"
1875
+ placeholder="${Language.text('please_enter_street_location')}"
1876
+ value="${vm.cartData.user_info.address || ''}"
1877
+ onchange="${gvc.event(e => {
1878
+ vm.cartData.user_info.address = e.value;
1879
+ this.storeLocalData(vm.cartData);
1880
+ })}"
1881
+ />
1882
+ </div>
1883
+ </div> `;
1884
+ },
1885
+ divCreate: {
1886
+ class: `col-12 mb-2`,
1887
+ },
1888
+ onCreate: () => {
1889
+ gvc.glitter.addMtScript(
1890
+ [
1891
+ {
1892
+ src: 'https://cdn.jsdelivr.net/npm/tw-city-selector@2.1.1/dist/tw-city-selector.min.js',
1893
+ },
1894
+ ],
1895
+ () => {
1896
+ //@ts-ignore
1897
+ const tw_selector = new TwCitySelector({
1898
+ el: `.d_${select_id}`,
1850
1899
  });
1851
- })}"
1852
- >
1853
- ${Language.text('quick_input')}
1854
- </div>
1855
- </label>
1856
- <div class="row">
1857
- <div class="col-12 mb-3">
1858
- <div
1859
- role="tw-city-selector"
1860
- id="select_id_${id}"
1861
- class="w-100 city-selector d-flex d_${select_id}"
1862
- style="gap:15px;"
1863
- ></div>
1864
- </div>
1865
- <div class="col-12">
1866
- <input
1867
- class="${gClass('input')}"
1868
- type="address"
1869
- placeholder="${Language.text('please_enter_street_location')}"
1870
- value="${vm.cartData.user_info.address || ''}"
1871
- onchange="${gvc.event(e => {
1872
- vm.cartData.user_info.address = e.value;
1873
- this.storeLocalData(vm.cartData);
1874
- })}"
1875
- />
1876
- </div>
1877
- </div> `;
1878
- },
1879
- divCreate: {
1880
- class: `col-12 mb-2`,
1881
- },
1882
- onCreate: () => {
1883
- gvc.glitter.addMtScript(
1884
- [
1885
- {
1886
- src: 'https://cdn.jsdelivr.net/npm/tw-city-selector@2.1.1/dist/tw-city-selector.min.js',
1887
- },
1888
- ],
1889
- () => {
1890
- //@ts-ignore
1891
- const tw_selector = new TwCitySelector({
1892
- el: `.d_${select_id}`,
1893
- });
1894
- const interVal = setInterval(() => {
1895
- if (document.querySelector(`#select_id_${id} .county`) as any) {
1896
- clearInterval(interVal);
1897
- (
1898
- document.querySelector(`#select_id_${id} .county`) as any
1899
- ).addEventListener('change', (event: any) => {
1900
- // 獲取當前選中的值
1901
- const selectedValue = event.target.value;
1902
-
1903
- // 根據選中的值執行其他操作
1904
- vm.cartData.user_info.city = selectedValue;
1905
- vm.cartData.user_info.area = undefined;
1906
- this.storeLocalData(vm.cartData);
1907
- });
1908
- (
1909
- document.querySelector(`#select_id_${id} .district`) as any
1910
- ).addEventListener('change', (event: any) => {
1911
- // 獲取當前選中的值
1912
- const selectedValue = event.target.value;
1913
-
1914
- // 根據選中的值執行其他操作
1915
- vm.cartData.user_info.area = selectedValue;
1916
- this.storeLocalData(vm.cartData);
1917
- });
1900
+ const interVal = setInterval(() => {
1901
+ if (document.querySelector(`#select_id_${id} .county`) as any) {
1902
+ clearInterval(interVal);
1903
+ (
1904
+ document.querySelector(`#select_id_${id} .county`) as any
1905
+ ).addEventListener('change', (event: any) => {
1906
+ // 獲取當前選中的值
1907
+ const selectedValue = event.target.value;
1908
+
1909
+ // 根據選中的值執行其他操作
1910
+ vm.cartData.user_info.city = selectedValue;
1911
+ vm.cartData.user_info.area = undefined;
1912
+ this.storeLocalData(vm.cartData);
1913
+ });
1914
+ (
1915
+ document.querySelector(`#select_id_${id} .district`) as any
1916
+ ).addEventListener('change', (event: any) => {
1917
+ // 獲取當前選中的值
1918
+ const selectedValue = event.target.value;
1919
+
1920
+ // 根據選中的值執行其他操作
1921
+ vm.cartData.user_info.area = selectedValue;
1922
+ this.storeLocalData(vm.cartData);
1923
+ });
1918
1924
 
1919
- if (vm.cartData.user_info.city && vm.cartData.user_info.area) {
1920
- tw_selector.setValue(
1921
- vm.cartData.user_info.city,
1922
- vm.cartData.user_info.area
1923
- );
1924
- } else if (vm.cartData.user_info.city) {
1925
- tw_selector.setValue(vm.cartData.user_info.city);
1925
+ if (vm.cartData.user_info.city && vm.cartData.user_info.area) {
1926
+ tw_selector.setValue(
1927
+ vm.cartData.user_info.city,
1928
+ vm.cartData.user_info.area
1929
+ );
1930
+ } else if (vm.cartData.user_info.city) {
1931
+ tw_selector.setValue(vm.cartData.user_info.city);
1932
+ }
1926
1933
  }
1927
- }
1928
- glitter.share.tw_selector = tw_selector;
1929
- }, 100);
1930
- },
1931
- () => {}
1932
- );
1933
- },
1934
- };
1935
- })
1934
+ glitter.share.tw_selector = tw_selector;
1935
+ }, 100);
1936
+ },
1937
+ () => {}
1938
+ );
1939
+ },
1940
+ };
1941
+ })
1936
1942
  : ''}
1937
1943
  <!-- 選取超商 -->
1938
1944
  ${ShipmentConfig.supermarketList.includes(vm.cartData.user_info.shipment)
1939
1945
  ? html` <div class="col-12">
1940
- <button
1941
- class="${gClass('button-bgr')}"
1942
- onclick="${gvc.event(() => {
1943
- ApiDelivery.storeMaps({
1944
- returnURL: (() => {
1946
+ <button
1947
+ class="${gClass('button-bgr')}"
1948
+ onclick="${gvc.event(() => {
1949
+ ApiDelivery.storeMaps({
1950
+ returnURL: (() => {
1951
+ if (ApplicationConfig.device_type === 'ios') {
1952
+ const url = new URL(location.href);
1953
+ url.searchParams.set('select_map_finish', 'true');
1954
+ return url.href;
1955
+ } else {
1956
+ return location.href;
1957
+ }
1958
+ })(),
1959
+ logistics: vm.cartData.user_info.shipment,
1960
+ }).then(async res => {
1945
1961
  if (ApplicationConfig.device_type === 'ios') {
1946
- const url = new URL(location.href);
1947
- url.searchParams.set('select_map_finish', 'true');
1948
- return url.href;
1962
+ glitter.runJsInterFace(
1963
+ 'post_form',
1964
+ {
1965
+ form: res.response.form,
1966
+ },
1967
+ () => {}
1968
+ );
1949
1969
  } else {
1950
- return location.href;
1970
+ const form_id = gvc.glitter.getUUID();
1971
+ $('body').append(`<div id="${form_id}">${res.response.form}</div>`);
1972
+ (document.querySelector(`#${form_id} #submit`) as any).click();
1951
1973
  }
1952
- })(),
1953
- logistics: vm.cartData.user_info.shipment,
1954
- }).then(async res => {
1955
- if (ApplicationConfig.device_type === 'ios') {
1956
- glitter.runJsInterFace(
1957
- 'post_form',
1958
- {
1959
- form: res.response.form,
1960
- },
1961
- () => {}
1962
- );
1963
- } else {
1964
- const form_id = gvc.glitter.getUUID();
1965
- $('body').append(`<div id="${form_id}">${res.response.form}</div>`);
1966
- (document.querySelector(`#${form_id} #submit`) as any).click();
1967
- }
1968
- });
1969
- })}"
1970
- >
1974
+ });
1975
+ })}"
1976
+ >
1971
1977
  <span class="${gClass('button-text')}"
1972
- >${(() => {
1973
- let cvs = glitter.getUrlParameter('CVSStoreName') || '';
1974
- if (decodeURIComponent(cvs)) {
1975
- return `${decodeURIComponent(cvs)} 『 ${Language.text('click_to_reselct_store')} 』`;
1976
- } else {
1977
- return Language.text('select_pickup_store');
1978
- }
1979
- })()}</span
1978
+ >${(() => {
1979
+ let cvs = glitter.getUrlParameter('CVSStoreName') || '';
1980
+ if (decodeURIComponent(cvs)) {
1981
+ return `${decodeURIComponent(cvs)} 『 ${Language.text('click_to_reselct_store')} 』`;
1982
+ } else {
1983
+ return Language.text('select_pickup_store');
1984
+ }
1985
+ })()}</span
1980
1986
  >
1981
- </button>
1982
- </div>`
1987
+ </button>
1988
+ </div>`
1983
1989
  : ''}
1984
1990
  ${(() => {
1985
1991
  if (vm.cartData.user_info.shipment === 'none') {
@@ -1987,138 +1993,138 @@ export class CheckoutIndex {
1987
1993
  }
1988
1994
  const ship_method = this.getShipmentMethod(vm.cartData).find((dd: any) => {
1989
1995
  return vm.cartData.user_info.shipment === dd.value;
1990
- });
1991
- if (ship_method && ship_method.system_form) {
1992
- return (ship_method.system_form ?? []).includes('global-address-selector');
1993
- }
1994
- return ['global_express'].includes(vm.cartData.user_info.shipment);
1995
- })()
1996
- ? [
1997
- html`<label class="${gClass('label')}">${Language.text('country')}</label>
1998
- ${gvc.bindView(() => {
1999
- const id = gvc.glitter.getUUID();
2000
- return {
2001
- bind: id,
2002
- view: async () => {
2003
- let country_select: any = [];
2004
- const support_country = (
2005
- await ApiUser.getPublicConfig('global_express_country', 'manager')
2006
- ).response.value.country;
2007
- await new Promise((resolve, reject) => {
2008
- glitter.getModule(
2009
- (() => {
2010
- switch (Language.getLanguage()) {
2011
- case 'en-US':
2012
- return `${gvc.glitter.root_path}/modules/country-language/country-en.js`;
2013
- case 'zh-CN':
2014
- return `${gvc.glitter.root_path}/modules/country-language/country-zh.js`;
2015
- default:
2016
- return `${gvc.glitter.root_path}/modules/country-language/country-tw.js`;
2017
- }
2018
- })(),
2019
- response => {
2020
- country_select = response.filter((dd: any) => {
2021
- return support_country.includes(dd.countryCode);
2022
- });
2023
- resolve(true);
2024
- }
2025
- );
2026
- });
2027
- return html`<select
2028
- class="w-100 ${gClass('select')}"
2029
- onchange="${gvc.event((e, event) => {
2030
- vm.cartData.user_info.country = e.value;
2031
- this.storeLocalData(vm.cartData);
2032
- refreshCartData();
2033
- })}"
2034
- >
2035
- ${(() => {
2036
- let map = country_select.map(
2037
- (dd: { countryCode: string; countryName: string }) => {
2038
- return html`
2039
- <option
2040
- value="${dd.countryCode}"
2041
- ${vm.cartData.user_info.country === dd.countryCode
2042
- ? `selected`
2043
- : ''}
2044
- >
2045
- ${dd.countryName}
2046
- </option>
2047
- `;
2048
- }
2049
- );
2050
- if (
2051
- !country_select.find((dd: any) => {
2052
- return dd.countryCode === vm.cartData.user_info.country;
2053
- })
2054
- ) {
2055
- delete vm.cartData.user_info.country;
2056
- map.push(
2057
- html` <option class="d-none" selected>
2058
- ${Language.text('select_country')}
2059
- </option>`
2060
- );
2061
- }
2062
- return map.join('');
2063
- })()}
2064
- </select>`;
2065
- },
2066
- };
2067
- })}`,
2068
- html` <label class="${gClass('label')}"
2069
- >${Language.text('shipping_address')}</label
2070
- >
2071
- <input
2072
- class="${gClass('input')}"
2073
- type="address"
2074
- placeholder="${Language.text('please_enter_delivery_address')}"
2075
- value="${vm.cartData.user_info.address || ''}"
2076
- onchange="${gvc.event(e => {
2077
- vm.cartData.user_info.address = e.value;
2078
- this.storeLocalData(vm.cartData);
2079
- })}"
2080
- />`,
2081
- html` <label class="${gClass('label')}">${Language.text('city')}</label>
2082
- <input
2083
- class="${gClass('input')}"
2084
- type="city"
2085
- placeholder="${Language.text('city')}"
2086
- value="${vm.cartData.user_info.city || ''}"
2087
- onchange="${gvc.event(e => {
2088
- vm.cartData.user_info.city = e.value;
2089
- this.storeLocalData(vm.cartData);
2090
- })}"
2091
- />`,
2092
- html` <label class="${gClass('label')}">${Language.text('state')}</label>
2093
- <input
2094
- class="${gClass('input')}"
2095
- class="${gClass('input')}"
2096
- type="state"
2097
- placeholder="${Language.text('state')}"
2098
- value="${vm.cartData.user_info.state || ''}"
2099
- onchange="${gvc.event(e => {
2100
- vm.cartData.user_info.state = e.value;
2101
- this.storeLocalData(vm.cartData);
2102
- })}"
2103
- />`,
2104
- html` <label class="${gClass('label')}"
2105
- >${Language.text('postal_code')}</label
2106
- >
2107
- <input
2108
- class="${gClass('input')}"
2109
- type=""
2110
- placeholder="${Language.text('postal_code')}"
2111
- value="${vm.cartData.user_info.postal_code || ''}"
2112
- onchange="${gvc.event(e => {
2113
- vm.cartData.user_info.postal_code = e.value;
2114
- this.storeLocalData(vm.cartData);
2115
- })}"
2116
- />`,
2117
- ]
2118
- .map(dd => {
2119
- return html` <div class="col-12 col-md-6 mb-2">${dd}</div>`;
2120
- })
2121
- .join('')
1996
+ });
1997
+ if (ship_method && ship_method.system_form) {
1998
+ return (ship_method.system_form ?? []).includes('global-address-selector');
1999
+ }
2000
+ return ['global_express'].includes(vm.cartData.user_info.shipment);
2001
+ })()
2002
+ ? [
2003
+ html`<label class="${gClass('label')}">${Language.text('country')}</label>
2004
+ ${gvc.bindView(() => {
2005
+ const id = gvc.glitter.getUUID();
2006
+ return {
2007
+ bind: id,
2008
+ view: async () => {
2009
+ let country_select: any = [];
2010
+ const support_country = (
2011
+ await ApiUser.getPublicConfig('global_express_country', 'manager')
2012
+ ).response.value.country;
2013
+ await new Promise((resolve, reject) => {
2014
+ glitter.getModule(
2015
+ (() => {
2016
+ switch (Language.getLanguage()) {
2017
+ case 'en-US':
2018
+ return `${gvc.glitter.root_path}/modules/country-language/country-en.js`;
2019
+ case 'zh-CN':
2020
+ return `${gvc.glitter.root_path}/modules/country-language/country-zh.js`;
2021
+ default:
2022
+ return `${gvc.glitter.root_path}/modules/country-language/country-tw.js`;
2023
+ }
2024
+ })(),
2025
+ response => {
2026
+ country_select = response.filter((dd: any) => {
2027
+ return support_country.includes(dd.countryCode);
2028
+ });
2029
+ resolve(true);
2030
+ }
2031
+ );
2032
+ });
2033
+ return html`<select
2034
+ class="w-100 ${gClass('select')}"
2035
+ onchange="${gvc.event((e, event) => {
2036
+ vm.cartData.user_info.country = e.value;
2037
+ this.storeLocalData(vm.cartData);
2038
+ refreshCartData();
2039
+ })}"
2040
+ >
2041
+ ${(() => {
2042
+ let map = country_select.map(
2043
+ (dd: { countryCode: string; countryName: string }) => {
2044
+ return html`
2045
+ <option
2046
+ value="${dd.countryCode}"
2047
+ ${vm.cartData.user_info.country === dd.countryCode
2048
+ ? `selected`
2049
+ : ''}
2050
+ >
2051
+ ${dd.countryName}
2052
+ </option>
2053
+ `;
2054
+ }
2055
+ );
2056
+ if (
2057
+ !country_select.find((dd: any) => {
2058
+ return dd.countryCode === vm.cartData.user_info.country;
2059
+ })
2060
+ ) {
2061
+ delete vm.cartData.user_info.country;
2062
+ map.push(
2063
+ html` <option class="d-none" selected>
2064
+ ${Language.text('select_country')}
2065
+ </option>`
2066
+ );
2067
+ }
2068
+ return map.join('');
2069
+ })()}
2070
+ </select>`;
2071
+ },
2072
+ };
2073
+ })}`,
2074
+ html` <label class="${gClass('label')}"
2075
+ >${Language.text('shipping_address')}</label
2076
+ >
2077
+ <input
2078
+ class="${gClass('input')}"
2079
+ type="address"
2080
+ placeholder="${Language.text('please_enter_delivery_address')}"
2081
+ value="${vm.cartData.user_info.address || ''}"
2082
+ onchange="${gvc.event(e => {
2083
+ vm.cartData.user_info.address = e.value;
2084
+ this.storeLocalData(vm.cartData);
2085
+ })}"
2086
+ />`,
2087
+ html` <label class="${gClass('label')}">${Language.text('city')}</label>
2088
+ <input
2089
+ class="${gClass('input')}"
2090
+ type="city"
2091
+ placeholder="${Language.text('city')}"
2092
+ value="${vm.cartData.user_info.city || ''}"
2093
+ onchange="${gvc.event(e => {
2094
+ vm.cartData.user_info.city = e.value;
2095
+ this.storeLocalData(vm.cartData);
2096
+ })}"
2097
+ />`,
2098
+ html` <label class="${gClass('label')}">${Language.text('state')}</label>
2099
+ <input
2100
+ class="${gClass('input')}"
2101
+ class="${gClass('input')}"
2102
+ type="state"
2103
+ placeholder="${Language.text('state')}"
2104
+ value="${vm.cartData.user_info.state || ''}"
2105
+ onchange="${gvc.event(e => {
2106
+ vm.cartData.user_info.state = e.value;
2107
+ this.storeLocalData(vm.cartData);
2108
+ })}"
2109
+ />`,
2110
+ html` <label class="${gClass('label')}"
2111
+ >${Language.text('postal_code')}</label
2112
+ >
2113
+ <input
2114
+ class="${gClass('input')}"
2115
+ type=""
2116
+ placeholder="${Language.text('postal_code')}"
2117
+ value="${vm.cartData.user_info.postal_code || ''}"
2118
+ onchange="${gvc.event(e => {
2119
+ vm.cartData.user_info.postal_code = e.value;
2120
+ this.storeLocalData(vm.cartData);
2121
+ })}"
2122
+ />`,
2123
+ ]
2124
+ .map(dd => {
2125
+ return html` <div class="col-12 col-md-6 mb-2">${dd}</div>`;
2126
+ })
2127
+ .join('')
2122
2128
  : ''}
2123
2129
  ${(() => {
2124
2130
  try {
@@ -2441,293 +2447,293 @@ export class CheckoutIndex {
2441
2447
  ...(method === 'nouse'
2442
2448
  ? []
2443
2449
  : [
2444
- {
2445
- col: '6',
2446
- key: 'invoice_type',
2447
- page: 'form-select',
2448
- type: 'form_plugin_v2',
2449
- group: '',
2450
- title: Language.text('invoice_recipient'),
2451
- col_sm: '12',
2452
- appName: 'cms_system',
2453
- require: 'true',
2454
- readonly: 'write',
2455
- formFormat: '{}',
2456
- moduleName: '下拉選單',
2457
- style_data: {
2458
- input: {
2459
- list: [],
2460
- class: '',
2461
- style: '',
2462
- version: 'v2',
2463
- },
2464
- label: {
2465
- list: [],
2466
- class: 'form-label fs-base ',
2467
- style: '',
2468
- version: 'v2',
2450
+ {
2451
+ col: '6',
2452
+ key: 'invoice_type',
2453
+ page: 'form-select',
2454
+ type: 'form_plugin_v2',
2455
+ group: '',
2456
+ title: Language.text('invoice_recipient'),
2457
+ col_sm: '12',
2458
+ appName: 'cms_system',
2459
+ require: 'true',
2460
+ readonly: 'write',
2461
+ formFormat: '{}',
2462
+ moduleName: '下拉選單',
2463
+ style_data: {
2464
+ input: {
2465
+ list: [],
2466
+ class: '',
2467
+ style: '',
2468
+ version: 'v2',
2469
+ },
2470
+ label: {
2471
+ list: [],
2472
+ class: 'form-label fs-base ',
2473
+ style: '',
2474
+ version: 'v2',
2475
+ },
2476
+ container: {
2477
+ list: [],
2478
+ class: '',
2479
+ style: '',
2480
+ version: 'v2',
2481
+ },
2469
2482
  },
2470
- container: {
2471
- list: [],
2472
- class: '',
2473
- style: '',
2474
- version: 'v2',
2483
+ form_config: {
2484
+ type: 'name',
2485
+ title: '',
2486
+ option: [
2487
+ {
2488
+ name: Language.text('personal'),
2489
+ index: 0,
2490
+ value: 'me',
2491
+ },
2492
+ {
2493
+ name: Language.text('company'),
2494
+ index: 1,
2495
+ value: 'company',
2496
+ },
2497
+ {
2498
+ name: Language.text('donate_invoice'),
2499
+ index: 2,
2500
+ value: 'donate',
2501
+ },
2502
+ ],
2503
+ input_style: { list: [], version: 'v2' },
2504
+ title_style: { list: [], version: 'v2' },
2505
+ place_holder: '',
2475
2506
  },
2507
+ hidden_code: "return (form_data['invoice_method']==='nouse')",
2476
2508
  },
2477
- form_config: {
2478
- type: 'name',
2479
- title: '',
2480
- option: [
2481
- {
2482
- name: Language.text('personal'),
2483
- index: 0,
2484
- value: 'me',
2509
+ {
2510
+ col: '6',
2511
+ key: 'send_type',
2512
+ page: 'form-select',
2513
+ type: 'form_plugin_v2',
2514
+ group: '',
2515
+ title: Language.text('invoice_method'),
2516
+ col_sm: '12',
2517
+ appName: 'cms_system',
2518
+ require: 'true',
2519
+ readonly: 'write',
2520
+ formFormat: '{}',
2521
+ moduleName: '下拉選單',
2522
+ style_data: {
2523
+ input: {
2524
+ list: [],
2525
+ class: '',
2526
+ style: '',
2527
+ version: 'v2',
2485
2528
  },
2486
- {
2487
- name: Language.text('company'),
2488
- index: 1,
2489
- value: 'company',
2529
+ label: {
2530
+ list: [],
2531
+ class: 'form-label fs-base ',
2532
+ style: '',
2533
+ version: 'v2',
2490
2534
  },
2491
- {
2492
- name: Language.text('donate_invoice'),
2493
- index: 2,
2494
- value: 'donate',
2535
+ container: {
2536
+ list: [],
2537
+ class: '',
2538
+ style: '',
2539
+ version: 'v2',
2495
2540
  },
2496
- ],
2497
- input_style: { list: [], version: 'v2' },
2498
- title_style: { list: [], version: 'v2' },
2499
- place_holder: '',
2500
- },
2501
- hidden_code: "return (form_data['invoice_method']==='nouse')",
2502
- },
2503
- {
2504
- col: '6',
2505
- key: 'send_type',
2506
- page: 'form-select',
2507
- type: 'form_plugin_v2',
2508
- group: '',
2509
- title: Language.text('invoice_method'),
2510
- col_sm: '12',
2511
- appName: 'cms_system',
2512
- require: 'true',
2513
- readonly: 'write',
2514
- formFormat: '{}',
2515
- moduleName: '下拉選單',
2516
- style_data: {
2517
- input: {
2518
- list: [],
2519
- class: '',
2520
- style: '',
2521
- version: 'v2',
2522
- },
2523
- label: {
2524
- list: [],
2525
- class: 'form-label fs-base ',
2526
- style: '',
2527
- version: 'v2',
2528
2541
  },
2529
- container: {
2530
- list: [],
2531
- class: '',
2532
- style: '',
2533
- version: 'v2',
2542
+ form_config: {
2543
+ type: 'name',
2544
+ title: '',
2545
+ option: [
2546
+ {
2547
+ name: Language.text('send_to_user_email'),
2548
+ index: 0,
2549
+ value: 'email',
2550
+ },
2551
+ {
2552
+ name: Language.text('mobile_barcode_device'),
2553
+ index: 1,
2554
+ value: 'carrier',
2555
+ },
2556
+ ],
2557
+ input_style: { list: [], version: 'v2' },
2558
+ title_style: { list: [], version: 'v2' },
2559
+ place_holder: '',
2534
2560
  },
2561
+ hidden_code:
2562
+ " if(form_data['invoice_type']!=='me' || (form_data['invoice_method']==='nouse') || (form_data['invoice_method']==='off_line')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2535
2563
  },
2536
- form_config: {
2537
- type: 'name',
2538
- title: '',
2539
- option: [
2540
- {
2541
- name: Language.text('send_to_user_email'),
2542
- index: 0,
2543
- value: 'email',
2564
+ {
2565
+ key: 'carrier_num',
2566
+ page: 'input',
2567
+ type: 'form_plugin_v2',
2568
+ group: '',
2569
+ title: Language.text('carrier_number'),
2570
+ appName: 'cms_system',
2571
+ require: 'false',
2572
+ readonly: 'write',
2573
+ formFormat: '{}',
2574
+ moduleName: '輸入框',
2575
+ col: '3',
2576
+ col_sm: '12',
2577
+ style_data: {
2578
+ input: {
2579
+ list: [],
2580
+ class: '',
2581
+ style: '',
2582
+ version: 'v2',
2544
2583
  },
2545
- {
2546
- name: Language.text('mobile_barcode_device'),
2547
- index: 1,
2548
- value: 'carrier',
2584
+ label: {
2585
+ list: [],
2586
+ class: 'form-label fs-base ',
2587
+ style: '',
2588
+ version: 'v2',
2589
+ },
2590
+ container: {
2591
+ list: [],
2592
+ class: '',
2593
+ style: '',
2594
+ version: 'v2',
2549
2595
  },
2550
- ],
2551
- input_style: { list: [], version: 'v2' },
2552
- title_style: { list: [], version: 'v2' },
2553
- place_holder: '',
2554
- },
2555
- hidden_code:
2556
- " if(form_data['invoice_type']!=='me' || (form_data['invoice_method']==='nouse') || (form_data['invoice_method']==='off_line')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2557
- },
2558
- {
2559
- key: 'carrier_num',
2560
- page: 'input',
2561
- type: 'form_plugin_v2',
2562
- group: '',
2563
- title: Language.text('carrier_number'),
2564
- appName: 'cms_system',
2565
- require: 'false',
2566
- readonly: 'write',
2567
- formFormat: '{}',
2568
- moduleName: '輸入框',
2569
- col: '3',
2570
- col_sm: '12',
2571
- style_data: {
2572
- input: {
2573
- list: [],
2574
- class: '',
2575
- style: '',
2576
- version: 'v2',
2577
- },
2578
- label: {
2579
- list: [],
2580
- class: 'form-label fs-base ',
2581
- style: '',
2582
- version: 'v2',
2583
2596
  },
2584
- container: {
2585
- list: [],
2586
- class: '',
2587
- style: '',
2588
- version: 'v2',
2597
+ form_config: {
2598
+ type: 'name',
2599
+ title: '',
2600
+ input_style: { list: [], version: 'v2' },
2601
+ title_style: { list: [], version: 'v2' },
2602
+ place_holder: Language.text('please_enter_carrier_number'),
2589
2603
  },
2604
+ hidden_code:
2605
+ " \n if(form_data['invoice_type']!=='me' || form_data['send_type']!=='carrier'){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2590
2606
  },
2591
- form_config: {
2592
- type: 'name',
2593
- title: '',
2594
- input_style: { list: [], version: 'v2' },
2595
- title_style: { list: [], version: 'v2' },
2596
- place_holder: Language.text('please_enter_carrier_number'),
2597
- },
2598
- hidden_code:
2599
- " \n if(form_data['invoice_type']!=='me' || form_data['send_type']!=='carrier'){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2600
- },
2601
- {
2602
- key: 'company',
2603
- page: 'input',
2604
- type: 'form_plugin_v2',
2605
- group: '',
2606
- title: Language.text('company_name'),
2607
- appName: 'cms_system',
2608
- require: 'false',
2609
- readonly: 'write',
2610
- formFormat: '{}',
2611
- moduleName: '輸入框',
2612
- col: '3',
2613
- col_sm: '12',
2614
- style_data: {
2615
- input: {
2616
- list: [],
2617
- class: '',
2618
- style: '',
2619
- version: 'v2',
2620
- },
2621
- label: {
2622
- list: [],
2623
- class: 'form-label fs-base ',
2624
- style: '',
2625
- version: 'v2',
2607
+ {
2608
+ key: 'company',
2609
+ page: 'input',
2610
+ type: 'form_plugin_v2',
2611
+ group: '',
2612
+ title: Language.text('company_name'),
2613
+ appName: 'cms_system',
2614
+ require: 'false',
2615
+ readonly: 'write',
2616
+ formFormat: '{}',
2617
+ moduleName: '輸入框',
2618
+ col: '3',
2619
+ col_sm: '12',
2620
+ style_data: {
2621
+ input: {
2622
+ list: [],
2623
+ class: '',
2624
+ style: '',
2625
+ version: 'v2',
2626
+ },
2627
+ label: {
2628
+ list: [],
2629
+ class: 'form-label fs-base ',
2630
+ style: '',
2631
+ version: 'v2',
2632
+ },
2633
+ container: {
2634
+ list: [],
2635
+ class: '',
2636
+ style: '',
2637
+ version: 'v2',
2638
+ },
2626
2639
  },
2627
- container: {
2628
- list: [],
2629
- class: '',
2630
- style: '',
2631
- version: 'v2',
2640
+ form_config: {
2641
+ type: 'name',
2642
+ title: '',
2643
+ input_style: { list: [], version: 'v2' },
2644
+ title_style: { list: [], version: 'v2' },
2645
+ place_holder: Language.text('please_enter_company_name'),
2632
2646
  },
2647
+ hidden_code:
2648
+ " if(form_data['invoice_type']!=='company' || (form_data['invoice_method']==='nouse')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2633
2649
  },
2634
- form_config: {
2635
- type: 'name',
2636
- title: '',
2637
- input_style: { list: [], version: 'v2' },
2638
- title_style: { list: [], version: 'v2' },
2639
- place_holder: Language.text('please_enter_company_name'),
2640
- },
2641
- hidden_code:
2642
- " if(form_data['invoice_type']!=='company' || (form_data['invoice_method']==='nouse')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2643
- },
2644
- {
2645
- key: 'gui_number',
2646
- page: 'input',
2647
- type: 'form_plugin_v2',
2648
- group: '',
2649
- title: Language.text('company_tax_id'),
2650
- col: '3',
2651
- col_sm: '12',
2652
- appName: 'cms_system',
2653
- require: 'false',
2654
- readonly: 'write',
2655
- formFormat: '{}',
2656
- moduleName: '輸入框',
2657
- style_data: {
2658
- input: {
2659
- list: [],
2660
- class: '',
2661
- style: '',
2662
- version: 'v2',
2663
- },
2664
- label: {
2665
- list: [],
2666
- class: 'form-label fs-base ',
2667
- style: '',
2668
- version: 'v2',
2650
+ {
2651
+ key: 'gui_number',
2652
+ page: 'input',
2653
+ type: 'form_plugin_v2',
2654
+ group: '',
2655
+ title: Language.text('company_tax_id'),
2656
+ col: '3',
2657
+ col_sm: '12',
2658
+ appName: 'cms_system',
2659
+ require: 'false',
2660
+ readonly: 'write',
2661
+ formFormat: '{}',
2662
+ moduleName: '輸入框',
2663
+ style_data: {
2664
+ input: {
2665
+ list: [],
2666
+ class: '',
2667
+ style: '',
2668
+ version: 'v2',
2669
+ },
2670
+ label: {
2671
+ list: [],
2672
+ class: 'form-label fs-base ',
2673
+ style: '',
2674
+ version: 'v2',
2675
+ },
2676
+ container: {
2677
+ list: [],
2678
+ class: '',
2679
+ style: '',
2680
+ version: 'v2',
2681
+ },
2669
2682
  },
2670
- container: {
2671
- list: [],
2672
- class: '',
2673
- style: '',
2674
- version: 'v2',
2683
+ form_config: {
2684
+ type: 'name',
2685
+ title: '',
2686
+ input_style: { list: [], version: 'v2' },
2687
+ title_style: { list: [], version: 'v2' },
2688
+ place_holder: Language.text('please_enter_company_tax_id'),
2675
2689
  },
2690
+ hidden_code:
2691
+ " if(form_data['invoice_type']!=='company'){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2676
2692
  },
2677
- form_config: {
2678
- type: 'name',
2679
- title: '',
2680
- input_style: { list: [], version: 'v2' },
2681
- title_style: { list: [], version: 'v2' },
2682
- place_holder: Language.text('please_enter_company_tax_id'),
2683
- },
2684
- hidden_code:
2685
- " if(form_data['invoice_type']!=='company'){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2686
- },
2687
- {
2688
- col: '6',
2689
- key: 'love_code',
2690
- page: 'input',
2691
- type: 'form_plugin_v2',
2692
- group: '',
2693
- title: Language.text('donation_code'),
2694
- col_sm: '12',
2695
- appName: 'cms_system',
2696
- require: 'false',
2697
- readonly: 'write',
2698
- formFormat: '{}',
2699
- moduleName: '輸入框',
2700
- style_data: {
2701
- input: {
2702
- list: [],
2703
- class: '',
2704
- style: '',
2705
- version: 'v2',
2706
- },
2707
- label: {
2708
- list: [],
2709
- class: 'form-label fs-base ',
2710
- style: '',
2711
- version: 'v2',
2693
+ {
2694
+ col: '6',
2695
+ key: 'love_code',
2696
+ page: 'input',
2697
+ type: 'form_plugin_v2',
2698
+ group: '',
2699
+ title: Language.text('donation_code'),
2700
+ col_sm: '12',
2701
+ appName: 'cms_system',
2702
+ require: 'false',
2703
+ readonly: 'write',
2704
+ formFormat: '{}',
2705
+ moduleName: '輸入框',
2706
+ style_data: {
2707
+ input: {
2708
+ list: [],
2709
+ class: '',
2710
+ style: '',
2711
+ version: 'v2',
2712
+ },
2713
+ label: {
2714
+ list: [],
2715
+ class: 'form-label fs-base ',
2716
+ style: '',
2717
+ version: 'v2',
2718
+ },
2719
+ container: {
2720
+ list: [],
2721
+ class: '',
2722
+ style: '',
2723
+ version: 'v2',
2724
+ },
2712
2725
  },
2713
- container: {
2714
- list: [],
2715
- class: '',
2716
- style: '',
2717
- version: 'v2',
2726
+ form_config: {
2727
+ type: 'name',
2728
+ title: '',
2729
+ input_style: { list: [], version: 'v2' },
2730
+ title_style: { list: [], version: 'v2' },
2731
+ place_holder: Language.text('please_enter_donation_code'),
2718
2732
  },
2733
+ hidden_code:
2734
+ " if(form_data['invoice_type']!=='donate' || (form_data['invoice_method']==='nouse')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2719
2735
  },
2720
- form_config: {
2721
- type: 'name',
2722
- title: '',
2723
- input_style: { list: [], version: 'v2' },
2724
- title_style: { list: [], version: 'v2' },
2725
- place_holder: Language.text('please_enter_donation_code'),
2726
- },
2727
- hidden_code:
2728
- " if(form_data['invoice_type']!=='donate' || (form_data['invoice_method']==='nouse')){\n form_data[form_key]=undefined\nreturn true\n }else{\n return false\n }",
2729
- },
2730
- ]),
2736
+ ]),
2731
2737
  {
2732
2738
  col: '12',
2733
2739
  key: 'note',
@@ -2918,10 +2924,10 @@ export class CheckoutIndex {
2918
2924
  class="d-flex align-items-center justify-content-end"
2919
2925
  style="width:1180px;max-width: 100%;gap:24px;"
2920
2926
  >
2921
- <div class="d-flex align-items-end fs-base" style="gap:5px;">
2922
- <span style="white-space:nowrap;" class="fw-bold fs-sm">
2923
- ${Language.text('total_amount')}</span
2924
- >
2927
+ <div class="d-flex align-items-center fs-base" style="gap:5px;">
2928
+ <div style="white-space:nowrap;" class="fw-bold fs-sm">
2929
+ ${Language.text('total_amount')}
2930
+ </div>
2925
2931
  <div class="${gClass(['price-row', 'text-1', 'bold'])}">
2926
2932
  <div class="fs-5 fw-bold ${gClass('price-text')}">
2927
2933
  ${Currency.convertCurrencyText(vm.cartData.total)}
@@ -2932,181 +2938,181 @@ export class CheckoutIndex {
2932
2938
  <div>
2933
2939
  <button
2934
2940
  class="${gClass(
2935
- verify.length > 0 ? 'button-bgr-disable' : 'button-bgr'
2936
- )}"
2941
+ verify.length > 0 ? 'button-bgr-disable' : 'button-bgr'
2942
+ )}"
2937
2943
  style="${document.body.clientWidth < 800
2938
- ? `min-width:100px;`
2939
- : `min-width:380px;`}"
2944
+ ? `min-width:100px;`
2945
+ : `min-width:380px;`}"
2940
2946
  onclick="${gvc.event(() => {
2941
- const that = this;
2942
- if (onlineData?.interaction?.status == 3) {
2943
- const dialog = new ShareDialog(gvc.glitter);
2944
- dialog.infoMessage({
2945
- text: `很抱歉,團購的結帳時間已截止,無法再進行訂單結算。感謝您的支持,期待下次再為您服務!`,
2946
- });
2947
- return;
2948
- }
2949
-
2950
- if (
2951
- (window as any).login_config.login_in_to_order &&
2952
- !GlobalUser.token
2953
- ) {
2954
- GlobalUser.loginRedirect = location.href;
2955
- gvc.glitter.href = '/login';
2956
- return;
2957
- }
2958
-
2959
- function next() {
2960
- if (vm.cartData.user_info_same) {
2961
- vm.cartData.user_info.name = vm.cartData.customer_info.name;
2962
- vm.cartData.user_info.phone = vm.cartData.customer_info.phone;
2963
- vm.cartData.user_info.email = vm.cartData.customer_info.email;
2964
- }
2965
- if (verify.length > 0) {
2966
- return;
2967
- }
2968
-
2969
- if (shipmentList.length === 0) {
2970
- vm.cartData.user_info.shipment = 'none';
2971
- }
2972
-
2973
- const dialog = new ShareDialog(gvc.glitter);
2974
- if (!that.checkFormData(gvc, vm.cartData, widget)) {
2975
- return;
2976
- }
2977
- for (const item of vm.cartData.lineItems) {
2978
- const title =
2979
- (item.language_data &&
2980
- item.language_data[Language.getLanguage()].title) ||
2981
- item.title;
2982
- let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
2983
- let max_qty =
2984
- (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
2985
- let count = 0;
2986
- for (const b of vm.cartData.lineItems) {
2987
- if (b.id === item.id) {
2988
- count += b.count;
2947
+ const that = this;
2948
+ if (onlineData?.interaction?.status == 3) {
2949
+ const dialog = new ShareDialog(gvc.glitter);
2950
+ dialog.infoMessage({
2951
+ text: `很抱歉,團購的結帳時間已截止,無法再進行訂單結算。感謝您的支持,期待下次再為您服務!`,
2952
+ });
2953
+ return;
2989
2954
  }
2990
- }
2991
- if (count < min) {
2992
- dialog.errorMessage({
2993
- text: Language.text('min_p_count_d')
2994
- .replace('_c_', min)
2995
- .replace('_p_', `『${title}』`),
2996
- });
2997
- return;
2998
- }
2999
- if (count > max_qty) {
3000
- dialog.errorMessage({
3001
- text: Language.text('max_p_count_d')
3002
- .replace('_c_', max_qty)
3003
- .replace('_p_', `『${title}』`),
3004
- });
3005
- return;
3006
- }
3007
- if (max_qty > 0 && count + item.buy_history_count > max_qty) {
3008
- dialog.errorMessage({
3009
- text: Language.text('trigger_maximum_item').replace(
3010
- '_p_',
3011
- `『${title}』`
3012
- ),
3013
- });
3014
- return;
3015
- }
3016
- }
3017
- [
3018
- 'MerchantTradeNo',
3019
- 'LogisticsSubType',
3020
- 'CVSStoreID',
3021
- 'CVSStoreName',
3022
- 'CVSTelephone',
3023
- 'CVSOutSide',
3024
- 'ExtraData',
3025
- 'CVSAddress',
3026
- ].map(dd => {
3027
- if (gvc.glitter.getUrlParameter(dd)) {
3028
- vm.cartData.user_info[dd] = decodeURI(
3029
- glitter.getUrlParameter(dd)
3030
- );
3031
- }
3032
- });
3033
- dialog.dataLoading({ visible: true });
3034
- vm.cartData.user_info.note =
3035
- (vm.cartData.user_info.note ?? '') + (check_out_sub.note ?? '');
3036
- ApiShop.toCheckout({
3037
- line_items: vm.cartData.lineItems.map((dd: any) => {
3038
- return {
3039
- id: dd.id,
3040
- spec: dd.spec,
3041
- count: dd.count,
3042
- };
3043
- }),
3044
- customer_info: vm.cartData.customer_info,
3045
- return_url: (() => {
3046
- const originalUrl =
3047
- glitter.root_path + 'order_detail' + location.search;
3048
- const urlObject = new URL(originalUrl);
3049
- urlObject.searchParams.set('EndCheckout', '1');
3050
- const newUrl = urlObject.toString();
2955
+
3051
2956
  if (
3052
- ApplicationConfig.device_type !== 'web' &&
3053
- ['jkopay', 'line_pay'].includes(
3054
- vm.cartData.customer_info.payment_select
3055
- )
2957
+ (window as any).login_config.login_in_to_order &&
2958
+ !GlobalUser.token
3056
2959
  ) {
3057
- return `${ApplicationConfig.bundle_id}://?path=${encodeURIComponent(newUrl)}`;
3058
- } else {
3059
- return newUrl;
3060
- }
3061
- })(),
3062
- user_info: vm.cartData.user_info,
3063
- code: apiCart.cart.code,
3064
- use_rebate: apiCart.cart.use_rebate,
3065
- custom_form_format: vm.cartData.custom_form_format,
3066
- custom_form_data: vm.cartData.custom_form_data,
3067
- custom_receipt_form: vm.cartData.receipt_form,
3068
- distribution_code:
3069
- localStorage.getItem('distributionCode') ?? '',
3070
- give_away: apiCart.cart.give_away,
3071
- }).then(res => {
3072
- dialog.dataLoading({ visible: false });
3073
- if (!res.result){
3074
- dialog.infoMessage({
3075
- text: '系統處理您的付款時遇到一些問題,導致交易未能完成。請聯繫我們的客服團隊以取得進一步的協助'
3076
- })
3077
- return
3078
- }
3079
- if (vm.cartData.customer_info.payment_select == 'paynow') {
3080
- if (!res.response?.data?.result?.secret) {
3081
- return 'paynow API失敗';
2960
+ GlobalUser.loginRedirect = location.href;
2961
+ gvc.glitter.href = '/login';
2962
+ return;
3082
2963
  }
3083
- glitter.innerDialog(
3084
- (gvc: GVC) => {
3085
- document.body.style.setProperty(
3086
- 'overflow-y',
3087
- 'hidden',
3088
- 'important'
3089
- );
3090
- return gvc.bindView({
3091
- bind: `paynow`,
3092
- view: () => {
3093
- return html` <div
2964
+
2965
+ function next() {
2966
+ if (vm.cartData.user_info_same) {
2967
+ vm.cartData.user_info.name = vm.cartData.customer_info.name;
2968
+ vm.cartData.user_info.phone = vm.cartData.customer_info.phone;
2969
+ vm.cartData.user_info.email = vm.cartData.customer_info.email;
2970
+ }
2971
+ if (verify.length > 0) {
2972
+ return;
2973
+ }
2974
+
2975
+ if (shipmentList.length === 0) {
2976
+ vm.cartData.user_info.shipment = 'none';
2977
+ }
2978
+
2979
+ const dialog = new ShareDialog(gvc.glitter);
2980
+ if (!that.checkFormData(gvc, vm.cartData, widget)) {
2981
+ return;
2982
+ }
2983
+ for (const item of vm.cartData.lineItems) {
2984
+ const title =
2985
+ (item.language_data &&
2986
+ item.language_data[Language.getLanguage()].title) ||
2987
+ item.title;
2988
+ let min = (item.min_qty && parseInt(item.min_qty, 10)) || 1;
2989
+ let max_qty =
2990
+ (item.max_qty && parseInt(item.max_qty, 10)) || Infinity;
2991
+ let count = 0;
2992
+ for (const b of vm.cartData.lineItems) {
2993
+ if (b.id === item.id) {
2994
+ count += b.count;
2995
+ }
2996
+ }
2997
+ if (count < min) {
2998
+ dialog.errorMessage({
2999
+ text: Language.text('min_p_count_d')
3000
+ .replace('_c_', min)
3001
+ .replace('_p_', `『${title}』`),
3002
+ });
3003
+ return;
3004
+ }
3005
+ if (count > max_qty) {
3006
+ dialog.errorMessage({
3007
+ text: Language.text('max_p_count_d')
3008
+ .replace('_c_', max_qty)
3009
+ .replace('_p_', `『${title}』`),
3010
+ });
3011
+ return;
3012
+ }
3013
+ if (max_qty > 0 && count + item.buy_history_count > max_qty) {
3014
+ dialog.errorMessage({
3015
+ text: Language.text('trigger_maximum_item').replace(
3016
+ '_p_',
3017
+ `『${title}』`
3018
+ ),
3019
+ });
3020
+ return;
3021
+ }
3022
+ }
3023
+ [
3024
+ 'MerchantTradeNo',
3025
+ 'LogisticsSubType',
3026
+ 'CVSStoreID',
3027
+ 'CVSStoreName',
3028
+ 'CVSTelephone',
3029
+ 'CVSOutSide',
3030
+ 'ExtraData',
3031
+ 'CVSAddress',
3032
+ ].map(dd => {
3033
+ if (gvc.glitter.getUrlParameter(dd)) {
3034
+ vm.cartData.user_info[dd] = decodeURI(
3035
+ glitter.getUrlParameter(dd)
3036
+ );
3037
+ }
3038
+ });
3039
+ dialog.dataLoading({ visible: true });
3040
+ vm.cartData.user_info.note =
3041
+ (vm.cartData.user_info.note ?? '') + (check_out_sub.note ?? '');
3042
+ ApiShop.toCheckout({
3043
+ line_items: vm.cartData.lineItems.map((dd: any) => {
3044
+ return {
3045
+ id: dd.id,
3046
+ spec: dd.spec,
3047
+ count: dd.count,
3048
+ };
3049
+ }),
3050
+ customer_info: vm.cartData.customer_info,
3051
+ return_url: (() => {
3052
+ const originalUrl =
3053
+ glitter.root_path + 'order_detail' + location.search;
3054
+ const urlObject = new URL(originalUrl);
3055
+ urlObject.searchParams.set('EndCheckout', '1');
3056
+ const newUrl = urlObject.toString();
3057
+ if (
3058
+ ApplicationConfig.device_type !== 'web' &&
3059
+ ['jkopay', 'line_pay'].includes(
3060
+ vm.cartData.customer_info.payment_select
3061
+ )
3062
+ ) {
3063
+ return `${ApplicationConfig.bundle_id}://?path=${encodeURIComponent(newUrl)}`;
3064
+ } else {
3065
+ return newUrl;
3066
+ }
3067
+ })(),
3068
+ user_info: vm.cartData.user_info,
3069
+ code: apiCart.cart.code,
3070
+ use_rebate: apiCart.cart.use_rebate,
3071
+ custom_form_format: vm.cartData.custom_form_format,
3072
+ custom_form_data: vm.cartData.custom_form_data,
3073
+ custom_receipt_form: vm.cartData.receipt_form,
3074
+ distribution_code:
3075
+ localStorage.getItem('distributionCode') ?? '',
3076
+ give_away: apiCart.cart.give_away,
3077
+ }).then(res => {
3078
+ dialog.dataLoading({ visible: false });
3079
+ if (!res.result) {
3080
+ dialog.infoMessage({
3081
+ text: '系統處理您的付款時遇到一些問題,導致交易未能完成。請聯繫我們的客服團隊以取得進一步的協助',
3082
+ });
3083
+ return;
3084
+ }
3085
+ if (vm.cartData.customer_info.payment_select == 'paynow') {
3086
+ if (!res.response?.data?.result?.secret) {
3087
+ return 'paynow API失敗';
3088
+ }
3089
+ glitter.innerDialog(
3090
+ (gvc: GVC) => {
3091
+ document.body.style.setProperty(
3092
+ 'overflow-y',
3093
+ 'hidden',
3094
+ 'important'
3095
+ );
3096
+ return gvc.bindView({
3097
+ bind: `paynow`,
3098
+ view: () => {
3099
+ return html` <div
3094
3100
  class="w-100 h-100 d-flex align-items-center justify-content-center"
3095
3101
  >
3096
3102
  ${document.body.clientWidth < 800
3097
- ? `
3103
+ ? `
3098
3104
  <div class="bg-white position-relative vw-100" style="height: ${window.innerHeight}px;overflow-y: auto;
3099
3105
  padding-top:${50 + glitter.share.top_inset}px;
3100
3106
  ">
3101
3107
  `
3102
- : `<div class="p-3 bg-white position-relative" style="max-height: calc(100vh - 90px);overflow-y:auto;">`}
3108
+ : `<div class="p-3 bg-white position-relative" style="max-height: calc(100vh - 90px);overflow-y:auto;">`}
3103
3109
  <div
3104
3110
  style="position: absolute; right: 15px;top:${15 +
3105
- glitter.share.top_inset}px;z-index:1;"
3111
+ glitter.share.top_inset}px;z-index:1;"
3106
3112
  onclick="${gvc.event(() => {
3107
3113
  location.href = res.response.returnUrl;
3108
- gvc.closeDialog();
3109
- })}"
3114
+ gvc.closeDialog();
3115
+ })}"
3110
3116
  >
3111
3117
  <i
3112
3118
  class="fa-regular fa-circle-xmark fs-5 text-dark cursor_pointer"
@@ -3120,24 +3126,24 @@ export class CheckoutIndex {
3120
3126
  <div class="px-3 px-sm-0 w-100">
3121
3127
  <button
3122
3128
  class="${gClass(
3123
- verify.length > 0
3124
- ? 'button-bgr-disable'
3125
- : 'button-bgr'
3126
- )} "
3129
+ verify.length > 0
3130
+ ? 'button-bgr-disable'
3131
+ : 'button-bgr'
3132
+ )} "
3127
3133
  id="checkoutButton"
3128
3134
  onclick="${gvc.event(() => {
3129
- const PayNow = (window as any).PayNow;
3130
- const dialog = new ShareDialog(gvc.glitter);
3131
- dialog.dataLoading({ visible: true });
3132
- PayNow.checkout().then((response: any) => {
3133
- dialog.dataLoading({ visible: false });
3134
- if (response.error) {
3135
- dialog.errorMessage({
3136
- text: response.error.message,
3137
- });
3138
- }
3139
- });
3140
- })}"
3135
+ const PayNow = (window as any).PayNow;
3136
+ const dialog = new ShareDialog(gvc.glitter);
3137
+ dialog.dataLoading({ visible: true });
3138
+ PayNow.checkout().then((response: any) => {
3139
+ dialog.dataLoading({ visible: false });
3140
+ if (response.error) {
3141
+ dialog.errorMessage({
3142
+ text: response.error.message,
3143
+ });
3144
+ }
3145
+ });
3146
+ })}"
3141
3147
  >
3142
3148
  <span class="${gClass('button-text')}"
3143
3149
  >確認結帳</span
@@ -3145,148 +3151,148 @@ export class CheckoutIndex {
3145
3151
  </button>
3146
3152
  </div>
3147
3153
  </div>`;
3148
- },
3149
- divCreate: {
3150
- class: ` h-100 d-flex align-items-center justify-content-center`,
3151
- style: `max-width:100vw;${document.body.clientWidth < 800 ? 'width:100%;' : 'width:400px;'};`,
3152
- },
3153
- onCreate: () => {
3154
- const publicKey = res.response.publicKey;
3155
- const secret = res.response.data.result.secret;
3156
- const env =
3157
- res.response.BETA == 'true'
3158
- ? 'sandbox'
3159
- : 'production';
3160
- const PayNow = (window as any).PayNow;
3161
- PayNow.createPayment({
3162
- publicKey: publicKey,
3163
- secret: secret,
3164
- env: env,
3165
- });
3166
- PayNow.mount('#paynow-container', {
3167
- locale: 'zh_tw',
3168
- appearance: {
3169
- variables: {
3170
- fontFamily: 'monospace',
3171
- colorPrimary: '#0078ab',
3172
- colorDefault: '#0a0a0a',
3173
- colorBorder: '#cccccc',
3174
- colorPlaceholder: '#eeeeee',
3175
- borderRadius: '.3rem',
3176
- colorDanger: '#ff3d3d',
3177
3154
  },
3155
+ divCreate: {
3156
+ class: ` h-100 d-flex align-items-center justify-content-center`,
3157
+ style: `max-width:100vw;${document.body.clientWidth < 800 ? 'width:100%;' : 'width:400px;'};`,
3158
+ },
3159
+ onCreate: () => {
3160
+ const publicKey = res.response.publicKey;
3161
+ const secret = res.response.data.result.secret;
3162
+ const env =
3163
+ res.response.BETA == 'true'
3164
+ ? 'sandbox'
3165
+ : 'production';
3166
+ const PayNow = (window as any).PayNow;
3167
+ PayNow.createPayment({
3168
+ publicKey: publicKey,
3169
+ secret: secret,
3170
+ env: env,
3171
+ });
3172
+ PayNow.mount('#paynow-container', {
3173
+ locale: 'zh_tw',
3174
+ appearance: {
3175
+ variables: {
3176
+ fontFamily: 'monospace',
3177
+ colorPrimary: '#0078ab',
3178
+ colorDefault: '#0a0a0a',
3179
+ colorBorder: '#cccccc',
3180
+ colorPlaceholder: '#eeeeee',
3181
+ borderRadius: '.3rem',
3182
+ colorDanger: '#ff3d3d',
3183
+ },
3184
+ },
3185
+ });
3186
+ },
3187
+ });
3188
+ },
3189
+ `paynow`,
3190
+ {
3191
+ animation:
3192
+ document.body.clientWidth > 800
3193
+ ? Animation.fade
3194
+ : Animation.popup,
3195
+ dismiss: () => {
3196
+ document.body.style.setProperty('overflow-y', 'auto');
3178
3197
  },
3179
- });
3180
- },
3181
- });
3182
- },
3183
- `paynow`,
3184
- {
3185
- animation:
3186
- document.body.clientWidth > 800
3187
- ? Animation.fade
3188
- : Animation.popup,
3189
- dismiss: () => {
3190
- document.body.style.setProperty('overflow-y', 'auto');
3191
- },
3192
- }
3193
- );
3194
- }
3195
-
3196
- localStorage.setItem(
3197
- 'clear_cart_items',
3198
- JSON.stringify(
3199
- vm.cartData.lineItems.map((item: any) => item.id)
3200
- )
3201
- );
3198
+ }
3199
+ );
3200
+ }
3202
3201
 
3203
- if (res.response.off_line || res.response.is_free) {
3204
- location.href = res.response.return_url;
3205
- } else {
3206
- if (
3207
- res.response.returnCode == '0000' &&
3208
- vm.cartData.customer_info.payment_select == 'line_pay'
3209
- ) {
3210
- if (glitter.share.is_application) {
3211
- gvc.glitter.runJsInterFace(
3212
- 'intent_url',
3213
- {
3214
- url: res.response.info.paymentUrl.app,
3215
- },
3216
- () => {}
3217
- );
3218
- // location.href = res.response.info.paymentUrl.app;
3219
- } else {
3220
- location.href = res.response.info.paymentUrl.web;
3221
- }
3222
- // todo 手機跳轉用這個
3223
- // location.href = res.response.form.info.paymentUrl.app;
3224
- } else if (res.response.approveLink) {
3225
- location.href = res.response.approveLink;
3226
- } else if (
3227
- vm.cartData.customer_info.payment_select == 'jkopay'
3228
- ) {
3229
- if (glitter.share.is_application) {
3230
- gvc.glitter.runJsInterFace(
3231
- 'intent_url',
3232
- {
3233
- url: res.response.result_object.payment_url,
3234
- },
3235
- () => {}
3202
+ localStorage.setItem(
3203
+ 'clear_cart_items',
3204
+ JSON.stringify(
3205
+ vm.cartData.lineItems.map((item: any) => item.id)
3206
+ )
3236
3207
  );
3237
- } else {
3238
- location.href = res.response.result_object.payment_url;
3239
- }
3240
- } else {
3241
- const id = gvc.glitter.getUUID();
3242
- $('body').append(
3243
- html` <div id="${id}" style="display: none;">
3208
+
3209
+ if (res.response.off_line || res.response.is_free) {
3210
+ location.href = res.response.return_url;
3211
+ } else {
3212
+ if (
3213
+ res.response.returnCode == '0000' &&
3214
+ vm.cartData.customer_info.payment_select == 'line_pay'
3215
+ ) {
3216
+ if (glitter.share.is_application) {
3217
+ gvc.glitter.runJsInterFace(
3218
+ 'intent_url',
3219
+ {
3220
+ url: res.response.info.paymentUrl.app,
3221
+ },
3222
+ () => {}
3223
+ );
3224
+ // location.href = res.response.info.paymentUrl.app;
3225
+ } else {
3226
+ location.href = res.response.info.paymentUrl.web;
3227
+ }
3228
+ // todo 手機跳轉用這個
3229
+ // location.href = res.response.form.info.paymentUrl.app;
3230
+ } else if (res.response.approveLink) {
3231
+ location.href = res.response.approveLink;
3232
+ } else if (
3233
+ vm.cartData.customer_info.payment_select == 'jkopay'
3234
+ ) {
3235
+ if (glitter.share.is_application) {
3236
+ gvc.glitter.runJsInterFace(
3237
+ 'intent_url',
3238
+ {
3239
+ url: res.response.result_object.payment_url,
3240
+ },
3241
+ () => {}
3242
+ );
3243
+ } else {
3244
+ location.href = res.response.result_object.payment_url;
3245
+ }
3246
+ } else {
3247
+ const id = gvc.glitter.getUUID();
3248
+ $('body').append(
3249
+ html` <div id="${id}" style="display: none;">
3244
3250
  ${res.response.form}
3245
3251
  </div>`
3246
- );
3247
- (document.querySelector(`#${id} #submit`) as any).click();
3252
+ );
3253
+ (document.querySelector(`#${id} #submit`) as any).click();
3254
+ }
3255
+ }
3256
+ });
3248
3257
  }
3249
- }
3250
- });
3251
- }
3252
3258
 
3253
- if (
3254
- (window as any).login_config.login_in_to_order &&
3255
- !GlobalUser.token
3256
- ) {
3257
- GlobalUser.loginRedirect = location.href;
3258
- gvc.glitter.href = '/login';
3259
- return;
3260
- } else {
3261
- ApiUser.getUserData(GlobalUser.token, 'me').then(res => {
3262
- if (
3263
- res.response.userData &&
3264
- !res.response.userData.phone &&
3265
- (window as any).login_config.phone_verify &&
3266
- glitter.getUrlParameter('page') !== 'account_edit'
3267
- ) {
3268
- const dialog = new ShareDialog(glitter);
3269
- dialog.infoMessage({
3270
- text: Language.text('phone_verify_check'),
3271
- });
3272
- glitter.href = '/account_edit';
3273
- } else {
3274
- next();
3275
- }
3276
- });
3277
- }
3278
- })}"
3259
+ if (
3260
+ (window as any).login_config.login_in_to_order &&
3261
+ !GlobalUser.token
3262
+ ) {
3263
+ GlobalUser.loginRedirect = location.href;
3264
+ gvc.glitter.href = '/login';
3265
+ return;
3266
+ } else {
3267
+ ApiUser.getUserData(GlobalUser.token, 'me').then(res => {
3268
+ if (
3269
+ res.response.userData &&
3270
+ !res.response.userData.phone &&
3271
+ (window as any).login_config.phone_verify &&
3272
+ glitter.getUrlParameter('page') !== 'account_edit'
3273
+ ) {
3274
+ const dialog = new ShareDialog(glitter);
3275
+ dialog.infoMessage({
3276
+ text: Language.text('phone_verify_check'),
3277
+ });
3278
+ glitter.href = '/account_edit';
3279
+ } else {
3280
+ next();
3281
+ }
3282
+ });
3283
+ }
3284
+ })}"
3279
3285
  >
3280
3286
  <span
3281
3287
  class="${gClass('button-text')} "
3282
3288
  style="${verify.length > 0 ? `font-size:13px;` : ''}"
3283
3289
  >
3284
3290
  ${verify.length > 0
3285
- ? verify.join('<br/>')
3286
- : (window as any).login_config.login_in_to_order &&
3287
- !GlobalUser.token
3288
- ? Language.text('login_in_to_checkout')
3289
- : Language.text('next')}
3291
+ ? verify.join('<br/>')
3292
+ : (window as any).login_config.login_in_to_order &&
3293
+ !GlobalUser.token
3294
+ ? Language.text('login_in_to_checkout')
3295
+ : Language.text('next')}
3290
3296
  </span>
3291
3297
  </button>
3292
3298
  </div>
@@ -3602,7 +3608,7 @@ export class CheckoutIndex {
3602
3608
  </div>
3603
3609
  <div class="c_dialog">
3604
3610
  <div class="c_dialog_body">
3605
- <div class="c_dialog_main" style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
3611
+ <div class="c_dialog_main" style="gap: 24px; height: auto; max-height: 500px; padding: 12px;">
3606
3612
  ${obj.innerHTML(gvc)}
3607
3613
  </div>
3608
3614
  </div>
@@ -3659,20 +3665,20 @@ export class CheckoutIndex {
3659
3665
 
3660
3666
  cartData.off_line_support = cartData.off_line_support ?? {};
3661
3667
  cartData.off_line_support.atm &&
3662
- array.push({
3663
- name: '銀行轉帳',
3664
- value: 'atm',
3665
- });
3668
+ array.push({
3669
+ name: '銀行轉帳',
3670
+ value: 'atm',
3671
+ });
3666
3672
  cartData.off_line_support.line &&
3667
- array.push({
3668
- name: 'Line轉帳',
3669
- value: 'line',
3670
- });
3673
+ array.push({
3674
+ name: 'Line轉帳',
3675
+ value: 'line',
3676
+ });
3671
3677
  cartData.off_line_support.cash_on_delivery &&
3672
- array.push({
3673
- name: '貨到付款',
3674
- value: 'cash_on_delivery',
3675
- });
3678
+ array.push({
3679
+ name: '貨到付款',
3680
+ value: 'cash_on_delivery',
3681
+ });
3676
3682
  if (cartData.payment_info_custom && cartData.payment_info_custom.length > 0) {
3677
3683
  cartData.payment_info_custom.map((item: any) => {
3678
3684
  if (cartData.off_line_support[item.id]) {
@@ -3768,4 +3774,4 @@ export class CheckoutIndex {
3768
3774
  }
3769
3775
  }
3770
3776
 
3771
- (window as any).glitter.setModule(import.meta.url, CheckoutIndex);
3777
+ (window as any).glitter.setModule(import.meta.url, CheckoutIndex);