ts-glitter 21.8.9 → 21.9.1
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/cms-plugin/filter-options.js +1 -1
- package/lowcode/cms-plugin/filter-options.ts +1 -1
- package/lowcode/cms-plugin/model/order.d.ts +62 -21
- package/lowcode/cms-plugin/module/data.js +7 -0
- package/lowcode/cms-plugin/module/data.ts +7 -189
- package/lowcode/cms-plugin/module/delivery-html.ts +1 -2
- package/lowcode/cms-plugin/module/order-setting.js +90 -60
- package/lowcode/cms-plugin/module/order-setting.ts +110 -77
- package/lowcode/cms-plugin/shopping-order-manager.js +152 -81
- package/lowcode/cms-plugin/shopping-order-manager.ts +165 -85
- package/lowcode/css/editor.css +1 -1
- package/lowcode/glitter-base/route/post.js +5 -0
- package/lowcode/glitter-base/route/post.ts +6 -0
- package/lowcode/public-components/checkout/index.js +38 -33
- package/lowcode/public-components/checkout/index.ts +37 -34
- package/lowcode/public-components/public/ad.ts +0 -1
- package/package.json +1 -1
- package/src/api-public/services/data-analyze.d.ts +1 -1
- package/src/api-public/services/shopping.js +5 -4
- package/src/api-public/services/shopping.js.map +5 -1
- package/src/api-public/services/shopping.ts +5 -4
|
@@ -17,14 +17,13 @@ import { Tool } from '../modules/tool.js';
|
|
|
17
17
|
import { CheckInput } from '../modules/checkInput.js';
|
|
18
18
|
import { CountryTw } from '../modules/country-language/country-tw.js';
|
|
19
19
|
import { OrderExcel } from './module/order-excel.js';
|
|
20
|
-
import { DeliveryHTML } from './module/delivery-html.js';
|
|
20
|
+
import { DeliveryHTML, PrintType } from './module/delivery-html.js';
|
|
21
21
|
import { OrderSetting } from './module/order-setting.js';
|
|
22
22
|
import { PosFunction } from './pos-pages/pos-function.js';
|
|
23
23
|
import { UserList } from './user-list.js';
|
|
24
24
|
import { FilterOptions } from './filter-options.js';
|
|
25
25
|
import { ListHeaderOption } from './list-header-option.js';
|
|
26
26
|
import { ShoppingInvoiceManager } from './shopping-invoice-manager.js';
|
|
27
|
-
import { LineItem } from './module/data.js';
|
|
28
27
|
import { OrderModule } from './order/order-module.js';
|
|
29
28
|
import { TableStorage } from './module/table-storage.js';
|
|
30
29
|
|
|
@@ -379,7 +378,7 @@ export class ShoppingOrderManager {
|
|
|
379
378
|
BgWidget.tableV3({
|
|
380
379
|
gvc: gvc,
|
|
381
380
|
defPage: ShoppingOrderManager.vm.page,
|
|
382
|
-
|
|
381
|
+
|
|
383
382
|
getData: vmi => {
|
|
384
383
|
ShoppingOrderManager.vm.page = vmi.page;
|
|
385
384
|
vm.apiJSON = {
|
|
@@ -672,6 +671,60 @@ export class ShoppingOrderManager {
|
|
|
672
671
|
return OrderSetting.combineOrders(gvc, checkArray, () => gvc.notifyDataChange(vm.id));
|
|
673
672
|
},
|
|
674
673
|
},
|
|
674
|
+
{
|
|
675
|
+
name: '更改付款狀態',
|
|
676
|
+
option: true,
|
|
677
|
+
event: (checkArray: any) => {
|
|
678
|
+
OrderSetting.allEditDialog({
|
|
679
|
+
gvc,
|
|
680
|
+
title: '批量更改付款狀態',
|
|
681
|
+
options: OrderSetting.getPaymentStatusOpt(),
|
|
682
|
+
callback: (value: any) => {
|
|
683
|
+
checkArray.forEach((order: any) => {
|
|
684
|
+
order.status = Number(value);
|
|
685
|
+
});
|
|
686
|
+
updateOrders(checkArray);
|
|
687
|
+
},
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: '更改出貨狀態',
|
|
693
|
+
option: true,
|
|
694
|
+
event: (checkArray: any) => {
|
|
695
|
+
OrderSetting.allEditDialog({
|
|
696
|
+
gvc,
|
|
697
|
+
title: '批量更改出貨狀態',
|
|
698
|
+
options: OrderSetting.getShippmentOpt(),
|
|
699
|
+
callback: (value: any) => {
|
|
700
|
+
checkArray.forEach((order: any) => {
|
|
701
|
+
order.orderData.progress = value;
|
|
702
|
+
if (['wait', 'returns', undefined].includes(value)) {
|
|
703
|
+
order.orderData.user_info.shipment_number = '';
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
updateOrders(checkArray);
|
|
707
|
+
},
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: '更改訂單狀態',
|
|
713
|
+
option: true,
|
|
714
|
+
event: (checkArray: any) => {
|
|
715
|
+
OrderSetting.allEditDialog({
|
|
716
|
+
gvc,
|
|
717
|
+
title: '批量更改訂單狀態',
|
|
718
|
+
options: OrderSetting.getOrderStatusOpt(),
|
|
719
|
+
callback: (value: any) => {
|
|
720
|
+
checkArray.forEach((order: any) => {
|
|
721
|
+
order.orderData.orderStatus = value;
|
|
722
|
+
});
|
|
723
|
+
updateOrders(checkArray);
|
|
724
|
+
},
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
},
|
|
675
728
|
{
|
|
676
729
|
name: '批改訂單各項狀態',
|
|
677
730
|
option: true,
|
|
@@ -985,6 +1038,58 @@ export class ShoppingOrderManager {
|
|
|
985
1038
|
];
|
|
986
1039
|
|
|
987
1040
|
const defaultArray = [
|
|
1041
|
+
{
|
|
1042
|
+
name: '列印出貨明細 / 地址貼條',
|
|
1043
|
+
event: (checkArray: any) => {
|
|
1044
|
+
let type = '';
|
|
1045
|
+
|
|
1046
|
+
BgWidget.settingDialog({
|
|
1047
|
+
gvc: gvc,
|
|
1048
|
+
title: '列印模式',
|
|
1049
|
+
innerHTML: (gvc: GVC) =>
|
|
1050
|
+
BgWidget.select({
|
|
1051
|
+
gvc,
|
|
1052
|
+
callback: (value: any) => {
|
|
1053
|
+
type = value;
|
|
1054
|
+
},
|
|
1055
|
+
default: '',
|
|
1056
|
+
options: [
|
|
1057
|
+
{ title: '選擇列印模式', value: '' },
|
|
1058
|
+
{ title: '出貨明細', value: 'shipment' },
|
|
1059
|
+
{ title: '地址貼條', value: 'address' },
|
|
1060
|
+
{ title: '出貨明細 + 地址貼條', value: 'shipAddr' },
|
|
1061
|
+
].map(item => {
|
|
1062
|
+
return {
|
|
1063
|
+
key: item.value,
|
|
1064
|
+
value: item.title,
|
|
1065
|
+
};
|
|
1066
|
+
}),
|
|
1067
|
+
}),
|
|
1068
|
+
footer_html: (gvc: GVC) => {
|
|
1069
|
+
return [
|
|
1070
|
+
BgWidget.cancel(
|
|
1071
|
+
gvc.event(() => {
|
|
1072
|
+
gvc.closeDialog();
|
|
1073
|
+
}),
|
|
1074
|
+
'取消'
|
|
1075
|
+
),
|
|
1076
|
+
BgWidget.save(
|
|
1077
|
+
gvc.event(() => {
|
|
1078
|
+
if (['shipment', 'address', 'shipAddr'].includes(type)) {
|
|
1079
|
+
gvc.closeDialog();
|
|
1080
|
+
DeliveryHTML.print(gvc, checkArray, type as PrintType);
|
|
1081
|
+
} else {
|
|
1082
|
+
dialog.infoMessage({ text: '請選擇列印模式' });
|
|
1083
|
+
}
|
|
1084
|
+
}),
|
|
1085
|
+
'列印'
|
|
1086
|
+
),
|
|
1087
|
+
].join('');
|
|
1088
|
+
},
|
|
1089
|
+
width: 350,
|
|
1090
|
+
});
|
|
1091
|
+
},
|
|
1092
|
+
},
|
|
988
1093
|
{
|
|
989
1094
|
name: query.isArchived ? '解除封存' : '批量封存',
|
|
990
1095
|
event: (checkArray: any) => {
|
|
@@ -1032,27 +1137,6 @@ export class ShoppingOrderManager {
|
|
|
1032
1137
|
DeliveryHTML.print(gvc, checkArray, 'pick');
|
|
1033
1138
|
},
|
|
1034
1139
|
},
|
|
1035
|
-
{
|
|
1036
|
-
name: '列印出貨明細',
|
|
1037
|
-
option: true,
|
|
1038
|
-
event: (checkArray: any) => {
|
|
1039
|
-
DeliveryHTML.print(gvc, checkArray, 'shipment');
|
|
1040
|
-
},
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
name: '列印地址貼條',
|
|
1044
|
-
option: true,
|
|
1045
|
-
event: (checkArray: any) => {
|
|
1046
|
-
DeliveryHTML.print(gvc, checkArray, 'address');
|
|
1047
|
-
},
|
|
1048
|
-
},
|
|
1049
|
-
{
|
|
1050
|
-
name: '列印出貨明細 + 地址貼條',
|
|
1051
|
-
option: true,
|
|
1052
|
-
event: (checkArray: any) => {
|
|
1053
|
-
DeliveryHTML.print(gvc, checkArray, 'shipAddr');
|
|
1054
|
-
},
|
|
1055
|
-
},
|
|
1056
1140
|
];
|
|
1057
1141
|
|
|
1058
1142
|
return [...defaultArray, ...(query.isShipment ? shipmentArray : normalArray)];
|
|
@@ -1323,7 +1407,6 @@ export class ShoppingOrderManager {
|
|
|
1323
1407
|
|
|
1324
1408
|
return orderData.orderData.progress;
|
|
1325
1409
|
})(),
|
|
1326
|
-
|
|
1327
1410
|
options: OrderSetting.getShippmentOpt(),
|
|
1328
1411
|
callback: (text: any) => {
|
|
1329
1412
|
const emptyStatus = ['wait', 'returns', undefined, ''];
|
|
@@ -2235,7 +2318,7 @@ export class ShoppingOrderManager {
|
|
|
2235
2318
|
const status = dd.discount_total > 0;
|
|
2236
2319
|
const isMinus = status ? '-' : '';
|
|
2237
2320
|
const isNegative = status ? 1 : -1;
|
|
2238
|
-
return `${isMinus} $${(dd.discount_total * isNegative).toLocaleString()}`;
|
|
2321
|
+
return `${isMinus} $${(Math.floor(dd.discount_total) * isNegative).toLocaleString()}`;
|
|
2239
2322
|
})(),
|
|
2240
2323
|
},
|
|
2241
2324
|
};
|
|
@@ -2296,7 +2379,7 @@ export class ShoppingOrderManager {
|
|
|
2296
2379
|
<div>分倉出貨</div>
|
|
2297
2380
|
<div
|
|
2298
2381
|
class="${is_shipment ? 'd-none' : ''}"
|
|
2299
|
-
style="display: flex;padding:
|
|
2382
|
+
style="display: flex;padding: 4px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
|
|
2300
2383
|
onclick="${gvc.event(() => {
|
|
2301
2384
|
OrderSetting.showEditShip({
|
|
2302
2385
|
gvc: gvc,
|
|
@@ -2407,19 +2490,24 @@ export class ShoppingOrderManager {
|
|
|
2407
2490
|
title: '',
|
|
2408
2491
|
gvc: gvc,
|
|
2409
2492
|
default: `${orderData.status}`,
|
|
2410
|
-
options:
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
value
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2493
|
+
options: (() => {
|
|
2494
|
+
const paymentOptions = OrderSetting.getPaymentStatusOpt();
|
|
2495
|
+
const unpayOption = paymentOptions.find(item => item.key === '0');
|
|
2496
|
+
|
|
2497
|
+
if (unpayOption) {
|
|
2498
|
+
if (orderData.orderData.proof_purchase) {
|
|
2499
|
+
unpayOption.value = '待核款';
|
|
2500
|
+
} else if (
|
|
2501
|
+
orderData.orderData.customer_info.payment_select == 'cash_on_delivery'
|
|
2502
|
+
) {
|
|
2503
|
+
unpayOption.value = '貨到付款';
|
|
2504
|
+
} else {
|
|
2505
|
+
unpayOption.value = '未付款';
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
return paymentOptions;
|
|
2510
|
+
})(),
|
|
2423
2511
|
callback: text => {
|
|
2424
2512
|
dialog.checkYesOrNot({
|
|
2425
2513
|
text: '是否確認變更付款狀態?',
|
|
@@ -2639,28 +2727,28 @@ export class ShoppingOrderManager {
|
|
|
2639
2727
|
<div class="w-100 d-flex tx_700 align-items-center justify-content-between">
|
|
2640
2728
|
<div>顧客備註</div>
|
|
2641
2729
|
<div
|
|
2642
|
-
style="display: flex;padding:
|
|
2730
|
+
style="display: flex;padding: 4px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
|
|
2643
2731
|
onclick="${gvc.event(() => {
|
|
2644
2732
|
vm.edit_mode = !vm.edit_mode;
|
|
2645
2733
|
gvc.notifyDataChange(vm.id);
|
|
2646
2734
|
})}"
|
|
2647
2735
|
>
|
|
2648
|
-
${vm.edit_mode ?
|
|
2736
|
+
${vm.edit_mode ? '取消編輯' : '編輯'}
|
|
2649
2737
|
</div>
|
|
2650
2738
|
</div>
|
|
2651
2739
|
${BgWidget.mbContainer(18)}
|
|
2652
|
-
<div style="position: relative;">
|
|
2740
|
+
<div style="position: relative; color: #8d8d8d;">
|
|
2653
2741
|
${vm.edit_mode
|
|
2654
2742
|
? EditorElem.editeText({
|
|
2655
2743
|
gvc: gvc,
|
|
2656
2744
|
title: '',
|
|
2657
2745
|
default: orderData.orderData.user_info.note || '',
|
|
2658
|
-
placeHolder: '',
|
|
2746
|
+
placeHolder: '請輸入備註',
|
|
2659
2747
|
callback: text => {
|
|
2660
2748
|
orderData.orderData.user_info.note = text;
|
|
2661
2749
|
},
|
|
2662
2750
|
})
|
|
2663
|
-
: orderData.orderData.user_info.note || '
|
|
2751
|
+
: orderData.orderData.user_info.note || '顧客尚未填寫備註'}
|
|
2664
2752
|
</div>
|
|
2665
2753
|
`;
|
|
2666
2754
|
},
|
|
@@ -2678,30 +2766,19 @@ export class ShoppingOrderManager {
|
|
|
2678
2766
|
view: () => {
|
|
2679
2767
|
return html`
|
|
2680
2768
|
<div class="w-100 d-flex tx_700 align-items-center justify-content-between">
|
|
2681
|
-
|
|
2682
|
-
<div
|
|
2683
|
-
style="display: flex;padding: 6px 18px;justify-content: center;align-items: center;gap: 8px;border-radius: 10px;border: 1px solid #DDD;background: #FFF;cursor: pointer;"
|
|
2684
|
-
onclick="${gvc.event(() => {
|
|
2685
|
-
vm.edit_mode = !vm.edit_mode;
|
|
2686
|
-
gvc.notifyDataChange(vm.id);
|
|
2687
|
-
})}"
|
|
2688
|
-
>
|
|
2689
|
-
${vm.edit_mode ? `取消編輯` : `編輯`}
|
|
2690
|
-
</div>
|
|
2769
|
+
訂單備註
|
|
2691
2770
|
</div>
|
|
2692
2771
|
${BgWidget.mbContainer(18)}
|
|
2693
2772
|
<div style="position: relative;">
|
|
2694
|
-
${
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
})
|
|
2704
|
-
: orderData.orderData.order_note || '尚未填寫商家備註'}
|
|
2773
|
+
${EditorElem.editeText({
|
|
2774
|
+
gvc: gvc,
|
|
2775
|
+
title: '',
|
|
2776
|
+
default: orderData.orderData.order_note || '',
|
|
2777
|
+
placeHolder: '請輸入備註',
|
|
2778
|
+
callback: text => {
|
|
2779
|
+
orderData.orderData.order_note = text;
|
|
2780
|
+
},
|
|
2781
|
+
})}
|
|
2705
2782
|
</div>
|
|
2706
2783
|
`;
|
|
2707
2784
|
},
|
|
@@ -2925,7 +3002,7 @@ export class ShoppingOrderManager {
|
|
|
2925
3002
|
<div class="tx_700">訂購人資料</div>
|
|
2926
3003
|
<div class="flex-fill"></div>
|
|
2927
3004
|
</div>
|
|
2928
|
-
<div class="w-100 d-flex flex-column mt-2" style="gap:
|
|
3005
|
+
<div class="w-100 d-flex flex-column mt-2" style="gap:6px;">
|
|
2929
3006
|
${[
|
|
2930
3007
|
html` <div class="d-flex flex-column" style="gap:8px;">
|
|
2931
3008
|
<div
|
|
@@ -2987,7 +3064,7 @@ export class ShoppingOrderManager {
|
|
|
2987
3064
|
${userData?.userData?.email ?? orderData.orderData.user_info.email ?? ''}
|
|
2988
3065
|
</div>
|
|
2989
3066
|
</div>`,
|
|
2990
|
-
BgWidget.horizontalLine(),
|
|
3067
|
+
BgWidget.horizontalLine({ margin: 0.5 }),
|
|
2991
3068
|
gvc.bindView({
|
|
2992
3069
|
bind: `user_info`,
|
|
2993
3070
|
view: () => {
|
|
@@ -3031,10 +3108,11 @@ export class ShoppingOrderManager {
|
|
|
3031
3108
|
</div>
|
|
3032
3109
|
`;
|
|
3033
3110
|
})
|
|
3034
|
-
.join(
|
|
3111
|
+
.join('');
|
|
3035
3112
|
},
|
|
3036
3113
|
divCreate: {
|
|
3037
|
-
class:
|
|
3114
|
+
class: 'd-flex flex-column tx_normal',
|
|
3115
|
+
style: 'gap: 8px;',
|
|
3038
3116
|
},
|
|
3039
3117
|
};
|
|
3040
3118
|
}),
|
|
@@ -3063,26 +3141,23 @@ export class ShoppingOrderManager {
|
|
|
3063
3141
|
case 'UNIMARTC2C':
|
|
3064
3142
|
case 'UNIMARTFREEZE':
|
|
3065
3143
|
case 'FAMIC2CFREEZE':
|
|
3066
|
-
return
|
|
3067
|
-
|
|
3068
|
-
<span class="me-2 fw-normal fs-6">門市名稱:</span>
|
|
3144
|
+
return html` <div class="tx_700">配送資訊</div>
|
|
3145
|
+
<div class="d-flex flex-wrap w-100">
|
|
3069
3146
|
<div
|
|
3070
3147
|
class="fw-normal fs-6"
|
|
3071
3148
|
style="white-space: normal;word-break: break-all;"
|
|
3072
3149
|
>
|
|
3073
|
-
${decodeURI(
|
|
3150
|
+
${decodeURI(
|
|
3151
|
+
orderData.orderData.user_info.CVSStoreName
|
|
3152
|
+
)}(${orderData.orderData.user_info.CVSStoreID})
|
|
3074
3153
|
</div>
|
|
3075
|
-
</div
|
|
3076
|
-
|
|
3077
|
-
代號: ${orderData.orderData.user_info.CVSStoreID}
|
|
3078
|
-
</div>`,
|
|
3079
|
-
html` <div
|
|
3154
|
+
</div>
|
|
3155
|
+
<div
|
|
3080
3156
|
class="fw-normal fs-6 w-100"
|
|
3081
3157
|
style="white-space: normal;word-break: break-all;"
|
|
3082
3158
|
>
|
|
3083
|
-
|
|
3084
|
-
</div
|
|
3085
|
-
].join('');
|
|
3159
|
+
${orderData.orderData.user_info.CVSAddress}
|
|
3160
|
+
</div>`;
|
|
3086
3161
|
case 'global_express':
|
|
3087
3162
|
case 'black_cat_freezing':
|
|
3088
3163
|
case 'normal':
|
|
@@ -3090,7 +3165,7 @@ export class ShoppingOrderManager {
|
|
|
3090
3165
|
const mapView = [];
|
|
3091
3166
|
if (orderData.orderData.user_info.address) {
|
|
3092
3167
|
mapView.push(
|
|
3093
|
-
html
|
|
3168
|
+
html`<div class="tx_700">配送資訊</div>
|
|
3094
3169
|
<div class="fw-normal fs-6" style="white-space: normal;">
|
|
3095
3170
|
${[
|
|
3096
3171
|
orderData.orderData.user_info.city,
|
|
@@ -3164,7 +3239,7 @@ export class ShoppingOrderManager {
|
|
|
3164
3239
|
`
|
|
3165
3240
|
: ''}
|
|
3166
3241
|
`);
|
|
3167
|
-
return view.join(
|
|
3242
|
+
return view.join(BgWidget.horizontalLine({ margin: 0.5 }));
|
|
3168
3243
|
},
|
|
3169
3244
|
divCreate: {
|
|
3170
3245
|
class: 'd-flex flex-column',
|
|
@@ -3777,6 +3852,11 @@ export class ShoppingOrderManager {
|
|
|
3777
3852
|
sale_price: variant.sale_price,
|
|
3778
3853
|
sku: variant.sku,
|
|
3779
3854
|
deduction_log: {},
|
|
3855
|
+
rebate: 0,
|
|
3856
|
+
weight: 0,
|
|
3857
|
+
is_gift: false,
|
|
3858
|
+
origin_price: variant.cost || variant.sale_price,
|
|
3859
|
+
discount_price: 0,
|
|
3780
3860
|
});
|
|
3781
3861
|
orderDetail.subtotal +=
|
|
3782
3862
|
Number(orderDetail.lineItems[index].count) * orderDetail.lineItems[index].sale_price;
|
|
@@ -4355,7 +4435,7 @@ export class ShoppingOrderManager {
|
|
|
4355
4435
|
style: 'width: 100%; display: flex; align-items: center; margin: 24px 0;',
|
|
4356
4436
|
},
|
|
4357
4437
|
})}
|
|
4358
|
-
${BgWidget.horizontalLine()} ${showOrderDetail()}
|
|
4438
|
+
${BgWidget.horizontalLine({ margin: 0.5 })} ${showOrderDetail()}
|
|
4359
4439
|
</div>
|
|
4360
4440
|
<!-- 選擇顧客 --- 顧客資料填寫 -->
|
|
4361
4441
|
<div style="margin-top: 24px"></div>
|
package/lowcode/css/editor.css
CHANGED
|
@@ -11,6 +11,11 @@ export class ApiPost {
|
|
|
11
11
|
event_label: json.postData.form_title || 'contact_form',
|
|
12
12
|
value: 1
|
|
13
13
|
});
|
|
14
|
+
Ad.gtagEvent('lead_form_submitted', {
|
|
15
|
+
event_category: 'form',
|
|
16
|
+
event_label: json.postData.form_title || 'contact_form',
|
|
17
|
+
value: 1
|
|
18
|
+
});
|
|
14
19
|
Ad.fbqEvent('Lead', {});
|
|
15
20
|
}
|
|
16
21
|
return BaseApi.create({
|
|
@@ -19,6 +19,12 @@ export class ApiPost {
|
|
|
19
19
|
event_label: json.postData.form_title || 'contact_form', // 可替換為你的表單名稱
|
|
20
20
|
value: 1
|
|
21
21
|
})
|
|
22
|
+
Ad.gtagEvent('lead_form_submitted',{
|
|
23
|
+
event_category: 'form',
|
|
24
|
+
event_label: json.postData.form_title || 'contact_form', // 可替換為你的表單名稱
|
|
25
|
+
value: 1
|
|
26
|
+
})
|
|
27
|
+
|
|
22
28
|
Ad.fbqEvent('Lead',{})
|
|
23
29
|
}
|
|
24
30
|
return BaseApi.create({
|
|
@@ -690,6 +690,37 @@ export class CheckoutIndex {
|
|
|
690
690
|
return html ` ${(() => {
|
|
691
691
|
let tempRebate = 0;
|
|
692
692
|
const dialog = new ShareDialog(gvc.glitter);
|
|
693
|
+
function useRebateButtonEvent() {
|
|
694
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
695
|
+
const sum = yield new Promise((resolve, reject) => {
|
|
696
|
+
ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
if (res.result && res.response.sum) {
|
|
698
|
+
resolve(res.response.sum);
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
resolve(0);
|
|
702
|
+
}
|
|
703
|
+
}));
|
|
704
|
+
});
|
|
705
|
+
const limit = vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
|
|
706
|
+
if (sum === 0) {
|
|
707
|
+
dialog.errorMessage({
|
|
708
|
+
text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
|
|
709
|
+
});
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (tempRebate > Math.min(sum, limit)) {
|
|
713
|
+
dialog.errorMessage({
|
|
714
|
+
text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
|
|
715
|
+
});
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
apiCart.setCart(cartItem => {
|
|
719
|
+
cartItem.use_rebate = tempRebate;
|
|
720
|
+
refreshCartData();
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
}
|
|
693
724
|
return html ` <div class="${gClass(['price-row', 'text-2'])}">
|
|
694
725
|
<div>${vm.rebateConfig.title}${Language.text('discount')}</div>
|
|
695
726
|
<div>- ${Currency.convertCurrencyText(vm.cartData.use_rebate)}</div>
|
|
@@ -714,9 +745,14 @@ export class CheckoutIndex {
|
|
|
714
745
|
? `width:calc(100% - 150px) !important;`
|
|
715
746
|
: ''}"
|
|
716
747
|
value="${vm.cartData.use_rebate || ''}"
|
|
717
|
-
onchange="${gvc.event(
|
|
748
|
+
onchange="${gvc.event(e => {
|
|
718
749
|
if (CheckInput.isNumberString(e.value)) {
|
|
719
750
|
tempRebate = parseInt(e.value, 10);
|
|
751
|
+
useRebateButtonEvent();
|
|
752
|
+
}
|
|
753
|
+
else if (e.value === '') {
|
|
754
|
+
tempRebate = 0;
|
|
755
|
+
useRebateButtonEvent();
|
|
720
756
|
}
|
|
721
757
|
else {
|
|
722
758
|
dialog.errorMessage({ text: Language.text('enter_value') });
|
|
@@ -725,38 +761,7 @@ export class CheckoutIndex {
|
|
|
725
761
|
})}"
|
|
726
762
|
/>
|
|
727
763
|
<div class="${gClass('group-button')}">
|
|
728
|
-
<div
|
|
729
|
-
class="${gClass('button-text')}"
|
|
730
|
-
onclick="${gvc.event(() => __awaiter(this, void 0, void 0, function* () {
|
|
731
|
-
const sum = yield new Promise((resolve, reject) => {
|
|
732
|
-
ApiShop.getRebate({}).then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
733
|
-
if (res.result && res.response.sum) {
|
|
734
|
-
resolve(res.response.sum);
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
resolve(0);
|
|
738
|
-
}
|
|
739
|
-
}));
|
|
740
|
-
});
|
|
741
|
-
const limit = vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
|
|
742
|
-
if (sum === 0) {
|
|
743
|
-
dialog.errorMessage({
|
|
744
|
-
text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
|
|
745
|
-
});
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
if (tempRebate > Math.min(sum, limit)) {
|
|
749
|
-
dialog.errorMessage({
|
|
750
|
-
text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
|
|
751
|
-
});
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
apiCart.setCart(cartItem => {
|
|
755
|
-
cartItem.use_rebate = tempRebate;
|
|
756
|
-
refreshCartData();
|
|
757
|
-
});
|
|
758
|
-
}))}"
|
|
759
|
-
>
|
|
764
|
+
<div class="${gClass('button-text')}" onclick="${gvc.event(useRebateButtonEvent)}">
|
|
760
765
|
${Language.text('apply')}
|
|
761
766
|
</div>
|
|
762
767
|
</div>
|
|
@@ -784,6 +784,37 @@ export class CheckoutIndex {
|
|
|
784
784
|
return html` ${(() => {
|
|
785
785
|
let tempRebate: number = 0;
|
|
786
786
|
const dialog = new ShareDialog(gvc.glitter);
|
|
787
|
+
|
|
788
|
+
async function useRebateButtonEvent() {
|
|
789
|
+
const sum: number = await new Promise((resolve, reject) => {
|
|
790
|
+
ApiShop.getRebate({}).then(async res => {
|
|
791
|
+
if (res.result && res.response.sum) {
|
|
792
|
+
resolve(res.response.sum);
|
|
793
|
+
} else {
|
|
794
|
+
resolve(0);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
const limit = vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
|
|
799
|
+
if (sum === 0) {
|
|
800
|
+
dialog.errorMessage({
|
|
801
|
+
text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
|
|
802
|
+
});
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (tempRebate > Math.min(sum, limit)) {
|
|
806
|
+
dialog.errorMessage({
|
|
807
|
+
text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
|
|
808
|
+
});
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
apiCart.setCart(cartItem => {
|
|
813
|
+
cartItem.use_rebate = tempRebate;
|
|
814
|
+
refreshCartData();
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
|
|
787
818
|
return html` <div class="${gClass(['price-row', 'text-2'])}">
|
|
788
819
|
<div>${vm.rebateConfig.title}${Language.text('discount')}</div>
|
|
789
820
|
<div>- ${Currency.convertCurrencyText(vm.cartData.use_rebate)}</div>
|
|
@@ -808,9 +839,13 @@ export class CheckoutIndex {
|
|
|
808
839
|
? `width:calc(100% - 150px) !important;`
|
|
809
840
|
: ''}"
|
|
810
841
|
value="${vm.cartData.use_rebate || ''}"
|
|
811
|
-
onchange="${gvc.event(
|
|
842
|
+
onchange="${gvc.event(e => {
|
|
812
843
|
if (CheckInput.isNumberString(e.value)) {
|
|
813
844
|
tempRebate = parseInt(e.value, 10);
|
|
845
|
+
useRebateButtonEvent();
|
|
846
|
+
} else if (e.value === '') {
|
|
847
|
+
tempRebate = 0;
|
|
848
|
+
useRebateButtonEvent();
|
|
814
849
|
} else {
|
|
815
850
|
dialog.errorMessage({ text: Language.text('enter_value') });
|
|
816
851
|
gvc.notifyDataChange(ids.page);
|
|
@@ -818,39 +853,7 @@ export class CheckoutIndex {
|
|
|
818
853
|
})}"
|
|
819
854
|
/>
|
|
820
855
|
<div class="${gClass('group-button')}">
|
|
821
|
-
<div
|
|
822
|
-
class="${gClass('button-text')}"
|
|
823
|
-
onclick="${gvc.event(async () => {
|
|
824
|
-
const sum: number = await new Promise((resolve, reject) => {
|
|
825
|
-
ApiShop.getRebate({}).then(async res => {
|
|
826
|
-
if (res.result && res.response.sum) {
|
|
827
|
-
resolve(res.response.sum);
|
|
828
|
-
} else {
|
|
829
|
-
resolve(0);
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
});
|
|
833
|
-
const limit =
|
|
834
|
-
vm.cartData.total - vm.cartData.shipment_fee + vm.cartData.use_rebate;
|
|
835
|
-
if (sum === 0) {
|
|
836
|
-
dialog.errorMessage({
|
|
837
|
-
text: `您的 ${vm.rebateConfig.title} 為 0 點,無法折抵`,
|
|
838
|
-
});
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
if (tempRebate > Math.min(sum, limit)) {
|
|
842
|
-
dialog.errorMessage({
|
|
843
|
-
text: `${Language.text('please_enter')} 0 到 ${Math.min(sum, limit)} 的數值`,
|
|
844
|
-
});
|
|
845
|
-
return;
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
apiCart.setCart(cartItem => {
|
|
849
|
-
cartItem.use_rebate = tempRebate;
|
|
850
|
-
refreshCartData();
|
|
851
|
-
});
|
|
852
|
-
})}"
|
|
853
|
-
>
|
|
856
|
+
<div class="${gClass('button-text')}" onclick="${gvc.event(useRebateButtonEvent)}">
|
|
854
857
|
${Language.text('apply')}
|
|
855
858
|
</div>
|
|
856
859
|
</div>
|