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.
- package/create.js +1 -0
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +39 -18
- package/lowcode/backend-manager/bg-product.ts +54 -23
- package/lowcode/cms-plugin/pos-pages/payment-page.js +37 -29
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +61 -49
- package/lowcode/cms-plugin/pos-pages/pos-function.js +6 -1
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +8 -1
- package/lowcode/cms-plugin/stock-history.js +1 -0
- package/lowcode/cms-plugin/stock-history.ts +1 -10
- package/lowcode/css/editor.css +2 -2
- package/lowcode/editor-components/global-widget/bridge.js +43 -0
- package/lowcode/editor-components/global-widget/bridge.ts +46 -0
- package/lowcode/editor-components/global-widget/global-widget.js +1 -1
- package/lowcode/editor-components/global-widget/global-widget.ts +1 -1
- package/lowcode/form-view/e-commerce/product-select.js +13 -11
- package/lowcode/form-view/e-commerce/product-select.ts +14 -12
- package/lowcode/glitterBundle/plugins/editor-elem.js +14 -4
- package/lowcode/glitterBundle/plugins/editor-elem.ts +13 -4
- package/lowcode/jspage/function-page/main_editor.js +14 -10
- package/lowcode/jspage/function-page/main_editor.ts +14 -10
- package/lowcode/jspage/function-page/tool-setting.js +259 -223
- package/lowcode/jspage/function-page/tool-setting.ts +349 -311
- package/lowcode/modules/tool.js +9 -0
- package/lowcode/modules/tool.ts +12 -0
- package/lowcode/official_view_component/official/component.ts +1 -0
- package/lowcode/public-components/checkout/index.js +216 -207
- package/lowcode/public-components/checkout/index.ts +1315 -1309
- package/package.json +3 -1
- package/src/api-public/models/glitter-finance.js +1 -2
- package/src/api-public/models/glitter-finance.js.map +1 -5
- package/src/api-public/services/checkout-event.js +17 -7
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/fb-service.js +4 -4
- package/src/api-public/services/fb-service.js.map +1 -1
- package/src/api-public/services/schedule.d.ts +1 -1
- package/src/api-public/services/schedule.js +18 -14
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +18 -14
- package/src/api-public/services/user.js +17 -7
- package/src/api-public/services/user.js.map +1 -1
- package/src/config.d.ts +1 -1
- package/src/modules/AWSLib.js +2 -3
- package/src/modules/AWSLib.js.map +1 -1
- package/src/modules/database.d.ts +1 -1
- package/src/modules/redis.d.ts +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +1 -2
- package/src/modules/tool.js.map +1 -1
- package/src/services/app.js +17 -7
- package/src/services/app.js.map +1 -1
- package/src/services/backend-service.js +17 -7
- package/src/services/backend-service.js.map +1 -1
- package/src/services/create-instance.js +3 -4
- package/src/services/create-instance.js.map +1 -1
- package/src/services/saas-table-check.js +2 -2
- package/src/services/saas-table-check.js.map +1 -5
- package/src/services/tool.js +2 -3
- 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
|
-
|
|
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
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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
|
-
|
|
519
|
+
>${Language.text('select_to_use')}</span
|
|
520
520
|
>
|
|
521
|
-
|
|
521
|
+
</button>`
|
|
522
522
|
: html` <button
|
|
523
|
-
|
|
524
|
-
|
|
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
|
-
|
|
527
|
+
>${Language.text('not_meet_usage_criteria')}</span
|
|
528
528
|
>
|
|
529
|
-
|
|
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
|
-
|
|
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
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
${
|
|
593
|
-
.map(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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
|
-
|
|
603
|
-
|
|
604
|
-
|
|
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
|
|
609
|
-
|
|
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
|
-
|
|
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
|
-
.
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
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
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
-
|
|
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
|
-
|
|
809
|
-
|
|
810
|
-
|
|
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
|
-
|
|
820
|
-
|
|
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
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
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
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
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
|
-
|
|
1080
|
-
|
|
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
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
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
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
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
|
-
|
|
1118
|
-
|
|
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
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
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
|
-
|
|
1143
|
-
|
|
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
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1151
|
+
vm.quantity,
|
|
1152
|
+
10
|
|
1153
|
+
) < 10
|
|
1154
|
+
? `text-indent: 43%;`
|
|
1155
|
+
: `text-indent: 40%;`}"
|
|
1150
1156
|
onchange="${gvc.event(e => {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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
|
-
|
|
1186
|
+
})
|
|
1187
|
+
.join('')}
|
|
1182
1188
|
</select>
|
|
1183
1189
|
<div
|
|
1184
1190
|
class=" align-items-center justify-content-center ${item.is_gift
|
|
1185
|
-
|
|
1186
|
-
|
|
1191
|
+
? `d-none`
|
|
1192
|
+
: `d-flex`}"
|
|
1187
1193
|
style="width:38px;height: 38px;cursor: pointer;"
|
|
1188
1194
|
onclick="${gvc.event(() => {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
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
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
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
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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
|
-
|
|
1248
|
-
|
|
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
|
-
|
|
1258
|
+
})
|
|
1259
|
+
.join('<div class="my-1"></div>')}
|
|
1254
1260
|
${(() => {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
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
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
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
|
-
|
|
1279
|
-
|
|
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
|
-
|
|
1283
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
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
|
-
|
|
1530
|
-
|
|
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
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
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
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1561
|
+
768
|
|
1562
|
+
? `rounded-3`
|
|
1563
|
+
: ` position-absolute bottom-0`}"
|
|
1558
1564
|
style=" ${document.body.clientWidth > 768
|
|
1559
|
-
|
|
1560
|
-
|
|
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
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1570
|
+
.clientWidth > 768
|
|
1571
|
+
? `rounded-3`
|
|
1572
|
+
: `h-100`}"
|
|
1567
1573
|
style="width: 100%; position: relative;${document
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1600
|
+
.body.clientWidth < 800
|
|
1601
|
+
? `padding: 12px 20px;`
|
|
1602
|
+
: `padding: 30px;`}"
|
|
1597
1603
|
>
|
|
1598
1604
|
${PdClass.selectSpec({
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
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
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
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
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
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
|
-
|
|
1819
|
-
|
|
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
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
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
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
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
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
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
|
-
|
|
1929
|
-
},
|
|
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
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
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
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1962
|
+
glitter.runJsInterFace(
|
|
1963
|
+
'post_form',
|
|
1964
|
+
{
|
|
1965
|
+
form: res.response.form,
|
|
1966
|
+
},
|
|
1967
|
+
() => {}
|
|
1968
|
+
);
|
|
1949
1969
|
} else {
|
|
1950
|
-
|
|
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
|
-
|
|
1954
|
-
|
|
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
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
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
|
-
|
|
1982
|
-
|
|
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
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
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
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
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
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
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
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
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
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2529
|
+
label: {
|
|
2530
|
+
list: [],
|
|
2531
|
+
class: 'form-label fs-base ',
|
|
2532
|
+
style: '',
|
|
2533
|
+
version: 'v2',
|
|
2490
2534
|
},
|
|
2491
|
-
{
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
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
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
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
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
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
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
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
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
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
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
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
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
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
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
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
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
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
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
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
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
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
|
-
|
|
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-
|
|
2922
|
-
<
|
|
2923
|
-
${Language.text('total_amount')}
|
|
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
|
-
|
|
2936
|
-
|
|
2941
|
+
verify.length > 0 ? 'button-bgr-disable' : 'button-bgr'
|
|
2942
|
+
)}"
|
|
2937
2943
|
style="${document.body.clientWidth < 800
|
|
2938
|
-
|
|
2939
|
-
|
|
2944
|
+
? `min-width:100px;`
|
|
2945
|
+
: `min-width:380px;`}"
|
|
2940
2946
|
onclick="${gvc.event(() => {
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
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
|
-
|
|
3053
|
-
|
|
3054
|
-
vm.cartData.customer_info.payment_select
|
|
3055
|
-
)
|
|
2957
|
+
(window as any).login_config.login_in_to_order &&
|
|
2958
|
+
!GlobalUser.token
|
|
3056
2959
|
) {
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
return
|
|
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
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3111
|
+
glitter.share.top_inset}px;z-index:1;"
|
|
3106
3112
|
onclick="${gvc.event(() => {
|
|
3107
3113
|
location.href = res.response.returnUrl;
|
|
3108
|
-
|
|
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
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3129
|
+
verify.length > 0
|
|
3130
|
+
? 'button-bgr-disable'
|
|
3131
|
+
: 'button-bgr'
|
|
3132
|
+
)} "
|
|
3127
3133
|
id="checkoutButton"
|
|
3128
3134
|
onclick="${gvc.event(() => {
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
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
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
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
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
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
|
-
|
|
3252
|
+
);
|
|
3253
|
+
(document.querySelector(`#${id} #submit`) as any).click();
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
});
|
|
3248
3257
|
}
|
|
3249
|
-
}
|
|
3250
|
-
});
|
|
3251
|
-
}
|
|
3252
3258
|
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
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
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
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
|
|
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
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3668
|
+
array.push({
|
|
3669
|
+
name: '銀行轉帳',
|
|
3670
|
+
value: 'atm',
|
|
3671
|
+
});
|
|
3666
3672
|
cartData.off_line_support.line &&
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3673
|
+
array.push({
|
|
3674
|
+
name: 'Line轉帳',
|
|
3675
|
+
value: 'line',
|
|
3676
|
+
});
|
|
3671
3677
|
cartData.off_line_support.cash_on_delivery &&
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
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);
|