ts-glitter 21.3.7 → 21.3.9

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 (135) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-line.js +12 -1
  4. package/lowcode/backend-manager/bg-line.ts +16 -1
  5. package/lowcode/backend-manager/bg-notify.js +13 -2
  6. package/lowcode/backend-manager/bg-notify.ts +17 -2
  7. package/lowcode/backend-manager/bg-product.js +81 -30
  8. package/lowcode/backend-manager/bg-product.ts +95 -34
  9. package/lowcode/backend-manager/bg-recommend.js +109 -141
  10. package/lowcode/backend-manager/bg-recommend.ts +122 -144
  11. package/lowcode/backend-manager/bg-sns.js +14 -4
  12. package/lowcode/backend-manager/bg-sns.ts +18 -4
  13. package/lowcode/backend-manager/bg-widget.js +176 -12
  14. package/lowcode/backend-manager/bg-widget.ts +198 -13
  15. package/lowcode/cms-plugin/POS-setting.js +2 -2
  16. package/lowcode/cms-plugin/POS-setting.ts +2 -2
  17. package/lowcode/cms-plugin/auto-fcm-advertise.js +13 -2
  18. package/lowcode/cms-plugin/auto-fcm-advertise.ts +16 -2
  19. package/lowcode/cms-plugin/auto-fcm-history.js +13 -2
  20. package/lowcode/cms-plugin/auto-fcm-history.ts +16 -2
  21. package/lowcode/cms-plugin/model/order.d.ts +1 -0
  22. package/lowcode/cms-plugin/module/order-excel.js +18 -2
  23. package/lowcode/cms-plugin/module/order-excel.ts +20 -9
  24. package/lowcode/cms-plugin/module/product-setting.js +2 -1
  25. package/lowcode/cms-plugin/module/product-setting.ts +2 -1
  26. package/lowcode/cms-plugin/module/user-excel.js +1 -1
  27. package/lowcode/cms-plugin/module/user-excel.ts +2 -2
  28. package/lowcode/cms-plugin/pos-pages/payment-page.js +4 -3
  29. package/lowcode/cms-plugin/pos-pages/payment-page.ts +12 -6
  30. package/lowcode/cms-plugin/pos-pages/products-page.js +9 -5
  31. package/lowcode/cms-plugin/pos-pages/products-page.ts +11 -5
  32. package/lowcode/cms-plugin/shopping-allowance-manager.js +3 -2
  33. package/lowcode/cms-plugin/shopping-allowance-manager.ts +3 -2
  34. package/lowcode/cms-plugin/shopping-discount-setting.js +2 -0
  35. package/lowcode/cms-plugin/shopping-discount-setting.ts +2 -0
  36. package/lowcode/cms-plugin/shopping-invoice-manager.js +7 -4
  37. package/lowcode/cms-plugin/shopping-invoice-manager.ts +12 -11
  38. package/lowcode/cms-plugin/shopping-order-manager.js +21 -4
  39. package/lowcode/cms-plugin/shopping-order-manager.ts +30 -11
  40. package/lowcode/cms-plugin/shopping-product-setting.js +45 -41
  41. package/lowcode/cms-plugin/shopping-product-setting.ts +55 -48
  42. package/lowcode/cms-plugin/shopping-rebate.js +52 -46
  43. package/lowcode/cms-plugin/shopping-rebate.ts +402 -396
  44. package/lowcode/cms-plugin/shopping-setting-advance.js +6 -6
  45. package/lowcode/cms-plugin/shopping-setting-advance.ts +7 -7
  46. package/lowcode/cms-plugin/shopping-setting-basic.js +44 -0
  47. package/lowcode/cms-plugin/shopping-setting-basic.ts +63 -1
  48. package/lowcode/cms-plugin/shopping-setting-stock-log.js +57 -0
  49. package/lowcode/cms-plugin/shopping-setting-stock-log.ts +101 -0
  50. package/lowcode/cms-plugin/user-list.js +10 -9
  51. package/lowcode/cms-plugin/user-list.ts +11 -8
  52. package/lowcode/css/editor.css +1 -1
  53. package/lowcode/form-view/editor/image-selector.js +83 -82
  54. package/lowcode/form-view/editor/image-selector.ts +115 -107
  55. package/lowcode/glitter-base/route/user.js +27 -34
  56. package/lowcode/glitter-base/route/user.ts +31 -40
  57. package/lowcode/glitterBundle/dialog/ShareDialog.js +1 -0
  58. package/lowcode/glitterBundle/dialog/ShareDialog.ts +2 -0
  59. package/lowcode/glitterBundle/dialog/dialog.js +2 -2
  60. package/lowcode/glitterBundle/dialog/dialog.ts +2 -2
  61. package/lowcode/glitterBundle/plugins/editor-elem.js +5 -11
  62. package/lowcode/glitterBundle/plugins/editor-elem.ts +11 -11
  63. package/lowcode/modules/image-library.js +836 -486
  64. package/lowcode/modules/image-library.ts +1760 -1418
  65. package/lowcode/modules/tool.js +10 -9
  66. package/lowcode/modules/tool.ts +11 -10
  67. package/lowcode/public-models/product.ts +13 -0
  68. package/nxv0ptv53w.json +1 -0
  69. package/package.json +1 -1
  70. package/src/api-public/controllers/shop.js +2 -2
  71. package/src/api-public/controllers/shop.js.map +1 -1
  72. package/src/api-public/controllers/shop.ts +5 -2
  73. package/src/api-public/controllers/stock.js +1 -1
  74. package/src/api-public/controllers/stock.js.map +1 -1
  75. package/src/api-public/controllers/stock.ts +93 -81
  76. package/src/api-public/models/glitter-finance.js +2 -1
  77. package/src/api-public/models/glitter-finance.js.map +1 -1
  78. package/src/api-public/services/checkout-event.js +1 -0
  79. package/src/api-public/services/checkout-event.js.map +1 -1
  80. package/src/api-public/services/checkout-event.ts +2 -2
  81. package/src/api-public/services/data-analyze.d.ts +1 -1
  82. package/src/api-public/services/diff-record.d.ts +25 -0
  83. package/src/api-public/services/diff-record.js +158 -0
  84. package/src/api-public/services/diff-record.js.map +1 -0
  85. package/src/api-public/services/diff-record.ts +217 -0
  86. package/src/api-public/services/ezpay/tool.d.ts +1 -0
  87. package/src/api-public/services/financial-serviceV2.js +7 -17
  88. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  89. package/src/api-public/services/public-table-check.js +25 -7
  90. package/src/api-public/services/public-table-check.js.map +1 -1
  91. package/src/api-public/services/public-table-check.ts +53 -31
  92. package/src/api-public/services/shopping.d.ts +2 -12
  93. package/src/api-public/services/shopping.js +16 -7
  94. package/src/api-public/services/shopping.js.map +1 -1
  95. package/src/api-public/services/shopping.ts +33 -7
  96. package/src/api-public/services/stock.d.ts +1 -1
  97. package/src/api-public/services/stock.js +19 -17
  98. package/src/api-public/services/stock.js.map +1 -1
  99. package/src/api-public/services/stock.ts +711 -696
  100. package/src/api-public/services/user.d.ts +1 -1
  101. package/src/api-public/services/user.js +18 -8
  102. package/src/api-public/services/user.js.map +1 -1
  103. package/src/api-public/services/user.ts +34 -27
  104. package/src/app-project/serverless/src/index.js +7 -17
  105. package/src/app-project/serverless/src/index.js.map +1 -1
  106. package/src/app-project/serverless/src/modules/CryptoJS.js +7 -17
  107. package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
  108. package/src/app-project/serverless/src/modules/database.d.ts +1 -1
  109. package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
  110. package/src/app-project/serverless/src/modules/ssh.js +7 -17
  111. package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
  112. package/src/firebase/message.js +2 -1
  113. package/src/firebase/message.js.map +1 -1
  114. package/src/helper/app_creater.js +2 -1
  115. package/src/helper/app_creater.js.map +1 -1
  116. package/src/helper/glitter-util.d.ts +1 -0
  117. package/src/index.js +17 -7
  118. package/src/index.js.map +5 -1
  119. package/src/lambda/interface.js +2 -2
  120. package/src/lambda/interface.js.map +1 -1
  121. package/src/modules/CryptoJS.js +7 -17
  122. package/src/modules/CryptoJS.js.map +1 -1
  123. package/src/modules/database.d.ts +1 -1
  124. package/src/modules/ssh.js +7 -17
  125. package/src/modules/ssh.js.map +1 -1
  126. package/src/modules/tool.d.ts +5 -0
  127. package/src/modules/tool.js +19 -0
  128. package/src/modules/tool.js.map +1 -1
  129. package/src/modules/tool.ts +27 -0
  130. package/src/run.js +2 -1
  131. package/src/run.js.map +1 -1
  132. package/src/services/saas-table-check.js +2 -2
  133. package/src/services/saas-table-check.js.map +1 -1
  134. package/src/services/ses.js +2 -1
  135. package/src/services/ses.js.map +1 -1
@@ -580,6 +580,7 @@ export class BgRecommend {
580
580
  ${BgWidget.title(vm.data.title || '新增分銷連結')}
581
581
  <div class="flex-fill"></div>
582
582
  </div>`,
583
+ BgWidget.mbContainer(18),
583
584
  BgWidget.container1x2({
584
585
  html: gvc.bindView(() => {
585
586
  const id = glitter.getUUID();
@@ -750,153 +751,120 @@ export class BgRecommend {
750
751
  }, { single: true, readonly: vm.readonly })}`,
751
752
  ].join(BgWidget.mbContainer(18))),
752
753
  BgWidget.mainCard([
753
- html ` <div class="tx_700 mb-3">分潤商品</div>`,
754
- gvc.bindView({
755
- bind: 'listProduct',
756
- view: () => {
757
- try {
758
- let returnHTML = '';
759
- if (newOrder.productCheck.length) {
760
- newOrder.productCheck.map((product, index) => {
761
- var _a, _b;
762
- let selectVariant = product.content.variants[parseInt((_a = product.selectIndex) !== null && _a !== void 0 ? _a : 0)];
763
- selectVariant.preview_image = (_b = selectVariant.preview_image) !== null && _b !== void 0 ? _b : '';
764
- let productIMG = typeof selectVariant.preview_image == 'string'
765
- ? selectVariant.preview_image
766
- : selectVariant.preview_image[0];
767
- productIMG = productIMG
768
- ? productIMG
769
- : product.content.preview_image[0]
770
- ? product.content.preview_image[0]
771
- : BgWidget.noImageURL;
772
- selectVariant.qty = selectVariant.qty || 1;
773
- returnHTML += html `
774
- <div
775
- style="width: 100%;display: flex;align-items: center;position: relative;padding-right: 20px;"
776
- >
777
- <div
778
- class="flex-fill d-flex align-items-center col-5"
779
- style="font-size: 16px;font-weight: 700;gap: 12px;"
780
- >
781
- <div
782
- style="width: 54px;height: 54px; background: url('${productIMG}') lightgray 50% / cover no-repeat;"
783
- ></div>
754
+ BgWidget.title('分潤商品', 'font-size: 16px;'),
755
+ html ` <div class="my-2"></div>`,
756
+ gvc.bindView(() => {
757
+ var _a;
758
+ const subVM = {
759
+ id: gvc.glitter.getUUID(),
760
+ loading: true,
761
+ dataList: [],
762
+ };
763
+ function getSelectProducts(id_array) {
764
+ return __awaiter(this, void 0, void 0, function* () {
765
+ const products_data = yield ApiShop.getProduct({
766
+ page: 0,
767
+ limit: 99999,
768
+ id_list: id_array.join(','),
769
+ }).then(data => data.response.data);
770
+ return products_data;
771
+ });
772
+ }
773
+ (_a = newOrder.productCheck) !== null && _a !== void 0 ? _a : (newOrder.productCheck = []);
774
+ const relativeCloneData = structuredClone(newOrder.productCheck);
775
+ return {
776
+ bind: subVM.id,
777
+ view: () => {
778
+ if (subVM.loading) {
779
+ return BgWidget.spinner();
780
+ }
781
+ return html `
782
+ <div class="d-flex flex-column p-2" style="gap: 18px;">
783
+ <div
784
+ class="d-flex align-items-center gray-bottom-line-18"
785
+ style="gap: 24px; justify-content: space-between;"
786
+ >
787
+ <div class="form-check-label c_updown_label">
788
+ <div class="tx_normal">產品列表</div>
789
+ </div>
790
+ ${BgWidget.grayButton('選擇商品', gvc.event(() => {
791
+ BgProduct.productsDialog({
792
+ gvc: gvc,
793
+ default: relativeCloneData.map((dd) => dd.id),
794
+ callback: product_array => {
795
+ getSelectProducts(product_array).then(resp => {
796
+ newOrder.productCheck = resp;
797
+ subVM.loading = true;
798
+ gvc.notifyDataChange(subVM.id);
799
+ });
800
+ },
801
+ });
802
+ }), { textStyle: 'font-weight: 400;' })}
803
+ </div>
804
+ ${subVM.dataList
805
+ .map((opt, index) => {
806
+ return html `
784
807
  <div
785
- style="display: flex;flex-direction: column;align-items: flex-start;gap: 4px;width: calc(100% - 54px);padding-right: 15px;"
808
+ class="d-flex align-items-center form-check-label c_updown_label gap-3"
786
809
  >
787
- <div
788
- style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100%;"
789
- >
790
- ${product.content.title}
810
+ <span class="tx_normal" style="min-width: 20px;">${index + 1}.</span>
811
+ ${BgWidget.validImageBox({
812
+ gvc: gvc,
813
+ image: opt.image,
814
+ width: 40,
815
+ })}
816
+ <div class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex flex-column">
817
+ ${opt.value}
818
+ ${opt.note ? html ` <div class="tx_gray_12">${opt.note}</div> ` : ''}
791
819
  </div>
820
+ <div class="flex-fill"></div>
821
+ ${BgWidget.cancel(gvc.event(() => {
822
+ newOrder.productCheck.splice(index, 1);
823
+ subVM.dataList.splice(index, 1);
824
+ gvc.notifyDataChange(subVM.id);
825
+ }), '移除')}
792
826
  </div>
793
- </div>
794
- <div
795
- class="col-3"
796
- style="display: flex;padding-right: 40px;align-items: flex-start;font-size: 16px;font-weight: 400;"
797
- >
798
- $${(() => {
799
- const price = parseInt(`${selectVariant.sale_price}`, 10);
800
- return isNaN(price) ? 0 : price.toLocaleString();
801
- })()}
802
- </div>
803
- <div
804
- style="min-width: 6%;font-size: 16px;font-weight: 400;width: 100px;text-align: right;"
805
- >
806
- <span
807
- >$${(selectVariant.sale_price * selectVariant.qty).toLocaleString()}</span
808
- >
809
- <div
810
- class="d-flex align-items-center cursor_pointer"
811
- style="position: absolute;right:0;top:50%;transform: translateY(-50%)"
812
- onclick="${gvc.event(() => {
813
- newOrder.productCheck.splice(index, 1);
814
- gvc.notifyDataChange('listProduct');
815
- })}"
816
- >
817
- <svg
818
- xmlns="http://www.w3.org/2000/svg"
819
- width="11"
820
- height="10"
821
- viewBox="0 0 11 10"
822
- fill="none"
823
- >
824
- <path
825
- d="M1.51367 9.24219L9.99895 0.756906"
826
- stroke="#DDDDDD"
827
- stroke-width="1.3"
828
- stroke-linecap="round"
829
- />
830
- <path
831
- d="M9.99805 9.24219L1.51276 0.756907"
832
- stroke="#DDDDDD"
833
- stroke-width="1.3"
834
- stroke-linecap="round"
835
- />
836
- </svg>
837
- </div>
838
- </div>
839
- </div>
840
- `;
841
- });
842
- }
843
- return returnHTML;
844
- }
845
- catch (e) {
846
- console.log(e);
847
- return `error`;
848
- }
849
- },
850
- divCreate: {
851
- style: `display: flex;flex-direction: column;align-items: flex-start;gap: 18px;align-self: stretch;`,
852
- class: ``,
853
- },
854
- }),
855
- gvc.bindView({
856
- bind: 'addProduct',
857
- view: () => {
858
- return html `
859
- <div
860
- class="w-100 d-flex justify-content-center align-items-center"
861
- style="color: #36B;gap:5px;"
862
- onclick="${gvc.event(() => {
863
- let confirm = true;
864
- BgProduct.productsDialog({
865
- gvc: gvc,
866
- default: newOrder.productCheck.map((dd) => {
867
- return dd.id;
868
- }),
869
- callback: (value) => __awaiter(this, void 0, void 0, function* () {
870
- const dialog = new ShareDialog(glitter);
871
- dialog.dataLoading({ visible: true });
872
- const pd = yield ApiShop.getProduct({
873
- limit: 1000,
874
- page: 0,
875
- id_list: value.join(','),
876
- });
877
- newOrder.productCheck = pd.response.data;
878
- dialog.dataLoading({ visible: false });
879
- gvc.notifyDataChange(id);
880
- }),
881
- filter: d1 => {
882
- return !newOrder.productCheck.find((dd) => {
883
- return dd.id === d1;
827
+ `;
828
+ })
829
+ .join('') ||
830
+ html `<div class="w-100 d-flex align-content-center justify-content-center">
831
+ 尚未加入任何賣場商品
832
+ </div>`}
833
+ </div>
834
+ `;
835
+ },
836
+ onCreate: () => {
837
+ if (subVM.loading) {
838
+ if (newOrder.productCheck.length === 0) {
839
+ setTimeout(() => {
840
+ subVM.dataList = [];
841
+ subVM.loading = false;
842
+ gvc.notifyDataChange(subVM.id);
843
+ }, 100);
844
+ }
845
+ else {
846
+ new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
847
+ const products_data = yield getSelectProducts(newOrder.productCheck.map((p) => p.id));
848
+ newOrder.productCheck = products_data;
849
+ subVM.dataList = products_data.map((product) => {
850
+ return {
851
+ key: product.id,
852
+ value: product.content.title,
853
+ image: product.content.preview_image[0] || BgWidget.noImageURL,
854
+ };
855
+ });
856
+ resolve(subVM.dataList);
857
+ })).then(data => {
858
+ subVM.dataList = data;
859
+ subVM.loading = false;
860
+ gvc.notifyDataChange(subVM.id);
884
861
  });
885
- },
886
- });
887
- })}"
888
- >
889
- 設定分潤商品
890
- <i class="fa-duotone fa-solid fa-gear"></i>
891
- </div>
892
- `;
893
- },
894
- divCreate: {
895
- style: `width: 100%;display: flex;align-items: center;margin:24px 0;cursor: pointer;`,
896
- class: ``,
897
- },
862
+ }
863
+ }
864
+ },
865
+ };
898
866
  }),
899
- ].join(``)),
867
+ ].join('')),
900
868
  vm.readonly
901
869
  ? gvc.bindView(() => {
902
870
  const id = gvc.glitter.getUUID();
@@ -695,6 +695,7 @@ export class BgRecommend {
695
695
  ${BgWidget.title(vm.data.title || '新增分銷連結')}
696
696
  <div class="flex-fill"></div>
697
697
  </div>`,
698
+ BgWidget.mbContainer(18),
698
699
  BgWidget.container1x2(
699
700
  {
700
701
  html: gvc.bindView(() => {
@@ -876,157 +877,133 @@ export class BgRecommend {
876
877
  ),
877
878
  BgWidget.mainCard(
878
879
  [
879
- html` <div class="tx_700 mb-3">分潤商品</div>`,
880
- gvc.bindView({
881
- bind: 'listProduct',
882
- view: () => {
883
- try {
884
- let returnHTML = '';
880
+ BgWidget.title('分潤商品', 'font-size: 16px;'),
881
+ html` <div class="my-2"></div>`,
882
+ gvc.bindView(() => {
883
+ const subVM = {
884
+ id: gvc.glitter.getUUID(),
885
+ loading: true,
886
+ dataList: [] as OptionsItem[],
887
+ };
885
888
 
886
- if (newOrder.productCheck.length) {
887
- newOrder.productCheck.map((product: any, index: number) => {
888
- let selectVariant =
889
- product.content.variants[parseInt(product.selectIndex ?? 0)];
890
- selectVariant.preview_image = selectVariant.preview_image ?? '';
891
- let productIMG =
892
- typeof selectVariant.preview_image == 'string'
893
- ? selectVariant.preview_image
894
- : selectVariant.preview_image[0];
895
- productIMG = productIMG
896
- ? productIMG
897
- : product.content.preview_image[0]
898
- ? product.content.preview_image[0]
899
- : BgWidget.noImageURL;
900
- selectVariant.qty = selectVariant.qty || 1;
901
- returnHTML += html`
902
- <div
903
- style="width: 100%;display: flex;align-items: center;position: relative;padding-right: 20px;"
904
- >
905
- <div
906
- class="flex-fill d-flex align-items-center col-5"
907
- style="font-size: 16px;font-weight: 700;gap: 12px;"
908
- >
909
- <div
910
- style="width: 54px;height: 54px; background: url('${productIMG}') lightgray 50% / cover no-repeat;"
911
- ></div>
889
+ async function getSelectProducts(id_array: number[]) {
890
+ const products_data = await ApiShop.getProduct({
891
+ page: 0,
892
+ limit: 99999,
893
+ id_list: id_array.join(','),
894
+ }).then(data => data.response.data);
895
+
896
+ return products_data;
897
+ }
898
+
899
+ newOrder.productCheck ??= [];
900
+ const relativeCloneData = structuredClone(newOrder.productCheck);
901
+
902
+ return {
903
+ bind: subVM.id,
904
+ view: () => {
905
+ if (subVM.loading) {
906
+ return BgWidget.spinner();
907
+ }
908
+
909
+ return html`
910
+ <div class="d-flex flex-column p-2" style="gap: 18px;">
911
+ <div
912
+ class="d-flex align-items-center gray-bottom-line-18"
913
+ style="gap: 24px; justify-content: space-between;"
914
+ >
915
+ <div class="form-check-label c_updown_label">
916
+ <div class="tx_normal">產品列表</div>
917
+ </div>
918
+ ${BgWidget.grayButton(
919
+ '選擇商品',
920
+ gvc.event(() => {
921
+ BgProduct.productsDialog({
922
+ gvc: gvc,
923
+ default: relativeCloneData.map((dd: any) => dd.id),
924
+ callback: product_array => {
925
+ getSelectProducts(product_array).then(resp => {
926
+ newOrder.productCheck = resp;
927
+ subVM.loading = true;
928
+ gvc.notifyDataChange(subVM.id);
929
+ });
930
+ },
931
+ });
932
+ }),
933
+ { textStyle: 'font-weight: 400;' }
934
+ )}
935
+ </div>
936
+ ${subVM.dataList
937
+ .map((opt, index) => {
938
+ return html`
912
939
  <div
913
- style="display: flex;flex-direction: column;align-items: flex-start;gap: 4px;width: calc(100% - 54px);padding-right: 15px;"
940
+ class="d-flex align-items-center form-check-label c_updown_label gap-3"
914
941
  >
915
- <div
916
- style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100%;"
917
- >
918
- ${product.content.title}
942
+ <span class="tx_normal" style="min-width: 20px;">${index + 1}.</span>
943
+ ${BgWidget.validImageBox({
944
+ gvc: gvc,
945
+ image: opt.image,
946
+ width: 40,
947
+ })}
948
+ <div class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex flex-column">
949
+ ${opt.value}
950
+ ${opt.note ? html` <div class="tx_gray_12">${opt.note}</div> ` : ''}
919
951
  </div>
952
+ <div class="flex-fill"></div>
953
+ ${BgWidget.cancel(
954
+ gvc.event(() => {
955
+ newOrder.productCheck.splice(index, 1);
956
+ subVM.dataList.splice(index, 1);
957
+ gvc.notifyDataChange(subVM.id);
958
+ }),
959
+ '移除'
960
+ )}
920
961
  </div>
921
- </div>
922
- <div
923
- class="col-3"
924
- style="display: flex;padding-right: 40px;align-items: flex-start;font-size: 16px;font-weight: 400;"
925
- >
926
- $${(() => {
927
- const price = parseInt(`${selectVariant.sale_price}`, 10);
928
- return isNaN(price) ? 0 : price.toLocaleString();
929
- })()}
930
- </div>
931
- <div
932
- style="min-width: 6%;font-size: 16px;font-weight: 400;width: 100px;text-align: right;"
933
- >
934
- <span
935
- >$${(
936
- selectVariant.sale_price * selectVariant.qty
937
- ).toLocaleString()}</span
938
- >
939
- <div
940
- class="d-flex align-items-center cursor_pointer"
941
- style="position: absolute;right:0;top:50%;transform: translateY(-50%)"
942
- onclick="${gvc.event(() => {
943
- newOrder.productCheck.splice(index, 1);
944
- gvc.notifyDataChange('listProduct');
945
- })}"
946
- >
947
- <svg
948
- xmlns="http://www.w3.org/2000/svg"
949
- width="11"
950
- height="10"
951
- viewBox="0 0 11 10"
952
- fill="none"
953
- >
954
- <path
955
- d="M1.51367 9.24219L9.99895 0.756906"
956
- stroke="#DDDDDD"
957
- stroke-width="1.3"
958
- stroke-linecap="round"
959
- />
960
- <path
961
- d="M9.99805 9.24219L1.51276 0.756907"
962
- stroke="#DDDDDD"
963
- stroke-width="1.3"
964
- stroke-linecap="round"
965
- />
966
- </svg>
967
- </div>
968
- </div>
969
- </div>
970
- `;
971
- });
972
- }
973
- return returnHTML;
974
- } catch (e) {
975
- console.log(e);
976
- return `error`;
977
- }
978
- },
979
- divCreate: {
980
- style: `display: flex;flex-direction: column;align-items: flex-start;gap: 18px;align-self: stretch;`,
981
- class: ``,
982
- },
983
- }),
984
- gvc.bindView({
985
- bind: 'addProduct',
986
- view: () => {
987
- return html`
988
- <div
989
- class="w-100 d-flex justify-content-center align-items-center"
990
- style="color: #36B;gap:5px;"
991
- onclick="${gvc.event(() => {
992
- let confirm = true;
993
- // productData.content
994
- BgProduct.productsDialog({
995
- gvc: gvc,
996
- default: newOrder.productCheck.map((dd: any) => {
997
- return dd.id;
998
- }),
999
- callback: async value => {
1000
- const dialog = new ShareDialog(glitter);
1001
- dialog.dataLoading({ visible: true });
1002
- const pd = await ApiShop.getProduct({
1003
- limit: 1000,
1004
- page: 0,
1005
- id_list: value.join(','),
1006
- });
1007
- newOrder.productCheck = pd.response.data;
1008
- dialog.dataLoading({ visible: false });
1009
- gvc.notifyDataChange(id);
1010
- },
1011
- filter: d1 => {
1012
- return !newOrder.productCheck.find((dd: any) => {
1013
- return dd.id === d1;
1014
- });
1015
- },
962
+ `;
963
+ })
964
+ .join('') ||
965
+ html`<div class="w-100 d-flex align-content-center justify-content-center">
966
+ 尚未加入任何賣場商品
967
+ </div>`}
968
+ </div>
969
+ `;
970
+ },
971
+ onCreate: () => {
972
+ if (subVM.loading) {
973
+ if (newOrder.productCheck.length === 0) {
974
+ setTimeout(() => {
975
+ subVM.dataList = [];
976
+ subVM.loading = false;
977
+ gvc.notifyDataChange(subVM.id);
978
+ }, 100);
979
+ } else {
980
+ new Promise<OptionsItem[]>(async resolve => {
981
+ const products_data = await getSelectProducts(
982
+ newOrder.productCheck.map((p: any) => p.id)
983
+ );
984
+
985
+ newOrder.productCheck = products_data;
986
+
987
+ subVM.dataList = products_data.map((product: any) => {
988
+ return {
989
+ key: product.id,
990
+ value: product.content.title,
991
+ image: product.content.preview_image[0] || BgWidget.noImageURL,
992
+ };
993
+ });
994
+
995
+ resolve(subVM.dataList);
996
+ }).then(data => {
997
+ subVM.dataList = data;
998
+ subVM.loading = false;
999
+ gvc.notifyDataChange(subVM.id);
1016
1000
  });
1017
- })}"
1018
- >
1019
- 設定分潤商品
1020
- <i class="fa-duotone fa-solid fa-gear"></i>
1021
- </div>
1022
- `;
1023
- },
1024
- divCreate: {
1025
- style: `width: 100%;display: flex;align-items: center;margin:24px 0;cursor: pointer;`,
1026
- class: ``,
1027
- },
1001
+ }
1002
+ }
1003
+ },
1004
+ };
1028
1005
  }),
1029
- ].join(``)
1006
+ ].join('')
1030
1007
  ),
1031
1008
  // 訂單記錄
1032
1009
  vm.readonly
@@ -1805,6 +1782,7 @@ export class BgRecommend {
1805
1782
  }
1806
1783
 
1807
1784
  vm.data.lineItems = newOrder.productCheck;
1785
+
1808
1786
  vm.data.start_ISO_Date = new Date(`${vm.data.startDate} ${vm.data.startTime}`).toISOString();
1809
1787
  if (vm.data.endDate && vm.data.endTime) {
1810
1788
  vm.data.end_ISO_Date = new Date(`${vm.data.endDate} ${vm.data.endTime}`).toISOString();