@pisell/pisellos 2.2.292 → 2.2.293
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/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +108 -65
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/modules/BookingContext/index.d.ts +3 -0
- package/dist/modules/BookingContext/index.js +42 -13
- package/dist/modules/BookingContext/types.d.ts +4 -4
- package/dist/modules/BookingContext/types.js +3 -3
- package/dist/modules/OpenData/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +19 -4
- package/dist/modules/Order/index.js +885 -485
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +93 -5
- package/dist/modules/Order/types.js +5 -0
- package/dist/modules/Order/utils.d.ts +12 -0
- package/dist/modules/Order/utils.js +96 -31
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/dist/modules/ProductList/clientDataVariants.js +216 -0
- package/dist/modules/ProductList/index.d.ts +18 -3
- package/dist/modules/ProductList/index.js +220 -38
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/Quotation/index.d.ts +22 -0
- package/dist/modules/Quotation/index.js +293 -28
- package/dist/modules/ResourcePlanner/index.d.ts +0 -22
- package/dist/modules/ResourcePlanner/index.js +1 -180
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/localClock.js +183 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
- package/dist/modules/ResourcePlanner/planner.js +2111 -958
- package/dist/modules/ResourcePlanner/types.d.ts +359 -187
- package/dist/modules/ResourcePlanner/types.js +33 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +17 -2
- package/dist/server/index.js +1134 -932
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/products/index.d.ts +10 -4
- package/dist/server/modules/products/index.js +177 -84
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/server/utils/product.d.ts +1 -1
- package/dist/server/utils/product.js +186 -22
- package/dist/server/utils/small-ticket.d.ts +9 -1
- package/dist/server/utils/small-ticket.js +136 -41
- package/dist/solution/BaseSales/index.d.ts +26 -3
- package/dist/solution/BaseSales/index.js +1384 -905
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +10 -3
- package/dist/solution/BaseSales/utils.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +4 -4
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -3
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/types.d.ts +2 -0
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +8 -3
- package/dist/solution/UnifiedBookingSales/index.d.ts +128 -74
- package/dist/solution/UnifiedBookingSales/index.js +3877 -963
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +161 -77
- package/dist/solution/UnifiedBookingSales/types.js +4 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -0
- package/dist/solution/VenueBooking/index.js +549 -497
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +15 -0
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/modules/BookingContext/index.d.ts +3 -0
- package/lib/modules/BookingContext/index.js +35 -8
- package/lib/modules/BookingContext/types.d.ts +4 -4
- package/lib/modules/BookingContext/types.js +3 -3
- package/lib/modules/OpenData/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +19 -4
- package/lib/modules/Order/index.js +325 -28
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +93 -5
- package/lib/modules/Order/types.js +4 -0
- package/lib/modules/Order/utils.d.ts +12 -0
- package/lib/modules/Order/utils.js +85 -16
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/lib/modules/ProductList/clientDataVariants.js +204 -0
- package/lib/modules/ProductList/index.d.ts +18 -3
- package/lib/modules/ProductList/index.js +137 -8
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/Quotation/index.d.ts +22 -0
- package/lib/modules/Quotation/index.js +158 -11
- package/lib/modules/ResourcePlanner/index.d.ts +0 -22
- package/lib/modules/ResourcePlanner/index.js +9 -129
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/localClock.js +205 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
- package/lib/modules/ResourcePlanner/planner.js +1807 -783
- package/lib/modules/ResourcePlanner/types.d.ts +359 -187
- package/lib/modules/ResourcePlanner/types.js +13 -1
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +17 -2
- package/lib/server/index.js +149 -21
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +60 -7
- package/lib/server/modules/menu/index.js +26 -4
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +194 -57
- package/lib/server/modules/products/index.d.ts +10 -4
- package/lib/server/modules/products/index.js +93 -23
- package/lib/server/modules/resource/index.js +12 -2
- package/lib/server/utils/product.d.ts +1 -1
- package/lib/server/utils/product.js +163 -3
- package/lib/server/utils/small-ticket.d.ts +9 -1
- package/lib/server/utils/small-ticket.js +126 -33
- package/lib/solution/BaseSales/index.d.ts +26 -3
- package/lib/solution/BaseSales/index.js +396 -70
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -2
- package/lib/solution/BaseSales/utils.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +4 -4
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +5 -2
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/types.d.ts +2 -0
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +4 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +128 -74
- package/lib/solution/UnifiedBookingSales/index.js +2592 -424
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +316 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +161 -77
- package/lib/solution/UnifiedBookingSales/types.js +4 -6
- package/lib/solution/VenueBooking/index.d.ts +3 -0
- package/lib/solution/VenueBooking/index.js +33 -9
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/lib/utils/platform.d.ts +8 -0
- package/lib/utils/platform.js +22 -0
- package/package.json +1 -1
|
@@ -32,6 +32,7 @@ const LABELS = {
|
|
|
32
32
|
orderDiscount: 'Order discount',
|
|
33
33
|
manualDiscount: 'Manual discount',
|
|
34
34
|
payProcessingFee: 'Pay processing fee',
|
|
35
|
+
surchargeIncluded: 'Surcharge(Included)',
|
|
35
36
|
rounding: 'Rounding',
|
|
36
37
|
gross: 'Gross',
|
|
37
38
|
tare: 'Tare'
|
|
@@ -58,6 +59,7 @@ const LABELS = {
|
|
|
58
59
|
orderDiscount: '整单折扣',
|
|
59
60
|
manualDiscount: '手动折扣',
|
|
60
61
|
payProcessingFee: '支付手续费',
|
|
62
|
+
surchargeIncluded: '手续费(已含)',
|
|
61
63
|
rounding: '抹零',
|
|
62
64
|
gross: '重量',
|
|
63
65
|
tare: '去皮'
|
|
@@ -84,6 +86,7 @@ const LABELS = {
|
|
|
84
86
|
orderDiscount: '整單折扣',
|
|
85
87
|
manualDiscount: '手動折扣',
|
|
86
88
|
payProcessingFee: '支付手續費',
|
|
89
|
+
surchargeIncluded: '手續費(已含)',
|
|
87
90
|
rounding: '抹零',
|
|
88
91
|
gross: '重量',
|
|
89
92
|
tare: '去皮'
|
|
@@ -141,6 +144,11 @@ function buildLocaleData(params) {
|
|
|
141
144
|
locale,
|
|
142
145
|
currencySymbol
|
|
143
146
|
}),
|
|
147
|
+
wallets: buildWallets({
|
|
148
|
+
order,
|
|
149
|
+
locale,
|
|
150
|
+
currencySymbol
|
|
151
|
+
}),
|
|
144
152
|
tickets: Array.isArray(order.tickets) ? order.tickets : [],
|
|
145
153
|
source_shop: [],
|
|
146
154
|
refund_data: [],
|
|
@@ -166,7 +174,10 @@ function buildBaseData(params) {
|
|
|
166
174
|
is_repeat: 0,
|
|
167
175
|
buzzer: stringify(order.buzzer || order.pickup_number || order.metadata?.buzzer),
|
|
168
176
|
order_no: orderNumber,
|
|
169
|
-
order_time: formatDateTime(order.created_at || order.sales_time || new Date(), locale)
|
|
177
|
+
order_time: formatDateTime(order.created_at || order.sales_time || new Date(), locale),
|
|
178
|
+
...(isPresentId(order.updated_at) ? {
|
|
179
|
+
updated_at: formatDateTime(order.updated_at, locale)
|
|
180
|
+
} : {})
|
|
170
181
|
};
|
|
171
182
|
}
|
|
172
183
|
function buildProducts(order, locale, productMap) {
|
|
@@ -200,6 +211,8 @@ function buildProducts(order, locale, productMap) {
|
|
|
200
211
|
parentProduct,
|
|
201
212
|
locale
|
|
202
213
|
});
|
|
214
|
+
const productUid = firstPresentValue(product.metadata?.unique_identification_number, product.unique_identification_number);
|
|
215
|
+
const bookingUid = firstPresentValue(product.booking_uid, product.metadata?.booking_uid);
|
|
203
216
|
const extensionList = buildProductExtensionList({
|
|
204
217
|
product,
|
|
205
218
|
locale,
|
|
@@ -214,6 +227,12 @@ function buildProducts(order, locale, productMap) {
|
|
|
214
227
|
original_price: formatMoney(originalPrice, currencySymbol),
|
|
215
228
|
total_original_price: formatMoney(new _decimal.default(toMoneyNumber(originalPrice)).mul(quantity), currencySymbol),
|
|
216
229
|
extension_list: extensionList,
|
|
230
|
+
...(isPresentId(productUid) ? {
|
|
231
|
+
product_uid: productUid
|
|
232
|
+
} : {}),
|
|
233
|
+
...(isPresentId(bookingUid) ? {
|
|
234
|
+
booking_uid: bookingUid
|
|
235
|
+
} : {}),
|
|
217
236
|
...(options.length ? {
|
|
218
237
|
options
|
|
219
238
|
} : {}),
|
|
@@ -579,6 +598,9 @@ function isNonZeroId(value) {
|
|
|
579
598
|
function isPresentId(value) {
|
|
580
599
|
return value !== undefined && value !== null && value !== '';
|
|
581
600
|
}
|
|
601
|
+
function firstPresentValue(...values) {
|
|
602
|
+
return values.find(value => isPresentId(value));
|
|
603
|
+
}
|
|
582
604
|
function isSameId(left, right) {
|
|
583
605
|
if (!isPresentId(left) || !isPresentId(right)) return false;
|
|
584
606
|
return String(left) === String(right);
|
|
@@ -647,12 +669,13 @@ function buildFees(params) {
|
|
|
647
669
|
});
|
|
648
670
|
}
|
|
649
671
|
const productExpectAmount = summary.product_expect_amount || summary.product_amount || order.product_expect_amount;
|
|
650
|
-
const productOriginalAmount = summary.product_original_amount
|
|
672
|
+
const productOriginalAmount = firstPresentValue(summary.product_original_amount, order.product_original_amount) ?? calculateProductOriginalAmount(order);
|
|
651
673
|
const totalSavingsAmount = new _decimal.default(toMoneyNumber(productOriginalAmount)).minus(toMoneyNumber(productExpectAmount)).plus(toMoneyNumber(discountAmount));
|
|
652
674
|
return {
|
|
653
675
|
fees,
|
|
654
676
|
countFee: {
|
|
655
677
|
total_amount: formatMoney(summary.total_amount || order.total_amount, currencySymbol),
|
|
678
|
+
original_item_amount: formatMoney(productOriginalAmount, currencySymbol),
|
|
656
679
|
product_expect_amount: formatMoney(productExpectAmount, currencySymbol),
|
|
657
680
|
expect_amount: formatMoney(summary.expect_amount || order.expect_amount || summary.total_amount || order.total_amount, currencySymbol),
|
|
658
681
|
product_quantity: toNumber(summary.product_quantity || products.reduce((sum, product) => sum + product.product_quantity, 0), 0),
|
|
@@ -675,6 +698,13 @@ function buildFees(params) {
|
|
|
675
698
|
}
|
|
676
699
|
};
|
|
677
700
|
}
|
|
701
|
+
function calculateProductOriginalAmount(order) {
|
|
702
|
+
return normalizeArray(order.products).reduce((total, product) => {
|
|
703
|
+
const quantity = toNumber(product.product_quantity ?? product.quantity ?? product.num ?? 1, 1);
|
|
704
|
+
const originalPrice = product.original_price ?? product.selling_price ?? product.payment_price ?? product.price ?? 0;
|
|
705
|
+
return total.plus(new _decimal.default(toMoneyNumber(originalPrice)).mul(quantity));
|
|
706
|
+
}, new _decimal.default(0));
|
|
707
|
+
}
|
|
678
708
|
function buildCustomer(order, locale) {
|
|
679
709
|
return [{
|
|
680
710
|
item: label(locale, 'contactName'),
|
|
@@ -712,6 +742,27 @@ function buildDelivery(order, locale) {
|
|
|
712
742
|
return items;
|
|
713
743
|
}
|
|
714
744
|
function buildAppointment(order, locale) {
|
|
745
|
+
const bookings = normalizeArray(order.bookings);
|
|
746
|
+
if (bookings.length) {
|
|
747
|
+
return bookings.map(booking => {
|
|
748
|
+
const snapshot = {
|
|
749
|
+
...booking
|
|
750
|
+
};
|
|
751
|
+
delete snapshot.product_uid;
|
|
752
|
+
delete snapshot.booking_uid;
|
|
753
|
+
const productUid = firstPresentValue(booking.product_uid, booking.metadata?.product_uid);
|
|
754
|
+
const bookingUid = firstPresentValue(booking.metadata?.unique_identification_number, booking.booking_uid);
|
|
755
|
+
return {
|
|
756
|
+
...snapshot,
|
|
757
|
+
...(isPresentId(productUid) ? {
|
|
758
|
+
product_uid: productUid
|
|
759
|
+
} : {}),
|
|
760
|
+
...(isPresentId(bookingUid) ? {
|
|
761
|
+
booking_uid: bookingUid
|
|
762
|
+
} : {})
|
|
763
|
+
};
|
|
764
|
+
});
|
|
765
|
+
}
|
|
715
766
|
const tableName = order.table_name || order.metadata?.table_name || order.metadata?.table?.name || order.form_data?.table_name;
|
|
716
767
|
if (!tableName) return [];
|
|
717
768
|
return [{
|
|
@@ -729,41 +780,81 @@ function buildResources(order, locale) {
|
|
|
729
780
|
}
|
|
730
781
|
function buildPaymentData(params) {
|
|
731
782
|
const payments = normalizeArray(params.order.payments);
|
|
732
|
-
return payments.filter(payment => isPrintablePayment(payment)).map(payment => {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
783
|
+
return payments.filter(payment => isPrintablePayment(payment)).map(payment => buildPaymentItems({
|
|
784
|
+
payment,
|
|
785
|
+
locale: params.locale,
|
|
786
|
+
currencySymbol: params.currencySymbol,
|
|
787
|
+
includeFundRecordBalance: false
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
790
|
+
function buildWallets(params) {
|
|
791
|
+
return normalizeArray(params.order.payments).filter(payment => isPrintablePayment(payment) && !!getFundRecord(payment)).map(payment => buildPaymentItems({
|
|
792
|
+
payment,
|
|
793
|
+
locale: params.locale,
|
|
794
|
+
currencySymbol: params.currencySymbol,
|
|
795
|
+
includeFundRecordBalance: true
|
|
796
|
+
}));
|
|
797
|
+
}
|
|
798
|
+
function buildPaymentItems(params) {
|
|
799
|
+
const {
|
|
800
|
+
payment,
|
|
801
|
+
locale,
|
|
802
|
+
currencySymbol,
|
|
803
|
+
includeFundRecordBalance
|
|
804
|
+
} = params;
|
|
805
|
+
const serviceFee = getPaymentServiceFee(payment);
|
|
806
|
+
const items = [{
|
|
807
|
+
item: paymentMethodName(payment, locale),
|
|
808
|
+
value: formatMoney(resolveReceiptPaymentAmount(payment, serviceFee), currencySymbol)
|
|
809
|
+
}];
|
|
810
|
+
if (serviceFee.gt(0)) {
|
|
754
811
|
items.push({
|
|
755
|
-
item:
|
|
756
|
-
value:
|
|
812
|
+
item: label(locale, 'surchargeIncluded'),
|
|
813
|
+
value: formatMoney(serviceFee, currencySymbol)
|
|
757
814
|
});
|
|
758
|
-
|
|
815
|
+
}
|
|
816
|
+
const fundRecord = getFundRecord(payment);
|
|
817
|
+
if (fundRecord) {
|
|
818
|
+
items.push(...buildFundRecordPaymentItems({
|
|
819
|
+
payment,
|
|
820
|
+
fundRecord,
|
|
821
|
+
locale,
|
|
822
|
+
currencySymbol,
|
|
823
|
+
includeBalance: includeFundRecordBalance
|
|
824
|
+
}));
|
|
825
|
+
} else {
|
|
826
|
+
const remainingAmount = payment.remaining_amount ?? payment.balance ?? payment.metadata?.remaining_amount;
|
|
827
|
+
if (remainingAmount !== undefined && remainingAmount !== null) {
|
|
828
|
+
items.push({
|
|
829
|
+
item: label(locale, 'remainingAmount'),
|
|
830
|
+
value: formatMoney(remainingAmount, currencySymbol)
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
items.push({
|
|
835
|
+
item: formatDateTime(payment.paid_at || payment.created_at || payment.updated_at || new Date(), locale),
|
|
836
|
+
value: ''
|
|
759
837
|
});
|
|
838
|
+
return items;
|
|
839
|
+
}
|
|
840
|
+
function getPaymentServiceFee(payment) {
|
|
841
|
+
return new _decimal.default(toMoneyNumber(payment.service_fee));
|
|
842
|
+
}
|
|
843
|
+
function resolveReceiptPaymentAmount(payment, serviceFee) {
|
|
844
|
+
const amount = new _decimal.default(toMoneyNumber(payment.amount ?? payment.origin_amount));
|
|
845
|
+
const hasAmount = payment.amount !== undefined && payment.amount !== null && payment.amount !== '';
|
|
846
|
+
const hasOriginAmount = payment.origin_amount !== undefined && payment.origin_amount !== null && payment.origin_amount !== '';
|
|
847
|
+
if (!hasAmount || !hasOriginAmount || serviceFee.lte(0)) return amount;
|
|
848
|
+
const originAmount = new _decimal.default(toMoneyNumber(payment.origin_amount));
|
|
849
|
+
return amount.eq(originAmount) ? amount.plus(serviceFee) : amount;
|
|
760
850
|
}
|
|
761
851
|
function buildFundRecordPaymentItems(params) {
|
|
762
852
|
const {
|
|
763
853
|
payment,
|
|
764
854
|
fundRecord,
|
|
765
855
|
locale,
|
|
766
|
-
currencySymbol
|
|
856
|
+
currencySymbol,
|
|
857
|
+
includeBalance
|
|
767
858
|
} = params;
|
|
768
859
|
const items = [];
|
|
769
860
|
const usingBeforeValue = fundRecord.using_before_value;
|
|
@@ -774,13 +865,15 @@ function buildFundRecordPaymentItems(params) {
|
|
|
774
865
|
item: label(locale, 'redeemPoints'),
|
|
775
866
|
value: trimDecimal(usedPoints)
|
|
776
867
|
});
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
868
|
+
if (includeBalance) {
|
|
869
|
+
items.push({
|
|
870
|
+
item: label(locale, 'remainingPoints'),
|
|
871
|
+
value: trimDecimal(new _decimal.default(toMoneyNumber(usingAfterValue)))
|
|
872
|
+
});
|
|
873
|
+
}
|
|
781
874
|
return items;
|
|
782
875
|
}
|
|
783
|
-
if (usingAfterValue !== undefined && usingAfterValue !== null) {
|
|
876
|
+
if (includeBalance && usingAfterValue !== undefined && usingAfterValue !== null) {
|
|
784
877
|
items.push({
|
|
785
878
|
item: label(locale, 'remainingAmount'),
|
|
786
879
|
value: formatMoney(usingAfterValue, currencySymbol)
|
|
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult, BaseSalesCashPaymentConfig, BaseSalesPayCashParams, BaseSalesPayCashResult, BaseSalesCommitPaymentMethodParams, BaseSalesCommitPaymentMethodResult, BaseSalesConfirmWalletPaymentResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions } from '../../modules/Order/types';
|
|
5
|
+
import type { AddProductBookingInput, AddProductToOrderOptions, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions, ReplaceTempOrderOptions, SalesNote, SalesNotesMutationSnapshot, SetSalesNoteInput, PickupReferenceMode, ShopServiceData, ShopServiceType } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
7
7
|
import type { Discount } from '../../modules/Discount/types';
|
|
8
8
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
@@ -129,8 +129,23 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
129
129
|
*/
|
|
130
130
|
protected preferAuthoritativeProductQueryPrice(): boolean;
|
|
131
131
|
private getPriceQuerySchedule;
|
|
132
|
+
private isCustomerUserPriceQuery;
|
|
133
|
+
private getPriceQueryScheduleList;
|
|
134
|
+
private buildPriceQueryPayload;
|
|
135
|
+
private getRawProductPriceSources;
|
|
136
|
+
private rememberRawProductPriceSources;
|
|
137
|
+
private getSelectedProductVariantId;
|
|
138
|
+
/**
|
|
139
|
+
* 将目录原始商品还原为本次选择的 SKU 基线。
|
|
140
|
+
*
|
|
141
|
+
* 这里绝不能复用已评估后的目录商品,否则从命中智能价切回不命中的
|
|
142
|
+
* 日期时会残留旧价格。套餐仅验证所选关系存在,最终仍由 merge 方法把
|
|
143
|
+
* 评估后的套餐价格映射回用户的选择数据。
|
|
144
|
+
*/
|
|
145
|
+
private prepareRawProductForPriceQuery;
|
|
146
|
+
private resolveLocalProductForPriceQuery;
|
|
132
147
|
private loadProductsForPriceQuery;
|
|
133
|
-
private
|
|
148
|
+
private resolveProductsForPriceQuery;
|
|
134
149
|
private getAuthoritativeBundleItems;
|
|
135
150
|
private findAuthoritativeBundleItem;
|
|
136
151
|
private getAuthoritativeBundleUnitPrice;
|
|
@@ -210,12 +225,20 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
210
225
|
getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
|
|
211
226
|
getOrderAmountSnapshot(): import("../../modules/Order/types").OrderAmountSnapshot | null;
|
|
212
227
|
getTempOrderNote(): string;
|
|
228
|
+
getSalesNotes(): SalesNote[];
|
|
229
|
+
createSalesNotesMutationSnapshot(): SalesNotesMutationSnapshot;
|
|
230
|
+
restoreSalesNotesMutationSnapshot(snapshot: SalesNotesMutationSnapshot): void;
|
|
231
|
+
setSalesNote(input: SetSalesNoteInput): Promise<SalesNote>;
|
|
232
|
+
removeSalesNote(uuid: string): Promise<void>;
|
|
233
|
+
clearSalesNotes(): Promise<void>;
|
|
213
234
|
updateTempOrderNote(note: string): string;
|
|
214
235
|
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
215
236
|
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
216
237
|
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
217
238
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
218
239
|
updateTempOrderDepositAmount(amount: string | number): OrderSummary;
|
|
240
|
+
setPickupReferenceMode(mode: PickupReferenceMode): ShopServiceData;
|
|
241
|
+
setServiceType(serviceType: ShopServiceType): ShopServiceData;
|
|
219
242
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
220
243
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
221
244
|
setEnableTempOrderPersist(enabled: boolean): void;
|
|
@@ -498,7 +521,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
498
521
|
getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
|
|
499
522
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
500
523
|
getLastGiftActions(): OrderLastGiftActions | null;
|
|
501
|
-
getProductList(): Promise<
|
|
524
|
+
getProductList(): Promise<import("../..").ProductData[] | undefined>;
|
|
502
525
|
getOtherParams(): Record<string, any>;
|
|
503
526
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
504
527
|
cover?: boolean;
|