ts-glitter 21.7.7 → 21.7.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 (49) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-blog.js +1 -6
  4. package/lowcode/backend-manager/bg-blog.ts +1 -11
  5. package/lowcode/backend-manager/bg-dialog.js +176 -0
  6. package/lowcode/backend-manager/bg-dialog.ts +230 -0
  7. package/lowcode/backend-manager/bg-product.js +1 -3
  8. package/lowcode/backend-manager/bg-product.ts +1 -5
  9. package/lowcode/cms-plugin/module/delivery-html.js +56 -5
  10. package/lowcode/cms-plugin/module/delivery-html.ts +69 -14
  11. package/lowcode/cms-plugin/shopping-discount-setting.js +234 -1468
  12. package/lowcode/cms-plugin/shopping-discount-setting.ts +302 -1732
  13. package/lowcode/jslib/lottie-player.js +143 -39
  14. package/lowcode/public-components/product/pd-card-01.js +1 -1
  15. package/lowcode/public-components/product/pd-card-01.ts +5 -8
  16. package/lowcode/public-components/product/pd-card-02.js +3 -2
  17. package/lowcode/public-components/product/pd-card-02.ts +7 -10
  18. package/lowcode/public-components/product/pd-card-03.js +3 -2
  19. package/lowcode/public-components/product/pd-card-03.ts +7 -9
  20. package/package.json +1 -1
  21. package/src/api-public/services/checkout-event.js +17 -7
  22. package/src/api-public/services/checkout-event.js.map +5 -1
  23. package/src/api-public/services/financial-serviceV2.js +17 -7
  24. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  25. package/src/api-public/services/monitor.d.ts +0 -1
  26. package/src/api-public/services/shopee.js +17 -7
  27. package/src/api-public/services/shopee.js.map +1 -1
  28. package/src/api-public/services/shopping.js +3 -3
  29. package/src/api-public/services/shopping.js.map +1 -1
  30. package/src/api-public/services/shopping.ts +3 -5
  31. package/src/api-public/services/user.js +17 -7
  32. package/src/api-public/services/user.js.map +5 -1
  33. package/src/app-project/serverless/src/index.js +17 -7
  34. package/src/app-project/serverless/src/index.js.map +1 -1
  35. package/src/app-project/serverless/src/modules/CryptoJS.js +17 -7
  36. package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
  37. package/src/app-project/serverless/src/modules/ssh.js +17 -7
  38. package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
  39. package/src/index.js +3 -3
  40. package/src/modules/CryptoJS.js +17 -7
  41. package/src/modules/CryptoJS.js.map +1 -1
  42. package/src/modules/database.d.ts +1 -1
  43. package/src/modules/ssh.js +17 -7
  44. package/src/modules/ssh.js.map +1 -1
  45. package/src/modules/tool.d.ts +4 -4
  46. package/src/modules/tool.js +1 -2
  47. package/src/modules/tool.js.map +1 -1
  48. package/src/services/app.js +17 -7
  49. package/src/services/app.js.map +1 -1
package/lowcode/Entry.js CHANGED
@@ -146,7 +146,7 @@ export class Entry {
146
146
  }
147
147
  window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
148
148
  console.log(`Entry-time:`, window.renderClock.stop());
149
- glitter.share.editerVersion = 'V_21.7.7';
149
+ glitter.share.editerVersion = 'V_21.7.8';
150
150
  glitter.share.start = new Date();
151
151
  const vm = { appConfig: [] };
152
152
  window.saasConfig = {
package/lowcode/Entry.ts CHANGED
@@ -150,7 +150,7 @@ export class Entry {
150
150
  }
151
151
  (window as any).renderClock = (window as any).renderClock ?? createClock();
152
152
  console.log(`Entry-time:`, (window as any).renderClock.stop());
153
- glitter.share.editerVersion = 'V_21.7.7';
153
+ glitter.share.editerVersion = 'V_21.7.8';
154
154
  glitter.share.start = new Date();
155
155
  const vm = { appConfig: [] };
156
156
  (window as any).saasConfig = {
@@ -1507,7 +1507,6 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1507
1507
  containerId: Tool.randomString(6),
1508
1508
  loading: true,
1509
1509
  };
1510
- console.log(`d1---->`, d1);
1511
1510
  return gvc.bindView(() => {
1512
1511
  return {
1513
1512
  bind: subVM.id,
@@ -1554,10 +1553,7 @@ function detail(gvc, cf, vm, cVm, page_tab) {
1554
1553
  },
1555
1554
  })}
1556
1555
  </div>
1557
- <div
1558
- class="${d1.select === 'all' ? `d-none` : ``}"
1559
- style=""
1560
- >
1556
+ <div class="${d1.select === 'all' ? `d-none` : ``}">
1561
1557
  ${BgWidget.save(gvc.event(() => {
1562
1558
  var _a, _b;
1563
1559
  if (d1.select === 'product') {
@@ -2347,7 +2343,6 @@ function loopFindProducts(config) {
2347
2343
  function loop(array, container_cf) {
2348
2344
  array.map((dd) => {
2349
2345
  if (dd.type === 'component' && dd.data.tag === 'SY00-normal-products') {
2350
- console.log(`loopFindProducts`, dd.data);
2351
2346
  product_select.push(dd.data.refer_form_data.product_select);
2352
2347
  }
2353
2348
  else if (dd.type === 'container') {
@@ -1699,7 +1699,6 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1699
1699
  containerId: Tool.randomString(6),
1700
1700
  loading: true,
1701
1701
  };
1702
- console.log(`d1---->`, d1);
1703
1702
  return gvc.bindView(() => {
1704
1703
  return {
1705
1704
  bind: subVM.id,
@@ -1707,7 +1706,6 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1707
1706
  if (subVM.loading) {
1708
1707
  return BgWidget.spinner();
1709
1708
  }
1710
- // d1=d1.
1711
1709
  return new Promise(async resolve => {
1712
1710
  subVM.dataList = await (async () => {
1713
1711
  try {
@@ -1747,10 +1745,7 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
1747
1745
  },
1748
1746
  })}
1749
1747
  </div>
1750
- <div
1751
- class="${d1.select === 'all' ? `d-none` : ``}"
1752
- style=""
1753
- >
1748
+ <div class="${d1.select === 'all' ? `d-none` : ``}">
1754
1749
  ${BgWidget.save(
1755
1750
  gvc.event(() => {
1756
1751
  if (d1.select === 'product') {
@@ -2609,11 +2604,6 @@ function loopFindProducts(config: any) {
2609
2604
  function loop(array: any, container_cf: any) {
2610
2605
  array.map((dd: any) => {
2611
2606
  if (dd.type === 'component' && dd.data.tag === 'SY00-normal-products') {
2612
- // if (dd.data.refer_form_data.product_select.select !== 'product') {
2613
- // dd.data.refer_form_data.product_select.select = 'product';
2614
- // dd.data.refer_form_data.product_select.value = [];
2615
- // }
2616
- console.log(`loopFindProducts`, dd.data);
2617
2607
  product_select.push(dd.data.refer_form_data.product_select);
2618
2608
  } else if (dd.type === 'container') {
2619
2609
  loop(dd.data.setting, dd);
@@ -0,0 +1,176 @@
1
+ import { Tool } from '../modules/tool.js';
2
+ import { Animation } from '../glitterBundle/module/Animation.js';
3
+ const html = String.raw;
4
+ const css = String.raw;
5
+ export class BgDialog {
6
+ constructor(gvc) {
7
+ this.gvc = gvc;
8
+ this.glitter = gvc.glitter;
9
+ this.isMobile = window.innerWidth <= 768;
10
+ this.prefix = Tool.randomString(6);
11
+ this.init();
12
+ }
13
+ init() {
14
+ this.gvc.addStyle(css `
15
+ .${this.prefix}_body {
16
+ border-radius: 10px;
17
+ background: #fff;
18
+ overflow-y: auto;
19
+ min-width: calc(100vw - 180px);
20
+ max-width: calc(100vw - 20px);
21
+ }
22
+
23
+ .${this.prefix}_header {
24
+ width: 100%;
25
+ display: flex;
26
+ align-items: center;
27
+ background: #f2f2f2;
28
+ padding: 12px 20px;
29
+ }
30
+
31
+ .${this.prefix}_btn {
32
+ display: flex;
33
+ padding: 3.25px 18px;
34
+ align-items: center;
35
+ gap: 8px;
36
+ border-radius: 10px;
37
+ }
38
+
39
+ .${this.prefix}_save {
40
+ background: #393939;
41
+ }
42
+
43
+ .${this.prefix}_cancel {
44
+ background: #fff;
45
+ border: 1px solid #ddd;
46
+ }
47
+
48
+ .${this.prefix}_footer {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: space-between;
52
+ padding: 8px 20px 20px 20px;
53
+ }
54
+
55
+ .${this.prefix}_footer_left {
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: start;
59
+ }
60
+
61
+ .${this.prefix}_footer_right {
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: end;
65
+ gap: 14px;
66
+ }
67
+ `);
68
+ }
69
+ static select(obj) {
70
+ return html ` <select
71
+ class="c_select c_select_w_100"
72
+ onchange="${obj.gvc.event(e => {
73
+ return obj.callback(e.value);
74
+ })}"
75
+ >
76
+ ${obj.options
77
+ .map(opt => {
78
+ return html ` <option class="c_select_option" value="${opt.key}" ${obj.default === opt.key ? 'selected' : ''}>
79
+ ${opt.value}
80
+ </option>`;
81
+ })
82
+ .join('')}
83
+ ${obj.options.find(opt => obj.default === opt.key)
84
+ ? ''
85
+ : html `<option class="d-none" selected>請選擇項目</option>`}
86
+ </select>`;
87
+ }
88
+ save(event, text = '完成') {
89
+ return html ` <button class="btn ${this.prefix}_btn ${this.prefix}_save" type="button" onclick="${event}">
90
+ <span class="tx_700_white">${text}</span>
91
+ </button>`;
92
+ }
93
+ cancal(event, text = '取消') {
94
+ return html ` <button class="btn ${this.prefix}_btn ${this.prefix}_cancel" type="button" onclick="${event}">
95
+ <span class="tx_700">${text}</span>
96
+ </button>`;
97
+ }
98
+ viewAllSelect(event, text = '檢視已選取項目') {
99
+ return html `<span
100
+ style="color: #4D86DB; font-size: 16px; font-weight: 400; cursor:pointer; overflow-wrap: break-word;"
101
+ onclick="${event}"
102
+ >${text}</span
103
+ >`;
104
+ }
105
+ clearAll(event, text = '清除全部') {
106
+ return html `<span style="margin-right: 8px; font-size: 16px; text-decoration: underline;" onclick="${event}"
107
+ >${text}</span
108
+ >`;
109
+ }
110
+ marketShop() {
111
+ const gvc = this.gvc;
112
+ const glitter = this.glitter;
113
+ const marketOptions = [
114
+ { key: 'hidden', value: '隱形賣場' },
115
+ { key: 'onepage', value: '一頁商店' },
116
+ { key: 'group', value: '拼團賣場' },
117
+ { key: 'recommend', value: '分銷連結' },
118
+ ];
119
+ return glitter.innerDialog((gvc) => {
120
+ const vm = {
121
+ id: gvc.glitter.getUUID(),
122
+ loading: false,
123
+ };
124
+ return html ` <div class="${this.prefix}_body">
125
+ ${gvc.bindView({
126
+ bind: vm.id,
127
+ view: () => {
128
+ if (vm.loading) {
129
+ return 'Loading';
130
+ }
131
+ return html ` <div class="${this.prefix}_header">
132
+ <div class="tx_700">產品列表</div>
133
+ <div class="flex-fill"></div>
134
+ </div>
135
+ <div class="c_dialog">
136
+ <div class="c_dialog_body">
137
+ <div class="c_dialog_main" style="height: auto; max-height: 500px; gap: 24px;">
138
+ ${BgDialog.select({
139
+ gvc,
140
+ default: marketOptions[0].key,
141
+ options: marketOptions,
142
+ callback: value => {
143
+ console.log(value);
144
+ },
145
+ })}
146
+ </div>
147
+ <div class="${this.prefix}_footer">
148
+ <div class="${this.prefix}_footer_left">
149
+ ${this.viewAllSelect(gvc.event(() => {
150
+ console.log('viewAllSelect');
151
+ }), '檢視已選商品(12)')}
152
+ </div>
153
+ <div class="${this.prefix}_footer_right">
154
+ ${[
155
+ this.clearAll(gvc.event(() => {
156
+ console.log('clearAll');
157
+ })),
158
+ this.cancal(gvc.event(() => {
159
+ console.log('cancal');
160
+ })),
161
+ this.save(gvc.event(() => {
162
+ console.log('save');
163
+ })),
164
+ ].join('')}
165
+ </div>
166
+ </div>
167
+ </div>
168
+ </div>`;
169
+ },
170
+ })}
171
+ </div>`;
172
+ }, gvc.glitter.getUUID(), {
173
+ animation: Animation.fade,
174
+ });
175
+ }
176
+ }
@@ -0,0 +1,230 @@
1
+ import { GVC } from '../glitterBundle/GVController.js';
2
+ import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
3
+ import { PageSplit } from './splitPage.js';
4
+ import { Tool } from '../modules/tool.js';
5
+ import { ApiShop } from '../glitter-base/route/shopping.js';
6
+ import { Article } from '../glitter-base/route/article.js';
7
+ import { ApiUser } from '../glitter-base/route/user.js';
8
+ import { ApiStock } from '../glitter-base/route/stock.js';
9
+ import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
10
+ import { Language, LanguageLocation } from '../glitter-base/global/language.js';
11
+ import { FormModule } from '../cms-plugin/module/form-module.js';
12
+ import { FormCheck } from '../cms-plugin/module/form-check.js';
13
+ import { TableStorage } from '../cms-plugin/module/table-storage.js';
14
+ import { ProductAi } from '../cms-plugin/ai-generator/product-ai.js';
15
+ import { imageLibrary } from '../modules/image-library.js';
16
+ import { Animation } from '../glitterBundle/module/Animation.js';
17
+
18
+ const html = String.raw;
19
+ const css = String.raw;
20
+
21
+ export interface Option {
22
+ key: string;
23
+ value: string;
24
+ note?: string;
25
+ image?: string;
26
+ icon?: string;
27
+ }
28
+
29
+ export class BgDialog {
30
+ gvc: GVC;
31
+ glitter: any;
32
+ isMobile: Boolean;
33
+ prefix: string;
34
+
35
+ constructor(gvc: GVC) {
36
+ this.gvc = gvc;
37
+ this.glitter = gvc.glitter;
38
+ this.isMobile = window.innerWidth <= 768;
39
+ this.prefix = Tool.randomString(6);
40
+
41
+ this.init();
42
+ }
43
+
44
+ private init() {
45
+ this.gvc.addStyle(css`
46
+ .${this.prefix}_body {
47
+ border-radius: 10px;
48
+ background: #fff;
49
+ overflow-y: auto;
50
+ min-width: calc(100vw - 180px);
51
+ max-width: calc(100vw - 20px);
52
+ }
53
+
54
+ .${this.prefix}_header {
55
+ width: 100%;
56
+ display: flex;
57
+ align-items: center;
58
+ background: #f2f2f2;
59
+ padding: 12px 20px;
60
+ }
61
+
62
+ .${this.prefix}_btn {
63
+ display: flex;
64
+ padding: 3.25px 18px;
65
+ align-items: center;
66
+ gap: 8px;
67
+ border-radius: 10px;
68
+ }
69
+
70
+ .${this.prefix}_save {
71
+ background: #393939;
72
+ }
73
+
74
+ .${this.prefix}_cancel {
75
+ background: #fff;
76
+ border: 1px solid #ddd;
77
+ }
78
+
79
+ .${this.prefix}_footer {
80
+ display: flex;
81
+ align-items: center;
82
+ justify-content: space-between;
83
+ padding: 8px 20px 20px 20px;
84
+ }
85
+
86
+ .${this.prefix}_footer_left {
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: start;
90
+ }
91
+
92
+ .${this.prefix}_footer_right {
93
+ display: flex;
94
+ align-items: center;
95
+ justify-content: end;
96
+ gap: 14px;
97
+ }
98
+ `);
99
+ }
100
+
101
+ static select(obj: { gvc: GVC; default: string; options: Option[]; callback: (value: string) => void }) {
102
+ return html` <select
103
+ class="c_select c_select_w_100"
104
+ onchange="${obj.gvc.event(e => {
105
+ return obj.callback(e.value);
106
+ })}"
107
+ >
108
+ ${obj.options
109
+ .map(opt => {
110
+ return html` <option class="c_select_option" value="${opt.key}" ${obj.default === opt.key ? 'selected' : ''}>
111
+ ${opt.value}
112
+ </option>`;
113
+ })
114
+ .join('')}
115
+ ${obj.options.find(opt => obj.default === opt.key)
116
+ ? ''
117
+ : html`<option class="d-none" selected>請選擇項目</option>`}
118
+ </select>`;
119
+ }
120
+
121
+ save(event: string, text: string = '完成'): string {
122
+ return html` <button class="btn ${this.prefix}_btn ${this.prefix}_save" type="button" onclick="${event}">
123
+ <span class="tx_700_white">${text}</span>
124
+ </button>`;
125
+ }
126
+
127
+ cancal(event: string, text: string = '取消'): string {
128
+ return html` <button class="btn ${this.prefix}_btn ${this.prefix}_cancel" type="button" onclick="${event}">
129
+ <span class="tx_700">${text}</span>
130
+ </button>`;
131
+ }
132
+
133
+ viewAllSelect(event: string, text: string = '檢視已選取項目'): string {
134
+ return html`<span
135
+ style="color: #4D86DB; font-size: 16px; font-weight: 400; cursor:pointer; overflow-wrap: break-word;"
136
+ onclick="${event}"
137
+ >${text}</span
138
+ >`;
139
+ }
140
+
141
+ clearAll(event: string, text: string = '清除全部'): string {
142
+ return html`<span style="margin-right: 8px; font-size: 16px; text-decoration: underline;" onclick="${event}"
143
+ >${text}</span
144
+ >`;
145
+ }
146
+
147
+ marketShop() {
148
+ const gvc = this.gvc;
149
+ const glitter = this.glitter;
150
+
151
+ const marketOptions = [
152
+ { key: 'hidden', value: '隱形賣場' },
153
+ { key: 'onepage', value: '一頁商店' },
154
+ { key: 'group', value: '拼團賣場' },
155
+ { key: 'recommend', value: '分銷連結' },
156
+ ];
157
+
158
+ return glitter.innerDialog(
159
+ (gvc: GVC) => {
160
+ const vm = {
161
+ id: gvc.glitter.getUUID(),
162
+ loading: false,
163
+ };
164
+
165
+ return html` <div class="${this.prefix}_body">
166
+ ${gvc.bindView({
167
+ bind: vm.id,
168
+ view: () => {
169
+ if (vm.loading) {
170
+ return 'Loading';
171
+ }
172
+
173
+ return html` <div class="${this.prefix}_header">
174
+ <div class="tx_700">產品列表</div>
175
+ <div class="flex-fill"></div>
176
+ </div>
177
+ <div class="c_dialog">
178
+ <div class="c_dialog_body">
179
+ <div class="c_dialog_main" style="height: auto; max-height: 500px; gap: 24px;">
180
+ ${BgDialog.select({
181
+ gvc,
182
+ default: marketOptions[0].key,
183
+ options: marketOptions,
184
+ callback: value => {
185
+ console.log(value);
186
+ },
187
+ })}
188
+ </div>
189
+ <div class="${this.prefix}_footer">
190
+ <div class="${this.prefix}_footer_left">
191
+ ${this.viewAllSelect(
192
+ gvc.event(() => {
193
+ console.log('viewAllSelect');
194
+ }),
195
+ '檢視已選商品(12)'
196
+ )}
197
+ </div>
198
+ <div class="${this.prefix}_footer_right">
199
+ ${[
200
+ this.clearAll(
201
+ gvc.event(() => {
202
+ console.log('clearAll');
203
+ })
204
+ ),
205
+ this.cancal(
206
+ gvc.event(() => {
207
+ console.log('cancal');
208
+ })
209
+ ),
210
+ this.save(
211
+ gvc.event(() => {
212
+ console.log('save');
213
+ })
214
+ ),
215
+ ].join('')}
216
+ </div>
217
+ </div>
218
+ </div>
219
+ </div>`;
220
+ },
221
+ })}
222
+ </div>`;
223
+ },
224
+ gvc.glitter.getUUID(),
225
+ {
226
+ animation: Animation.fade,
227
+ }
228
+ );
229
+ }
230
+ }
@@ -304,9 +304,7 @@ export class BgProduct {
304
304
  gvc.closeDialog();
305
305
  }))}
306
306
  ${BgWidget.save(gvc.event(() => {
307
- obj.callback(obj.default.filter(item => {
308
- return vm.options.find((opt) => opt.key === item);
309
- }));
307
+ obj.callback(obj.default);
310
308
  gvc.closeDialog();
311
309
  }), '確認')}
312
310
  </div>
@@ -380,11 +380,7 @@ export class BgProduct {
380
380
  )}
381
381
  ${BgWidget.save(
382
382
  gvc.event(() => {
383
- obj.callback(
384
- obj.default.filter(item => {
385
- return vm.options.find((opt: OptionsItem) => opt.key === item);
386
- })
387
- );
383
+ obj.callback(obj.default);
388
384
  gvc.closeDialog();
389
385
  }),
390
386
  '確認'
@@ -1,8 +1,18 @@
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 { Tool } from '../../modules/tool.js';
2
11
  import { BgWidget } from '../../backend-manager/bg-widget.js';
3
12
  import { ApiUser } from '../../glitter-base/route/user.js';
4
13
  import { ShipmentConfig } from '../../glitter-base/global/shipment-config.js';
5
14
  import { PaymentConfig } from '../../glitter-base/global/payment-config.js';
15
+ import { OrderExcel } from './order-excel.js';
6
16
  const html = String.raw;
7
17
  export class DeliveryHTML {
8
18
  static print(ogvc, dataArray, type) {
@@ -61,6 +71,26 @@ export class DeliveryHTML {
61
71
  },
62
72
  onCreate: () => {
63
73
  if (loading) {
74
+ function processInChunks(dataArray) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const chunkSize = 20;
77
+ for (let i = 0; i < dataArray.length; i += chunkSize) {
78
+ const chunk = dataArray.slice(i, i + chunkSize);
79
+ yield Promise.all(chunk.map((data) => __awaiter(this, void 0, void 0, function* () {
80
+ const d = yield OrderExcel.getCustomizeMap(data);
81
+ const temp = {};
82
+ const receiveKeys = [...d.keys()].filter(key => key.includes('收件人資訊'));
83
+ for (const key of receiveKeys) {
84
+ const value = d.get(key);
85
+ if (value && value !== '-') {
86
+ temp[key.split('-')[1].trim()] = value;
87
+ }
88
+ }
89
+ data.custom_receive_info = temp;
90
+ })));
91
+ }
92
+ });
93
+ }
64
94
  Promise.all([
65
95
  fetch(new URL('../../assets/json/twzipcode.json', import.meta.url).href)
66
96
  .then(response => response.text())
@@ -70,11 +100,12 @@ export class DeliveryHTML {
70
100
  }),
71
101
  ShipmentConfig.shipmentMethod({ type: 'all' }),
72
102
  PaymentConfig.getSupportPayment(true),
73
- ]).then(dataArray => {
74
- vm.twZipcode = dataArray[0];
75
- vm.store = dataArray[1];
76
- vm.shippingMethod = dataArray[2];
77
- vm.paymentMethod = dataArray[3];
103
+ processInChunks(dataArray),
104
+ ]).then(results => {
105
+ vm.twZipcode = results[0];
106
+ vm.store = results[1];
107
+ vm.shippingMethod = results[2];
108
+ vm.paymentMethod = results[3];
78
109
  loading = false;
79
110
  gvc.notifyDataChange(id);
80
111
  });
@@ -322,6 +353,16 @@ export class DeliveryHTML {
322
353
  const shippingAddr = ['UNIMARTC2C', 'UNIMARTFREEZE', 'FAMIC2C', 'FAMIC2CFREEZE', 'OKMARTC2C', 'HILIFEC2C'].includes(orderData.user_info.shipment)
323
354
  ? `${orderData.user_info.CVSStoreName} (${orderData.user_info.CVSAddress})`
324
355
  : [orderData.user_info.city, orderData.user_info.area, orderData.user_info.address].filter(Boolean).join('');
356
+ const receive_temp = [];
357
+ const receive_keys = Object.keys(data.custom_receive_info);
358
+ for (let i = 0; i < receive_keys.length; i += 2) {
359
+ const key1 = receive_keys[i];
360
+ const key2 = receive_keys[i + 1];
361
+ receive_temp.push(key2 ? [key1, key2] : [key1]);
362
+ }
363
+ function printReceiveTd(key) {
364
+ return key && data.custom_receive_info[key] ? html `<td>${key}:${data.custom_receive_info[key]}</td>` : '';
365
+ }
325
366
  return html `<div class="details">
326
367
  <table>
327
368
  <tr>
@@ -344,6 +385,16 @@ export class DeliveryHTML {
344
385
  <td>付款狀態:${paymentStatus(data)}</td>
345
386
  <td>收件人信箱:${orderData.user_info.email}</td>
346
387
  </tr>
388
+ ${receive_temp
389
+ .map(keys => {
390
+ const appendTd = keys.map(key => printReceiveTd(key)).join('');
391
+ return appendTd
392
+ ? html `<tr>
393
+ ${appendTd}
394
+ </tr>`
395
+ : '';
396
+ })
397
+ .join('')}
347
398
  </table>
348
399
  </div>`;
349
400
  }