ts-glitter 14.2.4 → 14.2.6

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 (107) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-product.js +2 -1
  4. package/lowcode/backend-manager/bg-product.ts +2 -1
  5. package/lowcode/cms-plugin/filter-options.js +1 -3
  6. package/lowcode/cms-plugin/filter-options.ts +1 -3
  7. package/lowcode/cms-plugin/module/product-excel.js +537 -0
  8. package/lowcode/cms-plugin/module/product-excel.ts +652 -0
  9. package/lowcode/cms-plugin/shopping-allowance-manager.js +12 -5
  10. package/lowcode/cms-plugin/shopping-allowance-manager.ts +12 -5
  11. package/lowcode/cms-plugin/shopping-discount-setting.js +1 -1
  12. package/lowcode/cms-plugin/shopping-discount-setting.ts +1 -1
  13. package/lowcode/cms-plugin/shopping-finance-setting.js +0 -7
  14. package/lowcode/cms-plugin/shopping-finance-setting.ts +8 -8
  15. package/lowcode/cms-plugin/shopping-invoice-manager.js +5 -1
  16. package/lowcode/cms-plugin/shopping-invoice-manager.ts +5 -2
  17. package/lowcode/cms-plugin/shopping-order-manager.js +8 -0
  18. package/lowcode/cms-plugin/shopping-order-manager.ts +8 -0
  19. package/lowcode/cms-plugin/shopping-product-setting.js +61 -638
  20. package/lowcode/cms-plugin/shopping-product-setting.ts +67 -790
  21. package/lowcode/jspage/main.ts +0 -1
  22. package/lowcode/public-components/blogs/blogs-01.js +4 -0
  23. package/lowcode/public-components/checkout/index.js +967 -209
  24. package/lowcode/public-components/checkout/index.ts +977 -214
  25. package/lowcode/public-components/checkout/index_.js +1724 -412
  26. package/lowcode/public-components/checkout/index_.ts +2032 -704
  27. package/lowcode/public-components/product/pd-class.js +68 -13
  28. package/lowcode/public-components/product/pd-class.ts +74 -14
  29. package/lowcode/public-components/product/product-detail.js +1 -1
  30. package/lowcode/public-components/product/product-detail.ts +7 -3
  31. package/lowcode/public-components/product/product-list.js +55 -0
  32. package/lowcode/public-components/product/product-list.ts +62 -1
  33. package/lowcode/public-components/public/ad.js +14 -0
  34. package/lowcode/public-components/public/ad.ts +15 -0
  35. package/package.json +7 -4
  36. package/src/api-public/controllers/ai-chat.js.map +1 -1
  37. package/src/api-public/controllers/app-release.js.map +1 -1
  38. package/src/api-public/controllers/article.js.map +1 -1
  39. package/src/api-public/controllers/fcm.js.map +1 -1
  40. package/src/api-public/controllers/post.js.map +1 -1
  41. package/src/api-public/controllers/rebate.js.map +1 -1
  42. package/src/api-public/controllers/shop.js +16 -0
  43. package/src/api-public/controllers/shop.js.map +1 -1
  44. package/src/api-public/controllers/shop.ts +27 -3
  45. package/src/api-public/controllers/user.js.map +1 -1
  46. package/src/api-public/services/EcInvoice.js +18 -12
  47. package/src/api-public/services/EcInvoice.js.map +1 -1
  48. package/src/api-public/services/EcInvoice.ts +19 -14
  49. package/src/api-public/services/ai-robot.d.ts +0 -1
  50. package/src/api-public/services/ai-robot.js.map +1 -1
  51. package/src/api-public/services/auto-send-email.js.map +1 -1
  52. package/src/api-public/services/chat.js.map +1 -1
  53. package/src/api-public/services/custom-code.js.map +1 -1
  54. package/src/api-public/services/delivery.js.map +1 -1
  55. package/src/api-public/services/ezpay/tool.d.ts +1 -0
  56. package/src/api-public/services/fb-message.js.map +1 -1
  57. package/src/api-public/services/financial-service.d.ts +49 -1
  58. package/src/api-public/services/financial-service.js +226 -1
  59. package/src/api-public/services/financial-service.js.map +1 -1
  60. package/src/api-public/services/financial-service.ts +282 -1
  61. package/src/api-public/services/line-message.js.map +1 -1
  62. package/src/api-public/services/monitor.d.ts +1 -0
  63. package/src/api-public/services/post.js.map +1 -1
  64. package/src/api-public/services/rebate.js.map +1 -1
  65. package/src/api-public/services/schedule.js.map +1 -1
  66. package/src/api-public/services/share-permission.js.map +1 -1
  67. package/src/api-public/services/shopping.d.ts +3 -1
  68. package/src/api-public/services/shopping.js +57 -58
  69. package/src/api-public/services/shopping.js.map +1 -1
  70. package/src/api-public/services/shopping.ts +77 -76
  71. package/src/api-public/services/sms.js.map +1 -1
  72. package/src/api-public/services/user.js.map +1 -1
  73. package/src/api-public/utils/ut-permission.d.ts +1 -0
  74. package/src/app-project/serverless/src/modules/database.d.ts +1 -1
  75. package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
  76. package/src/config.d.ts +1 -1
  77. package/src/config.js.map +1 -1
  78. package/src/controllers/ai.js.map +1 -1
  79. package/src/controllers/filemanager.js.map +1 -1
  80. package/src/firebase/message.js +2 -1
  81. package/src/firebase/message.js.map +1 -1
  82. package/src/helper/app_creater.js +2 -1
  83. package/src/helper/app_creater.js.map +1 -1
  84. package/src/helper/glitter-util.js.map +3 -3
  85. package/src/index.js +111 -92
  86. package/src/index.js.map +1 -5
  87. package/src/index.ts +424 -397
  88. package/src/lambda/interface.d.ts +1 -1
  89. package/src/lambda/interface.js +2 -2
  90. package/src/lambda/interface.js.map +1 -1
  91. package/src/modules/AWSLib.js +3 -2
  92. package/src/modules/AWSLib.js.map +1 -1
  93. package/src/modules/database.d.ts +1 -1
  94. package/src/modules/redis.d.ts +1 -1
  95. package/src/modules/tool.js +2 -1
  96. package/src/modules/tool.js.map +1 -1
  97. package/src/run.js +2 -1
  98. package/src/run.js.map +1 -1
  99. package/src/services/backend-service.js.map +1 -1
  100. package/src/services/create-instance.js +4 -3
  101. package/src/services/create-instance.js.map +1 -1
  102. package/src/services/saas-table-check.js +2 -2
  103. package/src/services/saas-table-check.js.map +1 -1
  104. package/src/services/ses.js +2 -1
  105. package/src/services/ses.js.map +1 -1
  106. package/src/services/tool.js +3 -2
  107. package/src/services/tool.js.map +1 -1
package/lowcode/Entry.js CHANGED
@@ -70,7 +70,7 @@ export class Entry {
70
70
  }
71
71
  window.renderClock = (_a = window.renderClock) !== null && _a !== void 0 ? _a : clockF();
72
72
  console.log(`Entry-time:`, window.renderClock.stop());
73
- glitter.share.editerVersion = 'V_14.2.4';
73
+ glitter.share.editerVersion = 'V_14.2.6';
74
74
  glitter.share.start = new Date();
75
75
  const vm = {
76
76
  appConfig: [],
package/lowcode/Entry.ts CHANGED
@@ -72,7 +72,7 @@ export class Entry {
72
72
  }
73
73
  (window as any).renderClock = (window as any).renderClock ?? clockF();
74
74
  console.log(`Entry-time:`, (window as any).renderClock.stop());
75
- glitter.share.editerVersion = 'V_14.2.4';
75
+ glitter.share.editerVersion = 'V_14.2.6';
76
76
  glitter.share.start = new Date();
77
77
  const vm: {
78
78
  appConfig: any;
@@ -314,7 +314,7 @@ export class BgProduct {
314
314
  return text.replace(/\//g, html `<i class="fa-solid fa-angle-right mx-1"></i>`);
315
315
  }
316
316
  }
317
- BgProduct.getProductOpts = (def) => {
317
+ BgProduct.getProductOpts = (def, product_type) => {
318
318
  return new Promise((resolve) => {
319
319
  if (!def || def.length === 0) {
320
320
  resolve([]);
@@ -323,6 +323,7 @@ BgProduct.getProductOpts = (def) => {
323
323
  ApiShop.getProduct({
324
324
  page: 0,
325
325
  limit: 99999,
326
+ productType: product_type,
326
327
  id_list: def.map((d) => `${d}`).join(','),
327
328
  }).then((data) => {
328
329
  resolve(data.response.data.map((product) => {
@@ -252,7 +252,7 @@ export class BgProduct {
252
252
  }, 'productsDialog');
253
253
  }
254
254
 
255
- static getProductOpts = (def: (number | string)[]) => {
255
+ static getProductOpts = (def: (number | string)[],product_type?: 'product' | 'addProduct' | 'giveaway' ) => {
256
256
  return new Promise<OptionsItem[]>((resolve) => {
257
257
  if (!def || def.length === 0) {
258
258
  resolve([]);
@@ -261,6 +261,7 @@ export class BgProduct {
261
261
  ApiShop.getProduct({
262
262
  page: 0,
263
263
  limit: 99999,
264
+ productType:product_type,
264
265
  id_list: def.map((d) => `${d}`).join(','),
265
266
  }).then((data) => {
266
267
  resolve(
@@ -219,10 +219,8 @@ FilterOptions.invoiceFunnel = [
219
219
  type: 'multi_checkbox',
220
220
  name: '發票狀態',
221
221
  data: [
222
- { key: '2', name: '已折讓' },
222
+ { key: '2', name: '已作廢' },
223
223
  { key: '1', name: '已開立' },
224
- { key: '0', name: '待審核' },
225
- { key: '-1', name: '已作廢' },
226
224
  ],
227
225
  },
228
226
  {
@@ -227,10 +227,8 @@ export class FilterOptions {
227
227
  type: 'multi_checkbox',
228
228
  name: '發票狀態',
229
229
  data: [
230
- { key: '2', name: '已折讓' },
230
+ { key: '2', name: '已作廢' },
231
231
  { key: '1', name: '已開立' },
232
- { key: '0', name: '待審核' },
233
- { key: '-1', name: '已作廢' },
234
232
  ],
235
233
  },
236
234
  {
@@ -0,0 +1,537 @@
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
+ };
10
+ import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
11
+ import { ApiShop } from '../../glitter-base/route/shopping.js';
12
+ import { CheckInput } from '../../modules/checkInput.js';
13
+ export class ProductExcel {
14
+ constructor(gvc, headers, lineName) {
15
+ this.gvc = gvc;
16
+ this.headers = headers;
17
+ this.lineName = lineName;
18
+ }
19
+ checkString(value) {
20
+ return CheckInput.isEmpty(value) ? '' : value;
21
+ }
22
+ checkNumber(value) {
23
+ return CheckInput.isEmpty(value) || !CheckInput.isNumberString(`${value}`) ? 0 : value;
24
+ }
25
+ loadScript() {
26
+ return new Promise((resolve) => {
27
+ if (window.ExcelJS) {
28
+ this.initExcel();
29
+ resolve(true);
30
+ }
31
+ else {
32
+ this.gvc.addMtScript([
33
+ {
34
+ src: 'https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.9/xlsx.full.min.js',
35
+ },
36
+ {
37
+ src: 'https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.3.0/exceljs.min.js',
38
+ },
39
+ ], () => {
40
+ if (window.XLSX) {
41
+ this.initExcel();
42
+ resolve(true);
43
+ }
44
+ }, () => { });
45
+ }
46
+ });
47
+ }
48
+ initExcel() {
49
+ this.ExcelJS = window.ExcelJS;
50
+ this.workbook = new this.ExcelJS.Workbook();
51
+ this.worksheet = this.workbook.addWorksheet('Sheet1');
52
+ }
53
+ insertData(data) {
54
+ data.forEach((row) => {
55
+ this.worksheet.addRow(Object.values(row));
56
+ });
57
+ }
58
+ setHeader() {
59
+ this.worksheet.addRow(this.headers);
60
+ }
61
+ setHeaderStyle() {
62
+ this.worksheet.getRow(1).eachCell((cell) => {
63
+ cell.font = { name: 'Microsoft JhengHei', bold: true };
64
+ cell.alignment = { vertical: 'middle', horizontal: 'center' };
65
+ cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFE1E1E1' } };
66
+ });
67
+ }
68
+ setRowHeight() {
69
+ this.worksheet.eachRow((row) => {
70
+ row.height = 18;
71
+ });
72
+ }
73
+ setFontAndAlignmentStyle() {
74
+ this.worksheet.eachRow((row) => {
75
+ row.eachCell((cell) => {
76
+ cell.font = { name: 'Microsoft JhengHei' };
77
+ cell.alignment = { vertical: 'middle', horizontal: 'center' };
78
+ });
79
+ });
80
+ }
81
+ saveAsExcelFile(buffer, fileName) {
82
+ const saasConfig = window.saasConfig;
83
+ const dialog = new ShareDialog(this.gvc.glitter);
84
+ saasConfig.api.uploadFile(fileName).then((data) => {
85
+ const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
86
+ const blobData = new Blob([buffer], { type: EXCEL_TYPE });
87
+ const data1 = data.response;
88
+ dialog.dataLoading({ visible: true });
89
+ $.ajax({
90
+ url: data1.url,
91
+ type: 'put',
92
+ data: blobData,
93
+ processData: false,
94
+ headers: {
95
+ 'Content-Type': data1.type,
96
+ },
97
+ crossDomain: true,
98
+ success: () => {
99
+ dialog.dataLoading({ visible: false });
100
+ const link = document.createElement('a');
101
+ link.href = data1.fullUrl;
102
+ link.download = fileName;
103
+ link.click();
104
+ },
105
+ error: () => {
106
+ dialog.dataLoading({ visible: false });
107
+ dialog.errorMessage({ text: '上傳失敗' });
108
+ },
109
+ });
110
+ });
111
+ }
112
+ getByteLength(str) {
113
+ let byteLength = 0;
114
+ for (let i = 0; i < str.length; i++) {
115
+ const charCode = str.charCodeAt(i);
116
+ if (charCode <= 0x007f) {
117
+ byteLength += 1;
118
+ }
119
+ else if (charCode <= 0x07ff) {
120
+ byteLength += 2;
121
+ }
122
+ else if (charCode <= 0xffff) {
123
+ byteLength += 3;
124
+ }
125
+ else {
126
+ byteLength += 4;
127
+ }
128
+ }
129
+ return byteLength;
130
+ }
131
+ adjustColumnWidths(sheetData) {
132
+ const maxLengths = this.headers.map((header) => this.getByteLength(header));
133
+ sheetData.forEach((row) => {
134
+ Object.values(row).forEach((value, index) => {
135
+ const valueLength = this.getByteLength(value);
136
+ if (valueLength > maxLengths[index]) {
137
+ maxLengths[index] = valueLength;
138
+ }
139
+ });
140
+ });
141
+ this.worksheet.columns = this.headers.map((header, index) => {
142
+ return { header, width: maxLengths[index] + 2 };
143
+ });
144
+ }
145
+ importData(notifyId, file) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ yield this.loadScript();
148
+ const reader = new FileReader();
149
+ const dialog = new ShareDialog(this.gvc.glitter);
150
+ dialog.dataLoading({ visible: true, text: '資料處理中' });
151
+ reader.onload = (e) => __awaiter(this, void 0, void 0, function* () {
152
+ const arrayBuffer = e.target.result;
153
+ const workbook = new this.ExcelJS.Workbook();
154
+ yield workbook.xlsx.load(arrayBuffer);
155
+ const worksheet = workbook.getWorksheet(1);
156
+ const data = [];
157
+ worksheet.eachRow({ includeEmpty: true }, (row, rowNumber) => {
158
+ const rowData = [];
159
+ row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
160
+ rowData.push(cell.value);
161
+ });
162
+ const isEmptyRow = rowData.every((cellValue) => cellValue === null || cellValue === '');
163
+ if (!isEmptyRow) {
164
+ data.push(rowData);
165
+ }
166
+ });
167
+ let error = false;
168
+ let addCollection = [];
169
+ let postMD = [];
170
+ let productData = {};
171
+ const getVariantData = () => {
172
+ return {
173
+ barcode: '',
174
+ compare_price: 0,
175
+ cost: 0,
176
+ preview_image: '',
177
+ profit: 0,
178
+ sale_price: 0,
179
+ shipment_type: 'weight',
180
+ show_understocking: '',
181
+ sku: '',
182
+ spec: [],
183
+ stock: 0,
184
+ type: '',
185
+ v_height: 0,
186
+ v_length: 0,
187
+ v_width: 0,
188
+ weight: 0,
189
+ };
190
+ };
191
+ const domainList = data.map((item) => item[5]);
192
+ function hasDuplicates(arr) {
193
+ const filteredArr = arr.filter((item) => item.trim() !== '');
194
+ return new Set(filteredArr).size !== filteredArr.length;
195
+ }
196
+ if (hasDuplicates(domainList)) {
197
+ error = true;
198
+ dialog.dataLoading({ visible: false });
199
+ dialog.infoMessage({ text: '「商品連結」的值不可重複' });
200
+ return;
201
+ }
202
+ data.forEach((row, index) => {
203
+ var _a;
204
+ const variantData = getVariantData();
205
+ if (index != 0) {
206
+ if (row[1]) {
207
+ if (Object.keys(productData).length != 0) {
208
+ postMD.push(productData);
209
+ }
210
+ addCollection = [];
211
+ productData = {
212
+ title: '',
213
+ productType: {
214
+ product: false,
215
+ addProduct: false,
216
+ giveaway: false,
217
+ },
218
+ visible: 'true',
219
+ content: '',
220
+ status: 'active',
221
+ collection: [],
222
+ hideIndex: 'false',
223
+ preview_image: '',
224
+ specs: [],
225
+ variants: [],
226
+ seo: {
227
+ domain: '',
228
+ title: '',
229
+ content: '',
230
+ keywords: '',
231
+ },
232
+ template: '',
233
+ };
234
+ productData.title = this.checkString(row[0]);
235
+ productData.status = row[1] == '啟用' ? 'active' : 'draft';
236
+ productData.collection = (_a = row[2].split(',')) !== null && _a !== void 0 ? _a : [];
237
+ const regex = /[\s\/\\]+/g;
238
+ productData.collection = productData.collection.map((item) => item.replace(/\s+/g, ''));
239
+ productData.collection.forEach((row) => {
240
+ let collection = row.replace(/\s+/g, '');
241
+ if (regex.test(collection)) {
242
+ error = true;
243
+ dialog.infoMessage({ text: `第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別` });
244
+ return;
245
+ }
246
+ function splitStringIncrementally(input) {
247
+ const parts = input.split('/');
248
+ const result = [];
249
+ parts.reduce((acc, part) => {
250
+ const newAcc = acc ? `${acc}/${part}` : part;
251
+ result.push(newAcc);
252
+ return newAcc;
253
+ }, '');
254
+ return result;
255
+ }
256
+ if (collection.split('/').length > 1) {
257
+ let check = splitStringIncrementally(collection);
258
+ const newItems = check.filter((item) => !productData.collection.includes(item));
259
+ addCollection.push(...newItems);
260
+ }
261
+ addCollection.push(collection);
262
+ });
263
+ productData.collection = addCollection;
264
+ switch (row[3]) {
265
+ case '贈品':
266
+ productData.productType.giveaway = true;
267
+ break;
268
+ case '加購品':
269
+ productData.productType.addProduct = true;
270
+ break;
271
+ case '隱形賣場':
272
+ productData.productType.product = true;
273
+ productData.visible = 'false';
274
+ break;
275
+ default:
276
+ productData.productType.product = true;
277
+ break;
278
+ }
279
+ productData.preview_image = row[4] ? [row[4]] : ['商品圖片'];
280
+ productData.seo.domain = this.checkString(row[5]);
281
+ productData.seo.title = this.checkString(row[6]);
282
+ productData.seo.content = this.checkString(row[7]);
283
+ let indices = [8, 10, 12];
284
+ indices.forEach((index) => {
285
+ if (row[index]) {
286
+ productData.specs.push({
287
+ title: row[index],
288
+ option: [],
289
+ });
290
+ }
291
+ });
292
+ }
293
+ let indices = [9, 11, 13];
294
+ indices.forEach((rowindex, key) => {
295
+ var _a;
296
+ if (row[rowindex] && productData.specs.length > key) {
297
+ productData.specs[key].option = (_a = productData.specs[key].option) !== null && _a !== void 0 ? _a : [];
298
+ const exists = productData.specs[key].option.some((item) => item.title === row[rowindex]);
299
+ if (!exists) {
300
+ productData.specs[key].option.push({ title: row[rowindex], expand: true });
301
+ }
302
+ variantData.spec.push(row[rowindex]);
303
+ }
304
+ });
305
+ variantData.sku = this.checkString(row[14]);
306
+ variantData.cost = this.checkString(row[15]);
307
+ variantData.sale_price = this.checkNumber(row[16]);
308
+ variantData.compare_price = this.checkNumber(row[17]);
309
+ variantData.profit = this.checkNumber(row[18]);
310
+ const shipmentTypeMap = {
311
+ 依重量計算: 'weight',
312
+ 依材積計算: 'volume',
313
+ };
314
+ variantData.shipment_type = shipmentTypeMap[row[19]] || 'none';
315
+ variantData.v_length = this.checkNumber(row[20]);
316
+ variantData.v_width = this.checkNumber(row[21]);
317
+ variantData.v_height = this.checkNumber(row[22]);
318
+ variantData.weight = this.checkNumber(row[23]);
319
+ variantData.show_understocking = row[25] == '追蹤' ? 'true' : 'false';
320
+ variantData.stock = this.checkNumber(row[26]);
321
+ variantData.save_stock = this.checkNumber(row[27]);
322
+ variantData.barcode = this.checkString(row[28]);
323
+ productData.variants.push(JSON.parse(JSON.stringify(variantData)));
324
+ }
325
+ });
326
+ postMD.push(productData);
327
+ productData.reverse;
328
+ let passData = {
329
+ data: postMD,
330
+ collection: addCollection,
331
+ };
332
+ dialog.dataLoading({ visible: false });
333
+ if (!error) {
334
+ dialog.dataLoading({ visible: true, text: '上傳資料中' });
335
+ yield ApiShop.postMultiProduct({
336
+ data: passData,
337
+ token: window.parent.config.token,
338
+ }).then(() => {
339
+ dialog.dataLoading({ visible: false });
340
+ dialog.successMessage({ text: '上傳成功' });
341
+ this.gvc.glitter.closeDiaLog();
342
+ this.gvc.notifyDataChange(notifyId);
343
+ });
344
+ }
345
+ });
346
+ reader.readAsArrayBuffer(file);
347
+ });
348
+ }
349
+ exportData(data, name) {
350
+ return __awaiter(this, void 0, void 0, function* () {
351
+ yield this.loadScript();
352
+ this.setHeader();
353
+ this.insertData(data);
354
+ this.setHeaderStyle();
355
+ this.setRowHeight();
356
+ this.setFontAndAlignmentStyle();
357
+ this.adjustColumnWidths(data);
358
+ const buffer = yield this.workbook.xlsx.writeBuffer();
359
+ this.saveAsExcelFile(buffer, `${name}.xlsx`);
360
+ });
361
+ }
362
+ static getFileTime() {
363
+ const now = new Date();
364
+ const year = now.getFullYear();
365
+ const month = String(now.getMonth() + 1).padStart(2, '0');
366
+ const day = String(now.getDate()).padStart(2, '0');
367
+ const hours = String(now.getHours()).padStart(2, '0');
368
+ const minutes = String(now.getMinutes()).padStart(2, '0');
369
+ const seconds = String(now.getSeconds()).padStart(2, '0');
370
+ return `${year}${month}${day}${hours}${minutes}${seconds}`;
371
+ }
372
+ static exampleHeader() {
373
+ return [
374
+ '商品ID',
375
+ '商品名稱',
376
+ '使用狀態(啟用/草稿)',
377
+ '商品類別',
378
+ '上架類型(前台商品/加購品/贈品/隱形賣場)',
379
+ '圖片網址',
380
+ '商品連結',
381
+ 'SEO標題',
382
+ 'SEO描述',
383
+ '規格1',
384
+ '規格詳細',
385
+ '規格2',
386
+ '規格詳細',
387
+ '規格3',
388
+ '規格詳細',
389
+ 'SKU',
390
+ '成本',
391
+ '售價',
392
+ '原價',
393
+ '利潤',
394
+ '運費計算方式',
395
+ '長度',
396
+ '寬度',
397
+ '高度',
398
+ '商品重量',
399
+ '重量單位',
400
+ '庫存政策',
401
+ '庫存數量',
402
+ '安全庫存數量',
403
+ '商品條碼',
404
+ ];
405
+ }
406
+ static exampleSheet() {
407
+ return [
408
+ [
409
+ '商品測試A',
410
+ '啟用',
411
+ '工具,把手',
412
+ '商品',
413
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
414
+ '商品連結A',
415
+ 'SEO標題A',
416
+ 'SEO描述A',
417
+ '顏色',
418
+ '黑色',
419
+ '尺寸',
420
+ '小型',
421
+ '',
422
+ '',
423
+ 'A00100230',
424
+ '15000',
425
+ '25000',
426
+ '30000',
427
+ '0',
428
+ '依重量計算',
429
+ '',
430
+ '',
431
+ '',
432
+ '100',
433
+ 'KG',
434
+ '追蹤',
435
+ '100',
436
+ '10',
437
+ 'CODE1230',
438
+ ],
439
+ ['', '', '', '', '', '', '', '', '', '黑色', '', '大型', '', '', 'A00100231', '24000', '35000', '40000', '0', '依重量計算', '', '', '', '110', 'KG', '追蹤', '100', '10', 'CODE1231'],
440
+ ['', '', '', '', '', '', '', '', '', '棕色', '', '小型', '', '', 'A00100232', '15000', '25000', '30000', '0', '依重量計算', '', '', '', '120', 'KG', '追蹤', '100', '10', 'CODE1232'],
441
+ ['', '', '', '', '', '', '', '', '', '棕色', '', '大型', '', '', 'A00100233', '24000', '35000', '40000', '0', '依重量計算', '', '', '', '130', 'KG', '追蹤', '100', '10', 'CODE1233'],
442
+ [
443
+ '商品測試B',
444
+ '草稿',
445
+ '工具',
446
+ '加購品',
447
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
448
+ '商品連結B',
449
+ 'SEO標題B',
450
+ 'SEO描述B',
451
+ '顏色',
452
+ '白色',
453
+ '尺寸',
454
+ '小型',
455
+ '',
456
+ '',
457
+ 'A00100567',
458
+ '12500',
459
+ '22000',
460
+ '28000',
461
+ '0',
462
+ '依材積計算',
463
+ '10',
464
+ '10',
465
+ '10',
466
+ '',
467
+ '',
468
+ '不追蹤',
469
+ '',
470
+ '',
471
+ 'CODE5678',
472
+ ],
473
+ [
474
+ '商品測試C',
475
+ '啟用',
476
+ '收納用品',
477
+ '贈品',
478
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
479
+ '商品連結C',
480
+ 'SEO標題C',
481
+ 'SEO描述C',
482
+ '顏色',
483
+ '紅色',
484
+ '',
485
+ '',
486
+ '',
487
+ '',
488
+ 'A00100890',
489
+ '13500',
490
+ '24000',
491
+ '32000',
492
+ '0',
493
+ '依材積計算',
494
+ '20',
495
+ '20',
496
+ '20',
497
+ '',
498
+ '',
499
+ '追蹤',
500
+ '200',
501
+ '20',
502
+ 'CODE9900',
503
+ ],
504
+ [
505
+ '商品測試D',
506
+ '草稿',
507
+ '衛生用品',
508
+ '隱形賣場',
509
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
510
+ '商品連結D',
511
+ 'SEO標題D',
512
+ 'SEO描述D',
513
+ '顏色',
514
+ '藍色',
515
+ '尺寸',
516
+ '大型',
517
+ '版型',
518
+ '窄版',
519
+ 'A00200234',
520
+ '8000',
521
+ '12000',
522
+ '15000',
523
+ '0',
524
+ '依重量計算',
525
+ '',
526
+ '',
527
+ '',
528
+ '50',
529
+ 'KG',
530
+ '不追蹤',
531
+ '',
532
+ '',
533
+ 'CODE1357',
534
+ ],
535
+ ];
536
+ }
537
+ }