ts-glitter 21.3.1 → 21.3.3

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 (38) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-customer-message.js +4 -2
  4. package/lowcode/backend-manager/bg-customer-message.ts +4 -2
  5. package/lowcode/cms-plugin/module/product-excel.js +169 -129
  6. package/lowcode/cms-plugin/module/product-excel.ts +174 -130
  7. package/lowcode/cms-plugin/shopping-discount-setting.js +640 -600
  8. package/lowcode/cms-plugin/shopping-discount-setting.ts +782 -716
  9. package/lowcode/cms-plugin/shopping-finance-setting.js +372 -407
  10. package/lowcode/cms-plugin/shopping-finance-setting.ts +918 -968
  11. package/lowcode/glitter-base/global/language.js +12 -0
  12. package/lowcode/glitter-base/global/language.ts +12 -0
  13. package/lowcode/glitter-base/route/api-track.js +2 -2
  14. package/lowcode/glitter-base/route/api-track.ts +20 -20
  15. package/lowcode/public-components/checkout/index.js +27 -5
  16. package/lowcode/public-components/checkout/index.ts +34 -6
  17. package/lowcode/public-components/headers/header-class.js +13 -18
  18. package/lowcode/public-components/headers/header-class.ts +16 -20
  19. package/lowcode/public-components/modules/cart-module.js +6 -0
  20. package/lowcode/public-components/modules/cart-module.ts +6 -0
  21. package/lowcode/public-components/product/pd-class.js +1 -3
  22. package/lowcode/public-components/product/pd-class.ts +1 -3
  23. package/omr85cp878.json +1 -0
  24. package/package.json +1 -1
  25. package/src/api-public/services/checkout-event.js +26 -12
  26. package/src/api-public/services/checkout-event.js.map +1 -1
  27. package/src/api-public/services/checkout-event.ts +34 -12
  28. package/src/api-public/services/data-analyze.d.ts +1 -1
  29. package/src/api-public/services/post.js +7 -17
  30. package/src/api-public/services/post.js.map +1 -1
  31. package/src/api-public/services/shopee.js +7 -17
  32. package/src/api-public/services/shopee.js.map +1 -1
  33. package/src/api-public/services/shopping.d.ts +44 -27
  34. package/src/api-public/services/shopping.js +56 -11
  35. package/src/api-public/services/shopping.js.map +1 -1
  36. package/src/api-public/services/shopping.ts +125 -58
  37. package/src/index.js +7 -17
  38. package/src/index.js.map +1 -1
@@ -25,7 +25,7 @@ import { ShoppingShipmentSetting } from './shopping-shipment-setting.js';
25
25
  const html = String.raw;
26
26
  export class ShoppingFinanceSetting {
27
27
  static main(gvc, pos) {
28
- pos = (`${pos}` === 'true');
28
+ pos = `${pos}` === 'true';
29
29
  const dialog = new ShareDialog(gvc.glitter);
30
30
  const saasConfig = window.parent.saasConfig;
31
31
  const vm = {
@@ -194,11 +194,11 @@ export class ShoppingFinanceSetting {
194
194
  });
195
195
  }
196
196
  return BgWidget.container(html `
197
- ${[
198
- html ` <div class="title-container ${pos ? `d-none` : ``}">
199
- ${BgWidget.title('金流設定')}
200
- <div class="flex-fill"></div>
201
- </div>`,
197
+ ${[
198
+ html ` <div class="title-container ${pos ? `d-none` : ''}">
199
+ ${BgWidget.title('金流設定')}
200
+ <div class="flex-fill"></div>
201
+ </div>`,
202
202
  gvc.bindView({
203
203
  bind: vm.id,
204
204
  view: () => {
@@ -223,25 +223,52 @@ export class ShoppingFinanceSetting {
223
223
  const cloneData = structuredClone(keyData);
224
224
  if (vm.page === 'online') {
225
225
  h = html ` <div class="px-md-0 px-2 mb-2">
226
- ${BgWidget.normalInsignia('透過線上金流,消費者可於線上進行結帳付款')}
227
- </div>
228
- <div class="row">
229
- ${PaymentConfig.onlinePay
226
+ ${BgWidget.normalInsignia('透過線上金流,消費者可於線上進行結帳付款')}
227
+ </div>
228
+ <div class="row">
229
+ ${PaymentConfig.onlinePay
230
230
  .filter(item => item.type !== 'pos')
231
231
  .map(dd => {
232
232
  var _a;
233
233
  keyData[dd.key] = (_a = keyData[dd.key]) !== null && _a !== void 0 ? _a : {};
234
- return html ` <div class="col-12 col-xl-3 col-md-4 p-0 p-md-2">
235
- <div
236
- class="w-100 position-relative main-card"
237
- style="padding: 24px 32px; background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: inline-flex;"
238
- >
239
- <div class="position-absolute fw-500" style="cursor:pointer;right:0px;top:0px;">
240
- ${BgWidget.customButton({
234
+ return html ` <div class="col-12 col-lg-3 col-md-4 p-0 p-md-2">
235
+ <div
236
+ class="w-100 position-relative main-card"
237
+ style=" background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; display: inline-flex;"
238
+ >
239
+
240
+ <div
241
+ style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
242
+ >
243
+ <div style="min-width: 46px;max-width: 46px;">
244
+ <img src="${dd.img || BgWidget.noImageURL}" />
245
+ </div>
246
+ <div
247
+ style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
248
+ >
249
+ <div class="tx_normal">${dd.name}</div>
250
+ <div class="d-flex align-items-center" style="gap:4px;">
251
+ <div class="tx_normal">${keyData[dd.key].toggle ? `開啟` : `關閉`}</div>
252
+ <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
253
+ <input
254
+ class="form-check-input"
255
+ type="checkbox"
256
+ onchange="${gvc.event((e, event) => {
257
+ keyData[dd.key].toggle = !keyData[dd.key].toggle;
258
+ saveData();
259
+ })}"
260
+ ${keyData[dd.key].toggle ? `checked` : ''}
261
+ />
262
+ </div>
263
+ </div>
264
+ </div>
265
+ </div>
266
+ <div class="border-top w-100"></div>
267
+ <div class="w-100 d-flex align-items-center justify-content-end fw-500" style="">
268
+ ${BgWidget.customButton({
241
269
  button: {
242
270
  color: 'gray',
243
271
  size: 'sm',
244
- style: `border-top-left-radius: 0px !important;border-bottom-right-radius: 0px !important;`
245
272
  },
246
273
  text: {
247
274
  name: '金流設定',
@@ -261,8 +288,8 @@ export class ShoppingFinanceSetting {
261
288
  html: html ` ${BgWidget.editeInput({
262
289
  gvc: gvc,
263
290
  title: html `<div>
264
- 自訂金流名稱 ${BgWidget.grayNote('未輸入則參照預設')}
265
- </div>`,
291
+ 自訂金流名稱 ${BgWidget.grayNote('未輸入則參照預設')}
292
+ </div>`,
266
293
  default: key_d.custome_name,
267
294
  callback: text => {
268
295
  key_d.custome_name = text;
@@ -270,8 +297,8 @@ export class ShoppingFinanceSetting {
270
297
  placeHolder: '請輸入自訂顯示名稱',
271
298
  global_language: true,
272
299
  })}
273
- <div style="margin-top: 8px;">
274
- ${(() => {
300
+ <div style="margin-top: 8px;">
301
+ ${(() => {
275
302
  switch (payData.key) {
276
303
  case 'newWebPay':
277
304
  case 'ecPay':
@@ -520,9 +547,9 @@ export class ShoppingFinanceSetting {
520
547
  }),
521
548
  ].join('');
522
549
  }
523
- return ``;
550
+ return '';
524
551
  })()}
525
- </div>`,
552
+ </div>`,
526
553
  };
527
554
  const shipment = {
528
555
  key: 'shipment',
@@ -554,10 +581,12 @@ export class ShoppingFinanceSetting {
554
581
  gvc.closeDialog();
555
582
  })),
556
583
  BgWidget.save(gvc.event(() => {
557
- if (payData.key == "ecPay" && key_d.ActionURL == "https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5") {
558
- key_d.MERCHANT_ID = "3002607";
559
- key_d.HASH_KEY = "pwFHCqoQZGmho4w6";
560
- key_d.HASH_IV = "EkRm7iFT261dpevs";
584
+ if (payData.key == 'ecPay' &&
585
+ key_d.ActionURL ==
586
+ 'https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5') {
587
+ key_d.MERCHANT_ID = '3002607';
588
+ key_d.HASH_KEY = 'pwFHCqoQZGmho4w6';
589
+ key_d.HASH_IV = 'EkRm7iFT261dpevs';
561
590
  }
562
591
  keyData[payData.key] = key_d;
563
592
  saveData();
@@ -571,38 +600,13 @@ export class ShoppingFinanceSetting {
571
600
  });
572
601
  }),
573
602
  })}
574
- </div>
575
- <div
576
- style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
577
- >
578
- <div style="min-width: 46px;max-width: 46px;">
579
- <img src="${dd.img || BgWidget.noImageURL}" />
580
- </div>
581
- <div
582
- style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
583
- >
584
- <div class="tx_normal">${dd.name}</div>
585
- <div class="d-flex align-items-center" style="gap:4px;">
586
- <div class="tx_normal">${keyData[dd.key].toggle ? `開啟` : `關閉`}</div>
587
- <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
588
- <input
589
- class="form-check-input"
590
- type="checkbox"
591
- onchange="${gvc.event((e, event) => {
592
- keyData[dd.key].toggle = !keyData[dd.key].toggle;
593
- saveData();
594
- })}"
595
- ${keyData[dd.key].toggle ? `checked` : ``}
596
- />
597
- </div>
598
- </div>
599
603
  </div>
600
604
  </div>
601
- </div>
602
- </div>`;
605
+
606
+ </div>`;
603
607
  })
604
608
  .join('')}
605
- </div>`;
609
+ </div>`;
606
610
  }
607
611
  if (vm.page === 'offline') {
608
612
  const offlinePayArray = [
@@ -616,25 +620,55 @@ export class ShoppingFinanceSetting {
616
620
  }),
617
621
  ];
618
622
  h = html ` <div class="px-md-0 px-2 mb-2">
619
- ${BgWidget.normalInsignia('透過設定線下金流,結帳後訂單將進入手動核款的流程,亦可使用超商取貨付款')}
620
- </div>
621
- <div class="row">
622
- ${offlinePayArray
623
+ ${BgWidget.normalInsignia('透過設定線下金流,結帳後訂單將進入手動核款的流程,亦可使用超商取貨付款')}
624
+ </div>
625
+ <div class="row">
626
+ ${offlinePayArray
623
627
  .map((dd) => {
624
- return html ` <div class="col-12 col-xl-3 col-md-4 p-0 p-md-2">
625
- <div
626
- class="w-100 position-relative main-card"
627
- style="padding: 24px 32px; background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: inline-flex;"
628
- >
628
+ return html ` <div class="col-12 col-lg-3 col-md-4 p-0 p-md-2">
629
629
  <div
630
- class="position-absolute fw-500 ${dd.hide_setting ? `d-none` : ``}"
631
- style="cursor:pointer;right:0px;top:0px;"
630
+ class="w-100 position-relative main-card"
631
+ style=" background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start;gap:10px; display: inline-flex;"
632
632
  >
633
- ${BgWidget.customButton({
633
+ <div
634
+ style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
635
+ >
636
+ <div style="min-width: 46px;max-width: 46px;">
637
+ ${dd.img
638
+ ? html `<img class="rounded-2" src="${dd.img}" />`
639
+ : html `<i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i>`}
640
+ </div>
641
+ <div
642
+ style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
643
+ >
644
+ <div class="tx_normal">${dd.name}</div>
645
+ <div class="d-flex align-items-center" style="gap:4px;">
646
+ <div class="tx_normal">
647
+ ${keyData.off_line_support[dd.key] ? `開啟` : `關閉`}
648
+ </div>
649
+ <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
650
+ <input
651
+ class="form-check-input"
652
+ type="checkbox"
653
+ onchange="${gvc.event((e, event) => {
654
+ keyData.off_line_support[dd.key] = !keyData.off_line_support[dd.key];
655
+ saveData();
656
+ })}"
657
+ ${keyData.off_line_support[dd.key] ? `checked` : ''}
658
+ />
659
+ </div>
660
+ </div>
661
+ </div>
662
+ </div>
663
+ <div class="border-top w-100"></div>
664
+ <div
665
+ class=" w-100 d-flex align-items-center justify-content-end fw-500 ${dd.hide_setting ? `d-none` : ''}"
666
+ style=""
667
+ >
668
+ ${BgWidget.customButton({
634
669
  button: {
635
670
  color: 'gray',
636
671
  size: 'sm',
637
- style: `border-top-left-radius: 0px !important;border-bottom-right-radius: 0px !important;`
638
672
  },
639
673
  text: {
640
674
  name: '金流設定',
@@ -677,82 +711,78 @@ export class ShoppingFinanceSetting {
677
711
  });
678
712
  }),
679
713
  })}
680
- </div>
681
- <div
682
- style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
683
- >
684
- <div style="min-width: 46px;max-width: 46px;">
685
- ${dd.img
686
- ? html ` <img class="rounded-2" src="${dd.img}" />`
687
- : html `<i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i>`}
688
- </div>
689
- <div
690
- style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
691
- >
692
- <div class="tx_normal">${dd.name}</div>
693
- <div class="d-flex align-items-center" style="gap:4px;">
694
- <div class="tx_normal">
695
- ${keyData.off_line_support[dd.key] ? `開啟` : `關閉`}
696
- </div>
697
- <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
698
- <input
699
- class="form-check-input"
700
- type="checkbox"
701
- onchange="${gvc.event((e, event) => {
702
- keyData.off_line_support[dd.key] = !keyData.off_line_support[dd.key];
703
- saveData();
704
- })}"
705
- ${keyData.off_line_support[dd.key] ? `checked` : ``}
706
- />
707
- </div>
708
- </div>
709
714
  </div>
710
715
  </div>
711
- </div>
712
- </div>`;
716
+ </div>`;
713
717
  })
714
718
  .join('')}
715
- <div
716
- class="col-12 col-xl-3 col-md-4 p-0 p-md-2"
717
- style="cursor: pointer;"
718
- onclick="${gvc.event(() => {
719
+ <div
720
+ class="col-12 col-lg-3 col-md-4 p-0 p-md-2"
721
+ style="cursor: pointer;"
722
+ onclick="${gvc.event(() => {
719
723
  updateCustomFinance({ function: 'plus' });
720
724
  })}"
721
- >
722
- <div
723
- class="w-100 main-card"
724
- style="min-height:119.09px;padding: 24px; background: white; overflow: hidden; flex-direction: column; justify-content: center; align-items: center; gap: 18px; display: inline-flex"
725
725
  >
726
726
  <div
727
- class="fw-bold"
728
- style="align-self: stretch; justify-content: center; align-items: center; gap: 14px; display: inline-flex;color:#4D86DB;"
727
+ class="w-100 main-card"
728
+ style="min-height:119.09px;padding: 24px; background: white; overflow: hidden; flex-direction: column; justify-content: center; align-items: center; gap: 18px; display: inline-flex"
729
729
  >
730
- <i class="fa-regular fa-circle-plus fs-5"></i>
731
- <div class="fs-5">新增自訂付款</div>
730
+ <div
731
+ class="fw-bold"
732
+ style="align-self: stretch; justify-content: center; align-items: center; gap: 14px; display: inline-flex;color:#4D86DB;"
733
+ >
734
+ <i class="fa-regular fa-circle-plus fs-5"></i>
735
+ <div class="fs-5">新增自訂付款</div>
736
+ </div>
732
737
  </div>
733
738
  </div>
734
- </div>
735
- </div>`;
739
+ </div>`;
736
740
  }
737
741
  if (vm.page === 'pos') {
738
742
  h = html `<div class="px-md-0 px-2 mb-2">
739
- ${BgWidget.normalInsignia('設定實體店面所需串接的付款方式')}
740
- </div>
741
- <div class="row">
742
- ${PaymentConfig.onlinePay
743
+ ${BgWidget.normalInsignia('設定實體店面所需串接的付款方式')}
744
+ </div>
745
+ <div class="row">
746
+ ${PaymentConfig.onlinePay
743
747
  .filter(item => item.type === 'pos')
744
748
  .map(dd => {
745
- return html ` <div class="col-12 col-xl-3 col-md-4 p-0 p-md-2">
746
- <div
747
- class="w-100 position-relative main-card"
748
- style="padding: 24px 32px; background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: inline-flex;"
749
- >
750
- <div class="position-absolute fw-500" style="cursor:pointer;right:0px;top:0px;">
751
- ${BgWidget.customButton({
749
+ return html ` <div class="col-12 col-lg-3 col-md-4 p-0 p-md-2">
750
+ <div
751
+ class="w-100 position-relative main-card"
752
+ style=" background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; display: inline-flex;"
753
+ >
754
+ <div
755
+ style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
756
+ >
757
+ <div style="min-width: 46px;max-width: 46px;">
758
+ <img src="${dd.img || BgWidget.noImageURL}" />
759
+ </div>
760
+ <div
761
+ style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
762
+ >
763
+ <div class="tx_normal">${dd.name}</div>
764
+ <div class="d-flex align-items-center" style="gap:4px;">
765
+ <div class="tx_normal">${keyData[dd.key].toggle ? `開啟` : `關閉`}</div>
766
+ <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
767
+ <input
768
+ class="form-check-input"
769
+ type="checkbox"
770
+ onchange="${gvc.event(() => {
771
+ keyData[dd.key].toggle = !keyData[dd.key].toggle;
772
+ saveData();
773
+ })}"
774
+ ${keyData[dd.key].toggle ? `checked` : ''}
775
+ />
776
+ </div>
777
+ </div>
778
+ </div>
779
+ </div>
780
+ <div class="border-top w-100"></div>
781
+ <div class="w-100 d-flex align-items-center justify-content-end fw-500" style="cursor:pointer;">
782
+ ${BgWidget.customButton({
752
783
  button: {
753
784
  color: 'gray',
754
785
  size: 'sm',
755
- style: `border-top-left-radius: 0px !important;border-bottom-right-radius: 0px !important;`
756
786
  },
757
787
  text: {
758
788
  name: '金流設定',
@@ -767,16 +797,16 @@ export class ShoppingFinanceSetting {
767
797
  innerHTML: (gvc) => {
768
798
  try {
769
799
  return html `<div>
770
- ${(() => {
800
+ ${(() => {
771
801
  switch (payData.key) {
772
802
  case 'line_pay_scan':
773
803
  return this.linePayScan(gvc, key_d);
774
804
  case 'ut_credit_card':
775
805
  return this.utCreditCard(gvc, key_d);
776
806
  }
777
- return ``;
807
+ return '';
778
808
  })()}
779
- </div>`;
809
+ </div>`;
780
810
  }
781
811
  catch (error) {
782
812
  console.error(error);
@@ -802,47 +832,23 @@ export class ShoppingFinanceSetting {
802
832
  });
803
833
  }),
804
834
  })}
805
- </div>
806
- <div
807
- style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex"
808
- >
809
- <div style="min-width: 46px;max-width: 46px;">
810
- <img src="${dd.img || BgWidget.noImageURL}" />
811
- </div>
812
- <div
813
- style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
814
- >
815
- <div class="tx_normal">${dd.name}</div>
816
- <div class="d-flex align-items-center" style="gap:4px;">
817
- <div class="tx_normal">${keyData[dd.key].toggle ? `開啟` : `關閉`}</div>
818
- <div class="cursor_pointer form-check form-switch" style="margin-top: 10px;">
819
- <input
820
- class="form-check-input"
821
- type="checkbox"
822
- onchange="${gvc.event(() => {
823
- keyData[dd.key].toggle = !keyData[dd.key].toggle;
824
- saveData();
825
- })}"
826
- ${keyData[dd.key].toggle ? `checked` : ``}
827
- />
828
- </div>
829
- </div>
830
835
  </div>
831
836
  </div>
832
- </div>
833
- </div>`;
837
+ </div>`;
834
838
  })
835
839
  .join('')}
836
- </div>`;
840
+ </div>`;
837
841
  }
838
842
  return [
839
- pos ? `` : BgWidget.tab([
840
- { key: 'online', title: '線上金流' },
841
- { key: 'offline', title: '線下金流' },
842
- ], gvc, vm.page, (key) => {
843
- vm.page = key;
844
- gvc.notifyDataChange(vm.id);
845
- }),
843
+ pos
844
+ ? ''
845
+ : BgWidget.tab([
846
+ { key: 'online', title: '線上金流' },
847
+ { key: 'offline', title: '線下金流' },
848
+ ], gvc, vm.page, (key) => {
849
+ vm.page = key;
850
+ gvc.notifyDataChange(vm.id);
851
+ }),
846
852
  h,
847
853
  ].join('');
848
854
  }
@@ -874,9 +880,9 @@ export class ShoppingFinanceSetting {
874
880
  },
875
881
  }),
876
882
  ].join('')}
877
- ${pos ? `` : BgWidget.mbContainer(240)}
878
- `, {
879
- style: pos ? `margin-top: 0px !important;` : ``,
883
+ ${pos ? '' : BgWidget.mbContainer(240)}
884
+ `, {
885
+ style: pos ? `margin-top: 0px !important;` : '',
880
886
  });
881
887
  }
882
888
  static tabView(gvc, viewList) {
@@ -1034,7 +1040,7 @@ export class ShoppingFinanceSetting {
1034
1040
  const id = gvc.glitter.getUUID();
1035
1041
  const dialog = new ShareDialog(gvc.glitter);
1036
1042
  const t = type === 'cashflow' ? '金' : '物';
1037
- data.cartSetting = Object.assign({ minimumTotal: 0, maximumTotal: 0, orderFormula: [] }, ((_a = data.cartSetting) !== null && _a !== void 0 ? _a : {}));
1043
+ data.cartSetting = Object.assign({ minimumTotal: 0, maximumTotal: 0, freeShipmnetTarget: 0, orderFormula: [] }, ((_a = data.cartSetting) !== null && _a !== void 0 ? _a : {}));
1038
1044
  function questionDialog(text) {
1039
1045
  return BgWidget.questionButton(gvc.event(() => {
1040
1046
  BgWidget.quesDialog({
@@ -1049,6 +1055,9 @@ export class ShoppingFinanceSetting {
1049
1055
  dialog.errorMessage({ text: '請輸入正整數' });
1050
1056
  gvc.notifyDataChange(id);
1051
1057
  }
1058
+ if (type === 'freeShipmnet') {
1059
+ data.cartSetting.freeShipmnetTarget = n;
1060
+ }
1052
1061
  if (type === 'min') {
1053
1062
  if (data.cartSetting.maximumTotal !== 0 && n > data.cartSetting.maximumTotal) {
1054
1063
  dialog.errorMessage({ text: '數值需小於最高消費金額' });
@@ -1131,6 +1140,20 @@ export class ShoppingFinanceSetting {
1131
1140
  },
1132
1141
  placeHolder: '請輸入金額',
1133
1142
  }),
1143
+ BgWidget.horizontalLine(),
1144
+ BgWidget.editeInput({
1145
+ gvc: gvc,
1146
+ title: html `<div class="d-flex align-items-center mt-2 gap-2">
1147
+ <div style="white-space: break-spaces;">達指定消費金額,訂單免運費(輸入0則不設定此功能)</div>
1148
+ ${questionDialog(html `訂單中「所有商品小計(A)」若達到輸入的指定值,使用此物流則免運`)}
1149
+ </div>`,
1150
+ default: `${data.cartSetting.freeShipmnetTarget}`,
1151
+ type: 'number',
1152
+ callback: text => {
1153
+ checkTotalNumber(text, 'freeShipmnet');
1154
+ },
1155
+ placeHolder: '請輸入金額',
1156
+ }),
1134
1157
  ].join('');
1135
1158
  },
1136
1159
  });
@@ -1571,7 +1594,7 @@ export class ShoppingFinanceSetting {
1571
1594
  let form = undefined;
1572
1595
  BgWidget.settingDialog({
1573
1596
  gvc: gvc,
1574
- title: '新增自訂物流',
1597
+ title: custom_delivery.name ? `「${custom_delivery.name}」自訂表單設定` : '新增自訂物流',
1575
1598
  innerHTML: gvc => {
1576
1599
  form = BgWidget.customForm(gvc, [
1577
1600
  {
@@ -1630,8 +1653,6 @@ export class ShoppingFinanceSetting {
1630
1653
  form.view,
1631
1654
  ].join(BgWidget.mbContainer(12));
1632
1655
  },
1633
- divCreate: {},
1634
- onCreate: () => { },
1635
1656
  };
1636
1657
  })());
1637
1658
  },
@@ -1704,7 +1725,7 @@ export class ShoppingFinanceSetting {
1704
1725
  }))
1705
1726
  .map(dd => {
1706
1727
  return html `
1707
- <div class="col-12 col-md-4 p-0 p-md-2">
1728
+ <div class="col-12 col-lg-4 col-md-6 p-0 p-md-2">
1708
1729
  <div
1709
1730
  class="w-100 position-relative main-card"
1710
1731
  style="padding: 24px; background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: inline-flex;"
@@ -1745,7 +1766,7 @@ export class ShoppingFinanceSetting {
1745
1766
  return dd.value === d1;
1746
1767
  })
1747
1768
  ? `checked`
1748
- : ``}
1769
+ : ''}
1749
1770
  />
1750
1771
  </div>
1751
1772
  </div>
@@ -1760,13 +1781,13 @@ export class ShoppingFinanceSetting {
1760
1781
  size: 'sm',
1761
1782
  },
1762
1783
  text: {
1763
- name: `物流設定`,
1784
+ name: html `<i class="fa-regular fa-gear me-1"></i>配送`,
1764
1785
  },
1765
1786
  event: gvc.event(() => __awaiter(this, void 0, void 0, function* () {
1766
1787
  const log_config = (yield ApiUser.getPublicConfig('shipment_config_' + dd.value, 'manager', saasConfig.config.appName)).response.value;
1767
1788
  BgWidget.settingDialog({
1768
1789
  gvc: gvc,
1769
- title: '物流設定',
1790
+ title: `「${dd.title}」配送設定`,
1770
1791
  innerHTML: gvc => {
1771
1792
  var _a;
1772
1793
  const view = [];
@@ -1792,7 +1813,7 @@ export class ShoppingFinanceSetting {
1792
1813
  log_config.bulk = !log_config.bulk;
1793
1814
  gvc.recreateView();
1794
1815
  })}"
1795
- ${log_config.bulk ? `checked` : ``}
1816
+ ${log_config.bulk ? `checked` : ''}
1796
1817
  />
1797
1818
  </div>
1798
1819
  </div>
@@ -1846,7 +1867,7 @@ export class ShoppingFinanceSetting {
1846
1867
  size: 'sm',
1847
1868
  },
1848
1869
  text: {
1849
- name: `購物車設定`,
1870
+ name: html `<i class="fa-regular fa-gear me-1"></i>購物車`,
1850
1871
  },
1851
1872
  event: gvc.event(() => __awaiter(this, void 0, void 0, function* () {
1852
1873
  const vm = {
@@ -1856,7 +1877,7 @@ export class ShoppingFinanceSetting {
1856
1877
  };
1857
1878
  BgWidget.settingDialog({
1858
1879
  gvc: gvc,
1859
- title: '物流設定',
1880
+ title: `「${dd.title}」購物車設定`,
1860
1881
  innerHTML: gvc => {
1861
1882
  return gvc.bindView({
1862
1883
  bind: id,
@@ -1868,7 +1889,6 @@ export class ShoppingFinanceSetting {
1868
1889
  return ShoppingFinanceSetting.setCartSetting(gvc, vm.config, 'shipment');
1869
1890
  }
1870
1891
  },
1871
- divCreate: {},
1872
1892
  onCreate: () => __awaiter(this, void 0, void 0, function* () {
1873
1893
  if (vm.loading) {
1874
1894
  const r = yield ApiUser.getPublicConfig('shipment_config_' + dd.value, 'manager', saasConfig.config.appName);
@@ -1902,15 +1922,57 @@ export class ShoppingFinanceSetting {
1902
1922
  })),
1903
1923
  }),
1904
1924
  ];
1925
+ const shipment_fee = () => {
1926
+ return BgWidget.customButton({
1927
+ button: {
1928
+ color: 'gray',
1929
+ size: 'sm',
1930
+ },
1931
+ text: {
1932
+ name: html `<i class="fa-regular fa-gear me-1"></i>運費`,
1933
+ },
1934
+ event: gvc.event(() => {
1935
+ const vm = {
1936
+ gvc: gvc,
1937
+ key: dd.value,
1938
+ save_event: () => {
1939
+ return new Promise(resolve => resolve(true));
1940
+ },
1941
+ };
1942
+ BgWidget.settingDialog({
1943
+ gvc: gvc,
1944
+ width: 1200,
1945
+ height: document.body.clientHeight - 100,
1946
+ title: `「${dd.title}」運費設定`,
1947
+ d_main_style: document.body.clientWidth < 768 ? 'padding:0px !important;' : '',
1948
+ innerHTML: (gvc) => {
1949
+ vm.gvc = gvc;
1950
+ return ShoppingShipmentSetting.main(vm);
1951
+ },
1952
+ footer_html: gvc => {
1953
+ return [
1954
+ BgWidget.cancel(gvc.event(() => {
1955
+ gvc.closeDialog();
1956
+ })),
1957
+ BgWidget.save(gvc.event(() => {
1958
+ vm.save_event().then(() => { });
1959
+ })),
1960
+ ].join('');
1961
+ },
1962
+ });
1963
+ }),
1964
+ });
1965
+ };
1905
1966
  if (dd.custom) {
1906
1967
  button_action = button_action.concat([
1968
+ shipment_fee(),
1907
1969
  BgWidget.customButton({
1908
1970
  button: {
1909
1971
  color: 'gray',
1910
1972
  size: 'sm',
1911
1973
  },
1912
1974
  text: {
1913
- name: `自訂表單`,
1975
+ name: html `<i class="fa-regular fa-gear me-1"></i>自訂表單`,
1914
1976
  },
1915
1977
  event: gvc.event(() => {
1916
1978
  updateCustomShipment({
@@ -1919,100 +1981,17 @@ export class ShoppingFinanceSetting {
1919
1981
  });
1920
1982
  }),
1921
1983
  }),
1922
- BgWidget.customButton({
1923
- button: {
1924
- color: 'gray',
1925
- size: 'sm',
1926
- },
1927
- text: {
1928
- name: `運費設定`,
1929
- },
1930
- event: gvc.event(() => {
1931
- const vm = {
1932
- gvc: gvc,
1933
- key: dd.value,
1934
- save_event: () => {
1935
- return new Promise(resolve => {
1936
- resolve(true);
1937
- });
1938
- },
1939
- };
1940
- BgWidget.settingDialog({
1941
- gvc: gvc,
1942
- width: 1200,
1943
- height: document.body.clientHeight - 100,
1944
- title: `『 ${dd.title} 』運費設定`,
1945
- d_main_style: document.body.clientWidth < 768 ? 'padding:0px !important;' : ``,
1946
- innerHTML: (gvc) => {
1947
- vm.gvc = gvc;
1948
- return ShoppingShipmentSetting.main(vm);
1949
- },
1950
- footer_html: gvc => {
1951
- return [
1952
- BgWidget.cancel(gvc.event(() => {
1953
- gvc.closeDialog();
1954
- })),
1955
- BgWidget.save(gvc.event(() => {
1956
- vm.save_event().then(() => { });
1957
- })),
1958
- ].join('');
1959
- },
1960
- });
1961
- }),
1962
- }),
1963
1984
  ]);
1964
1985
  return html `
1965
- <div class="d-flex" style="cursor:pointer;gap:5px;">
1986
+ <div class="d-flex flex-wrap justify-content-end gap-1 cursor_pointer">
1966
1987
  <div class="flex-fill"></div>
1967
1988
  ${button_action.join('')}
1968
1989
  </div>
1969
1990
  `;
1970
1991
  }
1971
1992
  else {
1972
- button_action = button_action.concat([
1973
- BgWidget.customButton({
1974
- button: {
1975
- color: 'gray',
1976
- size: 'sm',
1977
- },
1978
- text: {
1979
- name: `運費設定`,
1980
- },
1981
- event: gvc.event(() => {
1982
- const vm = {
1983
- gvc: gvc,
1984
- key: dd.value,
1985
- save_event: () => {
1986
- return new Promise((resolve, reject) => {
1987
- resolve(true);
1988
- });
1989
- },
1990
- };
1991
- BgWidget.settingDialog({
1992
- gvc: gvc,
1993
- width: 1200,
1994
- height: document.body.clientHeight - 100,
1995
- title: `『 ${dd.title} 』運費設定`,
1996
- d_main_style: document.body.clientWidth < 768 ? 'padding:0px !important;' : ``,
1997
- innerHTML: (gvc) => {
1998
- vm.gvc = gvc;
1999
- return ShoppingShipmentSetting.main(vm);
2000
- },
2001
- footer_html: gvc => {
2002
- return [
2003
- BgWidget.cancel(gvc.event(() => {
2004
- gvc.closeDialog();
2005
- })),
2006
- BgWidget.save(gvc.event(() => {
2007
- vm.save_event().then(() => { });
2008
- })),
2009
- ].join('');
2010
- },
2011
- });
2012
- }),
2013
- }),
2014
- ]);
2015
- return html ` <div class="d-flex" style="cursor:pointer;gap:5px;">
1993
+ button_action = button_action.concat([shipment_fee()]);
1994
+ return html ` <div class="d-flex flex-wrap justify-content-end gap-1 cursor_pointer">
2016
1995
  <div class="flex-fill"></div>
2017
1996
  ${button_action.join('')}
2018
1997
  </div>`;
@@ -2026,7 +2005,7 @@ export class ShoppingFinanceSetting {
2026
2005
  })
2027
2006
  .concat([
2028
2007
  html ` <div
2029
- class="col-12 col-md-4 p-0 p-md-2"
2008
+ class="col-12 col-lg-4 col-md-6 p-0 p-md-2"
2030
2009
  style="cursor: pointer;"
2031
2010
  onclick="${gvc.event(() => {
2032
2011
  updateCustomShipment({ function: 'plus' });
@@ -2056,143 +2035,134 @@ export class ShoppingFinanceSetting {
2056
2035
  ]);
2057
2036
  }
2058
2037
  else if (vm.page === 'delivery_note') {
2059
- view.push(BgWidget.mbContainer(24));
2060
- view.push(BgWidget.mainCard([
2061
- html ` <div class="title-container px-0">
2062
- <div class="d-flex d-md-block gap-2 align-items-center">
2063
- <div class="tx_700">配送說明${BgWidget.languageInsignia(vm.language, 'margin-left:5px;')}</div>
2064
- ${document.body.clientWidth > 768
2065
- ? BgWidget.grayNote('於結帳頁面中顯示,告知顧客配送所需要注意的事項')
2066
- : BgWidget.iconButton({
2067
- icon: 'info',
2068
- event: gvc.event(() => {
2069
- BgWidget.jumpAlert({
2070
- gvc,
2071
- text: '於結帳頁面中顯示,告知顧客配送所需要注意的事項',
2072
- justify: 'top',
2073
- align: 'center',
2074
- width: 220,
2075
- });
2076
- }),
2038
+ view.push([
2039
+ html ` <div class="px-md-0 px-2">
2040
+ ${BgWidget.normalInsignia('於結帳頁面中顯示,告知顧客配送所需要注意的事項')}
2041
+ </div>`,
2042
+ BgWidget.mainCard([
2043
+ html ` <div class="title-container px-0">
2044
+ <div class="d-flex align-items-center gap-1">
2045
+ <div class="tx_700">配送說明</div>
2046
+ ${BgWidget.languageInsignia(vm.language, 'margin-left:5px;')}
2047
+ </div>
2048
+ <div class="flex-fill"></div>
2049
+ ${LanguageBackend.switchBtn({
2050
+ gvc: gvc,
2051
+ language: vm.language,
2052
+ callback: language => {
2053
+ vm.language = language;
2054
+ gvc.notifyDataChange(vm.id);
2055
+ },
2077
2056
  })}
2078
- </div>
2079
- <div class="flex-fill"></div>
2080
- ${LanguageBackend.switchBtn({
2081
- gvc: gvc,
2082
- language: vm.language,
2083
- callback: language => {
2084
- vm.language = language;
2085
- gvc.notifyDataChange(vm.id);
2086
- },
2087
- })}
2088
- </div>`,
2089
- ,
2090
- BgWidget.mbContainer(18),
2091
- html ` <div class="guide3-4">
2092
- ${gvc.bindView((() => {
2093
- const id = gvc.glitter.getUUID();
2094
- return {
2095
- bind: id,
2096
- view: () => {
2097
- return html ` <div
2098
- class="d-flex justify-content-between align-items-center gap-3 mb-1"
2099
- style="cursor: pointer;"
2100
- onclick="${gvc.event(() => {
2101
- const originContent = `${language_data.info}`;
2102
- BgWidget.fullDialog({
2103
- gvc: gvc,
2104
- title: gvc2 => {
2105
- return html `<div class="d-flex align-items-center" style="gap:10px;">
2106
- ${'配送資訊' +
2107
- BgWidget.aiChatButton({
2057
+ </div>`,
2058
+ ,
2059
+ BgWidget.mbContainer(18),
2060
+ html ` <div class="guide3-4">
2061
+ ${gvc.bindView((() => {
2062
+ const id = gvc.glitter.getUUID();
2063
+ return {
2064
+ bind: id,
2065
+ view: () => {
2066
+ return html ` <div
2067
+ class="d-flex justify-content-between align-items-center gap-3 mb-1"
2068
+ style="cursor: pointer;"
2069
+ onclick="${gvc.event(() => {
2070
+ const originContent = `${language_data.info}`;
2071
+ BgWidget.fullDialog({
2072
+ gvc: gvc,
2073
+ title: gvc2 => {
2074
+ return html `<div class="d-flex align-items-center" style="gap:10px;">
2075
+ ${'配送資訊' +
2076
+ BgWidget.aiChatButton({
2077
+ gvc: gvc2,
2078
+ select: 'writer',
2079
+ click: () => {
2080
+ ProductAi.generateRichText(gvc, text => {
2081
+ language_data.info += text;
2082
+ gvc.notifyDataChange(vm.id);
2083
+ gvc2.recreateView();
2084
+ });
2085
+ },
2086
+ })}
2087
+ </div>`;
2088
+ },
2089
+ innerHTML: gvc2 => {
2090
+ return html ` <div>
2091
+ ${EditorElem.richText({
2108
2092
  gvc: gvc2,
2109
- select: 'writer',
2110
- click: () => {
2111
- ProductAi.generateRichText(gvc, text => {
2112
- language_data.info += text;
2113
- gvc.notifyDataChange(vm.id);
2114
- gvc2.recreateView();
2093
+ def: language_data.info,
2094
+ setHeight: '100vh',
2095
+ hiddenBorder: true,
2096
+ insertImageEvent: editor => {
2097
+ const mark = `{{${Tool.randomString(8)}}}`;
2098
+ editor.selection.setAtEnd(editor.$el.get(0));
2099
+ editor.html.insert(mark);
2100
+ editor.undo.saveStep();
2101
+ imageLibrary.selectImageLibrary(gvc, urlArray => {
2102
+ if (urlArray.length > 0) {
2103
+ const imgHTML = urlArray
2104
+ .map(url => {
2105
+ return html ` <img src="${url.data}" />`;
2106
+ })
2107
+ .join('');
2108
+ editor.html.set(editor.html
2109
+ .get(0)
2110
+ .replace(mark, html ` <div class="d-flex flex-column">${imgHTML}</div>`));
2111
+ editor.undo.saveStep();
2112
+ }
2113
+ else {
2114
+ dialog.errorMessage({ text: '請選擇至少一張圖片' });
2115
+ }
2116
+ }, html ` <div
2117
+ class="d-flex flex-column"
2118
+ style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;"
2119
+ >
2120
+ 圖片庫
2121
+ </div>`, {
2122
+ mul: true,
2123
+ cancelEvent: () => {
2124
+ editor.html.set(editor.html.get(0).replace(mark, ''));
2125
+ editor.undo.saveStep();
2126
+ },
2115
2127
  });
2116
2128
  },
2129
+ callback: text => {
2130
+ language_data.info = text;
2131
+ },
2132
+ rich_height: `calc(${window.parent.innerHeight}px - 70px - 58px - 49px - 64px - 40px + ${document.body.clientWidth < 800 ? `70` : `0`}px)`,
2117
2133
  })}
2118
- </div>`;
2119
- },
2120
- innerHTML: gvc2 => {
2121
- return html ` <div>
2122
- ${EditorElem.richText({
2123
- gvc: gvc2,
2124
- def: language_data.info,
2125
- setHeight: '100vh',
2126
- hiddenBorder: true,
2127
- insertImageEvent: editor => {
2128
- const mark = `{{${Tool.randomString(8)}}}`;
2129
- editor.selection.setAtEnd(editor.$el.get(0));
2130
- editor.html.insert(mark);
2131
- editor.undo.saveStep();
2132
- imageLibrary.selectImageLibrary(gvc, urlArray => {
2133
- if (urlArray.length > 0) {
2134
- const imgHTML = urlArray
2135
- .map(url => {
2136
- return html ` <img src="${url.data}" />`;
2137
- })
2138
- .join('');
2139
- editor.html.set(editor.html
2140
- .get(0)
2141
- .replace(mark, html ` <div class="d-flex flex-column">${imgHTML}</div>`));
2142
- editor.undo.saveStep();
2143
- }
2144
- else {
2145
- dialog.errorMessage({ text: '請選擇至少一張圖片' });
2146
- }
2147
- }, html ` <div
2148
- class="d-flex flex-column"
2149
- style="border-radius: 10px 10px 0px 0px;background: #F2F2F2;"
2150
- >
2151
- 圖片庫
2152
- </div>`, {
2153
- mul: true,
2154
- cancelEvent: () => {
2155
- editor.html.set(editor.html.get(0).replace(mark, ''));
2156
- editor.undo.saveStep();
2157
- },
2158
- });
2159
- },
2160
- callback: text => {
2161
- language_data.info = text;
2162
- },
2163
- rich_height: `calc(${window.parent.innerHeight}px - 70px - 58px - 49px - 64px - 40px + ${document.body.clientWidth < 800 ? `70` : `0`}px)`,
2164
- })}
2165
- </div>`;
2166
- },
2167
- footer_html: (gvc2) => {
2168
- return [
2169
- BgWidget.cancel(gvc2.event(() => {
2170
- language_data.info = originContent;
2171
- gvc2.closeDialog();
2172
- })),
2173
- BgWidget.save(gvc2.event(() => {
2174
- gvc2.closeDialog();
2175
- gvc.notifyDataChange(id);
2176
- save();
2177
- })),
2178
- ].join('');
2179
- },
2180
- closeCallback: () => {
2181
- language_data.info = originContent;
2182
- },
2183
- });
2184
- })}"
2185
- >
2186
- ${(() => {
2187
- const text = gvc.glitter.utText.removeTag(language_data.info);
2188
- return BgWidget.richTextView(Tool.truncateString(text, 100));
2189
- })()}
2190
- </div>`;
2191
- },
2192
- };
2193
- })())}
2194
- </div>`,
2195
- ].join('')));
2134
+ </div>`;
2135
+ },
2136
+ footer_html: (gvc2) => {
2137
+ return [
2138
+ BgWidget.cancel(gvc2.event(() => {
2139
+ language_data.info = originContent;
2140
+ gvc2.closeDialog();
2141
+ })),
2142
+ BgWidget.save(gvc2.event(() => {
2143
+ gvc2.closeDialog();
2144
+ gvc.notifyDataChange(id);
2145
+ save();
2146
+ })),
2147
+ ].join('');
2148
+ },
2149
+ closeCallback: () => {
2150
+ language_data.info = originContent;
2151
+ },
2152
+ });
2153
+ })}"
2154
+ >
2155
+ ${(() => {
2156
+ const text = gvc.glitter.utText.removeTag(language_data.info);
2157
+ return BgWidget.richTextView(Tool.truncateString(text, 100));
2158
+ })()}
2159
+ </div>`;
2160
+ },
2161
+ };
2162
+ })())}
2163
+ </div>`,
2164
+ ].join('')),
2165
+ ].join(BgWidget.mbContainer(24)));
2196
2166
  }
2197
2167
  else if (vm.page === 'delivery_track') {
2198
2168
  view = view.concat([
@@ -2235,7 +2205,7 @@ export class ShoppingFinanceSetting {
2235
2205
  ]
2236
2206
  .map(dd => {
2237
2207
  return html `
2238
- <div class="col-12 col-xl-3 col-md-4 p-0 p-md-2">
2208
+ <div class="col-12 col-lg-3 col-md-4 p-0 p-md-2">
2239
2209
  <div
2240
2210
  class="w-100 position-relative main-card"
2241
2211
  style="padding: 24px 32px; background: white; overflow: hidden; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: inline-flex;"
@@ -2346,8 +2316,6 @@ export class ShoppingFinanceSetting {
2346
2316
  })(),
2347
2317
  ].join(BgWidget.mbContainer(12));
2348
2318
  },
2349
- divCreate: {},
2350
- onCreate: () => { },
2351
2319
  };
2352
2320
  })());
2353
2321
  },
@@ -2544,8 +2512,6 @@ export class ShoppingFinanceSetting {
2544
2512
  })(),
2545
2513
  ].join(BgWidget.mbContainer(12));
2546
2514
  },
2547
- divCreate: {},
2548
- onCreate: () => { },
2549
2515
  };
2550
2516
  })());
2551
2517
  },
@@ -2598,7 +2564,7 @@ export class ShoppingFinanceSetting {
2598
2564
  saveDelivery();
2599
2565
  gvc.notifyDataChange(id);
2600
2566
  })}"
2601
- ${vm.delivery[dd.value].toggle ? `checked` : ``}
2567
+ ${vm.delivery[dd.value].toggle ? `checked` : ''}
2602
2568
  />
2603
2569
  </div>
2604
2570
  </div>
@@ -3067,8 +3033,7 @@ export class ShoppingFinanceSetting {
3067
3033
  `;
3068
3034
  },
3069
3035
  divCreate: {
3070
- style: ``,
3071
- class: `w-100`,
3036
+ class: 'w-100',
3072
3037
  },
3073
3038
  };
3074
3039
  }));