ts-glitter 20.6.8 → 20.7.0
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/stock-history.js +75 -63
- package/lowcode/cms-plugin/stock-history.ts +390 -376
- 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/stock.ts +1 -0
- 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 +371 -95
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +499 -141
- package/src/api-public/services/stock.js +0 -3
- package/src/api-public/services/stock.js.map +1 -1
- package/src/api-public/services/stock.ts +3 -3
- package/src/api-public/services/user.d.ts +1 -0
- package/src/api-public/services/user.js +32 -12
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +38 -19
- 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/ios/proshake/AppDelegate.swift +51 -7
- package/src/app-project/ios/proshake/Info.plist +11 -9
- package/src/app-project/ios/proshake/SceneDelegate.swift +18 -0
- package/src/app-project/ios/proshake/glitter-interface/BasicUtil.swift +43 -2
- package/src/app-project/ios/proshake/glitter-interface/Ecommerce.swift +56 -0
- package/src/app-project/ios/proshake.xcodeproj/project.xcworkspace/xcuserdata/jianzhi.wang.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- 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/ios-project.js +12 -6
- package/src/services/ios-project.js.map +1 -1
- package/src/services/ios-project.ts +12 -6
- 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
|
@@ -6,6 +6,8 @@ import { ShareDialog } from '../../glitterBundle/dialog/ShareDialog.js';
|
|
|
6
6
|
import { Tool } from '../../modules/tool.js';
|
|
7
7
|
import { CartData, LineItem, OrderData, OrderDetail } from './data.js';
|
|
8
8
|
import { EditorElem } from '../../glitterBundle/plugins/editor-elem.js';
|
|
9
|
+
import { ShipmentConfig } from '../../glitter-base/global/shipment-config.js';
|
|
10
|
+
import { PaymentConfig } from '../../glitter-base/global/payment-config.js';
|
|
9
11
|
|
|
10
12
|
const html = String.raw;
|
|
11
13
|
|
|
@@ -34,18 +36,16 @@ type DashboardData = {
|
|
|
34
36
|
|
|
35
37
|
export class OrderSetting {
|
|
36
38
|
// 付款名稱
|
|
37
|
-
static getPaymentMethodText(orderData: OrderData) {
|
|
39
|
+
static getPaymentMethodText(orderData: OrderData, paymentMethod: any) {
|
|
38
40
|
const paymentMethods: Record<string, string> = {
|
|
39
41
|
POS: '門市POS付款',
|
|
40
42
|
off_line: '線下付款',
|
|
41
|
-
newWebPay: '藍新金流',
|
|
42
|
-
ecPay: '綠界金流',
|
|
43
|
-
line_pay: 'Line Pay',
|
|
44
|
-
atm: '銀行轉帳',
|
|
45
|
-
line: 'Line 轉帳',
|
|
46
|
-
cash_on_delivery: '貨到付款',
|
|
47
43
|
};
|
|
48
44
|
|
|
45
|
+
paymentMethod.map((item: any) => {
|
|
46
|
+
paymentMethods[item.key] = item.name;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
49
|
return orderData.orderSource === 'POS'
|
|
50
50
|
? paymentMethods['POS']
|
|
51
51
|
: paymentMethods[orderData.customer_info.payment_select] || '線下付款';
|
|
@@ -53,39 +53,26 @@ export class OrderSetting {
|
|
|
53
53
|
|
|
54
54
|
// 配送名稱
|
|
55
55
|
static getShippingMethodText(orderData: OrderData) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return '7-11店到店';
|
|
59
|
-
case 'FAMIC2C':
|
|
60
|
-
return '全家店到店';
|
|
61
|
-
case 'OKMARTC2C':
|
|
62
|
-
return 'OK店到店';
|
|
63
|
-
case 'HILIFEC2C':
|
|
64
|
-
return '萊爾富店到店';
|
|
65
|
-
case 'normal':
|
|
66
|
-
return '中華郵政';
|
|
67
|
-
case 'black_cat':
|
|
68
|
-
return '黑貓到府';
|
|
69
|
-
case 'shop':
|
|
70
|
-
return '實體門市取貨';
|
|
71
|
-
case 'global_express':
|
|
72
|
-
return '國際快遞';
|
|
73
|
-
case 'now':
|
|
74
|
-
return '立即取貨';
|
|
75
|
-
default:
|
|
76
|
-
return '宅配';
|
|
56
|
+
if (!orderData.user_info.shipment) {
|
|
57
|
+
return '立即取貨';
|
|
77
58
|
}
|
|
59
|
+
|
|
60
|
+
const shippingData = ShipmentConfig.list.find(item => item.value === orderData.user_info.shipment);
|
|
61
|
+
return shippingData ? shippingData.title : '立即取貨';
|
|
78
62
|
}
|
|
79
63
|
|
|
80
64
|
// 配送地址
|
|
81
65
|
static getShippingAddress(orderData: OrderData) {
|
|
82
66
|
const shipment = orderData.user_info.shipment;
|
|
83
|
-
if (['UNIMARTC2C', 'FAMIC2C', 'OKMARTC2C', 'HILIFEC2C'].includes(shipment)) {
|
|
67
|
+
if (['UNIMARTC2C', 'UNIMARTFREEZE', 'FAMIC2C', 'FAMIC2CFREEZE', 'OKMARTC2C', 'HILIFEC2C'].includes(shipment)) {
|
|
84
68
|
return `${orderData.user_info.CVSStoreName} (${orderData.user_info.CVSAddress})`;
|
|
85
69
|
}
|
|
86
70
|
if (shipment === 'shop') {
|
|
87
71
|
return '實體門市';
|
|
88
72
|
}
|
|
73
|
+
if (shipment === 'now') {
|
|
74
|
+
return '立即取貨';
|
|
75
|
+
}
|
|
89
76
|
return orderData.user_info.address;
|
|
90
77
|
}
|
|
91
78
|
|
|
@@ -108,6 +95,7 @@ export class OrderSetting {
|
|
|
108
95
|
static getShippmentOpt() {
|
|
109
96
|
return [
|
|
110
97
|
{ title: '未出貨', value: 'wait' },
|
|
98
|
+
{ title: '待預購', value: 'pre_order' },
|
|
111
99
|
{ title: '備貨中', value: 'in_stock' },
|
|
112
100
|
{ title: '已出貨', value: 'shipping' },
|
|
113
101
|
{ title: '已到貨', value: 'arrived' },
|
|
@@ -777,6 +765,7 @@ export class OrderSetting {
|
|
|
777
765
|
selectOrderID: data.targetID,
|
|
778
766
|
dotClass: BgWidget.getWhiteDotClass(gvc),
|
|
779
767
|
};
|
|
768
|
+
|
|
780
769
|
return BgWidget.dialog({
|
|
781
770
|
gvc: ogvc,
|
|
782
771
|
title: '確認資訊',
|
|
@@ -790,6 +779,13 @@ export class OrderSetting {
|
|
|
790
779
|
{ width: 10, align: 'center' },
|
|
791
780
|
{ width: 30, align: 'center' },
|
|
792
781
|
];
|
|
782
|
+
|
|
783
|
+
const ovm = {
|
|
784
|
+
list_id: gvc.glitter.getUUID(),
|
|
785
|
+
list_loading: true,
|
|
786
|
+
payment_method: [] as any,
|
|
787
|
+
};
|
|
788
|
+
|
|
793
789
|
return html`
|
|
794
790
|
<div class="${gClass('check-info-box')}">
|
|
795
791
|
${BgWidget.grayNote(
|
|
@@ -814,59 +810,78 @@ export class OrderSetting {
|
|
|
814
810
|
})
|
|
815
811
|
.join('')}
|
|
816
812
|
</div>
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
813
|
+
${gvc.bindView({
|
|
814
|
+
bind: ovm.list_id,
|
|
815
|
+
view: () => {
|
|
816
|
+
if (ovm.list_loading) {
|
|
817
|
+
return '';
|
|
818
|
+
} else {
|
|
819
|
+
return orders
|
|
820
|
+
.map(order => {
|
|
821
|
+
const orderData = order.orderData;
|
|
822
|
+
const vt = this.getAllStatusBadge(order);
|
|
823
|
+
const row = [
|
|
824
|
+
{
|
|
825
|
+
title: html`
|
|
826
|
+
<div class="d-flex gap-2">
|
|
827
|
+
${gvc.bindView({
|
|
828
|
+
bind: `r-${order.cart_token}`,
|
|
829
|
+
view: () => {
|
|
830
|
+
return html`<input
|
|
831
|
+
class="form-check-input ${dialogVM.dotClass} cursor_pointer"
|
|
832
|
+
style="margin-top: 0.25rem;"
|
|
833
|
+
type="radio"
|
|
834
|
+
id="r-${order.cart_token}"
|
|
835
|
+
name="check-info-radios"
|
|
836
|
+
onchange="${gvc.event(() => {
|
|
837
|
+
dialogVM.selectOrderID = order.cart_token;
|
|
838
|
+
gvc.notifyDataChange(orders.map(d => `r-${d.cart_token}`));
|
|
839
|
+
})}"
|
|
840
|
+
${dialogVM.selectOrderID === order.cart_token ? 'checked' : ''}
|
|
841
|
+
/>`;
|
|
842
|
+
},
|
|
843
|
+
})}
|
|
844
|
+
<span style="color: #4d86db;">${order.cart_token}</span>
|
|
845
|
+
<div class="d-flex justify-content-end gap-2">
|
|
846
|
+
${vt.archivedBadge()}
|
|
847
|
+
${vt.paymentBadge()}${vt.outShipBadge()}${vt.orderStatusBadge()}
|
|
848
|
+
</div>
|
|
849
|
+
</div>
|
|
850
|
+
`,
|
|
851
|
+
},
|
|
852
|
+
{ title: order.created_time.split('T')[0] },
|
|
853
|
+
{ title: this.getPaymentMethodText(orderData, ovm.payment_method) },
|
|
854
|
+
{ title: this.getShippingMethodText(orderData) },
|
|
855
|
+
{ title: this.getShippingAddress(orderData) },
|
|
856
|
+
]
|
|
857
|
+
.map((item, i) => {
|
|
858
|
+
return html` <div
|
|
859
|
+
class="tx_normal"
|
|
860
|
+
style="width: ${styles[i].width}%; text-align: ${styles[i].align};"
|
|
861
|
+
>
|
|
862
|
+
<span style="white-space: break-spaces;">${(item.title ?? '').trim()}</span>
|
|
863
|
+
</div>`;
|
|
864
|
+
})
|
|
865
|
+
.join('');
|
|
866
|
+
|
|
867
|
+
return html` <div class="${gClass('order-row')}">${row}</div>`;
|
|
863
868
|
})
|
|
864
869
|
.join('');
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
divCreate: {
|
|
873
|
+
class: 'd-flex flex-column gap-0 mt-3',
|
|
874
|
+
},
|
|
875
|
+
onCreate: () => {
|
|
876
|
+
if (ovm.list_loading) {
|
|
877
|
+
PaymentConfig.getSupportPayment(true).then(response => {
|
|
878
|
+
ovm.payment_method = response;
|
|
879
|
+
ovm.list_loading = false;
|
|
880
|
+
gvc.notifyDataChange(ovm.list_id);
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
})}
|
|
870
885
|
</div>
|
|
871
886
|
</div>
|
|
872
887
|
`;
|
|
@@ -965,6 +980,12 @@ export class OrderSetting {
|
|
|
965
980
|
{ width: 5, align: 'center' },
|
|
966
981
|
];
|
|
967
982
|
|
|
983
|
+
const ovm = {
|
|
984
|
+
list_id: gvc.glitter.getUUID(),
|
|
985
|
+
list_loading: true,
|
|
986
|
+
payment_method: [] as any,
|
|
987
|
+
};
|
|
988
|
+
|
|
968
989
|
return html` <div class="${gClass('box')} mt-2" style="${isDesktop ? '' : 'width: 1200px'}">
|
|
969
990
|
<div class="d-flex">
|
|
970
991
|
${[
|
|
@@ -984,60 +1005,79 @@ export class OrderSetting {
|
|
|
984
1005
|
})
|
|
985
1006
|
.join('')}
|
|
986
1007
|
</div>
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1008
|
+
${gvc.bindView({
|
|
1009
|
+
bind: ovm.list_id,
|
|
1010
|
+
view: () => {
|
|
1011
|
+
if (ovm.list_loading) {
|
|
1012
|
+
return '';
|
|
1013
|
+
} else {
|
|
1014
|
+
return orders
|
|
1015
|
+
.map((order, index) => {
|
|
1016
|
+
const orderData = order.orderData;
|
|
1017
|
+
const vt = this.getAllStatusBadge(order);
|
|
1018
|
+
const row = [
|
|
1019
|
+
{
|
|
1020
|
+
title: html`
|
|
1021
|
+
<div class="d-flex gap-3">
|
|
1022
|
+
<span style="color: #4d86db;">${order.cart_token}</span>
|
|
1023
|
+
<div class="d-flex justify-content-end gap-2">
|
|
1024
|
+
${vt.archivedBadge()} ${vt.paymentBadge()}${vt.outShipBadge()}${vt.orderStatusBadge()}
|
|
1025
|
+
</div>
|
|
1026
|
+
</div>
|
|
1027
|
+
`,
|
|
1028
|
+
},
|
|
1029
|
+
{ title: order.created_time.split('T')[0] },
|
|
1030
|
+
{ title: this.getPaymentMethodText(orderData, ovm.payment_method) },
|
|
1031
|
+
{ title: this.getShippingMethodText(orderData) },
|
|
1032
|
+
{ title: this.getShippingAddress(orderData) },
|
|
1033
|
+
{ title: `$ ${orderData.total.toLocaleString()}` },
|
|
1034
|
+
{ title: `${orderData.lineItems.length}件商品` },
|
|
1035
|
+
{
|
|
1036
|
+
title:
|
|
1037
|
+
orders.length > 1
|
|
1038
|
+
? html`<i
|
|
1039
|
+
class="fa-solid fa-xmark"
|
|
1040
|
+
style="color: #B0B0B0; cursor: pointer"
|
|
1041
|
+
onclick="${gvc.event(() => {
|
|
1042
|
+
if (order.cart_token === data.targetID) {
|
|
1043
|
+
data.targetID = '';
|
|
1044
|
+
}
|
|
1045
|
+
data.orders.splice(index, 1);
|
|
1046
|
+
vm.dataObject = setDataStatus(dataMap);
|
|
1047
|
+
gvc.notifyDataChange([editID, ids.header, ids.dashboard]);
|
|
1048
|
+
})}"
|
|
1049
|
+
></i>`
|
|
1050
|
+
: '',
|
|
1051
|
+
},
|
|
1052
|
+
]
|
|
1053
|
+
.map((item, i) => {
|
|
1054
|
+
return html` <div
|
|
1055
|
+
class="tx_normal"
|
|
1056
|
+
style="width: ${styles[i].width}%; text-align: ${styles[i].align};"
|
|
1057
|
+
>
|
|
1058
|
+
<span style="white-space: break-spaces;">${(item.title ?? '').trim()}</span>
|
|
1059
|
+
</div>`;
|
|
1060
|
+
})
|
|
1061
|
+
.join('');
|
|
1062
|
+
|
|
1063
|
+
return html` <div class="${gClass('order-row')}">${row}</div>`;
|
|
1034
1064
|
})
|
|
1035
1065
|
.join('');
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
divCreate: {
|
|
1069
|
+
class: 'd-flex flex-column gap-0 mt-3',
|
|
1070
|
+
},
|
|
1071
|
+
onCreate: () => {
|
|
1072
|
+
if (ovm.list_loading) {
|
|
1073
|
+
PaymentConfig.getSupportPayment(true).then(response => {
|
|
1074
|
+
ovm.payment_method = response;
|
|
1075
|
+
ovm.list_loading = false;
|
|
1076
|
+
gvc.notifyDataChange(ovm.list_id);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
})}
|
|
1041
1081
|
</div>`;
|
|
1042
1082
|
};
|
|
1043
1083
|
|
|
@@ -1131,7 +1171,14 @@ export class OrderSetting {
|
|
|
1131
1171
|
|
|
1132
1172
|
const isPayStatusSame = status === baseStatus;
|
|
1133
1173
|
const isShipmentSame = user_info.shipment === baseShipment;
|
|
1134
|
-
const isAddressSame = [
|
|
1174
|
+
const isAddressSame = [
|
|
1175
|
+
'UNIMARTC2C',
|
|
1176
|
+
'UNIMARTFREEZE',
|
|
1177
|
+
'FAMIC2C',
|
|
1178
|
+
'FAMIC2CFREEZE',
|
|
1179
|
+
'OKMARTC2C',
|
|
1180
|
+
'HILIFEC2C',
|
|
1181
|
+
].includes(baseShipment)
|
|
1135
1182
|
? user_info.CVSStoreName === baseCVSStoreName
|
|
1136
1183
|
: user_info.address === baseAddress;
|
|
1137
1184
|
|
|
@@ -1323,7 +1370,7 @@ export class OrderSetting {
|
|
|
1323
1370
|
},
|
|
1324
1371
|
{
|
|
1325
1372
|
key: '出貨單號碼',
|
|
1326
|
-
value: html
|
|
1373
|
+
value: html` <div style="width: 200px;">
|
|
1327
1374
|
${BgWidget.grayNote(
|
|
1328
1375
|
dd.orderData.user_info.shipment_number
|
|
1329
1376
|
? `#${dd.orderData.user_info.shipment_number}`
|
|
@@ -1431,7 +1478,7 @@ export class OrderSetting {
|
|
|
1431
1478
|
: '',
|
|
1432
1479
|
].filter(Boolean);
|
|
1433
1480
|
|
|
1434
|
-
return html
|
|
1481
|
+
return html` <div class="d-flex align-items-center gap-2">${htmlArray.join('')}</div>`;
|
|
1435
1482
|
},
|
|
1436
1483
|
divCreate: {
|
|
1437
1484
|
style: 'min-width: 580px;',
|
|
@@ -1515,6 +1562,9 @@ export class OrderSetting {
|
|
|
1515
1562
|
callback: (value: any) => {
|
|
1516
1563
|
checkArray.forEach((order: any) => {
|
|
1517
1564
|
order.orderData.progress = value;
|
|
1565
|
+
if (['wait', 'returns', undefined].includes(value)) {
|
|
1566
|
+
order.orderData.user_info.shipment_number = '';
|
|
1567
|
+
}
|
|
1518
1568
|
});
|
|
1519
1569
|
},
|
|
1520
1570
|
});
|
|
@@ -1630,11 +1680,13 @@ export class OrderSetting {
|
|
|
1630
1680
|
}
|
|
1631
1681
|
|
|
1632
1682
|
// 拆分訂單
|
|
1633
|
-
static splitOrder(topGVC: GVC,
|
|
1683
|
+
static splitOrder(topGVC: GVC, origOrderData: any, callback: () => void) {
|
|
1634
1684
|
//把原本的預設資訊扔進拆分表單內,並且把商品的數量設定為0
|
|
1685
|
+
const orderData = structuredClone(origOrderData);
|
|
1686
|
+
|
|
1635
1687
|
function assignOrder(orderCreateUnit: OrderDetail) {
|
|
1636
1688
|
orderCreateUnit.cart_token = orderData.orderID;
|
|
1637
|
-
orderCreateUnit.customer_info = orderData.
|
|
1689
|
+
orderCreateUnit.customer_info = orderData.customer_info;
|
|
1638
1690
|
orderCreateUnit.user_info = orderData.user_info;
|
|
1639
1691
|
orderCreateUnit.voucher = orderData.voucherList;
|
|
1640
1692
|
orderCreateUnit.lineItems = structuredClone(orderData.lineItems);
|
|
@@ -1642,7 +1694,9 @@ export class OrderSetting {
|
|
|
1642
1694
|
lineItem.count = 0;
|
|
1643
1695
|
});
|
|
1644
1696
|
}
|
|
1697
|
+
|
|
1645
1698
|
orderData.orderSource = 'split';
|
|
1699
|
+
let storeList: any = [];
|
|
1646
1700
|
const dataArray: LineItem[] = orderData.lineItems;
|
|
1647
1701
|
const parentPageConfig = (window.parent as any)?.glitter?.pageConfig;
|
|
1648
1702
|
const latestPageConfig = parentPageConfig?.[parentPageConfig.length - 1];
|
|
@@ -1654,11 +1708,9 @@ export class OrderSetting {
|
|
|
1654
1708
|
const splitOrderArray: OrderDetail[] = [structuredClone(orderCreateUnit)];
|
|
1655
1709
|
const passData = structuredClone(orderCreateUnit); //修改後的
|
|
1656
1710
|
const isDesktop = document.body.clientWidth > 768;
|
|
1657
|
-
|
|
1658
1711
|
const vm = {
|
|
1659
|
-
dataObject: {} as DataMap, // 調用合併訂單資料
|
|
1660
|
-
originDataObject: {} as DataMap, // 原始合併訂單資料
|
|
1661
1712
|
prefix: 'split-orders',
|
|
1713
|
+
loading: true,
|
|
1662
1714
|
splitCount: 1,
|
|
1663
1715
|
};
|
|
1664
1716
|
|
|
@@ -1667,6 +1719,7 @@ export class OrderSetting {
|
|
|
1667
1719
|
page: glitter.getUUID(),
|
|
1668
1720
|
header: glitter.getUUID(),
|
|
1669
1721
|
dashboard: glitter.getUUID(),
|
|
1722
|
+
origQTY: glitter.getUUID(),
|
|
1670
1723
|
itemList: glitter.getUUID(),
|
|
1671
1724
|
block: glitter.getUUID(),
|
|
1672
1725
|
summary: glitter.getUUID(),
|
|
@@ -1730,31 +1783,7 @@ export class OrderSetting {
|
|
|
1730
1783
|
bottom: 0;
|
|
1731
1784
|
z-index: 10;
|
|
1732
1785
|
}
|
|
1733
|
-
|
|
1734
|
-
color: #8d8d8d;
|
|
1735
|
-
font-size: 16px;
|
|
1736
|
-
font-weight: 400;
|
|
1737
|
-
}
|
|
1738
|
-
.${vm.prefix}-update {
|
|
1739
|
-
width: 80px;
|
|
1740
|
-
color: #4d86db;
|
|
1741
|
-
font-weight: 400;
|
|
1742
|
-
gap: 8px;
|
|
1743
|
-
cursor: pointer;
|
|
1744
|
-
}
|
|
1745
|
-
.${vm.prefix}-list {
|
|
1746
|
-
list-style: disc;
|
|
1747
|
-
white-space: break-spaces;
|
|
1748
|
-
}
|
|
1749
|
-
.${vm.prefix}-box {
|
|
1750
|
-
border-radius: 10px;
|
|
1751
|
-
padding: 6px 10px;
|
|
1752
|
-
}
|
|
1753
|
-
.${vm.prefix}-check-info-box {
|
|
1754
|
-
position: absolute;
|
|
1755
|
-
width: 1000px;
|
|
1756
|
-
overflow: auto;
|
|
1757
|
-
}
|
|
1786
|
+
|
|
1758
1787
|
.${vm.prefix}-order-row {
|
|
1759
1788
|
display: flex;
|
|
1760
1789
|
align-items: center;
|
|
@@ -1792,7 +1821,7 @@ export class OrderSetting {
|
|
|
1792
1821
|
height:26px;
|
|
1793
1822
|
color:#4D86DB;
|
|
1794
1823
|
gap: 6px;
|
|
1795
|
-
padding
|
|
1824
|
+
padding:0 18px;
|
|
1796
1825
|
display: flex;
|
|
1797
1826
|
align-items: start;
|
|
1798
1827
|
cursor:pointer;
|
|
@@ -1804,13 +1833,15 @@ export class OrderSetting {
|
|
|
1804
1833
|
}
|
|
1805
1834
|
.${vm.prefix}-itemList-section{
|
|
1806
1835
|
min-width: 100%;
|
|
1836
|
+
border-bottom: 1px solid #DDD;
|
|
1807
1837
|
padding-top:24px;
|
|
1808
1838
|
gap:5px;
|
|
1809
|
-
display: flex;
|
|
1839
|
+
display: inline-flex;
|
|
1810
1840
|
}
|
|
1811
1841
|
.${vm.prefix}-summary-section{
|
|
1812
|
-
|
|
1842
|
+
min-width: 100%;
|
|
1813
1843
|
border-bottom: 1px solid #DDD;
|
|
1844
|
+
width:fit-content;
|
|
1814
1845
|
}
|
|
1815
1846
|
.${vm.prefix}-summary-title{
|
|
1816
1847
|
width:606px;
|
|
@@ -1857,19 +1888,21 @@ export class OrderSetting {
|
|
|
1857
1888
|
|
|
1858
1889
|
.${vm.prefix}-dialog-ul{
|
|
1859
1890
|
padding:6px ;
|
|
1860
|
-
list-style:disc;
|
|
1861
1891
|
|
|
1862
1892
|
}
|
|
1863
1893
|
.${vm.prefix}-dialog-ul li{
|
|
1894
|
+
margin-bottom: 3px;
|
|
1864
1895
|
list-style:disc;
|
|
1865
1896
|
text-align:left;
|
|
1866
|
-
|
|
1897
|
+
white-space:break-spaces;
|
|
1867
1898
|
}
|
|
1868
1899
|
`);
|
|
1869
1900
|
};
|
|
1870
1901
|
|
|
1871
1902
|
const closeDialog = () => glitter.closeDiaLog();
|
|
1872
1903
|
|
|
1904
|
+
|
|
1905
|
+
|
|
1873
1906
|
const renderHeader = (gvc: GVC) =>
|
|
1874
1907
|
gvc.bindView({
|
|
1875
1908
|
bind: ids.header,
|
|
@@ -1906,22 +1939,88 @@ export class OrderSetting {
|
|
|
1906
1939
|
dialog.checkYesOrNotWithCustomWidth({
|
|
1907
1940
|
callback: bool => {
|
|
1908
1941
|
if (bool) {
|
|
1942
|
+
// 定義 log 物件的型別介面
|
|
1943
|
+
interface StoreLog {
|
|
1944
|
+
[key: string]: number;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// 定義函式回傳值的型別介面
|
|
1948
|
+
interface DeductionResult {
|
|
1949
|
+
updatedLog: StoreLog; // 更新後的 log
|
|
1950
|
+
deductions: Record<string, number>; // 扣除紀錄,鍵是店鋪名稱,值是扣除的數量
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* 從商店 log 中扣除指定數量,優先從值較高的商店開始扣除。
|
|
1955
|
+
* @param log - 初始的 log 物件,將商店鍵 (string) 映射到值 (number)。
|
|
1956
|
+
* @param amountToDeduct - 要扣除的總數量。
|
|
1957
|
+
* @returns 一個包含更新後 log 和扣除紀錄的物件。
|
|
1958
|
+
*/
|
|
1959
|
+
function deductFromStoresTS(log: StoreLog, amountToDeduct: number): DeductionResult {
|
|
1960
|
+
// 1. 創建一個 log 的可變副本,並確保輸入數量有效
|
|
1961
|
+
const updatedLog: StoreLog = { ...log }; // 確保型別一致
|
|
1962
|
+
const deductions: Record<string, number> = {}; // 扣除紀錄的型別
|
|
1963
|
+
let remainingAmount: number = Math.max(0, amountToDeduct); // 確保數量不為負
|
|
1964
|
+
|
|
1965
|
+
// 2. 將 log 轉換為 [string, number] 陣列,並按值降序排序
|
|
1966
|
+
// Object.entries 會根據 StoreLog 型別推斷出 [string, number][]
|
|
1967
|
+
const sortedEntries: [string, number][] = Object.entries(updatedLog).sort(
|
|
1968
|
+
([, valueA], [, valueB]) => valueB - valueA
|
|
1969
|
+
);
|
|
1970
|
+
|
|
1971
|
+
// 3. 遍歷排序後的條目並執行扣除
|
|
1972
|
+
for (const [storeKey, storeValue] of sortedEntries) {
|
|
1973
|
+
// 如果剩餘待扣除數量已歸零,則停止迴圈
|
|
1974
|
+
if (remainingAmount <= 0) {
|
|
1975
|
+
break;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
// 如果當前商店的值小於或等於零,則跳過
|
|
1979
|
+
if (storeValue <= 0) {
|
|
1980
|
+
continue;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
// 確定從這個特定商店扣除的數量
|
|
1984
|
+
const amountDeductedFromThisStore: number = Math.min(remainingAmount, storeValue);
|
|
1985
|
+
|
|
1986
|
+
// 只有當實際扣除數量大於 0 時才執行更新和記錄
|
|
1987
|
+
if (amountDeductedFromThisStore > 0) {
|
|
1988
|
+
// 更新副本 log 物件中的值
|
|
1989
|
+
updatedLog[storeKey] -= amountDeductedFromThisStore;
|
|
1990
|
+
|
|
1991
|
+
// 記錄扣除資訊
|
|
1992
|
+
deductions[storeKey] = amountDeductedFromThisStore;
|
|
1993
|
+
|
|
1994
|
+
// 減少剩餘待扣除的數量
|
|
1995
|
+
remainingAmount -= amountDeductedFromThisStore;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
// 4. 返回更新後的 log (副本) 和扣除紀錄
|
|
2000
|
+
return {
|
|
2001
|
+
updatedLog: updatedLog,
|
|
2002
|
+
deductions: deductions,
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
//處理每件商品在原訂單上的庫存
|
|
1909
2007
|
orderData.lineItems.forEach((lineItem: any, index: number) => {
|
|
1910
2008
|
let count = 0;
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2009
|
+
splitOrderArray.forEach(order => {
|
|
2010
|
+
lineItem.count -= order.lineItems[index].count;
|
|
2011
|
+
const resultTS: DeductionResult = deductFromStoresTS(
|
|
2012
|
+
lineItem.deduction_log,
|
|
2013
|
+
order.lineItems[index].count
|
|
2014
|
+
);
|
|
2015
|
+
order.lineItems[index].deduction_log = resultTS.deductions as any;
|
|
2016
|
+
lineItem.deduction_log = resultTS.updatedLog;
|
|
2017
|
+
});
|
|
1915
2018
|
});
|
|
1916
2019
|
const passData = {
|
|
1917
2020
|
orderData: orderData,
|
|
1918
2021
|
splitOrderArray: splitOrderArray,
|
|
1919
2022
|
};
|
|
1920
2023
|
|
|
1921
|
-
ApiShop.combineOrder(vm.dataObject).then(r => {
|
|
1922
|
-
if (r.result && r.response) {
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
2024
|
dialog.dataLoading({ visible: true });
|
|
1926
2025
|
ApiShop.splitOrder(passData).then(r => {
|
|
1927
2026
|
if (r.result && r.response) {
|
|
@@ -1943,14 +2042,26 @@ export class OrderSetting {
|
|
|
1943
2042
|
gvc.bindView({
|
|
1944
2043
|
bind: ids.footer,
|
|
1945
2044
|
view: () => {
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
2045
|
+
let allOrdersHaveZeroItems = false;
|
|
2046
|
+
let origQtyZero = true;
|
|
2047
|
+
let iSplitQtyCount = 0;
|
|
2048
|
+
splitOrderArray.forEach(splitOrder => {
|
|
2049
|
+
if (splitOrder.lineItems.every(item => item.count === 0)) {
|
|
2050
|
+
allOrdersHaveZeroItems = true;
|
|
2051
|
+
}
|
|
2052
|
+
iSplitQtyCount += splitOrder.lineItems.reduce((count, lineItem) => {
|
|
2053
|
+
return (count += lineItem.count);
|
|
2054
|
+
}, 0);
|
|
2055
|
+
});
|
|
2056
|
+
const iQtyCount = dataArray.reduce((iCount, lineItem) => {
|
|
2057
|
+
return (iCount += lineItem.count);
|
|
2058
|
+
}, 0);
|
|
2059
|
+
origQtyZero = iSplitQtyCount === iQtyCount;
|
|
1949
2060
|
let checkBTN = ``;
|
|
1950
|
-
if (
|
|
1951
|
-
checkBTN = BgWidget.save(gvc.event(handleSave), '拆分訂單');
|
|
1952
|
-
} else {
|
|
2061
|
+
if (allOrdersHaveZeroItems || origQtyZero) {
|
|
1953
2062
|
checkBTN = BgWidget.disableSave('拆分訂單');
|
|
2063
|
+
} else {
|
|
2064
|
+
checkBTN = BgWidget.save(gvc.event(handleSave), '拆分訂單');
|
|
1954
2065
|
}
|
|
1955
2066
|
|
|
1956
2067
|
return html` ${BgWidget.cancel(gvc.event(closeDialog))} ${checkBTN} `;
|
|
@@ -1971,56 +2082,55 @@ export class OrderSetting {
|
|
|
1971
2082
|
normal: '#393939',
|
|
1972
2083
|
};
|
|
1973
2084
|
|
|
1974
|
-
//
|
|
2085
|
+
// 拆單須知
|
|
1975
2086
|
const hits = [
|
|
1976
2087
|
'原訂單將保留剩餘商品,訂單金額與折扣將調整;子訂單將包含選定商品,並按比例分配優惠折扣',
|
|
1977
2088
|
'拆單後,運費及附加費用不變,將保留於原訂單內,若需要,請手動編輯訂單新增費用',
|
|
2089
|
+
'請務必進入每一張新的子訂單,為其中的所有商品選擇正確的出貨庫存',
|
|
1978
2090
|
];
|
|
1979
2091
|
return html`
|
|
1980
2092
|
<div class="row">
|
|
1981
|
-
|
|
1982
|
-
${
|
|
1983
|
-
<
|
|
1984
|
-
|
|
1985
|
-
<
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
詳細拆單規則
|
|
2019
|
-
</div>
|
|
2093
|
+
${BgWidget.mainCard(html`
|
|
2094
|
+
<div style="${phoneCardStyle}">
|
|
2095
|
+
<span class="tx_700">拆單需知</span>
|
|
2096
|
+
<div class="w-100 d-flex flex-column">
|
|
2097
|
+
<ul class="mt-2 ms-4 ${gClass('dialog-ul')}">
|
|
2098
|
+
${hits
|
|
2099
|
+
.map(hit => {
|
|
2100
|
+
return html` <li class="">${hit}</li>`;
|
|
2101
|
+
})
|
|
2102
|
+
.join('')}
|
|
2103
|
+
</ul>
|
|
2104
|
+
<div
|
|
2105
|
+
class="${gClass('split-rule')} ms-auto d-flex align-items-end justify-content-end"
|
|
2106
|
+
onclick="${gvc.event(() => {
|
|
2107
|
+
BgWidget.settingDialog({
|
|
2108
|
+
gvc: gvc,
|
|
2109
|
+
title: '拆單需知',
|
|
2110
|
+
width: 766,
|
|
2111
|
+
innerHTML: gvc => {
|
|
2112
|
+
return html` <ul class="${gClass('dialog-ul')}">
|
|
2113
|
+
<li>
|
|
2114
|
+
原訂單將保留剩餘商品,訂單金額與折扣將調整;子訂單將包含選定商品,並按比例分配優惠折扣
|
|
2115
|
+
</li>
|
|
2116
|
+
<li>拆單後運費及附加費用不變,將保留於原訂單內,如需更改,請手動編輯訂單新增費用</li>
|
|
2117
|
+
<li>子訂單會預設繼承母訂單的配送與付款方式,如需更改,請手動編輯訂單內容</li>
|
|
2118
|
+
<li>子訂單若要重新開立發票,請至發票頁面手動建立</li>
|
|
2119
|
+
<li>若發票已開立,系統不會自動作廢,需至訂單頁面手動作廢並重新開立</li>
|
|
2120
|
+
<li>代收金額將更新,已建立的出貨單需取消並重新建立</li>
|
|
2121
|
+
</ul>`;
|
|
2122
|
+
},
|
|
2123
|
+
footer_html: (gvc: GVC) => {
|
|
2124
|
+
return '';
|
|
2125
|
+
},
|
|
2126
|
+
});
|
|
2127
|
+
})}"
|
|
2128
|
+
>
|
|
2129
|
+
詳細拆單規則
|
|
2020
2130
|
</div>
|
|
2021
2131
|
</div>
|
|
2022
|
-
|
|
2023
|
-
|
|
2132
|
+
</div>
|
|
2133
|
+
`)}
|
|
2024
2134
|
</div>
|
|
2025
2135
|
`;
|
|
2026
2136
|
};
|
|
@@ -2030,6 +2140,7 @@ export class OrderSetting {
|
|
|
2030
2140
|
splitOrderArray.push(structuredClone(orderCreateUnit));
|
|
2031
2141
|
gvc.notifyDataChange([ids.itemList, ids.summary, ids.footer]);
|
|
2032
2142
|
}
|
|
2143
|
+
|
|
2033
2144
|
function drawSplitOrder() {
|
|
2034
2145
|
const titleDom = {
|
|
2035
2146
|
title: '子訂單數量',
|
|
@@ -2044,11 +2155,22 @@ export class OrderSetting {
|
|
|
2044
2155
|
return html`
|
|
2045
2156
|
<div class="d-flex flex-column">
|
|
2046
2157
|
<div class="${commonClass}" style="width: ${titleDom.width};${titleDom?.style ?? ''}">
|
|
2047
|
-
<div class="tx_700"
|
|
2158
|
+
<div class="tx_700">
|
|
2159
|
+
${titleDom.title}${index + 1}
|
|
2160
|
+
<i
|
|
2161
|
+
class="fa-solid fa-xmark cursor_pointer"
|
|
2162
|
+
onclick="${gvc.event(() => {
|
|
2163
|
+
if (splitOrderArray.length > 1) {
|
|
2164
|
+
splitOrderArray.splice(index, 1);
|
|
2165
|
+
gvc.notifyDataChange([ids.itemList, ids.summary, ids.footer]);
|
|
2166
|
+
}
|
|
2167
|
+
})}"
|
|
2168
|
+
></i>
|
|
2169
|
+
</div>
|
|
2048
2170
|
<div class="flex-fill"></div>
|
|
2049
2171
|
</div>
|
|
2050
2172
|
<div
|
|
2051
|
-
class="d-flex flex-column"
|
|
2173
|
+
class="d-flex flex-column flex-shrink-0"
|
|
2052
2174
|
style="width: ${titleDom.width};gap:16px;padding-top: 24px;${titleDom?.style ?? ''}"
|
|
2053
2175
|
>
|
|
2054
2176
|
${splitOrderArray[index].lineItems
|
|
@@ -2059,30 +2181,38 @@ export class OrderSetting {
|
|
|
2059
2181
|
style="${commonHeight};"
|
|
2060
2182
|
type="number"
|
|
2061
2183
|
value="${item.count}"
|
|
2062
|
-
min="0"
|
|
2063
2184
|
onchange="${gvc.event(e => {
|
|
2185
|
+
if (Number(e.value) < 0) {
|
|
2186
|
+
e.value = '0';
|
|
2187
|
+
}
|
|
2064
2188
|
const temp = structuredClone(item.count);
|
|
2065
2189
|
item.count = Number(e.value);
|
|
2066
2190
|
let nowQty = 0;
|
|
2067
|
-
splitOrderArray.forEach((
|
|
2068
|
-
nowQty +=
|
|
2191
|
+
splitOrderArray.forEach((splitOrder, index) => {
|
|
2192
|
+
nowQty += splitOrder.lineItems[itemIndex].count;
|
|
2069
2193
|
});
|
|
2070
|
-
|
|
2071
|
-
|
|
2194
|
+
//如果說over數量了 要改回來
|
|
2195
|
+
if (dataArray[itemIndex].count < nowQty) {
|
|
2072
2196
|
item.count = temp;
|
|
2197
|
+
e.value = temp;
|
|
2073
2198
|
}
|
|
2074
|
-
gvc.notifyDataChange([ids.
|
|
2199
|
+
gvc.notifyDataChange([ids.summary, ids.footer, 'oriQty']);
|
|
2075
2200
|
})}"
|
|
2076
2201
|
/>
|
|
2077
2202
|
`;
|
|
2078
2203
|
})
|
|
2079
2204
|
.join('')}
|
|
2080
2205
|
</div>
|
|
2206
|
+
<div
|
|
2207
|
+
class="d-flex flex-column flex-grow-1"
|
|
2208
|
+
style="width: ${titleDom.width};gap:16px;padding-top: 24px;${titleDom?.style ?? ''}"
|
|
2209
|
+
></div>
|
|
2081
2210
|
</div>
|
|
2082
2211
|
`;
|
|
2083
2212
|
})
|
|
2084
2213
|
.join('');
|
|
2085
2214
|
}
|
|
2215
|
+
|
|
2086
2216
|
const commonClass = 'd-flex align-items-center';
|
|
2087
2217
|
const commonHeight = 'height:40px;';
|
|
2088
2218
|
const addBTN = html`
|
|
@@ -2124,126 +2254,245 @@ export class OrderSetting {
|
|
|
2124
2254
|
htmlArray: [],
|
|
2125
2255
|
},
|
|
2126
2256
|
];
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
</div>
|
|
2170
|
-
`);
|
|
2171
|
-
break;
|
|
2172
|
-
}
|
|
2173
|
-
case 'totalQty': {
|
|
2174
|
-
dataRaw.htmlArray.push(html`
|
|
2175
|
-
<div
|
|
2176
|
-
class="tx_normal ${commonClass} justify-content-start"
|
|
2177
|
-
style="width: ${dataRaw.width};${commonHeight}"
|
|
2178
|
-
>
|
|
2179
|
-
${item.count}
|
|
2180
|
-
</div>
|
|
2181
|
-
`);
|
|
2182
|
-
break;
|
|
2183
|
-
}
|
|
2184
|
-
case 'oriQty': {
|
|
2185
|
-
let splitQty = 0;
|
|
2186
|
-
splitOrderArray.forEach(order => {
|
|
2187
|
-
splitQty += Number(order.lineItems[lineItemIndex].count);
|
|
2188
|
-
});
|
|
2189
|
-
const minusQtyClass = `${gClass('minusQty')} ${splitQty > 0 ? '' : 'd-none'}`;
|
|
2190
|
-
dataRaw.htmlArray.push(html`
|
|
2191
|
-
<div
|
|
2192
|
-
class="tx_normal ${commonClass} justify-content-start"
|
|
2193
|
-
style="width: ${dataRaw.width};${commonHeight}"
|
|
2194
|
-
>
|
|
2195
|
-
${item.count} <span class="${minusQtyClass}"> -> ${Number(item.count) - splitQty}</span>
|
|
2196
|
-
</div>
|
|
2197
|
-
`);
|
|
2198
|
-
break;
|
|
2257
|
+
|
|
2258
|
+
function drawLineItems(dataRaw: { title: string; key: string; width: string; style?: string }) {
|
|
2259
|
+
switch (dataRaw.key) {
|
|
2260
|
+
case 'name': {
|
|
2261
|
+
return dataArray
|
|
2262
|
+
.map((item, lineItemIndex) => {
|
|
2263
|
+
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2264
|
+
return html` <div class="${commonClass}" style="width: ${dataRaw.width};gap:12px;${commonHeight}">
|
|
2265
|
+
${BgWidget.validImageBox({
|
|
2266
|
+
gvc: gvc,
|
|
2267
|
+
image: item.preview_image ?? '',
|
|
2268
|
+
width: 42,
|
|
2269
|
+
})}
|
|
2270
|
+
<div class="d-flex flex-column flex-grow-1" style="gap:2px;">
|
|
2271
|
+
<div class="tx_normal_14" style="white-space: normal;line-height: normal;">
|
|
2272
|
+
${Tool.truncateString(item.title ?? '', 10)} -${spec}
|
|
2273
|
+
</div>
|
|
2274
|
+
<div class="tx_normal_14 ${gClass('font-gray')}">
|
|
2275
|
+
存貨單位 (SKU): ${item.sku && item.sku.length > 0 ? item.sku : '無SKU'}
|
|
2276
|
+
</div>
|
|
2277
|
+
</div>
|
|
2278
|
+
</div>`;
|
|
2279
|
+
})
|
|
2280
|
+
.join('');
|
|
2281
|
+
}
|
|
2282
|
+
case 'stock': {
|
|
2283
|
+
|
|
2284
|
+
if (storeList.length > 0) {
|
|
2285
|
+
return dataArray.map((item)=>{
|
|
2286
|
+
let maxEntry = {
|
|
2287
|
+
key:"",
|
|
2288
|
+
title: "",
|
|
2289
|
+
value: 0
|
|
2290
|
+
};
|
|
2291
|
+
console.log("item.deduction_log -- " , item.deduction_log);
|
|
2292
|
+
Object.entries(item.deduction_log).forEach((log:any)=>{
|
|
2293
|
+
if (maxEntry.value < log[1]){
|
|
2294
|
+
maxEntry = {
|
|
2295
|
+
key: log[0],
|
|
2296
|
+
title: log[0],
|
|
2297
|
+
value: log[1]
|
|
2298
|
+
}
|
|
2199
2299
|
}
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2300
|
+
})
|
|
2301
|
+
|
|
2302
|
+
maxEntry.title = storeList.find((store:any)=>{
|
|
2303
|
+
return store.id ==maxEntry.key
|
|
2304
|
+
}).name;
|
|
2305
|
+
return html`
|
|
2306
|
+
<div
|
|
2307
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2308
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2309
|
+
>
|
|
2310
|
+
${maxEntry.title??"出貨庫存錯誤"}
|
|
2311
|
+
</div>
|
|
2312
|
+
`;
|
|
2313
|
+
}).join('')
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
return html`
|
|
2317
|
+
<div
|
|
2318
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2319
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2320
|
+
>
|
|
2321
|
+
AA倉庫
|
|
2322
|
+
</div>
|
|
2323
|
+
`;
|
|
2324
|
+
}
|
|
2325
|
+
case 'price': {
|
|
2326
|
+
return dataArray
|
|
2327
|
+
.map((item, lineItemIndex) => {
|
|
2328
|
+
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2329
|
+
return html`
|
|
2330
|
+
<div
|
|
2331
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2332
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2333
|
+
>
|
|
2334
|
+
${item.sale_price}
|
|
2335
|
+
</div>
|
|
2336
|
+
`;
|
|
2202
2337
|
})
|
|
2203
|
-
.join('')
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2338
|
+
.join('');
|
|
2339
|
+
}
|
|
2340
|
+
case 'totalQty': {
|
|
2341
|
+
return dataArray
|
|
2342
|
+
.map((item, lineItemIndex) => {
|
|
2343
|
+
const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2344
|
+
return html`
|
|
2345
|
+
<div
|
|
2346
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2347
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2348
|
+
>
|
|
2349
|
+
${item.count}
|
|
2350
|
+
</div>
|
|
2351
|
+
`;
|
|
2352
|
+
})
|
|
2353
|
+
.join('');
|
|
2354
|
+
}
|
|
2355
|
+
case 'oriQty': {
|
|
2356
|
+
return dataArray
|
|
2357
|
+
.map((item, lineItemIndex) => {
|
|
2358
|
+
let splitQty = 0;
|
|
2359
|
+
splitOrderArray.forEach(order => {
|
|
2360
|
+
splitQty += Number(order.lineItems[lineItemIndex].count);
|
|
2361
|
+
});
|
|
2362
|
+
const minusQtyClass = `${gClass('minusQty')} ${splitQty > 0 ? '' : 'd-none'}`;
|
|
2363
|
+
return html`
|
|
2364
|
+
<div
|
|
2365
|
+
class="tx_normal ${commonClass} justify-content-start"
|
|
2366
|
+
style="width: ${dataRaw.width};${commonHeight}"
|
|
2367
|
+
>
|
|
2368
|
+
${item.count}
|
|
2369
|
+
<span class="${minusQtyClass}">
|
|
2370
|
+
<i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2371
|
+
>${Number(item.count) - splitQty}</span
|
|
2372
|
+
>
|
|
2373
|
+
</div>
|
|
2374
|
+
`;
|
|
2375
|
+
})
|
|
2376
|
+
.join('');
|
|
2377
|
+
}
|
|
2378
|
+
default: {
|
|
2379
|
+
return '';
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
//繪製各行lineitem的資料
|
|
2385
|
+
// dataArray.forEach((item, lineItemIndex) => {
|
|
2386
|
+
// // 由於是line優先 所以跑每一行所需要的資料 推進來
|
|
2387
|
+
// dataRaws
|
|
2388
|
+
// .map((dataRaw, dataRowIndex) => {
|
|
2389
|
+
// switch (dataRaw.key) {
|
|
2390
|
+
// case 'name': {
|
|
2391
|
+
// const spec = item.spec.length > 0 ? Tool.truncateString(item.spec.join(''), 5) : '單一規格';
|
|
2392
|
+
// dataRaw.htmlArray.push(
|
|
2393
|
+
// html` <div class="${commonClass}" style="width: ${dataRaw.width};gap:12px;${commonHeight}">
|
|
2394
|
+
// ${BgWidget.validImageBox({
|
|
2395
|
+
// gvc: gvc,
|
|
2396
|
+
// image: item.preview_image ?? '',
|
|
2397
|
+
// width: 42,
|
|
2398
|
+
// })}
|
|
2399
|
+
// <div class="d-flex flex-column flex-grow-1" style="gap:2px;">
|
|
2400
|
+
// <div class="tx_normal_14" style="white-space: normal;line-height: normal;">
|
|
2401
|
+
// ${Tool.truncateString(item.title ?? '', 10)} -${spec}
|
|
2402
|
+
// </div>
|
|
2403
|
+
// <div class="tx_normal_14 ${gClass('font-gray')}">存貨單位 (SKU): ${item.sku ?? '無SKU'}</div>
|
|
2404
|
+
// </div>
|
|
2405
|
+
// </div>`
|
|
2406
|
+
// );
|
|
2407
|
+
// break;
|
|
2408
|
+
// }
|
|
2409
|
+
//
|
|
2410
|
+
// case 'price': {
|
|
2411
|
+
// dataRaw.htmlArray.push(html`
|
|
2412
|
+
// <div
|
|
2413
|
+
// class="tx_normal ${commonClass} justify-content-start"
|
|
2414
|
+
// style="width: ${dataRaw.width};${commonHeight}"
|
|
2415
|
+
// >
|
|
2416
|
+
// ${item.sale_price}
|
|
2417
|
+
// </div>
|
|
2418
|
+
// `);
|
|
2419
|
+
// break;
|
|
2420
|
+
// }
|
|
2421
|
+
// case 'totalQty': {
|
|
2422
|
+
// dataRaw.htmlArray.push(html`
|
|
2423
|
+
// <div
|
|
2424
|
+
// class="tx_normal ${commonClass} justify-content-start"
|
|
2425
|
+
// style="width: ${dataRaw.width};${commonHeight}"
|
|
2426
|
+
// >
|
|
2427
|
+
// ${item.count}
|
|
2428
|
+
// </div>
|
|
2429
|
+
// `);
|
|
2430
|
+
// break;
|
|
2431
|
+
// }
|
|
2432
|
+
// case 'oriQty': {
|
|
2433
|
+
// let splitQty = 0;
|
|
2434
|
+
// splitOrderArray.forEach(order => {
|
|
2435
|
+
// splitQty += Number(order.lineItems[lineItemIndex].count);
|
|
2436
|
+
// });
|
|
2437
|
+
// const minusQtyClass = `${gClass('minusQty')} ${splitQty > 0 ? '' : 'd-none'}`;
|
|
2438
|
+
//
|
|
2439
|
+
// dataRaw.htmlArray.push(
|
|
2440
|
+
// gvc.bindView({
|
|
2441
|
+
// bind: ids.origQTY + `${lineItemIndex}`,
|
|
2442
|
+
// view: () => {
|
|
2443
|
+
// return `
|
|
2444
|
+
// ${item.count}
|
|
2445
|
+
// <span class="${minusQtyClass}">
|
|
2446
|
+
// <i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2447
|
+
// >${Number(item.count) - splitQty}</span
|
|
2448
|
+
// >
|
|
2449
|
+
// `;
|
|
2450
|
+
// },
|
|
2451
|
+
// divCreate: {
|
|
2452
|
+
// class: `tx_normal ${commonClass} justify-content-start`,
|
|
2453
|
+
// style: `width: ${dataRaw.width};${commonHeight}`,
|
|
2454
|
+
// },
|
|
2455
|
+
// })
|
|
2456
|
+
// );
|
|
2457
|
+
// break;
|
|
2458
|
+
// }
|
|
2459
|
+
// }
|
|
2460
|
+
// return html``;
|
|
2461
|
+
// })
|
|
2462
|
+
// .join('');
|
|
2463
|
+
// });
|
|
2207
2464
|
return html`
|
|
2208
2465
|
${dataRaws
|
|
2209
2466
|
.map(item => {
|
|
2210
2467
|
return html`
|
|
2211
|
-
<div class="d-flex flex-column">
|
|
2468
|
+
<div class="d-flex flex-column flex-shrink-0">
|
|
2212
2469
|
<div class="${commonClass}" style="width: ${item.width};${item?.style ?? ''}">
|
|
2213
2470
|
<div class="tx_700">${item.title}</div>
|
|
2214
2471
|
<div class="flex-fill"></div>
|
|
2215
2472
|
</div>
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2473
|
+
${gvc.bindView({
|
|
2474
|
+
bind: item.key,
|
|
2475
|
+
view: () => {
|
|
2476
|
+
return (
|
|
2477
|
+
drawLineItems(item) +
|
|
2478
|
+
html` <div class="${commonClass} mt-3" style="width: ${item.width};"></div>`
|
|
2479
|
+
);
|
|
2480
|
+
},
|
|
2481
|
+
divCreate: {
|
|
2482
|
+
class: 'd-flex flex-column',
|
|
2483
|
+
style: `width: ${item.width};gap:16px;padding-top: 24px;${item?.style ?? ''}`,
|
|
2484
|
+
},
|
|
2485
|
+
})}
|
|
2222
2486
|
</div>
|
|
2223
2487
|
`;
|
|
2224
2488
|
})
|
|
2225
2489
|
.join('')}
|
|
2226
|
-
|
|
2490
|
+
<div class="d-flex flex-shrink-0" style="overflow-x: scroll;gap:5px;">${drawSplitOrder()} ${addBTN}</div>
|
|
2227
2491
|
`;
|
|
2228
2492
|
},
|
|
2229
2493
|
divCreate: { style: '', class: `${gClass('itemList-section')}` },
|
|
2230
2494
|
});
|
|
2231
2495
|
};
|
|
2232
|
-
|
|
2233
|
-
const renderBlock = (gvc: GVC) => {
|
|
2234
|
-
const subBlock = splitOrderArray
|
|
2235
|
-
.map((order, index) => {
|
|
2236
|
-
return html`<div class="${gClass('summary-subSummary')}"></div>`;
|
|
2237
|
-
})
|
|
2238
|
-
.join('');
|
|
2239
|
-
return html`
|
|
2240
|
-
<div class="d-flex" style="height:27px;">
|
|
2241
|
-
<div class="${gClass('summary-title')}"></div>
|
|
2242
|
-
<div class="${gClass('summary-oriSummary')}"></div>
|
|
2243
|
-
${subBlock}
|
|
2244
|
-
</div>
|
|
2245
|
-
`;
|
|
2246
|
-
};
|
|
2247
2496
|
const renderSummary = (gvc: GVC) => {
|
|
2248
2497
|
return gvc.bindView({
|
|
2249
2498
|
bind: ids.summary,
|
|
@@ -2257,6 +2506,7 @@ export class OrderSetting {
|
|
|
2257
2506
|
})
|
|
2258
2507
|
.join('');
|
|
2259
2508
|
}
|
|
2509
|
+
|
|
2260
2510
|
function drawOriData(index: number) {
|
|
2261
2511
|
//原先訂單的商品價格
|
|
2262
2512
|
const sale_price = dataArray.reduce((total, data) => total + data.sale_price * Number(data.count), 0);
|
|
@@ -2270,8 +2520,8 @@ export class OrderSetting {
|
|
|
2270
2520
|
),
|
|
2271
2521
|
0
|
|
2272
2522
|
);
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2523
|
+
const split_discount = splitOrderArray.reduce((total, order) => total + order.discount, 0);
|
|
2524
|
+
|
|
2275
2525
|
switch (index) {
|
|
2276
2526
|
case 1:
|
|
2277
2527
|
//若是有修改價格 需藍字顯示出修改後內容
|
|
@@ -2294,7 +2544,7 @@ export class OrderSetting {
|
|
|
2294
2544
|
<div class="d-flex align-items-center">
|
|
2295
2545
|
<span class="text-decoration-line-through">-${orderData.discount}</span
|
|
2296
2546
|
><i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2297
|
-
><span class="${gClass('font-blue')}">-${discount}</span>
|
|
2547
|
+
><span class="${gClass('font-blue')}">-${orderData.discount - split_discount}</span>
|
|
2298
2548
|
</div>
|
|
2299
2549
|
`;
|
|
2300
2550
|
}
|
|
@@ -2306,7 +2556,10 @@ export class OrderSetting {
|
|
|
2306
2556
|
<span class="text-decoration-line-through">${orderData.total}</span
|
|
2307
2557
|
><i class="fa-solid fa-arrow-right ${gClass('font-blue')} ${gClass('summary-right')}"></i
|
|
2308
2558
|
><span class="${gClass('font-blue')}"
|
|
2309
|
-
>${sale_price -
|
|
2559
|
+
>${sale_price -
|
|
2560
|
+
split_price -
|
|
2561
|
+
(orderData.discount - split_discount) +
|
|
2562
|
+
orderData.shipment_fee}</span
|
|
2310
2563
|
>
|
|
2311
2564
|
</div>
|
|
2312
2565
|
`;
|
|
@@ -2314,6 +2567,7 @@ export class OrderSetting {
|
|
|
2314
2567
|
return orderData.total;
|
|
2315
2568
|
}
|
|
2316
2569
|
}
|
|
2570
|
+
|
|
2317
2571
|
//rawIndex 第幾列 決定要繪製什麼類型的資料
|
|
2318
2572
|
function drawSplitData(rawIndex: number) {
|
|
2319
2573
|
function drawUnit(order: OrderDetail, lineIndex: number) {
|
|
@@ -2337,6 +2591,7 @@ export class OrderSetting {
|
|
|
2337
2591
|
return order.total;
|
|
2338
2592
|
}
|
|
2339
2593
|
}
|
|
2594
|
+
|
|
2340
2595
|
//lineIndex 決定要把第幾個拆分訂單的資訊放進去
|
|
2341
2596
|
return splitOrderArray
|
|
2342
2597
|
.map((order, lineIndex) => {
|
|
@@ -2348,6 +2603,7 @@ export class OrderSetting {
|
|
|
2348
2603
|
})
|
|
2349
2604
|
.join('');
|
|
2350
2605
|
}
|
|
2606
|
+
|
|
2351
2607
|
const titleRaw = [
|
|
2352
2608
|
{ title: '', style: 'height:58px;' },
|
|
2353
2609
|
{ title: '小計總額' },
|
|
@@ -2388,21 +2644,36 @@ export class OrderSetting {
|
|
|
2388
2644
|
glitter.innerDialog((gvc: GVC) => {
|
|
2389
2645
|
const temp: DataMap = {};
|
|
2390
2646
|
applyClass();
|
|
2391
|
-
|
|
2392
2647
|
return gvc.bindView({
|
|
2393
2648
|
bind: ids.page,
|
|
2394
|
-
view: () =>
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2649
|
+
view: () => {
|
|
2650
|
+
|
|
2651
|
+
if (vm.loading) {
|
|
2652
|
+
glitter.share.loading_dialog.dataLoading({ text: '載入中...', visible: true });
|
|
2653
|
+
ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
|
|
2654
|
+
if (dd.result && dd.response.value) {
|
|
2655
|
+
storeList = dd.response.value.list;
|
|
2656
|
+
vm.loading = false;
|
|
2657
|
+
gvc.notifyDataChange(ids.page);
|
|
2658
|
+
}
|
|
2659
|
+
});
|
|
2660
|
+
}else {
|
|
2661
|
+
glitter.share.loading_dialog.dataLoading({ text: '載入中...', visible: false });
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
return html`
|
|
2665
|
+
<div class="d-flex flex-column ${gClass('full-screen')}">
|
|
2666
|
+
${renderHeader(gvc)}
|
|
2667
|
+
<div
|
|
2668
|
+
class="flex-fill scrollbar-appear"
|
|
2669
|
+
style="${isDesktop ? 'padding: 24px 32px;' : 'padding: 0 24px;'} overflow: scroll;"
|
|
2670
|
+
>
|
|
2671
|
+
${renderHint(gvc)} ${renderItemList(gvc)} ${renderSummary(gvc)}
|
|
2672
|
+
</div>
|
|
2673
|
+
${renderFooter(gvc)}
|
|
2402
2674
|
</div>
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
`,
|
|
2675
|
+
`;
|
|
2676
|
+
},
|
|
2406
2677
|
});
|
|
2407
2678
|
}, 'splitOrder');
|
|
2408
2679
|
}
|