ts-glitter 22.5.6 → 22.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-product.js +13 -13
  4. package/lowcode/backend-manager/bg-product.ts +13 -13
  5. package/lowcode/backend-manager/bg-shopping.js +8 -13
  6. package/lowcode/backend-manager/bg-shopping.ts +8 -15
  7. package/lowcode/backend-manager/bg-widget.js +62 -49
  8. package/lowcode/backend-manager/bg-widget.ts +129 -93
  9. package/lowcode/cms-plugin/POS-setting.js +30 -9
  10. package/lowcode/cms-plugin/POS-setting.ts +49 -16
  11. package/lowcode/cms-plugin/cms-router.js +27 -21
  12. package/lowcode/cms-plugin/cms-router.ts +116 -101
  13. package/lowcode/cms-plugin/filter-options.js +25 -17
  14. package/lowcode/cms-plugin/filter-options.ts +27 -17
  15. package/lowcode/cms-plugin/module/product-excel.js +2 -0
  16. package/lowcode/cms-plugin/module/product-excel.ts +2 -0
  17. package/lowcode/cms-plugin/module/product-setting.js +13 -12
  18. package/lowcode/cms-plugin/module/product-setting.ts +26 -23
  19. package/lowcode/cms-plugin/order/order-module.js +91 -68
  20. package/lowcode/cms-plugin/order/order-module.ts +105 -73
  21. package/lowcode/cms-plugin/pos-checkout-setting.js +46 -39
  22. package/lowcode/cms-plugin/pos-checkout-setting.ts +237 -227
  23. package/lowcode/cms-plugin/pos-config-setting.js +25 -23
  24. package/lowcode/cms-plugin/pos-config-setting.ts +35 -32
  25. package/lowcode/cms-plugin/pos-pages/payment-function.js +253 -139
  26. package/lowcode/cms-plugin/pos-pages/payment-function.ts +405 -279
  27. package/lowcode/cms-plugin/pos-pages/payment-page.js +348 -267
  28. package/lowcode/cms-plugin/pos-pages/payment-page.ts +378 -296
  29. package/lowcode/cms-plugin/pos-pages/pos-function.js +76 -19
  30. package/lowcode/cms-plugin/pos-pages/pos-function.ts +84 -19
  31. package/lowcode/cms-plugin/shopping-discount-setting.js +2 -2
  32. package/lowcode/cms-plugin/shopping-discount-setting.ts +2 -2
  33. package/lowcode/cms-plugin/shopping-finance-setting.js +1590 -1701
  34. package/lowcode/cms-plugin/shopping-finance-setting.ts +1967 -2011
  35. package/lowcode/cms-plugin/shopping-order-manager.js +74 -62
  36. package/lowcode/cms-plugin/shopping-order-manager.ts +119 -85
  37. package/lowcode/cms-plugin/shopping-product-text.js +874 -531
  38. package/lowcode/cms-plugin/shopping-product-text.ts +1656 -1305
  39. package/lowcode/cms-plugin/shopping-setting-basic.js +152 -124
  40. package/lowcode/cms-plugin/shopping-setting-basic.ts +315 -247
  41. package/lowcode/css/editor.css +3 -2
  42. package/lowcode/glitter-base/global/language.js +5 -3
  43. package/lowcode/glitter-base/global/language.ts +8 -6
  44. package/lowcode/glitter-base/global/payment-config.js +6 -0
  45. package/lowcode/glitter-base/global/payment-config.ts +6 -3
  46. package/lowcode/public-components/product/pd-class.js +1 -3
  47. package/lowcode/public-components/product/pd-class.ts +1 -3
  48. package/lowcode/public-components/user-manager/um-order.js +2 -1
  49. package/lowcode/public-components/user-manager/um-order.ts +2 -1
  50. package/package.json +1 -1
  51. package/src/api-public/controllers/index.js +14 -1
  52. package/src/api-public/controllers/index.js.map +1 -1
  53. package/src/api-public/controllers/index.ts +16 -1
  54. package/src/api-public/controllers/shop.js +14 -7
  55. package/src/api-public/controllers/shop.js.map +1 -1
  56. package/src/api-public/controllers/shop.ts +14 -8
  57. package/src/api-public/services/data-analyze.d.ts +1 -1
  58. package/src/api-public/services/ezpay/tool.d.ts +0 -1
  59. package/src/api-public/services/financial-serviceV2.js +7 -17
  60. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  61. package/src/api-public/services/shopee.js.map +1 -1
  62. package/src/api-public/services/updated-table-checked.js +20 -0
  63. package/src/api-public/services/updated-table-checked.js.map +1 -1
  64. package/src/api-public/services/updated-table-checked.ts +21 -0
  65. package/src/app-project/serverless/src/modules/database.d.ts +1 -1
  66. package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
  67. package/src/helper/glitter-util.d.ts +0 -1
  68. package/src/index.js +3 -3
  69. package/src/index.js.map +13 -1
  70. package/src/modules/database.js +5 -1
  71. package/src/modules/database.js.map +1 -1
  72. package/src/modules/database.ts +5 -1
  73. package/src/modules/tool.d.ts +2 -0
  74. package/src/modules/tool.js +7 -0
  75. package/src/modules/tool.js.map +1 -1
  76. package/src/modules/tool.ts +7 -0
  77. package/src/seo-config.js +3 -3
  78. package/src/seo-config.js.map +9 -1
  79. package/src/services/private_config.js +11 -0
  80. package/src/services/private_config.js.map +1 -1
  81. package/src/services/private_config.ts +11 -0
  82. package/src/services/saas-table-check.js +12 -0
  83. package/src/services/saas-table-check.js.map +1 -1
  84. package/src/services/saas-table-check.ts +12 -0
  85. package/src/services/ses.js +3 -4
  86. package/src/services/ses.js.map +1 -1
@@ -128,7 +128,7 @@ function drawIcon(black, type) {
128
128
  />
129
129
  </svg>
130
130
  `;
131
- default:
131
+ case 'line':
132
132
  return html `
133
133
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
134
134
  <path
@@ -137,6 +137,8 @@ function drawIcon(black, type) {
137
137
  />
138
138
  </svg>
139
139
  `;
140
+ default:
141
+ return html ` <i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i> `;
140
142
  }
141
143
  }
142
144
  export class PosFunction {
@@ -560,6 +562,9 @@ export class PosFunction {
560
562
  const paymentMethods = JSON.parse(JSON.stringify(orderData.pos_info.payment));
561
563
  const dialog = new ShareDialog(gvc.glitter);
562
564
  gvc.glitter.innerDialog(gvc => {
565
+ const saasConfig = window.parent.saasConfig;
566
+ let loading = true;
567
+ let custom_payment = [];
563
568
  return gvc.bindView(() => {
564
569
  const id = gvc.glitter.getUUID();
565
570
  const renderPaymentMethod = (method, index) => {
@@ -577,23 +582,27 @@ export class PosFunction {
577
582
  onclick="${gvc.event(() => handlePaymentAmountClick(method, id, gvc, dialog))}"
578
583
  />
579
584
  </div>
580
- <div class="d-flex" style="flex: 68;">${method.paied ? `已付款` : `尚未付款`}</div>
585
+ <div class="d-flex" style="flex: 68;">${method.paied ? '已付款' : '尚未付款'}</div>
581
586
  <div class="d-flex" style="flex: 16;">
582
587
  ${paymentMethods.length > 1 ? renderDeleteIcon(method, index, gvc, dialog, paymentMethods, id) : ''}
583
588
  </div>
584
589
  </div>`;
585
590
  };
586
591
  const getPaymentMethodLabel = (method) => {
587
- switch (method) {
588
- case 'cash':
589
- return `現金`;
590
- case 'creditCard':
591
- return `刷卡`;
592
- case 'line':
593
- return `LINE PAY`;
594
- default:
595
- return '';
592
+ if (method === 'cash') {
593
+ return '現金';
594
+ }
595
+ if (method === 'creditCard') {
596
+ return '刷卡';
596
597
  }
598
+ if (method === 'line') {
599
+ return 'LINE PAY';
600
+ }
601
+ const payment = (custom_payment || []).find(item => item.key === method);
602
+ if (!payment) {
603
+ return '';
604
+ }
605
+ return payment.title;
597
606
  };
598
607
  const handlePaymentAmountClick = (method, id, gvc, dialog) => {
599
608
  if (method.paied) {
@@ -623,6 +632,9 @@ export class PosFunction {
623
632
  bind: id,
624
633
  view: () => {
625
634
  try {
635
+ if (loading) {
636
+ return BgWidget.spinner({ text: { visible: false } });
637
+ }
626
638
  return html `
627
639
  <div
628
640
  class="d-flex align-items-center"
@@ -638,7 +650,7 @@ export class PosFunction {
638
650
  </div>
639
651
  ${paymentMethods.map(renderPaymentMethod).join('')}
640
652
  ${PosWidget.buttonSnow('新增付款方式', gvc.event(() => {
641
- PosFunction.selectPaymentMethodSingle(gvc, orderData, data => {
653
+ PosFunction.selectPaymentMethodSingle(gvc, orderData, custom_payment, data => {
642
654
  paymentMethods.push(data);
643
655
  gvc.notifyDataChange(id);
644
656
  });
@@ -665,11 +677,43 @@ export class PosFunction {
665
677
  class: `p-3 p-lg-4`,
666
678
  style: `${dialogStyle} width: 546px; gap: 16px;`,
667
679
  },
680
+ onCreate: () => {
681
+ if (loading) {
682
+ saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitter_finance').then((d) => {
683
+ custom_payment = (() => {
684
+ try {
685
+ const val = d.response.result[0].value;
686
+ return val.payment_info_custom
687
+ .filter((item) => {
688
+ try {
689
+ return item.type === 'pos' && val[item.id].toggle;
690
+ }
691
+ catch (error) {
692
+ return false;
693
+ }
694
+ })
695
+ .map((item) => {
696
+ return {
697
+ title: item.name,
698
+ value: item.id,
699
+ key: item.id,
700
+ };
701
+ });
702
+ }
703
+ catch (error) {
704
+ return [];
705
+ }
706
+ })();
707
+ loading = false;
708
+ gvc.notifyDataChange(id);
709
+ });
710
+ }
711
+ },
668
712
  };
669
713
  });
670
714
  }, `selectPaymentMethod`);
671
715
  }
672
- static selectPaymentMethodSingle(gvc, orderDetail, callback) {
716
+ static selectPaymentMethodSingle(gvc, orderDetail, custom_payment, callback) {
673
717
  let method = {
674
718
  method: 'cash',
675
719
  total: 0,
@@ -688,7 +732,7 @@ export class PosFunction {
688
732
  >
689
733
  新增付款方式
690
734
  </div>`,
691
- html `<div class="w-100 d-flex align-items-center" style="gap: 5px;">
735
+ html `<div class="w-100 d-flex align-items-center flex-wrap" style="gap: 5px;">
692
736
  ${(() => {
693
737
  const btnArray = [
694
738
  { title: `現金`, value: 'cash', key: 'cash' },
@@ -697,14 +741,27 @@ export class PosFunction {
697
741
  ].filter(dd => {
698
742
  return dd.key === 'cash' || orderDetail.payment_setting.some((d1) => dd.key === d1.key);
699
743
  });
700
- return btnArray
744
+ return [...btnArray, ...custom_payment]
701
745
  .map(btn => {
746
+ const isActive = method.method === btn.value;
747
+ const boxStyle = `
748
+ min-width: 115px;
749
+ max-width: 115px;
750
+ flex: 1;
751
+ display: flex;
752
+ flex-direction: column;
753
+ justify-content: center;
754
+ align-items: center;
755
+ padding: 15px;
756
+ border-radius: 10px;
757
+ background: #f6f6f6;
758
+ color: ${isActive ? '#393939' : '#8D8D8D'};
759
+ border: 3px solid ${isActive ? '#393939' : '#f6f6f6'};
760
+ box-shadow: 2px 2px 15px rgba(0, 0, 0, ${isActive ? 0.2 : 0});
761
+ `;
702
762
  return html `
703
763
  <div
704
- style="flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px; border-radius: 10px; background: #F6F6F6; ${method.method ===
705
- btn.value
706
- ? 'color: #393939; border: 3px solid #393939; box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.20);'
707
- : 'color: #8D8D8D;'}"
764
+ style="${boxStyle}"
708
765
  onclick="${gvc.event(() => {
709
766
  method = { method: btn.value, total: 0 };
710
767
  gvc.notifyDataChange(id);
@@ -138,7 +138,7 @@ function drawIcon(black: boolean, type: string) {
138
138
  />
139
139
  </svg>
140
140
  `;
141
- default:
141
+ case 'line':
142
142
  return html`
143
143
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
144
144
  <path
@@ -147,6 +147,8 @@ function drawIcon(black: boolean, type: string) {
147
147
  />
148
148
  </svg>
149
149
  `;
150
+ default:
151
+ return html` <i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i> `;
150
152
  }
151
153
  }
152
154
 
@@ -620,6 +622,10 @@ export class PosFunction {
620
622
  const dialog = new ShareDialog(gvc.glitter);
621
623
 
622
624
  gvc.glitter.innerDialog(gvc => {
625
+ const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
626
+ let loading = true;
627
+ let custom_payment: any[] = [];
628
+
623
629
  return gvc.bindView(() => {
624
630
  const id = gvc.glitter.getUUID();
625
631
 
@@ -638,7 +644,7 @@ export class PosFunction {
638
644
  onclick="${gvc.event(() => handlePaymentAmountClick(method, id, gvc, dialog))}"
639
645
  />
640
646
  </div>
641
- <div class="d-flex" style="flex: 68;">${method.paied ? `已付款` : `尚未付款`}</div>
647
+ <div class="d-flex" style="flex: 68;">${method.paied ? '已付款' : '尚未付款'}</div>
642
648
  <div class="d-flex" style="flex: 16;">
643
649
  ${paymentMethods.length > 1 ? renderDeleteIcon(method, index, gvc, dialog, paymentMethods, id) : ''}
644
650
  </div>
@@ -646,16 +652,21 @@ export class PosFunction {
646
652
  };
647
653
 
648
654
  const getPaymentMethodLabel = (method: string) => {
649
- switch (method) {
650
- case 'cash':
651
- return `現金`;
652
- case 'creditCard':
653
- return `刷卡`;
654
- case 'line':
655
- return `LINE PAY`;
656
- default:
657
- return '';
655
+ if (method === 'cash') {
656
+ return '現金';
657
+ }
658
+ if (method === 'creditCard') {
659
+ return '刷卡';
658
660
  }
661
+ if (method === 'line') {
662
+ return 'LINE PAY';
663
+ }
664
+
665
+ const payment = (custom_payment || []).find(item => item.key === method);
666
+ if (!payment) {
667
+ return '';
668
+ }
669
+ return payment.title;
659
670
  };
660
671
 
661
672
  const handlePaymentAmountClick = (method: any, id: string, gvc: GVC, dialog: ShareDialog) => {
@@ -695,6 +706,10 @@ export class PosFunction {
695
706
  bind: id,
696
707
  view: () => {
697
708
  try {
709
+ if (loading) {
710
+ return BgWidget.spinner({ text: { visible: false } });
711
+ }
712
+
698
713
  return html`
699
714
  <div
700
715
  class="d-flex align-items-center"
@@ -712,7 +727,7 @@ export class PosFunction {
712
727
  ${PosWidget.buttonSnow(
713
728
  '新增付款方式',
714
729
  gvc.event(() => {
715
- PosFunction.selectPaymentMethodSingle(gvc, orderData, data => {
730
+ PosFunction.selectPaymentMethodSingle(gvc, orderData, custom_payment, data => {
716
731
  paymentMethods.push(data);
717
732
  gvc.notifyDataChange(id);
718
733
  });
@@ -741,13 +756,49 @@ export class PosFunction {
741
756
  class: `p-3 p-lg-4`,
742
757
  style: `${dialogStyle} width: 546px; gap: 16px;`,
743
758
  },
759
+ onCreate: () => {
760
+ if (loading) {
761
+ saasConfig.api.getPrivateConfig(saasConfig.config.appName, 'glitter_finance').then((d: any) => {
762
+ custom_payment = (() => {
763
+ try {
764
+ const val = d.response.result[0].value;
765
+
766
+ return val.payment_info_custom
767
+ .filter((item: any) => {
768
+ try {
769
+ return item.type === 'pos' && val[item.id].toggle;
770
+ } catch (error) {
771
+ return false;
772
+ }
773
+ })
774
+ .map((item: any) => {
775
+ return {
776
+ title: item.name,
777
+ value: item.id,
778
+ key: item.id,
779
+ };
780
+ });
781
+ } catch (error) {
782
+ return [];
783
+ }
784
+ })();
785
+ loading = false;
786
+ gvc.notifyDataChange(id);
787
+ });
788
+ }
789
+ },
744
790
  };
745
791
  });
746
792
  }, `selectPaymentMethod`);
747
793
  }
748
794
 
749
795
  // 選擇單一付款方式
750
- public static selectPaymentMethodSingle(gvc: GVC, orderDetail: any, callback: (method: any) => void) {
796
+ public static selectPaymentMethodSingle(
797
+ gvc: GVC,
798
+ orderDetail: any,
799
+ custom_payment: any,
800
+ callback: (method: any) => void
801
+ ) {
751
802
  let method = {
752
803
  method: 'cash',
753
804
  total: 0,
@@ -767,7 +818,7 @@ export class PosFunction {
767
818
  >
768
819
  新增付款方式
769
820
  </div>`,
770
- html`<div class="w-100 d-flex align-items-center" style="gap: 5px;">
821
+ html`<div class="w-100 d-flex align-items-center flex-wrap" style="gap: 5px;">
771
822
  ${(() => {
772
823
  const btnArray = [
773
824
  { title: `現金`, value: 'cash', key: 'cash' },
@@ -777,14 +828,28 @@ export class PosFunction {
777
828
  return dd.key === 'cash' || orderDetail.payment_setting.some((d1: any) => dd.key === d1.key);
778
829
  });
779
830
 
780
- return btnArray
831
+ return [...btnArray, ...custom_payment]
781
832
  .map(btn => {
833
+ const isActive = method.method === btn.value;
834
+ const boxStyle = `
835
+ min-width: 115px;
836
+ max-width: 115px;
837
+ flex: 1;
838
+ display: flex;
839
+ flex-direction: column;
840
+ justify-content: center;
841
+ align-items: center;
842
+ padding: 15px;
843
+ border-radius: 10px;
844
+ background: #f6f6f6;
845
+ color: ${isActive ? '#393939' : '#8D8D8D'};
846
+ border: 3px solid ${isActive ? '#393939' : '#f6f6f6'};
847
+ box-shadow: 2px 2px 15px rgba(0, 0, 0, ${isActive ? 0.2 : 0});
848
+ `;
849
+
782
850
  return html`
783
851
  <div
784
- style="flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px; border-radius: 10px; background: #F6F6F6; ${method.method ===
785
- btn.value
786
- ? 'color: #393939; border: 3px solid #393939; box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.20);'
787
- : 'color: #8D8D8D;'}"
852
+ style="${boxStyle}"
788
853
  onclick="${gvc.event(() => {
789
854
  method = { method: btn.value, total: 0 };
790
855
  gvc.notifyDataChange(id);
@@ -1245,12 +1245,12 @@ export class ShoppingDiscountSetting {
1245
1245
  {
1246
1246
  key: 'before',
1247
1247
  name: '折扣前金額',
1248
- innerHtml: BgWidget.grayNote('以未套用其他優惠前的商品原始金額,來判斷是否達成此優惠券的使用門檻'),
1248
+ innerHtml: BgWidget.grayNote('以未套用其他優惠前的訂單原始金額,來判斷是否達成此優惠券的使用門檻'),
1249
1249
  },
1250
1250
  {
1251
1251
  key: 'after',
1252
1252
  name: '折扣後金額',
1253
- innerHtml: BgWidget.grayNote('使用已套用其他優惠後的實際結帳,來判斷是否達成此優惠券的使用門檻'),
1253
+ innerHtml: BgWidget.grayNote('使用已套用其他優惠後的實際結帳金額,來判斷是否達成此優惠券的使用門檻'),
1254
1254
  },
1255
1255
  ], [voucherData.includeDiscount], text => {
1256
1256
  voucherData.includeDiscount = text[0];
@@ -1521,12 +1521,12 @@ export class ShoppingDiscountSetting {
1521
1521
  {
1522
1522
  key: 'before',
1523
1523
  name: '折扣前金額',
1524
- innerHtml: BgWidget.grayNote('以未套用其他優惠前的商品原始金額,來判斷是否達成此優惠券的使用門檻'),
1524
+ innerHtml: BgWidget.grayNote('以未套用其他優惠前的訂單原始金額,來判斷是否達成此優惠券的使用門檻'),
1525
1525
  },
1526
1526
  {
1527
1527
  key: 'after',
1528
1528
  name: '折扣後金額',
1529
- innerHtml: BgWidget.grayNote('使用已套用其他優惠後的實際結帳,來判斷是否達成此優惠券的使用門檻'),
1529
+ innerHtml: BgWidget.grayNote('使用已套用其他優惠後的實際結帳金額,來判斷是否達成此優惠券的使用門檻'),
1530
1530
  },
1531
1531
  ],
1532
1532
  [voucherData.includeDiscount],