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
@@ -17,6 +17,7 @@ import { ApiUser } from "../../glitter-base/route/user.js";
17
17
  import { FormWidget } from "../../official_view_component/official/form.js";
18
18
  import { ShareDialog } from "../../glitterBundle/dialog/ShareDialog.js";
19
19
  import { PdClass } from "../product/pd-class.js";
20
+ import { Ad } from "../public/ad.js";
20
21
  const html = String.raw;
21
22
  const css = String.raw;
22
23
  export class CheckoutIndex {
@@ -36,56 +37,36 @@ export class CheckoutIndex {
36
37
  {
37
38
  "spec": [
38
39
  "黑色",
39
- "小型"
40
+ "小號"
40
41
  ],
41
- "id": 732,
42
- "count": 1,
43
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
44
- "title": "鱷魚皮沙發doiwq",
45
- "sale_price": 25000,
42
+ "id": 710,
43
+ "count": 5,
44
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
45
+ "title": "溫德米爾 茶几",
46
+ "sale_price": 1800,
46
47
  "collection": [
47
48
  "折扣專區",
48
49
  "熱門商品",
49
50
  "熱門商品 / 夏季限定"
50
51
  ],
51
- "sku": "133",
52
- "shipment_obj": {
53
- "type": "weight",
54
- "value": 100
55
- },
56
- "discount_price": 38,
57
- "rebate": 0
58
- },
59
- {
60
- "spec": [
61
- "米色",
62
- "標準"
63
- ],
64
- "id": 735,
65
- "count": 10,
66
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
67
- "title": "維也納 布藝雙人床 ( 加購品 )",
68
- "sale_price": 3200,
69
- "collection": [],
70
52
  "sku": "",
71
53
  "shipment_obj": {
72
- "type": "weight",
73
- "value": 10
54
+ "type": "volume",
55
+ "value": 600
74
56
  },
75
- "is_add_on_items": true,
76
- "discount_price": 5,
57
+ "discount_price": 17.6,
77
58
  "rebate": 0
78
59
  }
79
60
  ],
80
- "total": 57412,
61
+ "total": 9212,
81
62
  "email": "sam38124@gmail.com",
82
63
  "user_info": {
83
- "shipment": "sescsbsfs4s2s4sf"
64
+ "shipment": "shop"
84
65
  },
85
- "shipment_fee": 500,
66
+ "shipment_fee": 300,
86
67
  "rebate": 0,
87
68
  "use_rebate": 0,
88
- "orderID": "1732706322131",
69
+ "orderID": "1732712547962",
89
70
  "shipment_support": [
90
71
  "OKMARTC2C",
91
72
  "shop",
@@ -194,7 +175,17 @@ export class CheckoutIndex {
194
175
  },
195
176
  "orderSource": "",
196
177
  "code_array": [],
197
- "give_away": [],
178
+ "give_away": [
179
+ {
180
+ "id": 737,
181
+ "spec": [
182
+ "淺木色",
183
+ "4人座"
184
+ ],
185
+ "count": 1,
186
+ "voucher_id": 738
187
+ }
188
+ ],
198
189
  "user_rebate_sum": 39807,
199
190
  "voucherList": [
200
191
  {
@@ -233,59 +224,39 @@ export class CheckoutIndex {
233
224
  {
234
225
  "spec": [
235
226
  "黑色",
236
- "小型"
227
+ "小號"
237
228
  ],
238
- "id": 732,
239
- "count": 1,
240
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
241
- "title": "鱷魚皮沙發doiwq",
242
- "sale_price": 25000,
229
+ "id": 710,
230
+ "count": 5,
231
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
232
+ "title": "溫德米爾 茶几",
233
+ "sale_price": 1800,
243
234
  "collection": [
244
235
  "折扣專區",
245
236
  "熱門商品",
246
237
  "熱門商品 / 夏季限定"
247
238
  ],
248
- "sku": "133",
249
- "shipment_obj": {
250
- "type": "weight",
251
- "value": 100
252
- },
253
- "discount_price": 38,
254
- "rebate": 0
255
- },
256
- {
257
- "spec": [
258
- "米色",
259
- "標準"
260
- ],
261
- "id": 735,
262
- "count": 10,
263
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
264
- "title": "維也納 布藝雙人床 ( 加購品 )",
265
- "sale_price": 3200,
266
- "collection": [],
267
239
  "sku": "",
268
240
  "shipment_obj": {
269
- "type": "weight",
270
- "value": 10
241
+ "type": "volume",
242
+ "value": 600
271
243
  },
272
- "is_add_on_items": true,
273
- "discount_price": 5,
244
+ "discount_price": 17.6,
274
245
  "rebate": 0
275
246
  }
276
247
  ],
277
248
  "times": 1,
278
- "bind_subtotal": 57000,
249
+ "bind_subtotal": 9000,
279
250
  "discount_total": 88,
280
251
  "rebate_total": 0
281
252
  },
282
253
  {
283
- "id": 736,
254
+ "id": 738,
284
255
  "for": "all",
285
256
  "code": "",
286
257
  "rule": "min_price",
287
258
  "type": "voucher",
288
- "title": "test",
259
+ "title": "滿100贈送",
289
260
  "value": "0",
290
261
  "device": [
291
262
  "normal"
@@ -299,68 +270,639 @@ export class CheckoutIndex {
299
270
  "trigger": "auto",
300
271
  "counting": "single",
301
272
  "ruleValue": 1000,
302
- "startDate": "2024-11-27",
303
- "startTime": "14:00",
304
- "reBackType": "add_on_items",
273
+ "startDate": "2024-11-20",
274
+ "startTime": "20:00",
275
+ "reBackType": "giveaway",
305
276
  "targetList": [],
306
277
  "end_ISO_Date": "",
307
278
  "macroLimited": 0,
308
279
  "microLimited": 0,
309
280
  "rebateEndDay": "30",
310
281
  "conditionType": "order",
311
- "start_ISO_Date": "2024-11-27T06:00:00.000Z",
282
+ "start_ISO_Date": "2024-11-20T12:00:00.000Z",
312
283
  "add_on_products": [
313
- 735
284
+ {
285
+ "id": 737,
286
+ "seo": {
287
+ "title": "北歐風實木餐桌 - 優雅的餐桌選擇",
288
+ "domain": "北歐風實木餐桌 ( 贈品 )",
289
+ "content": "選擇北歐風實木餐桌,帶給您的家居新氣象。",
290
+ "keywords": ""
291
+ },
292
+ "type": "product",
293
+ "specs": [
294
+ {
295
+ "title": "顏色",
296
+ "option": [
297
+ {
298
+ "title": "淺木色",
299
+ "expand": true
300
+ },
301
+ {
302
+ "title": "胡桃木色",
303
+ "expand": true
304
+ },
305
+ {
306
+ "title": "黑色",
307
+ "expand": true
308
+ }
309
+ ]
310
+ },
311
+ {
312
+ "title": "尺寸",
313
+ "option": [
314
+ {
315
+ "title": "4人座"
316
+ },
317
+ {
318
+ "title": "6人座"
319
+ },
320
+ {
321
+ "title": "8人座"
322
+ }
323
+ ]
324
+ }
325
+ ],
326
+ "title": "北歐風實木餐桌 ( 贈品 )",
327
+ "token": {
328
+ "exp": 1764244210,
329
+ "iat": 1732708210,
330
+ "userID": 122538856,
331
+ "account": "rdtest",
332
+ "userData": {}
333
+ },
334
+ "status": "active",
335
+ "content": "北歐風實木餐桌,提供多種顏色與尺寸,適合不同家庭。",
336
+ "visible": "true",
337
+ "template": "",
338
+ "variants": [
339
+ {
340
+ "sku": "",
341
+ "cost": 0,
342
+ "spec": [
343
+ "淺木色",
344
+ "4人座"
345
+ ],
346
+ "type": "variants",
347
+ "stock": 0,
348
+ "profit": 0,
349
+ "weight": "1",
350
+ "barcode": "",
351
+ "v_width": 0,
352
+ "editable": false,
353
+ "v_height": 0,
354
+ "v_length": 0,
355
+ "product_id": 737,
356
+ "sale_price": 3500,
357
+ "compare_price": 0,
358
+ "preview_image": "",
359
+ "shipment_type": "weight",
360
+ "shipment_weight": 0,
361
+ "show_understocking": "false"
362
+ },
363
+ {
364
+ "sku": "",
365
+ "cost": 0,
366
+ "spec": [
367
+ "淺木色",
368
+ "6人座"
369
+ ],
370
+ "type": "variants",
371
+ "stock": 0,
372
+ "profit": 0,
373
+ "weight": "1",
374
+ "barcode": "",
375
+ "v_width": 0,
376
+ "editable": false,
377
+ "v_height": 0,
378
+ "v_length": 0,
379
+ "product_id": 737,
380
+ "sale_price": 3000,
381
+ "compare_price": 0,
382
+ "preview_image": "",
383
+ "shipment_type": "weight",
384
+ "shipment_weight": 0,
385
+ "show_understocking": "false"
386
+ },
387
+ {
388
+ "sku": "",
389
+ "cost": 0,
390
+ "spec": [
391
+ "淺木色",
392
+ "8人座"
393
+ ],
394
+ "type": "variants",
395
+ "stock": 0,
396
+ "profit": 0,
397
+ "weight": "1",
398
+ "barcode": "",
399
+ "v_width": 0,
400
+ "editable": false,
401
+ "v_height": 0,
402
+ "v_length": 0,
403
+ "product_id": 737,
404
+ "sale_price": 2500,
405
+ "compare_price": 0,
406
+ "preview_image": "",
407
+ "shipment_type": "weight",
408
+ "shipment_weight": 0,
409
+ "show_understocking": "false"
410
+ },
411
+ {
412
+ "sku": "",
413
+ "cost": 0,
414
+ "spec": [
415
+ "胡桃木色",
416
+ "4人座"
417
+ ],
418
+ "type": "variants",
419
+ "stock": 0,
420
+ "profit": 0,
421
+ "weight": "1",
422
+ "barcode": "",
423
+ "v_width": 0,
424
+ "editable": false,
425
+ "v_height": 0,
426
+ "v_length": 0,
427
+ "product_id": 737,
428
+ "sale_price": 2500,
429
+ "compare_price": 0,
430
+ "preview_image": "",
431
+ "shipment_type": "weight",
432
+ "shipment_weight": 0,
433
+ "show_understocking": "false"
434
+ },
435
+ {
436
+ "sku": "",
437
+ "cost": 0,
438
+ "spec": [
439
+ "胡桃木色",
440
+ "6人座"
441
+ ],
442
+ "type": "variants",
443
+ "stock": 0,
444
+ "profit": 0,
445
+ "weight": "1",
446
+ "barcode": "",
447
+ "v_width": 0,
448
+ "editable": false,
449
+ "v_height": 0,
450
+ "v_length": 0,
451
+ "product_id": 737,
452
+ "sale_price": 2500,
453
+ "compare_price": 0,
454
+ "preview_image": "",
455
+ "shipment_type": "weight",
456
+ "shipment_weight": 0,
457
+ "show_understocking": "false"
458
+ },
459
+ {
460
+ "sku": "",
461
+ "cost": 0,
462
+ "spec": [
463
+ "胡桃木色",
464
+ "8人座"
465
+ ],
466
+ "type": "variants",
467
+ "stock": 0,
468
+ "profit": 0,
469
+ "weight": "1",
470
+ "barcode": "",
471
+ "v_width": 0,
472
+ "editable": false,
473
+ "v_height": 0,
474
+ "v_length": 0,
475
+ "product_id": 737,
476
+ "sale_price": 2500,
477
+ "compare_price": 0,
478
+ "preview_image": "",
479
+ "shipment_type": "weight",
480
+ "shipment_weight": 0,
481
+ "show_understocking": "false"
482
+ },
483
+ {
484
+ "sku": "",
485
+ "cost": 0,
486
+ "spec": [
487
+ "黑色",
488
+ "4人座"
489
+ ],
490
+ "type": "variants",
491
+ "stock": 0,
492
+ "profit": 0,
493
+ "weight": "1",
494
+ "barcode": "",
495
+ "v_width": 0,
496
+ "editable": false,
497
+ "v_height": 0,
498
+ "v_length": 0,
499
+ "product_id": 737,
500
+ "sale_price": 2500,
501
+ "compare_price": 0,
502
+ "preview_image": "",
503
+ "shipment_type": "weight",
504
+ "shipment_weight": 0,
505
+ "show_understocking": "false"
506
+ },
507
+ {
508
+ "sku": "",
509
+ "cost": 0,
510
+ "spec": [
511
+ "黑色",
512
+ "6人座"
513
+ ],
514
+ "type": "variants",
515
+ "stock": 0,
516
+ "profit": 0,
517
+ "weight": "1",
518
+ "barcode": "",
519
+ "v_width": 0,
520
+ "editable": false,
521
+ "v_height": 0,
522
+ "v_length": 0,
523
+ "product_id": 737,
524
+ "sale_price": 2500,
525
+ "compare_price": 0,
526
+ "preview_image": "",
527
+ "shipment_type": "weight",
528
+ "shipment_weight": 0,
529
+ "show_understocking": "false"
530
+ },
531
+ {
532
+ "sku": "",
533
+ "cost": 0,
534
+ "spec": [
535
+ "黑色",
536
+ "8人座"
537
+ ],
538
+ "type": "variants",
539
+ "stock": 0,
540
+ "profit": 0,
541
+ "weight": "1",
542
+ "barcode": "",
543
+ "v_width": 0,
544
+ "editable": false,
545
+ "v_height": 0,
546
+ "v_length": 0,
547
+ "product_id": 737,
548
+ "sale_price": 2500,
549
+ "compare_price": 0,
550
+ "preview_image": "",
551
+ "shipment_type": "weight",
552
+ "shipment_weight": 0,
553
+ "show_understocking": "false"
554
+ }
555
+ ],
556
+ "hideIndex": "false",
557
+ "max_price": 3500,
558
+ "min_price": 2500,
559
+ "collection": [],
560
+ "productType": {
561
+ "product": false,
562
+ "giveaway": true,
563
+ "addProduct": false
564
+ },
565
+ "content_json": [],
566
+ "in_wish_list": false,
567
+ "content_array": [],
568
+ "preview_image": [
569
+ "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E 2024-11-04 11.13.58 - A Scandinavian-style solid wood dining table in a minimalist dining room setting. The table has a simple yet elegant design, showcasing natural wood g.webp"
570
+ ],
571
+ "relative_product": [],
572
+ "voucher_id": 738,
573
+ "selected": true,
574
+ "have_select": true
575
+ },
576
+ {
577
+ "id": 739,
578
+ "seo": {
579
+ "title": "摩根鋼架書架 - 多色多層選擇",
580
+ "domain": "摩根鋼架書架 ( 贈品 )",
581
+ "content": "摩根鋼架書架,提供黑色、白色和灰色選擇,適合家庭及辦公室使用,尺寸有3層、4層、5層,價格合理。",
582
+ "keywords": ""
583
+ },
584
+ "type": "product",
585
+ "specs": [
586
+ {
587
+ "title": "顏色",
588
+ "option": [
589
+ {
590
+ "title": "黑色",
591
+ "expand": true
592
+ },
593
+ {
594
+ "title": "白色",
595
+ "expand": true
596
+ },
597
+ {
598
+ "title": "灰色",
599
+ "expand": true
600
+ }
601
+ ]
602
+ },
603
+ {
604
+ "title": "尺寸",
605
+ "option": [
606
+ {
607
+ "title": "3層"
608
+ },
609
+ {
610
+ "title": "4層"
611
+ },
612
+ {
613
+ "title": "5層"
614
+ }
615
+ ]
616
+ }
617
+ ],
618
+ "title": "摩根鋼架書架 ( 贈品 )",
619
+ "token": {
620
+ "exp": 1764244210,
621
+ "iat": 1732708210,
622
+ "userID": 122538856,
623
+ "account": "rdtest",
624
+ "userData": {}
625
+ },
626
+ "status": "active",
627
+ "content": "摩根鋼架書架,完美擺放您的書籍與裝飾品,適合不同空間需求,提供不同顏色及層數選擇。",
628
+ "visible": "true",
629
+ "template": "",
630
+ "variants": [
631
+ {
632
+ "sku": "",
633
+ "cost": 0,
634
+ "spec": [
635
+ "黑色",
636
+ "3層"
637
+ ],
638
+ "type": "variants",
639
+ "stock": 0,
640
+ "profit": 0,
641
+ "weight": "1",
642
+ "barcode": "",
643
+ "v_width": 0,
644
+ "editable": false,
645
+ "v_height": 0,
646
+ "v_length": 0,
647
+ "product_id": 739,
648
+ "sale_price": 1500,
649
+ "compare_price": 0,
650
+ "preview_image": "",
651
+ "shipment_type": "weight",
652
+ "shipment_weight": 0,
653
+ "show_understocking": "false"
654
+ },
655
+ {
656
+ "sku": "",
657
+ "cost": 0,
658
+ "spec": [
659
+ "黑色",
660
+ "4層"
661
+ ],
662
+ "type": "variants",
663
+ "stock": 0,
664
+ "profit": 0,
665
+ "weight": "1",
666
+ "barcode": "",
667
+ "v_width": 0,
668
+ "editable": false,
669
+ "v_height": 0,
670
+ "v_length": 0,
671
+ "product_id": 739,
672
+ "sale_price": 1300,
673
+ "compare_price": 0,
674
+ "preview_image": "",
675
+ "shipment_type": "weight",
676
+ "shipment_weight": 0,
677
+ "show_understocking": "false"
678
+ },
679
+ {
680
+ "sku": "",
681
+ "cost": 0,
682
+ "spec": [
683
+ "黑色",
684
+ "5層"
685
+ ],
686
+ "type": "variants",
687
+ "stock": 0,
688
+ "profit": 0,
689
+ "weight": "1",
690
+ "barcode": "",
691
+ "v_width": 0,
692
+ "editable": false,
693
+ "v_height": 0,
694
+ "v_length": 0,
695
+ "product_id": 739,
696
+ "sale_price": 1000,
697
+ "compare_price": 0,
698
+ "preview_image": "",
699
+ "shipment_type": "weight",
700
+ "shipment_weight": 0,
701
+ "show_understocking": "false"
702
+ },
703
+ {
704
+ "sku": "",
705
+ "cost": 0,
706
+ "spec": [
707
+ "白色",
708
+ "3層"
709
+ ],
710
+ "type": "variants",
711
+ "stock": 0,
712
+ "profit": 0,
713
+ "weight": "1",
714
+ "barcode": "",
715
+ "v_width": 0,
716
+ "editable": false,
717
+ "v_height": 0,
718
+ "v_length": 0,
719
+ "product_id": 739,
720
+ "sale_price": 1000,
721
+ "compare_price": 0,
722
+ "preview_image": "",
723
+ "shipment_type": "weight",
724
+ "shipment_weight": 0,
725
+ "show_understocking": "false"
726
+ },
727
+ {
728
+ "sku": "",
729
+ "cost": 0,
730
+ "spec": [
731
+ "白色",
732
+ "4層"
733
+ ],
734
+ "type": "variants",
735
+ "stock": 0,
736
+ "profit": 0,
737
+ "weight": "1",
738
+ "barcode": "",
739
+ "v_width": 0,
740
+ "editable": false,
741
+ "v_height": 0,
742
+ "v_length": 0,
743
+ "product_id": 739,
744
+ "sale_price": 1000,
745
+ "compare_price": 0,
746
+ "preview_image": "",
747
+ "shipment_type": "weight",
748
+ "shipment_weight": 0,
749
+ "show_understocking": "false"
750
+ },
751
+ {
752
+ "sku": "",
753
+ "cost": 0,
754
+ "spec": [
755
+ "白色",
756
+ "5層"
757
+ ],
758
+ "type": "variants",
759
+ "stock": 0,
760
+ "profit": 0,
761
+ "weight": "1",
762
+ "barcode": "",
763
+ "v_width": 0,
764
+ "editable": false,
765
+ "v_height": 0,
766
+ "v_length": 0,
767
+ "product_id": 739,
768
+ "sale_price": 1000,
769
+ "compare_price": 0,
770
+ "preview_image": "",
771
+ "shipment_type": "weight",
772
+ "shipment_weight": 0,
773
+ "show_understocking": "false"
774
+ },
775
+ {
776
+ "sku": "",
777
+ "cost": 0,
778
+ "spec": [
779
+ "灰色",
780
+ "3層"
781
+ ],
782
+ "type": "variants",
783
+ "stock": 0,
784
+ "profit": 0,
785
+ "weight": "1",
786
+ "barcode": "",
787
+ "v_width": 0,
788
+ "editable": false,
789
+ "v_height": 0,
790
+ "v_length": 0,
791
+ "product_id": 739,
792
+ "sale_price": 1000,
793
+ "compare_price": 0,
794
+ "preview_image": "",
795
+ "shipment_type": "weight",
796
+ "shipment_weight": 0,
797
+ "show_understocking": "false"
798
+ },
799
+ {
800
+ "sku": "",
801
+ "cost": 0,
802
+ "spec": [
803
+ "灰色",
804
+ "4層"
805
+ ],
806
+ "type": "variants",
807
+ "stock": 0,
808
+ "profit": 0,
809
+ "weight": "1",
810
+ "barcode": "",
811
+ "v_width": 0,
812
+ "editable": false,
813
+ "v_height": 0,
814
+ "v_length": 0,
815
+ "product_id": 739,
816
+ "sale_price": 1000,
817
+ "compare_price": 0,
818
+ "preview_image": "",
819
+ "shipment_type": "weight",
820
+ "shipment_weight": 0,
821
+ "show_understocking": "false"
822
+ },
823
+ {
824
+ "sku": "",
825
+ "cost": 0,
826
+ "spec": [
827
+ "灰色",
828
+ "5層"
829
+ ],
830
+ "type": "variants",
831
+ "stock": 0,
832
+ "profit": 0,
833
+ "weight": "1",
834
+ "barcode": "",
835
+ "v_width": 0,
836
+ "editable": false,
837
+ "v_height": 0,
838
+ "v_length": 0,
839
+ "product_id": 739,
840
+ "sale_price": 1000,
841
+ "compare_price": 0,
842
+ "preview_image": "",
843
+ "shipment_type": "weight",
844
+ "shipment_weight": 0,
845
+ "show_understocking": "false"
846
+ }
847
+ ],
848
+ "hideIndex": "false",
849
+ "max_price": 1500,
850
+ "min_price": 1000,
851
+ "collection": [],
852
+ "productType": {
853
+ "product": false,
854
+ "giveaway": true,
855
+ "addProduct": false
856
+ },
857
+ "content_json": [],
858
+ "in_wish_list": false,
859
+ "content_array": [],
860
+ "preview_image": [
861
+ "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0412.09.55-AmodernMorgansteel-framebookshelfwithaminimalist,industrialdesign.Thebookshelffeaturessturdy,darkmetalframeswithmultipleopenwood.webp"
862
+ ],
863
+ "relative_product": [],
864
+ "voucher_id": 738,
865
+ "have_select": true
866
+ }
314
867
  ],
315
868
  "bind": [
316
869
  {
317
870
  "spec": [
318
871
  "黑色",
319
- "小型"
872
+ "小號"
320
873
  ],
321
- "id": 732,
322
- "count": 1,
323
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
324
- "title": "鱷魚皮沙發doiwq",
325
- "sale_price": 25000,
874
+ "id": 710,
875
+ "count": 5,
876
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
877
+ "title": "溫德米爾 茶几",
878
+ "sale_price": 1800,
326
879
  "collection": [
327
880
  "折扣專區",
328
881
  "熱門商品",
329
882
  "熱門商品 / 夏季限定"
330
883
  ],
331
- "sku": "133",
332
- "shipment_obj": {
333
- "type": "weight",
334
- "value": 100
335
- },
336
- "discount_price": 38,
337
- "rebate": 0
338
- },
339
- {
340
- "spec": [
341
- "米色",
342
- "標準"
343
- ],
344
- "id": 735,
345
- "count": 10,
346
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
347
- "title": "維也納 布藝雙人床 ( 加購品 )",
348
- "sale_price": 3200,
349
- "collection": [],
350
884
  "sku": "",
351
885
  "shipment_obj": {
352
- "type": "weight",
353
- "value": 10
886
+ "type": "volume",
887
+ "value": 600
354
888
  },
355
- "is_add_on_items": true,
356
- "discount_price": 5,
889
+ "discount_price": 17.6,
357
890
  "rebate": 0
358
891
  }
359
892
  ],
360
893
  "times": 1,
361
- "bind_subtotal": 57000,
894
+ "bind_subtotal": 9000,
362
895
  "discount_total": 0,
363
- "rebate_total": 0
896
+ "rebate_total": 0,
897
+ "select_gif": {
898
+ "spec": [
899
+ "淺木色",
900
+ "4人座"
901
+ ],
902
+ "id": 737,
903
+ "count": 1,
904
+ "voucher_id": 738
905
+ }
364
906
  }
365
907
  ],
366
908
  "distribution_info": {
@@ -538,6 +1080,12 @@ export class CheckoutIndex {
538
1080
  <div class="${gClass('add-item-text')}">加購品</div>
539
1081
  </div>`;
540
1082
  }
1083
+ function giftBadge() {
1084
+ return html `
1085
+ <div class="${gClass('add-item-badge')}" style="background: #95ffe0;">
1086
+ <div class="${gClass('add-item-text')}">贈品</div>
1087
+ </div>`;
1088
+ }
541
1089
  function addStyle() {
542
1090
  gvc.addStyle(css `
543
1091
  .${classPrefix}-container {
@@ -941,21 +1489,35 @@ export class CheckoutIndex {
941
1489
  });
942
1490
  }
943
1491
  }
1492
+ function getBadgeClass() {
1493
+ if (item.is_add_on_items) {
1494
+ return addItemBadge();
1495
+ }
1496
+ else if (item.is_gift) {
1497
+ return giftBadge();
1498
+ }
1499
+ else {
1500
+ return ``;
1501
+ }
1502
+ }
944
1503
  return html `
945
1504
  <div class="d-flex flex-column border-bottom p-lg-3 px-1 py-3 gap-3">
946
1505
  <div class="d-flex w-100 position-relative"
947
1506
  style="gap:20px;">
948
1507
  <div class="${gClass('first-td')} justify-content-start d-sm-none">
949
1508
  <div style="width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"></div>
950
- <span class="ms-2 d-none">${item.is_add_on_items ? addItemBadge() : ''}${item.title}</span>
1509
+ <span class="ms-2 d-none">${getBadgeClass()}${item.title}</span>
951
1510
  </div>
952
1511
  <div class="d-flex flex-sm-row flex-column w-100 position-relative"
953
1512
  style="gap: 8px; position: relative;">
954
- <div class="${gClass('first-td')} justify-content-start d-none d-sm-flex" style="">
1513
+ <div class="${gClass('first-td')} justify-content-start d-none d-sm-flex"
1514
+ style="">
955
1515
  <div style="width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"></div>
956
- <span class="ms-2 d-flex align-items-start flex-column " style="gap:5px;">${item.is_add_on_items ? addItemBadge() : ''}${item.title}</span>
1516
+ <span class="ms-2 d-flex align-items-start flex-column "
1517
+ style="gap:5px;">${getBadgeClass()}${item.title}</span>
957
1518
  </div>
958
- <span class="d-flex align-items-start flex-column d-lg-none fw-bold" style="gap:5px;font-size:17px;">${item.is_add_on_items ? addItemBadge() : ''}${item.title}</span>
1519
+ <span class="d-flex align-items-start flex-column d-lg-none fw-bold"
1520
+ style="gap:5px;font-size:17px;">${getBadgeClass()}${item.title}</span>
959
1521
  <div class="${gClass('td')}">
960
1522
  ${item.spec ? item.spec.join(' / ') : ''}
961
1523
  </div>
@@ -963,6 +1525,9 @@ export class CheckoutIndex {
963
1525
  style="gap:10px;">
964
1526
  <div class="">
965
1527
  ${(() => {
1528
+ if (item.is_gift) {
1529
+ return `NT.0`;
1530
+ }
966
1531
  return `NT.${parseInt(item.sale_price, 10).toLocaleString()}`;
967
1532
  })()}
968
1533
  </div>
@@ -979,6 +1544,8 @@ export class CheckoutIndex {
979
1544
  refreshCartData();
980
1545
  });
981
1546
  })}"
1547
+ ${item.is_gift ? `disabled` : ``}
1548
+
982
1549
  >
983
1550
  ${[...new Array(99)].map((_, index) => {
984
1551
  return html `
@@ -986,7 +1553,7 @@ export class CheckoutIndex {
986
1553
  ${(index + 1 === item.count) ? `selected` : ``}>
987
1554
  ${index + 1}
988
1555
  </option>`;
989
- })}
1556
+ }).join('')}
990
1557
  </select>
991
1558
  </div>
992
1559
  <div class="d-block d-md-none"
@@ -1027,7 +1594,7 @@ export class CheckoutIndex {
1027
1594
  ${vm.cartData.voucherList.filter((dd) => {
1028
1595
  return dd.bind.find((d2) => {
1029
1596
  return d2.id === item.id;
1030
- });
1597
+ }) && (dd.reBackType !== 'giveaway') && (dd.reBackType !== 'add_on_items');
1031
1598
  }).map((dd) => {
1032
1599
  return `<div class="fs-6 w-100 " ><i class="fa-solid fa-tickets-perforated me-2"></i>${dd.title}</div>`;
1033
1600
  }).join('<div class="my-1"></div>')}
@@ -1435,37 +2002,51 @@ export class CheckoutIndex {
1435
2002
 
1436
2003
  </div>
1437
2004
  </section>
1438
-
1439
- ${(() => {
1440
- let add_on = [];
1441
- vm.cartData.voucherList.filter((dd) => {
1442
- if (dd.reBackType === 'add_on_items') {
1443
- add_on = add_on.concat(dd.add_on_products);
2005
+ `;
2006
+ },
2007
+ };
2008
+ })())}
2009
+ <section class="border-bottom"></section>
2010
+ <section class="d-flex">
2011
+ <div class="flex-fill"></div>
2012
+ <div class="${gClass('price-container')}">
2013
+ <div class="${gClass(['price-row', 'text-1', 'bold'])}">
2014
+ <div>總金額</div>
2015
+ <div>NT. ${vm.cartData.total.toLocaleString()}</div>
2016
+ </div>
2017
+ </div>
2018
+ </section>
2019
+ <!--加購品-->
2020
+ ${(() => {
2021
+ let add_on = [];
2022
+ vm.cartData.voucherList.filter((dd) => {
2023
+ if (dd.reBackType === 'add_on_items') {
2024
+ add_on = add_on.concat(dd.add_on_products);
2025
+ }
2026
+ });
2027
+ if (add_on.length) {
2028
+ return gvc.bindView(() => {
2029
+ const id = gvc.glitter.getUUID();
2030
+ return {
2031
+ bind: id,
2032
+ view: () => __awaiter(this, void 0, void 0, function* () {
2033
+ const add_products = (yield ApiShop.getProduct({
2034
+ page: 0,
2035
+ limit: 100,
2036
+ productType: 'addProduct',
2037
+ id_list: add_on.join(',')
2038
+ }));
2039
+ if (!add_products.response.data.length) {
2040
+ return ``;
1444
2041
  }
1445
- });
1446
- if (add_on.length) {
1447
- return gvc.bindView(() => {
1448
- const id = gvc.glitter.getUUID();
1449
- return {
1450
- bind: id,
1451
- view: () => __awaiter(this, void 0, void 0, function* () {
1452
- const add_products = (yield ApiShop.getProduct({
1453
- page: 0,
1454
- limit: 100,
1455
- productType: 'addProduct',
1456
- id_list: add_on.join(',')
1457
- }));
1458
- if (!add_products.response.data.length) {
1459
- return ``;
1460
- }
1461
- return html `
2042
+ return html `
1462
2043
  <div class="${gClass('banner-bgr')}">
1463
2044
  <span class="${gClass('banner-text')}">可加購商品</span>
1464
2045
  </div>
1465
2046
  <div class="d-flex align-items-center w-100"
1466
2047
  style="overflow-x:auto;gap:10px;">
1467
2048
  ${add_products.response.data.map((dd) => {
1468
- return html `
2049
+ return html `
1469
2050
  <div class="d-flex py-3 align-items-center"
1470
2051
  style="gap:10px;">
1471
2052
  <div class="img-fluid "
@@ -1476,7 +2057,7 @@ export class CheckoutIndex {
1476
2057
  background-position: center;
1477
2058
  background-size: cover;
1478
2059
  background-repeat: no-repeat;
1479
- background-image: url(${dd.content.preview_image[0]});"></div>
2060
+ background-image: url('${dd.content.preview_image[0]}');"></div>
1480
2061
  <div class="d-flex flex-column"
1481
2062
  style="gap:5px;">
1482
2063
  <div class="${gClass('banner-text')}"
@@ -1496,9 +2077,9 @@ export class CheckoutIndex {
1496
2077
  </div>
1497
2078
  <button class="${gClass('button-bgr')} mb-0 mt-2"
1498
2079
  onclick="${gvc.event(() => {
1499
- return gvc.glitter.innerDialog((gvc) => {
1500
- var _a, _b;
1501
- return html `
2080
+ return gvc.glitter.innerDialog((gvc) => {
2081
+ var _a, _b;
2082
+ return html `
1502
2083
  <div
1503
2084
  class="bg-white shadow rounded-3"
1504
2085
  style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
@@ -1512,8 +2093,8 @@ export class CheckoutIndex {
1512
2093
  class="fa-regular fa-circle-xmark fs-5 text-dark"
1513
2094
  style="cursor: pointer"
1514
2095
  onclick="${gvc.event(() => {
1515
- gvc.closeDialog();
1516
- })}"
2096
+ gvc.closeDialog();
2097
+ })}"
1517
2098
  ></i>
1518
2099
  </div>
1519
2100
  <div class="c_dialog">
@@ -1521,61 +2102,190 @@ export class CheckoutIndex {
1521
2102
  <div class="c_dialog_main"
1522
2103
  style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
1523
2104
  ${PdClass.selectSpec({
1524
- gvc,
1525
- titleFontColor: (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333',
1526
- prod: dd.content,
1527
- vm: {
1528
- specs: dd.content.specs.map((spec) => {
1529
- return spec.option[0].title;
1530
- }),
1531
- quantity: '1',
1532
- wishStatus: ((_b = glitter.share.wishList) !== null && _b !== void 0 ? _b : []).some((item) => {
1533
- return item.id === dd.id;
1534
- })
1535
- },
1536
- callback: () => {
1537
- gvc.closeDialog();
1538
- refreshCartData();
1539
- }
1540
- })}
2105
+ gvc,
2106
+ titleFontColor: (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333',
2107
+ prod: dd.content,
2108
+ vm: {
2109
+ specs: dd.content.specs.map((spec) => {
2110
+ return spec.option[0].title;
2111
+ }),
2112
+ quantity: '1',
2113
+ wishStatus: ((_b = glitter.share.wishList) !== null && _b !== void 0 ? _b : []).some((item) => {
2114
+ return item.id === dd.id;
2115
+ })
2116
+ },
2117
+ callback: () => {
2118
+ gvc.closeDialog();
2119
+ refreshCartData();
2120
+ }
2121
+ })}
1541
2122
  </div>
1542
2123
  </div>
1543
2124
  </div>
1544
2125
  </div>
1545
2126
  </div>`;
1546
- }, Tool.randomString(7));
1547
- })}">
2127
+ }, Tool.randomString(7));
2128
+ })}">
1548
2129
  <span class="${gClass('button-text')}">加入購物車</span>
1549
2130
  </button>
1550
2131
  </div>
1551
2132
  </div>`;
1552
- }).join('')}
2133
+ }).join('')}
1553
2134
  </div>
1554
2135
  `;
1555
- })
1556
- };
1557
- });
1558
- }
1559
- else {
1560
- return ``;
1561
- }
1562
- return ``;
1563
- })()}
1564
-
1565
- `;
1566
- },
1567
- };
1568
- })())}
1569
- <section class="border-bottom"></section>
1570
- <section class="d-flex">
1571
- <div class="flex-fill"></div>
1572
- <div class="${gClass('price-container')}">
1573
- <div class="${gClass(['price-row', 'text-1', 'bold'])}">
1574
- <div>總金額</div>
1575
- <div>NT. ${vm.cartData.total.toLocaleString()}</div>
1576
- </div>
1577
- </div>
1578
- </section>
2136
+ })
2137
+ };
2138
+ });
2139
+ }
2140
+ else {
2141
+ return ``;
2142
+ }
2143
+ return ``;
2144
+ })()}
2145
+ <!--贈品-->
2146
+ ${(() => {
2147
+ let already_add = vm.cartData.lineItems.filter((dd) => {
2148
+ return dd.is_gift;
2149
+ });
2150
+ return vm.cartData.voucherList.filter((d1) => {
2151
+ return d1.reBackType === 'giveaway';
2152
+ }).map((dd) => {
2153
+ let isSelected = already_add.find((d2) => {
2154
+ return dd.add_on_products.find((d1) => {
2155
+ return d1.id === d2.id;
2156
+ });
2157
+ });
2158
+ already_add = already_add.filter((dd) => {
2159
+ return !dd === isSelected;
2160
+ });
2161
+ return html `
2162
+ <div class="${gClass('banner-bgr')}">
2163
+ <span class="${gClass('banner-text')}">${dd.title}</span>
2164
+ </div>
2165
+ <div class="d-flex align-items-center w-100"
2166
+ style="overflow-x:auto;gap:10px;">
2167
+ ${dd.add_on_products.map((pd) => {
2168
+ try {
2169
+ return html `
2170
+ <div class="d-flex py-3 align-items-center"
2171
+ style="gap:10px;">
2172
+ <div class="img-fluid "
2173
+ style="width: 106px;
2174
+ min-width: 106px;
2175
+ height: 106px;
2176
+ border-radius: 3px;
2177
+ background-position: center;
2178
+ background-size: cover;
2179
+ background-repeat: no-repeat;
2180
+ background-image: url('${pd.preview_image[0]}');"></div>
2181
+ <div class="d-flex flex-column"
2182
+ style="gap:5px;">
2183
+ <div class="${gClass('banner-text')}"
2184
+ style="font-size: 15px;
2185
+ font-style: normal;
2186
+ font-weight: 400;
2187
+ white-space: nowrap;
2188
+ overflow: hidden;
2189
+ max-width: 130px;
2190
+ text-overflow: ellipsis;">${pd.title}
2191
+ </div>
2192
+ <div class="text-decoration-line-through text-danger"
2193
+ style="font-size: 14px;
2194
+ font-style: normal;
2195
+ font-weight: 700;
2196
+ line-height: 140%;">NT.${pd.min_price.toLocaleString()}
2197
+ </div>
2198
+ <button class="${gClass('button-bgr')} mb-0 mt-2"
2199
+ style="${(isSelected ? ((isSelected.id === pd.id) ? `background: gray !important;` : ``) : ``)}"
2200
+ onclick="${gvc.event(() => {
2201
+ if (isSelected && (isSelected.id === pd.id)) {
2202
+ return;
2203
+ }
2204
+ return gvc.glitter.innerDialog((gvc) => {
2205
+ var _a, _b;
2206
+ return html `
2207
+ <div
2208
+ class="bg-white shadow rounded-3"
2209
+ style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
2210
+ >
2211
+ <div class="bg-white shadow rounded-3"
2212
+ style="width: 100%; overflow-y: auto; position: relative;">
2213
+ <div class="w-100 d-flex align-items-center p-3 border-bottom"
2214
+ style="position: sticky; top: 0; background: #fff;">
2215
+ <div class="flex-fill"></div>
2216
+ <i
2217
+ class="fa-regular fa-circle-xmark fs-5 text-dark"
2218
+ style="cursor: pointer"
2219
+ onclick="${gvc.event(() => {
2220
+ gvc.closeDialog();
2221
+ })}"
2222
+ ></i>
2223
+ </div>
2224
+ <div class="c_dialog">
2225
+ <div class="c_dialog_body">
2226
+ <div class="c_dialog_main"
2227
+ style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
2228
+ ${PdClass.selectSpec({
2229
+ gvc,
2230
+ titleFontColor: (_a = glitter.share.globalValue['theme_color.0.title']) !== null && _a !== void 0 ? _a : '#333333',
2231
+ prod: pd,
2232
+ vm: {
2233
+ specs: pd.specs.map((spec) => {
2234
+ return spec.option[0].title;
2235
+ }),
2236
+ quantity: '1',
2237
+ wishStatus: ((_b = glitter.share.wishList) !== null && _b !== void 0 ? _b : []).some((item) => {
2238
+ return item.id === dd.id;
2239
+ })
2240
+ },
2241
+ with_qty: false,
2242
+ callback: () => {
2243
+ let find = vm.cartData.lineItems.find((d1) => {
2244
+ return dd.add_on_products.find((d2) => {
2245
+ return d2.id === d1.id;
2246
+ });
2247
+ });
2248
+ if (find) {
2249
+ ApiCart.setCart((cartItem) => {
2250
+ cartItem.line_items.map((dd) => {
2251
+ if (dd.id === find.id) {
2252
+ dd.count--;
2253
+ }
2254
+ });
2255
+ cartItem.line_items = cartItem.line_items.filter((dd) => {
2256
+ return dd.count > 0;
2257
+ });
2258
+ refreshCartData();
2259
+ gvc.closeDialog();
2260
+ });
2261
+ }
2262
+ else {
2263
+ refreshCartData();
2264
+ gvc.closeDialog();
2265
+ }
2266
+ }
2267
+ })}
2268
+ </div>
2269
+ </div>
2270
+ </div>
2271
+ </div>
2272
+ </div>`;
2273
+ }, Tool.randomString(7));
2274
+ })}">
2275
+
2276
+ <span class="${gClass('button-text')}">${isSelected ? ((isSelected.id === pd.id) ? `已選擇` : `更換贈品`) : `選擇贈品`}</span>
2277
+ </button>
2278
+ </div>
2279
+ </div>`;
2280
+ }
2281
+ catch (e) {
2282
+ console.log(e);
2283
+ }
2284
+ }).join('')}
2285
+ </div>
2286
+ `;
2287
+ }).join('');
2288
+ })()}
1579
2289
  <section>
1580
2290
  <div class="${gClass('banner-bgr')}">
1581
2291
  <span class="${gClass('banner-text')}">付款及配送方式</span>
@@ -2399,14 +3109,20 @@ export class CheckoutIndex {
2399
3109
  distribution_code: ApiCart.cart.distribution_code,
2400
3110
  give_away: ApiCart.cart.give_away
2401
3111
  }).then((res) => {
3112
+ dialog.dataLoading({ visible: false });
2402
3113
  if (res.response.off_line || res.response.is_free) {
2403
3114
  ApiCart.clearCart();
2404
3115
  location.href = res.response.return_url;
2405
3116
  }
2406
3117
  else {
2407
- const id = gvc.glitter.getUUID();
2408
- $('body').append(`<div id="${id}" style="display: none;">${res.response.form}</div>`);
2409
- document.querySelector(`#${id} #submit`).click();
3118
+ if (res.response.form.approveLink) {
3119
+ location.href = res.response.form.approveLink;
3120
+ }
3121
+ else {
3122
+ const id = gvc.glitter.getUUID();
3123
+ $('body').append(`<div id="${id}" style="display: none;">${res.response.form}</div>`);
3124
+ document.querySelector(`#${id} #submit`).click();
3125
+ }
2410
3126
  ApiCart.clearCart();
2411
3127
  }
2412
3128
  });
@@ -2425,6 +3141,31 @@ export class CheckoutIndex {
2425
3141
  },
2426
3142
  divCreate: {},
2427
3143
  onCreate: () => {
3144
+ Ad.gtagEvent('view_cart', {
3145
+ currency: 'TWD',
3146
+ value: vm.cartData.total,
3147
+ items: vm.cartData.lineItems.map((item) => {
3148
+ return {
3149
+ item_id: item.id,
3150
+ item_name: item.title,
3151
+ item_variant: item.spec.join('-'),
3152
+ price: item.sale_price,
3153
+ quantity: item.count,
3154
+ discount: item.discount_price,
3155
+ };
3156
+ }),
3157
+ });
3158
+ Ad.fbqEvent('AddPaymentInfo', {
3159
+ value: vm.cartData.total,
3160
+ currency: 'TWD',
3161
+ contents: vm.cartData.lineItems.map((item) => {
3162
+ return {
3163
+ id: item.id,
3164
+ quantity: item.count,
3165
+ };
3166
+ }),
3167
+ content_ids: vm.cartData.lineItems.map((item) => item.id),
3168
+ });
2428
3169
  },
2429
3170
  };
2430
3171
  })());
@@ -2494,13 +3235,19 @@ export class CheckoutIndex {
2494
3235
  })()) {
2495
3236
  widget.event('error', { title: `請輸入「${FormWidget.checkLeakData(cartData.custom_form_format, cartData.custom_form_data)}」` });
2496
3237
  }
2497
- else if (cartData.voucherList
2498
- .filter((dd) => {
2499
- return dd.reBackType === 'giveaway';
2500
- })
2501
- .find((dd) => {
2502
- return !dd.select_gif.id;
2503
- })) {
3238
+ else if ((() => {
3239
+ let gift_need = cartData.voucherList
3240
+ .filter((dd) => {
3241
+ return dd.reBackType === 'giveaway';
3242
+ }).length;
3243
+ let gift = 0;
3244
+ cartData.lineItems.filter((dd) => {
3245
+ return dd.is_gift;
3246
+ }).map((dd) => {
3247
+ gift += dd.count;
3248
+ });
3249
+ return gift < gift_need;
3250
+ })()) {
2504
3251
  widget.event('error', { title: '請選擇「贈品」' });
2505
3252
  }
2506
3253
  else {
@@ -2511,23 +3258,32 @@ export class CheckoutIndex {
2511
3258
  checkString(subData.phone, '收件人電話', 'phone');
2512
3259
  checkString(subData.email, '收件人信箱', 'email');
2513
3260
  if (pass) {
2514
- if (window.gtag) {
2515
- window.gtag('event', 'begin_checkout', {
2516
- currency: 'TWD',
2517
- value: cartData.total,
2518
- coupon: (_a = cartData.code) !== null && _a !== void 0 ? _a : '',
2519
- items: cartData.lineItems.map((item) => {
2520
- return {
2521
- item_id: item.id,
2522
- item_name: item.title,
2523
- item_variant: item.spec.join('-'),
2524
- price: item.sale_price,
2525
- quantity: item.count,
2526
- discount: item.discount_price,
2527
- };
2528
- }),
2529
- });
2530
- }
3261
+ Ad.gtagEvent('begin_checkout', {
3262
+ currency: 'TWD',
3263
+ value: cartData.total,
3264
+ coupon: (_a = cartData.code) !== null && _a !== void 0 ? _a : '',
3265
+ items: cartData.lineItems.map((item) => {
3266
+ return {
3267
+ item_id: item.id,
3268
+ item_name: item.title,
3269
+ item_variant: item.spec.join('-'),
3270
+ price: item.sale_price,
3271
+ quantity: item.count,
3272
+ discount: item.discount_price,
3273
+ };
3274
+ }),
3275
+ });
3276
+ Ad.fbqEvent('Purchase', {
3277
+ value: cartData.total,
3278
+ currency: 'TWD',
3279
+ contents: cartData.lineItems.map((item) => {
3280
+ return {
3281
+ id: item.id,
3282
+ quantity: item.count,
3283
+ };
3284
+ }),
3285
+ content_type: 'product',
3286
+ });
2531
3287
  resolve(subData);
2532
3288
  }
2533
3289
  }
@@ -2622,11 +3378,13 @@ export class CheckoutIndex {
2622
3378
  localStorage.setItem('checkout-payment', cartData.customer_info.payment_select);
2623
3379
  localStorage.setItem('custom_form_data', JSON.stringify(cartData.custom_form_data));
2624
3380
  localStorage.setItem('custom_user_info', JSON.stringify(cartData.user_info));
3381
+ localStorage.setItem('give_away', JSON.stringify(cartData.give_away));
2625
3382
  }
2626
3383
  static initial(cartData) {
2627
3384
  cartData.customer_info = JSON.parse(localStorage.getItem('cart_customer_info') || "{}");
2628
3385
  cartData.custom_form_data = JSON.parse(localStorage.getItem('custom_form_data') || "{}");
2629
3386
  cartData.user_info = JSON.parse(localStorage.getItem('custom_user_info') || "{}");
3387
+ cartData.give_away = JSON.parse(localStorage.getItem('give_away') || "[]");
2630
3388
  this.getPaymentMethod(cartData);
2631
3389
  this.getShipmentMethod(cartData);
2632
3390
  }