ts-glitter 21.0.3 → 21.0.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 +22 -37
- package/lowcode/backend-manager/bg-blog.ts +45 -34
- package/lowcode/backend-manager/bg-list-component.js +2 -2
- package/lowcode/backend-manager/bg-list-component.ts +2 -2
- package/lowcode/backend-manager/bg-widget.js +21 -0
- package/lowcode/backend-manager/bg-widget.ts +21 -0
- package/lowcode/cms-plugin/filter-options.js +3 -3
- package/lowcode/cms-plugin/filter-options.ts +1 -1
- package/lowcode/cms-plugin/shopping-finance-setting.js +251 -6
- package/lowcode/cms-plugin/shopping-finance-setting.ts +291 -6
- package/lowcode/cms-plugin/shopping-order-manager.js +56 -46
- package/lowcode/cms-plugin/shopping-order-manager.ts +59 -47
- package/lowcode/cms-plugin/shopping-product-setting.js +10 -5
- package/lowcode/cms-plugin/shopping-product-setting.ts +14 -6
- package/lowcode/cms-plugin/shopping-setting-advance.js +21 -72
- package/lowcode/cms-plugin/shopping-setting-advance.ts +31 -98
- package/lowcode/css/editor.css +48 -16
- package/lowcode/css/front-end.css +16 -17
- package/lowcode/glitter-base/global/language.js +2 -0
- package/lowcode/glitter-base/global/language.ts +3 -0
- package/lowcode/glitter-base/global/shipment-config.js +4 -4
- package/lowcode/glitter-base/global/shipment-config.ts +1 -1
- package/lowcode/glitter-base/route/shopping.js +11 -0
- package/lowcode/glitter-base/route/shopping.ts +12 -0
- package/lowcode/official_view_component/form-widget/input-custom.js +0 -1
- package/lowcode/official_view_component/form-widget/input-custom.ts +0 -1
- package/lowcode/public-components/checkout/index.js +578 -780
- package/lowcode/public-components/checkout/index.ts +2457 -2652
- package/lowcode/public-components/headers/header-class.js +252 -324
- package/lowcode/public-components/headers/header-class.ts +389 -480
- package/lowcode/public-components/modules/cart-module.js +433 -0
- package/lowcode/public-components/modules/cart-module.ts +491 -0
- package/lowcode/public-components/modules/product-module.js +45 -0
- package/lowcode/public-components/modules/product-module.ts +58 -0
- package/lowcode/public-components/product/product-detail.js +178 -184
- package/lowcode/public-components/product/product-detail.ts +564 -579
- package/lowcode/public-components/user-manager/um-order.js +162 -32
- package/lowcode/public-components/user-manager/um-order.ts +181 -46
- package/lowcode/public-models/product.ts +1 -0
- package/lowcode/view-model/saas-view-model.js +1 -1
- package/lowcode/view-model/saas-view-model.ts +1 -1
- package/package.json +1 -1
- package/src/Language.js +1 -0
- package/src/Language.js.map +1 -1
- package/src/Language.ts +3 -0
- package/src/api-public/controllers/article.js +33 -29
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/article.ts +152 -146
- package/src/api-public/controllers/index.js +2 -0
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +2 -0
- package/src/api-public/controllers/shop.js +125 -47
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +148 -61
- package/src/api-public/controllers/user.js +51 -52
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +63 -52
- package/src/api-public/models/glitter-finance.js +2 -1
- package/src/api-public/models/glitter-finance.js.map +5 -1
- package/src/api-public/services/checkout-event.d.ts +1 -0
- package/src/api-public/services/checkout-event.js +18 -10
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +18 -7
- package/src/api-public/services/factories/payment-strategy-factory.d.ts +6 -0
- package/src/api-public/services/factories/payment-strategy-factory.js +49 -0
- package/src/api-public/services/factories/payment-strategy-factory.js.map +1 -0
- package/src/api-public/services/factories/payment-strategy-factory.ts +71 -0
- package/src/api-public/services/fb-service.js +4 -4
- package/src/api-public/services/fb-service.js.map +1 -1
- package/src/api-public/services/financial-service.d.ts +2 -1
- package/src/api-public/services/financial-service.js +48 -53
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +29 -38
- package/src/api-public/services/financial-serviceV2.d.ts +298 -0
- package/src/api-public/services/financial-serviceV2.js +1158 -0
- package/src/api-public/services/financial-serviceV2.js.map +1 -0
- package/src/api-public/services/financial-serviceV2.ts +1518 -0
- package/src/api-public/services/interface/payment-keys-interface.d.ts +37 -0
- package/src/api-public/services/interface/payment-keys-interface.js +3 -0
- package/src/api-public/services/interface/payment-keys-interface.js.map +1 -0
- package/src/api-public/services/interface/payment-keys-interface.ts +46 -0
- package/src/api-public/services/interface/payment-strategy-interface.d.ts +17 -0
- package/src/api-public/services/interface/payment-strategy-interface.js +3 -0
- package/src/api-public/services/interface/payment-strategy-interface.js.map +1 -0
- package/src/api-public/services/interface/payment-strategy-interface.ts +48 -0
- package/src/api-public/services/migrate-event/public-user-config.d.ts +5 -0
- package/src/api-public/services/migrate-event/public-user-config.js +81 -0
- package/src/api-public/services/migrate-event/public-user-config.js.map +1 -0
- package/src/api-public/services/migrate-event/public-user-config.ts +106 -0
- package/src/api-public/services/model/handlePaymentTransaction.js +0 -68
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +62 -54
- package/src/api-public/services/monitor.d.ts +1 -0
- package/src/api-public/services/payment-service.d.ts +12 -0
- package/src/api-public/services/payment-service.js +83 -0
- package/src/api-public/services/payment-service.js.map +1 -0
- package/src/api-public/services/payment-service.ts +112 -0
- package/src/api-public/services/shopping.d.ts +2 -1
- package/src/api-public/services/shopping.js +60 -23
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +88 -16
- package/src/api-public/services/strategies/ecpay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/ecpay-strategy.js +26 -0
- package/src/api-public/services/strategies/ecpay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/ecpay-strategy.ts +30 -0
- package/src/api-public/services/strategies/ezpay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/ezpay-strategy.js +26 -0
- package/src/api-public/services/strategies/ezpay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/ezpay-strategy.ts +31 -0
- package/src/api-public/services/strategies/jkopay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/jkopay-strategy.js +32 -0
- package/src/api-public/services/strategies/jkopay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/jkopay-strategy.ts +36 -0
- package/src/api-public/services/strategies/linepay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/linepay-strategy.js +32 -0
- package/src/api-public/services/strategies/linepay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/linepay-strategy.ts +35 -0
- package/src/api-public/services/strategies/paynow-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/paynow-strategy.js +26 -0
- package/src/api-public/services/strategies/paynow-strategy.js.map +1 -0
- package/src/api-public/services/strategies/paynow-strategy.ts +29 -0
- package/src/api-public/services/strategies/paypal-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/paypal-strategy.js +28 -0
- package/src/api-public/services/strategies/paypal-strategy.js.map +1 -0
- package/src/api-public/services/strategies/paypal-strategy.ts +31 -0
- package/src/api-public/services/updated-table-checked.d.ts +1 -0
- package/src/api-public/services/updated-table-checked.js +37 -15
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +56 -36
- package/src/api-public/utils/ut-permission.d.ts +1 -0
- package/src/app-project/serverless/src/index.js +17 -7
- package/src/app-project/serverless/src/index.js.map +1 -1
- package/src/app-project/serverless/src/modules/CryptoJS.js +17 -7
- package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
- package/src/app-project/serverless/src/modules/ssh.js +17 -7
- package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
- package/src/config.d.ts +1 -1
- package/src/modules/AWSLib.js +3 -2
- package/src/modules/AWSLib.js.map +1 -1
- package/src/modules/CryptoJS.js +17 -7
- package/src/modules/CryptoJS.js.map +1 -1
- package/src/modules/database.d.ts +1 -1
- package/src/modules/redis.d.ts +1 -1
- package/src/modules/ssh.js +17 -7
- package/src/modules/ssh.js.map +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +2 -1
- package/src/modules/tool.js.map +1 -1
- package/src/run.js +2 -1
- package/src/run.js.map +1 -1
- package/src/services/create-instance.js +4 -3
- package/src/services/create-instance.js.map +1 -1
- package/src/services/saas-table-check.js +2 -2
- package/src/services/saas-table-check.js.map +5 -1
- package/src/services/tool.js +3 -2
- package/src/services/tool.js.map +1 -1
- package/vp00rqhw1r.json +1 -0
- package/src/api-public/services/product-migrate.d.ts +0 -8
- package/src/api-public/services/product-migrate.js.map +0 -1
|
@@ -7,20 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
11
10
|
import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
|
|
12
11
|
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
13
|
-
import {
|
|
12
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
14
13
|
import { CheckInput } from '../modules/checkInput.js';
|
|
15
|
-
import { LanguageBackend } from './language-backend.js';
|
|
16
14
|
import { Tool } from '../modules/tool.js';
|
|
17
|
-
import { ProductAi } from './ai-generator/product-ai.js';
|
|
18
15
|
import { imageLibrary } from '../modules/image-library.js';
|
|
16
|
+
import { LanguageBackend } from './language-backend.js';
|
|
17
|
+
import { ProductAi } from './ai-generator/product-ai.js';
|
|
18
|
+
import { ApiPageConfig } from '../api/pageConfig.js';
|
|
19
19
|
import { Language } from '../glitter-base/global/language.js';
|
|
20
|
-
import { ShoppingShipmentSetting } from './shopping-shipment-setting.js';
|
|
21
|
-
import { ShipmentConfig } from '../glitter-base/global/shipment-config.js';
|
|
22
20
|
import { ApiUser } from '../glitter-base/route/user.js';
|
|
21
|
+
import { ApiShop } from '../glitter-base/route/shopping.js';
|
|
23
22
|
import { PaymentConfig } from '../glitter-base/global/payment-config.js';
|
|
23
|
+
import { ShipmentConfig } from '../glitter-base/global/shipment-config.js';
|
|
24
|
+
import { ShoppingShipmentSetting } from './shopping-shipment-setting.js';
|
|
24
25
|
const html = String.raw;
|
|
25
26
|
export class ShoppingFinanceSetting {
|
|
26
27
|
static main(gvc, pos) {
|
|
@@ -552,6 +553,11 @@ export class ShoppingFinanceSetting {
|
|
|
552
553
|
gvc.closeDialog();
|
|
553
554
|
})),
|
|
554
555
|
BgWidget.save(gvc.event(() => {
|
|
556
|
+
if (payData.key == "ecPay" && key_d.ActionURL == "https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5") {
|
|
557
|
+
key_d.MERCHANT_ID = "3002607";
|
|
558
|
+
key_d.HASH_KEY = "pwFHCqoQZGmho4w6";
|
|
559
|
+
key_d.HASH_IV = "EkRm7iFT261dpevs";
|
|
560
|
+
}
|
|
555
561
|
keyData[payData.key] = key_d;
|
|
556
562
|
saveData();
|
|
557
563
|
gvc.closeDialog();
|
|
@@ -1537,6 +1543,7 @@ export class ShoppingFinanceSetting {
|
|
|
1537
1543
|
BgWidget.tab([
|
|
1538
1544
|
{ title: '基本設定', key: 'delivery_setting' },
|
|
1539
1545
|
{ title: '物流追蹤', key: 'delivery_track' },
|
|
1546
|
+
{ title: '物流群組', key: 'delivery_group' },
|
|
1540
1547
|
{ title: '配送備註', key: 'delivery_note' },
|
|
1541
1548
|
], gvc, vm.page, text => {
|
|
1542
1549
|
vm.page = text;
|
|
@@ -2608,6 +2615,244 @@ export class ShoppingFinanceSetting {
|
|
|
2608
2615
|
}),
|
|
2609
2616
|
]);
|
|
2610
2617
|
}
|
|
2618
|
+
else if (vm.page === 'delivery_group') {
|
|
2619
|
+
const dvm = {
|
|
2620
|
+
id: gvc.glitter.getUUID(),
|
|
2621
|
+
loading: true,
|
|
2622
|
+
dataList: [],
|
|
2623
|
+
};
|
|
2624
|
+
function updateGroup(dialogGVC) {
|
|
2625
|
+
dialog.dataLoading({ visible: true });
|
|
2626
|
+
setTimeout(() => {
|
|
2627
|
+
ApiUser.setPublicConfig({
|
|
2628
|
+
user_id: 'manager',
|
|
2629
|
+
key: 'logistics_group',
|
|
2630
|
+
value: dvm.dataList,
|
|
2631
|
+
}).then(() => {
|
|
2632
|
+
dialog.dataLoading({ visible: false });
|
|
2633
|
+
dialog.successMessage({ text: '設定成功' });
|
|
2634
|
+
dialogGVC.closeDialog();
|
|
2635
|
+
dvm.loading = true;
|
|
2636
|
+
gvc.notifyDataChange(dvm.id);
|
|
2637
|
+
});
|
|
2638
|
+
}, 100);
|
|
2639
|
+
}
|
|
2640
|
+
function deleteProductLogisticGroup(group, callback) {
|
|
2641
|
+
if (group) {
|
|
2642
|
+
ApiShop.deleteProductLogistic({ group }).then(() => callback());
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
function editGroupDialog(item) {
|
|
2646
|
+
const cloneData = structuredClone(item);
|
|
2647
|
+
const postData = item
|
|
2648
|
+
? structuredClone(item)
|
|
2649
|
+
: {
|
|
2650
|
+
key: Tool.randomString(8),
|
|
2651
|
+
name: '',
|
|
2652
|
+
list: [],
|
|
2653
|
+
};
|
|
2654
|
+
return BgWidget.settingDialog({
|
|
2655
|
+
gvc,
|
|
2656
|
+
title: '設定群組',
|
|
2657
|
+
innerHTML: iGVC => {
|
|
2658
|
+
const id = iGVC.glitter.getUUID();
|
|
2659
|
+
let loading = true;
|
|
2660
|
+
let dataList = [];
|
|
2661
|
+
return iGVC.bindView({
|
|
2662
|
+
bind: id,
|
|
2663
|
+
view: () => {
|
|
2664
|
+
if (loading) {
|
|
2665
|
+
return BgWidget.spinner();
|
|
2666
|
+
}
|
|
2667
|
+
return [
|
|
2668
|
+
html `<div class="tx_700">群組名稱</div>`,
|
|
2669
|
+
BgWidget.editeInput({
|
|
2670
|
+
gvc: iGVC,
|
|
2671
|
+
title: '',
|
|
2672
|
+
default: postData.name,
|
|
2673
|
+
placeHolder: '請輸入群組名稱',
|
|
2674
|
+
callback: value => {
|
|
2675
|
+
postData.name = value;
|
|
2676
|
+
},
|
|
2677
|
+
}),
|
|
2678
|
+
html `<div class="tx_700">包含的物流</div>`,
|
|
2679
|
+
BgWidget.multiCheckboxContainer(iGVC, dataList, postData.list, text => {
|
|
2680
|
+
postData.list = text;
|
|
2681
|
+
}, { single: false }),
|
|
2682
|
+
].join(BgWidget.mbContainer(12));
|
|
2683
|
+
},
|
|
2684
|
+
onCreate: () => {
|
|
2685
|
+
if (loading) {
|
|
2686
|
+
ApiPageConfig.getPrivateConfig(window.parent.appName, 'logistics_setting').then((dd) => {
|
|
2687
|
+
var _a;
|
|
2688
|
+
if (dd.result && dd.response.result[0]) {
|
|
2689
|
+
const shipment_setting = dd.response.result[0].value;
|
|
2690
|
+
const combinedList = [
|
|
2691
|
+
...ShipmentConfig.list.map(dd => ({
|
|
2692
|
+
name: dd.title,
|
|
2693
|
+
value: dd.value,
|
|
2694
|
+
})),
|
|
2695
|
+
...((_a = shipment_setting.custom_delivery) !== null && _a !== void 0 ? _a : []).map((dd) => ({
|
|
2696
|
+
form: dd.form,
|
|
2697
|
+
name: dd.name,
|
|
2698
|
+
value: dd.id,
|
|
2699
|
+
})),
|
|
2700
|
+
];
|
|
2701
|
+
const supportedList = combinedList.filter(d1 => shipment_setting.support.some((d2) => d2 === d1.value));
|
|
2702
|
+
dataList = supportedList.map(data => ({
|
|
2703
|
+
key: data.value,
|
|
2704
|
+
name: data.name,
|
|
2705
|
+
}));
|
|
2706
|
+
}
|
|
2707
|
+
loading = false;
|
|
2708
|
+
iGVC.notifyDataChange(id);
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
},
|
|
2712
|
+
});
|
|
2713
|
+
},
|
|
2714
|
+
footer_html: fGVC => {
|
|
2715
|
+
return [
|
|
2716
|
+
item
|
|
2717
|
+
? BgWidget.danger(fGVC.event(() => {
|
|
2718
|
+
dialog.checkYesOrNot({
|
|
2719
|
+
text: '若刪除此群組,有使用到此群組的商品將會改成全部物流皆可使用,確定要刪除此物流群組?',
|
|
2720
|
+
callback: bool => {
|
|
2721
|
+
if (bool) {
|
|
2722
|
+
dvm.dataList = dvm.dataList.filter(data => data.key !== (item === null || item === void 0 ? void 0 : item.key));
|
|
2723
|
+
deleteProductLogisticGroup(item === null || item === void 0 ? void 0 : item.key, () => updateGroup(fGVC));
|
|
2724
|
+
}
|
|
2725
|
+
},
|
|
2726
|
+
});
|
|
2727
|
+
}))
|
|
2728
|
+
: '',
|
|
2729
|
+
BgWidget.cancel(fGVC.event(() => {
|
|
2730
|
+
if (item) {
|
|
2731
|
+
item = cloneData;
|
|
2732
|
+
}
|
|
2733
|
+
fGVC.closeDialog();
|
|
2734
|
+
})),
|
|
2735
|
+
BgWidget.save(fGVC.event(() => {
|
|
2736
|
+
for (const data of dvm.dataList) {
|
|
2737
|
+
if (data.key !== postData.key) {
|
|
2738
|
+
if (data.name === postData.name) {
|
|
2739
|
+
dialog.infoMessage({ text: `群組名「${postData.name}」已經存在` });
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
if (Tool.ObjCompare(postData.list, data.list)) {
|
|
2743
|
+
dialog.infoMessage({ text: '此群組的物流組合已經存在,請調整您點選的物流' });
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
if (postData.list.length === 0) {
|
|
2747
|
+
dialog.infoMessage({ text: '請勾選至少一種物流的組合' });
|
|
2748
|
+
return;
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
if (item) {
|
|
2753
|
+
const target = dvm.dataList.find(data => data.key === (item === null || item === void 0 ? void 0 : item.key));
|
|
2754
|
+
target && Object.assign(target, postData);
|
|
2755
|
+
}
|
|
2756
|
+
else {
|
|
2757
|
+
dvm.dataList.push(postData);
|
|
2758
|
+
}
|
|
2759
|
+
updateGroup(fGVC);
|
|
2760
|
+
})),
|
|
2761
|
+
].join('');
|
|
2762
|
+
},
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2765
|
+
view = view.concat([
|
|
2766
|
+
html ` <div class="px-md-0 px-2">
|
|
2767
|
+
${BgWidget.normalInsignia('可以將多個物流設定成一個群組集中,在商品設定頁可以一次管理物流方式')}
|
|
2768
|
+
</div>`,
|
|
2769
|
+
gvc.bindView(() => {
|
|
2770
|
+
return {
|
|
2771
|
+
bind: dvm.id,
|
|
2772
|
+
view: () => {
|
|
2773
|
+
if (dvm.loading) {
|
|
2774
|
+
return BgWidget.spinner();
|
|
2775
|
+
}
|
|
2776
|
+
return dvm.dataList
|
|
2777
|
+
.map(item => {
|
|
2778
|
+
const dd = {
|
|
2779
|
+
title: item.name,
|
|
2780
|
+
value: item.key,
|
|
2781
|
+
list: item.list,
|
|
2782
|
+
type: 'font_awesome',
|
|
2783
|
+
src: html `<i class="fa-solid fa-object-group fs-4"></i>`,
|
|
2784
|
+
};
|
|
2785
|
+
return html `
|
|
2786
|
+
<div class="col-12 col-md-4 p-0 p-md-2">
|
|
2787
|
+
<div
|
|
2788
|
+
class="w-100 position-relative main-card"
|
|
2789
|
+
style="padding: 24px; background: white; overflow: hidden; justify-content: space-between; align-items: center; gap: 18px; display: inline-flex;"
|
|
2790
|
+
>
|
|
2791
|
+
<div
|
|
2792
|
+
style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex;"
|
|
2793
|
+
>
|
|
2794
|
+
<div>${dd.type === 'font_awesome' ? dd.src : html ` <img src="${dd.src}" />`}</div>
|
|
2795
|
+
<div
|
|
2796
|
+
style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
|
|
2797
|
+
>
|
|
2798
|
+
<div class="tx_normal">${dd.title}</div>
|
|
2799
|
+
</div>
|
|
2800
|
+
</div>
|
|
2801
|
+
<div>
|
|
2802
|
+
${BgWidget.customButton({
|
|
2803
|
+
button: { color: 'gray', size: 'sm' },
|
|
2804
|
+
text: { name: '設定群組' },
|
|
2805
|
+
event: gvc.event(() => editGroupDialog(item)),
|
|
2806
|
+
})}
|
|
2807
|
+
</div>
|
|
2808
|
+
</div>
|
|
2809
|
+
</div>
|
|
2810
|
+
${document.body.clientWidth > 768 ? '' : BgWidget.mbContainer(8)}
|
|
2811
|
+
`;
|
|
2812
|
+
})
|
|
2813
|
+
.concat([
|
|
2814
|
+
html ` <div
|
|
2815
|
+
class="col-12 col-md-4 p-0 p-md-2"
|
|
2816
|
+
style="cursor: pointer;"
|
|
2817
|
+
onclick="${gvc.event(() => editGroupDialog())}"
|
|
2818
|
+
>
|
|
2819
|
+
<div
|
|
2820
|
+
class="w-100 main-card"
|
|
2821
|
+
style="max-height:73.59px;padding: 24px; background: white; overflow: hidden; flex-direction: column; justify-content: center; align-items: center; gap: 18px; display: inline-flex"
|
|
2822
|
+
>
|
|
2823
|
+
<div
|
|
2824
|
+
class="fw-bold"
|
|
2825
|
+
style="align-self: stretch; justify-content: center; align-items: center; gap: 14px; display: inline-flex;color:#4D86DB;"
|
|
2826
|
+
>
|
|
2827
|
+
<i class="fa-regular fa-circle-plus fs-5"></i>
|
|
2828
|
+
<div class="fs-5">新增物流群組</div>
|
|
2829
|
+
</div>
|
|
2830
|
+
</div>
|
|
2831
|
+
</div>`,
|
|
2832
|
+
])
|
|
2833
|
+
.join('');
|
|
2834
|
+
},
|
|
2835
|
+
divCreate: {
|
|
2836
|
+
class: 'row guide3-3 mt-3 px-1',
|
|
2837
|
+
},
|
|
2838
|
+
onCreate: () => {
|
|
2839
|
+
if (dvm.loading) {
|
|
2840
|
+
ApiUser.getPublicConfig('logistics_group', 'manager').then(r => {
|
|
2841
|
+
var _a;
|
|
2842
|
+
if (r.result) {
|
|
2843
|
+
dvm.dataList = (_a = r.response.value) !== null && _a !== void 0 ? _a : [];
|
|
2844
|
+
}
|
|
2845
|
+
setTimeout(() => {
|
|
2846
|
+
dvm.loading = false;
|
|
2847
|
+
gvc.notifyDataChange(dvm.id);
|
|
2848
|
+
}, 100);
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
},
|
|
2852
|
+
};
|
|
2853
|
+
}),
|
|
2854
|
+
]);
|
|
2855
|
+
}
|
|
2611
2856
|
view.push(BgWidget.mbContainer(240));
|
|
2612
2857
|
return BgWidget.container(view.join(''));
|
|
2613
2858
|
},
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
2
1
|
import { GVC } from '../glitterBundle/GVController.js';
|
|
3
2
|
import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
|
|
4
3
|
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
5
|
-
import {
|
|
4
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
6
5
|
import { CheckInput } from '../modules/checkInput.js';
|
|
7
|
-
import { LanguageBackend } from './language-backend.js';
|
|
8
6
|
import { Tool } from '../modules/tool.js';
|
|
9
|
-
import { ProductAi } from './ai-generator/product-ai.js';
|
|
10
7
|
import { imageLibrary } from '../modules/image-library.js';
|
|
8
|
+
import { LanguageBackend } from './language-backend.js';
|
|
9
|
+
import { ProductAi } from './ai-generator/product-ai.js';
|
|
10
|
+
import { ApiPageConfig } from '../api/pageConfig.js';
|
|
11
11
|
import { Language } from '../glitter-base/global/language.js';
|
|
12
|
-
import { ShoppingShipmentSetting } from './shopping-shipment-setting.js';
|
|
13
|
-
import { ShipmentConfig } from '../glitter-base/global/shipment-config.js';
|
|
14
12
|
import { ApiUser } from '../glitter-base/route/user.js';
|
|
13
|
+
import { ApiShop } from '../glitter-base/route/shopping.js';
|
|
15
14
|
import { PaymentConfig } from '../glitter-base/global/payment-config.js';
|
|
15
|
+
import { ShipmentConfig } from '../glitter-base/global/shipment-config.js';
|
|
16
|
+
import { ShoppingShipmentSetting } from './shopping-shipment-setting.js';
|
|
16
17
|
|
|
17
18
|
type CustomFinance = {
|
|
18
19
|
name: string;
|
|
@@ -21,6 +22,12 @@ type CustomFinance = {
|
|
|
21
22
|
shipmentSupport: string[];
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
type ShipmentGroupData = {
|
|
26
|
+
key: string;
|
|
27
|
+
name: string;
|
|
28
|
+
list: string[];
|
|
29
|
+
};
|
|
30
|
+
|
|
24
31
|
const html = String.raw;
|
|
25
32
|
|
|
26
33
|
export class ShoppingFinanceSetting {
|
|
@@ -601,6 +608,12 @@ export class ShoppingFinanceSetting {
|
|
|
601
608
|
),
|
|
602
609
|
BgWidget.save(
|
|
603
610
|
gvc.event(() => {
|
|
611
|
+
//綠界支付的測試版切換
|
|
612
|
+
if (payData.key == "ecPay" && key_d.ActionURL == "https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5"){
|
|
613
|
+
key_d.MERCHANT_ID = "3002607";
|
|
614
|
+
key_d.HASH_KEY = "pwFHCqoQZGmho4w6";
|
|
615
|
+
key_d.HASH_IV = "EkRm7iFT261dpevs";
|
|
616
|
+
}
|
|
604
617
|
keyData[payData.key] = key_d;
|
|
605
618
|
saveData();
|
|
606
619
|
gvc.closeDialog();
|
|
@@ -1699,6 +1712,7 @@ export class ShoppingFinanceSetting {
|
|
|
1699
1712
|
[
|
|
1700
1713
|
{ title: '基本設定', key: 'delivery_setting' },
|
|
1701
1714
|
{ title: '物流追蹤', key: 'delivery_track' },
|
|
1715
|
+
{ title: '物流群組', key: 'delivery_group' },
|
|
1702
1716
|
{ title: '配送備註', key: 'delivery_note' },
|
|
1703
1717
|
],
|
|
1704
1718
|
gvc,
|
|
@@ -2890,7 +2904,278 @@ export class ShoppingFinanceSetting {
|
|
|
2890
2904
|
};
|
|
2891
2905
|
}),
|
|
2892
2906
|
]);
|
|
2907
|
+
} else if (vm.page === 'delivery_group') {
|
|
2908
|
+
const dvm = {
|
|
2909
|
+
id: gvc.glitter.getUUID(),
|
|
2910
|
+
loading: true,
|
|
2911
|
+
dataList: [] as ShipmentGroupData[],
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
function updateGroup(dialogGVC: GVC) {
|
|
2915
|
+
dialog.dataLoading({ visible: true });
|
|
2916
|
+
setTimeout(() => {
|
|
2917
|
+
ApiUser.setPublicConfig({
|
|
2918
|
+
user_id: 'manager',
|
|
2919
|
+
key: 'logistics_group',
|
|
2920
|
+
value: dvm.dataList,
|
|
2921
|
+
}).then(() => {
|
|
2922
|
+
dialog.dataLoading({ visible: false });
|
|
2923
|
+
dialog.successMessage({ text: '設定成功' });
|
|
2924
|
+
dialogGVC.closeDialog();
|
|
2925
|
+
|
|
2926
|
+
dvm.loading = true;
|
|
2927
|
+
gvc.notifyDataChange(dvm.id);
|
|
2928
|
+
});
|
|
2929
|
+
}, 100);
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
function deleteProductLogisticGroup(group: string | undefined, callback: () => void) {
|
|
2933
|
+
if (group) {
|
|
2934
|
+
ApiShop.deleteProductLogistic({ group }).then(() => callback());
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
function editGroupDialog(item?: ShipmentGroupData) {
|
|
2939
|
+
const cloneData = structuredClone(item);
|
|
2940
|
+
const postData = item
|
|
2941
|
+
? structuredClone(item)
|
|
2942
|
+
: {
|
|
2943
|
+
key: Tool.randomString(8),
|
|
2944
|
+
name: '',
|
|
2945
|
+
list: [],
|
|
2946
|
+
};
|
|
2947
|
+
|
|
2948
|
+
return BgWidget.settingDialog({
|
|
2949
|
+
gvc,
|
|
2950
|
+
title: '設定群組',
|
|
2951
|
+
innerHTML: iGVC => {
|
|
2952
|
+
const id = iGVC.glitter.getUUID();
|
|
2953
|
+
let loading = true;
|
|
2954
|
+
let dataList: any = [];
|
|
2955
|
+
|
|
2956
|
+
return iGVC.bindView({
|
|
2957
|
+
bind: id,
|
|
2958
|
+
view: () => {
|
|
2959
|
+
if (loading) {
|
|
2960
|
+
return BgWidget.spinner();
|
|
2961
|
+
}
|
|
2962
|
+
return [
|
|
2963
|
+
html`<div class="tx_700">群組名稱</div>`,
|
|
2964
|
+
BgWidget.editeInput({
|
|
2965
|
+
gvc: iGVC,
|
|
2966
|
+
title: '',
|
|
2967
|
+
default: postData.name,
|
|
2968
|
+
placeHolder: '請輸入群組名稱',
|
|
2969
|
+
callback: value => {
|
|
2970
|
+
postData.name = value;
|
|
2971
|
+
},
|
|
2972
|
+
}),
|
|
2973
|
+
html`<div class="tx_700">包含的物流</div>`,
|
|
2974
|
+
BgWidget.multiCheckboxContainer(
|
|
2975
|
+
iGVC,
|
|
2976
|
+
dataList,
|
|
2977
|
+
postData.list,
|
|
2978
|
+
text => {
|
|
2979
|
+
postData.list = text;
|
|
2980
|
+
},
|
|
2981
|
+
{ single: false }
|
|
2982
|
+
),
|
|
2983
|
+
].join(BgWidget.mbContainer(12));
|
|
2984
|
+
},
|
|
2985
|
+
onCreate: () => {
|
|
2986
|
+
if (loading) {
|
|
2987
|
+
ApiPageConfig.getPrivateConfig((window.parent as any).appName, 'logistics_setting').then(
|
|
2988
|
+
(dd: any) => {
|
|
2989
|
+
if (dd.result && dd.response.result[0]) {
|
|
2990
|
+
const shipment_setting = dd.response.result[0].value;
|
|
2991
|
+
|
|
2992
|
+
// 合併 ShipmentConfig.list 和 shipment_setting.custom_delivery
|
|
2993
|
+
const combinedList = [
|
|
2994
|
+
...ShipmentConfig.list.map(dd => ({
|
|
2995
|
+
name: dd.title,
|
|
2996
|
+
value: dd.value,
|
|
2997
|
+
})),
|
|
2998
|
+
...(shipment_setting.custom_delivery ?? []).map((dd: any) => ({
|
|
2999
|
+
form: dd.form,
|
|
3000
|
+
name: dd.name,
|
|
3001
|
+
value: dd.id,
|
|
3002
|
+
})),
|
|
3003
|
+
];
|
|
3004
|
+
|
|
3005
|
+
// 過濾出 shipment_setting.support 中支援的項目
|
|
3006
|
+
const supportedList = combinedList.filter(d1 =>
|
|
3007
|
+
shipment_setting.support.some((d2: any) => d2 === d1.value)
|
|
3008
|
+
);
|
|
3009
|
+
|
|
3010
|
+
// 轉換為 dataList 所需的格式
|
|
3011
|
+
dataList = supportedList.map(data => ({
|
|
3012
|
+
key: data.value,
|
|
3013
|
+
name: data.name,
|
|
3014
|
+
}));
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
// 更新狀態並通知資料變更
|
|
3018
|
+
loading = false;
|
|
3019
|
+
iGVC.notifyDataChange(id);
|
|
3020
|
+
}
|
|
3021
|
+
);
|
|
3022
|
+
}
|
|
3023
|
+
},
|
|
3024
|
+
});
|
|
3025
|
+
},
|
|
3026
|
+
footer_html: fGVC => {
|
|
3027
|
+
return [
|
|
3028
|
+
item
|
|
3029
|
+
? BgWidget.danger(
|
|
3030
|
+
fGVC.event(() => {
|
|
3031
|
+
dialog.checkYesOrNot({
|
|
3032
|
+
text: '若刪除此群組,有使用到此群組的商品將會改成全部物流皆可使用,確定要刪除此物流群組?',
|
|
3033
|
+
callback: bool => {
|
|
3034
|
+
if (bool) {
|
|
3035
|
+
dvm.dataList = dvm.dataList.filter(data => data.key !== item?.key);
|
|
3036
|
+
deleteProductLogisticGroup(item?.key, () => updateGroup(fGVC));
|
|
3037
|
+
}
|
|
3038
|
+
},
|
|
3039
|
+
});
|
|
3040
|
+
})
|
|
3041
|
+
)
|
|
3042
|
+
: '',
|
|
3043
|
+
BgWidget.cancel(
|
|
3044
|
+
fGVC.event(() => {
|
|
3045
|
+
if (item) {
|
|
3046
|
+
item = cloneData;
|
|
3047
|
+
}
|
|
3048
|
+
fGVC.closeDialog();
|
|
3049
|
+
})
|
|
3050
|
+
),
|
|
3051
|
+
BgWidget.save(
|
|
3052
|
+
fGVC.event(() => {
|
|
3053
|
+
for (const data of dvm.dataList) {
|
|
3054
|
+
if (data.key !== postData.key) {
|
|
3055
|
+
if (data.name === postData.name) {
|
|
3056
|
+
dialog.infoMessage({ text: `群組名「${postData.name}」已經存在` });
|
|
3057
|
+
return;
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
if (Tool.ObjCompare(postData.list, data.list)) {
|
|
3061
|
+
dialog.infoMessage({ text: '此群組的物流組合已經存在,請調整您點選的物流' });
|
|
3062
|
+
return;
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
if (postData.list.length === 0) {
|
|
3066
|
+
dialog.infoMessage({ text: '請勾選至少一種物流的組合' });
|
|
3067
|
+
return;
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
if (item) {
|
|
3073
|
+
const target = dvm.dataList.find(data => data.key === item?.key);
|
|
3074
|
+
target && Object.assign(target, postData);
|
|
3075
|
+
} else {
|
|
3076
|
+
dvm.dataList.push(postData);
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
updateGroup(fGVC);
|
|
3080
|
+
})
|
|
3081
|
+
),
|
|
3082
|
+
].join('');
|
|
3083
|
+
},
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
|
|
3087
|
+
view = view.concat([
|
|
3088
|
+
html` <div class="px-md-0 px-2">
|
|
3089
|
+
${BgWidget.normalInsignia('可以將多個物流設定成一個群組集中,在商品設定頁可以一次管理物流方式')}
|
|
3090
|
+
</div>`,
|
|
3091
|
+
gvc.bindView(() => {
|
|
3092
|
+
return {
|
|
3093
|
+
bind: dvm.id,
|
|
3094
|
+
view: () => {
|
|
3095
|
+
if (dvm.loading) {
|
|
3096
|
+
return BgWidget.spinner();
|
|
3097
|
+
}
|
|
3098
|
+
return dvm.dataList
|
|
3099
|
+
.map(item => {
|
|
3100
|
+
const dd = {
|
|
3101
|
+
title: item.name,
|
|
3102
|
+
value: item.key,
|
|
3103
|
+
list: item.list,
|
|
3104
|
+
type: 'font_awesome',
|
|
3105
|
+
src: html`<i class="fa-solid fa-object-group fs-4"></i>`,
|
|
3106
|
+
};
|
|
3107
|
+
|
|
3108
|
+
return html`
|
|
3109
|
+
<div class="col-12 col-md-4 p-0 p-md-2">
|
|
3110
|
+
<div
|
|
3111
|
+
class="w-100 position-relative main-card"
|
|
3112
|
+
style="padding: 24px; background: white; overflow: hidden; justify-content: space-between; align-items: center; gap: 18px; display: inline-flex;"
|
|
3113
|
+
>
|
|
3114
|
+
<div
|
|
3115
|
+
style="align-self: stretch; justify-content: flex-start; align-items: center; gap: 28px; display: inline-flex;"
|
|
3116
|
+
>
|
|
3117
|
+
<div>${dd.type === 'font_awesome' ? dd.src : html` <img src="${dd.src}" />`}</div>
|
|
3118
|
+
<div
|
|
3119
|
+
style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; display: inline-flex"
|
|
3120
|
+
>
|
|
3121
|
+
<div class="tx_normal">${dd.title}</div>
|
|
3122
|
+
</div>
|
|
3123
|
+
</div>
|
|
3124
|
+
<div>
|
|
3125
|
+
${BgWidget.customButton({
|
|
3126
|
+
button: { color: 'gray', size: 'sm' },
|
|
3127
|
+
text: { name: '設定群組' },
|
|
3128
|
+
event: gvc.event(() => editGroupDialog(item)),
|
|
3129
|
+
})}
|
|
3130
|
+
</div>
|
|
3131
|
+
</div>
|
|
3132
|
+
</div>
|
|
3133
|
+
${document.body.clientWidth > 768 ? '' : BgWidget.mbContainer(8)}
|
|
3134
|
+
`;
|
|
3135
|
+
})
|
|
3136
|
+
.concat([
|
|
3137
|
+
html` <div
|
|
3138
|
+
class="col-12 col-md-4 p-0 p-md-2"
|
|
3139
|
+
style="cursor: pointer;"
|
|
3140
|
+
onclick="${gvc.event(() => editGroupDialog())}"
|
|
3141
|
+
>
|
|
3142
|
+
<div
|
|
3143
|
+
class="w-100 main-card"
|
|
3144
|
+
style="max-height:73.59px;padding: 24px; background: white; overflow: hidden; flex-direction: column; justify-content: center; align-items: center; gap: 18px; display: inline-flex"
|
|
3145
|
+
>
|
|
3146
|
+
<div
|
|
3147
|
+
class="fw-bold"
|
|
3148
|
+
style="align-self: stretch; justify-content: center; align-items: center; gap: 14px; display: inline-flex;color:#4D86DB;"
|
|
3149
|
+
>
|
|
3150
|
+
<i class="fa-regular fa-circle-plus fs-5"></i>
|
|
3151
|
+
<div class="fs-5">新增物流群組</div>
|
|
3152
|
+
</div>
|
|
3153
|
+
</div>
|
|
3154
|
+
</div>`,
|
|
3155
|
+
])
|
|
3156
|
+
.join('');
|
|
3157
|
+
},
|
|
3158
|
+
divCreate: {
|
|
3159
|
+
class: 'row guide3-3 mt-3 px-1',
|
|
3160
|
+
},
|
|
3161
|
+
onCreate: () => {
|
|
3162
|
+
if (dvm.loading) {
|
|
3163
|
+
ApiUser.getPublicConfig('logistics_group', 'manager').then(r => {
|
|
3164
|
+
if (r.result) {
|
|
3165
|
+
dvm.dataList = r.response.value ?? [];
|
|
3166
|
+
}
|
|
3167
|
+
setTimeout(() => {
|
|
3168
|
+
dvm.loading = false;
|
|
3169
|
+
gvc.notifyDataChange(dvm.id);
|
|
3170
|
+
}, 100);
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
},
|
|
3174
|
+
};
|
|
3175
|
+
}),
|
|
3176
|
+
]);
|
|
2893
3177
|
}
|
|
3178
|
+
|
|
2894
3179
|
// view.push(
|
|
2895
3180
|
// html`<div
|
|
2896
3181
|
// style="width: 100%;padding: 14px 16px;background: #FFF; display: flex;justify-content: end;position: fixed;bottom: 0;right: 0;z-index:1;gap:14px;"
|