@pisell/pisellos 2.2.174 → 2.2.175
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/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +17 -33
- package/dist/modules/Order/index.js +395 -757
- package/dist/modules/Order/types.d.ts +17 -58
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +1 -39
- package/dist/modules/Order/utils.js +31 -220
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +21 -23
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +6 -10
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +113 -130
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -53
- package/dist/solution/BaseSales/index.js +340 -1165
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -776
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +17 -33
- package/lib/modules/Order/index.js +148 -402
- package/lib/modules/Order/types.d.ts +17 -58
- package/lib/modules/Order/utils.d.ts +1 -39
- package/lib/modules/Order/utils.js +22 -198
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +15 -18
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +0 -2
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +20 -30
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -53
- package/lib/solution/BaseSales/index.js +22 -530
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -349
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -43,6 +43,8 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
43
43
|
const query = {};
|
|
44
44
|
if (params == null ? void 0 : params.channel)
|
|
45
45
|
query.channel = params.channel;
|
|
46
|
+
if (params == null ? void 0 : params.customer_id)
|
|
47
|
+
query.customer_id = String(params.customer_id);
|
|
46
48
|
if ((params == null ? void 0 : params.channel) === "online_store") {
|
|
47
49
|
query.channel = "online-store";
|
|
48
50
|
}
|
|
@@ -51,7 +53,10 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
51
53
|
query,
|
|
52
54
|
{ useCache: false }
|
|
53
55
|
);
|
|
54
|
-
const list =
|
|
56
|
+
const list = this.filterQuotationsByCustomer(
|
|
57
|
+
((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [],
|
|
58
|
+
params == null ? void 0 : params.customer_id
|
|
59
|
+
);
|
|
55
60
|
list.sort((a, b) => a.sort - b.sort);
|
|
56
61
|
this.store.list = list;
|
|
57
62
|
}
|
|
@@ -69,11 +74,9 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
69
74
|
getPriceForProduct(params) {
|
|
70
75
|
const { productId, variantId, datetime, customer_id } = params;
|
|
71
76
|
for (const quotation of this.store.list) {
|
|
72
|
-
|
|
73
|
-
if (!visible)
|
|
77
|
+
if (!this.isQuotationVisibleForCustomer(quotation, customer_id))
|
|
74
78
|
continue;
|
|
75
|
-
|
|
76
|
-
if (!active)
|
|
79
|
+
if (!this.isQuotationActiveAt(quotation, datetime))
|
|
77
80
|
continue;
|
|
78
81
|
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
79
82
|
if (!match)
|
|
@@ -125,6 +128,9 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
125
128
|
setScheduleResolver(resolver) {
|
|
126
129
|
this.scheduleResolver = resolver;
|
|
127
130
|
}
|
|
131
|
+
filterQuotationsByCustomer(list, customerId) {
|
|
132
|
+
return list.filter((quotation) => this.isQuotationVisibleForCustomer(quotation, customerId));
|
|
133
|
+
}
|
|
128
134
|
isQuotationVisibleForCustomer(quotation, customerId) {
|
|
129
135
|
const customers = quotation.customer || [];
|
|
130
136
|
if (customers.length === 0)
|
|
@@ -142,27 +148,18 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
142
148
|
var _a;
|
|
143
149
|
if (!((_a = quotation.schedule) == null ? void 0 : _a.length))
|
|
144
150
|
return false;
|
|
145
|
-
const scheduleItems =
|
|
146
|
-
quotation.schedule.forEach((s) => {
|
|
151
|
+
const scheduleItems = quotation.schedule.map((s) => {
|
|
147
152
|
var _a2;
|
|
148
153
|
const full = (_a2 = this.scheduleResolver) == null ? void 0 : _a2.call(this, s.id);
|
|
149
|
-
if (full)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
if (this.scheduleResolver) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const fallbackSchedule = {
|
|
154
|
+
if (full)
|
|
155
|
+
return full;
|
|
156
|
+
return {
|
|
157
157
|
...s,
|
|
158
158
|
repeat_type: s.repeat_type || "none",
|
|
159
159
|
repeat_rule: s.repeat_rule || null,
|
|
160
160
|
time_slot: s.time_slot || []
|
|
161
161
|
};
|
|
162
|
-
scheduleItems.push(fallbackSchedule);
|
|
163
162
|
});
|
|
164
|
-
if (!scheduleItems.length)
|
|
165
|
-
return false;
|
|
166
163
|
return (0, import_getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
|
|
167
164
|
}
|
|
168
165
|
findProductData(productData, productId, variantId) {
|
|
@@ -32,10 +32,6 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
|
|
|
32
32
|
unavailableReason?: UnavailableReason;
|
|
33
33
|
};
|
|
34
34
|
filterDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
35
|
-
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
36
|
-
excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
|
|
37
|
-
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
38
|
-
resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
|
|
39
35
|
private getUnavailableReason;
|
|
40
36
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
41
37
|
discountList: Discount[];
|
|
@@ -159,14 +159,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
159
159
|
filterDiscountListByType(discountList, type) {
|
|
160
160
|
return (discountList || []).filter((item) => item.type === type || item.tag === type);
|
|
161
161
|
}
|
|
162
|
-
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
163
|
-
excludeDiscountListByType(discountList, type) {
|
|
164
|
-
return (discountList || []).filter((item) => item.type !== type && item.tag !== type);
|
|
165
|
-
}
|
|
166
|
-
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
167
|
-
resolveDiscountListForManualOverride(discountList) {
|
|
168
|
-
return this.excludeDiscountListByType(discountList, "promotion");
|
|
169
|
-
}
|
|
170
162
|
// 获取券不可用的原因
|
|
171
163
|
getUnavailableReason(discountList, productList) {
|
|
172
164
|
var _a;
|
|
@@ -681,7 +673,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
681
673
|
}, 0);
|
|
682
674
|
};
|
|
683
675
|
sortedFlattenedList.forEach((flatItem, index) => {
|
|
684
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F
|
|
676
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
685
677
|
let product, originProduct;
|
|
686
678
|
if (flatItem.type === "main") {
|
|
687
679
|
product = flatItem.product;
|
|
@@ -904,7 +896,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
904
896
|
price: product.price,
|
|
905
897
|
options: restoredOptions
|
|
906
898
|
},
|
|
907
|
-
discount_list:
|
|
899
|
+
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
908
900
|
})
|
|
909
901
|
]);
|
|
910
902
|
} else {
|
|
@@ -926,14 +918,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
926
918
|
main_product_selling_price,
|
|
927
919
|
options: restoredOptions
|
|
928
920
|
},
|
|
929
|
-
discount_list:
|
|
921
|
+
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
930
922
|
})
|
|
931
923
|
]);
|
|
932
924
|
}
|
|
933
925
|
} else {
|
|
934
926
|
processedFlatItemsMap.set(flatItem._id, [{
|
|
935
927
|
...flatItem,
|
|
936
|
-
discount_list:
|
|
928
|
+
discount_list: this.filterDiscountListByType(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || [], "promotion"),
|
|
937
929
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
938
930
|
processed: true
|
|
939
931
|
}]);
|
|
@@ -984,13 +976,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
984
976
|
if (this.filterDiscountListByType(product.discount_list, "promotion").length && product.origin_total) {
|
|
985
977
|
productOriginTotal = product.origin_total;
|
|
986
978
|
}
|
|
987
|
-
if (Number(((
|
|
979
|
+
if (Number(((_w = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _w.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
|
|
988
980
|
productOriginTotal = product.total;
|
|
989
981
|
}
|
|
990
982
|
const isOrderLevel = (0, import_utils3.isOrderLevelFixedAmountDiscount)(selectedDiscount2);
|
|
991
983
|
const orderLevelAllocation = isOrderLevel ? orderLevelDiscountAllocations.get(selectedDiscount2.id) : null;
|
|
992
984
|
const productAllocation = orderLevelAllocation == null ? void 0 : orderLevelAllocation.get(flatItem._id);
|
|
993
|
-
const isDeductOptionPrice = !!((
|
|
985
|
+
const isDeductOptionPrice = !!((_x = selectedDiscount2.config) == null ? void 0 : _x.deductOptionPrice);
|
|
994
986
|
let mainProductSellingPrice;
|
|
995
987
|
let amount;
|
|
996
988
|
let productDiscountDifference;
|
|
@@ -1008,7 +1000,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1008
1000
|
);
|
|
1009
1001
|
amount = new import_decimal.default(product.price).minus(new import_decimal.default(mainProductSellingPrice)).toNumber();
|
|
1010
1002
|
}
|
|
1011
|
-
if (isDeductOptionPrice && ((
|
|
1003
|
+
if (isDeductOptionPrice && ((_y = product.options) == null ? void 0 : _y.length)) {
|
|
1012
1004
|
const optionResult = applyDiscountToOptions(
|
|
1013
1005
|
product.options,
|
|
1014
1006
|
selectedDiscount2
|
|
@@ -1016,7 +1008,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1016
1008
|
discountedOptions = optionResult.discountedOptions;
|
|
1017
1009
|
optionDiscountAmount = optionResult.optionDiscountAmount;
|
|
1018
1010
|
}
|
|
1019
|
-
const optionsForLineTotal = isDeductOptionPrice && ((
|
|
1011
|
+
const optionsForLineTotal = isDeductOptionPrice && ((_z = product.options) == null ? void 0 : _z.length) ? discountedOptions : product.options;
|
|
1020
1012
|
const optionsLineTotal = getOptionTotal(optionsForLineTotal || []);
|
|
1021
1013
|
const total = new import_decimal.default(mainProductSellingPrice).plus(optionsLineTotal).toNumber();
|
|
1022
1014
|
const mainProductDiscountAmount = amount;
|
|
@@ -1027,9 +1019,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1027
1019
|
amount: lineDiscountAmount,
|
|
1028
1020
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
|
|
1029
1021
|
discount: {
|
|
1030
|
-
discount_card_type: (
|
|
1022
|
+
discount_card_type: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_card_type,
|
|
1031
1023
|
fixed_amount: lineDiscountAmount,
|
|
1032
|
-
discount_calculation_mode: (
|
|
1024
|
+
discount_calculation_mode: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_calculation_mode,
|
|
1033
1025
|
resource_id: selectedDiscount2.id,
|
|
1034
1026
|
title: selectedDiscount2.format_title,
|
|
1035
1027
|
original_amount: product.price,
|
|
@@ -1111,7 +1103,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1111
1103
|
type: "good_pass",
|
|
1112
1104
|
discount: {
|
|
1113
1105
|
fixed_amount: product.origin_total,
|
|
1114
|
-
discount_calculation_mode: (
|
|
1106
|
+
discount_calculation_mode: (_C = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _C.discount_calculation_mode,
|
|
1115
1107
|
resource_id: selectedDiscount2.id,
|
|
1116
1108
|
title: selectedDiscount2.format_title,
|
|
1117
1109
|
original_amount: product.origin_total,
|
|
@@ -1185,9 +1177,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1185
1177
|
amount: fixedAmountPerItem * (product.num || 1),
|
|
1186
1178
|
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
1187
1179
|
discount: {
|
|
1188
|
-
discount_card_type: (
|
|
1180
|
+
discount_card_type: (_D = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _D.discount_card_type,
|
|
1189
1181
|
fixed_amount: fixedAmountPerItem,
|
|
1190
|
-
discount_calculation_mode: (
|
|
1182
|
+
discount_calculation_mode: (_E = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _E.discount_calculation_mode,
|
|
1191
1183
|
resource_id: selectedDiscount2.id,
|
|
1192
1184
|
title: selectedDiscount2.format_title,
|
|
1193
1185
|
original_amount: product.original_price,
|
|
@@ -1203,7 +1195,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1203
1195
|
...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
|
|
1204
1196
|
},
|
|
1205
1197
|
config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
|
|
1206
|
-
_num: (product.num || 1) * (((
|
|
1198
|
+
_num: (product.num || 1) * (((_F = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _F.num) || 1)
|
|
1207
1199
|
};
|
|
1208
1200
|
const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
|
|
1209
1201
|
appliedProducts.push(discountDetail);
|
|
@@ -30,8 +30,7 @@ __reExport(SalesSummary_exports, require("./types"), module.exports);
|
|
|
30
30
|
var salesSummaryDataKeys = {
|
|
31
31
|
isPriceIncludeTax: "is_price_include_tax",
|
|
32
32
|
taxRate: "tax_rate",
|
|
33
|
-
taxTitle: "tax_title"
|
|
34
|
-
taxCountryCode: "tax_country_code"
|
|
33
|
+
taxTitle: "tax_title"
|
|
35
34
|
};
|
|
36
35
|
var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
37
36
|
constructor(name, version) {
|
|
@@ -85,8 +84,7 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
85
84
|
return {
|
|
86
85
|
isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
|
|
87
86
|
taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
|
|
88
|
-
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
|
|
89
|
-
taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
|
|
87
|
+
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
90
|
async getSummary(params) {
|
|
@@ -135,9 +135,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
135
135
|
return dates;
|
|
136
136
|
}
|
|
137
137
|
getScheduleListByIds(ids) {
|
|
138
|
-
|
|
139
|
-
const list = this.store.scheduleList.filter((n) => idSet.has(String(n.id)));
|
|
140
|
-
return list;
|
|
138
|
+
return this.store.scheduleList.filter((n) => ids.includes(n.id));
|
|
141
139
|
}
|
|
142
140
|
setAvailabilityScheduleDateList(list) {
|
|
143
141
|
this.store.availabilityDateList = list;
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -34,7 +34,6 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
34
34
|
__reExport(modules_exports, require("./Quotation"), module.exports);
|
|
35
35
|
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
36
36
|
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
37
|
-
__reExport(modules_exports, require("./BookingContext"), module.exports);
|
|
38
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
38
|
0 && (module.exports = {
|
|
40
39
|
...require("./Product"),
|
|
@@ -54,6 +53,5 @@ __reExport(modules_exports, require("./BookingContext"), module.exports);
|
|
|
54
53
|
...require("./Schedule"),
|
|
55
54
|
...require("./Quotation"),
|
|
56
55
|
...require("./ScanOrderLogger"),
|
|
57
|
-
...require("./OpenData")
|
|
58
|
-
...require("./BookingContext")
|
|
56
|
+
...require("./OpenData")
|
|
59
57
|
});
|
package/lib/server/index.js
CHANGED
|
@@ -931,8 +931,6 @@ var Server = class {
|
|
|
931
931
|
return;
|
|
932
932
|
}
|
|
933
933
|
try {
|
|
934
|
-
await this.schedule.loadAllSchedule();
|
|
935
|
-
this.products.clearPriceCache();
|
|
936
934
|
await this.products.setupQuotationPriceBridge({
|
|
937
935
|
scheduleModule: this.schedule,
|
|
938
936
|
channel: (_a = this.core.context) == null ? void 0 : _a.channel
|
|
@@ -33,13 +33,6 @@ __export(filterOrders_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(filterOrders_exports);
|
|
35
35
|
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
-
function getOrderPaymentCodes(order) {
|
|
37
|
-
const payments = order.payments;
|
|
38
|
-
if (!Array.isArray(payments) || payments.length === 0) {
|
|
39
|
-
return [];
|
|
40
|
-
}
|
|
41
|
-
return payments.map((item) => item == null ? void 0 : item.code).filter((code) => typeof code === "string" && code.length > 0);
|
|
42
|
-
}
|
|
43
36
|
function filterOrders(orders, filters) {
|
|
44
37
|
const safeFilters = filters || {};
|
|
45
38
|
if (!orders || !Array.isArray(orders)) {
|
|
@@ -140,27 +133,26 @@ function filterOrders(orders, filters) {
|
|
|
140
133
|
}
|
|
141
134
|
}
|
|
142
135
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
143
|
-
|
|
144
|
-
if (orderPaymentCodes.length === 0) {
|
|
136
|
+
if (!order.payment_methods || !Array.isArray(order.payment_methods) || order.payment_methods.length === 0) {
|
|
145
137
|
rejected.push({
|
|
146
138
|
order_id: order.order_id,
|
|
147
139
|
order_number: order.order_number,
|
|
148
140
|
reason: {
|
|
149
141
|
field: "payment_methods",
|
|
150
|
-
actual: order.
|
|
142
|
+
actual: order.payment_methods,
|
|
151
143
|
expected: safeFilters.payment_methods
|
|
152
144
|
}
|
|
153
145
|
});
|
|
154
146
|
return false;
|
|
155
147
|
}
|
|
156
|
-
const hasMatch =
|
|
148
|
+
const hasMatch = order.payment_methods.some((pm) => safeFilters.payment_methods.includes(pm));
|
|
157
149
|
if (!hasMatch) {
|
|
158
150
|
rejected.push({
|
|
159
151
|
order_id: order.order_id,
|
|
160
152
|
order_number: order.order_number,
|
|
161
153
|
reason: {
|
|
162
154
|
field: "payment_methods",
|
|
163
|
-
actual:
|
|
155
|
+
actual: order.payment_methods,
|
|
164
156
|
expected: safeFilters.payment_methods
|
|
165
157
|
}
|
|
166
158
|
});
|
|
@@ -21,7 +21,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
21
21
|
private isPriceFormatterRegistered;
|
|
22
22
|
private quotationPriceBridge?;
|
|
23
23
|
private quotationBridgeChannel?;
|
|
24
|
-
private
|
|
24
|
+
private quotationBridgeCustomerId?;
|
|
25
25
|
private quotationBridgeRefreshPromise?;
|
|
26
26
|
private quotationBridgeRefreshKey?;
|
|
27
27
|
private productDataSource;
|
|
@@ -44,7 +44,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
44
44
|
this.formatters = [];
|
|
45
45
|
// 是否已注册内置价格格式化器
|
|
46
46
|
this.isPriceFormatterRegistered = false;
|
|
47
|
-
this.quotationBridgeLoadedKey = "";
|
|
48
47
|
this.pendingSyncMessages = [];
|
|
49
48
|
}
|
|
50
49
|
async initialize(core, options) {
|
|
@@ -178,7 +177,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
178
177
|
* Server 层负责传入完整 schedule 模块,Products 只负责把报价单计算结果转成价格响应形状。
|
|
179
178
|
*/
|
|
180
179
|
async setupQuotationPriceBridge(params) {
|
|
181
|
-
var _a;
|
|
180
|
+
var _a, _b, _c;
|
|
182
181
|
if (!this.core) {
|
|
183
182
|
this.logWarning("setupQuotationPriceBridge: core 尚未初始化");
|
|
184
183
|
return;
|
|
@@ -191,25 +190,15 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
191
190
|
this.quotationPriceBridge = quotation;
|
|
192
191
|
}
|
|
193
192
|
if (params.scheduleModule) {
|
|
194
|
-
const
|
|
195
|
-
|
|
193
|
+
const scheduleList = ((_c = (_b = params.scheduleModule).getScheduleList) == null ? void 0 : _c.call(_b)) || [];
|
|
194
|
+
const scheduleMap = new Map(
|
|
195
|
+
scheduleList.map((schedule) => [schedule.id, schedule])
|
|
196
|
+
);
|
|
196
197
|
this.quotationPriceBridge.setScheduleResolver((id) => {
|
|
197
|
-
var _a2,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (!hasLoadedScheduleList) {
|
|
202
|
-
const scheduleList = ((_b = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b.call(_a2)) || [];
|
|
203
|
-
for (const schedule of scheduleList) {
|
|
204
|
-
scheduleCache.set(String(schedule.id), schedule);
|
|
205
|
-
}
|
|
206
|
-
hasLoadedScheduleList = true;
|
|
207
|
-
}
|
|
208
|
-
if (scheduleCache.has(scheduleId))
|
|
209
|
-
return scheduleCache.get(scheduleId);
|
|
210
|
-
const schedules = ((_d = (_c = params.scheduleModule).getScheduleListByIds) == null ? void 0 : _d.call(_c, [id])) || ((_f = (_e = params.scheduleModule).getScheduleByIds) == null ? void 0 : _f.call(_e, [id])) || [];
|
|
211
|
-
if (schedules[0])
|
|
212
|
-
scheduleCache.set(scheduleId, schedules[0]);
|
|
198
|
+
var _a2, _b2;
|
|
199
|
+
if (scheduleMap.has(id))
|
|
200
|
+
return scheduleMap.get(id);
|
|
201
|
+
const schedules = ((_b2 = (_a2 = params.scheduleModule).getScheduleByIds) == null ? void 0 : _b2.call(_a2, [id])) || [];
|
|
213
202
|
return schedules[0];
|
|
214
203
|
});
|
|
215
204
|
}
|
|
@@ -221,7 +210,8 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
221
210
|
async refreshQuotationPriceBridge(params) {
|
|
222
211
|
if (!this.quotationPriceBridge)
|
|
223
212
|
return;
|
|
224
|
-
const
|
|
213
|
+
const customerId = params && "customer_id" in params ? params.customer_id : this.quotationBridgeCustomerId;
|
|
214
|
+
const refreshKey = this.getQuotationBridgeScopeKey(customerId);
|
|
225
215
|
if (this.quotationBridgeRefreshPromise && this.quotationBridgeRefreshKey === refreshKey) {
|
|
226
216
|
await this.quotationBridgeRefreshPromise;
|
|
227
217
|
return;
|
|
@@ -231,9 +221,10 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
231
221
|
}
|
|
232
222
|
this.quotationBridgeRefreshKey = refreshKey;
|
|
233
223
|
this.quotationBridgeRefreshPromise = this.quotationPriceBridge.loadQuotations({
|
|
234
|
-
channel: this.quotationBridgeChannel
|
|
224
|
+
channel: this.quotationBridgeChannel,
|
|
225
|
+
customer_id: customerId
|
|
235
226
|
}).then(() => {
|
|
236
|
-
this.
|
|
227
|
+
this.quotationBridgeCustomerId = customerId;
|
|
237
228
|
}).finally(() => {
|
|
238
229
|
this.quotationBridgeRefreshPromise = void 0;
|
|
239
230
|
this.quotationBridgeRefreshKey = void 0;
|
|
@@ -252,12 +243,12 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
252
243
|
if (this.quotationBridgeRefreshPromise) {
|
|
253
244
|
await this.quotationBridgeRefreshPromise;
|
|
254
245
|
}
|
|
255
|
-
if (this.getQuotationBridgeScopeKey() !== this.
|
|
246
|
+
if (this.getQuotationBridgeScopeKey(customerId) !== this.getQuotationBridgeScopeKey(this.quotationBridgeCustomerId)) {
|
|
256
247
|
await this.refreshQuotationPriceBridge({ customer_id: customerId });
|
|
257
248
|
}
|
|
258
249
|
}
|
|
259
|
-
getQuotationBridgeScopeKey() {
|
|
260
|
-
return this.quotationBridgeChannel || ""
|
|
250
|
+
getQuotationBridgeScopeKey(customerId) {
|
|
251
|
+
return `${this.quotationBridgeChannel || ""}:${customerId ?? ""}`;
|
|
261
252
|
}
|
|
262
253
|
buildPriceDataFromQuotation(product, datetime, customerId) {
|
|
263
254
|
var _a;
|
|
@@ -267,11 +258,10 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
267
258
|
customer_id: customerId
|
|
268
259
|
});
|
|
269
260
|
const productPrice = quotedPrice ?? product.price;
|
|
270
|
-
const productBasePrice = quotedPrice ?? product.base_price ?? product.price ?? 0;
|
|
271
261
|
return {
|
|
272
262
|
id: product.id,
|
|
273
263
|
price: String(productPrice ?? 0),
|
|
274
|
-
base_price: String(
|
|
264
|
+
base_price: String(product.base_price ?? product.price ?? 0),
|
|
275
265
|
variant: this.buildVariantPriceData(product, datetime, customerId),
|
|
276
266
|
bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
|
|
277
267
|
};
|
|
@@ -288,7 +278,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
288
278
|
customer_id: customerId
|
|
289
279
|
});
|
|
290
280
|
const price = quotedPrice ?? variant.price ?? product.price ?? 0;
|
|
291
|
-
const basePrice =
|
|
281
|
+
const basePrice = variant.base_price ?? variant.price ?? product.base_price ?? product.price ?? 0;
|
|
292
282
|
return {
|
|
293
283
|
id: Number(variant.id),
|
|
294
284
|
product_id: Number(variant.product_id ?? product.id),
|
|
@@ -313,7 +303,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
313
303
|
customer_id: customerId
|
|
314
304
|
});
|
|
315
305
|
const price = quotedPrice ?? item.price ?? 0;
|
|
316
|
-
const basePrice =
|
|
306
|
+
const basePrice = item.base_price ?? item.price ?? 0;
|
|
317
307
|
return {
|
|
318
308
|
id: Number(item.id),
|
|
319
309
|
product_id: Number(item.product_id ?? product.id),
|
|
@@ -183,9 +183,8 @@ var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
|
|
|
183
183
|
return [];
|
|
184
184
|
}
|
|
185
185
|
const result = [];
|
|
186
|
-
const scheduleList = this.store.scheduleList || [];
|
|
187
186
|
for (const id of ids) {
|
|
188
|
-
const schedule = this.store.map.get(id)
|
|
187
|
+
const schedule = this.store.map.get(id);
|
|
189
188
|
if (schedule) {
|
|
190
189
|
result.push(schedule);
|
|
191
190
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus,
|
|
3
|
+
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesScanCodeResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput,
|
|
5
|
+
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateProductInOrderParams } 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';
|
|
@@ -11,7 +11,6 @@ import { ProductList } from '../../modules/ProductList';
|
|
|
11
11
|
import { PaymentModule } from '../../modules/Payment';
|
|
12
12
|
import type { SalesSummaryModule } from '../../modules/SalesSummary';
|
|
13
13
|
import type { ScheduleModule } from '../../modules/Schedule';
|
|
14
|
-
import { QuotationModule } from '../../modules/Quotation';
|
|
15
14
|
import type { ISalesDetail, ISalesDetailHeader, ISalesBooking, ISalesPayment, ISalesSurcharge } from './utils/parseSalesResponse';
|
|
16
15
|
import { type TransformBaseProductToOrderProductParams } from './utils/transformBaseProductToOrderProduct';
|
|
17
16
|
export interface BaseSalesState {
|
|
@@ -20,7 +19,6 @@ export interface BaseSalesState {
|
|
|
20
19
|
payment?: PaymentModule;
|
|
21
20
|
salesSummary?: SalesSummaryModule;
|
|
22
21
|
schedule?: ScheduleModule;
|
|
23
|
-
quotation?: QuotationModule;
|
|
24
22
|
}
|
|
25
23
|
export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
26
24
|
protected defaultName: string;
|
|
@@ -28,7 +26,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
28
26
|
isSolution: boolean;
|
|
29
27
|
protected initializeOptions: ModuleOptions;
|
|
30
28
|
private logger;
|
|
31
|
-
private appPlugin;
|
|
32
29
|
protected store: BaseSalesState;
|
|
33
30
|
protected otherParams: Record<string, any>;
|
|
34
31
|
protected cacheId: string | undefined;
|
|
@@ -39,12 +36,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
39
36
|
window: WindowPlugin;
|
|
40
37
|
request: RequestPlugin;
|
|
41
38
|
protected currentSalesDetail: ISalesDetail | null;
|
|
42
|
-
protected discountConfigCacheKey: string | null;
|
|
43
|
-
protected hasManualDiscountSelection: boolean;
|
|
44
39
|
constructor(name?: string, version?: string);
|
|
45
40
|
/**
|
|
46
41
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
47
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment
|
|
42
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
48
43
|
*/
|
|
49
44
|
protected getRegisteredModuleNames(): readonly string[];
|
|
50
45
|
/**
|
|
@@ -60,10 +55,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
60
55
|
*/
|
|
61
56
|
private logError;
|
|
62
57
|
get payment(): PaymentModule | undefined;
|
|
63
|
-
private getCurrentOrderCustomerId;
|
|
64
|
-
private applyQuotationScheduleResolver;
|
|
65
|
-
private loadQuotationForPriceQuery;
|
|
66
|
-
protected getSubmitOrderSalesChannel(): string | undefined;
|
|
67
58
|
/**
|
|
68
59
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
69
60
|
* 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
|
|
@@ -76,8 +67,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
76
67
|
* sessionStorage 损坏时静默忽略,按空状态注册。
|
|
77
68
|
*/
|
|
78
69
|
protected readSessionCacheData(): Record<string, any>;
|
|
79
|
-
private getAppData;
|
|
80
|
-
private syncAppDataToTempOrder;
|
|
81
70
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
82
71
|
destroy(): Promise<void>;
|
|
83
72
|
/**
|
|
@@ -102,59 +91,27 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
102
91
|
getPayments(): ISalesPayment[];
|
|
103
92
|
/** 获取附加费用(运费/服务费/税费等)。 */
|
|
104
93
|
getSurcharges(): ISalesSurcharge[];
|
|
105
|
-
getTempOrder(): OrderTempOrder | null;
|
|
106
|
-
replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
|
|
94
|
+
getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
|
|
107
95
|
getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
|
|
108
96
|
getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
|
|
109
97
|
getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
|
|
110
98
|
getOrderAmountSnapshot(): import("../../modules/Order/types").OrderAmountSnapshot | null;
|
|
111
99
|
getTempOrderNote(): string;
|
|
112
100
|
updateTempOrderNote(note: string): string;
|
|
113
|
-
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
114
|
-
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
115
|
-
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
116
101
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
117
102
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
118
|
-
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
119
|
-
setEnableTempOrderPersist(enabled: boolean): void;
|
|
120
|
-
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
121
|
-
isTempOrderPersistEnabled(): boolean;
|
|
122
103
|
private ensureTempOrder;
|
|
123
|
-
addNewOrder(): Promise<OrderTempOrder>;
|
|
104
|
+
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
124
105
|
saveDraft(): Promise<void>;
|
|
125
|
-
restoreOrder(): Promise<OrderTempOrder>;
|
|
126
|
-
/**
|
|
127
|
-
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
128
|
-
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
129
|
-
*/
|
|
130
|
-
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
106
|
+
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
131
107
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
132
108
|
getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
|
|
133
|
-
private getHistoricalProductDiscountList;
|
|
134
|
-
private isPersistedOrderProduct;
|
|
135
|
-
private mergeHistoricalDiscountList;
|
|
136
|
-
private mergeCurrentDiscountSelectionState;
|
|
137
|
-
loadDiscountConfig(params?: {
|
|
138
|
-
customerId?: number;
|
|
139
|
-
action?: 'create' | 'edit';
|
|
140
|
-
}): Promise<{
|
|
141
|
-
productList: Record<string, any>[];
|
|
142
|
-
discountList: Discount[];
|
|
143
|
-
}>;
|
|
144
|
-
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
145
|
-
productList: Record<string, any>[];
|
|
146
|
-
discountList: Discount[];
|
|
147
|
-
}>;
|
|
148
109
|
getDiscountList(): Discount[];
|
|
149
110
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
150
111
|
setDiscountSelected(params: {
|
|
151
112
|
discountId: number;
|
|
152
113
|
isSelected: boolean;
|
|
153
114
|
}): Promise<void>;
|
|
154
|
-
applyDiscountCalculationResult(result?: {
|
|
155
|
-
productList?: Record<string, any>[];
|
|
156
|
-
discountList?: Discount[];
|
|
157
|
-
}): Promise<void>;
|
|
158
115
|
submitScanOrder<T = any>(params?: {
|
|
159
116
|
payments?: OrderPaymentSource[];
|
|
160
117
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -226,11 +183,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
226
183
|
submitBeforeSend?: boolean;
|
|
227
184
|
}): Promise<T>;
|
|
228
185
|
transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
|
|
229
|
-
calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
230
186
|
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
231
|
-
|
|
232
|
-
updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
233
|
-
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
187
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
234
188
|
/**
|
|
235
189
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
236
190
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|