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
@@ -0,0 +1,652 @@
1
+ import { GVC } from '../../glitterBundle/GVController.js';
2
+ import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
3
+ import { ApiShop } from '../../glitter-base/route/shopping.js';
4
+ import { CheckInput } from '../../modules/checkInput.js';
5
+
6
+ export interface Variant {
7
+ save_stock?: string;
8
+ sale_price: number;
9
+ compare_price: number;
10
+ cost: number;
11
+ spec: string[];
12
+ profit: number;
13
+ v_length: number;
14
+ v_width: number;
15
+ v_height: number;
16
+ weight: number;
17
+ shipment_type: 'weight' | 'none' | 'volume';
18
+ sku: string;
19
+ barcode: string;
20
+ stock: number;
21
+ preview_image: string;
22
+ show_understocking: string;
23
+ type: string;
24
+ }
25
+
26
+ export interface RowInitData {
27
+ id?: string;
28
+ name: string;
29
+ status: string;
30
+ category: string;
31
+ productType: string;
32
+ img: string;
33
+ SEO_domain: string;
34
+ SEO_title: string;
35
+ SEO_desc: string;
36
+ spec1: string;
37
+ spec1Value: string;
38
+ spec2: string;
39
+ spec2Value: string;
40
+ spec3: string;
41
+ spec3Value: string;
42
+ sku: string;
43
+ cost: string;
44
+ sale_price: string;
45
+ compare_price: string;
46
+ benefit: string;
47
+ shipment_type: string;
48
+ length: string;
49
+ width: string;
50
+ height: string;
51
+ weight: string;
52
+ weightUnit: string;
53
+ stockPolicy: string;
54
+ stock: string;
55
+ save_stock: string;
56
+ barcode: string;
57
+ }
58
+
59
+ export class ProductExcel {
60
+ private workbook: any;
61
+ private worksheet: any;
62
+ private ExcelJS: any;
63
+ private gvc: GVC;
64
+ headers: string[];
65
+ lineName: string[];
66
+
67
+ constructor(gvc: GVC, headers: string[], lineName: string[]) {
68
+ this.gvc = gvc;
69
+ this.headers = headers;
70
+ this.lineName = lineName;
71
+ }
72
+
73
+ checkString(value: any) {
74
+ return CheckInput.isEmpty(value) ? '' : value;
75
+ }
76
+
77
+ checkNumber(value: any) {
78
+ return CheckInput.isEmpty(value) || !CheckInput.isNumberString(`${value}`) ? 0 : value;
79
+ }
80
+
81
+ loadScript() {
82
+ return new Promise((resolve) => {
83
+ if ((window as any).ExcelJS) {
84
+ this.initExcel();
85
+ resolve(true);
86
+ } else {
87
+ this.gvc.addMtScript(
88
+ [
89
+ {
90
+ src: 'https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.9/xlsx.full.min.js',
91
+ },
92
+ {
93
+ src: 'https://cdnjs.cloudflare.com/ajax/libs/exceljs/4.3.0/exceljs.min.js',
94
+ },
95
+ ],
96
+ () => {
97
+ if ((window as any).XLSX) {
98
+ this.initExcel();
99
+ resolve(true);
100
+ }
101
+ },
102
+ () => {}
103
+ );
104
+ }
105
+ });
106
+ }
107
+
108
+ private initExcel() {
109
+ this.ExcelJS = (window as any).ExcelJS;
110
+ this.workbook = new this.ExcelJS.Workbook();
111
+ this.worksheet = this.workbook.addWorksheet('Sheet1');
112
+ }
113
+
114
+ private insertData(data: any): void {
115
+ data.forEach((row: any) => {
116
+ this.worksheet.addRow(Object.values(row));
117
+ });
118
+ }
119
+
120
+ private setHeader(): void {
121
+ this.worksheet.addRow(this.headers);
122
+ }
123
+
124
+ // 設定標頭粗體
125
+ private setHeaderStyle(): void {
126
+ this.worksheet.getRow(1).eachCell((cell: any) => {
127
+ cell.font = { name: 'Microsoft JhengHei', bold: true };
128
+ cell.alignment = { vertical: 'middle', horizontal: 'center' };
129
+ cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFE1E1E1' } };
130
+ });
131
+ }
132
+
133
+ // 設定行高1.2
134
+ private setRowHeight(): void {
135
+ this.worksheet.eachRow((row: any) => {
136
+ row.height = 18;
137
+ });
138
+ }
139
+
140
+ private setFontAndAlignmentStyle(): void {
141
+ this.worksheet.eachRow((row: any) => {
142
+ row.eachCell((cell: any) => {
143
+ cell.font = { name: 'Microsoft JhengHei' };
144
+ cell.alignment = { vertical: 'middle', horizontal: 'center' };
145
+ });
146
+ });
147
+ }
148
+
149
+ private saveAsExcelFile(buffer: any, fileName: string): void {
150
+ const saasConfig: { config: any; api: any } = (window as any).saasConfig;
151
+ const dialog = new ShareDialog(this.gvc.glitter);
152
+ saasConfig.api.uploadFile(fileName).then((data: any) => {
153
+ const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
154
+ const blobData: Blob = new Blob([buffer], { type: EXCEL_TYPE });
155
+ const data1 = data.response;
156
+ dialog.dataLoading({ visible: true });
157
+ $.ajax({
158
+ url: data1.url,
159
+ type: 'put',
160
+ data: blobData,
161
+ processData: false,
162
+ headers: {
163
+ 'Content-Type': data1.type,
164
+ },
165
+ crossDomain: true,
166
+ success: () => {
167
+ dialog.dataLoading({ visible: false });
168
+ const link = document.createElement('a');
169
+ link.href = data1.fullUrl;
170
+ link.download = fileName;
171
+ link.click();
172
+ },
173
+ error: () => {
174
+ dialog.dataLoading({ visible: false });
175
+ dialog.errorMessage({ text: '上傳失敗' });
176
+ },
177
+ });
178
+ });
179
+ }
180
+
181
+ // 透過位元組的大小,判斷內容文字的適合寬度計算
182
+ private getByteLength(str: string): number {
183
+ let byteLength = 0;
184
+ for (let i = 0; i < str.length; i++) {
185
+ const charCode = str.charCodeAt(i);
186
+ if (charCode <= 0x007f) {
187
+ // ASCII 字符
188
+ byteLength += 1;
189
+ } else if (charCode <= 0x07ff) {
190
+ // 扩展拉丁字符
191
+ byteLength += 2;
192
+ } else if (charCode <= 0xffff) {
193
+ // 大部分语言字符
194
+ byteLength += 3;
195
+ } else {
196
+ // 补充字符
197
+ byteLength += 4;
198
+ }
199
+ }
200
+ return byteLength;
201
+ }
202
+
203
+ // 調整excel內容的寬度
204
+ private adjustColumnWidths(sheetData: any): void {
205
+ const maxLengths = this.headers.map((header) => this.getByteLength(header));
206
+ sheetData.forEach((row: any) => {
207
+ Object.values(row).forEach((value, index) => {
208
+ const valueLength = this.getByteLength(value as string);
209
+ if (valueLength > maxLengths[index]) {
210
+ maxLengths[index] = valueLength;
211
+ }
212
+ });
213
+ });
214
+ this.worksheet.columns = this.headers.map((header, index) => {
215
+ return { header, width: maxLengths[index] + 2 };
216
+ });
217
+ }
218
+
219
+ // 匯入excel
220
+ async importData(notifyId: string, file: any) {
221
+ await this.loadScript();
222
+ const reader = new FileReader();
223
+ const dialog = new ShareDialog(this.gvc.glitter);
224
+ dialog.dataLoading({ visible: true, text: '資料處理中' });
225
+
226
+ reader.onload = async (e) => {
227
+ const arrayBuffer = e.target!.result;
228
+ const workbook = new this.ExcelJS.Workbook();
229
+ await workbook.xlsx.load(arrayBuffer);
230
+ const worksheet = workbook.getWorksheet(1);
231
+
232
+ const data: any = [];
233
+ worksheet.eachRow({ includeEmpty: true }, (row: any, rowNumber: any) => {
234
+ const rowData: any = [];
235
+ row.eachCell({ includeEmpty: true }, (cell: any, colNumber: any) => {
236
+ rowData.push(cell.value);
237
+ });
238
+ const isEmptyRow = rowData.every((cellValue: any) => cellValue === null || cellValue === '');
239
+ if (!isEmptyRow) {
240
+ data.push(rowData);
241
+ }
242
+ });
243
+ let error = false;
244
+ let addCollection: any = [];
245
+ let postMD: {
246
+ title: string;
247
+ productType: {
248
+ product: boolean;
249
+ addProduct: boolean;
250
+ giveaway: boolean;
251
+ };
252
+ content: string;
253
+ preview_image: string;
254
+ hideIndex: string;
255
+ collection: string[];
256
+ status: 'active' | 'draft';
257
+ specs: { title: string; option: any }[];
258
+ variants: Variant[];
259
+ seo: {
260
+ title: string;
261
+ content: string;
262
+ keywords: string;
263
+ };
264
+ template: string;
265
+ }[] = [];
266
+ let productData: any = {};
267
+ const getVariantData: () => Variant = () => {
268
+ return {
269
+ barcode: '',
270
+ compare_price: 0,
271
+ cost: 0,
272
+ preview_image: '',
273
+ profit: 0,
274
+ sale_price: 0,
275
+ shipment_type: 'weight',
276
+ show_understocking: '',
277
+ sku: '',
278
+ spec: [],
279
+ stock: 0,
280
+ type: '',
281
+ v_height: 0,
282
+ v_length: 0,
283
+ v_width: 0,
284
+ weight: 0,
285
+ };
286
+ };
287
+
288
+ const domainList = data.map((item: string[]) => item[5]);
289
+ function hasDuplicates(arr: string[]) {
290
+ const filteredArr = arr.filter((item) => item.trim() !== ''); // 過濾掉空白字串
291
+ return new Set(filteredArr).size !== filteredArr.length;
292
+ }
293
+ if (hasDuplicates(domainList)) {
294
+ error = true;
295
+ dialog.dataLoading({ visible: false });
296
+ dialog.infoMessage({ text: '「商品連結」的值不可重複' });
297
+ return;
298
+ }
299
+
300
+ data.forEach((row: any, index: number) => {
301
+ const variantData = getVariantData();
302
+ if (index != 0) {
303
+ if (row[1]) {
304
+ if (Object.keys(productData).length != 0) {
305
+ postMD.push(productData);
306
+ }
307
+ addCollection = [];
308
+ productData = {
309
+ title: '',
310
+ productType: {
311
+ product: false,
312
+ addProduct: false,
313
+ giveaway: false,
314
+ },
315
+ visible: 'true',
316
+ content: '',
317
+ status: 'active',
318
+ collection: [],
319
+ hideIndex: 'false',
320
+ preview_image: '',
321
+ specs: [],
322
+ variants: [],
323
+ seo: {
324
+ domain: '',
325
+ title: '',
326
+ content: '',
327
+ keywords: '',
328
+ },
329
+ template: '',
330
+ };
331
+
332
+ productData.title = this.checkString(row[0]);
333
+ productData.status = row[1] == '啟用' ? 'active' : 'draft';
334
+ productData.collection = row[2].split(',') ?? [];
335
+ const regex = /[\s\/\\]+/g;
336
+ // 去除多餘空白
337
+ productData.collection = productData.collection.map((item: string) => item.replace(/\s+/g, ''));
338
+ productData.collection.forEach((row: any) => {
339
+ let collection = row.replace(/\s+/g, '');
340
+ if (regex.test(collection)) {
341
+ error = true;
342
+ dialog.infoMessage({ text: `第${index + 1}行的類別名稱不可包含空白格與以下符號:「 / 」「 \\ 」,並以「 , 」區分不同類別` });
343
+ return;
344
+ }
345
+
346
+ // 若帶有/,要自動加上父類
347
+ function splitStringIncrementally(input: string): string[] {
348
+ const parts = input.split('/');
349
+ const result: string[] = [];
350
+
351
+ // 使用 reduce 来构建每一部分的拼接字符串
352
+ parts.reduce((acc, part) => {
353
+ const newAcc = acc ? `${acc}/${part}` : part;
354
+ result.push(newAcc);
355
+ return newAcc;
356
+ }, '');
357
+
358
+ return result;
359
+ }
360
+
361
+ if (collection.split('/').length > 1) {
362
+ // 會進來代表有/的內容 需要檢查放進去的collection有沒有父類
363
+ // 先取得目前分層 例如 貓/貓用品/貓砂/A品牌 會拆分成 貓/貓用品/貓砂 , 貓/貓用品, 貓
364
+ // 然後把父層自動推進去
365
+ let check = splitStringIncrementally(collection);
366
+ const newItems = check.filter((item: string) => !productData.collection.includes(item));
367
+ addCollection.push(...newItems);
368
+ }
369
+ addCollection.push(collection);
370
+ });
371
+ productData.collection = addCollection;
372
+ switch (row[3]) {
373
+ case '贈品':
374
+ productData.productType.giveaway = true;
375
+ break;
376
+ case '加購品':
377
+ productData.productType.addProduct = true;
378
+ break;
379
+ case '隱形賣場':
380
+ productData.productType.product = true;
381
+ productData.visible = 'false';
382
+ break;
383
+ default:
384
+ productData.productType.product = true;
385
+ break;
386
+ }
387
+ productData.preview_image = row[4] ? [row[4]] : ['商品圖片'];
388
+ productData.seo.domain = this.checkString(row[5]);
389
+ productData.seo.title = this.checkString(row[6]);
390
+ productData.seo.content = this.checkString(row[7]);
391
+ // spec值 merge
392
+ let indices = [8, 10, 12];
393
+ indices.forEach((index) => {
394
+ if (row[index]) {
395
+ productData.specs.push({
396
+ title: row[index],
397
+ option: [],
398
+ });
399
+ }
400
+ });
401
+ }
402
+
403
+ let indices = [9, 11, 13];
404
+ indices.forEach((rowindex, key) => {
405
+ if (row[rowindex] && productData.specs.length > key) {
406
+ productData.specs[key].option = productData.specs[key].option ?? [];
407
+ const exists = productData.specs[key].option.some((item: any) => item.title === row[rowindex]);
408
+ if (!exists) {
409
+ productData.specs[key].option.push({ title: row[rowindex], expand: true });
410
+ }
411
+ variantData.spec.push(row[rowindex]);
412
+ }
413
+ });
414
+
415
+ variantData.sku = this.checkString(row[14]);
416
+ variantData.cost = this.checkString(row[15]);
417
+ variantData.sale_price = this.checkNumber(row[16]);
418
+ variantData.compare_price = this.checkNumber(row[17]);
419
+ variantData.profit = this.checkNumber(row[18]);
420
+
421
+ const shipmentTypeMap: { [key: string]: 'weight' | 'volume' } = {
422
+ 依重量計算: 'weight',
423
+ 依材積計算: 'volume',
424
+ };
425
+ variantData.shipment_type = shipmentTypeMap[row[19]] || 'none';
426
+
427
+ variantData.v_length = this.checkNumber(row[20]);
428
+ variantData.v_width = this.checkNumber(row[21]);
429
+ variantData.v_height = this.checkNumber(row[22]);
430
+ variantData.weight = this.checkNumber(row[23]);
431
+ variantData.show_understocking = row[25] == '追蹤' ? 'true' : 'false';
432
+ variantData.stock = this.checkNumber(row[26]);
433
+ variantData.save_stock = this.checkNumber(row[27]);
434
+ variantData.barcode = this.checkString(row[28]);
435
+
436
+ productData.variants.push(JSON.parse(JSON.stringify(variantData)));
437
+ }
438
+ });
439
+ postMD.push(productData);
440
+ productData.reverse;
441
+ let passData = {
442
+ data: postMD,
443
+ collection: addCollection,
444
+ };
445
+
446
+ dialog.dataLoading({ visible: false });
447
+ if (!error) {
448
+ dialog.dataLoading({ visible: true, text: '上傳資料中' });
449
+ await ApiShop.postMultiProduct({
450
+ data: passData,
451
+ token: (window.parent as any).config.token,
452
+ }).then(() => {
453
+ dialog.dataLoading({ visible: false });
454
+ dialog.successMessage({ text: '上傳成功' });
455
+ this.gvc.glitter.closeDiaLog();
456
+ this.gvc.notifyDataChange(notifyId);
457
+ });
458
+ }
459
+ };
460
+ reader.readAsArrayBuffer(file);
461
+ }
462
+
463
+ async exportData(data: any, name: string) {
464
+ await this.loadScript();
465
+ this.setHeader();
466
+ this.insertData(data);
467
+ this.setHeaderStyle();
468
+ this.setRowHeight();
469
+ this.setFontAndAlignmentStyle();
470
+ this.adjustColumnWidths(data);
471
+ const buffer = await this.workbook.xlsx.writeBuffer();
472
+ this.saveAsExcelFile(buffer, `${name}.xlsx`);
473
+ }
474
+
475
+ static getFileTime() {
476
+ const now = new Date();
477
+ const year = now.getFullYear();
478
+ const month = String(now.getMonth() + 1).padStart(2, '0');
479
+ const day = String(now.getDate()).padStart(2, '0');
480
+ const hours = String(now.getHours()).padStart(2, '0');
481
+ const minutes = String(now.getMinutes()).padStart(2, '0');
482
+ const seconds = String(now.getSeconds()).padStart(2, '0');
483
+ return `${year}${month}${day}${hours}${minutes}${seconds}`;
484
+ }
485
+
486
+ static exampleHeader() {
487
+ return [
488
+ '商品ID',
489
+ '商品名稱',
490
+ '使用狀態(啟用/草稿)',
491
+ '商品類別',
492
+ '上架類型(前台商品/加購品/贈品/隱形賣場)',
493
+ '圖片網址',
494
+ '商品連結',
495
+ 'SEO標題',
496
+ 'SEO描述',
497
+ '規格1',
498
+ '規格詳細',
499
+ '規格2',
500
+ '規格詳細',
501
+ '規格3',
502
+ '規格詳細',
503
+ 'SKU',
504
+ '成本',
505
+ '售價',
506
+ '原價',
507
+ '利潤',
508
+ '運費計算方式',
509
+ '長度',
510
+ '寬度',
511
+ '高度',
512
+ '商品重量',
513
+ '重量單位',
514
+ '庫存政策',
515
+ '庫存數量',
516
+ '安全庫存數量',
517
+ '商品條碼',
518
+ ];
519
+ }
520
+
521
+ static exampleSheet() {
522
+ return [
523
+ [
524
+ '商品測試A',
525
+ '啟用',
526
+ '工具,把手',
527
+ '商品',
528
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
529
+ '商品連結A',
530
+ 'SEO標題A',
531
+ 'SEO描述A',
532
+ '顏色',
533
+ '黑色',
534
+ '尺寸',
535
+ '小型',
536
+ '',
537
+ '',
538
+ 'A00100230',
539
+ '15000',
540
+ '25000',
541
+ '30000',
542
+ '0',
543
+ '依重量計算',
544
+ '',
545
+ '',
546
+ '',
547
+ '100',
548
+ 'KG',
549
+ '追蹤',
550
+ '100',
551
+ '10',
552
+ 'CODE1230',
553
+ ],
554
+ ['', '', '', '', '', '', '', '', '', '黑色', '', '大型', '', '', 'A00100231', '24000', '35000', '40000', '0', '依重量計算', '', '', '', '110', 'KG', '追蹤', '100', '10', 'CODE1231'],
555
+ ['', '', '', '', '', '', '', '', '', '棕色', '', '小型', '', '', 'A00100232', '15000', '25000', '30000', '0', '依重量計算', '', '', '', '120', 'KG', '追蹤', '100', '10', 'CODE1232'],
556
+ ['', '', '', '', '', '', '', '', '', '棕色', '', '大型', '', '', 'A00100233', '24000', '35000', '40000', '0', '依重量計算', '', '', '', '130', 'KG', '追蹤', '100', '10', 'CODE1233'],
557
+ [
558
+ '商品測試B',
559
+ '草稿',
560
+ '工具',
561
+ '加購品',
562
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
563
+ '商品連結B',
564
+ 'SEO標題B',
565
+ 'SEO描述B',
566
+ '顏色',
567
+ '白色',
568
+ '尺寸',
569
+ '小型',
570
+ '',
571
+ '',
572
+ 'A00100567',
573
+ '12500',
574
+ '22000',
575
+ '28000',
576
+ '0',
577
+ '依材積計算',
578
+ '10',
579
+ '10',
580
+ '10',
581
+ '',
582
+ '',
583
+ '不追蹤',
584
+ '',
585
+ '',
586
+ 'CODE5678',
587
+ ],
588
+ [
589
+ '商品測試C',
590
+ '啟用',
591
+ '收納用品',
592
+ '贈品',
593
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
594
+ '商品連結C',
595
+ 'SEO標題C',
596
+ 'SEO描述C',
597
+ '顏色',
598
+ '紅色',
599
+ '',
600
+ '',
601
+ '',
602
+ '',
603
+ 'A00100890',
604
+ '13500',
605
+ '24000',
606
+ '32000',
607
+ '0',
608
+ '依材積計算',
609
+ '20',
610
+ '20',
611
+ '20',
612
+ '',
613
+ '',
614
+ '追蹤',
615
+ '200',
616
+ '20',
617
+ 'CODE9900',
618
+ ],
619
+ [
620
+ '商品測試D',
621
+ '草稿',
622
+ '衛生用品',
623
+ '隱形賣場',
624
+ 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg',
625
+ '商品連結D',
626
+ 'SEO標題D',
627
+ 'SEO描述D',
628
+ '顏色',
629
+ '藍色',
630
+ '尺寸',
631
+ '大型',
632
+ '版型',
633
+ '窄版',
634
+ 'A00200234',
635
+ '8000',
636
+ '12000',
637
+ '15000',
638
+ '0',
639
+ '依重量計算',
640
+ '',
641
+ '',
642
+ '',
643
+ '50',
644
+ 'KG',
645
+ '不追蹤',
646
+ '',
647
+ '',
648
+ 'CODE1357',
649
+ ],
650
+ ];
651
+ }
652
+ }
@@ -829,7 +829,7 @@ export class ShoppingAllowanceManager {
829
829
  }
830
830
  static createOrder(gvc, vm) {
831
831
  let viewModel = {
832
- searchOrder: '',
832
+ searchOrder: 'VF10008513',
833
833
  searchData: '',
834
834
  orderData: {},
835
835
  errorReport: '',
@@ -1203,10 +1203,17 @@ export class ShoppingAllowanceManager {
1203
1203
  dialog.dataLoading({
1204
1204
  visible: false
1205
1205
  });
1206
- dialog.infoMessage({
1207
- text: '折讓單建立完成'
1208
- });
1209
- vm.type = 'list';
1206
+ if (r.response.RtnCode == "1") {
1207
+ dialog.infoMessage({
1208
+ text: html `折讓單建立完成<br>可折讓金額剩餘${r.response.IA_Remain_Allowance_Amt}`
1209
+ });
1210
+ }
1211
+ else {
1212
+ dialog.warningMessage({
1213
+ callback: () => { },
1214
+ text: html `此發票已無可用折讓餘額`
1215
+ });
1216
+ }
1210
1217
  });
1211
1218
  }
1212
1219
  }), '開立')}