ts-glitter 18.2.6 → 18.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lowcode/Entry.js +30 -1
- package/lowcode/Entry.ts +36 -1
- package/lowcode/cms-plugin/customer-message-user.js +503 -8
- package/lowcode/cms-plugin/customer-message-user.ts +549 -12
- package/lowcode/cms-plugin/shopping-finance-setting.js +4 -4
- package/lowcode/cms-plugin/shopping-finance-setting.ts +4 -4
- package/lowcode/cms-plugin/shopping-information.js +16 -0
- package/lowcode/cms-plugin/shopping-information.ts +16 -0
- package/lowcode/cms-plugin/shopping-order-manager.js +138 -77
- package/lowcode/cms-plugin/shopping-order-manager.ts +177 -102
- package/lowcode/glitter-base/global/language.js +6 -0
- package/lowcode/glitter-base/global/language.ts +6 -0
- package/lowcode/glitterBundle/GVController.js +2 -2
- package/lowcode/glitterBundle/GVController.ts +2 -2
- package/lowcode/glitterBundle/dialog/dialog_inner.js +5 -2
- package/lowcode/glitterBundle/dialog/dialog_inner.ts +5 -2
- package/lowcode/glitterBundle/module/Animation.js +59 -0
- package/lowcode/glitterBundle/module/Animation.ts +62 -0
- package/lowcode/glitterBundle/module/PageManager.js +3 -3
- package/lowcode/glitterBundle/module/PageManager.ts +1 -1
- package/lowcode/index.html +1 -0
- package/lowcode/public-components/checkout/index.js +77 -117
- package/lowcode/public-components/checkout/index.ts +174 -221
- package/lowcode/public-components/footer/footer-01.js +3 -0
- package/lowcode/public-components/footer/footer-01.ts +3 -0
- package/lowcode/public-components/footer/footer-02.js +3 -0
- package/lowcode/public-components/footer/footer-02.ts +3 -0
- package/lowcode/public-components/footer/footer-03.js +3 -0
- package/lowcode/public-components/footer/footer-03.ts +3 -0
- package/lowcode/public-components/product/pd-class.js +868 -355
- package/lowcode/public-components/product/pd-class.ts +1005 -438
- package/lowcode/public-components/product/product-detail.js +1 -1
- package/lowcode/public-components/product/product-detail.ts +3 -1
- package/package.json +1 -1
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/delivery.js.map +1 -1
- package/src/api-public/controllers/delivery.ts +2 -0
- package/src/api-public/controllers/shop.js +3 -2
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +4 -3
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/services/ai-robot.js.map +1 -1
- package/src/api-public/services/fb-api.js.map +1 -1
- package/src/api-public/services/financial-service.d.ts +4 -0
- package/src/api-public/services/financial-service.js +48 -23
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +57 -26
- package/src/api-public/services/public-table-check.js.map +1 -1
- package/src/api-public/services/shopping.js +7 -0
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +9 -0
- package/src/api-public/services/user.d.ts +2 -2
- package/src/api-public/services/user.js +8 -2
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +8 -2
- package/src/index.js +3 -3
- package/src/index.js.map +1 -1
|
@@ -17,6 +17,8 @@ import { Language } from '../../glitter-base/global/language.js';
|
|
|
17
17
|
import { Currency } from '../../glitter-base/global/currency.js';
|
|
18
18
|
import { ProductInitial } from '../../public-models/product.js';
|
|
19
19
|
import { ApiTrack } from "../../glitter-base/route/api-track.js";
|
|
20
|
+
import { Animation } from "../../glitterBundle/module/Animation.js";
|
|
21
|
+
import { ShareDialog } from "../../glitterBundle/dialog/ShareDialog.js";
|
|
20
22
|
const html = String.raw;
|
|
21
23
|
const css = String.raw;
|
|
22
24
|
export class PdClass {
|
|
@@ -69,7 +71,8 @@ export class PdClass {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
`);
|
|
72
|
-
const htmlString = html `
|
|
74
|
+
const htmlString = html `
|
|
75
|
+
<div class="bounce-effect-${className}">${obj.text}</div>`;
|
|
73
76
|
obj.gvc.glitter.document.body.insertAdjacentHTML('beforeend', htmlString);
|
|
74
77
|
setTimeout(() => {
|
|
75
78
|
const element = document.querySelector(`.bounce-effect-${className}`);
|
|
@@ -155,6 +158,7 @@ export class PdClass {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
.add-cart-imd-btn {
|
|
161
|
+
border: none;
|
|
158
162
|
display: inline-flex;
|
|
159
163
|
align-items: center;
|
|
160
164
|
justify-content: center;
|
|
@@ -217,37 +221,42 @@ export class PdClass {
|
|
|
217
221
|
}
|
|
218
222
|
static addCartAction(obj) {
|
|
219
223
|
obj.gvc.glitter.innerDialog((gvc) => {
|
|
220
|
-
return html `
|
|
221
|
-
<div class="bg-white shadow rounded-3
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
224
|
+
return html `
|
|
225
|
+
<div class=" bg-white shadow ${document.body.clientWidth > 768 ? `rounded-3` : ` position-absolute bottom-0`}"
|
|
226
|
+
style=" ${document.body.clientWidth > 768 ? `min-width: 400px; width: 1000px;max-height:calc(100% - 150px);overflow-y: auto;` : 'width:calc(100vw);height:100%;'}">
|
|
227
|
+
<div class="bg-white shadow ${document.body.clientWidth > 768 ? `rounded-3` : `h-100`}" style="
|
|
228
|
+
width: 100%; position: relative;${document.body.clientWidth > 768 ? `` : `overflow-y: auto;`}">
|
|
229
|
+
<div class="w-100 d-flex align-items-center p-3 border-bottom"
|
|
230
|
+
style="position: sticky; top: 0; background: #fff;z-index:12;">
|
|
231
|
+
<div class="fw-bold fs-5"
|
|
232
|
+
style="color:${obj.titleFontColor}; white-space: nowrap;text-overflow: ellipsis;max-width: calc(100% - 40px); overflow: hidden;">
|
|
233
|
+
${obj.prod.title}
|
|
234
|
+
</div>
|
|
235
|
+
<div class="flex-fill"></div>
|
|
236
|
+
<i
|
|
237
|
+
class="fa-regular fa-circle-xmark fs-5 text-dark"
|
|
238
|
+
style="cursor: pointer"
|
|
239
|
+
onclick="${gvc.event(() => {
|
|
231
240
|
gvc.closeDialog();
|
|
232
241
|
})}"
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
${PdClass.selectSpec({
|
|
242
|
+
></i>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="c_dialog_main"
|
|
245
|
+
style="gap: 24px; max-height: calc(100% - 100px); ${document.body.clientWidth < 800 ? `padding: 12px 20px;` : `padding: 30px;`}">
|
|
246
|
+
${PdClass.selectSpec({
|
|
239
247
|
gvc,
|
|
240
248
|
titleFontColor: obj.titleFontColor,
|
|
241
249
|
prod: obj.prod,
|
|
242
250
|
vm: obj.vm,
|
|
243
251
|
preview: true,
|
|
244
252
|
})}
|
|
245
|
-
|
|
253
|
+
<div class="d-sm-none" style="height:100px;"></div>
|
|
246
254
|
</div>
|
|
247
255
|
</div>
|
|
248
|
-
</div
|
|
249
|
-
|
|
250
|
-
|
|
256
|
+
</div>`;
|
|
257
|
+
}, Tool.randomString(7), {
|
|
258
|
+
animation: (document.body.clientWidth < 768) ? Animation.popup : Animation.fade
|
|
259
|
+
});
|
|
251
260
|
}
|
|
252
261
|
static showSwiper(obj) {
|
|
253
262
|
const isPhone = document.body.clientWidth < 768;
|
|
@@ -259,8 +268,9 @@ export class PdClass {
|
|
|
259
268
|
{
|
|
260
269
|
src: `https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js`,
|
|
261
270
|
},
|
|
262
|
-
], () => {
|
|
263
|
-
|
|
271
|
+
], () => {
|
|
272
|
+
}, () => {
|
|
273
|
+
});
|
|
264
274
|
obj.prod.variants.forEach((variant) => {
|
|
265
275
|
variant.preview_image = variant[`preview_image_${Language.getLanguage()}`] || variant.preview_image;
|
|
266
276
|
if (variant.preview_image && !obj.prod.preview_image.includes(variant.preview_image)) {
|
|
@@ -283,13 +293,15 @@ export class PdClass {
|
|
|
283
293
|
bind: id,
|
|
284
294
|
view: () => {
|
|
285
295
|
return html `
|
|
286
|
-
<div class="swiper${id}" id="dynamic-swiper${id}"
|
|
296
|
+
<div class="swiper${id}" id="dynamic-swiper${id}"
|
|
297
|
+
style="width: 500px;position:relative;overflow: hidden;max-width: 100%;">
|
|
287
298
|
<div class="swiper-wrapper">
|
|
288
299
|
${obj.prod.preview_image
|
|
289
300
|
.map((image, index) => {
|
|
290
|
-
return html `
|
|
291
|
-
|
|
292
|
-
|
|
301
|
+
return html `
|
|
302
|
+
<div class="swiper-slide swiper-slide-def">
|
|
303
|
+
<img src="${image}" alt="${obj.prod.title}-${index}"/>
|
|
304
|
+
</div>`;
|
|
293
305
|
})
|
|
294
306
|
.join('')}
|
|
295
307
|
</div>
|
|
@@ -297,17 +309,22 @@ export class PdClass {
|
|
|
297
309
|
<div class="swiper-button-next"></div>
|
|
298
310
|
</div>
|
|
299
311
|
${obj.prod.preview_image.length > 1
|
|
300
|
-
? html `
|
|
301
|
-
|
|
302
|
-
|
|
312
|
+
? html `
|
|
313
|
+
<div class="swiper-sm${id} mt-2"
|
|
314
|
+
style="height: ${isPhone ? 75 : 100}px; overflow: hidden;">
|
|
315
|
+
<div class="swiper-wrapper">
|
|
316
|
+
${obj.prod.preview_image
|
|
303
317
|
.map((image, index) => {
|
|
304
|
-
return html `
|
|
305
|
-
|
|
306
|
-
|
|
318
|
+
return html `
|
|
319
|
+
<div class="swiper-slide swiper-slide-sm"
|
|
320
|
+
data-image-index="${index}">
|
|
321
|
+
<img src="${image}" alt="${obj.prod.title}-${index}-sm"
|
|
322
|
+
style="height: ${isPhone ? 75 : 100}px;width: auto !important;"/>
|
|
323
|
+
</div>`;
|
|
307
324
|
})
|
|
308
325
|
.join('')}
|
|
309
|
-
|
|
310
|
-
|
|
326
|
+
</div>
|
|
327
|
+
</div>`
|
|
311
328
|
: ``}
|
|
312
329
|
`;
|
|
313
330
|
},
|
|
@@ -387,6 +404,7 @@ export class PdClass {
|
|
|
387
404
|
});
|
|
388
405
|
}
|
|
389
406
|
static selectSpec(obj) {
|
|
407
|
+
var _a, _b;
|
|
390
408
|
const gvc = obj.gvc;
|
|
391
409
|
const glitter = gvc.glitter;
|
|
392
410
|
const titleFontColor = obj.titleFontColor;
|
|
@@ -398,6 +416,7 @@ export class PdClass {
|
|
|
398
416
|
addCartButton: glitter.getUUID(),
|
|
399
417
|
stock_count: glitter.getUUID(),
|
|
400
418
|
qty_count: glitter.getUUID(),
|
|
419
|
+
ids_spec: glitter.getUUID()
|
|
401
420
|
};
|
|
402
421
|
obj.gvc.addStyle(`
|
|
403
422
|
.insignia {
|
|
@@ -419,12 +438,12 @@ export class PdClass {
|
|
|
419
438
|
justify-content: center;
|
|
420
439
|
align-items: center;
|
|
421
440
|
gap: 4px;
|
|
422
|
-
border-radius:
|
|
423
|
-
background: #FFE9B2;
|
|
441
|
+
border-radius: 2px;
|
|
424
442
|
font-size: 14px;
|
|
425
443
|
}
|
|
426
444
|
`);
|
|
427
|
-
let changePage = (index, type, subData) => {
|
|
445
|
+
let changePage = (index, type, subData) => {
|
|
446
|
+
};
|
|
428
447
|
gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, (cl) => {
|
|
429
448
|
changePage = cl.changePage;
|
|
430
449
|
});
|
|
@@ -444,230 +463,436 @@ export class PdClass {
|
|
|
444
463
|
return `免運費活動`;
|
|
445
464
|
}
|
|
446
465
|
}
|
|
466
|
+
function refreshAll() {
|
|
467
|
+
gvc.notifyDataChange([ids.price, ids.addCartButton, ids.stock_count, ids.qty_count, ids.ids_spec]);
|
|
468
|
+
}
|
|
469
|
+
const solidButtonBgr = (_a = glitter.share.globalValue['theme_color.0.solid-button-bg']) !== null && _a !== void 0 ? _a : '#dddddd';
|
|
470
|
+
const solidButtonText = (_b = glitter.share.globalValue['theme_color.0.solid-button-text']) !== null && _b !== void 0 ? _b : '#000000';
|
|
447
471
|
const aboutVoucherHTML = vm.data && vm.data.content.about_vouchers && vm.data.content.about_vouchers.length > 0
|
|
448
|
-
? html
|
|
449
|
-
|
|
472
|
+
? html `
|
|
473
|
+
<div class="d-flex flex-column gap-2 mt-3">
|
|
474
|
+
${vm.data.content.about_vouchers
|
|
450
475
|
.map((v) => {
|
|
451
476
|
return html `
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
477
|
+
<div class="d-flex gap-2 align-items-center">
|
|
478
|
+
<div class="insignia insignia-voucher"
|
|
479
|
+
style="background:${solidButtonBgr};color:${solidButtonText};font-size:12px;">
|
|
480
|
+
${eventName(v.reBackType)}
|
|
481
|
+
</div>
|
|
482
|
+
<div class="fs-sm" style="font-weight: 500;color:${titleFontColor};">
|
|
483
|
+
${v.title}
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
`;
|
|
457
487
|
})
|
|
458
488
|
.join('')}
|
|
459
|
-
|
|
489
|
+
</div>`
|
|
460
490
|
: '';
|
|
461
|
-
|
|
462
|
-
<div class="
|
|
463
|
-
<div class="w-100">
|
|
491
|
+
let viewMap = [
|
|
492
|
+
` <div class="w-100">
|
|
464
493
|
<div class="w-100">
|
|
465
494
|
${obj.preview
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
495
|
+
? PdClass.showSwiper({
|
|
496
|
+
gvc: gvc,
|
|
497
|
+
prod: obj.prod,
|
|
498
|
+
vm: obj.vm,
|
|
499
|
+
})
|
|
500
|
+
: ``}
|
|
472
501
|
</div>
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
502
|
+
</div>`,
|
|
503
|
+
` <div class="w-100">
|
|
504
|
+
<h1 style="color: ${titleFontColor};font-size:${document.body.clientWidth > 991 ? `28` : `20`}px;">
|
|
505
|
+
${prod.title}</h1>
|
|
477
506
|
<div class="d-flex flex-wrap" style="gap:10px;">
|
|
478
507
|
${prod.product_tag.language[Language.getLanguage()]
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
508
|
+
.map((tag) => {
|
|
509
|
+
return html `
|
|
510
|
+
<div
|
|
511
|
+
class="mb-3 rounded-1 text-white d-flex align-items-center justify-content-center px-2 "
|
|
512
|
+
style="background: ${glitter.share.globalValue['theme_color.0.solid-button-bg']};font-size: 12px;"
|
|
513
|
+
>
|
|
514
|
+
${tag}
|
|
515
|
+
</div>`;
|
|
516
|
+
})
|
|
517
|
+
.join('')}
|
|
488
518
|
</div>
|
|
489
519
|
${prod.min_qty && `${prod.min_qty}` > `1`
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
520
|
+
? html `
|
|
521
|
+
<div class="insignia mx-0 w-auto mt-0 mb-3 fw-500 py-2 me-1"
|
|
522
|
+
style="background: #ffe9b2;margin-left:5px;">
|
|
523
|
+
${Language.text('min_p_count').replace('_c_', `<span class="fw-bold mx-1">${prod.min_qty}</span>`)}
|
|
524
|
+
</div>`
|
|
525
|
+
: ``}
|
|
494
526
|
${prod.max_qty && `${prod.max_qty}` > `1`
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
527
|
+
? html `
|
|
528
|
+
<div class="insignia mx-0 w-auto mt-0 mb-3 fw-500 py-2"
|
|
529
|
+
style="background: #ffe9b2;margin-left:5px;">
|
|
530
|
+
${Language.text('max_p_count').replace('_c_', `<span class="fw-bold mx-1">${prod.max_qty}</span>`)}
|
|
531
|
+
</div>`
|
|
532
|
+
: ``}
|
|
533
|
+
${language_data && language_data.sub_title ? html `
|
|
534
|
+
<div class="mb-3">${language_data.sub_title}</div> ` : ``}
|
|
500
535
|
${gvc.bindView({
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
536
|
+
bind: ids.price,
|
|
537
|
+
view: () => {
|
|
538
|
+
var _a, _b;
|
|
539
|
+
const v = prod.variants.find((variant) => PdClass.ObjCompare(variant.spec, vm.specs, true));
|
|
540
|
+
if (!v)
|
|
541
|
+
return '錯誤';
|
|
542
|
+
const comparePrice = parseInt(`${(_a = v.compare_price) !== null && _a !== void 0 ? _a : 0}`, 10);
|
|
543
|
+
const originPrice = parseInt(`${(_b = v.origin_price) !== null && _b !== void 0 ? _b : 0}`, 10);
|
|
544
|
+
const lineThroughPrice = comparePrice > originPrice ? originPrice : comparePrice;
|
|
545
|
+
return html `
|
|
546
|
+
<div class="d-flex align-items-end" style="font-family: 'Noto Sans'; gap: 8px;">
|
|
547
|
+
<div style="color: ${(lineThroughPrice > 0 && lineThroughPrice > v.sale_price) ? '#ff5353' : titleFontColor}; font-size: 24px; font-weight: 700; line-height: normal">
|
|
548
|
+
${Currency.convertCurrencyText(v.sale_price)}
|
|
549
|
+
</div>
|
|
550
|
+
${lineThroughPrice > 0 && lineThroughPrice > v.sale_price
|
|
551
|
+
? html `
|
|
552
|
+
<div style="color: #8D8D8D; font-size: 16px; text-decoration: line-through;">
|
|
553
|
+
${Currency.convertCurrencyText(lineThroughPrice)}
|
|
554
|
+
</div> `
|
|
555
|
+
: ''}
|
|
556
|
+
</div>
|
|
557
|
+
`;
|
|
558
|
+
},
|
|
559
|
+
divCreate: {
|
|
560
|
+
style: 'margin-bottom: 12px;'
|
|
561
|
+
}
|
|
562
|
+
})}
|
|
563
|
+
${gvc.bindView(() => {
|
|
564
|
+
return {
|
|
565
|
+
bind: ids.ids_spec,
|
|
566
|
+
view: () => {
|
|
567
|
+
return prod.specs.map((spec, index1) => {
|
|
568
|
+
return html `
|
|
569
|
+
<div>
|
|
525
570
|
<h5 class="mb-2" style="color: ${titleFontColor};font-size:14px;">
|
|
526
571
|
${(spec.language_title && spec.language_title[Language.getLanguage()]) || spec.title}
|
|
527
572
|
</h5>
|
|
528
573
|
<div class="d-flex gap-2 flex-wrap">
|
|
529
574
|
${gvc.map(spec.option.map((opt) => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
575
|
+
return html `
|
|
576
|
+
<div
|
|
577
|
+
gvc-option="spec-option-${index1}"
|
|
578
|
+
class="spec-option ${vm.specs[index1] === opt.title ? 'selected-option' : ''}"
|
|
579
|
+
onclick="${gvc.event((e) => {
|
|
580
|
+
const allOptions = document.querySelectorAll(`div[gvc-option=spec-option-${index1}]`);
|
|
581
|
+
allOptions.forEach((option) => {
|
|
582
|
+
option.classList.remove('selected-option');
|
|
583
|
+
});
|
|
584
|
+
e.classList.toggle('selected-option');
|
|
585
|
+
vm.specs[index1] = opt.title;
|
|
586
|
+
const v = prod.variants.find((variant) => {
|
|
587
|
+
return PdClass.ObjCompare(variant.spec, vm.specs, true);
|
|
588
|
+
});
|
|
589
|
+
if (v === null || v === void 0 ? void 0 : v.preview_image) {
|
|
590
|
+
let index = prod.preview_image.findIndex((src) => {
|
|
591
|
+
return src == v.preview_image;
|
|
592
|
+
});
|
|
593
|
+
if (index >= 0) {
|
|
594
|
+
vm.swiper.slideTo(index);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
refreshAll();
|
|
598
|
+
})}"
|
|
599
|
+
>
|
|
554
600
|
<span style="font-size: 15px; font-weight: 500; letter-spacing: 1.76px;"
|
|
555
|
-
|
|
601
|
+
>${(opt.language_title && opt.language_title[Language.getLanguage()]) || opt.title}</span
|
|
556
602
|
>
|
|
557
|
-
|
|
558
|
-
|
|
603
|
+
</div>`;
|
|
604
|
+
}))}
|
|
559
605
|
</div>
|
|
560
606
|
</div>
|
|
561
607
|
<div class="mt-3"></div>`;
|
|
562
|
-
|
|
563
|
-
${[
|
|
564
|
-
gvc.bindView(() => {
|
|
565
|
-
return {
|
|
566
|
-
bind: ids.qty_count,
|
|
567
|
-
view: () => {
|
|
568
|
-
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
569
|
-
const cartItem = new ApiCart().cart.line_items.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
570
|
-
if (variant &&
|
|
571
|
-
(variant.stock < parseInt(vm.quantity, 10) || (cartItem && variant.stock < cartItem.count + parseInt(vm.quantity, 10))) &&
|
|
572
|
-
`${variant.show_understocking}` !== 'false') {
|
|
573
|
-
return '';
|
|
574
|
-
}
|
|
575
|
-
return html `
|
|
576
|
-
<h5 class="mb-0" style="color: ${titleFontColor};font-size:14px;">${Language.text('quantity')}</h5>
|
|
577
|
-
<div class="d-flex align-items-center" style="color:${titleFontColor};">
|
|
578
|
-
<select
|
|
579
|
-
class="form-select custom-select me-2"
|
|
580
|
-
style="border-radius: 5px; color: #575757; width: 100px;height:38px;"
|
|
581
|
-
onchange="${gvc.event((e) => {
|
|
582
|
-
vm.quantity = e.value;
|
|
583
|
-
gvc.notifyDataChange([ids.addCartButton, ids.stock_count]);
|
|
584
|
-
})}"
|
|
585
|
-
>
|
|
586
|
-
${gvc.map([
|
|
587
|
-
...new Array((() => {
|
|
588
|
-
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
589
|
-
if (!variant || variant.show_understocking === 'false') {
|
|
590
|
-
return 50;
|
|
591
|
-
}
|
|
592
|
-
return variant.stock < 50 ? variant.stock : 50;
|
|
593
|
-
})()),
|
|
594
|
-
].map((item, index) => {
|
|
595
|
-
return html ` <option value="${index + 1}">${index + 1}</option>`;
|
|
596
|
-
}))}
|
|
597
|
-
</select>
|
|
598
|
-
${prod.unit[Language.getLanguage()] || Language.text('pieces')}
|
|
599
|
-
</div>
|
|
600
|
-
`;
|
|
608
|
+
}).join('');
|
|
601
609
|
},
|
|
602
610
|
divCreate: {
|
|
603
|
-
class: `
|
|
604
|
-
}
|
|
611
|
+
class: `w-100`
|
|
612
|
+
}
|
|
605
613
|
};
|
|
606
|
-
})
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
(() =>
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
<div class="${stockClass} fw-500 mt-2" style="font-size: 14px; color: ${titleFontColor};">${Language.text('stock_count')}:${variant.stock}</div>
|
|
618
|
-
`;
|
|
619
|
-
}
|
|
614
|
+
})}
|
|
615
|
+
${[
|
|
616
|
+
gvc.bindView(() => {
|
|
617
|
+
return {
|
|
618
|
+
bind: ids.qty_count,
|
|
619
|
+
view: () => {
|
|
620
|
+
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
621
|
+
const cartItem = new ApiCart().cart.line_items.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
622
|
+
if (variant &&
|
|
623
|
+
(variant.stock < parseInt(vm.quantity, 10) || (cartItem && variant.stock < cartItem.count + parseInt(vm.quantity, 10))) &&
|
|
624
|
+
`${variant.show_understocking}` !== 'false') {
|
|
620
625
|
return '';
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
626
|
+
}
|
|
627
|
+
return html `
|
|
628
|
+
<h5 class="mb-0" style="color: ${titleFontColor};font-size:14px;">
|
|
629
|
+
${Language.text('quantity')}</h5>
|
|
630
|
+
<div class="d-flex align-items-center" style="color:${titleFontColor};">
|
|
631
|
+
<select
|
|
632
|
+
class="form-select custom-select me-2"
|
|
633
|
+
style="border-radius: 5px; color: #575757; width: 100px;height:38px;"
|
|
634
|
+
onchange="${gvc.event((e) => {
|
|
635
|
+
vm.quantity = e.value;
|
|
636
|
+
gvc.notifyDataChange([ids.addCartButton, ids.stock_count]);
|
|
637
|
+
})}"
|
|
638
|
+
>
|
|
639
|
+
${gvc.map([
|
|
640
|
+
...new Array((() => {
|
|
641
|
+
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
642
|
+
if (!variant || variant.show_understocking === 'false') {
|
|
643
|
+
return 50;
|
|
644
|
+
}
|
|
645
|
+
return variant.stock < 50 ? variant.stock : 50;
|
|
646
|
+
})()),
|
|
647
|
+
].map((item, index) => {
|
|
648
|
+
return html `
|
|
649
|
+
<option value="${index + 1}">${index + 1}</option>`;
|
|
650
|
+
}))}
|
|
651
|
+
</select>
|
|
652
|
+
${prod.unit[Language.getLanguage()] || Language.text('pieces')}
|
|
653
|
+
</div>
|
|
654
|
+
`;
|
|
655
|
+
},
|
|
656
|
+
divCreate: {
|
|
657
|
+
class: `flex-column gap-2 ${obj.with_qty === false ? `d-none` : `d-none d-sm-flex`} `,
|
|
658
|
+
},
|
|
659
|
+
};
|
|
660
|
+
}),
|
|
661
|
+
gvc.bindView(() => {
|
|
662
|
+
return {
|
|
663
|
+
bind: ids.stock_count,
|
|
664
|
+
view: () => {
|
|
665
|
+
return [
|
|
666
|
+
(() => {
|
|
667
|
+
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
668
|
+
if (variant && variant.show_understocking !== 'false') {
|
|
669
|
+
const stockClass = `${variant.stock}` === '0' ? 'text-danger' : '';
|
|
670
|
+
return html `
|
|
671
|
+
<div class="${stockClass} fw-500 mt-2"
|
|
672
|
+
style="font-size: 14px; color: ${titleFontColor};">
|
|
673
|
+
${Language.text('can_buy')}:${variant.stock}
|
|
674
|
+
</div>
|
|
675
|
+
`;
|
|
676
|
+
}
|
|
677
|
+
return '';
|
|
678
|
+
})(),
|
|
679
|
+
].join('');
|
|
680
|
+
},
|
|
681
|
+
divCreate: {},
|
|
682
|
+
};
|
|
683
|
+
}),
|
|
684
|
+
gvc.bindView({
|
|
685
|
+
bind: ids.addCartButton,
|
|
686
|
+
view: () => {
|
|
687
|
+
const variant = prod.variants.find((item) => {
|
|
688
|
+
return PdClass.ObjCompare(item.spec, vm.specs, true);
|
|
689
|
+
});
|
|
690
|
+
const cartItem = new ApiCart().cart.line_items.find((item) => {
|
|
691
|
+
return PdClass.ObjCompare(item.spec, vm.specs, true);
|
|
692
|
+
});
|
|
693
|
+
if (!variant) {
|
|
694
|
+
return html `
|
|
695
|
+
<button class="no-stock w-100" disabled>發生錯誤</button>`;
|
|
696
|
+
}
|
|
697
|
+
Ad.gtagEvent('view_item', {
|
|
698
|
+
currency: 'TWD',
|
|
699
|
+
value: variant.sale_price,
|
|
700
|
+
items: [
|
|
701
|
+
{
|
|
702
|
+
item_id: prod.id,
|
|
703
|
+
item_name: prod.title,
|
|
704
|
+
item_variant: variant.spec.length > 0 ? variant.spec.join('-') : '',
|
|
705
|
+
price: variant.sale_price,
|
|
706
|
+
},
|
|
707
|
+
],
|
|
708
|
+
});
|
|
709
|
+
Ad.fbqEvent('ViewContent', {
|
|
710
|
+
content_ids: [variant.sku || prod.id],
|
|
711
|
+
content_type: 'product',
|
|
712
|
+
value: variant.sale_price,
|
|
713
|
+
currency: 'TWD',
|
|
714
|
+
});
|
|
715
|
+
if (((variant.stock < parseInt(vm.quantity, 10)) &&
|
|
716
|
+
`${variant.show_understocking}` !== 'false') && (document.body.clientWidth > 800)) {
|
|
717
|
+
return html `
|
|
718
|
+
<button class="no-stock w-100" disabled>${Language.text('out_of_stock')}
|
|
719
|
+
</button>`;
|
|
720
|
+
}
|
|
721
|
+
if (obj.is_gift) {
|
|
722
|
+
return `<button
|
|
723
|
+
class="add-cart-imd-btn fw-bold"
|
|
724
|
+
style="width:calc(100% - 10px);cursor: pointer;height:48px;"
|
|
665
725
|
onclick="${gvc.event(() => {
|
|
726
|
+
if (obj.only_select) {
|
|
727
|
+
obj.only_select({ id: prod.id, specs: vm.specs });
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
new ApiCart(ApiCart.checkoutCart).addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
731
|
+
gvc.glitter.recreateView('.js-cart-count');
|
|
732
|
+
gvc.glitter.recreateView('.shopping-cart');
|
|
733
|
+
PdClass.jumpAlert({
|
|
734
|
+
gvc,
|
|
735
|
+
text: html `${Language.text('add_to_cart_success')}`,
|
|
736
|
+
justify: 'top',
|
|
737
|
+
align: 'center',
|
|
738
|
+
width: 300,
|
|
739
|
+
});
|
|
740
|
+
ApiTrack.track({
|
|
741
|
+
event_name: "AddToCart",
|
|
742
|
+
custom_data: {
|
|
743
|
+
currency: "TWD",
|
|
744
|
+
value: variant.sale_price,
|
|
745
|
+
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
746
|
+
content_name: prod.title,
|
|
747
|
+
content_type: "product"
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
obj.callback && obj.callback();
|
|
751
|
+
}
|
|
752
|
+
})}"
|
|
753
|
+
>
|
|
754
|
+
${Language.text('confirm_select')}
|
|
755
|
+
</button>`;
|
|
756
|
+
}
|
|
757
|
+
let viewMap = [];
|
|
758
|
+
if (document.body.clientWidth < 800 && window.store_info.chat_toggle) {
|
|
759
|
+
viewMap.push(`<div class="rounded-3 d-flex flex-column align-items-center justify-content-center fs-6 add-cart-btn fw-bold "
|
|
760
|
+
style="height:44px;width:44px;" onclick="${gvc.event(() => {
|
|
761
|
+
const userID = (() => {
|
|
762
|
+
if (GlobalUser.token) {
|
|
763
|
+
return GlobalUser.parseJWT(GlobalUser.token).payload.userID;
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
return gvc.glitter.macAddress;
|
|
767
|
+
}
|
|
768
|
+
})();
|
|
769
|
+
gvc.glitter.getModule(new URL('./cms-plugin/customer-message-user.js', gvc.glitter.root_path).href, (cl) => {
|
|
770
|
+
cl.mobileChat({
|
|
771
|
+
gvc: gvc,
|
|
772
|
+
chat: {
|
|
773
|
+
chat_id: [`${userID}`, 'manager'].sort().join('-'),
|
|
774
|
+
type: 'user',
|
|
775
|
+
},
|
|
776
|
+
user_id: `${userID}`
|
|
777
|
+
});
|
|
778
|
+
});
|
|
779
|
+
})}">
|
|
780
|
+
<i class="fa-brands fa-rocketchat"></i>
|
|
781
|
+
<div style="font-size:10px;">${Language.text('chat')}</div>
|
|
782
|
+
</div>`);
|
|
783
|
+
}
|
|
784
|
+
viewMap.push(`<div class="rounded-3 d-flex flex-column align-items-center justify-content-center fs-6 add-cart-btn fw-bold "
|
|
785
|
+
style="height:44px;width:44px;cursor: pointer;" onclick="${gvc.event(() => {
|
|
786
|
+
navigator.clipboard.writeText(`${window.location.href}`);
|
|
787
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
788
|
+
dialog.successMessage({ text: Language.text('copy_link_success') });
|
|
789
|
+
})}">
|
|
790
|
+
<i class="fa-solid fa-share"></i>
|
|
791
|
+
<div style="font-size:10px;">${Language.text('share')}</div>
|
|
792
|
+
</div>`);
|
|
793
|
+
if (window.store_info.wishlist) {
|
|
794
|
+
viewMap.push(gvc.bindView(() => {
|
|
795
|
+
return {
|
|
796
|
+
bind: ids.wishStatus,
|
|
797
|
+
view: () => {
|
|
798
|
+
return html `${(vm.wishStatus) ? ` <i class="fa-solid fa-heart" style="color:white;"></i>` : ` <i class="fa-regular fa-heart"></i>`}
|
|
799
|
+
<div style="font-size:10px; ${(vm.wishStatus) ? `color:white;` : ``}">
|
|
800
|
+
${(vm.wishStatus) ? Language.text('h_collect') : Language.text('collect')}
|
|
801
|
+
</div>`;
|
|
802
|
+
},
|
|
803
|
+
divCreate: () => {
|
|
804
|
+
return {
|
|
805
|
+
option: [
|
|
806
|
+
{
|
|
807
|
+
key: 'onclick',
|
|
808
|
+
value: gvc.event(() => {
|
|
809
|
+
if (CheckInput.isEmpty(GlobalUser.token)) {
|
|
810
|
+
changePage('login', 'page', {});
|
|
811
|
+
GlobalUser.loginRedirect = location.href;
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
815
|
+
dialog.dataLoading({ visible: true });
|
|
816
|
+
ApiShop.getWishList().then((getRes) => {
|
|
817
|
+
var _a;
|
|
818
|
+
if (getRes.result && getRes.response.data) {
|
|
819
|
+
if (getRes.response.data.find((item) => `${item.id}` === `${prod.id}`)) {
|
|
820
|
+
ApiShop.deleteWishList(`${prod.id}`).then(() => __awaiter(this, void 0, void 0, function* () {
|
|
821
|
+
PdClass.jumpAlert({
|
|
822
|
+
gvc,
|
|
823
|
+
text: '刪除成功',
|
|
824
|
+
justify: 'top',
|
|
825
|
+
align: 'center',
|
|
826
|
+
});
|
|
827
|
+
vm.wishStatus = false;
|
|
828
|
+
gvc.notifyDataChange(ids.wishStatus);
|
|
829
|
+
dialog.dataLoading({ visible: false });
|
|
830
|
+
}));
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
const variant = (_a = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true))) !== null && _a !== void 0 ? _a : prod.variants[0];
|
|
834
|
+
Ad.gtagEvent('add_to_wishlist', {
|
|
835
|
+
currency: 'TWD',
|
|
836
|
+
value: variant.sale_price,
|
|
837
|
+
items: [
|
|
838
|
+
{
|
|
839
|
+
item_id: prod.id,
|
|
840
|
+
item_name: prod.title,
|
|
841
|
+
item_variant: variant.spec.length > 0 ? variant.spec.join('-') : '',
|
|
842
|
+
price: variant.sale_price,
|
|
843
|
+
},
|
|
844
|
+
],
|
|
845
|
+
});
|
|
846
|
+
Ad.fbqEvent('AddToWishlist', {
|
|
847
|
+
content_ids: [prod.id],
|
|
848
|
+
contents: [
|
|
849
|
+
{
|
|
850
|
+
id: prod.id,
|
|
851
|
+
quantity: 1,
|
|
852
|
+
},
|
|
853
|
+
],
|
|
854
|
+
value: variant.sale_price,
|
|
855
|
+
currency: 'TWD',
|
|
856
|
+
});
|
|
857
|
+
ApiShop.postWishList(`${prod.id}`).then(() => __awaiter(this, void 0, void 0, function* () {
|
|
858
|
+
PdClass.jumpAlert({
|
|
859
|
+
gvc,
|
|
860
|
+
text: '新增成功',
|
|
861
|
+
justify: 'top',
|
|
862
|
+
align: 'center',
|
|
863
|
+
});
|
|
864
|
+
vm.wishStatus = true;
|
|
865
|
+
gvc.notifyDataChange(ids.wishStatus);
|
|
866
|
+
dialog.dataLoading({ visible: false });
|
|
867
|
+
}));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
})
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
class: `rounded-3 d-flex flex-column align-items-center justify-content-center fs-6 add-cart-btn fw-bold`,
|
|
875
|
+
style: `height:44px;width:44px;cursor:pointer; ${(vm.wishStatus) ? `background: #ff5353;border:1px solid white;` : ``}`
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
}));
|
|
880
|
+
}
|
|
881
|
+
viewMap.push(`<button
|
|
882
|
+
class="add-cart-btn fw-bold fs-sm"
|
|
883
|
+
style=" flex: 1;height:44px;"
|
|
884
|
+
onclick="${gvc.event(() => {
|
|
885
|
+
if (document.body.clientWidth < 800) {
|
|
886
|
+
this.addProductPopUp(obj, 'addCart', () => {
|
|
887
|
+
refreshAll();
|
|
888
|
+
});
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
666
891
|
if (obj.only_select) {
|
|
667
892
|
obj.only_select({ id: prod.id, specs: vm.specs });
|
|
668
893
|
}
|
|
669
894
|
else {
|
|
670
|
-
new ApiCart(
|
|
895
|
+
new ApiCart().addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
671
896
|
gvc.glitter.recreateView('.js-cart-count');
|
|
672
897
|
gvc.glitter.recreateView('.shopping-cart');
|
|
673
898
|
PdClass.jumpAlert({
|
|
@@ -691,52 +916,23 @@ export class PdClass {
|
|
|
691
916
|
}
|
|
692
917
|
})}"
|
|
693
918
|
>
|
|
694
|
-
${Language.text('
|
|
695
|
-
</button
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
ApiCart.toCheckOutPage(ApiCart.buyItNow);
|
|
706
|
-
gvc.closeDialog();
|
|
707
|
-
ApiTrack.track({
|
|
708
|
-
event_name: "AddToCart",
|
|
709
|
-
custom_data: {
|
|
710
|
-
currency: "TWD",
|
|
711
|
-
value: variant.sale_price,
|
|
712
|
-
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
713
|
-
content_name: prod.title,
|
|
714
|
-
content_type: "product"
|
|
919
|
+
${Language.text('add_to_cart')}
|
|
920
|
+
</button>`);
|
|
921
|
+
viewMap.push(`<button
|
|
922
|
+
class="add-cart-imd-btn fw-bold fs-sm"
|
|
923
|
+
style="cursor: pointer; flex: 1;height:44px;"
|
|
924
|
+
onclick="${gvc.event(() => {
|
|
925
|
+
if (document.body.clientWidth < 800) {
|
|
926
|
+
this.addProductPopUp(obj, 'buyNow', () => {
|
|
927
|
+
refreshAll();
|
|
928
|
+
});
|
|
929
|
+
return;
|
|
715
930
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
<div class="flex-fill"></div>
|
|
722
|
-
<button
|
|
723
|
-
class="add-cart-btn fw-bold "
|
|
724
|
-
style="width:calc(50% - 5px);"
|
|
725
|
-
onclick="${gvc.event(() => {
|
|
726
|
-
if (obj.only_select) {
|
|
727
|
-
obj.only_select({ id: prod.id, specs: vm.specs });
|
|
728
|
-
}
|
|
729
|
-
else {
|
|
730
|
-
new ApiCart().addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
731
|
-
gvc.glitter.recreateView('.js-cart-count');
|
|
732
|
-
gvc.glitter.recreateView('.shopping-cart');
|
|
733
|
-
PdClass.jumpAlert({
|
|
734
|
-
gvc,
|
|
735
|
-
text: html `${Language.text('add_to_cart_success')}`,
|
|
736
|
-
justify: 'top',
|
|
737
|
-
align: 'center',
|
|
738
|
-
width: 300,
|
|
739
|
-
});
|
|
931
|
+
const buy_it = new ApiCart(ApiCart.buyItNow);
|
|
932
|
+
buy_it.clearCart();
|
|
933
|
+
buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
934
|
+
ApiCart.toCheckOutPage(ApiCart.buyItNow);
|
|
935
|
+
gvc.closeDialog();
|
|
740
936
|
ApiTrack.track({
|
|
741
937
|
event_name: "AddToCart",
|
|
742
938
|
custom_data: {
|
|
@@ -747,46 +943,202 @@ export class PdClass {
|
|
|
747
943
|
content_type: "product"
|
|
748
944
|
}
|
|
749
945
|
});
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
})}"
|
|
946
|
+
})}"
|
|
753
947
|
>
|
|
754
|
-
${Language.text('
|
|
755
|
-
</button
|
|
756
|
-
|
|
948
|
+
${Language.text('buy_it_now')}
|
|
949
|
+
</button>`);
|
|
950
|
+
return viewMap.join('');
|
|
951
|
+
},
|
|
952
|
+
divCreate: {
|
|
953
|
+
style: `${document.body.clientWidth > 800 ? `width:100%;height: 38px;` : `width:100%;z-index:10;`}gap:6px;`,
|
|
954
|
+
class: `d-flex ${(document.body.clientWidth < 800) ? `position-fixed bottom-0 start-0 px-2 py-2 pb-4 bg-white shadow border-top` : `mt-3`}`,
|
|
955
|
+
},
|
|
956
|
+
}),
|
|
957
|
+
(aboutVoucherHTML) ? `
|
|
958
|
+
<div class="w-100 border-top" style="margin-top:${this.isPhone() ? 10 : 20}px;margin-bottom:${this.isPhone() ? 10 : 10}px;"></div>
|
|
959
|
+
<div class="w-100">
|
|
960
|
+
<h1 style="color: ${titleFontColor};font-size:16px;">本商品適用活動</h1>
|
|
961
|
+
${aboutVoucherHTML}
|
|
962
|
+
</div>` : ``,
|
|
963
|
+
].join('')}
|
|
964
|
+
</div>`
|
|
965
|
+
];
|
|
966
|
+
return html `
|
|
967
|
+
<div class="d-flex flex-column flex-lg-row w-100" style="gap:${this.isPhone() ? 20 : 40}px">
|
|
968
|
+
${viewMap.join(``)}
|
|
969
|
+
</div>
|
|
970
|
+
`;
|
|
971
|
+
}
|
|
972
|
+
static addProductPopUp(obj, type, close_event) {
|
|
973
|
+
var _a, _b;
|
|
974
|
+
const gvc = obj.gvc;
|
|
975
|
+
const glitter = gvc.glitter;
|
|
976
|
+
const titleFontColor = obj.titleFontColor;
|
|
977
|
+
const prod = obj.prod;
|
|
978
|
+
const vm = obj.vm;
|
|
979
|
+
const ids = {
|
|
980
|
+
price: glitter.getUUID(),
|
|
981
|
+
wishStatus: glitter.getUUID(),
|
|
982
|
+
addCartButton: glitter.getUUID(),
|
|
983
|
+
stock_count: glitter.getUUID(),
|
|
984
|
+
qty_count: glitter.getUUID(),
|
|
985
|
+
};
|
|
986
|
+
obj.gvc.addStyle(`
|
|
987
|
+
.insignia {
|
|
988
|
+
border-radius: 0.5rem;
|
|
989
|
+
padding: 6px 8px;
|
|
990
|
+
font-size: 0.875rem;
|
|
991
|
+
display: inline-block;
|
|
992
|
+
font-weight: 500;
|
|
993
|
+
line-height: 1.5;
|
|
994
|
+
text-align: center;
|
|
995
|
+
white-space: normal;
|
|
996
|
+
vertical-align: baseline;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
.insignia-voucher {
|
|
1000
|
+
display: flex;
|
|
1001
|
+
height: 22px;
|
|
1002
|
+
padding: 4px 6px;
|
|
1003
|
+
justify-content: center;
|
|
1004
|
+
align-items: center;
|
|
1005
|
+
gap: 4px;
|
|
1006
|
+
border-radius: 2px;
|
|
1007
|
+
font-size: 14px;
|
|
1008
|
+
}
|
|
1009
|
+
`);
|
|
1010
|
+
let changePage = (index, type, subData) => {
|
|
1011
|
+
};
|
|
1012
|
+
gvc.glitter.getModule(new URL('./official_event/page/change-page.js', gvc.glitter.root_path).href, (cl) => {
|
|
1013
|
+
changePage = cl.changePage;
|
|
1014
|
+
});
|
|
1015
|
+
const language_data = prod.language_data && prod.language_data[Language.getLanguage()];
|
|
1016
|
+
ProductInitial.initial(prod);
|
|
1017
|
+
const solidButtonBgr = (_a = glitter.share.globalValue['theme_color.0.solid-button-bg']) !== null && _a !== void 0 ? _a : '#dddddd';
|
|
1018
|
+
const solidButtonText = (_b = glitter.share.globalValue['theme_color.0.solid-button-text']) !== null && _b !== void 0 ? _b : '#000000';
|
|
1019
|
+
obj.gvc.glitter.innerDialog((gvc) => {
|
|
1020
|
+
const variant = prod.variants.find((item) => {
|
|
1021
|
+
return PdClass.ObjCompare(item.spec, vm.specs, true);
|
|
1022
|
+
});
|
|
1023
|
+
return `<div class="w-100 h-100 position-absolute bottom-0 left-0" onclick="${gvc.event(() => {
|
|
1024
|
+
gvc.closeDialog();
|
|
1025
|
+
})}"></div>
|
|
1026
|
+
<div class="rounded-top bg-white w-100 position-absolute bottom-0 left-0 px-3 pt-3" style="padding-bottom:100px;">
|
|
1027
|
+
|
|
1028
|
+
<div class="d-flex align-items-center mb-3 " style="margin-top:20px;gap:10px;">
|
|
1029
|
+
<div style="width: 88px;height: 88px;border-radius: 10px;background: 50%/cover url('${variant === null || variant === void 0 ? void 0 : variant.preview_image}');"></div>
|
|
1030
|
+
<div class="d-flex flex-column" style="gap:5px;">
|
|
1031
|
+
<div class="fw-bold" style="color: ${titleFontColor};font-size:14px;">${prod.title}</div>
|
|
1032
|
+
${gvc.bindView({
|
|
1033
|
+
bind: ids.price,
|
|
1034
|
+
view: () => {
|
|
1035
|
+
var _a, _b;
|
|
1036
|
+
const v = prod.variants.find((variant) => PdClass.ObjCompare(variant.spec, vm.specs, true));
|
|
1037
|
+
if (!v)
|
|
1038
|
+
return '錯誤';
|
|
1039
|
+
const comparePrice = parseInt(`${(_a = v.compare_price) !== null && _a !== void 0 ? _a : 0}`, 10);
|
|
1040
|
+
const originPrice = parseInt(`${(_b = v.origin_price) !== null && _b !== void 0 ? _b : 0}`, 10);
|
|
1041
|
+
const lineThroughPrice = comparePrice > originPrice ? originPrice : comparePrice;
|
|
1042
|
+
return html `
|
|
1043
|
+
<div class="d-flex align-items-end" style=" gap: 8px;">
|
|
1044
|
+
<div style="color: ${(lineThroughPrice > 0 && lineThroughPrice > v.sale_price) ? '#ff5353' : titleFontColor}; font-size: 16px; font-weight: 700; ">
|
|
1045
|
+
${Currency.convertCurrencyText(v.sale_price)}
|
|
1046
|
+
</div>
|
|
1047
|
+
${lineThroughPrice > 0 && lineThroughPrice > v.sale_price
|
|
1048
|
+
? html `
|
|
1049
|
+
<div style="color: #8D8D8D; font-size: 14px; text-decoration: line-through;">
|
|
1050
|
+
${Currency.convertCurrencyText(lineThroughPrice)}
|
|
1051
|
+
</div> `
|
|
1052
|
+
: ''}
|
|
1053
|
+
</div>
|
|
1054
|
+
`;
|
|
757
1055
|
},
|
|
758
1056
|
divCreate: {
|
|
759
|
-
style:
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
align: 'center',
|
|
1057
|
+
style: ''
|
|
1058
|
+
}
|
|
1059
|
+
})}
|
|
1060
|
+
</div>
|
|
1061
|
+
</div>
|
|
1062
|
+
${[
|
|
1063
|
+
prod.specs.map((spec, index1) => {
|
|
1064
|
+
return html `
|
|
1065
|
+
<div>
|
|
1066
|
+
<h5 class="mb-2" style="color: ${titleFontColor};font-size:14px;">
|
|
1067
|
+
${(spec.language_title && spec.language_title[Language.getLanguage()]) || spec.title}
|
|
1068
|
+
</h5>
|
|
1069
|
+
<div class="d-flex gap-2 flex-wrap">
|
|
1070
|
+
${gvc.map(spec.option.map((opt) => {
|
|
1071
|
+
return html `
|
|
1072
|
+
<div
|
|
1073
|
+
gvc-option="spec-option-${index1}"
|
|
1074
|
+
class="spec-option ${vm.specs[index1] === opt.title ? 'selected-option' : ''}"
|
|
1075
|
+
onclick="${gvc.event((e) => {
|
|
1076
|
+
const allOptions = document.querySelectorAll(`div[gvc-option=spec-option-${index1}]`);
|
|
1077
|
+
allOptions.forEach((option) => {
|
|
1078
|
+
option.classList.remove('selected-option');
|
|
782
1079
|
});
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
1080
|
+
e.classList.toggle('selected-option');
|
|
1081
|
+
vm.specs[index1] = opt.title;
|
|
1082
|
+
const v = prod.variants.find((variant) => {
|
|
1083
|
+
return PdClass.ObjCompare(variant.spec, vm.specs, true);
|
|
1084
|
+
});
|
|
1085
|
+
if (v === null || v === void 0 ? void 0 : v.preview_image) {
|
|
1086
|
+
let index = prod.preview_image.findIndex((src) => {
|
|
1087
|
+
return src == v.preview_image;
|
|
1088
|
+
});
|
|
1089
|
+
if (index >= 0) {
|
|
1090
|
+
vm.swiper.slideTo(index);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
gvc.recreateView();
|
|
1094
|
+
})}"
|
|
1095
|
+
>
|
|
1096
|
+
<span style="font-size: 15px; font-weight: 500; letter-spacing: 1.76px;"
|
|
1097
|
+
>${(opt.language_title && opt.language_title[Language.getLanguage()]) || opt.title}</span
|
|
1098
|
+
>
|
|
1099
|
+
</div>`;
|
|
1100
|
+
}))}
|
|
1101
|
+
</div>
|
|
1102
|
+
</div>
|
|
1103
|
+
<div class="mt-3"></div>`;
|
|
1104
|
+
}).join(''),
|
|
1105
|
+
gvc.bindView(() => {
|
|
1106
|
+
return {
|
|
1107
|
+
bind: ids.stock_count,
|
|
1108
|
+
view: () => {
|
|
1109
|
+
return [
|
|
1110
|
+
(() => {
|
|
1111
|
+
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
1112
|
+
if (variant && variant.show_understocking !== 'false') {
|
|
1113
|
+
const stockClass = `${variant.stock}` === '0' ? 'text-danger' : '';
|
|
1114
|
+
return html `
|
|
1115
|
+
<div class="${stockClass} fw-500 mt-2"
|
|
1116
|
+
style="font-size: 14px; color: ${titleFontColor};">
|
|
1117
|
+
${Language.text('can_buy')}:${variant.stock}
|
|
1118
|
+
</div>
|
|
1119
|
+
`;
|
|
1120
|
+
}
|
|
1121
|
+
return '';
|
|
1122
|
+
})(),
|
|
1123
|
+
].join('');
|
|
1124
|
+
},
|
|
1125
|
+
divCreate: {},
|
|
1126
|
+
};
|
|
1127
|
+
}),
|
|
1128
|
+
gvc.bindView({
|
|
1129
|
+
bind: ids.addCartButton,
|
|
1130
|
+
view: () => {
|
|
1131
|
+
const variant = prod.variants.find((item) => {
|
|
1132
|
+
return PdClass.ObjCompare(item.spec, vm.specs, true);
|
|
1133
|
+
});
|
|
1134
|
+
const cartItem = new ApiCart().cart.line_items.find((item) => {
|
|
1135
|
+
return PdClass.ObjCompare(item.spec, vm.specs, true);
|
|
1136
|
+
});
|
|
1137
|
+
if (!variant) {
|
|
1138
|
+
return html `
|
|
1139
|
+
<button class="no-stock w-100" disabled>發生錯誤</button>`;
|
|
1140
|
+
}
|
|
1141
|
+
Ad.gtagEvent('view_item', {
|
|
790
1142
|
currency: 'TWD',
|
|
791
1143
|
value: variant.sale_price,
|
|
792
1144
|
items: [
|
|
@@ -798,55 +1150,216 @@ export class PdClass {
|
|
|
798
1150
|
},
|
|
799
1151
|
],
|
|
800
1152
|
});
|
|
801
|
-
Ad.fbqEvent('
|
|
802
|
-
content_ids: [prod.id],
|
|
803
|
-
|
|
804
|
-
{
|
|
805
|
-
id: prod.id,
|
|
806
|
-
quantity: 1,
|
|
807
|
-
},
|
|
808
|
-
],
|
|
1153
|
+
Ad.fbqEvent('ViewContent', {
|
|
1154
|
+
content_ids: [variant.sku || prod.id],
|
|
1155
|
+
content_type: 'product',
|
|
809
1156
|
value: variant.sale_price,
|
|
810
1157
|
currency: 'TWD',
|
|
811
1158
|
});
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1159
|
+
if (obj.is_gift) {
|
|
1160
|
+
return `<button
|
|
1161
|
+
class="add-cart-imd-btn fw-bold h-100"
|
|
1162
|
+
style="width:calc(100% - 10px);cursor: pointer;"
|
|
1163
|
+
onclick="${gvc.event(() => {
|
|
1164
|
+
if (obj.only_select) {
|
|
1165
|
+
obj.only_select({ id: prod.id, specs: vm.specs });
|
|
1166
|
+
}
|
|
1167
|
+
else {
|
|
1168
|
+
new ApiCart(ApiCart.checkoutCart).addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
1169
|
+
gvc.glitter.recreateView('.js-cart-count');
|
|
1170
|
+
gvc.glitter.recreateView('.shopping-cart');
|
|
1171
|
+
PdClass.jumpAlert({
|
|
1172
|
+
gvc,
|
|
1173
|
+
text: html `${Language.text('add_to_cart_success')}`,
|
|
1174
|
+
justify: 'top',
|
|
1175
|
+
align: 'center',
|
|
1176
|
+
width: 300,
|
|
1177
|
+
});
|
|
1178
|
+
ApiTrack.track({
|
|
1179
|
+
event_name: "AddToCart",
|
|
1180
|
+
custom_data: {
|
|
1181
|
+
currency: "TWD",
|
|
1182
|
+
value: variant.sale_price,
|
|
1183
|
+
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
1184
|
+
content_name: prod.title,
|
|
1185
|
+
content_type: "product"
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
obj.callback && obj.callback();
|
|
1189
|
+
}
|
|
1190
|
+
})}"
|
|
1191
|
+
>
|
|
1192
|
+
${Language.text('confirm_select')}
|
|
1193
|
+
</button>`;
|
|
1194
|
+
}
|
|
1195
|
+
let viewMap = [];
|
|
1196
|
+
viewMap.push(gvc.bindView(() => {
|
|
1197
|
+
return {
|
|
1198
|
+
bind: ids.qty_count,
|
|
1199
|
+
view: () => {
|
|
1200
|
+
vm.quantity = vm.quantity || '1';
|
|
1201
|
+
const supportMinus = parseInt(vm.quantity, 10) > 1;
|
|
1202
|
+
function getSupportAds() {
|
|
1203
|
+
return !((variant.stock < (parseInt(vm.quantity, 10) + 1)) &&
|
|
1204
|
+
`${variant.show_understocking}` !== 'false');
|
|
1205
|
+
}
|
|
1206
|
+
function hasStock() {
|
|
1207
|
+
return !(((variant.stock < (parseInt(vm.quantity, 10))) || (variant.stock < 1)) &&
|
|
1208
|
+
`${variant.show_understocking}` !== 'false');
|
|
1209
|
+
}
|
|
1210
|
+
let supportAdds = getSupportAds();
|
|
1211
|
+
if (!hasStock()) {
|
|
1212
|
+
vm.quantity = `${variant.stock}`;
|
|
1213
|
+
}
|
|
1214
|
+
if (!hasStock()) {
|
|
1215
|
+
return ``;
|
|
1216
|
+
}
|
|
1217
|
+
return html `
|
|
1218
|
+
<div class="d-flex align-items-center" style="color:${titleFontColor};">
|
|
1219
|
+
<div class="d-flex align-items-center justify-content-center"
|
|
1220
|
+
style="width:44px;height: 44px;cursor: pointer;" onclick="${gvc.event(() => {
|
|
1221
|
+
if (supportMinus) {
|
|
1222
|
+
vm.quantity = `${parseInt(vm.quantity, 10) - 1}`;
|
|
1223
|
+
gvc.recreateView();
|
|
1224
|
+
}
|
|
1225
|
+
})}">
|
|
1226
|
+
<i class="fa-solid fa-minus"
|
|
1227
|
+
style="color:${(supportMinus) ? `#ff5353` : `#999`};"></i>
|
|
1228
|
+
</div>
|
|
1229
|
+
<select
|
|
1230
|
+
class="form-select custom-select mx-0 p-0 "
|
|
1231
|
+
style="border-radius: 5px; color: #575757; width: 100px;height:38px;background-image:none;${parseInt(vm.quantity, 10) < 10 ? `text-indent: 43%;` : `text-indent: 40%;`}"
|
|
1232
|
+
onchange="${gvc.event((e) => {
|
|
1233
|
+
vm.quantity = e.value;
|
|
1234
|
+
gvc.notifyDataChange([ids.addCartButton, ids.stock_count]);
|
|
1235
|
+
})}"
|
|
1236
|
+
>
|
|
1237
|
+
${gvc.map([
|
|
1238
|
+
...new Array((() => {
|
|
1239
|
+
const variant = prod.variants.find((item) => PdClass.ObjCompare(item.spec, vm.specs, true));
|
|
1240
|
+
if (!variant || variant.show_understocking === 'false') {
|
|
1241
|
+
return 50;
|
|
1242
|
+
}
|
|
1243
|
+
return variant.stock < 50 ? variant.stock : 50;
|
|
1244
|
+
})()),
|
|
1245
|
+
].map((item, index) => {
|
|
1246
|
+
return html `
|
|
1247
|
+
<option value="${index + 1}"
|
|
1248
|
+
${(`${vm.quantity}` === `${index + 1}`) ? `selected` : ``}>
|
|
1249
|
+
${index + 1}
|
|
1250
|
+
</option>`;
|
|
1251
|
+
}))}
|
|
1252
|
+
</select>
|
|
1253
|
+
<div class="d-flex align-items-center justify-content-center"
|
|
1254
|
+
style="width:44px;height: 44px;cursor: pointer;" onclick="${gvc.event(() => {
|
|
1255
|
+
if (supportAdds) {
|
|
1256
|
+
vm.quantity = `${parseInt(vm.quantity, 10) + 1}`;
|
|
1257
|
+
gvc.recreateView();
|
|
1258
|
+
}
|
|
1259
|
+
})}">
|
|
1260
|
+
<i class="fa-solid fa-plus"
|
|
1261
|
+
style="color:${(supportAdds) ? `#ff5353` : `#999`};"></i>
|
|
1262
|
+
</div>
|
|
1263
|
+
</div>
|
|
1264
|
+
`;
|
|
1265
|
+
},
|
|
1266
|
+
divCreate: {
|
|
1267
|
+
class: `flex-column gap-2 d-flex `,
|
|
1268
|
+
},
|
|
1269
|
+
};
|
|
821
1270
|
}));
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
1271
|
+
if (((variant.stock < 1) &&
|
|
1272
|
+
`${variant.show_understocking}` !== 'false')) {
|
|
1273
|
+
viewMap.push(`
|
|
1274
|
+
<button class="no-stock w-100 " style="height:44px;" disabled>${Language.text('out_of_stock')}
|
|
1275
|
+
</button>`);
|
|
1276
|
+
}
|
|
1277
|
+
else if (type === 'addCart') {
|
|
1278
|
+
viewMap.push(`<button
|
|
1279
|
+
class="add-cart-imd-btn fw-bold fs-sm"
|
|
1280
|
+
style=" flex: 1;height:44px;"
|
|
1281
|
+
onclick="${gvc.event(() => {
|
|
1282
|
+
if (obj.only_select) {
|
|
1283
|
+
obj.only_select({ id: prod.id, specs: vm.specs });
|
|
1284
|
+
}
|
|
1285
|
+
else {
|
|
1286
|
+
new ApiCart().addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
1287
|
+
gvc.glitter.recreateView('.js-cart-count');
|
|
1288
|
+
gvc.glitter.recreateView('.shopping-cart');
|
|
1289
|
+
PdClass.jumpAlert({
|
|
1290
|
+
gvc,
|
|
1291
|
+
text: html `${Language.text('add_to_cart_success')}`,
|
|
1292
|
+
justify: 'top',
|
|
1293
|
+
align: 'center',
|
|
1294
|
+
width: 300,
|
|
1295
|
+
});
|
|
1296
|
+
ApiTrack.track({
|
|
1297
|
+
event_name: "AddToCart",
|
|
1298
|
+
custom_data: {
|
|
1299
|
+
currency: "TWD",
|
|
1300
|
+
value: variant.sale_price,
|
|
1301
|
+
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
1302
|
+
content_name: prod.title,
|
|
1303
|
+
content_type: "product"
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
obj.callback && obj.callback();
|
|
1307
|
+
}
|
|
1308
|
+
gvc.closeDialog();
|
|
1309
|
+
})}"
|
|
1310
|
+
>
|
|
1311
|
+
${Language.text('add_to_cart')}
|
|
1312
|
+
</button>`);
|
|
1313
|
+
}
|
|
1314
|
+
else if (type === 'buyNow') {
|
|
1315
|
+
viewMap.push(`<button
|
|
1316
|
+
class="add-cart-imd-btn fw-bold fs-sm"
|
|
1317
|
+
style="cursor: pointer; flex: 1;height:44px;"
|
|
1318
|
+
onclick="${gvc.event(() => {
|
|
1319
|
+
const buy_it = new ApiCart(ApiCart.buyItNow);
|
|
1320
|
+
buy_it.clearCart();
|
|
1321
|
+
buy_it.addToCart(`${prod.id}`, vm.specs, vm.quantity);
|
|
1322
|
+
gvc.glitter.closeDiaLog();
|
|
1323
|
+
setTimeout(() => {
|
|
1324
|
+
ApiCart.toCheckOutPage(ApiCart.buyItNow);
|
|
1325
|
+
}, 100);
|
|
1326
|
+
ApiTrack.track({
|
|
1327
|
+
event_name: "AddToCart",
|
|
1328
|
+
custom_data: {
|
|
1329
|
+
currency: "TWD",
|
|
1330
|
+
value: variant.sale_price,
|
|
1331
|
+
content_ids: [variant.sku || `${prod.id}-${vm.specs.join('-')}`],
|
|
1332
|
+
content_name: prod.title,
|
|
1333
|
+
content_type: "product"
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
})}"
|
|
1337
|
+
>
|
|
1338
|
+
${Language.text('buy_it_now')}
|
|
1339
|
+
</button>`);
|
|
1340
|
+
}
|
|
1341
|
+
return viewMap.join('');
|
|
1342
|
+
},
|
|
1343
|
+
divCreate: {
|
|
1344
|
+
style: `${document.body.clientWidth > 800 ? `width:100%;height: 38px;` : `width:100%;z-index:10;`}gap:6px;`,
|
|
1345
|
+
class: `d-flex ${(document.body.clientWidth < 800) ? `position-fixed bottom-0 start-0 px-2 py-2 pb-4 bg-white shadow border-top` : `mt-3`} align-items-center`,
|
|
1346
|
+
},
|
|
1347
|
+
})
|
|
1348
|
+
].join('')}
|
|
1349
|
+
<div class="position-absolute d-flex align-items-center justify-content-center " style="top:10px;right:10px;width:30px;height:30px;"
|
|
1350
|
+
onclick="${gvc.event(() => {
|
|
1351
|
+
gvc.closeDialog();
|
|
1352
|
+
})}">
|
|
1353
|
+
<i class="fa-solid fa-xmark text-black fs-5"></i>
|
|
1354
|
+
</div>
|
|
1355
|
+
</div>
|
|
1356
|
+
`;
|
|
1357
|
+
}, 'addProductPopUp', {
|
|
1358
|
+
animation: Animation.popup,
|
|
1359
|
+
dismiss: () => {
|
|
1360
|
+
close_event();
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
850
1363
|
}
|
|
851
1364
|
static isPhone() {
|
|
852
1365
|
return document.body.clientWidth < 768;
|