ts-glitter 20.6.7 → 20.6.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 (160) hide show
  1. package/lowcode/Entry.js +2 -2
  2. package/lowcode/Entry.ts +2 -2
  3. package/lowcode/backend-manager/bg-blog.js +617 -621
  4. package/lowcode/backend-manager/bg-blog.ts +2323 -2325
  5. package/lowcode/backend-manager/bg-line.js +5 -4
  6. package/lowcode/backend-manager/bg-line.ts +5 -4
  7. package/lowcode/backend-manager/bg-list-component.js +9 -0
  8. package/lowcode/backend-manager/bg-list-component.ts +15 -1
  9. package/lowcode/backend-manager/bg-notify.js +6 -4
  10. package/lowcode/backend-manager/bg-notify.ts +6 -4
  11. package/lowcode/backend-manager/bg-product.js +145 -0
  12. package/lowcode/backend-manager/bg-product.ts +153 -0
  13. package/lowcode/backend-manager/bg-sns.js +5 -3
  14. package/lowcode/backend-manager/bg-sns.ts +5 -3
  15. package/lowcode/backend-manager/bg-widget.js +92 -4
  16. package/lowcode/backend-manager/bg-widget.ts +122 -6
  17. package/lowcode/backend-manager/splitPage.js +0 -39
  18. package/lowcode/backend-manager/splitPage.ts +0 -40
  19. package/lowcode/cms-plugin/auto-fcm-advertise.js +17 -5
  20. package/lowcode/cms-plugin/auto-fcm-advertise.ts +19 -6
  21. package/lowcode/cms-plugin/auto-fcm-history.js +2732 -0
  22. package/lowcode/cms-plugin/auto-fcm-history.ts +2995 -0
  23. package/lowcode/cms-plugin/cms-router.js +5 -0
  24. package/lowcode/cms-plugin/cms-router.ts +6 -0
  25. package/lowcode/cms-plugin/filter-options.js +80 -27
  26. package/lowcode/cms-plugin/filter-options.ts +83 -27
  27. package/lowcode/cms-plugin/language-backend.js +50 -39
  28. package/lowcode/cms-plugin/language-backend.ts +109 -95
  29. package/lowcode/cms-plugin/menus-setting.js +175 -151
  30. package/lowcode/cms-plugin/menus-setting.ts +620 -591
  31. package/lowcode/cms-plugin/model/order.d.ts +1 -0
  32. package/lowcode/cms-plugin/module/data.js +7 -7
  33. package/lowcode/cms-plugin/module/data.ts +262 -233
  34. package/lowcode/cms-plugin/module/delivery-html.js +18 -10
  35. package/lowcode/cms-plugin/module/delivery-html.ts +26 -10
  36. package/lowcode/cms-plugin/module/order-setting.js +458 -328
  37. package/lowcode/cms-plugin/module/order-setting.ts +622 -351
  38. package/lowcode/cms-plugin/module/product-excel.js +1 -1
  39. package/lowcode/cms-plugin/module/product-excel.ts +2 -1
  40. package/lowcode/cms-plugin/order/order-module.js +90 -1
  41. package/lowcode/cms-plugin/order/order-module.ts +106 -1
  42. package/lowcode/cms-plugin/pos-pages/payment-page.js +11 -8
  43. package/lowcode/cms-plugin/pos-pages/payment-page.ts +28 -15
  44. package/lowcode/cms-plugin/pos-pages/products-page.js +0 -39
  45. package/lowcode/cms-plugin/pos-pages/products-page.ts +0 -40
  46. package/lowcode/cms-plugin/shopping-collections.ts +1 -3
  47. package/lowcode/cms-plugin/shopping-finance-setting.js +19 -80
  48. package/lowcode/cms-plugin/shopping-finance-setting.ts +19 -87
  49. package/lowcode/cms-plugin/shopping-order-manager.js +122 -38
  50. package/lowcode/cms-plugin/shopping-order-manager.ts +160 -58
  51. package/lowcode/cms-plugin/shopping-product-setting.js +364 -376
  52. package/lowcode/cms-plugin/shopping-product-setting.ts +406 -415
  53. package/lowcode/cms-plugin/shopping-setting-advance.js +57 -16
  54. package/lowcode/cms-plugin/shopping-setting-advance.ts +69 -18
  55. package/lowcode/cms-plugin/user/user-module.js +2 -43
  56. package/lowcode/cms-plugin/user/user-module.ts +2 -46
  57. package/lowcode/cms-plugin/user-list.js +4 -6
  58. package/lowcode/cms-plugin/user-list.ts +35 -38
  59. package/lowcode/css/editor.css +42 -3
  60. package/lowcode/glitter-base/global/language.js +6 -1
  61. package/lowcode/glitter-base/global/language.ts +10 -4
  62. package/lowcode/glitter-base/global/payment-config.js +19 -16
  63. package/lowcode/glitter-base/global/payment-config.ts +22 -16
  64. package/lowcode/glitter-base/global/shipment-config.js +6 -5
  65. package/lowcode/glitter-base/global/shipment-config.ts +12 -10
  66. package/lowcode/glitter-base/route/fcm.js +21 -1
  67. package/lowcode/glitter-base/route/fcm.ts +22 -2
  68. package/lowcode/glitter-base/route/shopping.js +8 -32
  69. package/lowcode/glitter-base/route/shopping.ts +10 -33
  70. package/lowcode/glitter-base/route/user.js +11 -2
  71. package/lowcode/glitter-base/route/user.ts +23 -12
  72. package/lowcode/jspage/function-page/setting_editor.js +9 -0
  73. package/lowcode/jspage/function-page/setting_editor.ts +9 -0
  74. package/lowcode/public-components/blogs/list.js +223 -195
  75. package/lowcode/public-components/blogs/list.ts +383 -352
  76. package/lowcode/public-components/product/product-list.js +8 -4
  77. package/lowcode/public-components/product/product-list.ts +9 -4
  78. package/lowcode/public-components/terms-related/index.js +1 -1
  79. package/lowcode/public-components/terms-related/index.ts +1 -1
  80. package/lowcode/public-components/user-manager/um-login.js +1 -1
  81. package/lowcode/public-components/user-manager/um-login.ts +2 -2
  82. package/lowcode/public-components/user-manager/um-order.js +41 -5
  83. package/lowcode/public-components/user-manager/um-order.ts +58 -20
  84. package/lowcode/public-components/user-manager/um-voucher.ts +2 -2
  85. package/nhi4veq3gk.json +1 -0
  86. package/package.json +1 -1
  87. package/src/Language.d.ts +2 -0
  88. package/src/Language.js +66 -65
  89. package/src/Language.js.map +1 -1
  90. package/src/Language.ts +719 -715
  91. package/src/api-public/config/shipment-config.js +3 -2
  92. package/src/api-public/config/shipment-config.js.map +1 -1
  93. package/src/api-public/config/shipment-config.ts +3 -2
  94. package/src/api-public/controllers/ai-chat.js.map +1 -1
  95. package/src/api-public/controllers/ai-chat.ts +1 -2
  96. package/src/api-public/controllers/fcm.js +23 -58
  97. package/src/api-public/controllers/fcm.js.map +1 -1
  98. package/src/api-public/controllers/fcm.ts +28 -56
  99. package/src/api-public/controllers/shop.js +7 -1
  100. package/src/api-public/controllers/shop.js.map +1 -1
  101. package/src/api-public/controllers/shop.ts +17 -10
  102. package/src/api-public/controllers/user.js +1 -0
  103. package/src/api-public/controllers/user.js.map +1 -1
  104. package/src/api-public/controllers/user.ts +2 -0
  105. package/src/api-public/services/auto-send-email.js +247 -187
  106. package/src/api-public/services/auto-send-email.js.map +1 -1
  107. package/src/api-public/services/auto-send-email.ts +568 -505
  108. package/src/api-public/services/delivery.js +1 -1
  109. package/src/api-public/services/delivery.js.map +1 -1
  110. package/src/api-public/services/delivery.ts +6 -5
  111. package/src/api-public/services/financial-service.js +1 -2
  112. package/src/api-public/services/financial-service.js.map +1 -1
  113. package/src/api-public/services/financial-service.ts +4 -6
  114. package/src/api-public/services/manager.d.ts +4 -3
  115. package/src/api-public/services/manager.js +8 -12
  116. package/src/api-public/services/manager.js.map +1 -1
  117. package/src/api-public/services/manager.ts +57 -59
  118. package/src/api-public/services/model/handlePaymentTransaction.d.ts +1 -1
  119. package/src/api-public/services/model/handlePaymentTransaction.js +23 -3
  120. package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
  121. package/src/api-public/services/model/handlePaymentTransaction.ts +25 -36
  122. package/src/api-public/services/schedule.d.ts +1 -0
  123. package/src/api-public/services/schedule.js +27 -0
  124. package/src/api-public/services/schedule.js.map +1 -1
  125. package/src/api-public/services/schedule.ts +30 -0
  126. package/src/api-public/services/shopping.d.ts +22 -2
  127. package/src/api-public/services/shopping.js +362 -90
  128. package/src/api-public/services/shopping.js.map +1 -1
  129. package/src/api-public/services/shopping.ts +481 -134
  130. package/src/api-public/services/user.d.ts +1 -0
  131. package/src/api-public/services/user.js +36 -16
  132. package/src/api-public/services/user.js.map +1 -1
  133. package/src/api-public/services/user.ts +42 -23
  134. package/src/api-public/services/workers.js +3 -3
  135. package/src/api-public/services/workers.js.map +1 -1
  136. package/src/api-public/services/workers.ts +103 -103
  137. package/src/app-project/serverless/src/modules/database.js +1 -1
  138. package/src/app-project/serverless/src/modules/database.js.map +1 -1
  139. package/src/app-project/serverless/src/modules/database.ts +171 -171
  140. package/src/controllers/template.d.ts +1 -1
  141. package/src/controllers/template.js +16 -16
  142. package/src/controllers/template.js.map +1 -1
  143. package/src/controllers/template.ts +98 -84
  144. package/src/modules/database.js +3 -1
  145. package/src/modules/database.js.map +1 -1
  146. package/src/modules/database.ts +185 -181
  147. package/src/modules/firebase.d.ts +17 -0
  148. package/src/modules/firebase.js +126 -0
  149. package/src/modules/firebase.js.map +1 -1
  150. package/src/modules/firebase.ts +169 -0
  151. package/src/public-config-initial/auto-fcm.js +8 -2
  152. package/src/public-config-initial/auto-fcm.js.map +1 -1
  153. package/src/public-config-initial/auto-fcm.ts +15 -6
  154. package/src/services/app.d.ts +2 -1
  155. package/src/services/app.js.map +1 -1
  156. package/src/services/app.ts +2 -1
  157. package/src/services/template.d.ts +3 -2
  158. package/src/services/template.js +2 -1
  159. package/src/services/template.js.map +1 -1
  160. package/src/services/template.ts +13 -20
@@ -795,6 +795,7 @@ export class BgLine {
795
795
  ApiUser.getUserList({
796
796
  page: 0,
797
797
  limit: 99999,
798
+ only_id: true
798
799
  }).then(dd => {
799
800
  dd.response.data.map((user) => {
800
801
  if (user.userData.lineID) {
@@ -1140,9 +1141,10 @@ export class BgLine {
1140
1141
  text: '取得所有會員資料中...',
1141
1142
  });
1142
1143
  new Promise(resolve => {
1143
- ApiUser.getUserListOrders({
1144
+ ApiUser.getUserList({
1144
1145
  page: 0,
1145
1146
  limit: 99999,
1147
+ only_id: true
1146
1148
  }).then(dd => {
1147
1149
  if (dd.response.data) {
1148
1150
  const ids = [];
@@ -1190,11 +1192,10 @@ export class BgLine {
1190
1192
  default: getDefault([]),
1191
1193
  api: (data) => {
1192
1194
  return new Promise(resolve => {
1193
- ApiUser.getUserListOrders({
1195
+ ApiUser.getUserList({
1194
1196
  page: 0,
1195
1197
  limit: 99999,
1196
- search: data.query,
1197
- orderString: data.orderString,
1198
+ search: data.query, only_id: true,
1198
1199
  }).then(dd => {
1199
1200
  if (dd.response.data) {
1200
1201
  vm.dataList = dd.response.data
@@ -900,6 +900,7 @@ export class BgLine {
900
900
  ApiUser.getUserList({
901
901
  page: 0,
902
902
  limit: 99999,
903
+ only_id:true
903
904
  }).then(dd => {
904
905
  dd.response.data.map((user: any) => {
905
906
  if (user.userData.lineID) {
@@ -1268,9 +1269,10 @@ export class BgLine {
1268
1269
  text: '取得所有會員資料中...',
1269
1270
  });
1270
1271
  new Promise(resolve => {
1271
- ApiUser.getUserListOrders({
1272
+ ApiUser.getUserList({
1272
1273
  page: 0,
1273
1274
  limit: 99999,
1275
+ only_id:true
1274
1276
  }).then(dd => {
1275
1277
  if (dd.response.data) {
1276
1278
  const ids: number[] = [];
@@ -1334,11 +1336,10 @@ export class BgLine {
1334
1336
  default: getDefault([]),
1335
1337
  api: (data: { query: string; orderString: string }) => {
1336
1338
  return new Promise(resolve => {
1337
- ApiUser.getUserListOrders({
1339
+ ApiUser.getUserList({
1338
1340
  page: 0,
1339
1341
  limit: 99999,
1340
- search: data.query,
1341
- orderString: data.orderString,
1342
+ search: data.query, only_id:true,
1342
1343
  }).then(dd => {
1343
1344
  if (dd.response.data) {
1344
1345
  vm.dataList = dd.response.data
@@ -59,6 +59,7 @@ export class BgListComponent {
59
59
  : '';
60
60
  break;
61
61
  case 'multi_checkbox':
62
+ case 'search_and_select':
62
63
  h +=
63
64
  data.length > 0
64
65
  ? this.tagBadge(item.key, item.name, item.data
@@ -128,6 +129,14 @@ export class BgListComponent {
128
129
  })
129
130
  : '';
130
131
  break;
132
+ case 'search_and_select':
133
+ contentHTML +=
134
+ item.data.length > 0
135
+ ? BgWidget.searchSelectContainer(gvc, '選擇標籤', item.data, this.vm.filter[item.key], value => {
136
+ this.vm.filter[item.key] = value;
137
+ })
138
+ : '';
139
+ break;
131
140
  }
132
141
  return contentHTML.length > 0
133
142
  ? html `<!-- Item -->
@@ -78,6 +78,7 @@ export class BgListComponent {
78
78
  : '';
79
79
  break;
80
80
  case 'multi_checkbox':
81
+ case 'search_and_select':
81
82
  h +=
82
83
  data.length > 0
83
84
  ? this.tagBadge(
@@ -144,7 +145,6 @@ export class BgListComponent {
144
145
  this.vm.filter[item.key] = value;
145
146
  })
146
147
  : '';
147
-
148
148
  break;
149
149
  case 'radio_and_input':
150
150
  contentHTML +=
@@ -154,6 +154,20 @@ export class BgListComponent {
154
154
  })
155
155
  : '';
156
156
  break;
157
+ case 'search_and_select':
158
+ contentHTML +=
159
+ item.data.length > 0
160
+ ? BgWidget.searchSelectContainer(
161
+ gvc,
162
+ '選擇標籤',
163
+ item.data,
164
+ this.vm.filter[item.key],
165
+ value => {
166
+ this.vm.filter[item.key] = value;
167
+ }
168
+ )
169
+ : '';
170
+ break;
157
171
  }
158
172
 
159
173
  return contentHTML.length > 0
@@ -854,6 +854,7 @@ export class BgNotify {
854
854
  ApiUser.getUserList({
855
855
  page: 0,
856
856
  limit: 99999,
857
+ only_id: true
857
858
  }).then(dd => {
858
859
  dd.response.data.map((user) => {
859
860
  if (user.userData.email && user.userData.email.length > 0) {
@@ -1184,9 +1185,10 @@ export class BgNotify {
1184
1185
  case 'all':
1185
1186
  dialog.dataLoading({ visible: true, text: '取得所有會員資料中...' });
1186
1187
  new Promise(resolve => {
1187
- ApiUser.getUserListOrders({
1188
+ ApiUser.getUserList({
1188
1189
  page: 0,
1189
1190
  limit: 99999,
1191
+ only_id: true
1190
1192
  }).then(dd => {
1191
1193
  if (dd.response.data) {
1192
1194
  const ids = [];
@@ -1234,11 +1236,11 @@ export class BgNotify {
1234
1236
  default: getDefault([]),
1235
1237
  api: (data) => {
1236
1238
  return new Promise(resolve => {
1237
- ApiUser.getUserListOrders({
1239
+ ApiUser.getUserList({
1238
1240
  page: 0,
1239
1241
  limit: 99999,
1240
- search: data.query,
1241
- orderString: data.orderString,
1242
+ only_id: true,
1243
+ search: data.query
1242
1244
  }).then(dd => {
1243
1245
  if (dd.response.data) {
1244
1246
  vm.dataList = dd.response.data
@@ -957,6 +957,7 @@ export class BgNotify {
957
957
  ApiUser.getUserList({
958
958
  page: 0,
959
959
  limit: 99999,
960
+ only_id:true
960
961
  }).then(dd => {
961
962
  dd.response.data.map((user: any) => {
962
963
  if (user.userData.email && user.userData.email.length > 0) {
@@ -1304,9 +1305,10 @@ export class BgNotify {
1304
1305
  case 'all':
1305
1306
  dialog.dataLoading({ visible: true, text: '取得所有會員資料中...' });
1306
1307
  new Promise(resolve => {
1307
- ApiUser.getUserListOrders({
1308
+ ApiUser.getUserList({
1308
1309
  page: 0,
1309
1310
  limit: 99999,
1311
+ only_id:true
1310
1312
  }).then(dd => {
1311
1313
  if (dd.response.data) {
1312
1314
  const ids: number[] = [];
@@ -1355,11 +1357,11 @@ export class BgNotify {
1355
1357
  default: getDefault([]),
1356
1358
  api: (data: { query: string; orderString: string }) => {
1357
1359
  return new Promise(resolve => {
1358
- ApiUser.getUserListOrders({
1360
+ ApiUser.getUserList({
1359
1361
  page: 0,
1360
1362
  limit: 99999,
1361
- search: data.query,
1362
- orderString: data.orderString,
1363
+ only_id:true,
1364
+ search: data.query
1363
1365
  }).then(dd => {
1364
1366
  if (dd.response.data) {
1365
1367
  vm.dataList = dd.response.data
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { BgWidget } from './bg-widget.js';
2
11
  import { ApiUser } from '../glitter-base/route/user.js';
3
12
  import { ApiShop } from '../glitter-base/route/shopping.js';
@@ -674,6 +683,142 @@ export class BgProduct {
674
683
  });
675
684
  }, 'setUserTagPriceSetting');
676
685
  }
686
+ static useProductTags(obj) {
687
+ const gvc = obj.gvc;
688
+ const vmt = {
689
+ id: gvc.glitter.getUUID(),
690
+ loading: true,
691
+ search: '',
692
+ dataList: [],
693
+ postData: obj.def,
694
+ };
695
+ return BgWidget.settingDialog({
696
+ gvc,
697
+ title: '使用現有標籤',
698
+ innerHTML: gvc2 => {
699
+ return gvc2.bindView({
700
+ bind: vmt.id,
701
+ view: () => {
702
+ if (vmt.loading) {
703
+ return BgWidget.spinner();
704
+ }
705
+ else {
706
+ return [
707
+ BgWidget.searchPlace(gvc2.event(e => {
708
+ vmt.search = e.value;
709
+ vmt.loading = true;
710
+ gvc2.notifyDataChange(vmt.id);
711
+ }), vmt.search, '搜尋標籤', '0', '0'),
712
+ BgWidget.renderOptions(gvc2, vmt),
713
+ ].join(BgWidget.mbContainer(18));
714
+ }
715
+ },
716
+ divCreate: {},
717
+ onCreate: () => {
718
+ if (vmt.loading) {
719
+ ApiUser.getPublicConfig(obj.config_key, 'manager').then((dd) => {
720
+ var _a, _b;
721
+ if (dd.result && ((_b = (_a = dd.response) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.list)) {
722
+ const responseList = obj.config_lang
723
+ ? dd.response.value.list[obj.config_lang]
724
+ : dd.response.value.list;
725
+ const list = [...new Set([...responseList, ...obj.def])];
726
+ vmt.dataList = list.filter((item) => item.includes(vmt.search));
727
+ }
728
+ vmt.loading = false;
729
+ gvc2.notifyDataChange(vmt.id);
730
+ });
731
+ }
732
+ },
733
+ });
734
+ },
735
+ footer_html: gvc2 => {
736
+ return [
737
+ html `<div
738
+ style="color: #393939; text-decoration-line: underline; cursor: pointer"
739
+ onclick="${gvc2.event(() => {
740
+ vmt.postData = [];
741
+ vmt.loading = true;
742
+ gvc2.notifyDataChange(vmt.id);
743
+ })}"
744
+ >
745
+ 清除全部
746
+ </div>`,
747
+ BgWidget.cancel(gvc2.event(() => {
748
+ gvc2.closeDialog();
749
+ })),
750
+ BgWidget.save(gvc2.event(() => {
751
+ obj.callback(vmt.postData);
752
+ gvc2.closeDialog();
753
+ })),
754
+ ].join('');
755
+ },
756
+ });
757
+ }
758
+ static getProductGeneralTag() {
759
+ return __awaiter(this, void 0, void 0, function* () {
760
+ return yield ApiUser.getPublicConfig('product_general_tags', 'manager').then((dd) => {
761
+ var _a, _b, _c, _d, _e, _f;
762
+ if (dd.result && ((_b = (_a = dd.response) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.list)) {
763
+ const defaultLanguage = (_f = (_e = (_d = (_c = window.parent) === null || _c === void 0 ? void 0 : _c.store_info) === null || _d === void 0 ? void 0 : _d.language_setting) === null || _e === void 0 ? void 0 : _e.def) !== null && _f !== void 0 ? _f : 'zh-TW';
764
+ const result = [];
765
+ for (const [lang, tags] of Object.entries(dd.response.value.list)) {
766
+ tags.forEach(tag => {
767
+ result.push({
768
+ lang: lang,
769
+ tag,
770
+ });
771
+ });
772
+ }
773
+ return result
774
+ .filter(item => item.lang === defaultLanguage)
775
+ .map(item => {
776
+ return {
777
+ key: item.tag,
778
+ name: `#${item.tag}`,
779
+ };
780
+ });
781
+ }
782
+ return [];
783
+ });
784
+ });
785
+ }
786
+ static getProductManagerTag() {
787
+ return __awaiter(this, void 0, void 0, function* () {
788
+ return yield ApiUser.getPublicConfig('product_manager_tags', 'manager').then((dd) => {
789
+ var _a, _b;
790
+ if (dd.result && ((_b = (_a = dd.response) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.list)) {
791
+ return dd.response.value.list.map((item) => {
792
+ return {
793
+ key: item,
794
+ name: `#${item}`,
795
+ };
796
+ });
797
+ }
798
+ return [];
799
+ });
800
+ });
801
+ }
802
+ static getCollectonCheckData() {
803
+ return __awaiter(this, void 0, void 0, function* () {
804
+ return yield new Promise((resolve, reject) => {
805
+ try {
806
+ let collections = [];
807
+ this.getCollectionAllOpts(collections, () => {
808
+ resolve(collections.map(item => {
809
+ return {
810
+ key: `${item.key}`,
811
+ name: item.value,
812
+ };
813
+ }));
814
+ });
815
+ }
816
+ catch (error) {
817
+ console.log(error);
818
+ }
819
+ });
820
+ });
821
+ }
677
822
  }
678
823
  BgProduct.getProductOpts = (def, productType) => {
679
824
  return new Promise(resolve => {
@@ -2,6 +2,7 @@ import { GVC } from '../glitterBundle/GVController.js';
2
2
  import { BgWidget } from './bg-widget.js';
3
3
  import { ApiUser } from '../glitter-base/route/user.js';
4
4
  import { ApiShop } from '../glitter-base/route/shopping.js';
5
+ import { LanguageLocation } from '../glitter-base/global/language.js';
5
6
  import { FilterOptions } from '../cms-plugin/filter-options.js';
6
7
  import { StockList } from '../cms-plugin/shopping-product-stock.js';
7
8
  import { ProductConfig } from '../cms-plugin/product-config.js';
@@ -879,4 +880,156 @@ export class BgProduct {
879
880
  });
880
881
  }, 'setUserTagPriceSetting');
881
882
  }
883
+
884
+ static useProductTags(obj: {
885
+ gvc: GVC;
886
+ config_key: 'product_manager_tags' | 'product_general_tags';
887
+ config_lang?: LanguageLocation;
888
+ def: string[];
889
+ callback: (dataArray: string[]) => void;
890
+ }) {
891
+ const gvc = obj.gvc;
892
+
893
+ const vmt = {
894
+ id: gvc.glitter.getUUID(),
895
+ loading: true,
896
+ search: '',
897
+ dataList: [] as string[],
898
+ postData: obj.def,
899
+ };
900
+
901
+ return BgWidget.settingDialog({
902
+ gvc,
903
+ title: '使用現有標籤',
904
+ innerHTML: gvc2 => {
905
+ return gvc2.bindView({
906
+ bind: vmt.id,
907
+ view: () => {
908
+ if (vmt.loading) {
909
+ return BgWidget.spinner();
910
+ } else {
911
+ return [
912
+ BgWidget.searchPlace(
913
+ gvc2.event(e => {
914
+ vmt.search = e.value;
915
+ vmt.loading = true;
916
+ gvc2.notifyDataChange(vmt.id);
917
+ }),
918
+ vmt.search,
919
+ '搜尋標籤',
920
+ '0',
921
+ '0'
922
+ ),
923
+ BgWidget.renderOptions(gvc2, vmt),
924
+ ].join(BgWidget.mbContainer(18));
925
+ }
926
+ },
927
+ divCreate: {},
928
+ onCreate: () => {
929
+ if (vmt.loading) {
930
+ ApiUser.getPublicConfig(obj.config_key, 'manager').then((dd: any) => {
931
+ if (dd.result && dd.response?.value?.list) {
932
+ const responseList = obj.config_lang
933
+ ? dd.response.value.list[obj.config_lang]
934
+ : dd.response.value.list;
935
+ const list = [...new Set([...responseList, ...obj.def])];
936
+ vmt.dataList = list.filter((item: string) => item.includes(vmt.search));
937
+ }
938
+ vmt.loading = false;
939
+ gvc2.notifyDataChange(vmt.id);
940
+ });
941
+ }
942
+ },
943
+ });
944
+ },
945
+ footer_html: gvc2 => {
946
+ return [
947
+ html`<div
948
+ style="color: #393939; text-decoration-line: underline; cursor: pointer"
949
+ onclick="${gvc2.event(() => {
950
+ vmt.postData = [];
951
+ vmt.loading = true;
952
+ gvc2.notifyDataChange(vmt.id);
953
+ })}"
954
+ >
955
+ 清除全部
956
+ </div>`,
957
+ BgWidget.cancel(
958
+ gvc2.event(() => {
959
+ gvc2.closeDialog();
960
+ })
961
+ ),
962
+ BgWidget.save(
963
+ gvc2.event(() => {
964
+ obj.callback(vmt.postData);
965
+ gvc2.closeDialog();
966
+ })
967
+ ),
968
+ ].join('');
969
+ },
970
+ });
971
+ }
972
+
973
+ static async getProductGeneralTag() {
974
+ return await ApiUser.getPublicConfig('product_general_tags', 'manager').then((dd: any) => {
975
+ if (dd.result && dd.response?.value?.list) {
976
+ const defaultLanguage = (window.parent as any)?.store_info?.language_setting?.def ?? 'zh-TW';
977
+ const result: { lang: LanguageLocation; tag: string }[] = [];
978
+
979
+ // 遍歷每個語言和標籤
980
+ for (const [lang, tags] of Object.entries(dd.response.value.list)) {
981
+ (tags as string[]).forEach(tag => {
982
+ result.push({
983
+ lang: lang as LanguageLocation,
984
+ tag,
985
+ });
986
+ });
987
+ }
988
+
989
+ return result
990
+ .filter(item => item.lang === defaultLanguage)
991
+ .map(item => {
992
+ return {
993
+ key: item.tag,
994
+ name: `#${item.tag}`,
995
+ };
996
+ });
997
+ }
998
+ return [];
999
+ });
1000
+ }
1001
+
1002
+ static async getProductManagerTag() {
1003
+ return await ApiUser.getPublicConfig('product_manager_tags', 'manager').then((dd: any) => {
1004
+ if (dd.result && dd.response?.value?.list) {
1005
+ return dd.response.value.list.map((item: string) => {
1006
+ return {
1007
+ key: item,
1008
+ name: `#${item}`,
1009
+ };
1010
+ });
1011
+ }
1012
+ return [];
1013
+ });
1014
+ }
1015
+
1016
+ static async getCollectonCheckData() {
1017
+ return await new Promise<{ key: string; name: string }[]>((resolve, reject) => {
1018
+ try {
1019
+ let collections: OptionsItem[] = [];
1020
+ this.getCollectionAllOpts(collections, () => {
1021
+ resolve(
1022
+ collections.map(item => {
1023
+ return {
1024
+ key: `${item.key}`,
1025
+ name: item.value,
1026
+ };
1027
+ })
1028
+ );
1029
+ });
1030
+ } catch (error) {
1031
+ console.log(error);
1032
+ }
1033
+ });
1034
+ }
882
1035
  }
@@ -843,6 +843,7 @@ export class BgSNS {
843
843
  ApiUser.getUserList({
844
844
  page: 0,
845
845
  limit: 99999,
846
+ only_id: true
846
847
  }).then(dd => {
847
848
  dd.response.data.map((user) => {
848
849
  if (user.userData.email && user.userData.email.length > 0 && user.userData.phone) {
@@ -1191,9 +1192,10 @@ export class BgSNS {
1191
1192
  text: '取得所有會員資料中...',
1192
1193
  });
1193
1194
  new Promise(resolve => {
1194
- ApiUser.getUserListOrders({
1195
+ ApiUser.getUserList({
1195
1196
  page: 0,
1196
1197
  limit: 99999,
1198
+ only_id: true
1197
1199
  }).then(dd => {
1198
1200
  if (dd.response.data) {
1199
1201
  const ids = [];
@@ -1241,11 +1243,11 @@ export class BgSNS {
1241
1243
  default: getDefault([]),
1242
1244
  api: (data) => {
1243
1245
  return new Promise(resolve => {
1244
- ApiUser.getUserListOrders({
1246
+ ApiUser.getUserList({
1245
1247
  page: 0,
1246
1248
  limit: 99999,
1249
+ only_id: true,
1247
1250
  search: data.query,
1248
- orderString: data.orderString,
1249
1251
  }).then(dd => {
1250
1252
  if (dd.response.data) {
1251
1253
  vm.dataList = dd.response.data
@@ -946,6 +946,7 @@ export class BgSNS {
946
946
  ApiUser.getUserList({
947
947
  page: 0,
948
948
  limit: 99999,
949
+ only_id:true
949
950
  }).then(dd => {
950
951
  dd.response.data.map((user: any) => {
951
952
  if (user.userData.email && user.userData.email.length > 0 && user.userData.phone) {
@@ -1317,9 +1318,10 @@ export class BgSNS {
1317
1318
  text: '取得所有會員資料中...',
1318
1319
  });
1319
1320
  new Promise(resolve => {
1320
- ApiUser.getUserListOrders({
1321
+ ApiUser.getUserList({
1321
1322
  page: 0,
1322
1323
  limit: 99999,
1324
+ only_id:true
1323
1325
  }).then(dd => {
1324
1326
  if (dd.response.data) {
1325
1327
  const ids: number[] = [];
@@ -1382,11 +1384,11 @@ export class BgSNS {
1382
1384
  default: getDefault([]),
1383
1385
  api: (data: { query: string; orderString: string }) => {
1384
1386
  return new Promise(resolve => {
1385
- ApiUser.getUserListOrders({
1387
+ ApiUser.getUserList({
1386
1388
  page: 0,
1387
1389
  limit: 99999,
1390
+ only_id:true,
1388
1391
  search: data.query,
1389
- orderString: data.orderString,
1390
1392
  }).then(dd => {
1391
1393
  if (dd.response.data) {
1392
1394
  vm.dataList = dd.response.data