ts-glitter 21.2.4 → 21.2.5
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 +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +19 -21
- package/lowcode/backend-manager/bg-blog.ts +20 -21
- package/lowcode/backend-manager/bg-product.js +94 -99
- package/lowcode/backend-manager/bg-product.ts +104 -109
- package/lowcode/cms-plugin/pos-pages/payment-page.js +16 -6
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +15 -2
- package/lowcode/cms-plugin/pos-pages/pos-function.js +102 -55
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +111 -61
- package/lowcode/public-components/checkout/index.js +5 -3
- package/lowcode/public-components/checkout/index.ts +8 -3
- package/package.json +1 -1
- package/src/api-public/controllers/shop.js +2 -1
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +2 -1
- package/src/api-public/controllers/user.js +2 -1
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +2 -1
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/fb-api.js +3 -2
- package/src/api-public/services/fb-api.js.map +1 -1
- package/src/api-public/services/fb-api.ts +3 -2
- package/src/api-public/services/monitor.d.ts +1 -0
- package/src/api-public/services/monitor.js +5 -2
- package/src/api-public/services/monitor.js.map +1 -1
- package/src/api-public/services/monitor.ts +5 -2
- package/src/seo-config.js +1 -1
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +1 -1
|
@@ -342,7 +342,6 @@ export class PosFunction {
|
|
|
342
342
|
`;
|
|
343
343
|
},
|
|
344
344
|
divCreate: {
|
|
345
|
-
class: '',
|
|
346
345
|
style: `width: 338px; max-height: 400px; overflow-y: auto; padding: 25px 20px; background: white; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px;`,
|
|
347
346
|
},
|
|
348
347
|
}));
|
|
@@ -477,86 +476,129 @@ export class PosFunction {
|
|
|
477
476
|
}
|
|
478
477
|
|
|
479
478
|
// SetMoney
|
|
480
|
-
public static setMoney(gvc: GVC, callback: (money: number) => void, title?: string) {
|
|
479
|
+
public static setMoney(gvc: GVC, def: number, callback: (money: number) => void, title?: string) {
|
|
481
480
|
gvc.glitter.innerDialog(gvc => {
|
|
482
481
|
const c_vm = {
|
|
483
|
-
text: '',
|
|
484
482
|
id: gvc.glitter.getUUID(),
|
|
483
|
+
addListener: false,
|
|
484
|
+
text: def ? `${def}` : '',
|
|
485
485
|
};
|
|
486
486
|
|
|
487
487
|
const numberButtons = [
|
|
488
|
-
[1, 2, 3],
|
|
489
|
-
[4, 5, 6],
|
|
490
488
|
[7, 8, 9],
|
|
491
|
-
[
|
|
489
|
+
[4, 5, 6],
|
|
490
|
+
[1, 2, 3],
|
|
491
|
+
['C', 0, '<i class="fa-regular fa-delete-left"></i>'],
|
|
492
492
|
];
|
|
493
493
|
|
|
494
494
|
const handleButtonClick = (value: any) => {
|
|
495
|
-
if (value === '確認') {
|
|
496
|
-
|
|
497
|
-
gvc.closeDialog();
|
|
495
|
+
if (value === '確認' || value === 'Enter') {
|
|
496
|
+
saveEvent();
|
|
498
497
|
} else if (value === '取消') {
|
|
499
|
-
|
|
500
|
-
} else if (typeof value === 'string' && value.includes('fa-regular')) {
|
|
498
|
+
closeEvent();
|
|
499
|
+
} else if (value === 'Backspace' || (typeof value === 'string' && value.includes('fa-regular'))) {
|
|
501
500
|
c_vm.text = c_vm.text.slice(0, -1);
|
|
502
501
|
gvc.notifyDataChange(c_vm.id);
|
|
502
|
+
} else if (value === 'c' || value === 'C') {
|
|
503
|
+
c_vm.text = '';
|
|
504
|
+
gvc.notifyDataChange(c_vm.id);
|
|
503
505
|
} else {
|
|
504
506
|
c_vm.text += value;
|
|
507
|
+
if (c_vm.text[0] === '0') {
|
|
508
|
+
c_vm.text = c_vm.text.slice(1, c_vm.text.length);
|
|
509
|
+
}
|
|
505
510
|
gvc.notifyDataChange(c_vm.id);
|
|
506
511
|
}
|
|
507
512
|
};
|
|
508
513
|
|
|
514
|
+
const numberBoardClickEvent = (e: any) => {
|
|
515
|
+
const key = e.key;
|
|
516
|
+
|
|
517
|
+
if (/^[0-9]$/.test(key) || key === 'Backspace' || key === 'Enter' || key.toLowerCase() === 'c') {
|
|
518
|
+
handleButtonClick(key);
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
const closeEvent = () => {
|
|
523
|
+
document.removeEventListener('keydown', numberBoardClickEvent);
|
|
524
|
+
gvc.closeDialog();
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const saveEvent = () => {
|
|
528
|
+
callback(parseInt(c_vm.text, 10));
|
|
529
|
+
closeEvent();
|
|
530
|
+
};
|
|
531
|
+
|
|
509
532
|
return gvc.bindView(() => ({
|
|
510
533
|
bind: c_vm.id,
|
|
511
|
-
view: () =>
|
|
512
|
-
|
|
513
|
-
style="flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 20px; display: inline-flex"
|
|
514
|
-
>
|
|
515
|
-
<div style="align-self: stretch; display: inline-flex; justify-content: center;">
|
|
516
|
-
<div class="fw-bold" style="text-align: center; color: #585858; font-size: 28px;">
|
|
517
|
-
${title || '輸入收款金額'}
|
|
518
|
-
</div>
|
|
519
|
-
</div>
|
|
520
|
-
<div class="border w-100 p-3 rounded-3 d-flex align-items-center justify-content-end" style="gap: 20px;">
|
|
521
|
-
<span style="font-size: 28px;">${c_vm.text || 0}</span>
|
|
522
|
-
</div>
|
|
534
|
+
view: () => {
|
|
535
|
+
return html`
|
|
523
536
|
<div
|
|
524
|
-
style="
|
|
537
|
+
style="flex-direction: column; justify-content: flex-start; align-items: flex-end; gap: 20px; display: inline-flex"
|
|
525
538
|
>
|
|
539
|
+
<div style="align-self: stretch; display: inline-flex; justify-content: center;">
|
|
540
|
+
<div class="fw-bold" style="text-align: center; color: #585858; font-size: 28px;">
|
|
541
|
+
${title || '輸入收款金額'}
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="border w-100 p-3 rounded-3 d-flex align-items-center justify-content-end" style="gap: 20px;">
|
|
545
|
+
<span style="font-size: 28px;">${c_vm.text || 0}</span>
|
|
546
|
+
</div>
|
|
526
547
|
<div
|
|
527
|
-
style="
|
|
548
|
+
style="background: white; flex-direction: column; justify-content: flex-start; align-items: center; gap: 32px; display: flex"
|
|
528
549
|
>
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
>
|
|
550
|
+
<div
|
|
551
|
+
style="align-self: stretch; border-radius: 10px; border: 1px solid #DDD; display: flex; flex-direction: column;"
|
|
552
|
+
>
|
|
553
|
+
${numberButtons
|
|
554
|
+
.map(
|
|
555
|
+
row => html`
|
|
556
|
+
<div style="display: inline-flex; justify-content: flex-start; align-items: center;">
|
|
557
|
+
${row
|
|
558
|
+
.map(
|
|
559
|
+
value => html`
|
|
540
560
|
<div
|
|
541
|
-
style="
|
|
561
|
+
style="height: 56px; width: 95px; display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;"
|
|
562
|
+
onclick="${gvc.event(() => handleButtonClick(value))}"
|
|
542
563
|
>
|
|
543
|
-
|
|
564
|
+
<div
|
|
565
|
+
style="align-self: stretch; text-align: center; color: #393939; font-size: 20px; font-weight: 700; line-height: 28px;"
|
|
566
|
+
>
|
|
567
|
+
${value}
|
|
568
|
+
</div>
|
|
544
569
|
</div>
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
570
|
+
`
|
|
571
|
+
)
|
|
572
|
+
.join('<div style="border-right: 1px #DDDDDD solid; height: 56px;"></div>')}
|
|
573
|
+
</div>
|
|
574
|
+
`
|
|
575
|
+
)
|
|
576
|
+
.join('<div style="border-top: 1px #DDDDDD solid; height: 1px; width: 100%;"></div>')}
|
|
577
|
+
</div>
|
|
553
578
|
</div>
|
|
579
|
+
<div>${BgWidget.save(gvc.event(saveEvent), '確認')}</div>
|
|
554
580
|
</div>
|
|
555
|
-
|
|
556
|
-
|
|
581
|
+
`;
|
|
582
|
+
},
|
|
557
583
|
divCreate: {
|
|
558
|
-
|
|
559
|
-
|
|
584
|
+
style: `
|
|
585
|
+
width: 338px;
|
|
586
|
+
padding: 25px 20px;
|
|
587
|
+
background: white;
|
|
588
|
+
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15);
|
|
589
|
+
border-radius: 20px;
|
|
590
|
+
overflow: hidden;
|
|
591
|
+
display: flex;
|
|
592
|
+
flex-direction: column;
|
|
593
|
+
align-items: center;
|
|
594
|
+
gap: 10px;
|
|
595
|
+
`,
|
|
596
|
+
},
|
|
597
|
+
onCreate: () => {
|
|
598
|
+
if (!c_vm.addListener) {
|
|
599
|
+
c_vm.addListener = true;
|
|
600
|
+
document.addEventListener('keydown', numberBoardClickEvent);
|
|
601
|
+
}
|
|
560
602
|
},
|
|
561
603
|
}));
|
|
562
604
|
}, 'setMoney');
|
|
@@ -615,11 +657,12 @@ export class PosFunction {
|
|
|
615
657
|
};
|
|
616
658
|
|
|
617
659
|
const handlePaymentAmountClick = (method: any, id: string, gvc: GVC, dialog: ShareDialog) => {
|
|
660
|
+
console.log(method);
|
|
618
661
|
if (method.paied) {
|
|
619
662
|
dialog.errorMessage({ text: '此付款金額已結清,無法進行調整' });
|
|
620
663
|
return;
|
|
621
664
|
}
|
|
622
|
-
PosFunction.setMoney(gvc, money => {
|
|
665
|
+
PosFunction.setMoney(gvc, method.total, money => {
|
|
623
666
|
method.total = money || 0;
|
|
624
667
|
gvc.notifyDataChange(id);
|
|
625
668
|
});
|
|
@@ -735,16 +778,23 @@ export class PosFunction {
|
|
|
735
778
|
|
|
736
779
|
return btnArray
|
|
737
780
|
.map(btn => {
|
|
738
|
-
return `
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
781
|
+
return html`
|
|
782
|
+
<div
|
|
783
|
+
style="flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px; border-radius: 10px; background: #F6F6F6; ${method.method ===
|
|
784
|
+
btn.value
|
|
785
|
+
? 'color: #393939; border: 3px solid #393939; box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.20);'
|
|
786
|
+
: 'color: #8D8D8D;'}"
|
|
787
|
+
onclick="${gvc.event(() => {
|
|
788
|
+
method = { method: btn.value, total: 0 };
|
|
789
|
+
gvc.notifyDataChange(id);
|
|
790
|
+
})}"
|
|
791
|
+
>
|
|
792
|
+
<div style="width: 28px; height: 28px;">
|
|
793
|
+
${drawIcon(method.method === btn.value, btn.value)}
|
|
794
|
+
</div>
|
|
795
|
+
<div style="font-size: 16px; font-weight: 500;">${btn.title}</div>
|
|
796
|
+
</div>
|
|
797
|
+
`;
|
|
748
798
|
})
|
|
749
799
|
.join('');
|
|
750
800
|
})()}
|
|
@@ -1181,6 +1181,7 @@ export class CheckoutIndex {
|
|
|
1181
1181
|
return d1.reBackType === 'giveaway';
|
|
1182
1182
|
})
|
|
1183
1183
|
.map((dd) => {
|
|
1184
|
+
dd.add_on_products = dd.add_on_products.filter(Boolean);
|
|
1184
1185
|
let isSelected = already_add.find(d2 => {
|
|
1185
1186
|
return dd.add_on_products.find((d1) => {
|
|
1186
1187
|
return d1.id === d2.id;
|
|
@@ -1296,7 +1297,7 @@ export class CheckoutIndex {
|
|
|
1296
1297
|
callback: () => {
|
|
1297
1298
|
let find = vm.cartData.lineItems.find((d1) => {
|
|
1298
1299
|
return dd.add_on_products.find((d2) => {
|
|
1299
|
-
return d2.id === d1.id;
|
|
1300
|
+
return d2 && d2.id === d1.id;
|
|
1300
1301
|
});
|
|
1301
1302
|
});
|
|
1302
1303
|
if (find) {
|
|
@@ -1351,14 +1352,14 @@ export class CheckoutIndex {
|
|
|
1351
1352
|
`;
|
|
1352
1353
|
})
|
|
1353
1354
|
.join('');
|
|
1354
|
-
return giftHtml && `<div class="rounded-3 bg-white p-3 mt-3">${giftHtml}</div>`;
|
|
1355
|
+
return giftHtml && html `<div class="rounded-3 bg-white p-3 mt-3">${giftHtml}</div>`;
|
|
1355
1356
|
})()}
|
|
1356
1357
|
<!--加購品-->
|
|
1357
1358
|
${(() => {
|
|
1358
1359
|
let add_on = [];
|
|
1359
1360
|
vm.cartData.voucherList.filter((dd) => {
|
|
1360
1361
|
if (dd.reBackType === 'add_on_items') {
|
|
1361
|
-
add_on = add_on.concat(dd.add_on_products);
|
|
1362
|
+
add_on = add_on.concat(dd.add_on_products).filter(Boolean);
|
|
1362
1363
|
}
|
|
1363
1364
|
});
|
|
1364
1365
|
if (add_on.length) {
|
|
@@ -1472,6 +1473,7 @@ export class CheckoutIndex {
|
|
|
1472
1473
|
is_gift: true,
|
|
1473
1474
|
callback: () => {
|
|
1474
1475
|
gvc.closeDialog();
|
|
1476
|
+
console.log(5);
|
|
1475
1477
|
let find = vm.cartData.lineItems.find((d1) => {
|
|
1476
1478
|
return dd.add_on_products.find((d2) => {
|
|
1477
1479
|
return d2.id === d1.id;
|
|
@@ -1315,14 +1315,18 @@ export class CheckoutIndex {
|
|
|
1315
1315
|
return d1.reBackType === 'giveaway';
|
|
1316
1316
|
})
|
|
1317
1317
|
.map((dd: any) => {
|
|
1318
|
+
dd.add_on_products = dd.add_on_products.filter(Boolean);
|
|
1319
|
+
|
|
1318
1320
|
let isSelected = already_add.find(d2 => {
|
|
1319
1321
|
return dd.add_on_products.find((d1: any) => {
|
|
1320
1322
|
return d1.id === d2.id;
|
|
1321
1323
|
});
|
|
1322
1324
|
});
|
|
1325
|
+
|
|
1323
1326
|
already_add = already_add.filter(dd => {
|
|
1324
1327
|
return !dd === isSelected;
|
|
1325
1328
|
});
|
|
1329
|
+
|
|
1326
1330
|
return html`
|
|
1327
1331
|
<span class="${gClass('banner-text')}">${dd.title}</span>
|
|
1328
1332
|
<div class="d-flex align-items-center w-100" style="overflow-x:auto;gap:10px;">
|
|
@@ -1442,7 +1446,7 @@ export class CheckoutIndex {
|
|
|
1442
1446
|
let find = vm.cartData.lineItems.find(
|
|
1443
1447
|
(d1: any) => {
|
|
1444
1448
|
return dd.add_on_products.find((d2: any) => {
|
|
1445
|
-
return d2.id === d1.id;
|
|
1449
|
+
return d2 && d2.id === d1.id;
|
|
1446
1450
|
});
|
|
1447
1451
|
}
|
|
1448
1452
|
);
|
|
@@ -1501,14 +1505,14 @@ export class CheckoutIndex {
|
|
|
1501
1505
|
`;
|
|
1502
1506
|
})
|
|
1503
1507
|
.join('');
|
|
1504
|
-
return giftHtml && `<div class="rounded-3 bg-white p-3 mt-3">${giftHtml}</div>`;
|
|
1508
|
+
return giftHtml && html`<div class="rounded-3 bg-white p-3 mt-3">${giftHtml}</div>`;
|
|
1505
1509
|
})()}
|
|
1506
1510
|
<!--加購品-->
|
|
1507
1511
|
${(() => {
|
|
1508
1512
|
let add_on: any[] = [];
|
|
1509
1513
|
vm.cartData.voucherList.filter((dd: any) => {
|
|
1510
1514
|
if (dd.reBackType === 'add_on_items') {
|
|
1511
|
-
add_on = add_on.concat(dd.add_on_products);
|
|
1515
|
+
add_on = add_on.concat(dd.add_on_products).filter(Boolean);
|
|
1512
1516
|
}
|
|
1513
1517
|
});
|
|
1514
1518
|
if (add_on.length) {
|
|
@@ -1634,6 +1638,7 @@ export class CheckoutIndex {
|
|
|
1634
1638
|
is_gift: true,
|
|
1635
1639
|
callback: () => {
|
|
1636
1640
|
gvc.closeDialog();
|
|
1641
|
+
console.log(5);
|
|
1637
1642
|
let find = vm.cartData.lineItems.find(
|
|
1638
1643
|
(d1: any) => {
|
|
1639
1644
|
return dd.add_on_products.find(
|
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ const pos_js_1 = require("../services/pos.js");
|
|
|
22
22
|
const shopnex_line_message_1 = require("../services/model/shopnex-line-message");
|
|
23
23
|
const caught_error_js_1 = require("../../modules/caught-error.js");
|
|
24
24
|
const checkout_event_js_1 = require("../services/checkout-event.js");
|
|
25
|
+
const monitor_js_1 = require("../services/monitor.js");
|
|
25
26
|
const router = express_1.default.Router();
|
|
26
27
|
router.post('/worker', async (req, resp) => {
|
|
27
28
|
try {
|
|
@@ -158,7 +159,7 @@ router.post('/checkout', async (req, resp) => {
|
|
|
158
159
|
code_array: req.body.code_array,
|
|
159
160
|
give_away: req.body.give_away,
|
|
160
161
|
language: req.headers['language'],
|
|
161
|
-
client_ip_address:
|
|
162
|
+
client_ip_address: monitor_js_1.Monitor.userIP(req),
|
|
162
163
|
fbc: req.cookies._fbc,
|
|
163
164
|
fbp: req.cookies._fbp,
|
|
164
165
|
temp_cart_id: req.body.temp_cart_id,
|