ts-glitter 22.5.7 → 22.5.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.
Files changed (83) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-product.js +13 -13
  4. package/lowcode/backend-manager/bg-product.ts +13 -13
  5. package/lowcode/backend-manager/bg-shopping.js +8 -13
  6. package/lowcode/backend-manager/bg-shopping.ts +8 -15
  7. package/lowcode/backend-manager/bg-widget.js +62 -49
  8. package/lowcode/backend-manager/bg-widget.ts +129 -93
  9. package/lowcode/cms-plugin/POS-setting.js +30 -9
  10. package/lowcode/cms-plugin/POS-setting.ts +49 -16
  11. package/lowcode/cms-plugin/cms-router.js +27 -21
  12. package/lowcode/cms-plugin/cms-router.ts +116 -101
  13. package/lowcode/cms-plugin/filter-options.js +25 -17
  14. package/lowcode/cms-plugin/filter-options.ts +27 -17
  15. package/lowcode/cms-plugin/module/product-excel.js +2 -0
  16. package/lowcode/cms-plugin/module/product-excel.ts +2 -0
  17. package/lowcode/cms-plugin/module/product-setting.js +13 -12
  18. package/lowcode/cms-plugin/module/product-setting.ts +26 -23
  19. package/lowcode/cms-plugin/order/order-module.js +91 -68
  20. package/lowcode/cms-plugin/order/order-module.ts +105 -73
  21. package/lowcode/cms-plugin/pos-checkout-setting.js +46 -39
  22. package/lowcode/cms-plugin/pos-checkout-setting.ts +237 -227
  23. package/lowcode/cms-plugin/pos-config-setting.js +25 -23
  24. package/lowcode/cms-plugin/pos-config-setting.ts +35 -32
  25. package/lowcode/cms-plugin/pos-pages/payment-function.js +253 -139
  26. package/lowcode/cms-plugin/pos-pages/payment-function.ts +405 -279
  27. package/lowcode/cms-plugin/pos-pages/payment-page.js +348 -267
  28. package/lowcode/cms-plugin/pos-pages/payment-page.ts +378 -296
  29. package/lowcode/cms-plugin/pos-pages/pos-function.js +76 -19
  30. package/lowcode/cms-plugin/pos-pages/pos-function.ts +84 -19
  31. package/lowcode/cms-plugin/shopping-discount-setting.js +2 -2
  32. package/lowcode/cms-plugin/shopping-discount-setting.ts +2 -2
  33. package/lowcode/cms-plugin/shopping-finance-setting.js +1590 -1701
  34. package/lowcode/cms-plugin/shopping-finance-setting.ts +1967 -2011
  35. package/lowcode/cms-plugin/shopping-order-manager.js +74 -62
  36. package/lowcode/cms-plugin/shopping-order-manager.ts +119 -85
  37. package/lowcode/cms-plugin/shopping-product-text.js +874 -531
  38. package/lowcode/cms-plugin/shopping-product-text.ts +1656 -1305
  39. package/lowcode/cms-plugin/shopping-setting-basic.js +152 -124
  40. package/lowcode/cms-plugin/shopping-setting-basic.ts +315 -247
  41. package/lowcode/css/editor.css +3 -2
  42. package/lowcode/glitter-base/global/language.js +5 -3
  43. package/lowcode/glitter-base/global/language.ts +8 -6
  44. package/lowcode/glitter-base/global/payment-config.js +6 -0
  45. package/lowcode/glitter-base/global/payment-config.ts +6 -3
  46. package/lowcode/public-components/product/pd-class.js +1 -3
  47. package/lowcode/public-components/product/pd-class.ts +1 -3
  48. package/lowcode/public-components/user-manager/um-order.js +2 -1
  49. package/lowcode/public-components/user-manager/um-order.ts +2 -1
  50. package/package.json +1 -1
  51. package/src/api-public/controllers/index.js +14 -3
  52. package/src/api-public/controllers/index.js.map +1 -1
  53. package/src/api-public/controllers/index.ts +16 -3
  54. package/src/api-public/controllers/shop.js +14 -7
  55. package/src/api-public/controllers/shop.js.map +1 -1
  56. package/src/api-public/controllers/shop.ts +14 -8
  57. package/src/api-public/services/data-analyze.d.ts +1 -1
  58. package/src/api-public/services/ezpay/tool.d.ts +0 -1
  59. package/src/api-public/services/financial-serviceV2.js +7 -17
  60. package/src/api-public/services/financial-serviceV2.js.map +1 -1
  61. package/src/api-public/services/shopee.js.map +1 -1
  62. package/src/api-public/services/updated-table-checked.js +20 -0
  63. package/src/api-public/services/updated-table-checked.js.map +1 -1
  64. package/src/api-public/services/updated-table-checked.ts +21 -0
  65. package/src/app-project/serverless/src/modules/database.d.ts +1 -1
  66. package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
  67. package/src/helper/glitter-util.d.ts +0 -1
  68. package/src/index.js +3 -3
  69. package/src/index.js.map +13 -1
  70. package/src/modules/tool.d.ts +2 -0
  71. package/src/modules/tool.js +7 -0
  72. package/src/modules/tool.js.map +1 -1
  73. package/src/modules/tool.ts +7 -0
  74. package/src/seo-config.js +3 -3
  75. package/src/seo-config.js.map +9 -1
  76. package/src/services/private_config.js +11 -0
  77. package/src/services/private_config.js.map +1 -1
  78. package/src/services/private_config.ts +11 -0
  79. package/src/services/saas-table-check.js +12 -0
  80. package/src/services/saas-table-check.js.map +1 -1
  81. package/src/services/saas-table-check.ts +12 -0
  82. package/src/services/ses.js +3 -4
  83. package/src/services/ses.js.map +1 -1
@@ -75,6 +75,7 @@ export class PaymentPage {
75
75
  const gvc = obj.gvc;
76
76
  const vm = obj.vm;
77
77
  const dialog = new ShareDialog(gvc.glitter);
78
+ const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
78
79
  PaymentPage.storeHistory(obj.ogOrderData);
79
80
  PaymentPage.addStyle(gvc);
80
81
 
@@ -1356,6 +1357,322 @@ export class PaymentPage {
1356
1357
  }
1357
1358
  });
1358
1359
 
1360
+ function drawIcon(black: boolean, type: string) {
1361
+ switch (type) {
1362
+ case 'cash':
1363
+ return html`
1364
+ <svg
1365
+ xmlns="http://www.w3.org/2000/svg"
1366
+ width="28"
1367
+ height="28"
1368
+ viewBox="0 0 28 28"
1369
+ fill="none"
1370
+ >
1371
+ <path
1372
+ d="M9.625 4.8125C9.625 4.81797 9.63047 4.84531 9.65781 4.89453C9.69063 4.96016 9.76719 5.06406 9.91484 5.19531C9.93672 5.21172 9.95859 5.23359 9.98047 5.25C8.95781 5.27187 7.9625 5.34297 7.00547 5.47422L7 4.8125C7 3.82812 7.53047 3.04062 8.15391 2.47734C8.77734 1.91406 9.61406 1.46562 10.5328 1.11563C12.3813 0.410156 14.8477 0 17.5 0C20.1523 0 22.6187 0.410156 24.4617 1.11016C25.3805 1.46016 26.2172 1.90859 26.8406 2.47187C27.4641 3.03516 28 3.82812 28 4.8125V10.5V16.1875C28 17.1719 27.4695 17.9594 26.8461 18.5227C26.2227 19.0859 25.3859 19.5344 24.4672 19.8844C23.9422 20.0867 23.368 20.2617 22.7555 20.4094V17.6914C23.0344 17.6094 23.2914 17.5219 23.532 17.4289C24.2758 17.1445 24.7898 16.8383 25.0906 16.5703C25.2383 16.4391 25.3148 16.3352 25.3477 16.2695C25.3805 16.2094 25.3805 16.1875 25.3805 16.1875V13.8031C25.0906 13.9453 24.7844 14.0766 24.4672 14.1969C23.9422 14.3992 23.368 14.5742 22.7555 14.7219V12.0039C23.0344 11.9219 23.2914 11.8344 23.532 11.7414C24.2758 11.457 24.7898 11.1508 25.0906 10.8828C25.2383 10.7516 25.3148 10.6477 25.3477 10.582C25.375 10.5328 25.3805 10.5055 25.3805 10.5V8.11562C25.0906 8.25781 24.7844 8.38906 24.4672 8.50938C23.718 8.79375 22.8594 9.03438 21.9352 9.21484C21.6562 8.80469 21.3336 8.45469 21.0164 8.17031C20.4641 7.67266 19.8242 7.26797 19.157 6.93438C20.8906 6.80859 22.4 6.48594 23.532 6.05391C24.2758 5.76953 24.7898 5.46328 25.0906 5.19531C25.2383 5.06406 25.3148 4.96016 25.3477 4.89453C25.375 4.84531 25.3805 4.81797 25.3805 4.8125C25.3805 4.8125 25.3805 4.78516 25.3477 4.73047C25.3148 4.66484 25.2383 4.56094 25.0906 4.42969C24.7898 4.15625 24.2758 3.85 23.532 3.57109C22.05 3.00234 19.9172 2.625 17.5 2.625C15.0828 2.625 12.95 3.00234 11.4734 3.56562C10.7297 3.85 10.2156 4.15625 9.91484 4.42422C9.76719 4.55547 9.69063 4.65938 9.65781 4.725C9.625 4.78516 9.625 4.80703 9.625 4.80703V4.8125ZM2.625 11.8125C2.625 11.818 2.63047 11.8453 2.65781 11.8945C2.69062 11.9602 2.76719 12.0641 2.91484 12.1953C3.21563 12.4688 3.72969 12.775 4.47344 13.0539C5.95 13.6172 8.08281 13.9945 10.5 13.9945C12.9172 13.9945 15.05 13.6172 16.5266 13.0539C17.2703 12.7695 17.7844 12.4633 18.0852 12.1953C18.2328 12.0641 18.3094 11.9602 18.3422 11.8945C18.3695 11.8453 18.375 11.818 18.375 11.8125C18.375 11.8125 18.375 11.7852 18.3422 11.7305C18.3094 11.6648 18.2328 11.5609 18.0852 11.4297C17.7844 11.1562 17.2703 10.85 16.5266 10.5711C15.05 10.0078 12.9172 9.63047 10.5 9.63047C8.08281 9.63047 5.95 10.0078 4.47344 10.5711C3.72969 10.8555 3.21563 11.1617 2.91484 11.4297C2.76719 11.5609 2.69062 11.6648 2.65781 11.7305C2.625 11.7906 2.625 11.8125 2.625 11.8125ZM0 11.8125C0 10.8281 0.530469 10.0406 1.15391 9.47734C1.77734 8.91406 2.61406 8.46562 3.53281 8.11562C5.38125 7.41016 7.84766 7 10.5 7C13.1523 7 15.6187 7.41016 17.4617 8.11016C18.3805 8.46016 19.2172 8.90859 19.8406 9.47188C20.4641 10.0352 21 10.8281 21 11.8125V17.5V23.1875C21 24.1719 20.4695 24.9594 19.8461 25.5227C19.2227 26.0859 18.3859 26.5344 17.4672 26.8844C15.6187 27.5898 13.1523 28 10.5 28C7.84766 28 5.38125 27.5898 3.53828 26.8898C2.61953 26.5398 1.78828 26.0914 1.15938 25.5281C0.530469 24.9648 0 24.1719 0 23.1875V17.5V11.8125ZM18.375 17.5V15.1156C18.0852 15.2578 17.7789 15.3891 17.4617 15.5094C15.6187 16.2148 13.1523 16.625 10.5 16.625C7.84766 16.625 5.38125 16.2148 3.53828 15.5148C3.22109 15.3945 2.91484 15.2633 2.625 15.1211V17.5C2.625 17.5055 2.63047 17.5328 2.65781 17.582C2.69062 17.6477 2.76719 17.7516 2.91484 17.8828C3.21563 18.1562 3.72969 18.4625 4.47344 18.7414C5.95 19.3047 8.08281 19.682 10.5 19.682C12.9172 19.682 15.05 19.3047 16.5266 18.7414C17.2703 18.457 17.7844 18.1508 18.0852 17.8828C18.2328 17.7516 18.3094 17.6477 18.3422 17.582C18.3695 17.5328 18.375 17.5055 18.375 17.5ZM3.53828 21.2023C3.22109 21.082 2.91484 20.9508 2.625 20.8086V23.1875C2.625 23.1875 2.625 23.2148 2.65781 23.2695C2.69062 23.3352 2.76719 23.4391 2.91484 23.5703C3.21563 23.8438 3.72969 24.15 4.47344 24.4289C5.95 24.9922 8.08281 25.3695 10.5 25.3695C12.9172 25.3695 15.05 24.9922 16.5266 24.4289C17.2703 24.1445 17.7844 23.8383 18.0852 23.5703C18.2328 23.4391 18.3094 23.3352 18.3422 23.2695C18.375 23.2094 18.375 23.1875 18.375 23.1875V20.8031C18.0852 20.9453 17.7789 21.0766 17.4617 21.1969C15.6187 21.9023 13.1523 22.3125 10.5 22.3125C7.84766 22.3125 5.38125 21.9023 3.53828 21.2023Z"
1373
+ fill="${black ? `#393939` : `#8D8D8D`}"
1374
+ />
1375
+ </svg>
1376
+ `;
1377
+ case 'creditCard':
1378
+ return html`
1379
+ <svg
1380
+ xmlns="http://www.w3.org/2000/svg"
1381
+ width="28"
1382
+ height="28"
1383
+ viewBox="0 0 28 28"
1384
+ fill="none"
1385
+ >
1386
+ <path
1387
+ d="M24.8889 5.84375C25.3167 5.84375 25.6667 6.19531 25.6667 6.625V8.1875H2.33333V6.625C2.33333 6.19531 2.68333 5.84375 3.11111 5.84375H24.8889ZM25.6667 12.875V22.25C25.6667 22.6797 25.3167 23.0312 24.8889 23.0312H3.11111C2.68333 23.0312 2.33333 22.6797 2.33333 22.25V12.875H25.6667ZM3.11111 3.5C1.39514 3.5 0 4.90137 0 6.625V22.25C0 23.9736 1.39514 25.375 3.11111 25.375H24.8889C26.6049 25.375 28 23.9736 28 22.25V6.625C28 4.90137 26.6049 3.5 24.8889 3.5H3.11111ZM5.83333 18.3437C5.18681 18.3437 4.66667 18.8662 4.66667 19.5156C4.66667 20.165 5.18681 20.6875 5.83333 20.6875H8.16667C8.81319 20.6875 9.33333 20.165 9.33333 19.5156C9.33333 18.8662 8.81319 18.3437 8.16667 18.3437H5.83333ZM12.0556 18.3437C11.409 18.3437 10.8889 18.8662 10.8889 19.5156C10.8889 20.165 11.409 20.6875 12.0556 20.6875H17.5C18.1465 20.6875 18.6667 20.165 18.6667 19.5156C18.6667 18.8662 18.1465 18.3437 17.5 18.3437H12.0556Z"
1388
+ fill="${black ? `#393939` : `#8D8D8D`}"
1389
+ />
1390
+ </svg>
1391
+ `;
1392
+ case 'line':
1393
+ return html`
1394
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
1395
+ <path
1396
+ fill="${black ? `#393939` : `#8D8D8D`}"
1397
+ d="M311 196.8v81.3c0 2.1-1.6 3.7-3.7 3.7h-13c-1.3 0-2.4-.7-3-1.5l-37.3-50.3v48.2c0 2.1-1.6 3.7-3.7 3.7h-13c-2.1 0-3.7-1.6-3.7-3.7V196.9c0-2.1 1.6-3.7 3.7-3.7h12.9c1.1 0 2.4 .6 3 1.6l37.3 50.3V196.9c0-2.1 1.6-3.7 3.7-3.7h13c2.1-.1 3.8 1.6 3.8 3.5zm-93.7-3.7h-13c-2.1 0-3.7 1.6-3.7 3.7v81.3c0 2.1 1.6 3.7 3.7 3.7h13c2.1 0 3.7-1.6 3.7-3.7V196.8c0-1.9-1.6-3.7-3.7-3.7zm-31.4 68.1H150.3V196.8c0-2.1-1.6-3.7-3.7-3.7h-13c-2.1 0-3.7 1.6-3.7 3.7v81.3c0 1 .3 1.8 1 2.5c.7 .6 1.5 1 2.5 1h52.2c2.1 0 3.7-1.6 3.7-3.7v-13c0-1.9-1.6-3.7-3.5-3.7zm193.7-68.1H327.3c-1.9 0-3.7 1.6-3.7 3.7v81.3c0 1.9 1.6 3.7 3.7 3.7h52.2c2.1 0 3.7-1.6 3.7-3.7V265c0-2.1-1.6-3.7-3.7-3.7H344V247.7h35.5c2.1 0 3.7-1.6 3.7-3.7V230.9c0-2.1-1.6-3.7-3.7-3.7H344V213.5h35.5c2.1 0 3.7-1.6 3.7-3.7v-13c-.1-1.9-1.7-3.7-3.7-3.7zM512 93.4V419.4c-.1 51.2-42.1 92.7-93.4 92.6H92.6C41.4 511.9-.1 469.8 0 418.6V92.6C.1 41.4 42.2-.1 93.4 0H419.4c51.2 .1 92.7 42.1 92.6 93.4zM441.6 233.5c0-83.4-83.7-151.3-186.4-151.3s-186.4 67.9-186.4 151.3c0 74.7 66.3 137.4 155.9 149.3c21.8 4.7 19.3 12.7 14.4 42.1c-.8 4.7-3.8 18.4 16.1 10.1s107.3-63.2 146.5-108.2c27-29.7 39.9-59.8 39.9-93.1z"
1398
+ />
1399
+ </svg>
1400
+ `;
1401
+ default:
1402
+ return html` <i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i> `;
1403
+ }
1404
+ }
1405
+
1406
+ const paymentView = () => {
1407
+ let custom_payment: any[] = [];
1408
+ let loading = true;
1409
+
1410
+ return gvc.bindView({
1411
+ bind: 'payment',
1412
+ dataList: [{ obj: obj.ogOrderData.pos_info, key: 'payment' }],
1413
+ view: () => {
1414
+ if (loading) {
1415
+ return BgWidget.spinner();
1416
+ }
1417
+
1418
+ if (
1419
+ obj.ogOrderData.pos_info.payment.length === 1 &&
1420
+ !obj.ogOrderData.pos_info.payment[0].paied
1421
+ ) {
1422
+ const btnArray = [
1423
+ {
1424
+ title: `現金`,
1425
+ value: 'cash',
1426
+ key: 'cash',
1427
+ event: () => {
1428
+ obj.ogOrderData.pos_info.payment = [
1429
+ {
1430
+ method: 'cash',
1431
+ total: 0,
1432
+ },
1433
+ ];
1434
+ },
1435
+ },
1436
+ {
1437
+ title: `刷卡`,
1438
+ value: 'creditCard',
1439
+ key: 'ut_credit_card',
1440
+ event: () => {
1441
+ obj.ogOrderData.pos_info.payment = [
1442
+ {
1443
+ method: 'creditCard',
1444
+ total: 0,
1445
+ },
1446
+ ];
1447
+ },
1448
+ },
1449
+ {
1450
+ title: `Line Pay`,
1451
+ value: 'line',
1452
+ key: 'line_pay_scan',
1453
+ event: () => {
1454
+ obj.ogOrderData.pos_info.payment = [
1455
+ {
1456
+ method: 'line',
1457
+ total: 0,
1458
+ },
1459
+ ];
1460
+ },
1461
+ },
1462
+ ].filter(dd => {
1463
+ return (
1464
+ dd.key === 'cash' || orderDetail.payment_setting.find((d1: any) => dd.key === d1.key)
1465
+ );
1466
+ });
1467
+
1468
+ return [...btnArray, ...custom_payment]
1469
+ .map(btn => {
1470
+ const activeMethod = obj.ogOrderData.pos_info.payment.find(
1471
+ (dd: any) => dd.method === btn.value
1472
+ );
1473
+
1474
+ const boxStyle = `
1475
+ min-width: 120px;
1476
+ max-width: 120px;
1477
+ flex: 1;
1478
+ display: flex;
1479
+ flex-direction: column;
1480
+ justify-content: center;
1481
+ align-items: center;
1482
+ border-radius: 10px;
1483
+ background: #f6f6f6;
1484
+ border-radius: 10px;
1485
+ padding: 15px 15px;
1486
+ color: ${activeMethod ? '#393939' : '#8d8d8d'};
1487
+ border: 3px solid ${activeMethod ? '#393939' : '#f6f6f6'};
1488
+ box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, ${activeMethod ? '0.2' : '0'});
1489
+ `;
1490
+
1491
+ return html`
1492
+ <div style="${boxStyle}" onclick="${gvc.event(() => btn.event())}">
1493
+ <div style="width: 28px; height: 28px;">${drawIcon(activeMethod, btn.value)}</div>
1494
+ <div style="font-size: 16px; font-weight: 500; letter-spacing: 0.64px;">
1495
+ ${btn.title}
1496
+ </div>
1497
+ </div>
1498
+ `;
1499
+ })
1500
+ .join('');
1501
+ } else {
1502
+ const getPaymentMethodLabel = (method: string) => {
1503
+ if (method === 'cash') {
1504
+ return '現金';
1505
+ }
1506
+ if (method === 'creditCard') {
1507
+ return '刷卡';
1508
+ }
1509
+ if (method === 'line') {
1510
+ return 'LINE PAY';
1511
+ }
1512
+
1513
+ const payment = (custom_payment || []).find(item => item.key === method);
1514
+ if (!payment) {
1515
+ return '';
1516
+ }
1517
+ return payment.title;
1518
+ };
1519
+
1520
+ return html` <div class="w-100 d-flex flex-column">
1521
+ <div class="d-flex align-items-center justify-content-center w-100 ">
1522
+ <div class="d-flex" style="flex:68;">${PosWidget.fontLight('付款方式')}</div>
1523
+ <div class="d-flex" style="flex:94;">${PosWidget.fontLight('付款金額')}</div>
1524
+ <div class="d-flex" style="flex:68;">${PosWidget.fontLight('狀態')}</div>
1525
+ <div class="d-flex" style="flex:34;"></div>
1526
+ </div>
1527
+ ${obj.ogOrderData.pos_info.payment
1528
+ .map((dd: any) => {
1529
+ return html` <div
1530
+ class="d-flex align-items-center justify-content-center w-100 mt-lg-4 mt-2"
1531
+ style="height:50px;"
1532
+ >
1533
+ <div class="d-flex" style="flex:68;color:#36B;cursor: pointer;">
1534
+ ${getPaymentMethodLabel(dd.method)}
1535
+ </div>
1536
+ <div class="d-flex" style="flex:94;">
1537
+ <input
1538
+ style="display: flex;width: calc(100% - 20px);padding: 9px 18px;border-radius: 10px;border: 1px solid #DDD;text-align: right;"
1539
+ value="${dd.total}"
1540
+ onclick="${gvc.event(() => {
1541
+ if (dd.paied) {
1542
+ dialog.errorMessage({ text: '此付款金額已結清,無法進行調整' });
1543
+ return;
1544
+ }
1545
+ PosFunction.setMoney(gvc, dd.total, money => {
1546
+ dd.total = money || 0;
1547
+ refreshOrderView();
1548
+ });
1549
+ })}"
1550
+ />
1551
+ </div>
1552
+ <div class="d-flex" style="flex:68;">${dd.paied ? `已付款` : `尚未付款`}</div>
1553
+ <div class="d-flex" style="flex:34;">
1554
+ ${!dd.paied
1555
+ ? BgWidget.save(
1556
+ gvc.event(() => {
1557
+ switch (dd.method) {
1558
+ case 'cash':
1559
+ PaymentFunction.cashFinish(gvc, dd.total, result => {
1560
+ if (result) {
1561
+ dd.paied = true;
1562
+ refreshOrderView();
1563
+ }
1564
+ });
1565
+ break;
1566
+ case 'creditCard':
1567
+ PaymentFunction.creditFinish(gvc, dd.total, orderDetail, result => {
1568
+ if (result) {
1569
+ dd.paied = true;
1570
+ refreshOrderView();
1571
+ }
1572
+ });
1573
+ break;
1574
+ case 'line':
1575
+ dd.line_prefix = dd.line_prefix || 0;
1576
+ dd.line_prefix++;
1577
+ PaymentFunction.lineFinish(
1578
+ gvc,
1579
+ dd.total,
1580
+ dd.line_prefix,
1581
+ orderDetail,
1582
+ result => {
1583
+ if (result) {
1584
+ dd.paied = true;
1585
+ refreshOrderView();
1586
+ }
1587
+ }
1588
+ );
1589
+ break;
1590
+ default:
1591
+ PaymentFunction.customFinish(gvc, dd.total, result => {
1592
+ if (result) {
1593
+ dd.paied = true;
1594
+ refreshOrderView();
1595
+ }
1596
+ });
1597
+ break;
1598
+ }
1599
+ }),
1600
+ '支付'
1601
+ )
1602
+ : BgWidget.danger(
1603
+ gvc.event(() => {
1604
+ dialog.checkYesOrNot({
1605
+ text: '此款項已支付,是否確認移除付款資訊?',
1606
+ callback: response => {
1607
+ if (response) {
1608
+ dd.paied = false;
1609
+ refreshOrderView();
1610
+ }
1611
+ },
1612
+ });
1613
+ }),
1614
+ '取消'
1615
+ )}
1616
+ </div>
1617
+ </div>`;
1618
+ })
1619
+ .join('')}
1620
+ </div>`;
1621
+ }
1622
+ },
1623
+ divCreate: {
1624
+ style: `
1625
+ display: flex;
1626
+ justify-content: space-between;
1627
+ margin-top: 24px;
1628
+ gap: 15px;
1629
+ flex-wrap: wrap;
1630
+ `,
1631
+ },
1632
+ onCreate: () => {
1633
+ if (loading) {
1634
+ saasConfig.api
1635
+ .getPrivateConfig(saasConfig.config.appName, 'glitter_finance')
1636
+ .then((d: any) => {
1637
+ custom_payment = (() => {
1638
+ try {
1639
+ const val = d.response.result[0].value;
1640
+
1641
+ return val.payment_info_custom
1642
+ .filter((item: any) => {
1643
+ try {
1644
+ return item.type === 'pos' && val[item.id].toggle;
1645
+ } catch (error) {
1646
+ return false;
1647
+ }
1648
+ })
1649
+ .map((item: any) => {
1650
+ return {
1651
+ title: item.name,
1652
+ value: item.id,
1653
+ key: item.id,
1654
+ event: () => {
1655
+ obj.ogOrderData.pos_info.payment = [
1656
+ {
1657
+ method: item.id,
1658
+ total: 0,
1659
+ },
1660
+ ];
1661
+ },
1662
+ };
1663
+ });
1664
+ } catch (error) {
1665
+ return [];
1666
+ }
1667
+ })();
1668
+ loading = false;
1669
+ gvc.notifyDataChange('payment');
1670
+ });
1671
+ }
1672
+ },
1673
+ });
1674
+ };
1675
+
1359
1676
  return {
1360
1677
  bind: vm_id,
1361
1678
  dataList: [{ obj: vm, key: 'paySelect' }],
@@ -1367,260 +1684,7 @@ export class PaymentPage {
1367
1684
  ${parseInt(orderDetail.total as any, 10).toLocaleString()}
1368
1685
  </div>
1369
1686
  </div>`,
1370
- html`${PosWidget.bigTitle('付款方式')}
1371
- ${gvc.bindView({
1372
- bind: 'payment',
1373
- dataList: [{ obj: obj.ogOrderData.pos_info, key: 'payment' }],
1374
- view: () => {
1375
- if (
1376
- obj.ogOrderData.pos_info.payment.length === 1 &&
1377
- !obj.ogOrderData.pos_info.payment[0].paied
1378
- ) {
1379
- function drawIcon(black: boolean, type: string) {
1380
- switch (type) {
1381
- case 'cash':
1382
- return html`
1383
- <svg
1384
- xmlns="http://www.w3.org/2000/svg"
1385
- width="28"
1386
- height="28"
1387
- viewBox="0 0 28 28"
1388
- fill="none"
1389
- >
1390
- <path
1391
- d="M9.625 4.8125C9.625 4.81797 9.63047 4.84531 9.65781 4.89453C9.69063 4.96016 9.76719 5.06406 9.91484 5.19531C9.93672 5.21172 9.95859 5.23359 9.98047 5.25C8.95781 5.27187 7.9625 5.34297 7.00547 5.47422L7 4.8125C7 3.82812 7.53047 3.04062 8.15391 2.47734C8.77734 1.91406 9.61406 1.46562 10.5328 1.11563C12.3813 0.410156 14.8477 0 17.5 0C20.1523 0 22.6187 0.410156 24.4617 1.11016C25.3805 1.46016 26.2172 1.90859 26.8406 2.47187C27.4641 3.03516 28 3.82812 28 4.8125V10.5V16.1875C28 17.1719 27.4695 17.9594 26.8461 18.5227C26.2227 19.0859 25.3859 19.5344 24.4672 19.8844C23.9422 20.0867 23.368 20.2617 22.7555 20.4094V17.6914C23.0344 17.6094 23.2914 17.5219 23.532 17.4289C24.2758 17.1445 24.7898 16.8383 25.0906 16.5703C25.2383 16.4391 25.3148 16.3352 25.3477 16.2695C25.3805 16.2094 25.3805 16.1875 25.3805 16.1875V13.8031C25.0906 13.9453 24.7844 14.0766 24.4672 14.1969C23.9422 14.3992 23.368 14.5742 22.7555 14.7219V12.0039C23.0344 11.9219 23.2914 11.8344 23.532 11.7414C24.2758 11.457 24.7898 11.1508 25.0906 10.8828C25.2383 10.7516 25.3148 10.6477 25.3477 10.582C25.375 10.5328 25.3805 10.5055 25.3805 10.5V8.11562C25.0906 8.25781 24.7844 8.38906 24.4672 8.50938C23.718 8.79375 22.8594 9.03438 21.9352 9.21484C21.6562 8.80469 21.3336 8.45469 21.0164 8.17031C20.4641 7.67266 19.8242 7.26797 19.157 6.93438C20.8906 6.80859 22.4 6.48594 23.532 6.05391C24.2758 5.76953 24.7898 5.46328 25.0906 5.19531C25.2383 5.06406 25.3148 4.96016 25.3477 4.89453C25.375 4.84531 25.3805 4.81797 25.3805 4.8125C25.3805 4.8125 25.3805 4.78516 25.3477 4.73047C25.3148 4.66484 25.2383 4.56094 25.0906 4.42969C24.7898 4.15625 24.2758 3.85 23.532 3.57109C22.05 3.00234 19.9172 2.625 17.5 2.625C15.0828 2.625 12.95 3.00234 11.4734 3.56562C10.7297 3.85 10.2156 4.15625 9.91484 4.42422C9.76719 4.55547 9.69063 4.65938 9.65781 4.725C9.625 4.78516 9.625 4.80703 9.625 4.80703V4.8125ZM2.625 11.8125C2.625 11.818 2.63047 11.8453 2.65781 11.8945C2.69062 11.9602 2.76719 12.0641 2.91484 12.1953C3.21563 12.4688 3.72969 12.775 4.47344 13.0539C5.95 13.6172 8.08281 13.9945 10.5 13.9945C12.9172 13.9945 15.05 13.6172 16.5266 13.0539C17.2703 12.7695 17.7844 12.4633 18.0852 12.1953C18.2328 12.0641 18.3094 11.9602 18.3422 11.8945C18.3695 11.8453 18.375 11.818 18.375 11.8125C18.375 11.8125 18.375 11.7852 18.3422 11.7305C18.3094 11.6648 18.2328 11.5609 18.0852 11.4297C17.7844 11.1562 17.2703 10.85 16.5266 10.5711C15.05 10.0078 12.9172 9.63047 10.5 9.63047C8.08281 9.63047 5.95 10.0078 4.47344 10.5711C3.72969 10.8555 3.21563 11.1617 2.91484 11.4297C2.76719 11.5609 2.69062 11.6648 2.65781 11.7305C2.625 11.7906 2.625 11.8125 2.625 11.8125ZM0 11.8125C0 10.8281 0.530469 10.0406 1.15391 9.47734C1.77734 8.91406 2.61406 8.46562 3.53281 8.11562C5.38125 7.41016 7.84766 7 10.5 7C13.1523 7 15.6187 7.41016 17.4617 8.11016C18.3805 8.46016 19.2172 8.90859 19.8406 9.47188C20.4641 10.0352 21 10.8281 21 11.8125V17.5V23.1875C21 24.1719 20.4695 24.9594 19.8461 25.5227C19.2227 26.0859 18.3859 26.5344 17.4672 26.8844C15.6187 27.5898 13.1523 28 10.5 28C7.84766 28 5.38125 27.5898 3.53828 26.8898C2.61953 26.5398 1.78828 26.0914 1.15938 25.5281C0.530469 24.9648 0 24.1719 0 23.1875V17.5V11.8125ZM18.375 17.5V15.1156C18.0852 15.2578 17.7789 15.3891 17.4617 15.5094C15.6187 16.2148 13.1523 16.625 10.5 16.625C7.84766 16.625 5.38125 16.2148 3.53828 15.5148C3.22109 15.3945 2.91484 15.2633 2.625 15.1211V17.5C2.625 17.5055 2.63047 17.5328 2.65781 17.582C2.69062 17.6477 2.76719 17.7516 2.91484 17.8828C3.21563 18.1562 3.72969 18.4625 4.47344 18.7414C5.95 19.3047 8.08281 19.682 10.5 19.682C12.9172 19.682 15.05 19.3047 16.5266 18.7414C17.2703 18.457 17.7844 18.1508 18.0852 17.8828C18.2328 17.7516 18.3094 17.6477 18.3422 17.582C18.3695 17.5328 18.375 17.5055 18.375 17.5ZM3.53828 21.2023C3.22109 21.082 2.91484 20.9508 2.625 20.8086V23.1875C2.625 23.1875 2.625 23.2148 2.65781 23.2695C2.69062 23.3352 2.76719 23.4391 2.91484 23.5703C3.21563 23.8438 3.72969 24.15 4.47344 24.4289C5.95 24.9922 8.08281 25.3695 10.5 25.3695C12.9172 25.3695 15.05 24.9922 16.5266 24.4289C17.2703 24.1445 17.7844 23.8383 18.0852 23.5703C18.2328 23.4391 18.3094 23.3352 18.3422 23.2695C18.375 23.2094 18.375 23.1875 18.375 23.1875V20.8031C18.0852 20.9453 17.7789 21.0766 17.4617 21.1969C15.6187 21.9023 13.1523 22.3125 10.5 22.3125C7.84766 22.3125 5.38125 21.9023 3.53828 21.2023Z"
1392
- fill="${black ? `#393939` : `#8D8D8D`}"
1393
- />
1394
- </svg>
1395
- `;
1396
- case 'creditCard':
1397
- return html`
1398
- <svg
1399
- xmlns="http://www.w3.org/2000/svg"
1400
- width="28"
1401
- height="28"
1402
- viewBox="0 0 28 28"
1403
- fill="none"
1404
- >
1405
- <path
1406
- d="M24.8889 5.84375C25.3167 5.84375 25.6667 6.19531 25.6667 6.625V8.1875H2.33333V6.625C2.33333 6.19531 2.68333 5.84375 3.11111 5.84375H24.8889ZM25.6667 12.875V22.25C25.6667 22.6797 25.3167 23.0312 24.8889 23.0312H3.11111C2.68333 23.0312 2.33333 22.6797 2.33333 22.25V12.875H25.6667ZM3.11111 3.5C1.39514 3.5 0 4.90137 0 6.625V22.25C0 23.9736 1.39514 25.375 3.11111 25.375H24.8889C26.6049 25.375 28 23.9736 28 22.25V6.625C28 4.90137 26.6049 3.5 24.8889 3.5H3.11111ZM5.83333 18.3437C5.18681 18.3437 4.66667 18.8662 4.66667 19.5156C4.66667 20.165 5.18681 20.6875 5.83333 20.6875H8.16667C8.81319 20.6875 9.33333 20.165 9.33333 19.5156C9.33333 18.8662 8.81319 18.3437 8.16667 18.3437H5.83333ZM12.0556 18.3437C11.409 18.3437 10.8889 18.8662 10.8889 19.5156C10.8889 20.165 11.409 20.6875 12.0556 20.6875H17.5C18.1465 20.6875 18.6667 20.165 18.6667 19.5156C18.6667 18.8662 18.1465 18.3437 17.5 18.3437H12.0556Z"
1407
- fill="${black ? `#393939` : `#8D8D8D`}"
1408
- />
1409
- </svg>
1410
- `;
1411
- default:
1412
- return html`
1413
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
1414
- <path
1415
- fill="${black ? `#393939` : `#8D8D8D`}"
1416
- d="M311 196.8v81.3c0 2.1-1.6 3.7-3.7 3.7h-13c-1.3 0-2.4-.7-3-1.5l-37.3-50.3v48.2c0 2.1-1.6 3.7-3.7 3.7h-13c-2.1 0-3.7-1.6-3.7-3.7V196.9c0-2.1 1.6-3.7 3.7-3.7h12.9c1.1 0 2.4 .6 3 1.6l37.3 50.3V196.9c0-2.1 1.6-3.7 3.7-3.7h13c2.1-.1 3.8 1.6 3.8 3.5zm-93.7-3.7h-13c-2.1 0-3.7 1.6-3.7 3.7v81.3c0 2.1 1.6 3.7 3.7 3.7h13c2.1 0 3.7-1.6 3.7-3.7V196.8c0-1.9-1.6-3.7-3.7-3.7zm-31.4 68.1H150.3V196.8c0-2.1-1.6-3.7-3.7-3.7h-13c-2.1 0-3.7 1.6-3.7 3.7v81.3c0 1 .3 1.8 1 2.5c.7 .6 1.5 1 2.5 1h52.2c2.1 0 3.7-1.6 3.7-3.7v-13c0-1.9-1.6-3.7-3.5-3.7zm193.7-68.1H327.3c-1.9 0-3.7 1.6-3.7 3.7v81.3c0 1.9 1.6 3.7 3.7 3.7h52.2c2.1 0 3.7-1.6 3.7-3.7V265c0-2.1-1.6-3.7-3.7-3.7H344V247.7h35.5c2.1 0 3.7-1.6 3.7-3.7V230.9c0-2.1-1.6-3.7-3.7-3.7H344V213.5h35.5c2.1 0 3.7-1.6 3.7-3.7v-13c-.1-1.9-1.7-3.7-3.7-3.7zM512 93.4V419.4c-.1 51.2-42.1 92.7-93.4 92.6H92.6C41.4 511.9-.1 469.8 0 418.6V92.6C.1 41.4 42.2-.1 93.4 0H419.4c51.2 .1 92.7 42.1 92.6 93.4zM441.6 233.5c0-83.4-83.7-151.3-186.4-151.3s-186.4 67.9-186.4 151.3c0 74.7 66.3 137.4 155.9 149.3c21.8 4.7 19.3 12.7 14.4 42.1c-.8 4.7-3.8 18.4 16.1 10.1s107.3-63.2 146.5-108.2c27-29.7 39.9-59.8 39.9-93.1z"
1417
- />
1418
- </svg>
1419
- `;
1420
- }
1421
- }
1422
-
1423
- let btnArray = [
1424
- {
1425
- title: `現金`,
1426
- value: 'cash',
1427
- key: 'cash',
1428
- event: () => {
1429
- obj.ogOrderData.pos_info.payment = [
1430
- {
1431
- method: 'cash',
1432
- total: 0,
1433
- },
1434
- ];
1435
- },
1436
- },
1437
- {
1438
- title: `刷卡`,
1439
- value: 'creditCard',
1440
- key: 'ut_credit_card',
1441
- event: () => {
1442
- obj.ogOrderData.pos_info.payment = [
1443
- {
1444
- method: 'creditCard',
1445
- total: 0,
1446
- },
1447
- ];
1448
- },
1449
- },
1450
- {
1451
- title: `Line Pay`,
1452
- value: 'line',
1453
- key: 'line_pay_scan',
1454
- event: () => {
1455
- obj.ogOrderData.pos_info.payment = [
1456
- {
1457
- method: 'line',
1458
- total: 0,
1459
- },
1460
- ];
1461
- },
1462
- },
1463
- ].filter(dd => {
1464
- return (
1465
- dd.key === 'cash' ||
1466
- orderDetail.payment_setting.find((d1: any) => {
1467
- return dd.key === d1.key;
1468
- })
1469
- );
1470
- });
1471
- return btnArray
1472
- .map(btn => {
1473
- return html`
1474
- <div
1475
- style="flex:1;display: flex;flex-direction: column;justify-content: center;align-items: center;padding: 15px 15px;border-radius: 10px;background: #F6F6F6;${obj.ogOrderData.pos_info.payment.find(
1476
- (dd: any) => {
1477
- return dd.method === btn.value;
1478
- }
1479
- )
1480
- ? `color:#393939;border-radius: 10px;border: 3px solid #393939;box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, 0.20);`
1481
- : 'color:#8D8D8D;'}"
1482
- onclick="${gvc.event(() => {
1483
- btn.event();
1484
- })}"
1485
- >
1486
- <div style="width: 28px;height: 28px;">
1487
- ${drawIcon(
1488
- obj.ogOrderData.pos_info.payment.find((dd: any) => {
1489
- return dd.method === btn.value;
1490
- }) !== undefined,
1491
- btn.value
1492
- )}
1493
- </div>
1494
- <div style="font-size: 16px;font-weight: 500;letter-spacing: 0.64px;">
1495
- ${btn.title}
1496
- </div>
1497
- </div>
1498
- `;
1499
- })
1500
- .join('');
1501
- } else {
1502
- return html` <div class="w-100 d-flex flex-column">
1503
- <div class="d-flex align-items-center justify-content-center w-100 ">
1504
- <div class="d-flex" style="flex:68;">${PosWidget.fontLight('付款方式')}</div>
1505
- <div class="d-flex" style="flex:94;">${PosWidget.fontLight('付款金額')}</div>
1506
- <div class="d-flex" style="flex:68;">${PosWidget.fontLight('狀態')}</div>
1507
- <div class="d-flex" style="flex:34;"></div>
1508
- </div>
1509
- ${obj.ogOrderData.pos_info.payment
1510
- .map((dd: any, index: number) => {
1511
- return html` <div
1512
- class="d-flex align-items-center justify-content-center w-100 mt-lg-4 mt-2"
1513
- style="height:50px;"
1514
- >
1515
- <div
1516
- class="d-flex"
1517
- style="flex:68;color:#36B;cursor: pointer;"
1518
- onclick="${gvc.event(() => {})}"
1519
- >
1520
- ${(() => {
1521
- switch (dd.method) {
1522
- case 'cash':
1523
- return `現金`;
1524
- case 'creditCard':
1525
- return `刷卡`;
1526
- case 'line':
1527
- return `LINE PAY`;
1528
- }
1529
- })()}
1530
- </div>
1531
- <div class="d-flex" style="flex:94;">
1532
- <input
1533
- style="display: flex;width: calc(100% - 20px);padding: 9px 18px;border-radius: 10px;border: 1px solid #DDD;text-align: right;"
1534
- value="${dd.total}"
1535
- onclick="${gvc.event(() => {
1536
- if (dd.paied) {
1537
- dialog.errorMessage({ text: '此付款金額已結清,無法進行調整' });
1538
- return;
1539
- }
1540
- PosFunction.setMoney(gvc, dd.total, money => {
1541
- dd.total = money || 0;
1542
- refreshOrderView();
1543
- });
1544
- })}"
1545
- />
1546
- </div>
1547
- <div class="d-flex" style="flex:68;">${dd.paied ? `已付款` : `尚未付款`}</div>
1548
- <div class="d-flex" style="flex:34;">
1549
- ${!dd.paied
1550
- ? BgWidget.save(
1551
- gvc.event(() => {
1552
- switch (dd.method) {
1553
- case 'cash':
1554
- PaymentFunction.cashFinish(gvc, dd.total, result => {
1555
- if (result) {
1556
- dd.paied = true;
1557
- refreshOrderView();
1558
- }
1559
- });
1560
- break;
1561
- case 'creditCard':
1562
- PaymentFunction.creditFinish(
1563
- gvc,
1564
- dd.total,
1565
- orderDetail,
1566
- result => {
1567
- if (result) {
1568
- dd.paied = true;
1569
- refreshOrderView();
1570
- }
1571
- }
1572
- );
1573
- break;
1574
- case 'line':
1575
- dd.line_prefix = dd.line_prefix || 0;
1576
- dd.line_prefix++;
1577
- PaymentFunction.lineFinish(
1578
- gvc,
1579
- dd.total,
1580
- dd.line_prefix,
1581
- orderDetail,
1582
- result => {
1583
- if (result) {
1584
- dd.paied = true;
1585
- refreshOrderView();
1586
- }
1587
- }
1588
- );
1589
- break;
1590
- }
1591
- }),
1592
- '支付'
1593
- )
1594
- : BgWidget.danger(
1595
- gvc.event(() => {
1596
- dialog.checkYesOrNot({
1597
- text: '此款項已支付,是否確認移除付款資訊?',
1598
- callback: response => {
1599
- if (response) {
1600
- dd.paied = false;
1601
- refreshOrderView();
1602
- }
1603
- },
1604
- });
1605
- }),
1606
- '取消'
1607
- )}
1608
- </div>
1609
- </div>`;
1610
- })
1611
- .join('')}
1612
- </div>`;
1613
- }
1614
- },
1615
- divCreate: {
1616
- style: `
1617
- display: flex;
1618
- justify-content: space-between;
1619
- margin-top: 24px;
1620
- gap: 15px;
1621
- `,
1622
- },
1623
- })}`,
1687
+ html`${PosWidget.bigTitle('付款方式')} ${paymentView()}`,
1624
1688
  html` <div style="height:24px;"></div>`,
1625
1689
  PosWidget.buttonSnow(
1626
1690
  `新增付款方式`,
@@ -1804,6 +1868,7 @@ export class PaymentPage {
1804
1868
 
1805
1869
  view.push(html`
1806
1870
  <div style="margin-top: 32px;gap:10px;" class="d-flex align-items-center">
1871
+ <!-- 儲存訂單按鈕 -->
1807
1872
  <div
1808
1873
  style="width:49px;height: 49px;border-radius: 10px;background: #F6F6F6;cursor: pointer;"
1809
1874
  class="d-flex align-items-center justify-content-center"
@@ -1818,22 +1883,22 @@ export class PaymentPage {
1818
1883
  >
1819
1884
  <i class="fa-solid fa-down-to-bracket fs-4"></i>
1820
1885
  </div>
1886
+
1887
+ <!-- 建立預購單按鈕 -->
1821
1888
  <div
1822
1889
  style="flex:1;display: flex;padding: 10px;justify-content: center;align-items: center;border-radius: 10px;background: #FF6C02;color: #FFF;font-size: 18px;font-style: normal;font-weight: 500;line-height: normal;letter-spacing: 0.72px;"
1823
1890
  onclick="${gvc.event(() => {
1824
- if (
1891
+ const hasUnpaidPayments =
1825
1892
  obj.ogOrderData.pos_info.payment.length > 1 &&
1826
- obj.ogOrderData.pos_info.payment.find((dd: any) => {
1827
- return !dd.paied;
1828
- })
1829
- ) {
1830
- dialog.errorMessage({
1831
- text: `請結清所有款項`,
1832
- });
1893
+ obj.ogOrderData.pos_info.payment.find((dd: any) => !dd.paied);
1894
+
1895
+ if (hasUnpaidPayments) {
1896
+ dialog.errorMessage({ text: '請結清所有款項' });
1833
1897
  return;
1834
1898
  }
1899
+
1835
1900
  dialog.checkYesOrNot({
1836
- text: '是否確認建立預購單?',
1901
+ text: '是否確認建立預購單?',
1837
1902
  callback: response => {
1838
1903
  if (response) {
1839
1904
  paymentNext(true);
@@ -1844,38 +1909,32 @@ export class PaymentPage {
1844
1909
  >
1845
1910
  建立預購單
1846
1911
  </div>
1912
+
1913
+ <!-- 前往結帳按鈕 -->
1847
1914
  <div
1848
1915
  style="flex:1;display: flex;padding: 10px;justify-content: center;align-items: center;border-radius: 10px;background: #393939;color: #FFF;font-size: 18px;font-style: normal;font-weight: 500;line-height: normal;letter-spacing: 0.72px;"
1849
1916
  onclick="${gvc.event(() => {
1850
- if (total - parseInt(orderDetail.total as any, 10) < 0) {
1851
- dialog.errorMessage({
1852
- text: `收款金額尚需要『 ${((total - parseInt(orderDetail.total as any, 10)) * -1).toLocaleString()} 』`,
1853
- });
1854
- return;
1855
- } else if (
1917
+ const amountShortage = total - parseInt(orderDetail.total as any, 10);
1918
+ const hasUnpaidPayments =
1856
1919
  obj.ogOrderData.pos_info.payment.length > 1 &&
1857
- obj.ogOrderData.pos_info.payment.find((dd: any) => {
1858
- return !dd.paied;
1859
- })
1860
- ) {
1920
+ obj.ogOrderData.pos_info.payment.find((dd: any) => !dd.paied);
1921
+ const hasPreOrderItems = orderDetail.lineItems.find((dd: any) => dd.pre_order);
1922
+
1923
+ if (amountShortage < 0) {
1861
1924
  dialog.errorMessage({
1862
- text: `請結清所有款項`,
1925
+ text: `收款金額尚需要『 ${(amountShortage * -1).toLocaleString()} 』`,
1863
1926
  });
1864
1927
  return;
1865
- } else if (
1866
- orderDetail.lineItems.find((dd: any) => {
1867
- return dd.pre_order;
1868
- })
1869
- ) {
1928
+ } else if (hasUnpaidPayments) {
1870
1929
  dialog.errorMessage({
1871
- text: `庫存不足,請建立預購單`,
1930
+ text: '請結清所有款項',
1872
1931
  });
1873
1932
  return;
1874
1933
  }
1875
1934
 
1876
1935
  PaymentPage.storeHistory(orderDetail);
1877
1936
  dialog.checkYesOrNot({
1878
- text: '是否確認前往結帳?',
1937
+ text: hasPreOrderItems ? '是否確認建立預購單?' : '是否確認前往結帳?',
1879
1938
  callback: response => {
1880
1939
  if (response) {
1881
1940
  paymentNext(false);
@@ -1891,7 +1950,7 @@ export class PaymentPage {
1891
1950
  return view.join('');
1892
1951
  },
1893
1952
  divCreate: {
1894
- class: `d-flex flex-column w-100`,
1953
+ class: 'd-flex flex-column w-100',
1895
1954
  },
1896
1955
  };
1897
1956
  })}
@@ -1900,8 +1959,8 @@ export class PaymentPage {
1900
1959
  });
1901
1960
  },
1902
1961
  divCreate: {
1903
- class: `${document.body.offsetWidth < 800 ? `w-100` : `d-flex flex-column flex-sm-row w-100`}`,
1904
- style: `overflow-y: auto;`,
1962
+ class: `w-100 ${document.body.offsetWidth < 800 ? '' : 'd-flex flex-column flex-sm-row'}`,
1963
+ style: 'overflow-y: auto;',
1905
1964
  },
1906
1965
  };
1907
1966
  });
@@ -2378,14 +2437,23 @@ export class PaymentPage {
2378
2437
  ];
2379
2438
  return btnArray
2380
2439
  .map(btn => {
2440
+ const isActive = c_vm.invoice_select == btn.value;
2441
+
2442
+ const boxStyle = `
2443
+ padding: 20px;
2444
+ border-radius: 10px;
2445
+ background: #f6f6f6;
2446
+ color: ${isActive ? '#393939' : '#8D8D8D'};
2447
+ border-radius: 10px;
2448
+ border: 3px solid ${isActive ? '#393939' : '#f6f6f6'};
2449
+ box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, ${isActive ? '0.2' : '0'});
2450
+ `;
2451
+
2381
2452
  return html`
2382
2453
  <div class="col-6 mb-4">
2383
2454
  <div
2384
2455
  class="w-100 d-flex align-items-center flex-column justify-content-center"
2385
- style="padding: 20px;border-radius: 10px;background: #F6F6F6;${c_vm.invoice_select ==
2386
- btn.value
2387
- ? `color:#393939;border-radius: 10px;border: 3px solid #393939;box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, 0.20);`
2388
- : 'color:#8D8D8D;'} "
2456
+ style="${boxStyle} "
2389
2457
  onclick="${gvc.event(() => {
2390
2458
  c_vm.invoice_select = btn.value as any;
2391
2459
  c_vm.value = '';
@@ -2471,16 +2539,30 @@ export class PaymentPage {
2471
2539
  return '';
2472
2540
  }
2473
2541
  })()}
2474
- <div
2475
- class="d-flex align-items-center justify-content-center w-100"
2476
- style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
2477
- >
2542
+ <div class="d-flex gap-2 w-100 px-2">
2478
2543
  <div
2479
- class="flex-fill"
2480
- style="border-radius: 10px;background: #393939;padding: 12px 24px;color: #FFF;text-align:center;"
2481
- onclick="${gvc.event(() => next())}"
2544
+ class="d-flex align-items-center justify-content-center w-100"
2545
+ style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
2482
2546
  >
2483
- 確定
2547
+ <div
2548
+ class="flex-fill"
2549
+ style="border: 1px solid #393939;border-radius: 10px;background: #fff;padding: 12px 24px;color: #393939;text-align:center;"
2550
+ onclick="${gvc.event(() => gvc.glitter.closeDiaLog())}"
2551
+ >
2552
+ 取消
2553
+ </div>
2554
+ </div>
2555
+ <div
2556
+ class="d-flex align-items-center justify-content-center w-100"
2557
+ style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
2558
+ >
2559
+ <div
2560
+ class="flex-fill"
2561
+ style="border-radius: 10px;background: #393939;padding: 12px 24px;color: #FFF;text-align:center;"
2562
+ onclick="${gvc.event(() => next())}"
2563
+ >
2564
+ 確定
2565
+ </div>
2484
2566
  </div>
2485
2567
  </div>
2486
2568
  </div>