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
@@ -12,6 +12,8 @@ import {FormWidget} from "../../official_view_component/official/form.js";
12
12
  import {ShareDialog} from "../../glitterBundle/dialog/ShareDialog.js";
13
13
  import {Voucher as OriginVoucher, VoucherContent} from '../user-manager/um-voucher.js'
14
14
  import {PdClass} from "../product/pd-class.js";
15
+ import * as vm from "node:vm";
16
+ import {Ad} from "../public/ad.js";
15
17
 
16
18
  const html = String.raw;
17
19
  const css = String.raw;
@@ -41,56 +43,36 @@ export class CheckoutIndex {
41
43
  {
42
44
  "spec": [
43
45
  "黑色",
44
- "小型"
46
+ "小號"
45
47
  ],
46
- "id": 732,
47
- "count": 1,
48
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
49
- "title": "鱷魚皮沙發doiwq",
50
- "sale_price": 25000,
48
+ "id": 710,
49
+ "count": 5,
50
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
51
+ "title": "溫德米爾 茶几",
52
+ "sale_price": 1800,
51
53
  "collection": [
52
54
  "折扣專區",
53
55
  "熱門商品",
54
56
  "熱門商品 / 夏季限定"
55
57
  ],
56
- "sku": "133",
57
- "shipment_obj": {
58
- "type": "weight",
59
- "value": 100
60
- },
61
- "discount_price": 38,
62
- "rebate": 0
63
- },
64
- {
65
- "spec": [
66
- "米色",
67
- "標準"
68
- ],
69
- "id": 735,
70
- "count": 10,
71
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
72
- "title": "維也納 布藝雙人床 ( 加購品 )",
73
- "sale_price": 3200,
74
- "collection": [],
75
58
  "sku": "",
76
59
  "shipment_obj": {
77
- "type": "weight",
78
- "value": 10
60
+ "type": "volume",
61
+ "value": 600
79
62
  },
80
- "is_add_on_items": true,
81
- "discount_price": 5,
63
+ "discount_price": 17.6,
82
64
  "rebate": 0
83
65
  }
84
66
  ],
85
- "total": 57412,
67
+ "total": 9212,
86
68
  "email": "sam38124@gmail.com",
87
69
  "user_info": {
88
- "shipment": "sescsbsfs4s2s4sf"
70
+ "shipment": "shop"
89
71
  },
90
- "shipment_fee": 500,
72
+ "shipment_fee": 300,
91
73
  "rebate": 0,
92
74
  "use_rebate": 0,
93
- "orderID": "1732706322131",
75
+ "orderID": "1732712547962",
94
76
  "shipment_support": [
95
77
  "OKMARTC2C",
96
78
  "shop",
@@ -199,7 +181,17 @@ export class CheckoutIndex {
199
181
  },
200
182
  "orderSource": "",
201
183
  "code_array": [],
202
- "give_away": [],
184
+ "give_away": [
185
+ {
186
+ "id": 737,
187
+ "spec": [
188
+ "淺木色",
189
+ "4人座"
190
+ ],
191
+ "count": 1,
192
+ "voucher_id": 738
193
+ }
194
+ ],
203
195
  "user_rebate_sum": 39807,
204
196
  "voucherList": [
205
197
  {
@@ -238,59 +230,39 @@ export class CheckoutIndex {
238
230
  {
239
231
  "spec": [
240
232
  "黑色",
241
- "小型"
233
+ "小號"
242
234
  ],
243
- "id": 732,
244
- "count": 1,
245
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
246
- "title": "鱷魚皮沙發doiwq",
247
- "sale_price": 25000,
235
+ "id": 710,
236
+ "count": 5,
237
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
238
+ "title": "溫德米爾 茶几",
239
+ "sale_price": 1800,
248
240
  "collection": [
249
241
  "折扣專區",
250
242
  "熱門商品",
251
243
  "熱門商品 / 夏季限定"
252
244
  ],
253
- "sku": "133",
254
- "shipment_obj": {
255
- "type": "weight",
256
- "value": 100
257
- },
258
- "discount_price": 38,
259
- "rebate": 0
260
- },
261
- {
262
- "spec": [
263
- "米色",
264
- "標準"
265
- ],
266
- "id": 735,
267
- "count": 10,
268
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
269
- "title": "維也納 布藝雙人床 ( 加購品 )",
270
- "sale_price": 3200,
271
- "collection": [],
272
245
  "sku": "",
273
246
  "shipment_obj": {
274
- "type": "weight",
275
- "value": 10
247
+ "type": "volume",
248
+ "value": 600
276
249
  },
277
- "is_add_on_items": true,
278
- "discount_price": 5,
250
+ "discount_price": 17.6,
279
251
  "rebate": 0
280
252
  }
281
253
  ],
282
254
  "times": 1,
283
- "bind_subtotal": 57000,
255
+ "bind_subtotal": 9000,
284
256
  "discount_total": 88,
285
257
  "rebate_total": 0
286
258
  },
287
259
  {
288
- "id": 736,
260
+ "id": 738,
289
261
  "for": "all",
290
262
  "code": "",
291
263
  "rule": "min_price",
292
264
  "type": "voucher",
293
- "title": "test",
265
+ "title": "滿100贈送",
294
266
  "value": "0",
295
267
  "device": [
296
268
  "normal"
@@ -304,68 +276,639 @@ export class CheckoutIndex {
304
276
  "trigger": "auto",
305
277
  "counting": "single",
306
278
  "ruleValue": 1000,
307
- "startDate": "2024-11-27",
308
- "startTime": "14:00",
309
- "reBackType": "add_on_items",
279
+ "startDate": "2024-11-20",
280
+ "startTime": "20:00",
281
+ "reBackType": "giveaway",
310
282
  "targetList": [],
311
283
  "end_ISO_Date": "",
312
284
  "macroLimited": 0,
313
285
  "microLimited": 0,
314
286
  "rebateEndDay": "30",
315
287
  "conditionType": "order",
316
- "start_ISO_Date": "2024-11-27T06:00:00.000Z",
288
+ "start_ISO_Date": "2024-11-20T12:00:00.000Z",
317
289
  "add_on_products": [
318
- 735
290
+ {
291
+ "id": 737,
292
+ "seo": {
293
+ "title": "北歐風實木餐桌 - 優雅的餐桌選擇",
294
+ "domain": "北歐風實木餐桌 ( 贈品 )",
295
+ "content": "選擇北歐風實木餐桌,帶給您的家居新氣象。",
296
+ "keywords": ""
297
+ },
298
+ "type": "product",
299
+ "specs": [
300
+ {
301
+ "title": "顏色",
302
+ "option": [
303
+ {
304
+ "title": "淺木色",
305
+ "expand": true
306
+ },
307
+ {
308
+ "title": "胡桃木色",
309
+ "expand": true
310
+ },
311
+ {
312
+ "title": "黑色",
313
+ "expand": true
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "title": "尺寸",
319
+ "option": [
320
+ {
321
+ "title": "4人座"
322
+ },
323
+ {
324
+ "title": "6人座"
325
+ },
326
+ {
327
+ "title": "8人座"
328
+ }
329
+ ]
330
+ }
331
+ ],
332
+ "title": "北歐風實木餐桌 ( 贈品 )",
333
+ "token": {
334
+ "exp": 1764244210,
335
+ "iat": 1732708210,
336
+ "userID": 122538856,
337
+ "account": "rdtest",
338
+ "userData": {}
339
+ },
340
+ "status": "active",
341
+ "content": "北歐風實木餐桌,提供多種顏色與尺寸,適合不同家庭。",
342
+ "visible": "true",
343
+ "template": "",
344
+ "variants": [
345
+ {
346
+ "sku": "",
347
+ "cost": 0,
348
+ "spec": [
349
+ "淺木色",
350
+ "4人座"
351
+ ],
352
+ "type": "variants",
353
+ "stock": 0,
354
+ "profit": 0,
355
+ "weight": "1",
356
+ "barcode": "",
357
+ "v_width": 0,
358
+ "editable": false,
359
+ "v_height": 0,
360
+ "v_length": 0,
361
+ "product_id": 737,
362
+ "sale_price": 3500,
363
+ "compare_price": 0,
364
+ "preview_image": "",
365
+ "shipment_type": "weight",
366
+ "shipment_weight": 0,
367
+ "show_understocking": "false"
368
+ },
369
+ {
370
+ "sku": "",
371
+ "cost": 0,
372
+ "spec": [
373
+ "淺木色",
374
+ "6人座"
375
+ ],
376
+ "type": "variants",
377
+ "stock": 0,
378
+ "profit": 0,
379
+ "weight": "1",
380
+ "barcode": "",
381
+ "v_width": 0,
382
+ "editable": false,
383
+ "v_height": 0,
384
+ "v_length": 0,
385
+ "product_id": 737,
386
+ "sale_price": 3000,
387
+ "compare_price": 0,
388
+ "preview_image": "",
389
+ "shipment_type": "weight",
390
+ "shipment_weight": 0,
391
+ "show_understocking": "false"
392
+ },
393
+ {
394
+ "sku": "",
395
+ "cost": 0,
396
+ "spec": [
397
+ "淺木色",
398
+ "8人座"
399
+ ],
400
+ "type": "variants",
401
+ "stock": 0,
402
+ "profit": 0,
403
+ "weight": "1",
404
+ "barcode": "",
405
+ "v_width": 0,
406
+ "editable": false,
407
+ "v_height": 0,
408
+ "v_length": 0,
409
+ "product_id": 737,
410
+ "sale_price": 2500,
411
+ "compare_price": 0,
412
+ "preview_image": "",
413
+ "shipment_type": "weight",
414
+ "shipment_weight": 0,
415
+ "show_understocking": "false"
416
+ },
417
+ {
418
+ "sku": "",
419
+ "cost": 0,
420
+ "spec": [
421
+ "胡桃木色",
422
+ "4人座"
423
+ ],
424
+ "type": "variants",
425
+ "stock": 0,
426
+ "profit": 0,
427
+ "weight": "1",
428
+ "barcode": "",
429
+ "v_width": 0,
430
+ "editable": false,
431
+ "v_height": 0,
432
+ "v_length": 0,
433
+ "product_id": 737,
434
+ "sale_price": 2500,
435
+ "compare_price": 0,
436
+ "preview_image": "",
437
+ "shipment_type": "weight",
438
+ "shipment_weight": 0,
439
+ "show_understocking": "false"
440
+ },
441
+ {
442
+ "sku": "",
443
+ "cost": 0,
444
+ "spec": [
445
+ "胡桃木色",
446
+ "6人座"
447
+ ],
448
+ "type": "variants",
449
+ "stock": 0,
450
+ "profit": 0,
451
+ "weight": "1",
452
+ "barcode": "",
453
+ "v_width": 0,
454
+ "editable": false,
455
+ "v_height": 0,
456
+ "v_length": 0,
457
+ "product_id": 737,
458
+ "sale_price": 2500,
459
+ "compare_price": 0,
460
+ "preview_image": "",
461
+ "shipment_type": "weight",
462
+ "shipment_weight": 0,
463
+ "show_understocking": "false"
464
+ },
465
+ {
466
+ "sku": "",
467
+ "cost": 0,
468
+ "spec": [
469
+ "胡桃木色",
470
+ "8人座"
471
+ ],
472
+ "type": "variants",
473
+ "stock": 0,
474
+ "profit": 0,
475
+ "weight": "1",
476
+ "barcode": "",
477
+ "v_width": 0,
478
+ "editable": false,
479
+ "v_height": 0,
480
+ "v_length": 0,
481
+ "product_id": 737,
482
+ "sale_price": 2500,
483
+ "compare_price": 0,
484
+ "preview_image": "",
485
+ "shipment_type": "weight",
486
+ "shipment_weight": 0,
487
+ "show_understocking": "false"
488
+ },
489
+ {
490
+ "sku": "",
491
+ "cost": 0,
492
+ "spec": [
493
+ "黑色",
494
+ "4人座"
495
+ ],
496
+ "type": "variants",
497
+ "stock": 0,
498
+ "profit": 0,
499
+ "weight": "1",
500
+ "barcode": "",
501
+ "v_width": 0,
502
+ "editable": false,
503
+ "v_height": 0,
504
+ "v_length": 0,
505
+ "product_id": 737,
506
+ "sale_price": 2500,
507
+ "compare_price": 0,
508
+ "preview_image": "",
509
+ "shipment_type": "weight",
510
+ "shipment_weight": 0,
511
+ "show_understocking": "false"
512
+ },
513
+ {
514
+ "sku": "",
515
+ "cost": 0,
516
+ "spec": [
517
+ "黑色",
518
+ "6人座"
519
+ ],
520
+ "type": "variants",
521
+ "stock": 0,
522
+ "profit": 0,
523
+ "weight": "1",
524
+ "barcode": "",
525
+ "v_width": 0,
526
+ "editable": false,
527
+ "v_height": 0,
528
+ "v_length": 0,
529
+ "product_id": 737,
530
+ "sale_price": 2500,
531
+ "compare_price": 0,
532
+ "preview_image": "",
533
+ "shipment_type": "weight",
534
+ "shipment_weight": 0,
535
+ "show_understocking": "false"
536
+ },
537
+ {
538
+ "sku": "",
539
+ "cost": 0,
540
+ "spec": [
541
+ "黑色",
542
+ "8人座"
543
+ ],
544
+ "type": "variants",
545
+ "stock": 0,
546
+ "profit": 0,
547
+ "weight": "1",
548
+ "barcode": "",
549
+ "v_width": 0,
550
+ "editable": false,
551
+ "v_height": 0,
552
+ "v_length": 0,
553
+ "product_id": 737,
554
+ "sale_price": 2500,
555
+ "compare_price": 0,
556
+ "preview_image": "",
557
+ "shipment_type": "weight",
558
+ "shipment_weight": 0,
559
+ "show_understocking": "false"
560
+ }
561
+ ],
562
+ "hideIndex": "false",
563
+ "max_price": 3500,
564
+ "min_price": 2500,
565
+ "collection": [],
566
+ "productType": {
567
+ "product": false,
568
+ "giveaway": true,
569
+ "addProduct": false
570
+ },
571
+ "content_json": [],
572
+ "in_wish_list": false,
573
+ "content_array": [],
574
+ "preview_image": [
575
+ "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"
576
+ ],
577
+ "relative_product": [],
578
+ "voucher_id": 738,
579
+ "selected": true,
580
+ "have_select": true
581
+ },
582
+ {
583
+ "id": 739,
584
+ "seo": {
585
+ "title": "摩根鋼架書架 - 多色多層選擇",
586
+ "domain": "摩根鋼架書架 ( 贈品 )",
587
+ "content": "摩根鋼架書架,提供黑色、白色和灰色選擇,適合家庭及辦公室使用,尺寸有3層、4層、5層,價格合理。",
588
+ "keywords": ""
589
+ },
590
+ "type": "product",
591
+ "specs": [
592
+ {
593
+ "title": "顏色",
594
+ "option": [
595
+ {
596
+ "title": "黑色",
597
+ "expand": true
598
+ },
599
+ {
600
+ "title": "白色",
601
+ "expand": true
602
+ },
603
+ {
604
+ "title": "灰色",
605
+ "expand": true
606
+ }
607
+ ]
608
+ },
609
+ {
610
+ "title": "尺寸",
611
+ "option": [
612
+ {
613
+ "title": "3層"
614
+ },
615
+ {
616
+ "title": "4層"
617
+ },
618
+ {
619
+ "title": "5層"
620
+ }
621
+ ]
622
+ }
623
+ ],
624
+ "title": "摩根鋼架書架 ( 贈品 )",
625
+ "token": {
626
+ "exp": 1764244210,
627
+ "iat": 1732708210,
628
+ "userID": 122538856,
629
+ "account": "rdtest",
630
+ "userData": {}
631
+ },
632
+ "status": "active",
633
+ "content": "摩根鋼架書架,完美擺放您的書籍與裝飾品,適合不同空間需求,提供不同顏色及層數選擇。",
634
+ "visible": "true",
635
+ "template": "",
636
+ "variants": [
637
+ {
638
+ "sku": "",
639
+ "cost": 0,
640
+ "spec": [
641
+ "黑色",
642
+ "3層"
643
+ ],
644
+ "type": "variants",
645
+ "stock": 0,
646
+ "profit": 0,
647
+ "weight": "1",
648
+ "barcode": "",
649
+ "v_width": 0,
650
+ "editable": false,
651
+ "v_height": 0,
652
+ "v_length": 0,
653
+ "product_id": 739,
654
+ "sale_price": 1500,
655
+ "compare_price": 0,
656
+ "preview_image": "",
657
+ "shipment_type": "weight",
658
+ "shipment_weight": 0,
659
+ "show_understocking": "false"
660
+ },
661
+ {
662
+ "sku": "",
663
+ "cost": 0,
664
+ "spec": [
665
+ "黑色",
666
+ "4層"
667
+ ],
668
+ "type": "variants",
669
+ "stock": 0,
670
+ "profit": 0,
671
+ "weight": "1",
672
+ "barcode": "",
673
+ "v_width": 0,
674
+ "editable": false,
675
+ "v_height": 0,
676
+ "v_length": 0,
677
+ "product_id": 739,
678
+ "sale_price": 1300,
679
+ "compare_price": 0,
680
+ "preview_image": "",
681
+ "shipment_type": "weight",
682
+ "shipment_weight": 0,
683
+ "show_understocking": "false"
684
+ },
685
+ {
686
+ "sku": "",
687
+ "cost": 0,
688
+ "spec": [
689
+ "黑色",
690
+ "5層"
691
+ ],
692
+ "type": "variants",
693
+ "stock": 0,
694
+ "profit": 0,
695
+ "weight": "1",
696
+ "barcode": "",
697
+ "v_width": 0,
698
+ "editable": false,
699
+ "v_height": 0,
700
+ "v_length": 0,
701
+ "product_id": 739,
702
+ "sale_price": 1000,
703
+ "compare_price": 0,
704
+ "preview_image": "",
705
+ "shipment_type": "weight",
706
+ "shipment_weight": 0,
707
+ "show_understocking": "false"
708
+ },
709
+ {
710
+ "sku": "",
711
+ "cost": 0,
712
+ "spec": [
713
+ "白色",
714
+ "3層"
715
+ ],
716
+ "type": "variants",
717
+ "stock": 0,
718
+ "profit": 0,
719
+ "weight": "1",
720
+ "barcode": "",
721
+ "v_width": 0,
722
+ "editable": false,
723
+ "v_height": 0,
724
+ "v_length": 0,
725
+ "product_id": 739,
726
+ "sale_price": 1000,
727
+ "compare_price": 0,
728
+ "preview_image": "",
729
+ "shipment_type": "weight",
730
+ "shipment_weight": 0,
731
+ "show_understocking": "false"
732
+ },
733
+ {
734
+ "sku": "",
735
+ "cost": 0,
736
+ "spec": [
737
+ "白色",
738
+ "4層"
739
+ ],
740
+ "type": "variants",
741
+ "stock": 0,
742
+ "profit": 0,
743
+ "weight": "1",
744
+ "barcode": "",
745
+ "v_width": 0,
746
+ "editable": false,
747
+ "v_height": 0,
748
+ "v_length": 0,
749
+ "product_id": 739,
750
+ "sale_price": 1000,
751
+ "compare_price": 0,
752
+ "preview_image": "",
753
+ "shipment_type": "weight",
754
+ "shipment_weight": 0,
755
+ "show_understocking": "false"
756
+ },
757
+ {
758
+ "sku": "",
759
+ "cost": 0,
760
+ "spec": [
761
+ "白色",
762
+ "5層"
763
+ ],
764
+ "type": "variants",
765
+ "stock": 0,
766
+ "profit": 0,
767
+ "weight": "1",
768
+ "barcode": "",
769
+ "v_width": 0,
770
+ "editable": false,
771
+ "v_height": 0,
772
+ "v_length": 0,
773
+ "product_id": 739,
774
+ "sale_price": 1000,
775
+ "compare_price": 0,
776
+ "preview_image": "",
777
+ "shipment_type": "weight",
778
+ "shipment_weight": 0,
779
+ "show_understocking": "false"
780
+ },
781
+ {
782
+ "sku": "",
783
+ "cost": 0,
784
+ "spec": [
785
+ "灰色",
786
+ "3層"
787
+ ],
788
+ "type": "variants",
789
+ "stock": 0,
790
+ "profit": 0,
791
+ "weight": "1",
792
+ "barcode": "",
793
+ "v_width": 0,
794
+ "editable": false,
795
+ "v_height": 0,
796
+ "v_length": 0,
797
+ "product_id": 739,
798
+ "sale_price": 1000,
799
+ "compare_price": 0,
800
+ "preview_image": "",
801
+ "shipment_type": "weight",
802
+ "shipment_weight": 0,
803
+ "show_understocking": "false"
804
+ },
805
+ {
806
+ "sku": "",
807
+ "cost": 0,
808
+ "spec": [
809
+ "灰色",
810
+ "4層"
811
+ ],
812
+ "type": "variants",
813
+ "stock": 0,
814
+ "profit": 0,
815
+ "weight": "1",
816
+ "barcode": "",
817
+ "v_width": 0,
818
+ "editable": false,
819
+ "v_height": 0,
820
+ "v_length": 0,
821
+ "product_id": 739,
822
+ "sale_price": 1000,
823
+ "compare_price": 0,
824
+ "preview_image": "",
825
+ "shipment_type": "weight",
826
+ "shipment_weight": 0,
827
+ "show_understocking": "false"
828
+ },
829
+ {
830
+ "sku": "",
831
+ "cost": 0,
832
+ "spec": [
833
+ "灰色",
834
+ "5層"
835
+ ],
836
+ "type": "variants",
837
+ "stock": 0,
838
+ "profit": 0,
839
+ "weight": "1",
840
+ "barcode": "",
841
+ "v_width": 0,
842
+ "editable": false,
843
+ "v_height": 0,
844
+ "v_length": 0,
845
+ "product_id": 739,
846
+ "sale_price": 1000,
847
+ "compare_price": 0,
848
+ "preview_image": "",
849
+ "shipment_type": "weight",
850
+ "shipment_weight": 0,
851
+ "show_understocking": "false"
852
+ }
853
+ ],
854
+ "hideIndex": "false",
855
+ "max_price": 1500,
856
+ "min_price": 1000,
857
+ "collection": [],
858
+ "productType": {
859
+ "product": false,
860
+ "giveaway": true,
861
+ "addProduct": false
862
+ },
863
+ "content_json": [],
864
+ "in_wish_list": false,
865
+ "content_array": [],
866
+ "preview_image": [
867
+ "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0412.09.55-AmodernMorgansteel-framebookshelfwithaminimalist,industrialdesign.Thebookshelffeaturessturdy,darkmetalframeswithmultipleopenwood.webp"
868
+ ],
869
+ "relative_product": [],
870
+ "voucher_id": 738,
871
+ "have_select": true
872
+ }
319
873
  ],
320
874
  "bind": [
321
875
  {
322
876
  "spec": [
323
877
  "黑色",
324
- "小型"
878
+ "小號"
325
879
  ],
326
- "id": 732,
327
- "count": 1,
328
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/size1440_s*px$_s5s3sds0s9scsfs9_截圖2024-11-20晚上9.31.00.jpg",
329
- "title": "鱷魚皮沙發doiwq",
330
- "sale_price": 25000,
880
+ "id": 710,
881
+ "count": 5,
882
+ "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0514.20.13-AsophisticatedWindermerecoffeetablewithamodernyetclassicdesign.Thetablefeaturesasolidwoodconstructionwithasmooth,polishedsurfa.webp",
883
+ "title": "溫德米爾 茶几",
884
+ "sale_price": 1800,
331
885
  "collection": [
332
886
  "折扣專區",
333
887
  "熱門商品",
334
888
  "熱門商品 / 夏季限定"
335
889
  ],
336
- "sku": "133",
337
- "shipment_obj": {
338
- "type": "weight",
339
- "value": 100
340
- },
341
- "discount_price": 38,
342
- "rebate": 0
343
- },
344
- {
345
- "spec": [
346
- "米色",
347
- "標準"
348
- ],
349
- "id": 735,
350
- "count": 10,
351
- "preview_image": "https://d3jnmi1tfjgtti.cloudfront.net/file/122538856/DALL·E2024-11-0411.59.41-AstylishViennaupholstereddoublebedwithamodern,cozydesign.Thebedfeaturesahigh-qualityfabricheadboardandsoftpaddingforaddedcomf.webp",
352
- "title": "維也納 布藝雙人床 ( 加購品 )",
353
- "sale_price": 3200,
354
- "collection": [],
355
890
  "sku": "",
356
891
  "shipment_obj": {
357
- "type": "weight",
358
- "value": 10
892
+ "type": "volume",
893
+ "value": 600
359
894
  },
360
- "is_add_on_items": true,
361
- "discount_price": 5,
895
+ "discount_price": 17.6,
362
896
  "rebate": 0
363
897
  }
364
898
  ],
365
899
  "times": 1,
366
- "bind_subtotal": 57000,
900
+ "bind_subtotal": 9000,
367
901
  "discount_total": 0,
368
- "rebate_total": 0
902
+ "rebate_total": 0,
903
+ "select_gif": {
904
+ "spec": [
905
+ "淺木色",
906
+ "4人座"
907
+ ],
908
+ "id": 737,
909
+ "count": 1,
910
+ "voucher_id": 738
911
+ }
369
912
  }
370
913
  ],
371
914
  "distribution_info": {
@@ -566,6 +1109,13 @@ export class CheckoutIndex {
566
1109
  </div>`;
567
1110
  }
568
1111
 
1112
+ function giftBadge() {
1113
+ return html`
1114
+ <div class="${gClass('add-item-badge')}" style="background: #95ffe0;">
1115
+ <div class="${gClass('add-item-text')}">贈品</div>
1116
+ </div>`;
1117
+ }
1118
+
569
1119
  function addStyle() {
570
1120
  gvc.addStyle(css`
571
1121
  .${classPrefix}-container {
@@ -999,22 +1549,33 @@ export class CheckoutIndex {
999
1549
  });
1000
1550
  }
1001
1551
  }
1002
-
1552
+ function getBadgeClass(){
1553
+ if(item.is_add_on_items){
1554
+ return addItemBadge()
1555
+ }else if(item.is_gift){
1556
+ return giftBadge()
1557
+ }else{
1558
+ return ``
1559
+ }
1560
+ }
1003
1561
  return html`
1004
1562
  <div class="d-flex flex-column border-bottom p-lg-3 px-1 py-3 gap-3">
1005
1563
  <div class="d-flex w-100 position-relative"
1006
1564
  style="gap:20px;">
1007
1565
  <div class="${gClass('first-td')} justify-content-start d-sm-none">
1008
1566
  <div style="width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"></div>
1009
- <span class="ms-2 d-none">${item.is_add_on_items ? addItemBadge() : ''}${item.title}</span>
1567
+ <span class="ms-2 d-none">${getBadgeClass()}${item.title}</span>
1010
1568
  </div>
1011
1569
  <div class="d-flex flex-sm-row flex-column w-100 position-relative"
1012
1570
  style="gap: 8px; position: relative;">
1013
- <div class="${gClass('first-td')} justify-content-start d-none d-sm-flex" style="">
1571
+ <div class="${gClass('first-td')} justify-content-start d-none d-sm-flex"
1572
+ style="">
1014
1573
  <div style="width: 88px;height: 88px;border-radius: 20px;background: 50%/cover url('${item.preview_image}')"></div>
1015
- <span class="ms-2 d-flex align-items-start flex-column " style="gap:5px;">${item.is_add_on_items ? addItemBadge() : ''}${item.title}</span>
1574
+ <span class="ms-2 d-flex align-items-start flex-column "
1575
+ style="gap:5px;">${getBadgeClass()}${item.title}</span>
1016
1576
  </div>
1017
- <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>
1577
+ <span class="d-flex align-items-start flex-column d-lg-none fw-bold"
1578
+ style="gap:5px;font-size:17px;">${getBadgeClass()}${item.title}</span>
1018
1579
  <div class="${gClass('td')}">
1019
1580
  ${item.spec ? item.spec.join(' / ') : ''}
1020
1581
  </div>
@@ -1022,6 +1583,9 @@ export class CheckoutIndex {
1022
1583
  style="gap:10px;">
1023
1584
  <div class="">
1024
1585
  ${(() => {
1586
+ if(item.is_gift){
1587
+ return `NT.0`
1588
+ }
1025
1589
  return `NT.${parseInt(item.sale_price, 10).toLocaleString()}`;
1026
1590
  })()}
1027
1591
  </div>
@@ -1039,6 +1603,8 @@ export class CheckoutIndex {
1039
1603
  })
1040
1604
 
1041
1605
  })}"
1606
+ ${item.is_gift ? `disabled`:``}
1607
+
1042
1608
  >
1043
1609
  ${[...new Array(99)].map((_, index) => {
1044
1610
  return html`
@@ -1046,7 +1612,7 @@ export class CheckoutIndex {
1046
1612
  ${(index + 1 === item.count) ? `selected` : ``}>
1047
1613
  ${index + 1}
1048
1614
  </option>`;
1049
- })}
1615
+ }).join('')}
1050
1616
  </select>
1051
1617
  </div>
1052
1618
  <div class="d-block d-md-none"
@@ -1086,8 +1652,8 @@ export class CheckoutIndex {
1086
1652
  <div>
1087
1653
  ${vm.cartData.voucherList.filter((dd: any) => {
1088
1654
  return dd.bind.find((d2: any) => {
1089
- return d2.id === item.id
1090
- })
1655
+ return d2.id === item.id
1656
+ }) && (dd.reBackType!=='giveaway') && (dd.reBackType!=='add_on_items')
1091
1657
  }).map((dd: any) => {
1092
1658
  return `<div class="fs-6 w-100 " ><i class="fa-solid fa-tickets-perforated me-2"></i>${dd.title}</div>`
1093
1659
  }).join('<div class="my-1"></div>')}
@@ -1533,37 +2099,52 @@ export class CheckoutIndex {
1533
2099
 
1534
2100
  </div>
1535
2101
  </section>
1536
-
1537
- ${(() => {
1538
- let add_on: any[] = []
1539
- vm.cartData.voucherList.filter((dd: any) => {
1540
- if (dd.reBackType === 'add_on_items') {
1541
- add_on = add_on.concat(dd.add_on_products)
1542
- }
1543
- });
1544
- if (add_on.length) {
1545
- return gvc.bindView(() => {
1546
- const id = gvc.glitter.getUUID()
1547
- return {
1548
- bind: id,
1549
- view: async () => {
1550
- const add_products = (await ApiShop.getProduct({
1551
- page: 0,
1552
- limit: 100,
1553
- productType: 'addProduct',
1554
- id_list: add_on.join(',')
1555
- }));
1556
- if (!add_products.response.data.length) {
1557
- return ``
1558
- }
1559
- return html`
2102
+ `;
2103
+ },
2104
+ };
2105
+ })()
2106
+ )}
2107
+ <section class="border-bottom"></section>
2108
+ <section class="d-flex">
2109
+ <div class="flex-fill"></div>
2110
+ <div class="${gClass('price-container')}">
2111
+ <div class="${gClass(['price-row', 'text-1', 'bold'])}">
2112
+ <div>總金額</div>
2113
+ <div>NT. ${vm.cartData.total.toLocaleString()}</div>
2114
+ </div>
2115
+ </div>
2116
+ </section>
2117
+ <!--加購品-->
2118
+ ${(() => {
2119
+ let add_on: any[] = []
2120
+ vm.cartData.voucherList.filter((dd: any) => {
2121
+ if (dd.reBackType === 'add_on_items') {
2122
+ add_on = add_on.concat(dd.add_on_products)
2123
+ }
2124
+ });
2125
+ if (add_on.length) {
2126
+ return gvc.bindView(() => {
2127
+ const id = gvc.glitter.getUUID()
2128
+ return {
2129
+ bind: id,
2130
+ view: async () => {
2131
+ const add_products = (await ApiShop.getProduct({
2132
+ page: 0,
2133
+ limit: 100,
2134
+ productType: 'addProduct',
2135
+ id_list: add_on.join(',')
2136
+ }));
2137
+ if (!add_products.response.data.length) {
2138
+ return ``
2139
+ }
2140
+ return html`
1560
2141
  <div class="${gClass('banner-bgr')}">
1561
2142
  <span class="${gClass('banner-text')}">可加購商品</span>
1562
2143
  </div>
1563
2144
  <div class="d-flex align-items-center w-100"
1564
2145
  style="overflow-x:auto;gap:10px;">
1565
2146
  ${add_products.response.data.map((dd: any) => {
1566
- return html`
2147
+ return html`
1567
2148
  <div class="d-flex py-3 align-items-center"
1568
2149
  style="gap:10px;">
1569
2150
  <div class="img-fluid "
@@ -1574,7 +2155,7 @@ export class CheckoutIndex {
1574
2155
  background-position: center;
1575
2156
  background-size: cover;
1576
2157
  background-repeat: no-repeat;
1577
- background-image: url(${dd.content.preview_image[0]});"></div>
2158
+ background-image: url('${dd.content.preview_image[0]}');"></div>
1578
2159
  <div class="d-flex flex-column"
1579
2160
  style="gap:5px;">
1580
2161
  <div class="${gClass('banner-text')}"
@@ -1594,8 +2175,8 @@ export class CheckoutIndex {
1594
2175
  </div>
1595
2176
  <button class="${gClass('button-bgr')} mb-0 mt-2"
1596
2177
  onclick="${gvc.event(() => {
1597
- return gvc.glitter.innerDialog((gvc: GVC) => {
1598
- return html`
2178
+ return gvc.glitter.innerDialog((gvc: GVC) => {
2179
+ return html`
1599
2180
  <div
1600
2181
  class="bg-white shadow rounded-3"
1601
2182
  style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
@@ -1609,8 +2190,8 @@ export class CheckoutIndex {
1609
2190
  class="fa-regular fa-circle-xmark fs-5 text-dark"
1610
2191
  style="cursor: pointer"
1611
2192
  onclick="${gvc.event(() => {
1612
- gvc.closeDialog();
1613
- })}"
2193
+ gvc.closeDialog();
2194
+ })}"
1614
2195
  ></i>
1615
2196
  </div>
1616
2197
  <div class="c_dialog">
@@ -1618,67 +2199,199 @@ export class CheckoutIndex {
1618
2199
  <div class="c_dialog_main"
1619
2200
  style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
1620
2201
  ${PdClass.selectSpec({
1621
- gvc,
1622
- titleFontColor: glitter.share.globalValue['theme_color.0.title'] ?? '#333333',
1623
- prod: dd.content,
1624
- vm: {
1625
- specs: dd.content.specs.map((spec: {
1626
- option: {
1627
- title: string
1628
- }[]
1629
- }) => {
1630
- return spec.option[0].title;
1631
- }),
1632
- quantity: '1',
1633
- wishStatus: (glitter.share.wishList ?? []).some((item: {
1634
- id: number
1635
- }) => {
1636
- return item.id === dd.id;
1637
- })
1638
- },
1639
- callback: () => {
1640
- gvc.closeDialog();
1641
- refreshCartData()
1642
- }
1643
- })}
2202
+ gvc,
2203
+ titleFontColor: glitter.share.globalValue['theme_color.0.title'] ?? '#333333',
2204
+ prod: dd.content,
2205
+ vm: {
2206
+ specs: dd.content.specs.map((spec: {
2207
+ option: {
2208
+ title: string
2209
+ }[]
2210
+ }) => {
2211
+ return spec.option[0].title;
2212
+ }),
2213
+ quantity: '1',
2214
+ wishStatus: (glitter.share.wishList ?? []).some((item: {
2215
+ id: number
2216
+ }) => {
2217
+ return item.id === dd.id;
2218
+ })
2219
+ },
2220
+ callback: () => {
2221
+ gvc.closeDialog();
2222
+ refreshCartData()
2223
+ }
2224
+ })}
1644
2225
  </div>
1645
2226
  </div>
1646
2227
  </div>
1647
2228
  </div>
1648
2229
  </div>`;
1649
- }, Tool.randomString(7));
1650
- })}">
2230
+ }, Tool.randomString(7));
2231
+ })}">
1651
2232
  <span class="${gClass('button-text')}">加入購物車</span>
1652
2233
  </button>
1653
2234
  </div>
1654
2235
  </div>`
1655
- }).join('')}
2236
+ }).join('')}
1656
2237
  </div>
1657
2238
  `
1658
- }
1659
- }
2239
+ }
2240
+ }
2241
+ })
2242
+ } else {
2243
+ return ``
2244
+ }
2245
+ return ``
2246
+ })()}
2247
+ <!--贈品-->
2248
+ ${(() => {
2249
+ let already_add: any[] = vm.cartData.lineItems.filter((dd:any)=>{
2250
+ return dd.is_gift
2251
+ });
2252
+ return vm.cartData.voucherList.filter((d1: any) => {
2253
+ return d1.reBackType === 'giveaway'
2254
+ }).map((dd: any) => {
2255
+ let isSelected=already_add.find((d2)=>{
2256
+ return dd.add_on_products.find((d1:any)=>{
2257
+ return d1.id===d2.id
2258
+ })
2259
+ });
2260
+ already_add=already_add.filter((dd)=>{
2261
+ return !dd===isSelected
2262
+ })
2263
+ return html`
2264
+ <div class="${gClass('banner-bgr')}">
2265
+ <span class="${gClass('banner-text')}">${dd.title}</span>
2266
+ </div>
2267
+ <div class="d-flex align-items-center w-100"
2268
+ style="overflow-x:auto;gap:10px;">
2269
+ ${dd.add_on_products.map((pd: any) => {
2270
+ try {
2271
+ return html`
2272
+ <div class="d-flex py-3 align-items-center"
2273
+ style="gap:10px;">
2274
+ <div class="img-fluid "
2275
+ style="width: 106px;
2276
+ min-width: 106px;
2277
+ height: 106px;
2278
+ border-radius: 3px;
2279
+ background-position: center;
2280
+ background-size: cover;
2281
+ background-repeat: no-repeat;
2282
+ background-image: url('${pd.preview_image[0]}');"></div>
2283
+ <div class="d-flex flex-column"
2284
+ style="gap:5px;">
2285
+ <div class="${gClass('banner-text')}"
2286
+ style="font-size: 15px;
2287
+ font-style: normal;
2288
+ font-weight: 400;
2289
+ white-space: nowrap;
2290
+ overflow: hidden;
2291
+ max-width: 130px;
2292
+ text-overflow: ellipsis;">${pd.title}
2293
+ </div>
2294
+ <div class="text-decoration-line-through text-danger"
2295
+ style="font-size: 14px;
2296
+ font-style: normal;
2297
+ font-weight: 700;
2298
+ line-height: 140%;">NT.${pd.min_price.toLocaleString()}
2299
+ </div>
2300
+ <button class="${gClass('button-bgr')} mb-0 mt-2"
2301
+ style="${(isSelected ? ((isSelected.id === pd.id) ? `background: gray !important;`:``):``) }"
2302
+ onclick="${gvc.event(() => {
2303
+ if(isSelected && (isSelected.id === pd.id) ){
2304
+ return
2305
+ }
2306
+ return gvc.glitter.innerDialog((gvc: GVC) => {
2307
+ return html`
2308
+ <div
2309
+ class="bg-white shadow rounded-3"
2310
+ style="overflow-y: auto; ${document.body.clientWidth > 768 ? `min-width: 400px; width: 600px;` : 'min-width: 90vw; max-width: 92.5vw;'}"
2311
+ >
2312
+ <div class="bg-white shadow rounded-3"
2313
+ style="width: 100%; overflow-y: auto; position: relative;">
2314
+ <div class="w-100 d-flex align-items-center p-3 border-bottom"
2315
+ style="position: sticky; top: 0; background: #fff;">
2316
+ <div class="flex-fill"></div>
2317
+ <i
2318
+ class="fa-regular fa-circle-xmark fs-5 text-dark"
2319
+ style="cursor: pointer"
2320
+ onclick="${gvc.event(() => {
2321
+ gvc.closeDialog();
2322
+ })}"
2323
+ ></i>
2324
+ </div>
2325
+ <div class="c_dialog">
2326
+ <div class="c_dialog_body">
2327
+ <div class="c_dialog_main"
2328
+ style="gap: 24px; height: auto; max-height: 500px; padding: 12px 20px;">
2329
+ ${PdClass.selectSpec({
2330
+ gvc,
2331
+ titleFontColor: glitter.share.globalValue['theme_color.0.title'] ?? '#333333',
2332
+ prod: pd,
2333
+ vm: {
2334
+ specs: pd.specs.map((spec: {
2335
+ option: {
2336
+ title: string
2337
+ }[]
2338
+ }) => {
2339
+ return spec.option[0].title;
2340
+ }),
2341
+ quantity: '1',
2342
+ wishStatus: (glitter.share.wishList ?? []).some((item: {
2343
+ id: number
2344
+ }) => {
2345
+ return item.id === dd.id;
1660
2346
  })
1661
- } else {
1662
- return ``
2347
+ },
2348
+ with_qty:false,
2349
+ callback: () => {
2350
+ let find=vm.cartData.lineItems.find((d1:any)=>{
2351
+ return dd.add_on_products.find((d2:any)=>{
2352
+ return d2.id===d1.id
2353
+ })
2354
+ });
2355
+ if(find){
2356
+ ApiCart.setCart((cartItem) => {
2357
+ cartItem.line_items.map((dd) => {
2358
+ if(dd.id===find.id){
2359
+ dd.count--
2360
+ }
2361
+ })
2362
+ cartItem.line_items=cartItem.line_items.filter((dd)=>{
2363
+ return dd.count>0
2364
+ })
2365
+ refreshCartData()
2366
+ gvc.closeDialog()
2367
+ })
2368
+ }else{
2369
+ refreshCartData()
2370
+ gvc.closeDialog()
2371
+ }
1663
2372
  }
1664
- return ``
1665
- })()}
2373
+ })}
2374
+ </div>
2375
+ </div>
2376
+ </div>
2377
+ </div>
2378
+ </div>`;
2379
+ }, Tool.randomString(7));
2380
+ })}">
2381
+
2382
+ <span class="${gClass('button-text')}">${isSelected ? ((isSelected.id === pd.id) ? `已選擇`:`更換贈品`):`選擇贈品`}</span>
2383
+ </button>
2384
+ </div>
2385
+ </div>`
2386
+ }catch (e) {
2387
+ console.log(e)
2388
+ }
1666
2389
 
1667
- `;
1668
- },
1669
- };
1670
- })()
1671
- )}
1672
- <section class="border-bottom"></section>
1673
- <section class="d-flex">
1674
- <div class="flex-fill"></div>
1675
- <div class="${gClass('price-container')}">
1676
- <div class="${gClass(['price-row', 'text-1', 'bold'])}">
1677
- <div>總金額</div>
1678
- <div>NT. ${vm.cartData.total.toLocaleString()}</div>
1679
- </div>
1680
- </div>
1681
- </section>
2390
+ }).join('')}
2391
+ </div>
2392
+ `
2393
+ }).join('')
2394
+ })()}
1682
2395
  <section>
1683
2396
  <div class="${gClass('banner-bgr')}">
1684
2397
  <span class="${gClass('banner-text')}">付款及配送方式</span>
@@ -2524,13 +3237,21 @@ export class CheckoutIndex {
2524
3237
  distribution_code: ApiCart.cart.distribution_code,
2525
3238
  give_away: ApiCart.cart.give_away
2526
3239
  }).then((res) => {
3240
+ dialog.dataLoading({visible:false})
3241
+
2527
3242
  if (res.response.off_line || res.response.is_free) {
2528
3243
  ApiCart.clearCart()
2529
3244
  location.href = res.response.return_url;
2530
3245
  } else {
2531
- const id = gvc.glitter.getUUID();
2532
- $('body').append(`<div id="${id}" style="display: none;">${res.response.form}</div>`);
2533
- (document.querySelector(`#${id} #submit`) as any).click();
3246
+ // todo if 他是paypal的key值 上面應該有select之類的
3247
+ if (res.response.form.approveLink){
3248
+ location.href = res.response.form.approveLink;
3249
+ }else{
3250
+ const id = gvc.glitter.getUUID();
3251
+ $('body').append(`<div id="${id}" style="display: none;">${res.response.form}</div>`);
3252
+ (document.querySelector(`#${id} #submit`) as any).click();
3253
+ }
3254
+
2534
3255
  ApiCart.clearCart()
2535
3256
  }
2536
3257
  })
@@ -2548,6 +3269,31 @@ export class CheckoutIndex {
2548
3269
  },
2549
3270
  divCreate: {},
2550
3271
  onCreate: () => {
3272
+ Ad.gtagEvent('view_cart', {
3273
+ currency: 'TWD',
3274
+ value: vm.cartData.total,
3275
+ items: vm.cartData.lineItems.map((item: any) => {
3276
+ return {
3277
+ item_id: item.id,
3278
+ item_name: item.title,
3279
+ item_variant: item.spec.join('-'),
3280
+ price: item.sale_price,
3281
+ quantity: item.count,
3282
+ discount: item.discount_price,
3283
+ };
3284
+ }),
3285
+ });
3286
+ Ad.fbqEvent('AddPaymentInfo', {
3287
+ value: vm.cartData.total,
3288
+ currency: 'TWD',
3289
+ contents: vm.cartData.lineItems.map((item: any) => {
3290
+ return {
3291
+ id: item.id,
3292
+ quantity: item.count,
3293
+ };
3294
+ }),
3295
+ content_ids: vm.cartData.lineItems.map((item: any) => item.id),
3296
+ });
2551
3297
  },
2552
3298
  };
2553
3299
  })()
@@ -2623,13 +3369,19 @@ export class CheckoutIndex {
2623
3369
  })()) {
2624
3370
  widget.event('error', {title: `請輸入「${FormWidget.checkLeakData(cartData.custom_form_format, cartData.custom_form_data)}」`});
2625
3371
  } else if (
2626
- cartData.voucherList
2627
- .filter((dd: any) => {
2628
- return dd.reBackType === 'giveaway';
2629
- })
2630
- .find((dd: any) => {
2631
- return !dd.select_gif.id;
3372
+ (()=>{
3373
+ let gift_need= cartData.voucherList
3374
+ .filter((dd: any) => {
3375
+ return dd.reBackType === 'giveaway';
3376
+ }).length;
3377
+ let gift=0
3378
+ cartData.lineItems.filter((dd:any)=>{
3379
+ return dd.is_gift
3380
+ }).map((dd:any)=>{
3381
+ gift+=dd.count
2632
3382
  })
3383
+ return gift<gift_need
3384
+ })()
2633
3385
  ) {
2634
3386
  widget.event('error', {title: '請選擇「贈品」'});
2635
3387
  } else {
@@ -2640,23 +3392,32 @@ export class CheckoutIndex {
2640
3392
  checkString(subData.phone, '收件人電話', 'phone');
2641
3393
  checkString(subData.email, '收件人信箱', 'email');
2642
3394
  if (pass) {
2643
- if ((window as any).gtag) {
2644
- (window as any).gtag('event', 'begin_checkout', {
2645
- currency: 'TWD',
2646
- value: cartData.total,
2647
- coupon: cartData.code ?? '',
2648
- items: cartData.lineItems.map((item: any) => {
2649
- return {
2650
- item_id: item.id,
2651
- item_name: item.title,
2652
- item_variant: item.spec.join('-'),
2653
- price: item.sale_price,
2654
- quantity: item.count,
2655
- discount: item.discount_price,
2656
- };
2657
- }),
2658
- });
2659
- }
3395
+ Ad.gtagEvent('begin_checkout', {
3396
+ currency: 'TWD',
3397
+ value: cartData.total,
3398
+ coupon: cartData.code ?? '',
3399
+ items: cartData.lineItems.map((item: any) => {
3400
+ return {
3401
+ item_id: item.id,
3402
+ item_name: item.title,
3403
+ item_variant: item.spec.join('-'),
3404
+ price: item.sale_price,
3405
+ quantity: item.count,
3406
+ discount: item.discount_price,
3407
+ };
3408
+ }),
3409
+ });
3410
+ Ad.fbqEvent('Purchase', {
3411
+ value: cartData.total,
3412
+ currency: 'TWD',
3413
+ contents: cartData.lineItems.map((item: any) => {
3414
+ return {
3415
+ id: item.id,
3416
+ quantity: item.count,
3417
+ };
3418
+ }),
3419
+ content_type: 'product',
3420
+ });
2660
3421
  resolve(subData);
2661
3422
  }
2662
3423
  }
@@ -2767,6 +3528,8 @@ export class CheckoutIndex {
2767
3528
  localStorage.setItem('custom_form_data', JSON.stringify(cartData.custom_form_data))
2768
3529
  //設定配送資訊
2769
3530
  localStorage.setItem('custom_user_info', JSON.stringify(cartData.user_info))
3531
+ //贈品功能
3532
+ localStorage.setItem('give_away', JSON.stringify(cartData.give_away))
2770
3533
  }
2771
3534
 
2772
3535
 
@@ -2774,7 +3537,7 @@ export class CheckoutIndex {
2774
3537
  cartData.customer_info = JSON.parse(localStorage.getItem('cart_customer_info') || "{}")
2775
3538
  cartData.custom_form_data = JSON.parse(localStorage.getItem('custom_form_data') || "{}")
2776
3539
  cartData.user_info = JSON.parse(localStorage.getItem('custom_user_info') || "{}")
2777
-
3540
+ cartData.give_away = JSON.parse(localStorage.getItem('give_away') || "[]")
2778
3541
  this.getPaymentMethod(cartData)
2779
3542
  this.getShipmentMethod(cartData)
2780
3543
  }