ts-glitter 22.5.6 → 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.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +13 -13
- package/lowcode/backend-manager/bg-product.ts +13 -13
- package/lowcode/backend-manager/bg-shopping.js +8 -13
- package/lowcode/backend-manager/bg-shopping.ts +8 -15
- package/lowcode/backend-manager/bg-widget.js +62 -49
- package/lowcode/backend-manager/bg-widget.ts +129 -93
- package/lowcode/cms-plugin/POS-setting.js +30 -9
- package/lowcode/cms-plugin/POS-setting.ts +49 -16
- package/lowcode/cms-plugin/cms-router.js +27 -21
- package/lowcode/cms-plugin/cms-router.ts +116 -101
- package/lowcode/cms-plugin/filter-options.js +25 -17
- package/lowcode/cms-plugin/filter-options.ts +27 -17
- package/lowcode/cms-plugin/module/product-excel.js +2 -0
- package/lowcode/cms-plugin/module/product-excel.ts +2 -0
- package/lowcode/cms-plugin/module/product-setting.js +13 -12
- package/lowcode/cms-plugin/module/product-setting.ts +26 -23
- package/lowcode/cms-plugin/order/order-module.js +91 -68
- package/lowcode/cms-plugin/order/order-module.ts +105 -73
- package/lowcode/cms-plugin/pos-checkout-setting.js +46 -39
- package/lowcode/cms-plugin/pos-checkout-setting.ts +237 -227
- package/lowcode/cms-plugin/pos-config-setting.js +25 -23
- package/lowcode/cms-plugin/pos-config-setting.ts +35 -32
- package/lowcode/cms-plugin/pos-pages/payment-function.js +253 -139
- package/lowcode/cms-plugin/pos-pages/payment-function.ts +405 -279
- package/lowcode/cms-plugin/pos-pages/payment-page.js +348 -267
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +378 -296
- package/lowcode/cms-plugin/pos-pages/pos-function.js +76 -19
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +84 -19
- package/lowcode/cms-plugin/shopping-discount-setting.js +2 -2
- package/lowcode/cms-plugin/shopping-discount-setting.ts +2 -2
- package/lowcode/cms-plugin/shopping-finance-setting.js +1590 -1701
- package/lowcode/cms-plugin/shopping-finance-setting.ts +1967 -2011
- package/lowcode/cms-plugin/shopping-order-manager.js +74 -62
- package/lowcode/cms-plugin/shopping-order-manager.ts +119 -85
- package/lowcode/cms-plugin/shopping-product-text.js +874 -531
- package/lowcode/cms-plugin/shopping-product-text.ts +1656 -1305
- package/lowcode/cms-plugin/shopping-setting-basic.js +152 -124
- package/lowcode/cms-plugin/shopping-setting-basic.ts +315 -247
- package/lowcode/css/editor.css +3 -2
- package/lowcode/glitter-base/global/language.js +5 -3
- package/lowcode/glitter-base/global/language.ts +8 -6
- package/lowcode/glitter-base/global/payment-config.js +6 -0
- package/lowcode/glitter-base/global/payment-config.ts +6 -3
- package/lowcode/public-components/product/pd-class.js +1 -3
- package/lowcode/public-components/product/pd-class.ts +1 -3
- package/lowcode/public-components/user-manager/um-order.js +2 -1
- package/lowcode/public-components/user-manager/um-order.ts +2 -1
- package/package.json +1 -1
- package/src/api-public/controllers/index.js +14 -1
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +16 -1
- package/src/api-public/controllers/shop.js +14 -7
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +14 -8
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/ezpay/tool.d.ts +0 -1
- package/src/api-public/services/financial-serviceV2.js +7 -17
- package/src/api-public/services/financial-serviceV2.js.map +1 -1
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/updated-table-checked.js +20 -0
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +21 -0
- package/src/app-project/serverless/src/modules/database.d.ts +1 -1
- package/src/app-project/serverless/src/modules/redis.d.ts +1 -1
- package/src/helper/glitter-util.d.ts +0 -1
- package/src/index.js +3 -3
- package/src/index.js.map +13 -1
- package/src/modules/database.js +5 -1
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +5 -1
- package/src/modules/tool.d.ts +2 -0
- package/src/modules/tool.js +7 -0
- package/src/modules/tool.js.map +1 -1
- package/src/modules/tool.ts +7 -0
- package/src/seo-config.js +3 -3
- package/src/seo-config.js.map +9 -1
- package/src/services/private_config.js +11 -0
- package/src/services/private_config.js.map +1 -1
- package/src/services/private_config.ts +11 -0
- package/src/services/saas-table-check.js +12 -0
- package/src/services/saas-table-check.js.map +1 -1
- package/src/services/saas-table-check.ts +12 -0
- package/src/services/ses.js +3 -4
- package/src/services/ses.js.map +1 -1
|
@@ -68,6 +68,7 @@ export class PaymentPage {
|
|
|
68
68
|
const gvc = obj.gvc;
|
|
69
69
|
const vm = obj.vm;
|
|
70
70
|
const dialog = new ShareDialog(gvc.glitter);
|
|
71
|
+
const saasConfig = window.parent.saasConfig;
|
|
71
72
|
PaymentPage.storeHistory(obj.ogOrderData);
|
|
72
73
|
PaymentPage.addStyle(gvc);
|
|
73
74
|
obj.ogOrderData.pos_info = obj.ogOrderData.pos_info || {
|
|
@@ -1250,6 +1251,297 @@ export class PaymentPage {
|
|
|
1250
1251
|
orderDetail.total -= item.discount_total;
|
|
1251
1252
|
}
|
|
1252
1253
|
});
|
|
1254
|
+
function drawIcon(black, type) {
|
|
1255
|
+
switch (type) {
|
|
1256
|
+
case 'cash':
|
|
1257
|
+
return html `
|
|
1258
|
+
<svg
|
|
1259
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1260
|
+
width="28"
|
|
1261
|
+
height="28"
|
|
1262
|
+
viewBox="0 0 28 28"
|
|
1263
|
+
fill="none"
|
|
1264
|
+
>
|
|
1265
|
+
<path
|
|
1266
|
+
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"
|
|
1267
|
+
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1268
|
+
/>
|
|
1269
|
+
</svg>
|
|
1270
|
+
`;
|
|
1271
|
+
case 'creditCard':
|
|
1272
|
+
return html `
|
|
1273
|
+
<svg
|
|
1274
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1275
|
+
width="28"
|
|
1276
|
+
height="28"
|
|
1277
|
+
viewBox="0 0 28 28"
|
|
1278
|
+
fill="none"
|
|
1279
|
+
>
|
|
1280
|
+
<path
|
|
1281
|
+
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"
|
|
1282
|
+
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1283
|
+
/>
|
|
1284
|
+
</svg>
|
|
1285
|
+
`;
|
|
1286
|
+
case 'line':
|
|
1287
|
+
return html `
|
|
1288
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
1289
|
+
<path
|
|
1290
|
+
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1291
|
+
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"
|
|
1292
|
+
/>
|
|
1293
|
+
</svg>
|
|
1294
|
+
`;
|
|
1295
|
+
default:
|
|
1296
|
+
return html ` <i class="fa-regular fa-puzzle-piece-simple fs-4" aria-hidden="true"></i> `;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
const paymentView = () => {
|
|
1300
|
+
let custom_payment = [];
|
|
1301
|
+
let loading = true;
|
|
1302
|
+
return gvc.bindView({
|
|
1303
|
+
bind: 'payment',
|
|
1304
|
+
dataList: [{ obj: obj.ogOrderData.pos_info, key: 'payment' }],
|
|
1305
|
+
view: () => {
|
|
1306
|
+
if (loading) {
|
|
1307
|
+
return BgWidget.spinner();
|
|
1308
|
+
}
|
|
1309
|
+
if (obj.ogOrderData.pos_info.payment.length === 1 &&
|
|
1310
|
+
!obj.ogOrderData.pos_info.payment[0].paied) {
|
|
1311
|
+
const btnArray = [
|
|
1312
|
+
{
|
|
1313
|
+
title: `現金`,
|
|
1314
|
+
value: 'cash',
|
|
1315
|
+
key: 'cash',
|
|
1316
|
+
event: () => {
|
|
1317
|
+
obj.ogOrderData.pos_info.payment = [
|
|
1318
|
+
{
|
|
1319
|
+
method: 'cash',
|
|
1320
|
+
total: 0,
|
|
1321
|
+
},
|
|
1322
|
+
];
|
|
1323
|
+
},
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
title: `刷卡`,
|
|
1327
|
+
value: 'creditCard',
|
|
1328
|
+
key: 'ut_credit_card',
|
|
1329
|
+
event: () => {
|
|
1330
|
+
obj.ogOrderData.pos_info.payment = [
|
|
1331
|
+
{
|
|
1332
|
+
method: 'creditCard',
|
|
1333
|
+
total: 0,
|
|
1334
|
+
},
|
|
1335
|
+
];
|
|
1336
|
+
},
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
title: `Line Pay`,
|
|
1340
|
+
value: 'line',
|
|
1341
|
+
key: 'line_pay_scan',
|
|
1342
|
+
event: () => {
|
|
1343
|
+
obj.ogOrderData.pos_info.payment = [
|
|
1344
|
+
{
|
|
1345
|
+
method: 'line',
|
|
1346
|
+
total: 0,
|
|
1347
|
+
},
|
|
1348
|
+
];
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1351
|
+
].filter(dd => {
|
|
1352
|
+
return (dd.key === 'cash' || orderDetail.payment_setting.find((d1) => dd.key === d1.key));
|
|
1353
|
+
});
|
|
1354
|
+
return [...btnArray, ...custom_payment]
|
|
1355
|
+
.map(btn => {
|
|
1356
|
+
const activeMethod = obj.ogOrderData.pos_info.payment.find((dd) => dd.method === btn.value);
|
|
1357
|
+
const boxStyle = `
|
|
1358
|
+
min-width: 120px;
|
|
1359
|
+
max-width: 120px;
|
|
1360
|
+
flex: 1;
|
|
1361
|
+
display: flex;
|
|
1362
|
+
flex-direction: column;
|
|
1363
|
+
justify-content: center;
|
|
1364
|
+
align-items: center;
|
|
1365
|
+
border-radius: 10px;
|
|
1366
|
+
background: #f6f6f6;
|
|
1367
|
+
border-radius: 10px;
|
|
1368
|
+
padding: 15px 15px;
|
|
1369
|
+
color: ${activeMethod ? '#393939' : '#8d8d8d'};
|
|
1370
|
+
border: 3px solid ${activeMethod ? '#393939' : '#f6f6f6'};
|
|
1371
|
+
box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, ${activeMethod ? '0.2' : '0'});
|
|
1372
|
+
`;
|
|
1373
|
+
return html `
|
|
1374
|
+
<div style="${boxStyle}" onclick="${gvc.event(() => btn.event())}">
|
|
1375
|
+
<div style="width: 28px; height: 28px;">${drawIcon(activeMethod, btn.value)}</div>
|
|
1376
|
+
<div style="font-size: 16px; font-weight: 500; letter-spacing: 0.64px;">
|
|
1377
|
+
${btn.title}
|
|
1378
|
+
</div>
|
|
1379
|
+
</div>
|
|
1380
|
+
`;
|
|
1381
|
+
})
|
|
1382
|
+
.join('');
|
|
1383
|
+
}
|
|
1384
|
+
else {
|
|
1385
|
+
const getPaymentMethodLabel = (method) => {
|
|
1386
|
+
if (method === 'cash') {
|
|
1387
|
+
return '現金';
|
|
1388
|
+
}
|
|
1389
|
+
if (method === 'creditCard') {
|
|
1390
|
+
return '刷卡';
|
|
1391
|
+
}
|
|
1392
|
+
if (method === 'line') {
|
|
1393
|
+
return 'LINE PAY';
|
|
1394
|
+
}
|
|
1395
|
+
const payment = (custom_payment || []).find(item => item.key === method);
|
|
1396
|
+
if (!payment) {
|
|
1397
|
+
return '';
|
|
1398
|
+
}
|
|
1399
|
+
return payment.title;
|
|
1400
|
+
};
|
|
1401
|
+
return html ` <div class="w-100 d-flex flex-column">
|
|
1402
|
+
<div class="d-flex align-items-center justify-content-center w-100 ">
|
|
1403
|
+
<div class="d-flex" style="flex:68;">${PosWidget.fontLight('付款方式')}</div>
|
|
1404
|
+
<div class="d-flex" style="flex:94;">${PosWidget.fontLight('付款金額')}</div>
|
|
1405
|
+
<div class="d-flex" style="flex:68;">${PosWidget.fontLight('狀態')}</div>
|
|
1406
|
+
<div class="d-flex" style="flex:34;"></div>
|
|
1407
|
+
</div>
|
|
1408
|
+
${obj.ogOrderData.pos_info.payment
|
|
1409
|
+
.map((dd) => {
|
|
1410
|
+
return html ` <div
|
|
1411
|
+
class="d-flex align-items-center justify-content-center w-100 mt-lg-4 mt-2"
|
|
1412
|
+
style="height:50px;"
|
|
1413
|
+
>
|
|
1414
|
+
<div class="d-flex" style="flex:68;color:#36B;cursor: pointer;">
|
|
1415
|
+
${getPaymentMethodLabel(dd.method)}
|
|
1416
|
+
</div>
|
|
1417
|
+
<div class="d-flex" style="flex:94;">
|
|
1418
|
+
<input
|
|
1419
|
+
style="display: flex;width: calc(100% - 20px);padding: 9px 18px;border-radius: 10px;border: 1px solid #DDD;text-align: right;"
|
|
1420
|
+
value="${dd.total}"
|
|
1421
|
+
onclick="${gvc.event(() => {
|
|
1422
|
+
if (dd.paied) {
|
|
1423
|
+
dialog.errorMessage({ text: '此付款金額已結清,無法進行調整' });
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
PosFunction.setMoney(gvc, dd.total, money => {
|
|
1427
|
+
dd.total = money || 0;
|
|
1428
|
+
refreshOrderView();
|
|
1429
|
+
});
|
|
1430
|
+
})}"
|
|
1431
|
+
/>
|
|
1432
|
+
</div>
|
|
1433
|
+
<div class="d-flex" style="flex:68;">${dd.paied ? `已付款` : `尚未付款`}</div>
|
|
1434
|
+
<div class="d-flex" style="flex:34;">
|
|
1435
|
+
${!dd.paied
|
|
1436
|
+
? BgWidget.save(gvc.event(() => {
|
|
1437
|
+
switch (dd.method) {
|
|
1438
|
+
case 'cash':
|
|
1439
|
+
PaymentFunction.cashFinish(gvc, dd.total, result => {
|
|
1440
|
+
if (result) {
|
|
1441
|
+
dd.paied = true;
|
|
1442
|
+
refreshOrderView();
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
break;
|
|
1446
|
+
case 'creditCard':
|
|
1447
|
+
PaymentFunction.creditFinish(gvc, dd.total, orderDetail, result => {
|
|
1448
|
+
if (result) {
|
|
1449
|
+
dd.paied = true;
|
|
1450
|
+
refreshOrderView();
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
break;
|
|
1454
|
+
case 'line':
|
|
1455
|
+
dd.line_prefix = dd.line_prefix || 0;
|
|
1456
|
+
dd.line_prefix++;
|
|
1457
|
+
PaymentFunction.lineFinish(gvc, dd.total, dd.line_prefix, orderDetail, result => {
|
|
1458
|
+
if (result) {
|
|
1459
|
+
dd.paied = true;
|
|
1460
|
+
refreshOrderView();
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
break;
|
|
1464
|
+
default:
|
|
1465
|
+
PaymentFunction.customFinish(gvc, dd.total, result => {
|
|
1466
|
+
if (result) {
|
|
1467
|
+
dd.paied = true;
|
|
1468
|
+
refreshOrderView();
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
}), '支付')
|
|
1474
|
+
: BgWidget.danger(gvc.event(() => {
|
|
1475
|
+
dialog.checkYesOrNot({
|
|
1476
|
+
text: '此款項已支付,是否確認移除付款資訊?',
|
|
1477
|
+
callback: response => {
|
|
1478
|
+
if (response) {
|
|
1479
|
+
dd.paied = false;
|
|
1480
|
+
refreshOrderView();
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
});
|
|
1484
|
+
}), '取消')}
|
|
1485
|
+
</div>
|
|
1486
|
+
</div>`;
|
|
1487
|
+
})
|
|
1488
|
+
.join('')}
|
|
1489
|
+
</div>`;
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
divCreate: {
|
|
1493
|
+
style: `
|
|
1494
|
+
display: flex;
|
|
1495
|
+
justify-content: space-between;
|
|
1496
|
+
margin-top: 24px;
|
|
1497
|
+
gap: 15px;
|
|
1498
|
+
flex-wrap: wrap;
|
|
1499
|
+
`,
|
|
1500
|
+
},
|
|
1501
|
+
onCreate: () => {
|
|
1502
|
+
if (loading) {
|
|
1503
|
+
saasConfig.api
|
|
1504
|
+
.getPrivateConfig(saasConfig.config.appName, 'glitter_finance')
|
|
1505
|
+
.then((d) => {
|
|
1506
|
+
custom_payment = (() => {
|
|
1507
|
+
try {
|
|
1508
|
+
const val = d.response.result[0].value;
|
|
1509
|
+
return val.payment_info_custom
|
|
1510
|
+
.filter((item) => {
|
|
1511
|
+
try {
|
|
1512
|
+
return item.type === 'pos' && val[item.id].toggle;
|
|
1513
|
+
}
|
|
1514
|
+
catch (error) {
|
|
1515
|
+
return false;
|
|
1516
|
+
}
|
|
1517
|
+
})
|
|
1518
|
+
.map((item) => {
|
|
1519
|
+
return {
|
|
1520
|
+
title: item.name,
|
|
1521
|
+
value: item.id,
|
|
1522
|
+
key: item.id,
|
|
1523
|
+
event: () => {
|
|
1524
|
+
obj.ogOrderData.pos_info.payment = [
|
|
1525
|
+
{
|
|
1526
|
+
method: item.id,
|
|
1527
|
+
total: 0,
|
|
1528
|
+
},
|
|
1529
|
+
];
|
|
1530
|
+
},
|
|
1531
|
+
};
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
catch (error) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1537
|
+
})();
|
|
1538
|
+
loading = false;
|
|
1539
|
+
gvc.notifyDataChange('payment');
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
});
|
|
1544
|
+
};
|
|
1253
1545
|
return {
|
|
1254
1546
|
bind: vm_id,
|
|
1255
1547
|
dataList: [{ obj: vm, key: 'paySelect' }],
|
|
@@ -1261,234 +1553,7 @@ export class PaymentPage {
|
|
|
1261
1553
|
${parseInt(orderDetail.total, 10).toLocaleString()}
|
|
1262
1554
|
</div>
|
|
1263
1555
|
</div>`,
|
|
1264
|
-
html `${PosWidget.bigTitle('付款方式')}
|
|
1265
|
-
${gvc.bindView({
|
|
1266
|
-
bind: 'payment',
|
|
1267
|
-
dataList: [{ obj: obj.ogOrderData.pos_info, key: 'payment' }],
|
|
1268
|
-
view: () => {
|
|
1269
|
-
if (obj.ogOrderData.pos_info.payment.length === 1 &&
|
|
1270
|
-
!obj.ogOrderData.pos_info.payment[0].paied) {
|
|
1271
|
-
function drawIcon(black, type) {
|
|
1272
|
-
switch (type) {
|
|
1273
|
-
case 'cash':
|
|
1274
|
-
return html `
|
|
1275
|
-
<svg
|
|
1276
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1277
|
-
width="28"
|
|
1278
|
-
height="28"
|
|
1279
|
-
viewBox="0 0 28 28"
|
|
1280
|
-
fill="none"
|
|
1281
|
-
>
|
|
1282
|
-
<path
|
|
1283
|
-
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"
|
|
1284
|
-
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1285
|
-
/>
|
|
1286
|
-
</svg>
|
|
1287
|
-
`;
|
|
1288
|
-
case 'creditCard':
|
|
1289
|
-
return html `
|
|
1290
|
-
<svg
|
|
1291
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1292
|
-
width="28"
|
|
1293
|
-
height="28"
|
|
1294
|
-
viewBox="0 0 28 28"
|
|
1295
|
-
fill="none"
|
|
1296
|
-
>
|
|
1297
|
-
<path
|
|
1298
|
-
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"
|
|
1299
|
-
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1300
|
-
/>
|
|
1301
|
-
</svg>
|
|
1302
|
-
`;
|
|
1303
|
-
default:
|
|
1304
|
-
return html `
|
|
1305
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
1306
|
-
<path
|
|
1307
|
-
fill="${black ? `#393939` : `#8D8D8D`}"
|
|
1308
|
-
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"
|
|
1309
|
-
/>
|
|
1310
|
-
</svg>
|
|
1311
|
-
`;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
let btnArray = [
|
|
1315
|
-
{
|
|
1316
|
-
title: `現金`,
|
|
1317
|
-
value: 'cash',
|
|
1318
|
-
key: 'cash',
|
|
1319
|
-
event: () => {
|
|
1320
|
-
obj.ogOrderData.pos_info.payment = [
|
|
1321
|
-
{
|
|
1322
|
-
method: 'cash',
|
|
1323
|
-
total: 0,
|
|
1324
|
-
},
|
|
1325
|
-
];
|
|
1326
|
-
},
|
|
1327
|
-
},
|
|
1328
|
-
{
|
|
1329
|
-
title: `刷卡`,
|
|
1330
|
-
value: 'creditCard',
|
|
1331
|
-
key: 'ut_credit_card',
|
|
1332
|
-
event: () => {
|
|
1333
|
-
obj.ogOrderData.pos_info.payment = [
|
|
1334
|
-
{
|
|
1335
|
-
method: 'creditCard',
|
|
1336
|
-
total: 0,
|
|
1337
|
-
},
|
|
1338
|
-
];
|
|
1339
|
-
},
|
|
1340
|
-
},
|
|
1341
|
-
{
|
|
1342
|
-
title: `Line Pay`,
|
|
1343
|
-
value: 'line',
|
|
1344
|
-
key: 'line_pay_scan',
|
|
1345
|
-
event: () => {
|
|
1346
|
-
obj.ogOrderData.pos_info.payment = [
|
|
1347
|
-
{
|
|
1348
|
-
method: 'line',
|
|
1349
|
-
total: 0,
|
|
1350
|
-
},
|
|
1351
|
-
];
|
|
1352
|
-
},
|
|
1353
|
-
},
|
|
1354
|
-
].filter(dd => {
|
|
1355
|
-
return (dd.key === 'cash' ||
|
|
1356
|
-
orderDetail.payment_setting.find((d1) => {
|
|
1357
|
-
return dd.key === d1.key;
|
|
1358
|
-
}));
|
|
1359
|
-
});
|
|
1360
|
-
return btnArray
|
|
1361
|
-
.map(btn => {
|
|
1362
|
-
return html `
|
|
1363
|
-
<div
|
|
1364
|
-
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((dd) => {
|
|
1365
|
-
return dd.method === btn.value;
|
|
1366
|
-
})
|
|
1367
|
-
? `color:#393939;border-radius: 10px;border: 3px solid #393939;box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, 0.20);`
|
|
1368
|
-
: 'color:#8D8D8D;'}"
|
|
1369
|
-
onclick="${gvc.event(() => {
|
|
1370
|
-
btn.event();
|
|
1371
|
-
})}"
|
|
1372
|
-
>
|
|
1373
|
-
<div style="width: 28px;height: 28px;">
|
|
1374
|
-
${drawIcon(obj.ogOrderData.pos_info.payment.find((dd) => {
|
|
1375
|
-
return dd.method === btn.value;
|
|
1376
|
-
}) !== undefined, btn.value)}
|
|
1377
|
-
</div>
|
|
1378
|
-
<div style="font-size: 16px;font-weight: 500;letter-spacing: 0.64px;">
|
|
1379
|
-
${btn.title}
|
|
1380
|
-
</div>
|
|
1381
|
-
</div>
|
|
1382
|
-
`;
|
|
1383
|
-
})
|
|
1384
|
-
.join('');
|
|
1385
|
-
}
|
|
1386
|
-
else {
|
|
1387
|
-
return html ` <div class="w-100 d-flex flex-column">
|
|
1388
|
-
<div class="d-flex align-items-center justify-content-center w-100 ">
|
|
1389
|
-
<div class="d-flex" style="flex:68;">${PosWidget.fontLight('付款方式')}</div>
|
|
1390
|
-
<div class="d-flex" style="flex:94;">${PosWidget.fontLight('付款金額')}</div>
|
|
1391
|
-
<div class="d-flex" style="flex:68;">${PosWidget.fontLight('狀態')}</div>
|
|
1392
|
-
<div class="d-flex" style="flex:34;"></div>
|
|
1393
|
-
</div>
|
|
1394
|
-
${obj.ogOrderData.pos_info.payment
|
|
1395
|
-
.map((dd, index) => {
|
|
1396
|
-
return html ` <div
|
|
1397
|
-
class="d-flex align-items-center justify-content-center w-100 mt-lg-4 mt-2"
|
|
1398
|
-
style="height:50px;"
|
|
1399
|
-
>
|
|
1400
|
-
<div
|
|
1401
|
-
class="d-flex"
|
|
1402
|
-
style="flex:68;color:#36B;cursor: pointer;"
|
|
1403
|
-
onclick="${gvc.event(() => { })}"
|
|
1404
|
-
>
|
|
1405
|
-
${(() => {
|
|
1406
|
-
switch (dd.method) {
|
|
1407
|
-
case 'cash':
|
|
1408
|
-
return `現金`;
|
|
1409
|
-
case 'creditCard':
|
|
1410
|
-
return `刷卡`;
|
|
1411
|
-
case 'line':
|
|
1412
|
-
return `LINE PAY`;
|
|
1413
|
-
}
|
|
1414
|
-
})()}
|
|
1415
|
-
</div>
|
|
1416
|
-
<div class="d-flex" style="flex:94;">
|
|
1417
|
-
<input
|
|
1418
|
-
style="display: flex;width: calc(100% - 20px);padding: 9px 18px;border-radius: 10px;border: 1px solid #DDD;text-align: right;"
|
|
1419
|
-
value="${dd.total}"
|
|
1420
|
-
onclick="${gvc.event(() => {
|
|
1421
|
-
if (dd.paied) {
|
|
1422
|
-
dialog.errorMessage({ text: '此付款金額已結清,無法進行調整' });
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
PosFunction.setMoney(gvc, dd.total, money => {
|
|
1426
|
-
dd.total = money || 0;
|
|
1427
|
-
refreshOrderView();
|
|
1428
|
-
});
|
|
1429
|
-
})}"
|
|
1430
|
-
/>
|
|
1431
|
-
</div>
|
|
1432
|
-
<div class="d-flex" style="flex:68;">${dd.paied ? `已付款` : `尚未付款`}</div>
|
|
1433
|
-
<div class="d-flex" style="flex:34;">
|
|
1434
|
-
${!dd.paied
|
|
1435
|
-
? BgWidget.save(gvc.event(() => {
|
|
1436
|
-
switch (dd.method) {
|
|
1437
|
-
case 'cash':
|
|
1438
|
-
PaymentFunction.cashFinish(gvc, dd.total, result => {
|
|
1439
|
-
if (result) {
|
|
1440
|
-
dd.paied = true;
|
|
1441
|
-
refreshOrderView();
|
|
1442
|
-
}
|
|
1443
|
-
});
|
|
1444
|
-
break;
|
|
1445
|
-
case 'creditCard':
|
|
1446
|
-
PaymentFunction.creditFinish(gvc, dd.total, orderDetail, result => {
|
|
1447
|
-
if (result) {
|
|
1448
|
-
dd.paied = true;
|
|
1449
|
-
refreshOrderView();
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
break;
|
|
1453
|
-
case 'line':
|
|
1454
|
-
dd.line_prefix = dd.line_prefix || 0;
|
|
1455
|
-
dd.line_prefix++;
|
|
1456
|
-
PaymentFunction.lineFinish(gvc, dd.total, dd.line_prefix, orderDetail, result => {
|
|
1457
|
-
if (result) {
|
|
1458
|
-
dd.paied = true;
|
|
1459
|
-
refreshOrderView();
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
break;
|
|
1463
|
-
}
|
|
1464
|
-
}), '支付')
|
|
1465
|
-
: BgWidget.danger(gvc.event(() => {
|
|
1466
|
-
dialog.checkYesOrNot({
|
|
1467
|
-
text: '此款項已支付,是否確認移除付款資訊?',
|
|
1468
|
-
callback: response => {
|
|
1469
|
-
if (response) {
|
|
1470
|
-
dd.paied = false;
|
|
1471
|
-
refreshOrderView();
|
|
1472
|
-
}
|
|
1473
|
-
},
|
|
1474
|
-
});
|
|
1475
|
-
}), '取消')}
|
|
1476
|
-
</div>
|
|
1477
|
-
</div>`;
|
|
1478
|
-
})
|
|
1479
|
-
.join('')}
|
|
1480
|
-
</div>`;
|
|
1481
|
-
}
|
|
1482
|
-
},
|
|
1483
|
-
divCreate: {
|
|
1484
|
-
style: `
|
|
1485
|
-
display: flex;
|
|
1486
|
-
justify-content: space-between;
|
|
1487
|
-
margin-top: 24px;
|
|
1488
|
-
gap: 15px;
|
|
1489
|
-
`,
|
|
1490
|
-
},
|
|
1491
|
-
})}`,
|
|
1556
|
+
html `${PosWidget.bigTitle('付款方式')} ${paymentView()}`,
|
|
1492
1557
|
html ` <div style="height:24px;"></div>`,
|
|
1493
1558
|
PosWidget.buttonSnow(`新增付款方式`, gvc.event(() => {
|
|
1494
1559
|
PosFunction.selectPaymentMethod({
|
|
@@ -1645,6 +1710,7 @@ export class PaymentPage {
|
|
|
1645
1710
|
}
|
|
1646
1711
|
view.push(html `
|
|
1647
1712
|
<div style="margin-top: 32px;gap:10px;" class="d-flex align-items-center">
|
|
1713
|
+
<!-- 儲存訂單按鈕 -->
|
|
1648
1714
|
<div
|
|
1649
1715
|
style="width:49px;height: 49px;border-radius: 10px;background: #F6F6F6;cursor: pointer;"
|
|
1650
1716
|
class="d-flex align-items-center justify-content-center"
|
|
@@ -1659,20 +1725,19 @@ export class PaymentPage {
|
|
|
1659
1725
|
>
|
|
1660
1726
|
<i class="fa-solid fa-down-to-bracket fs-4"></i>
|
|
1661
1727
|
</div>
|
|
1728
|
+
|
|
1729
|
+
<!-- 建立預購單按鈕 -->
|
|
1662
1730
|
<div
|
|
1663
1731
|
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;"
|
|
1664
1732
|
onclick="${gvc.event(() => {
|
|
1665
|
-
|
|
1666
|
-
obj.ogOrderData.pos_info.payment.find((dd) =>
|
|
1667
|
-
|
|
1668
|
-
})
|
|
1669
|
-
dialog.errorMessage({
|
|
1670
|
-
text: `請結清所有款項`,
|
|
1671
|
-
});
|
|
1733
|
+
const hasUnpaidPayments = obj.ogOrderData.pos_info.payment.length > 1 &&
|
|
1734
|
+
obj.ogOrderData.pos_info.payment.find((dd) => !dd.paied);
|
|
1735
|
+
if (hasUnpaidPayments) {
|
|
1736
|
+
dialog.errorMessage({ text: '請結清所有款項' });
|
|
1672
1737
|
return;
|
|
1673
1738
|
}
|
|
1674
1739
|
dialog.checkYesOrNot({
|
|
1675
|
-
text: '
|
|
1740
|
+
text: '是否確認建立預購單?',
|
|
1676
1741
|
callback: response => {
|
|
1677
1742
|
if (response) {
|
|
1678
1743
|
paymentNext(true);
|
|
@@ -1683,35 +1748,30 @@ export class PaymentPage {
|
|
|
1683
1748
|
>
|
|
1684
1749
|
建立預購單
|
|
1685
1750
|
</div>
|
|
1751
|
+
|
|
1752
|
+
<!-- 前往結帳按鈕 -->
|
|
1686
1753
|
<div
|
|
1687
1754
|
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;"
|
|
1688
1755
|
onclick="${gvc.event(() => {
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
}
|
|
1695
|
-
else if (obj.ogOrderData.pos_info.payment.length > 1 &&
|
|
1696
|
-
obj.ogOrderData.pos_info.payment.find((dd) => {
|
|
1697
|
-
return !dd.paied;
|
|
1698
|
-
})) {
|
|
1756
|
+
const amountShortage = total - parseInt(orderDetail.total, 10);
|
|
1757
|
+
const hasUnpaidPayments = obj.ogOrderData.pos_info.payment.length > 1 &&
|
|
1758
|
+
obj.ogOrderData.pos_info.payment.find((dd) => !dd.paied);
|
|
1759
|
+
const hasPreOrderItems = orderDetail.lineItems.find((dd) => dd.pre_order);
|
|
1760
|
+
if (amountShortage < 0) {
|
|
1699
1761
|
dialog.errorMessage({
|
|
1700
|
-
text:
|
|
1762
|
+
text: `收款金額尚需要『 ${(amountShortage * -1).toLocaleString()} 』`,
|
|
1701
1763
|
});
|
|
1702
1764
|
return;
|
|
1703
1765
|
}
|
|
1704
|
-
else if (
|
|
1705
|
-
return dd.pre_order;
|
|
1706
|
-
})) {
|
|
1766
|
+
else if (hasUnpaidPayments) {
|
|
1707
1767
|
dialog.errorMessage({
|
|
1708
|
-
text:
|
|
1768
|
+
text: '請結清所有款項',
|
|
1709
1769
|
});
|
|
1710
1770
|
return;
|
|
1711
1771
|
}
|
|
1712
1772
|
PaymentPage.storeHistory(orderDetail);
|
|
1713
1773
|
dialog.checkYesOrNot({
|
|
1714
|
-
text: '是否確認前往結帳?',
|
|
1774
|
+
text: hasPreOrderItems ? '是否確認建立預購單?' : '是否確認前往結帳?',
|
|
1715
1775
|
callback: response => {
|
|
1716
1776
|
if (response) {
|
|
1717
1777
|
paymentNext(false);
|
|
@@ -1727,7 +1787,7 @@ export class PaymentPage {
|
|
|
1727
1787
|
return view.join('');
|
|
1728
1788
|
},
|
|
1729
1789
|
divCreate: {
|
|
1730
|
-
class:
|
|
1790
|
+
class: 'd-flex flex-column w-100',
|
|
1731
1791
|
},
|
|
1732
1792
|
};
|
|
1733
1793
|
})}
|
|
@@ -1735,8 +1795,8 @@ export class PaymentPage {
|
|
|
1735
1795
|
}));
|
|
1736
1796
|
},
|
|
1737
1797
|
divCreate: {
|
|
1738
|
-
class:
|
|
1739
|
-
style:
|
|
1798
|
+
class: `w-100 ${document.body.offsetWidth < 800 ? '' : 'd-flex flex-column flex-sm-row'}`,
|
|
1799
|
+
style: 'overflow-y: auto;',
|
|
1740
1800
|
},
|
|
1741
1801
|
};
|
|
1742
1802
|
});
|
|
@@ -2180,14 +2240,21 @@ export class PaymentPage {
|
|
|
2180
2240
|
];
|
|
2181
2241
|
return btnArray
|
|
2182
2242
|
.map(btn => {
|
|
2243
|
+
const isActive = c_vm.invoice_select == btn.value;
|
|
2244
|
+
const boxStyle = `
|
|
2245
|
+
padding: 20px;
|
|
2246
|
+
border-radius: 10px;
|
|
2247
|
+
background: #f6f6f6;
|
|
2248
|
+
color: ${isActive ? '#393939' : '#8D8D8D'};
|
|
2249
|
+
border-radius: 10px;
|
|
2250
|
+
border: 3px solid ${isActive ? '#393939' : '#f6f6f6'};
|
|
2251
|
+
box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, ${isActive ? '0.2' : '0'});
|
|
2252
|
+
`;
|
|
2183
2253
|
return html `
|
|
2184
2254
|
<div class="col-6 mb-4">
|
|
2185
2255
|
<div
|
|
2186
2256
|
class="w-100 d-flex align-items-center flex-column justify-content-center"
|
|
2187
|
-
style="
|
|
2188
|
-
btn.value
|
|
2189
|
-
? `color:#393939;border-radius: 10px;border: 3px solid #393939;box-shadow: 2px 2px 15px 0px rgba(0, 0, 0, 0.20);`
|
|
2190
|
-
: 'color:#8D8D8D;'} "
|
|
2257
|
+
style="${boxStyle} "
|
|
2191
2258
|
onclick="${gvc.event(() => {
|
|
2192
2259
|
c_vm.invoice_select = btn.value;
|
|
2193
2260
|
c_vm.value = '';
|
|
@@ -2270,16 +2337,30 @@ export class PaymentPage {
|
|
|
2270
2337
|
return '';
|
|
2271
2338
|
}
|
|
2272
2339
|
})()}
|
|
2273
|
-
<div
|
|
2274
|
-
class="d-flex align-items-center justify-content-center w-100"
|
|
2275
|
-
style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
|
|
2276
|
-
>
|
|
2340
|
+
<div class="d-flex gap-2 w-100 px-2">
|
|
2277
2341
|
<div
|
|
2278
|
-
class="flex-
|
|
2279
|
-
style="
|
|
2280
|
-
onclick="${gvc.event(() => next())}"
|
|
2342
|
+
class="d-flex align-items-center justify-content-center w-100"
|
|
2343
|
+
style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
|
|
2281
2344
|
>
|
|
2282
|
-
|
|
2345
|
+
<div
|
|
2346
|
+
class="flex-fill"
|
|
2347
|
+
style="border: 1px solid #393939;border-radius: 10px;background: #fff;padding: 12px 24px;color: #393939;text-align:center;"
|
|
2348
|
+
onclick="${gvc.event(() => gvc.glitter.closeDiaLog())}"
|
|
2349
|
+
>
|
|
2350
|
+
取消
|
|
2351
|
+
</div>
|
|
2352
|
+
</div>
|
|
2353
|
+
<div
|
|
2354
|
+
class="d-flex align-items-center justify-content-center w-100"
|
|
2355
|
+
style="margin-top: 24px;font-size: 16px;font-weight: 700;letter-spacing: 0.64px;"
|
|
2356
|
+
>
|
|
2357
|
+
<div
|
|
2358
|
+
class="flex-fill"
|
|
2359
|
+
style="border-radius: 10px;background: #393939;padding: 12px 24px;color: #FFF;text-align:center;"
|
|
2360
|
+
onclick="${gvc.event(() => next())}"
|
|
2361
|
+
>
|
|
2362
|
+
確定
|
|
2363
|
+
</div>
|
|
2283
2364
|
</div>
|
|
2284
2365
|
</div>
|
|
2285
2366
|
</div>
|