ts-glitter 20.6.7 → 20.6.9
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 +2 -2
- package/lowcode/Entry.ts +2 -2
- package/lowcode/backend-manager/bg-blog.js +617 -621
- package/lowcode/backend-manager/bg-blog.ts +2323 -2325
- package/lowcode/backend-manager/bg-line.js +5 -4
- package/lowcode/backend-manager/bg-line.ts +5 -4
- package/lowcode/backend-manager/bg-list-component.js +9 -0
- package/lowcode/backend-manager/bg-list-component.ts +15 -1
- package/lowcode/backend-manager/bg-notify.js +6 -4
- package/lowcode/backend-manager/bg-notify.ts +6 -4
- package/lowcode/backend-manager/bg-product.js +145 -0
- package/lowcode/backend-manager/bg-product.ts +153 -0
- package/lowcode/backend-manager/bg-sns.js +5 -3
- package/lowcode/backend-manager/bg-sns.ts +5 -3
- package/lowcode/backend-manager/bg-widget.js +92 -4
- package/lowcode/backend-manager/bg-widget.ts +122 -6
- package/lowcode/backend-manager/splitPage.js +0 -39
- package/lowcode/backend-manager/splitPage.ts +0 -40
- package/lowcode/cms-plugin/auto-fcm-advertise.js +17 -5
- package/lowcode/cms-plugin/auto-fcm-advertise.ts +19 -6
- package/lowcode/cms-plugin/auto-fcm-history.js +2732 -0
- package/lowcode/cms-plugin/auto-fcm-history.ts +2995 -0
- package/lowcode/cms-plugin/cms-router.js +5 -0
- package/lowcode/cms-plugin/cms-router.ts +6 -0
- package/lowcode/cms-plugin/filter-options.js +80 -27
- package/lowcode/cms-plugin/filter-options.ts +83 -27
- package/lowcode/cms-plugin/language-backend.js +50 -39
- package/lowcode/cms-plugin/language-backend.ts +109 -95
- package/lowcode/cms-plugin/menus-setting.js +175 -151
- package/lowcode/cms-plugin/menus-setting.ts +620 -591
- package/lowcode/cms-plugin/model/order.d.ts +1 -0
- package/lowcode/cms-plugin/module/data.js +7 -7
- package/lowcode/cms-plugin/module/data.ts +262 -233
- package/lowcode/cms-plugin/module/delivery-html.js +18 -10
- package/lowcode/cms-plugin/module/delivery-html.ts +26 -10
- package/lowcode/cms-plugin/module/order-setting.js +458 -328
- package/lowcode/cms-plugin/module/order-setting.ts +622 -351
- package/lowcode/cms-plugin/module/product-excel.js +1 -1
- package/lowcode/cms-plugin/module/product-excel.ts +2 -1
- package/lowcode/cms-plugin/order/order-module.js +90 -1
- package/lowcode/cms-plugin/order/order-module.ts +106 -1
- package/lowcode/cms-plugin/pos-pages/payment-page.js +11 -8
- package/lowcode/cms-plugin/pos-pages/payment-page.ts +28 -15
- package/lowcode/cms-plugin/pos-pages/products-page.js +0 -39
- package/lowcode/cms-plugin/pos-pages/products-page.ts +0 -40
- package/lowcode/cms-plugin/shopping-collections.ts +1 -3
- package/lowcode/cms-plugin/shopping-finance-setting.js +19 -80
- package/lowcode/cms-plugin/shopping-finance-setting.ts +19 -87
- package/lowcode/cms-plugin/shopping-order-manager.js +122 -38
- package/lowcode/cms-plugin/shopping-order-manager.ts +160 -58
- package/lowcode/cms-plugin/shopping-product-setting.js +364 -376
- package/lowcode/cms-plugin/shopping-product-setting.ts +406 -415
- package/lowcode/cms-plugin/shopping-setting-advance.js +57 -16
- package/lowcode/cms-plugin/shopping-setting-advance.ts +69 -18
- package/lowcode/cms-plugin/user/user-module.js +2 -43
- package/lowcode/cms-plugin/user/user-module.ts +2 -46
- package/lowcode/cms-plugin/user-list.js +4 -6
- package/lowcode/cms-plugin/user-list.ts +35 -38
- package/lowcode/css/editor.css +42 -3
- package/lowcode/glitter-base/global/language.js +6 -1
- package/lowcode/glitter-base/global/language.ts +10 -4
- package/lowcode/glitter-base/global/payment-config.js +19 -16
- package/lowcode/glitter-base/global/payment-config.ts +22 -16
- package/lowcode/glitter-base/global/shipment-config.js +6 -5
- package/lowcode/glitter-base/global/shipment-config.ts +12 -10
- package/lowcode/glitter-base/route/fcm.js +21 -1
- package/lowcode/glitter-base/route/fcm.ts +22 -2
- package/lowcode/glitter-base/route/shopping.js +8 -32
- package/lowcode/glitter-base/route/shopping.ts +10 -33
- package/lowcode/glitter-base/route/user.js +11 -2
- package/lowcode/glitter-base/route/user.ts +23 -12
- package/lowcode/jspage/function-page/setting_editor.js +9 -0
- package/lowcode/jspage/function-page/setting_editor.ts +9 -0
- package/lowcode/public-components/blogs/list.js +223 -195
- package/lowcode/public-components/blogs/list.ts +383 -352
- package/lowcode/public-components/product/product-list.js +8 -4
- package/lowcode/public-components/product/product-list.ts +9 -4
- package/lowcode/public-components/terms-related/index.js +1 -1
- package/lowcode/public-components/terms-related/index.ts +1 -1
- package/lowcode/public-components/user-manager/um-login.js +1 -1
- package/lowcode/public-components/user-manager/um-login.ts +2 -2
- package/lowcode/public-components/user-manager/um-order.js +41 -5
- package/lowcode/public-components/user-manager/um-order.ts +58 -20
- package/lowcode/public-components/user-manager/um-voucher.ts +2 -2
- package/nhi4veq3gk.json +1 -0
- package/package.json +1 -1
- package/src/Language.d.ts +2 -0
- package/src/Language.js +66 -65
- package/src/Language.js.map +1 -1
- package/src/Language.ts +719 -715
- package/src/api-public/config/shipment-config.js +3 -2
- package/src/api-public/config/shipment-config.js.map +1 -1
- package/src/api-public/config/shipment-config.ts +3 -2
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/ai-chat.ts +1 -2
- package/src/api-public/controllers/fcm.js +23 -58
- package/src/api-public/controllers/fcm.js.map +1 -1
- package/src/api-public/controllers/fcm.ts +28 -56
- package/src/api-public/controllers/shop.js +7 -1
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +17 -10
- package/src/api-public/controllers/user.js +1 -0
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +2 -0
- package/src/api-public/services/auto-send-email.js +247 -187
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/auto-send-email.ts +568 -505
- package/src/api-public/services/delivery.js +1 -1
- package/src/api-public/services/delivery.js.map +1 -1
- package/src/api-public/services/delivery.ts +6 -5
- package/src/api-public/services/financial-service.js +1 -2
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +4 -6
- package/src/api-public/services/manager.d.ts +4 -3
- package/src/api-public/services/manager.js +8 -12
- package/src/api-public/services/manager.js.map +1 -1
- package/src/api-public/services/manager.ts +57 -59
- package/src/api-public/services/model/handlePaymentTransaction.d.ts +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.js +23 -3
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +25 -36
- package/src/api-public/services/schedule.d.ts +1 -0
- package/src/api-public/services/schedule.js +27 -0
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +30 -0
- package/src/api-public/services/shopping.d.ts +22 -2
- package/src/api-public/services/shopping.js +362 -90
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +481 -134
- package/src/api-public/services/user.d.ts +1 -0
- package/src/api-public/services/user.js +36 -16
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +42 -23
- package/src/api-public/services/workers.js +3 -3
- package/src/api-public/services/workers.js.map +1 -1
- package/src/api-public/services/workers.ts +103 -103
- package/src/app-project/serverless/src/modules/database.js +1 -1
- package/src/app-project/serverless/src/modules/database.js.map +1 -1
- package/src/app-project/serverless/src/modules/database.ts +171 -171
- package/src/controllers/template.d.ts +1 -1
- package/src/controllers/template.js +16 -16
- package/src/controllers/template.js.map +1 -1
- package/src/controllers/template.ts +98 -84
- package/src/modules/database.js +3 -1
- package/src/modules/database.js.map +1 -1
- package/src/modules/database.ts +185 -181
- package/src/modules/firebase.d.ts +17 -0
- package/src/modules/firebase.js +126 -0
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/firebase.ts +169 -0
- package/src/public-config-initial/auto-fcm.js +8 -2
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/public-config-initial/auto-fcm.ts +15 -6
- package/src/services/app.d.ts +2 -1
- package/src/services/app.js.map +1 -1
- package/src/services/app.ts +2 -1
- package/src/services/template.d.ts +3 -2
- package/src/services/template.js +2 -1
- package/src/services/template.js.map +1 -1
- package/src/services/template.ts +13 -20
|
@@ -5,55 +5,40 @@ import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
|
5
5
|
import { Tool } from '../../modules/tool.js';
|
|
6
6
|
import { OrderDetail } from './data.js';
|
|
7
7
|
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
8
|
+
import { ShipmentConfig } from '../../glitter-base/global/shipment-config.js';
|
|
9
|
+
import { PaymentConfig } from '../../glitter-base/global/payment-config.js';
|
|
8
10
|
const html = String.raw;
|
|
9
11
|
export class OrderSetting {
|
|
10
|
-
static getPaymentMethodText(orderData) {
|
|
12
|
+
static getPaymentMethodText(orderData, paymentMethod) {
|
|
11
13
|
const paymentMethods = {
|
|
12
14
|
POS: '門市POS付款',
|
|
13
15
|
off_line: '線下付款',
|
|
14
|
-
newWebPay: '藍新金流',
|
|
15
|
-
ecPay: '綠界金流',
|
|
16
|
-
line_pay: 'Line Pay',
|
|
17
|
-
atm: '銀行轉帳',
|
|
18
|
-
line: 'Line 轉帳',
|
|
19
|
-
cash_on_delivery: '貨到付款',
|
|
20
16
|
};
|
|
17
|
+
paymentMethod.map((item) => {
|
|
18
|
+
paymentMethods[item.key] = item.name;
|
|
19
|
+
});
|
|
21
20
|
return orderData.orderSource === 'POS'
|
|
22
21
|
? paymentMethods['POS']
|
|
23
22
|
: paymentMethods[orderData.customer_info.payment_select] || '線下付款';
|
|
24
23
|
}
|
|
25
24
|
static getShippingMethodText(orderData) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return '7-11店到店';
|
|
29
|
-
case 'FAMIC2C':
|
|
30
|
-
return '全家店到店';
|
|
31
|
-
case 'OKMARTC2C':
|
|
32
|
-
return 'OK店到店';
|
|
33
|
-
case 'HILIFEC2C':
|
|
34
|
-
return '萊爾富店到店';
|
|
35
|
-
case 'normal':
|
|
36
|
-
return '中華郵政';
|
|
37
|
-
case 'black_cat':
|
|
38
|
-
return '黑貓到府';
|
|
39
|
-
case 'shop':
|
|
40
|
-
return '實體門市取貨';
|
|
41
|
-
case 'global_express':
|
|
42
|
-
return '國際快遞';
|
|
43
|
-
case 'now':
|
|
44
|
-
return '立即取貨';
|
|
45
|
-
default:
|
|
46
|
-
return '宅配';
|
|
25
|
+
if (!orderData.user_info.shipment) {
|
|
26
|
+
return '立即取貨';
|
|
47
27
|
}
|
|
28
|
+
const shippingData = ShipmentConfig.list.find(item => item.value === orderData.user_info.shipment);
|
|
29
|
+
return shippingData ? shippingData.title : '立即取貨';
|
|
48
30
|
}
|
|
49
31
|
static getShippingAddress(orderData) {
|
|
50
32
|
const shipment = orderData.user_info.shipment;
|
|
51
|
-
if (['UNIMARTC2C', 'FAMIC2C', 'OKMARTC2C', 'HILIFEC2C'].includes(shipment)) {
|
|
33
|
+
if (['UNIMARTC2C', 'UNIMARTFREEZE', 'FAMIC2C', 'FAMIC2CFREEZE', 'OKMARTC2C', 'HILIFEC2C'].includes(shipment)) {
|
|
52
34
|
return `${orderData.user_info.CVSStoreName} (${orderData.user_info.CVSAddress})`;
|
|
53
35
|
}
|
|
54
36
|
if (shipment === 'shop') {
|
|
55
37
|
return '實體門市';
|
|
56
38
|
}
|
|
39
|
+
if (shipment === 'now') {
|
|
40
|
+
return '立即取貨';
|
|
41
|
+
}
|
|
57
42
|
return orderData.user_info.address;
|
|
58
43
|
}
|
|
59
44
|
static getPaymentStatusOpt() {
|
|
@@ -72,6 +57,7 @@ export class OrderSetting {
|
|
|
72
57
|
static getShippmentOpt() {
|
|
73
58
|
return [
|
|
74
59
|
{ title: '未出貨', value: 'wait' },
|
|
60
|
+
{ title: '待預購', value: 'pre_order' },
|
|
75
61
|
{ title: '備貨中', value: 'in_stock' },
|
|
76
62
|
{ title: '已出貨', value: 'shipping' },
|
|
77
63
|
{ title: '已到貨', value: 'arrived' },
|
|
@@ -678,6 +664,11 @@ export class OrderSetting {
|
|
|
678
664
|
{ width: 10, align: 'center' },
|
|
679
665
|
{ width: 30, align: 'center' },
|
|
680
666
|
];
|
|
667
|
+
const ovm = {
|
|
668
|
+
list_id: gvc.glitter.getUUID(),
|
|
669
|
+
list_loading: true,
|
|
670
|
+
payment_method: [],
|
|
671
|
+
};
|
|
681
672
|
return html `
|
|
682
673
|
<div class="${gClass('check-info-box')}">
|
|
683
674
|
${BgWidget.grayNote('請與顧客確認合併訂單的付款、配送方式及地址<br />應與下列哪筆訂單相同,避免爭議')}
|
|
@@ -700,59 +691,79 @@ export class OrderSetting {
|
|
|
700
691
|
})
|
|
701
692
|
.join('')}
|
|
702
693
|
</div>
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
{
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
{
|
|
738
|
-
{
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
.
|
|
755
|
-
|
|
694
|
+
${gvc.bindView({
|
|
695
|
+
bind: ovm.list_id,
|
|
696
|
+
view: () => {
|
|
697
|
+
if (ovm.list_loading) {
|
|
698
|
+
return '';
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
return orders
|
|
702
|
+
.map(order => {
|
|
703
|
+
const orderData = order.orderData;
|
|
704
|
+
const vt = this.getAllStatusBadge(order);
|
|
705
|
+
const row = [
|
|
706
|
+
{
|
|
707
|
+
title: html `
|
|
708
|
+
<div class="d-flex gap-2">
|
|
709
|
+
${gvc.bindView({
|
|
710
|
+
bind: `r-${order.cart_token}`,
|
|
711
|
+
view: () => {
|
|
712
|
+
return html `<input
|
|
713
|
+
class="form-check-input ${dialogVM.dotClass} cursor_pointer"
|
|
714
|
+
style="margin-top: 0.25rem;"
|
|
715
|
+
type="radio"
|
|
716
|
+
id="r-${order.cart_token}"
|
|
717
|
+
name="check-info-radios"
|
|
718
|
+
onchange="${gvc.event(() => {
|
|
719
|
+
dialogVM.selectOrderID = order.cart_token;
|
|
720
|
+
gvc.notifyDataChange(orders.map(d => `r-${d.cart_token}`));
|
|
721
|
+
})}"
|
|
722
|
+
${dialogVM.selectOrderID === order.cart_token ? 'checked' : ''}
|
|
723
|
+
/>`;
|
|
724
|
+
},
|
|
725
|
+
})}
|
|
726
|
+
<span style="color: #4d86db;">${order.cart_token}</span>
|
|
727
|
+
<div class="d-flex justify-content-end gap-2">
|
|
728
|
+
${vt.archivedBadge()}
|
|
729
|
+
${vt.paymentBadge()}${vt.outShipBadge()}${vt.orderStatusBadge()}
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
`,
|
|
733
|
+
},
|
|
734
|
+
{ title: order.created_time.split('T')[0] },
|
|
735
|
+
{ title: this.getPaymentMethodText(orderData, ovm.payment_method) },
|
|
736
|
+
{ title: this.getShippingMethodText(orderData) },
|
|
737
|
+
{ title: this.getShippingAddress(orderData) },
|
|
738
|
+
]
|
|
739
|
+
.map((item, i) => {
|
|
740
|
+
var _a;
|
|
741
|
+
return html ` <div
|
|
742
|
+
class="tx_normal"
|
|
743
|
+
style="width: ${styles[i].width}%; text-align: ${styles[i].align};"
|
|
744
|
+
>
|
|
745
|
+
<span style="white-space: break-spaces;">${((_a = item.title) !== null && _a !== void 0 ? _a : '').trim()}</span>
|
|
746
|
+
</div>`;
|
|
747
|
+
})
|
|
748
|
+
.join('');
|
|
749
|
+
return html ` <div class="${gClass('order-row')}">${row}</div>`;
|
|
750
|
+
})
|
|
751
|
+
.join('');
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
divCreate: {
|
|
755
|
+
class: 'd-flex flex-column gap-0 mt-3',
|
|
756
|
+
},
|
|
757
|
+
onCreate: () => {
|
|
758
|
+
if (ovm.list_loading) {
|
|
759
|
+
PaymentConfig.getSupportPayment(true).then(response => {
|
|
760
|
+
ovm.payment_method = response;
|
|
761
|
+
ovm.list_loading = false;
|
|
762
|
+
gvc.notifyDataChange(ovm.list_id);
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
})}
|
|
756
767
|
</div>
|
|
757
768
|
</div>
|
|
758
769
|
`;
|
|
@@ -841,6 +852,11 @@ export class OrderSetting {
|
|
|
841
852
|
{ width: 10, align: 'center' },
|
|
842
853
|
{ width: 5, align: 'center' },
|
|
843
854
|
];
|
|
855
|
+
const ovm = {
|
|
856
|
+
list_id: gvc.glitter.getUUID(),
|
|
857
|
+
list_loading: true,
|
|
858
|
+
payment_method: [],
|
|
859
|
+
};
|
|
844
860
|
return html ` <div class="${gClass('box')} mt-2" style="${isDesktop ? '' : 'width: 1200px'}">
|
|
845
861
|
<div class="d-flex">
|
|
846
862
|
${[
|
|
@@ -860,59 +876,79 @@ export class OrderSetting {
|
|
|
860
876
|
})
|
|
861
877
|
.join('')}
|
|
862
878
|
</div>
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
{
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
879
|
+
${gvc.bindView({
|
|
880
|
+
bind: ovm.list_id,
|
|
881
|
+
view: () => {
|
|
882
|
+
if (ovm.list_loading) {
|
|
883
|
+
return '';
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
return orders
|
|
887
|
+
.map((order, index) => {
|
|
888
|
+
const orderData = order.orderData;
|
|
889
|
+
const vt = this.getAllStatusBadge(order);
|
|
890
|
+
const row = [
|
|
891
|
+
{
|
|
892
|
+
title: html `
|
|
893
|
+
<div class="d-flex gap-3">
|
|
894
|
+
<span style="color: #4d86db;">${order.cart_token}</span>
|
|
895
|
+
<div class="d-flex justify-content-end gap-2">
|
|
896
|
+
${vt.archivedBadge()} ${vt.paymentBadge()}${vt.outShipBadge()}${vt.orderStatusBadge()}
|
|
897
|
+
</div>
|
|
898
|
+
</div>
|
|
899
|
+
`,
|
|
900
|
+
},
|
|
901
|
+
{ title: order.created_time.split('T')[0] },
|
|
902
|
+
{ title: this.getPaymentMethodText(orderData, ovm.payment_method) },
|
|
903
|
+
{ title: this.getShippingMethodText(orderData) },
|
|
904
|
+
{ title: this.getShippingAddress(orderData) },
|
|
905
|
+
{ title: `$ ${orderData.total.toLocaleString()}` },
|
|
906
|
+
{ title: `${orderData.lineItems.length}件商品` },
|
|
907
|
+
{
|
|
908
|
+
title: orders.length > 1
|
|
909
|
+
? html `<i
|
|
910
|
+
class="fa-solid fa-xmark"
|
|
911
|
+
style="color: #B0B0B0; cursor: pointer"
|
|
912
|
+
onclick="${gvc.event(() => {
|
|
913
|
+
if (order.cart_token === data.targetID) {
|
|
914
|
+
data.targetID = '';
|
|
915
|
+
}
|
|
916
|
+
data.orders.splice(index, 1);
|
|
917
|
+
vm.dataObject = setDataStatus(dataMap);
|
|
918
|
+
gvc.notifyDataChange([editID, ids.header, ids.dashboard]);
|
|
919
|
+
})}"
|
|
920
|
+
></i>`
|
|
921
|
+
: '',
|
|
922
|
+
},
|
|
923
|
+
]
|
|
924
|
+
.map((item, i) => {
|
|
925
|
+
var _a;
|
|
926
|
+
return html ` <div
|
|
927
|
+
class="tx_normal"
|
|
928
|
+
style="width: ${styles[i].width}%; text-align: ${styles[i].align};"
|
|
929
|
+
>
|
|
930
|
+
<span style="white-space: break-spaces;">${((_a = item.title) !== null && _a !== void 0 ? _a : '').trim()}</span>
|
|
931
|
+
</div>`;
|
|
932
|
+
})
|
|
933
|
+
.join('');
|
|
934
|
+
return html ` <div class="${gClass('order-row')}">${row}</div>`;
|
|
935
|
+
})
|
|
936
|
+
.join('');
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
divCreate: {
|
|
940
|
+
class: 'd-flex flex-column gap-0 mt-3',
|
|
941
|
+
},
|
|
942
|
+
onCreate: () => {
|
|
943
|
+
if (ovm.list_loading) {
|
|
944
|
+
PaymentConfig.getSupportPayment(true).then(response => {
|
|
945
|
+
ovm.payment_method = response;
|
|
946
|
+
ovm.list_loading = false;
|
|
947
|
+
gvc.notifyDataChange(ovm.list_id);
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
})}
|
|
916
952
|
</div>`;
|
|
917
953
|
};
|
|
918
954
|
const isExpanded = ids.show === editID;
|
|
@@ -994,7 +1030,14 @@ export class OrderSetting {
|
|
|
994
1030
|
const { user_info } = orderData;
|
|
995
1031
|
const isPayStatusSame = status === baseStatus;
|
|
996
1032
|
const isShipmentSame = user_info.shipment === baseShipment;
|
|
997
|
-
const isAddressSame = [
|
|
1033
|
+
const isAddressSame = [
|
|
1034
|
+
'UNIMARTC2C',
|
|
1035
|
+
'UNIMARTFREEZE',
|
|
1036
|
+
'FAMIC2C',
|
|
1037
|
+
'FAMIC2CFREEZE',
|
|
1038
|
+
'OKMARTC2C',
|
|
1039
|
+
'HILIFEC2C',
|
|
1040
|
+
].includes(baseShipment)
|
|
998
1041
|
? user_info.CVSStoreName === baseCVSStoreName
|
|
999
1042
|
: user_info.address === baseAddress;
|
|
1000
1043
|
return isPayStatusSame && isShipmentSame && isAddressSame;
|
|
@@ -1154,7 +1197,7 @@ export class OrderSetting {
|
|
|
1154
1197
|
},
|
|
1155
1198
|
{
|
|
1156
1199
|
key: '出貨單號碼',
|
|
1157
|
-
value: html
|
|
1200
|
+
value: html ` <div style="width: 200px;">
|
|
1158
1201
|
${BgWidget.grayNote(dd.orderData.user_info.shipment_number
|
|
1159
1202
|
? `#${dd.orderData.user_info.shipment_number}`
|
|
1160
1203
|
: dd.orderData.orderSource === 'POS'
|
|
@@ -1256,7 +1299,7 @@ export class OrderSetting {
|
|
|
1256
1299
|
})
|
|
1257
1300
|
: '',
|
|
1258
1301
|
].filter(Boolean);
|
|
1259
|
-
return html
|
|
1302
|
+
return html ` <div class="d-flex align-items-center gap-2">${htmlArray.join('')}</div>`;
|
|
1260
1303
|
},
|
|
1261
1304
|
divCreate: {
|
|
1262
1305
|
style: 'min-width: 580px;',
|
|
@@ -1330,6 +1373,9 @@ export class OrderSetting {
|
|
|
1330
1373
|
callback: (value) => {
|
|
1331
1374
|
checkArray.forEach((order) => {
|
|
1332
1375
|
order.orderData.progress = value;
|
|
1376
|
+
if (['wait', 'returns', undefined].includes(value)) {
|
|
1377
|
+
order.orderData.user_info.shipment_number = '';
|
|
1378
|
+
}
|
|
1333
1379
|
});
|
|
1334
1380
|
},
|
|
1335
1381
|
});
|
|
@@ -1431,11 +1477,12 @@ export class OrderSetting {
|
|
|
1431
1477
|
});
|
|
1432
1478
|
}, 'batchEditOrders');
|
|
1433
1479
|
}
|
|
1434
|
-
static splitOrder(topGVC,
|
|
1480
|
+
static splitOrder(topGVC, origOrderData, callback) {
|
|
1435
1481
|
var _a, _b;
|
|
1482
|
+
const orderData = structuredClone(origOrderData);
|
|
1436
1483
|
function assignOrder(orderCreateUnit) {
|
|
1437
1484
|
orderCreateUnit.cart_token = orderData.orderID;
|
|
1438
|
-
orderCreateUnit.customer_info = orderData.
|
|
1485
|
+
orderCreateUnit.customer_info = orderData.customer_info;
|
|
1439
1486
|
orderCreateUnit.user_info = orderData.user_info;
|
|
1440
1487
|
orderCreateUnit.voucher = orderData.voucherList;
|
|
1441
1488
|
orderCreateUnit.lineItems = structuredClone(orderData.lineItems);
|
|
@@ -1444,6 +1491,7 @@ export class OrderSetting {
|
|
|
1444
1491
|
});
|
|
1445
1492
|
}
|
|
1446
1493
|
orderData.orderSource = 'split';
|
|
1494
|
+
let storeList = [];
|
|
1447
1495
|
const dataArray = orderData.lineItems;
|
|
1448
1496
|
const parentPageConfig = (_b = (_a = window.parent) === null || _a === void 0 ? void 0 : _a.glitter) === null || _b === void 0 ? void 0 : _b.pageConfig;
|
|
1449
1497
|
const latestPageConfig = parentPageConfig === null || parentPageConfig === void 0 ? void 0 : parentPageConfig[parentPageConfig.length - 1];
|
|
@@ -1456,9 +1504,8 @@ export class OrderSetting {
|
|
|
1456
1504
|
const passData = structuredClone(orderCreateUnit);
|
|
1457
1505
|
const isDesktop = document.body.clientWidth > 768;
|
|
1458
1506
|
const vm = {
|
|
1459
|
-
dataObject: {},
|
|
1460
|
-
originDataObject: {},
|
|
1461
1507
|
prefix: 'split-orders',
|
|
1508
|
+
loading: true,
|
|
1462
1509
|
splitCount: 1,
|
|
1463
1510
|
};
|
|
1464
1511
|
const ids = {
|
|
@@ -1466,6 +1513,7 @@ export class OrderSetting {
|
|
|
1466
1513
|
page: glitter.getUUID(),
|
|
1467
1514
|
header: glitter.getUUID(),
|
|
1468
1515
|
dashboard: glitter.getUUID(),
|
|
1516
|
+
origQTY: glitter.getUUID(),
|
|
1469
1517
|
itemList: glitter.getUUID(),
|
|
1470
1518
|
block: glitter.getUUID(),
|
|
1471
1519
|
summary: glitter.getUUID(),
|
|
@@ -1527,31 +1575,7 @@ export class OrderSetting {
|
|
|
1527
1575
|
bottom: 0;
|
|
1528
1576
|
z-index: 10;
|
|
1529
1577
|
}
|
|
1530
|
-
|
|
1531
|
-
color: #8d8d8d;
|
|
1532
|
-
font-size: 16px;
|
|
1533
|
-
font-weight: 400;
|
|
1534
|
-
}
|
|
1535
|
-
.${vm.prefix}-update {
|
|
1536
|
-
width: 80px;
|
|
1537
|
-
color: #4d86db;
|
|
1538
|
-
font-weight: 400;
|
|
1539
|
-
gap: 8px;
|
|
1540
|
-
cursor: pointer;
|
|
1541
|
-
}
|
|
1542
|
-
.${vm.prefix}-list {
|
|
1543
|
-
list-style: disc;
|
|
1544
|
-
white-space: break-spaces;
|
|
1545
|
-
}
|
|
1546
|
-
.${vm.prefix}-box {
|
|
1547
|
-
border-radius: 10px;
|
|
1548
|
-
padding: 6px 10px;
|
|
1549
|
-
}
|
|
1550
|
-
.${vm.prefix}-check-info-box {
|
|
1551
|
-
position: absolute;
|
|
1552
|
-
width: 1000px;
|
|
1553
|
-
overflow: auto;
|
|
1554
|
-
}
|
|
1578
|
+
|
|
1555
1579
|
.${vm.prefix}-order-row {
|
|
1556
1580
|
display: flex;
|
|
1557
1581
|
align-items: center;
|
|
@@ -1589,7 +1613,7 @@ export class OrderSetting {
|
|
|
1589
1613
|
height:26px;
|
|
1590
1614
|
color:#4D86DB;
|
|
1591
1615
|
gap: 6px;
|
|
1592
|
-
padding
|
|
1616
|
+
padding:0 18px;
|
|
1593
1617
|
display: flex;
|
|
1594
1618
|
align-items: start;
|
|
1595
1619
|
cursor:pointer;
|
|
@@ -1601,13 +1625,15 @@ export class OrderSetting {
|
|
|
1601
1625
|
}
|
|
1602
1626
|
.${vm.prefix}-itemList-section{
|
|
1603
1627
|
min-width: 100%;
|
|
1628
|
+
border-bottom: 1px solid #DDD;
|
|
1604
1629
|
padding-top:24px;
|
|
1605
1630
|
gap:5px;
|
|
1606
|
-
display: flex;
|
|
1631
|
+
display: inline-flex;
|
|
1607
1632
|
}
|
|
1608
1633
|
.${vm.prefix}-summary-section{
|
|
1609
|
-
|
|
1634
|
+
min-width: 100%;
|
|
1610
1635
|
border-bottom: 1px solid #DDD;
|
|
1636
|
+
width:fit-content;
|
|
1611
1637
|
}
|
|
1612
1638
|
.${vm.prefix}-summary-title{
|
|
1613
1639
|
width:606px;
|
|
@@ -1654,13 +1680,13 @@ export class OrderSetting {
|
|
|
1654
1680
|
|
|
1655
1681
|
.${vm.prefix}-dialog-ul{
|
|
1656
1682
|
padding:6px ;
|
|
1657
|
-
list-style:disc;
|
|
1658
1683
|
|
|
1659
1684
|
}
|
|
1660
1685
|
.${vm.prefix}-dialog-ul li{
|
|
1686
|
+
margin-bottom: 3px;
|
|
1661
1687
|
list-style:disc;
|
|
1662
1688
|
text-align:left;
|
|
1663
|
-
|
|
1689
|
+
white-space:break-spaces;
|
|
1664
1690
|
}
|
|
1665
1691
|
`);
|
|
1666
1692
|
};
|
|
@@ -1697,21 +1723,43 @@ export class OrderSetting {
|
|
|
1697
1723
|
dialog.checkYesOrNotWithCustomWidth({
|
|
1698
1724
|
callback: bool => {
|
|
1699
1725
|
if (bool) {
|
|
1726
|
+
function deductFromStoresTS(log, amountToDeduct) {
|
|
1727
|
+
const updatedLog = Object.assign({}, log);
|
|
1728
|
+
const deductions = {};
|
|
1729
|
+
let remainingAmount = Math.max(0, amountToDeduct);
|
|
1730
|
+
const sortedEntries = Object.entries(updatedLog).sort(([, valueA], [, valueB]) => valueB - valueA);
|
|
1731
|
+
for (const [storeKey, storeValue] of sortedEntries) {
|
|
1732
|
+
if (remainingAmount <= 0) {
|
|
1733
|
+
break;
|
|
1734
|
+
}
|
|
1735
|
+
if (storeValue <= 0) {
|
|
1736
|
+
continue;
|
|
1737
|
+
}
|
|
1738
|
+
const amountDeductedFromThisStore = Math.min(remainingAmount, storeValue);
|
|
1739
|
+
if (amountDeductedFromThisStore > 0) {
|
|
1740
|
+
updatedLog[storeKey] -= amountDeductedFromThisStore;
|
|
1741
|
+
deductions[storeKey] = amountDeductedFromThisStore;
|
|
1742
|
+
remainingAmount -= amountDeductedFromThisStore;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return {
|
|
1746
|
+
updatedLog: updatedLog,
|
|
1747
|
+
deductions: deductions,
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1700
1750
|
orderData.lineItems.forEach((lineItem, index) => {
|
|
1701
1751
|
let count = 0;
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1752
|
+
splitOrderArray.forEach(order => {
|
|
1753
|
+
lineItem.count -= order.lineItems[index].count;
|
|
1754
|
+
const resultTS = deductFromStoresTS(lineItem.deduction_log, order.lineItems[index].count);
|
|
1755
|
+
order.lineItems[index].deduction_log = resultTS.deductions;
|
|
1756
|
+
lineItem.deduction_log = resultTS.updatedLog;
|
|
1757
|
+
});
|
|
1706
1758
|
});
|
|
1707
1759
|
const passData = {
|
|
1708
1760
|
orderData: orderData,
|
|
1709
1761
|
splitOrderArray: splitOrderArray,
|
|
1710
1762
|
};
|
|
1711
|
-
ApiShop.combineOrder(vm.dataObject).then(r => {
|
|
1712
|
-
if (r.result && r.response) {
|
|
1713
|
-
}
|
|
1714
|
-
});
|
|
1715
1763
|
dialog.dataLoading({ visible: true });
|
|
1716
1764
|
ApiShop.splitOrder(passData).then(r => {
|
|
1717
1765
|
if (r.result && r.response) {
|
|
@@ -1731,13 +1779,27 @@ export class OrderSetting {
|
|
|
1731
1779
|
const renderFooter = (gvc) => gvc.bindView({
|
|
1732
1780
|
bind: ids.footer,
|
|
1733
1781
|
view: () => {
|
|
1734
|
-
|
|
1782
|
+
let allOrdersHaveZeroItems = false;
|
|
1783
|
+
let origQtyZero = true;
|
|
1784
|
+
let iSplitQtyCount = 0;
|
|
1785
|
+
splitOrderArray.forEach(splitOrder => {
|
|
1786
|
+
if (splitOrder.lineItems.every(item => item.count === 0)) {
|
|
1787
|
+
allOrdersHaveZeroItems = true;
|
|
1788
|
+
}
|
|
1789
|
+
iSplitQtyCount += splitOrder.lineItems.reduce((count, lineItem) => {
|
|
1790
|
+
return (count += lineItem.count);
|
|
1791
|
+
}, 0);
|
|
1792
|
+
});
|
|
1793
|
+
const iQtyCount = dataArray.reduce((iCount, lineItem) => {
|
|
1794
|
+
return (iCount += lineItem.count);
|
|
1795
|
+
}, 0);
|
|
1796
|
+
origQtyZero = iSplitQtyCount === iQtyCount;
|
|
1735
1797
|
let checkBTN = ``;
|
|
1736
|
-
if (
|
|
1737
|
-
checkBTN = BgWidget.
|
|
1798
|
+
if (allOrdersHaveZeroItems || origQtyZero) {
|
|
1799
|
+
checkBTN = BgWidget.disableSave('拆分訂單');
|
|
1738
1800
|
}
|
|
1739
1801
|
else {
|
|
1740
|
-
checkBTN = BgWidget.
|
|
1802
|
+
checkBTN = BgWidget.save(gvc.event(handleSave), '拆分訂單');
|
|
1741
1803
|
}
|
|
1742
1804
|
return html ` ${BgWidget.cancel(gvc.event(closeDialog))} ${checkBTN} `;
|
|
1743
1805
|
},
|
|
@@ -1755,52 +1817,51 @@ export class OrderSetting {
|
|
|
1755
1817
|
const hits = [
|
|
1756
1818
|
'原訂單將保留剩餘商品,訂單金額與折扣將調整;子訂單將包含選定商品,並按比例分配優惠折扣',
|
|
1757
1819
|
'拆單後,運費及附加費用不變,將保留於原訂單內,若需要,請手動編輯訂單新增費用',
|
|
1820
|
+
'請務必進入每一張新的子訂單,為其中的所有商品選擇正確的出貨庫存',
|
|
1758
1821
|
];
|
|
1759
1822
|
return html `
|
|
1760
1823
|
<div class="row">
|
|
1761
|
-
|
|
1762
|
-
${
|
|
1763
|
-
<
|
|
1764
|
-
|
|
1765
|
-
<
|
|
1766
|
-
|
|
1767
|
-
${hits
|
|
1824
|
+
${BgWidget.mainCard(html `
|
|
1825
|
+
<div style="${phoneCardStyle}">
|
|
1826
|
+
<span class="tx_700">拆單需知</span>
|
|
1827
|
+
<div class="w-100 d-flex flex-column">
|
|
1828
|
+
<ul class="mt-2 ms-4 ${gClass('dialog-ul')}">
|
|
1829
|
+
${hits
|
|
1768
1830
|
.map(hit => {
|
|
1769
|
-
return html ` <li class="
|
|
1831
|
+
return html ` <li class="">${hit}</li>`;
|
|
1770
1832
|
})
|
|
1771
1833
|
.join('')}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1834
|
+
</ul>
|
|
1835
|
+
<div
|
|
1836
|
+
class="${gClass('split-rule')} ms-auto d-flex align-items-end justify-content-end"
|
|
1837
|
+
onclick="${gvc.event(() => {
|
|
1776
1838
|
BgWidget.settingDialog({
|
|
1777
1839
|
gvc: gvc,
|
|
1778
1840
|
title: '拆單需知',
|
|
1779
1841
|
width: 766,
|
|
1780
1842
|
innerHTML: gvc => {
|
|
1781
1843
|
return html ` <ul class="${gClass('dialog-ul')}">
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1844
|
+
<li>
|
|
1845
|
+
原訂單將保留剩餘商品,訂單金額與折扣將調整;子訂單將包含選定商品,並按比例分配優惠折扣
|
|
1846
|
+
</li>
|
|
1847
|
+
<li>拆單後運費及附加費用不變,將保留於原訂單內,如需更改,請手動編輯訂單新增費用</li>
|
|
1848
|
+
<li>子訂單會預設繼承母訂單的配送與付款方式,如需更改,請手動編輯訂單內容</li>
|
|
1849
|
+
<li>子訂單若要重新開立發票,請至發票頁面手動建立</li>
|
|
1850
|
+
<li>若發票已開立,系統不會自動作廢,需至訂單頁面手動作廢並重新開立</li>
|
|
1851
|
+
<li>代收金額將更新,已建立的出貨單需取消並重新建立</li>
|
|
1852
|
+
</ul>`;
|
|
1791
1853
|
},
|
|
1792
1854
|
footer_html: (gvc) => {
|
|
1793
1855
|
return '';
|
|
1794
1856
|
},
|
|
1795
1857
|
});
|
|
1796
1858
|
})}"
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
</div>
|
|
1859
|
+
>
|
|
1860
|
+
詳細拆單規則
|
|
1800
1861
|
</div>
|
|
1801
1862
|
</div>
|
|
1802
|
-
|
|
1803
|
-
|
|
1863
|
+
</div>
|
|
1864
|
+
`)}
|
|
1804
1865
|
</div>
|
|
1805
1866
|
`;
|
|
1806
1867
|
};
|
|
@@ -1819,15 +1880,26 @@ export class OrderSetting {
|
|
|
1819
1880
|
};
|
|
1820
1881
|
return splitOrderArray
|
|
1821
1882
|
.map((order, index) => {
|
|
1822
|
-
var _a, _b;
|
|
1883
|
+
var _a, _b, _c;
|
|
1823
1884
|
return html `
|
|
1824
1885
|
<div class="d-flex flex-column">
|
|
1825
1886
|
<div class="${commonClass}" style="width: ${titleDom.width};${(_a = titleDom === null || titleDom === void 0 ? void 0 : titleDom.style) !== null && _a !== void 0 ? _a : ''}">
|
|
1826
|
-
<div class="tx_700"
|
|
1887
|
+
<div class="tx_700">
|
|
1888
|
+
${titleDom.title}${index + 1}
|
|
1889
|
+
<i
|
|
1890
|
+
class="fa-solid fa-xmark cursor_pointer"
|
|
1891
|
+
onclick="${gvc.event(() => {
|
|
1892
|
+
if (splitOrderArray.length > 1) {
|
|
1893
|
+
splitOrderArray.splice(index, 1);
|
|
1894
|
+
gvc.notifyDataChange([ids.itemList, ids.summary, ids.footer]);
|
|
1895
|
+
}
|
|
1896
|
+
})}"
|
|
1897
|
+
></i>
|
|
1898
|
+
</div>
|
|
1827
1899
|
<div class="flex-fill"></div>
|
|
1828
1900
|
</div>
|
|
1829
1901
|
<div
|
|
1830
|
-
class="d-flex flex-column"
|
|
1902
|
+
class="d-flex flex-column flex-shrink-0"
|
|
1831
1903
|
style="width: ${titleDom.width};gap:16px;padding-top: 24px;${(_b = titleDom === null || titleDom === void 0 ? void 0 : titleDom.style) !== null && _b !== void 0 ? _b : ''}"
|
|
1832
1904
|
>
|
|
1833
1905
|
${splitOrderArray[index].lineItems
|
|
@@ -1838,26 +1910,31 @@ export class OrderSetting {
|
|
|
1838
1910
|
style="${commonHeight};"
|
|
1839
1911
|
type="number"
|
|
1840
1912
|
value="${item.count}"
|
|
1841
|
-
min="0"
|
|
1842
1913
|
onchange="${gvc.event(e => {
|
|
1914
|
+
if (Number(e.value) < 0) {
|
|
1915
|
+
e.value = '0';
|
|
1916
|
+
}
|
|
1843
1917
|
const temp = structuredClone(item.count);
|
|
1844
1918
|
item.count = Number(e.value);
|
|
1845
1919
|
let nowQty = 0;
|
|
1846
|
-
splitOrderArray.forEach((
|
|
1847
|
-
nowQty +=
|
|
1920
|
+
splitOrderArray.forEach((splitOrder, index) => {
|
|
1921
|
+
nowQty += splitOrder.lineItems[itemIndex].count;
|
|
1848
1922
|
});
|
|
1849
|
-
if (
|
|
1850
|
-
}
|
|
1851
|
-
else {
|
|
1923
|
+
if (dataArray[itemIndex].count < nowQty) {
|
|
1852
1924
|
item.count = temp;
|
|
1925
|
+
e.value = temp;
|
|
1853
1926
|
}
|
|
1854
|
-
gvc.notifyDataChange([ids.
|
|
1927
|
+
gvc.notifyDataChange([ids.summary, ids.footer, 'oriQty']);
|
|
1855
1928
|
})}"
|
|
1856
1929
|
/>
|
|
1857
1930
|
`;
|
|
1858
1931
|
})
|
|
1859
1932
|
.join('')}
|
|
1860
1933
|
</div>
|
|
1934
|
+
<div
|
|
1935
|
+
class="d-flex flex-column flex-grow-1"
|
|
1936
|
+
style="width: ${titleDom.width};gap:16px;padding-top: 24px;${(_c = titleDom === null || titleDom === void 0 ? void 0 : titleDom.style) !== null && _c !== void 0 ? _c : ''}"
|
|
1937
|
+
></div>
|
|
1861
1938
|
</div>
|
|
1862
1939
|
`;
|
|
1863
1940
|
})
|
|
@@ -1897,125 +1974,161 @@ export class OrderSetting {
|
|
|
1897
1974
|
htmlArray: [],
|
|
1898
1975
|
},
|
|
1899
1976
|
];
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
switch (dataRaw.key) {
|
|
1907
|
-
case 'name': {
|
|
1977
|
+
function drawLineItems(dataRaw) {
|
|
1978
|
+
switch (dataRaw.key) {
|
|
1979
|
+
case 'name': {
|
|
1980
|
+
return dataArray
|
|
1981
|
+
.map((item, lineItemIndex) => {
|
|
1982
|
+
var _a, _b;
|
|
1908
1983
|
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1984
|
+
return html ` <div class="${commonClass}" style="width: ${dataRaw.width};gap:12px;${commonHeight}">
|
|
1985
|
+
${BgWidget.validImageBox({
|
|
1986
|
+
gvc: gvc,
|
|
1987
|
+
image: (_a = item.preview_image) !== null && _a !== void 0 ? _a : '',
|
|
1988
|
+
width: 42,
|
|
1989
|
+
})}
|
|
1990
|
+
<div class="d-flex flex-column flex-grow-1" style="gap:2px;">
|
|
1991
|
+
<div class="tx_normal_14" style="white-space: normal;line-height: normal;">
|
|
1992
|
+
${Tool.truncateString((_b = item.title) !== null && _b !== void 0 ? _b : '', 10)} -${spec}
|
|
1993
|
+
</div>
|
|
1994
|
+
<div class="tx_normal_14 ${gClass('font-gray')}">
|
|
1995
|
+
存貨單位 (SKU): ${item.sku && item.sku.length > 0 ? item.sku : '無SKU'}
|
|
1996
|
+
</div>
|
|
1997
|
+
</div>
|
|
1998
|
+
</div>`;
|
|
1999
|
+
})
|
|
2000
|
+
.join('');
|
|
2001
|
+
}
|
|
2002
|
+
case 'stock': {
|
|
2003
|
+
if (storeList.length > 0) {
|
|
2004
|
+
return dataArray.map((item) => {
|
|
2005
|
+
var _a;
|
|
2006
|
+
let maxEntry = {
|
|
2007
|
+
key: "",
|
|
2008
|
+
title: "",
|
|
2009
|
+
value: 0
|
|
2010
|
+
};
|
|
2011
|
+
console.log("item.deduction_log -- ", item.deduction_log);
|
|
2012
|
+
Object.entries(item.deduction_log).forEach((log) => {
|
|
2013
|
+
if (maxEntry.value < log[1]) {
|
|
2014
|
+
maxEntry = {
|
|
2015
|
+
key: log[0],
|
|
2016
|
+
title: log[0],
|
|
2017
|
+
value: log[1]
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
});
|
|
2021
|
+
maxEntry.title = storeList.find((store) => {
|
|
2022
|
+
return store.id == maxEntry.key;
|
|
2023
|
+
}).name;
|
|
2024
|
+
return html `
|
|
2025
|
+
<div
|
|
2026
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2027
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2028
|
+
>
|
|
2029
|
+
${(_a = maxEntry.title) !== null && _a !== void 0 ? _a : "出貨庫存錯誤"}
|
|
2030
|
+
</div>
|
|
2031
|
+
`;
|
|
2032
|
+
}).join('');
|
|
1955
2033
|
}
|
|
1956
|
-
|
|
2034
|
+
return html `
|
|
2035
|
+
<div
|
|
2036
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2037
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2038
|
+
>
|
|
2039
|
+
AA倉庫
|
|
2040
|
+
</div>
|
|
2041
|
+
`;
|
|
2042
|
+
}
|
|
2043
|
+
case 'price': {
|
|
2044
|
+
return dataArray
|
|
2045
|
+
.map((item, lineItemIndex) => {
|
|
2046
|
+
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2047
|
+
return html `
|
|
2048
|
+
<div
|
|
2049
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2050
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2051
|
+
>
|
|
2052
|
+
${item.sale_price}
|
|
2053
|
+
</div>
|
|
2054
|
+
`;
|
|
2055
|
+
})
|
|
2056
|
+
.join('');
|
|
2057
|
+
}
|
|
2058
|
+
case 'totalQty': {
|
|
2059
|
+
return dataArray
|
|
2060
|
+
.map((item, lineItemIndex) => {
|
|
2061
|
+
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2062
|
+
return html `
|
|
2063
|
+
<div
|
|
2064
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2065
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2066
|
+
>
|
|
2067
|
+
${item.count}
|
|
2068
|
+
</div>
|
|
2069
|
+
`;
|
|
2070
|
+
})
|
|
2071
|
+
.join('');
|
|
2072
|
+
}
|
|
2073
|
+
case 'oriQty': {
|
|
2074
|
+
return dataArray
|
|
2075
|
+
.map((item, lineItemIndex) => {
|
|
1957
2076
|
let splitQty = 0;
|
|
1958
2077
|
splitOrderArray.forEach(order => {
|
|
1959
2078
|
splitQty += Number(order.lineItems[lineItemIndex].count);
|
|
1960
2079
|
});
|
|
1961
2080
|
const minusQtyClass = `${gClass('minusQty')} ${splitQty > 0 ? '' : 'd-none'}`;
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
2081
|
+
return html `
|
|
2082
|
+
<div
|
|
2083
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2084
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2085
|
+
>
|
|
2086
|
+
${item.count}
|
|
2087
|
+
<span class="${minusQtyClass}">
|
|
2088
|
+
<i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2089
|
+
>${Number(item.count) - splitQty}</span
|
|
2090
|
+
>
|
|
2091
|
+
</div>
|
|
2092
|
+
`;
|
|
2093
|
+
})
|
|
2094
|
+
.join('');
|
|
1972
2095
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
});
|
|
2096
|
+
default: {
|
|
2097
|
+
return '';
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
1979
2101
|
return html `
|
|
1980
2102
|
${dataRaws
|
|
1981
2103
|
.map(item => {
|
|
1982
2104
|
var _a, _b;
|
|
1983
2105
|
return html `
|
|
1984
|
-
<div class="d-flex flex-column">
|
|
2106
|
+
<div class="d-flex flex-column flex-shrink-0">
|
|
1985
2107
|
<div class="${commonClass}" style="width: ${item.width};${(_a = item === null || item === void 0 ? void 0 : item.style) !== null && _a !== void 0 ? _a : ''}">
|
|
1986
2108
|
<div class="tx_700">${item.title}</div>
|
|
1987
2109
|
<div class="flex-fill"></div>
|
|
1988
2110
|
</div>
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2111
|
+
${gvc.bindView({
|
|
2112
|
+
bind: item.key,
|
|
2113
|
+
view: () => {
|
|
2114
|
+
return (drawLineItems(item) +
|
|
2115
|
+
html ` <div class="${commonClass} mt-3" style="width: ${item.width};"></div>`);
|
|
2116
|
+
},
|
|
2117
|
+
divCreate: {
|
|
2118
|
+
class: 'd-flex flex-column',
|
|
2119
|
+
style: `width: ${item.width};gap:16px;padding-top: 24px;${(_b = item === null || item === void 0 ? void 0 : item.style) !== null && _b !== void 0 ? _b : ''}`,
|
|
2120
|
+
},
|
|
2121
|
+
})}
|
|
1995
2122
|
</div>
|
|
1996
2123
|
`;
|
|
1997
2124
|
})
|
|
1998
2125
|
.join('')}
|
|
1999
|
-
|
|
2126
|
+
<div class="d-flex flex-shrink-0" style="overflow-x: scroll;gap:5px;">${drawSplitOrder()} ${addBTN}</div>
|
|
2000
2127
|
`;
|
|
2001
2128
|
},
|
|
2002
2129
|
divCreate: { style: '', class: `${gClass('itemList-section')}` },
|
|
2003
2130
|
});
|
|
2004
2131
|
};
|
|
2005
|
-
const renderBlock = (gvc) => {
|
|
2006
|
-
const subBlock = splitOrderArray
|
|
2007
|
-
.map((order, index) => {
|
|
2008
|
-
return html `<div class="${gClass('summary-subSummary')}"></div>`;
|
|
2009
|
-
})
|
|
2010
|
-
.join('');
|
|
2011
|
-
return html `
|
|
2012
|
-
<div class="d-flex" style="height:27px;">
|
|
2013
|
-
<div class="${gClass('summary-title')}"></div>
|
|
2014
|
-
<div class="${gClass('summary-oriSummary')}"></div>
|
|
2015
|
-
${subBlock}
|
|
2016
|
-
</div>
|
|
2017
|
-
`;
|
|
2018
|
-
};
|
|
2019
2132
|
const renderSummary = (gvc) => {
|
|
2020
2133
|
return gvc.bindView({
|
|
2021
2134
|
bind: ids.summary,
|
|
@@ -2033,8 +2146,7 @@ export class OrderSetting {
|
|
|
2033
2146
|
const sale_price = dataArray.reduce((total, data) => total + data.sale_price * Number(data.count), 0);
|
|
2034
2147
|
const split_price = splitOrderArray.reduce((total, order) => total +
|
|
2035
2148
|
order.lineItems.reduce((subTotal, lineItem) => subTotal + lineItem.sale_price * Number(lineItem.count), 0), 0);
|
|
2036
|
-
const
|
|
2037
|
-
const discount = Math.round(orderData.discount * rate);
|
|
2149
|
+
const split_discount = splitOrderArray.reduce((total, order) => total + order.discount, 0);
|
|
2038
2150
|
switch (index) {
|
|
2039
2151
|
case 1:
|
|
2040
2152
|
if (split_price) {
|
|
@@ -2055,7 +2167,7 @@ export class OrderSetting {
|
|
|
2055
2167
|
<div class="d-flex align-items-center">
|
|
2056
2168
|
<span class="text-decoration-line-through">-${orderData.discount}</span
|
|
2057
2169
|
><i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2058
|
-
><span class="${gClass('font-blue')}">-${discount}</span>
|
|
2170
|
+
><span class="${gClass('font-blue')}">-${orderData.discount - split_discount}</span>
|
|
2059
2171
|
</div>
|
|
2060
2172
|
`;
|
|
2061
2173
|
}
|
|
@@ -2067,7 +2179,10 @@ export class OrderSetting {
|
|
|
2067
2179
|
<span class="text-decoration-line-through">${orderData.total}</span
|
|
2068
2180
|
><i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2069
2181
|
><span class="${gClass('font-blue')}"
|
|
2070
|
-
>${sale_price -
|
|
2182
|
+
>${sale_price -
|
|
2183
|
+
split_price -
|
|
2184
|
+
(orderData.discount - split_discount) +
|
|
2185
|
+
orderData.shipment_fee}</span
|
|
2071
2186
|
>
|
|
2072
2187
|
</div>
|
|
2073
2188
|
`;
|
|
@@ -2142,18 +2257,33 @@ export class OrderSetting {
|
|
|
2142
2257
|
applyClass();
|
|
2143
2258
|
return gvc.bindView({
|
|
2144
2259
|
bind: ids.page,
|
|
2145
|
-
view: () =>
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2260
|
+
view: () => {
|
|
2261
|
+
if (vm.loading) {
|
|
2262
|
+
glitter.share.loading_dialog.dataLoading({ text: '載入中...', visible: true });
|
|
2263
|
+
ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
|
|
2264
|
+
if (dd.result && dd.response.value) {
|
|
2265
|
+
storeList = dd.response.value.list;
|
|
2266
|
+
vm.loading = false;
|
|
2267
|
+
gvc.notifyDataChange(ids.page);
|
|
2268
|
+
}
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
else {
|
|
2272
|
+
glitter.share.loading_dialog.dataLoading({ text: '載入中...', visible: false });
|
|
2273
|
+
}
|
|
2274
|
+
return html `
|
|
2275
|
+
<div class="d-flex flex-column ${gClass('full-screen')}">
|
|
2276
|
+
${renderHeader(gvc)}
|
|
2277
|
+
<div
|
|
2278
|
+
class="flex-fill scrollbar-appear"
|
|
2279
|
+
style="${isDesktop ? 'padding: 24px 32px;' : 'padding: 0 24px;'} overflow: scroll;"
|
|
2280
|
+
>
|
|
2281
|
+
${renderHint(gvc)} ${renderItemList(gvc)} ${renderSummary(gvc)}
|
|
2282
|
+
</div>
|
|
2283
|
+
${renderFooter(gvc)}
|
|
2153
2284
|
</div>
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
`,
|
|
2285
|
+
`;
|
|
2286
|
+
},
|
|
2157
2287
|
});
|
|
2158
2288
|
}, 'splitOrder');
|
|
2159
2289
|
}
|