@pisell/pisellos 2.2.180 → 2.2.182
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.js +4 -3
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +101 -10
- package/dist/modules/Order/index.js +1444 -490
- package/dist/modules/Order/types.d.ts +201 -18
- package/dist/modules/Order/types.js +31 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils.d.ts +83 -1
- package/dist/modules/Order/utils.js +405 -61
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +23 -21
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +43 -39
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/SalesSummary/utils.js +21 -7
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +87 -29
- package/dist/server/modules/order/index.d.ts +23 -0
- package/dist/server/modules/order/index.js +123 -46
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +130 -113
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +89 -7
- package/dist/solution/BaseSales/index.js +1489 -366
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1258 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +68 -16
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +152 -2
- package/dist/solution/BookingTicket/index.js +848 -184
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/cartView.js +4 -2
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/VenueBooking/index.d.ts +5 -2
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +271 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.js +5 -1
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +101 -10
- package/lib/modules/Order/index.js +751 -114
- package/lib/modules/Order/types.d.ts +201 -18
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils.d.ts +83 -1
- package/lib/modules/Order/utils.js +340 -22
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +18 -15
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +26 -27
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/utils.js +21 -7
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +41 -4
- package/lib/server/modules/order/index.d.ts +23 -0
- package/lib/server/modules/order/index.js +46 -14
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +30 -20
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +89 -7
- package/lib/solution/BaseSales/index.js +742 -23
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +836 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +71 -12
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +152 -2
- package/lib/solution/BookingTicket/index.js +389 -9
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/cartView.js +4 -2
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/VenueBooking/index.d.ts +5 -2
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +1 -1
|
@@ -78,22 +78,21 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
78
78
|
case 0:
|
|
79
79
|
query = {};
|
|
80
80
|
if (params !== null && params !== void 0 && params.channel) query.channel = params.channel;
|
|
81
|
-
if (params !== null && params !== void 0 && params.customer_id) query.customer_id = String(params.customer_id);
|
|
82
81
|
if ((params === null || params === void 0 ? void 0 : params.channel) === 'online_store') {
|
|
83
82
|
query.channel = 'online-store';
|
|
84
83
|
}
|
|
85
|
-
_context2.next =
|
|
84
|
+
_context2.next = 5;
|
|
86
85
|
return this.request.get('/quotation/available', query, {
|
|
87
86
|
useCache: false
|
|
88
87
|
});
|
|
89
|
-
case
|
|
88
|
+
case 5:
|
|
90
89
|
res = _context2.sent;
|
|
91
|
-
list =
|
|
90
|
+
list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
|
|
92
91
|
list.sort(function (a, b) {
|
|
93
92
|
return a.sort - b.sort;
|
|
94
93
|
});
|
|
95
94
|
this.store.list = list;
|
|
96
|
-
case
|
|
95
|
+
case 9:
|
|
97
96
|
case "end":
|
|
98
97
|
return _context2.stop();
|
|
99
98
|
}
|
|
@@ -130,8 +129,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
130
129
|
try {
|
|
131
130
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
132
131
|
var quotation = _step.value;
|
|
133
|
-
|
|
134
|
-
if (!
|
|
132
|
+
var visible = this.isQuotationVisibleForCustomer(quotation, customer_id);
|
|
133
|
+
if (!visible) continue;
|
|
134
|
+
var active = this.isQuotationActiveAt(quotation, datetime);
|
|
135
|
+
if (!active) continue;
|
|
135
136
|
var match = this.findProductData(quotation.product_data, productId, variantId);
|
|
136
137
|
if (!match) continue;
|
|
137
138
|
if (match.value === 0) continue;
|
|
@@ -218,14 +219,6 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
218
219
|
value: function setScheduleResolver(resolver) {
|
|
219
220
|
this.scheduleResolver = resolver;
|
|
220
221
|
}
|
|
221
|
-
}, {
|
|
222
|
-
key: "filterQuotationsByCustomer",
|
|
223
|
-
value: function filterQuotationsByCustomer(list, customerId) {
|
|
224
|
-
var _this2 = this;
|
|
225
|
-
return list.filter(function (quotation) {
|
|
226
|
-
return _this2.isQuotationVisibleForCustomer(quotation, customerId);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
222
|
}, {
|
|
230
223
|
key: "isQuotationVisibleForCustomer",
|
|
231
224
|
value: function isQuotationVisibleForCustomer(quotation, customerId) {
|
|
@@ -246,18 +239,27 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
246
239
|
key: "isQuotationActiveAt",
|
|
247
240
|
value: function isQuotationActiveAt(quotation, datetime) {
|
|
248
241
|
var _quotation$schedule,
|
|
249
|
-
|
|
242
|
+
_this2 = this;
|
|
250
243
|
if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
|
|
251
|
-
var scheduleItems =
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
|
|
244
|
+
var scheduleItems = [];
|
|
245
|
+
quotation.schedule.forEach(function (s) {
|
|
246
|
+
var _this2$scheduleResolv;
|
|
247
|
+
var full = (_this2$scheduleResolv = _this2.scheduleResolver) === null || _this2$scheduleResolv === void 0 ? void 0 : _this2$scheduleResolv.call(_this2, s.id);
|
|
248
|
+
if (full) {
|
|
249
|
+
scheduleItems.push(full);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (_this2.scheduleResolver) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
|
|
256
256
|
repeat_type: s.repeat_type || 'none',
|
|
257
257
|
repeat_rule: s.repeat_rule || null,
|
|
258
258
|
time_slot: s.time_slot || []
|
|
259
259
|
});
|
|
260
|
+
scheduleItems.push(fallbackSchedule);
|
|
260
261
|
});
|
|
262
|
+
if (!scheduleItems.length) return false;
|
|
261
263
|
return getDateIsInSchedule(datetime, scheduleItems);
|
|
262
264
|
}
|
|
263
265
|
}, {
|
|
@@ -32,6 +32,10 @@ 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[];
|
|
35
39
|
private getUnavailableReason;
|
|
36
40
|
calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
|
|
37
41
|
discountList: Discount[];
|
|
@@ -222,6 +222,22 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
222
222
|
return item.type === type || item.tag === type;
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
|
|
226
|
+
/** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
|
|
227
|
+
}, {
|
|
228
|
+
key: "excludeDiscountListByType",
|
|
229
|
+
value: function excludeDiscountListByType(discountList, type) {
|
|
230
|
+
return (discountList || []).filter(function (item) {
|
|
231
|
+
return item.type !== type && item.tag !== type;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
|
|
236
|
+
}, {
|
|
237
|
+
key: "resolveDiscountListForManualOverride",
|
|
238
|
+
value: function resolveDiscountListForManualOverride(discountList) {
|
|
239
|
+
return this.excludeDiscountListByType(discountList, 'promotion');
|
|
240
|
+
}
|
|
225
241
|
// 获取券不可用的原因
|
|
226
242
|
}, {
|
|
227
243
|
key: "getUnavailableReason",
|
|
@@ -760,7 +776,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
760
776
|
}
|
|
761
777
|
}
|
|
762
778
|
});
|
|
763
|
-
console.log('occupiedItems', occupiedItems, 'orderLevelDiscountApplicableItems', orderLevelDiscountApplicableItems);
|
|
764
779
|
|
|
765
780
|
// 🔥 第三步:识别 order_level 折扣卡并预计算分摊(排除被其他专属折扣卡占用的商品)
|
|
766
781
|
sortedDiscountList.forEach(function (discount) {
|
|
@@ -1208,7 +1223,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1208
1223
|
price: product.price,
|
|
1209
1224
|
options: restoredOptions
|
|
1210
1225
|
}), {}, {
|
|
1211
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1226
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1212
1227
|
}))]);
|
|
1213
1228
|
} else {
|
|
1214
1229
|
var _ref13, _product$_promotion$f, _product13, _product$origin_total;
|
|
@@ -1231,14 +1246,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1231
1246
|
main_product_selling_price: main_product_selling_price,
|
|
1232
1247
|
options: restoredOptions
|
|
1233
1248
|
}), {}, {
|
|
1234
|
-
discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1249
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1235
1250
|
}))]);
|
|
1236
1251
|
}
|
|
1237
1252
|
} else {
|
|
1238
|
-
var _flatItem$bundleItem8;
|
|
1253
|
+
var _flatItem$bundleItem8, _flatItem$bundleItem9;
|
|
1239
1254
|
// bundle子商品:保存到扁平化Map
|
|
1240
1255
|
processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1241
|
-
discount_list: _this3.
|
|
1256
|
+
discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this3.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
|
|
1242
1257
|
price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
|
|
1243
1258
|
processed: true
|
|
1244
1259
|
})]);
|
|
@@ -1847,7 +1862,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1847
1862
|
} else {
|
|
1848
1863
|
// 🔥 没有子商品被拆分,使用原有逻辑
|
|
1849
1864
|
mainProductArr.forEach(function (mainProduct) {
|
|
1850
|
-
var _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
|
|
1865
|
+
var _ref14, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
|
|
1851
1866
|
var mainProductData = _this3.hooks.getProduct(mainProduct);
|
|
1852
1867
|
|
|
1853
1868
|
// 重组bundle
|
|
@@ -1886,8 +1901,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1886
1901
|
});
|
|
1887
1902
|
}
|
|
1888
1903
|
|
|
1889
|
-
//
|
|
1890
|
-
|
|
1904
|
+
// 主商品已经在前面的 setProduct 中应用过折扣;这里只替换 bundle,
|
|
1905
|
+
// 避免把主商品 discount_list 再扣一次。
|
|
1906
|
+
var mainSellingPrice = (_ref14 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref14 !== void 0 ? _ref14 : 0;
|
|
1907
|
+
var newTotal = Number(mainSellingPrice || 0);
|
|
1891
1908
|
var newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
|
|
1892
1909
|
|
|
1893
1910
|
// 判断是否是手动折扣
|
|
@@ -1901,24 +1918,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1901
1918
|
newTotal = (_mainProductData$tota = mainProductData.total) !== null && _mainProductData$tota !== void 0 ? _mainProductData$tota : newTotal;
|
|
1902
1919
|
newOriginTotal = (_mainProductData$orig3 = mainProductData.origin_total) !== null && _mainProductData$orig3 !== void 0 ? _mainProductData$orig3 : newOriginTotal;
|
|
1903
1920
|
} else {
|
|
1904
|
-
//
|
|
1905
|
-
var _mainDiscountList = mainProductData.discount_list.filter(function (item) {
|
|
1906
|
-
var _item$metadata5;
|
|
1907
|
-
return !(item !== null && item !== void 0 && (_item$metadata5 = item.metadata) !== null && _item$metadata5 !== void 0 && _item$metadata5.custom_product_bundle_map_id);
|
|
1908
|
-
});
|
|
1909
|
-
|
|
1910
|
-
// 如果主商品本身有折扣,需要重新计算主商品价格
|
|
1911
|
-
if (_mainDiscountList && _mainDiscountList.length > 0) {
|
|
1912
|
-
var _Decimal$minus$toNumb3, _mainProductData$orig4;
|
|
1913
|
-
var _allDiscountAmount2 = getDiscountListAmount(_mainDiscountList);
|
|
1914
|
-
newTotal = (_Decimal$minus$toNumb3 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount2).toNumber()) !== null && _Decimal$minus$toNumb3 !== void 0 ? _Decimal$minus$toNumb3 : newTotal;
|
|
1915
|
-
newOriginTotal = (_mainProductData$orig4 = mainProductData.origin_total) !== null && _mainProductData$orig4 !== void 0 ? _mainProductData$orig4 : newOriginTotal;
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
// 累加bundle的价格(只累加一次)
|
|
1921
|
+
// 累加 bundle 的折后价格(只累加一次)
|
|
1919
1922
|
if (newBundle.length > 0) {
|
|
1920
1923
|
newBundle.forEach(function (item) {
|
|
1921
|
-
|
|
1924
|
+
var _item$bundle_selling_;
|
|
1925
|
+
var bundleSellingPrice = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price;
|
|
1926
|
+
newTotal += Number(bundleSellingPrice) * Number(item.num);
|
|
1922
1927
|
});
|
|
1923
1928
|
|
|
1924
1929
|
// 计算原始总价(不考虑折扣)
|
|
@@ -2020,7 +2025,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2020
2025
|
appliedProductDetails: []
|
|
2021
2026
|
});
|
|
2022
2027
|
});
|
|
2023
|
-
console.log(processedProductList, 'processedProductList');
|
|
2024
2028
|
return {
|
|
2025
2029
|
productList: processedProductList,
|
|
2026
2030
|
discountList: [].concat(editModeDiscount, _toConsumableArray(updatedDiscountList))
|
|
@@ -2047,14 +2051,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2047
2051
|
var ruleType = usageRules.type;
|
|
2048
2052
|
// 套餐适用范围配置
|
|
2049
2053
|
var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
|
|
2050
|
-
var
|
|
2051
|
-
scopeType =
|
|
2052
|
-
|
|
2053
|
-
exclude_bundle_product_ids =
|
|
2054
|
-
|
|
2055
|
-
include_bundle_product_ids =
|
|
2056
|
-
|
|
2057
|
-
filter =
|
|
2054
|
+
var _ref15 = packageScope || {},
|
|
2055
|
+
scopeType = _ref15.type,
|
|
2056
|
+
_ref15$exclude_bundle = _ref15.exclude_bundle_product_ids,
|
|
2057
|
+
exclude_bundle_product_ids = _ref15$exclude_bundle === void 0 ? [] : _ref15$exclude_bundle,
|
|
2058
|
+
_ref15$include_bundle = _ref15.include_bundle_product_ids,
|
|
2059
|
+
include_bundle_product_ids = _ref15$include_bundle === void 0 ? [] : _ref15$include_bundle,
|
|
2060
|
+
_ref15$filter = _ref15.filter,
|
|
2061
|
+
filter = _ref15$filter === void 0 ? 0 : _ref15$filter;
|
|
2058
2062
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2059
2063
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2060
2064
|
|
|
@@ -2069,10 +2073,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2069
2073
|
return true; // 单独购买时可用
|
|
2070
2074
|
}
|
|
2071
2075
|
if (isBundleItem) {
|
|
2072
|
-
var _flatItem$
|
|
2076
|
+
var _flatItem$bundleItem10, _flatItem$bundleItem11, _flatItem$originProdu, _flatItem$parentProdu10;
|
|
2073
2077
|
// 套餐中购买时,判断是否为原价
|
|
2074
|
-
var priceType = (_flatItem$
|
|
2075
|
-
var priceTypeExt = (_flatItem$
|
|
2078
|
+
var priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
|
|
2079
|
+
var priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
|
|
2076
2080
|
// 主商品id
|
|
2077
2081
|
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
|
|
2078
2082
|
// original_price 对应:
|
|
@@ -2139,10 +2143,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2139
2143
|
return false; // 单独购买时不可用
|
|
2140
2144
|
}
|
|
2141
2145
|
if (isBundleItem) {
|
|
2142
|
-
var _flatItem$
|
|
2146
|
+
var _flatItem$bundleItem12, _flatItem$bundleItem13;
|
|
2143
2147
|
// 套餐中购买时,判断是否为原价
|
|
2144
|
-
var _priceType = (_flatItem$
|
|
2145
|
-
var _priceTypeExt = (_flatItem$
|
|
2148
|
+
var _priceType = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type;
|
|
2149
|
+
var _priceTypeExt = (_flatItem$bundleItem13 = flatItem.bundleItem) === null || _flatItem$bundleItem13 === void 0 ? void 0 : _flatItem$bundleItem13.price_type_ext;
|
|
2146
2150
|
|
|
2147
2151
|
// original_price 对应:
|
|
2148
2152
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
@@ -27,7 +27,8 @@ export * from "./types";
|
|
|
27
27
|
var salesSummaryDataKeys = {
|
|
28
28
|
isPriceIncludeTax: 'is_price_include_tax',
|
|
29
29
|
taxRate: 'tax_rate',
|
|
30
|
-
taxTitle: 'tax_title'
|
|
30
|
+
taxTitle: 'tax_title',
|
|
31
|
+
taxCountryCode: 'tax_country_code'
|
|
31
32
|
};
|
|
32
33
|
export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
33
34
|
_inherits(SalesSummaryModule, _BaseModule);
|
|
@@ -135,7 +136,8 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
135
136
|
return {
|
|
136
137
|
isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
|
|
137
138
|
taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
|
|
138
|
-
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
|
|
139
|
+
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle),
|
|
140
|
+
taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
}, {
|
|
@@ -280,6 +280,7 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
280
280
|
isChargeTax: (_product$is_charge_ta2 = product.is_charge_tax) !== null && _product$is_charge_ta2 !== void 0 ? _product$is_charge_ta2 : 0
|
|
281
281
|
});
|
|
282
282
|
var mainTaxRounded = mainTaxPrecise.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
283
|
+
product.main_product_attached_bundle_tax_fee = mainTaxRounded.toFixed(2);
|
|
283
284
|
if (mainTaxPrecise.gt(0)) {
|
|
284
285
|
lastTaxableItem = {
|
|
285
286
|
type: 'main',
|
|
@@ -313,15 +314,16 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
313
314
|
var bundleQuantity = new Decimal(getSafeNum((_bundleItem$num2 = bundleItem.num) !== null && _bundleItem$num2 !== void 0 ? _bundleItem$num2 : bundleItem.quantity));
|
|
314
315
|
var bundlePrice = toDecimal((_ref4 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref4 !== void 0 ? _ref4 : 0);
|
|
315
316
|
var bundleOriginalPrice = toDecimal((_ref5 = (_ref6 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
317
|
+
var bundleSurchargeFee = toDecimal(bundleItem.surcharge_fee);
|
|
316
318
|
var bundleTaxPrecise = calculateSingleItemTax({
|
|
317
|
-
price: bundlePrice,
|
|
319
|
+
price: bundlePrice.plus(bundleSurchargeFee),
|
|
318
320
|
taxRate: rate,
|
|
319
321
|
isPriceIncludeTax: isPriceIncludeTax,
|
|
320
322
|
isChargeTax: (_ref7 = (_bundleItem$is_charge = bundleItem.is_charge_tax) !== null && _bundleItem$is_charge !== void 0 ? _bundleItem$is_charge : product.is_charge_tax) !== null && _ref7 !== void 0 ? _ref7 : 0
|
|
321
323
|
});
|
|
322
324
|
var bundleTaxRounded = bundleTaxPrecise.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
323
325
|
var bundleOrigTaxPrecise = calculateSingleItemTax({
|
|
324
|
-
price: bundleOriginalPrice,
|
|
326
|
+
price: bundleOriginalPrice.plus(bundleSurchargeFee),
|
|
325
327
|
taxRate: rate,
|
|
326
328
|
isPriceIncludeTax: isPriceIncludeTax,
|
|
327
329
|
isChargeTax: (_ref8 = (_bundleItem$is_charge2 = bundleItem.is_charge_tax) !== null && _bundleItem$is_charge2 !== void 0 ? _bundleItem$is_charge2 : product.is_charge_tax) !== null && _ref8 !== void 0 ? _ref8 : 0
|
|
@@ -444,8 +446,20 @@ export function calculateSalesSummary(params) {
|
|
|
444
446
|
isEdit: false
|
|
445
447
|
}) || 0);
|
|
446
448
|
for (var i = 0; i < products.length; i++) {
|
|
447
|
-
var
|
|
448
|
-
|
|
449
|
+
var sourceItem = surchargeServiceItems[i] || {};
|
|
450
|
+
var product = products[i];
|
|
451
|
+
product.surcharge_fee = sourceItem.surcharge_fee || 0;
|
|
452
|
+
var relationSurchargeIds = Array.isArray(sourceItem.relation_surcharge_ids) ? sourceItem.relation_surcharge_ids : [];
|
|
453
|
+
var hasSurcharge = new Decimal(product.surcharge_fee || 0).gt(0) || relationSurchargeIds.length > 0;
|
|
454
|
+
if (hasSurcharge) {
|
|
455
|
+
product.main_product_attached_bundle_surcharge_fee = toFixed2(product.surcharge_fee);
|
|
456
|
+
}
|
|
457
|
+
if (relationSurchargeIds.length > 0) {
|
|
458
|
+
product.relation_surcharge_ids = sourceItem.relation_surcharge_ids;
|
|
459
|
+
}
|
|
460
|
+
if (hasSurcharge && sourceItem.surcharge_rounding_remainder !== undefined) {
|
|
461
|
+
product.surcharge_rounding_remainder = sourceItem.surcharge_rounding_remainder;
|
|
462
|
+
}
|
|
449
463
|
}
|
|
450
464
|
var hasTaxRate = taxRate !== undefined && taxRate !== null && taxRate > 0;
|
|
451
465
|
var productTaxFee;
|
|
@@ -458,8 +472,8 @@ export function calculateSalesSummary(params) {
|
|
|
458
472
|
}, new Decimal(0));
|
|
459
473
|
}
|
|
460
474
|
var shopDiscountAmount = Decimal.max(new Decimal(Number(shopDiscount) || 0), 0);
|
|
461
|
-
var
|
|
462
|
-
var totalAmount = isPriceIncludeTax === 1 ?
|
|
475
|
+
var preTaxExpectAmount = Decimal.max(0, productAmount.plus(surchargeAmount).minus(shopDiscountAmount));
|
|
476
|
+
var totalAmount = isPriceIncludeTax === 1 ? preTaxExpectAmount : preTaxExpectAmount.plus(productTaxFee);
|
|
463
477
|
var deposit = calculateProductsDeposit(products);
|
|
464
478
|
return {
|
|
465
479
|
product_quantity: productQuantity,
|
|
@@ -475,7 +489,7 @@ export function calculateSalesSummary(params) {
|
|
|
475
489
|
discount_amount: toFixed2(Decimal.max(productOriginalAmount.minus(productAmount), 0).plus(shopDiscountAmount)),
|
|
476
490
|
deposit_amount: deposit ? deposit.total : '0.00',
|
|
477
491
|
deposit: deposit,
|
|
478
|
-
expect_amount: toFixed2(
|
|
492
|
+
expect_amount: toFixed2(totalAmount),
|
|
479
493
|
total_amount: toFixed2(totalAmount),
|
|
480
494
|
total_refund_amount: '0.00',
|
|
481
495
|
customer_paid_amount: '0.00',
|
|
@@ -205,9 +205,13 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
205
|
}, {
|
|
206
206
|
key: "getScheduleListByIds",
|
|
207
207
|
value: function getScheduleListByIds(ids) {
|
|
208
|
-
|
|
209
|
-
return
|
|
208
|
+
var idSet = new Set(ids.map(function (id) {
|
|
209
|
+
return String(id);
|
|
210
|
+
}));
|
|
211
|
+
var list = this.store.scheduleList.filter(function (n) {
|
|
212
|
+
return idSet.has(String(n.id));
|
|
210
213
|
});
|
|
214
|
+
return list;
|
|
211
215
|
}
|
|
212
216
|
}, {
|
|
213
217
|
key: "setAvailabilityScheduleDateList",
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -168,16 +168,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
168
168
|
*/
|
|
169
169
|
_defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
|
|
170
170
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
171
|
-
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, _ref3, callback, subscriberId;
|
|
171
|
+
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, _ref3, callback, subscriberId;
|
|
172
172
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
173
173
|
while (1) switch (_context.prev = _context.next) {
|
|
174
174
|
case 0:
|
|
175
175
|
url = _ref.url, method = _ref.method, data = _ref.data, config = _ref.config;
|
|
176
176
|
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
177
|
-
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id;
|
|
177
|
+
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id, ids = data.ids;
|
|
178
178
|
_ref3 = config || {}, callback = _ref3.callback, subscriberId = _ref3.subscriberId;
|
|
179
179
|
_this.logInfo('handleProductQuery: 开始处理商品查询请求', {
|
|
180
180
|
menu_list_ids: menu_list_ids,
|
|
181
|
+
ids: ids,
|
|
181
182
|
schedule_datetime: schedule_datetime,
|
|
182
183
|
schedule_date: schedule_date,
|
|
183
184
|
customer_id: customer_id
|
|
@@ -189,6 +190,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
189
190
|
callback: callback,
|
|
190
191
|
context: {
|
|
191
192
|
menu_list_ids: menu_list_ids,
|
|
193
|
+
ids: ids,
|
|
192
194
|
schedule_date: schedule_date,
|
|
193
195
|
schedule_datetime: schedule_datetime,
|
|
194
196
|
customer_id: customer_id
|
|
@@ -201,6 +203,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
201
203
|
}
|
|
202
204
|
return _context.abrupt("return", _this.computeProductQueryResult({
|
|
203
205
|
menu_list_ids: menu_list_ids,
|
|
206
|
+
ids: ids,
|
|
204
207
|
schedule_date: schedule_date,
|
|
205
208
|
schedule_datetime: schedule_datetime,
|
|
206
209
|
customer_id: customer_id
|
|
@@ -1608,26 +1611,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
1608
1611
|
case 6:
|
|
1609
1612
|
_context18.prev = 6;
|
|
1610
1613
|
_context18.next = 9;
|
|
1614
|
+
return this.schedule.loadAllSchedule();
|
|
1615
|
+
case 9:
|
|
1616
|
+
this.products.clearPriceCache();
|
|
1617
|
+
_context18.next = 12;
|
|
1611
1618
|
return this.products.setupQuotationPriceBridge({
|
|
1612
1619
|
scheduleModule: this.schedule,
|
|
1613
1620
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1614
1621
|
});
|
|
1615
|
-
case
|
|
1622
|
+
case 12:
|
|
1616
1623
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1617
|
-
_context18.next =
|
|
1624
|
+
_context18.next = 19;
|
|
1618
1625
|
break;
|
|
1619
|
-
case
|
|
1620
|
-
_context18.prev =
|
|
1626
|
+
case 15:
|
|
1627
|
+
_context18.prev = 15;
|
|
1621
1628
|
_context18.t0 = _context18["catch"](6);
|
|
1622
1629
|
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1623
1630
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1624
1631
|
error: errorMessage
|
|
1625
1632
|
});
|
|
1626
|
-
case
|
|
1633
|
+
case 19:
|
|
1627
1634
|
case "end":
|
|
1628
1635
|
return _context18.stop();
|
|
1629
1636
|
}
|
|
1630
|
-
}, _callee18, this, [[6,
|
|
1637
|
+
}, _callee18, this, [[6, 15]]);
|
|
1631
1638
|
}));
|
|
1632
1639
|
function setupProductsQuotationPriceBridge() {
|
|
1633
1640
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -3303,14 +3310,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3303
3310
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(context, options) {
|
|
3304
3311
|
var _menu_list_ids$length3,
|
|
3305
3312
|
_this6 = this;
|
|
3306
|
-
var tTotal, menu_list_ids, schedule_date, schedule_datetime, customer_id, product_id, _published$find, pid,
|
|
3313
|
+
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3307
3314
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3308
3315
|
while (1) switch (_context29.prev = _context29.next) {
|
|
3309
3316
|
case 0:
|
|
3310
3317
|
tTotal = performance.now();
|
|
3311
|
-
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
3318
|
+
menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
3319
|
+
queryIds = Array.isArray(ids) ? ids.map(function (id) {
|
|
3320
|
+
return Number(id);
|
|
3321
|
+
}).filter(function (id) {
|
|
3322
|
+
return Number.isFinite(id);
|
|
3323
|
+
}) : [];
|
|
3312
3324
|
this.logInfo('computeProductQueryResult 开始', {
|
|
3313
3325
|
menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
|
|
3326
|
+
ids: queryIds,
|
|
3314
3327
|
schedule_datetime: schedule_datetime,
|
|
3315
3328
|
schedule_date: schedule_date,
|
|
3316
3329
|
customer_id: customer_id,
|
|
@@ -3318,7 +3331,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3318
3331
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3319
3332
|
});
|
|
3320
3333
|
if (this.products) {
|
|
3321
|
-
_context29.next =
|
|
3334
|
+
_context29.next = 7;
|
|
3322
3335
|
break;
|
|
3323
3336
|
}
|
|
3324
3337
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
@@ -3329,22 +3342,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3329
3342
|
count: 0
|
|
3330
3343
|
}
|
|
3331
3344
|
});
|
|
3332
|
-
case
|
|
3333
|
-
if (!(
|
|
3345
|
+
case 7:
|
|
3346
|
+
if (!(queryIds.length > 0)) {
|
|
3334
3347
|
_context29.next = 18;
|
|
3335
3348
|
break;
|
|
3336
3349
|
}
|
|
3337
|
-
|
|
3350
|
+
uniqueIds = Array.from(new Set(queryIds));
|
|
3338
3351
|
_tPrice = performance.now();
|
|
3339
|
-
_context29.next =
|
|
3352
|
+
_context29.next = 12;
|
|
3353
|
+
return this.products.getProductsWithPrice(schedule_date, {
|
|
3354
|
+
scheduleModule: this.getSchedule(),
|
|
3355
|
+
schedule_datetime: schedule_datetime,
|
|
3356
|
+
customer_id: customer_id
|
|
3357
|
+
}, {
|
|
3358
|
+
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
3359
|
+
productIds: uniqueIds
|
|
3360
|
+
});
|
|
3361
|
+
case 12:
|
|
3362
|
+
productsWithPrice = _context29.sent;
|
|
3363
|
+
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
3364
|
+
count: productsWithPrice.length,
|
|
3365
|
+
ids: uniqueIds
|
|
3366
|
+
});
|
|
3367
|
+
_filteredProducts = productsWithPrice.filter(function (p) {
|
|
3368
|
+
return uniqueIds.includes(Number(p === null || p === void 0 ? void 0 : p.id));
|
|
3369
|
+
}).filter(function (p) {
|
|
3370
|
+
return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
|
|
3371
|
+
});
|
|
3372
|
+
perfMark('computeProductQueryResult', performance.now() - tTotal, {
|
|
3373
|
+
mode: 'ids',
|
|
3374
|
+
ids: uniqueIds,
|
|
3375
|
+
count: _filteredProducts.length
|
|
3376
|
+
});
|
|
3377
|
+
this.logInfo('computeProductQueryResult 完成(ids)', {
|
|
3378
|
+
ids: uniqueIds,
|
|
3379
|
+
count: _filteredProducts.length
|
|
3380
|
+
});
|
|
3381
|
+
return _context29.abrupt("return", {
|
|
3382
|
+
code: 200,
|
|
3383
|
+
data: {
|
|
3384
|
+
list: _filteredProducts,
|
|
3385
|
+
count: _filteredProducts.length
|
|
3386
|
+
},
|
|
3387
|
+
message: '',
|
|
3388
|
+
status: true
|
|
3389
|
+
});
|
|
3390
|
+
case 18:
|
|
3391
|
+
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3392
|
+
_context29.next = 30;
|
|
3393
|
+
break;
|
|
3394
|
+
}
|
|
3395
|
+
pid = Number(product_id);
|
|
3396
|
+
_tPrice2 = performance.now();
|
|
3397
|
+
_context29.next = 23;
|
|
3340
3398
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3341
3399
|
scheduleModule: this.getSchedule()
|
|
3342
3400
|
}, {
|
|
3343
3401
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3344
3402
|
});
|
|
3345
|
-
case
|
|
3403
|
+
case 23:
|
|
3346
3404
|
allProductsWithPrice = _context29.sent;
|
|
3347
|
-
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() -
|
|
3405
|
+
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
3348
3406
|
count: allProductsWithPrice.length,
|
|
3349
3407
|
productId: pid
|
|
3350
3408
|
});
|
|
@@ -3369,9 +3427,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3369
3427
|
message: item ? '' : '商品不存在或未发布',
|
|
3370
3428
|
status: true
|
|
3371
3429
|
});
|
|
3372
|
-
case
|
|
3430
|
+
case 30:
|
|
3373
3431
|
if (this.menu) {
|
|
3374
|
-
_context29.next =
|
|
3432
|
+
_context29.next = 33;
|
|
3375
3433
|
break;
|
|
3376
3434
|
}
|
|
3377
3435
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -3382,9 +3440,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3382
3440
|
count: 0
|
|
3383
3441
|
}
|
|
3384
3442
|
});
|
|
3385
|
-
case
|
|
3443
|
+
case 33:
|
|
3386
3444
|
if (this.schedule) {
|
|
3387
|
-
_context29.next =
|
|
3445
|
+
_context29.next = 36;
|
|
3388
3446
|
break;
|
|
3389
3447
|
}
|
|
3390
3448
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -3395,7 +3453,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3395
3453
|
count: 0
|
|
3396
3454
|
}
|
|
3397
3455
|
});
|
|
3398
|
-
case
|
|
3456
|
+
case 36:
|
|
3399
3457
|
activeMenuList = [];
|
|
3400
3458
|
if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
|
|
3401
3459
|
tMenu = performance.now();
|
|
@@ -3419,10 +3477,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3419
3477
|
});
|
|
3420
3478
|
tPrice = performance.now();
|
|
3421
3479
|
if (!(scopedProductIds.length > 0)) {
|
|
3422
|
-
_context29.next =
|
|
3480
|
+
_context29.next = 49;
|
|
3423
3481
|
break;
|
|
3424
3482
|
}
|
|
3425
|
-
_context29.next =
|
|
3483
|
+
_context29.next = 46;
|
|
3426
3484
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3427
3485
|
scheduleModule: this.getSchedule(),
|
|
3428
3486
|
schedule_datetime: schedule_datetime,
|
|
@@ -3431,13 +3489,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3431
3489
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
3432
3490
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
3433
3491
|
});
|
|
3434
|
-
case
|
|
3492
|
+
case 46:
|
|
3435
3493
|
_context29.t0 = _context29.sent;
|
|
3436
|
-
_context29.next =
|
|
3494
|
+
_context29.next = 50;
|
|
3437
3495
|
break;
|
|
3438
|
-
case
|
|
3496
|
+
case 49:
|
|
3439
3497
|
_context29.t0 = [];
|
|
3440
|
-
case
|
|
3498
|
+
case 50:
|
|
3441
3499
|
filteredProducts = _context29.t0;
|
|
3442
3500
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3443
3501
|
count: filteredProducts.length,
|
|
@@ -3480,7 +3538,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3480
3538
|
message: '',
|
|
3481
3539
|
status: true
|
|
3482
3540
|
});
|
|
3483
|
-
case
|
|
3541
|
+
case 62:
|
|
3484
3542
|
case "end":
|
|
3485
3543
|
return _context29.stop();
|
|
3486
3544
|
}
|