@pisell/pisellos 2.2.283 → 2.2.284
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.js +6 -10
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +64 -86
- package/dist/modules/Order/types.d.ts +1 -1
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Rules/index.js +1 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/modules/Summary/utils.d.ts +1 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +97 -129
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.js +2 -4
- package/dist/server/modules/products/index.js +24 -42
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BaseSales/index.js +100 -72
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/index.js +0 -2
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +131 -132
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +1 -0
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +122 -127
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +70 -76
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1728 -2123
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.d.ts +1 -1
- package/lib/modules/Order/types.js +87 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils.js +814 -647
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +113 -123
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +66 -100
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +60 -61
- package/lib/modules/ResourcePlanner/planner.js +346 -384
- package/lib/modules/ResourcePlanner/types.js +4 -16
- package/lib/modules/Rules/index.js +1218 -959
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +85 -90
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +355 -430
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.d.ts +1 -1
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +3027 -2655
- package/lib/server/modules/floor-plan/index.js +102 -123
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +758 -956
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.js +575 -459
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +213 -184
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.js +479 -456
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.js +1209 -1412
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.js +650 -502
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
- package/lib/solution/BaseSales/utils.js +158 -143
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/index.js +594 -514
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +225 -187
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +328 -324
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +832 -864
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +409 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.js +437 -487
- package/lib/solution/UnifiedBookingSales/types.js +12 -31
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
package/dist/core/index.js
CHANGED
|
@@ -45,7 +45,6 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
45
45
|
this.serverOptions = options.server;
|
|
46
46
|
}
|
|
47
47
|
this.initialize(options);
|
|
48
|
-
console.log('constructor123456543');
|
|
49
48
|
}
|
|
50
49
|
_createClass(PisellOSCore, [{
|
|
51
50
|
key: "initialize",
|
|
@@ -107,21 +106,20 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
107
106
|
_context.next = 16;
|
|
108
107
|
return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
|
|
109
108
|
case 16:
|
|
110
|
-
console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
|
|
111
109
|
this.log('[PisellOS] Server 初始化完成');
|
|
112
|
-
_context.next =
|
|
110
|
+
_context.next = 24;
|
|
113
111
|
break;
|
|
114
|
-
case
|
|
115
|
-
_context.prev =
|
|
112
|
+
case 19:
|
|
113
|
+
_context.prev = 19;
|
|
116
114
|
_context.t0 = _context["catch"](6);
|
|
117
115
|
console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
|
|
118
116
|
this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
|
|
119
117
|
throw _context.t0;
|
|
120
|
-
case
|
|
118
|
+
case 24:
|
|
121
119
|
case "end":
|
|
122
120
|
return _context.stop();
|
|
123
121
|
}
|
|
124
|
-
}, _callee, this, [[6,
|
|
122
|
+
}, _callee, this, [[6, 19]]);
|
|
125
123
|
}));
|
|
126
124
|
function initializeServer(_x) {
|
|
127
125
|
return _initializeServer.apply(this, arguments);
|
|
@@ -139,11 +137,10 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
139
137
|
var prefix = '[PisellOS]';
|
|
140
138
|
switch (level) {
|
|
141
139
|
case 'info':
|
|
142
|
-
console.log("".concat(prefix, " ").concat(message));
|
|
143
140
|
break;
|
|
144
141
|
case 'warn':
|
|
145
142
|
// 使用 console.log 避免显示堆栈跟踪,提升性能
|
|
146
|
-
|
|
143
|
+
|
|
147
144
|
break;
|
|
148
145
|
case 'error':
|
|
149
146
|
console.error("".concat(prefix, " ").concat(message));
|
|
@@ -250,7 +247,6 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
250
247
|
}
|
|
251
248
|
// 预先给模块初始化值系统
|
|
252
249
|
var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
|
|
253
|
-
console.log('core 检测到模块值更新', module.name, path, value);
|
|
254
250
|
_this3.effects.emit("".concat(module.name, ":changed"), {
|
|
255
251
|
path: path,
|
|
256
252
|
value: value
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -164,8 +164,6 @@ var strategyConfigs = [
|
|
|
164
164
|
// ============================================
|
|
165
165
|
|
|
166
166
|
function runExample() {
|
|
167
|
-
console.log('========== WalletPass 评估器示例 ==========\n');
|
|
168
|
-
|
|
169
167
|
// 创建评估器实例
|
|
170
168
|
var evaluator = new WalletPassEvaluator();
|
|
171
169
|
|
|
@@ -178,38 +176,17 @@ function runExample() {
|
|
|
178
176
|
});
|
|
179
177
|
|
|
180
178
|
// 输出结果
|
|
181
|
-
|
|
182
|
-
console.log("- \u603B\u91D1\u989D: ".concat(180, " \u5143"));
|
|
183
|
-
console.log("- \u5546\u54C1: ".concat(products.map(function (p) {
|
|
184
|
-
return "".concat(p.name, "(").concat(p.quantity, "\u4EF6)");
|
|
185
|
-
}).join(', '), "\n"));
|
|
186
|
-
console.log('评估结果:\n');
|
|
179
|
+
|
|
187
180
|
results.forEach(function (result, index) {
|
|
188
|
-
|
|
189
|
-
console.log(" \u9762\u989D: ".concat(result.voucher.amount, " \u5143"));
|
|
190
|
-
console.log(" \u53EF\u7528: ".concat(result.isApplicable ? '✅ 是' : '❌ 否'));
|
|
191
|
-
if (result.isApplicable) {
|
|
192
|
-
console.log(" \u6700\u5927\u62B5\u6263: ".concat(result.maxDeduction, " \u5143"));
|
|
193
|
-
console.log(" \u6BCF\u5355\u53EF\u7528: ".concat(result.canUseCount, " \u5F20"));
|
|
194
|
-
console.log(" \u62B5\u6263\u7A0E\u8D39: ".concat(result.deductTaxAndFee ? '是' : '否'));
|
|
195
|
-
console.log(" \u9002\u7528\u5546\u54C1: ".concat(result.applicableProductIds.join(', ')));
|
|
196
|
-
} else {
|
|
197
|
-
console.log(" \u539F\u56E0: ".concat(result.reason));
|
|
198
|
-
console.log(" \u539F\u56E0\u7801: ".concat(result.reasonCode));
|
|
199
|
-
}
|
|
200
|
-
console.log('');
|
|
181
|
+
if (result.isApplicable) {} else {}
|
|
201
182
|
});
|
|
202
183
|
|
|
203
184
|
// 筛选可用的 vouchers
|
|
204
185
|
var availableVouchers = results.filter(function (r) {
|
|
205
186
|
return r.isApplicable;
|
|
206
187
|
});
|
|
207
|
-
console.log("\n\u5171 ".concat(availableVouchers.length, " \u5F20\u53EF\u7528"));
|
|
208
188
|
if (availableVouchers.length > 0) {
|
|
209
|
-
|
|
210
|
-
availableVouchers.forEach(function (v) {
|
|
211
|
-
console.log(" - ".concat(v.voucher.id, ": \u6700\u591A\u62B5\u6263 ").concat(v.maxDeduction, " \u5143"));
|
|
212
|
-
});
|
|
189
|
+
availableVouchers.forEach(function (v) {});
|
|
213
190
|
}
|
|
214
191
|
}
|
|
215
192
|
|
|
@@ -246,8 +246,6 @@ var codeContext = {
|
|
|
246
246
|
// ============================================
|
|
247
247
|
|
|
248
248
|
function runExamples() {
|
|
249
|
-
console.log('====== 策略模型使用示例 ======\n');
|
|
250
|
-
|
|
251
249
|
// 创建引擎实例(开启调试和追踪)
|
|
252
250
|
var engine = createStrategyEngine({
|
|
253
251
|
debug: true,
|
|
@@ -255,32 +253,23 @@ function runExamples() {
|
|
|
255
253
|
});
|
|
256
254
|
|
|
257
255
|
// 示例1: 代金券
|
|
258
|
-
|
|
256
|
+
|
|
259
257
|
var result1 = engine.evaluate(voucherConfig, voucherContext);
|
|
260
|
-
console.log('结果:', JSON.stringify(result1, null, 2));
|
|
261
|
-
console.log('\n');
|
|
262
258
|
|
|
263
259
|
// 示例2: 阶梯满减
|
|
264
|
-
|
|
260
|
+
|
|
265
261
|
var result2 = engine.evaluate(tieredDiscountConfig, tieredContext);
|
|
266
|
-
console.log('结果:', JSON.stringify(result2, null, 2));
|
|
267
|
-
console.log('\n');
|
|
268
262
|
|
|
269
263
|
// 示例3: Code 模式
|
|
270
|
-
|
|
264
|
+
|
|
271
265
|
var result3 = engine.evaluate(codeConditionConfig, codeContext);
|
|
272
|
-
console.log('结果:', JSON.stringify(result3, null, 2));
|
|
273
|
-
console.log('\n');
|
|
274
266
|
|
|
275
267
|
// 快速评估(不需要创建引擎实例)
|
|
276
|
-
|
|
268
|
+
|
|
277
269
|
var result4 = evaluate(voucherConfig, voucherContext);
|
|
278
|
-
console.log('适用:', result4.applicable);
|
|
279
|
-
console.log('匹配动作数:', result4.matchedActions.length);
|
|
280
|
-
console.log('\n');
|
|
281
270
|
|
|
282
271
|
// 注册自定义运算符
|
|
283
|
-
|
|
272
|
+
|
|
284
273
|
engine.registerOperator('divisible_by', function (fieldValue, compareValue) {
|
|
285
274
|
return Number(fieldValue) % Number(compareValue) === 0;
|
|
286
275
|
});
|
|
@@ -317,11 +306,8 @@ function runExamples() {
|
|
|
317
306
|
}
|
|
318
307
|
};
|
|
319
308
|
var result5 = engine.evaluate(customOperatorConfig, customContext);
|
|
320
|
-
console.log('结果:', result5.applicable ? '适用' : '不适用');
|
|
321
|
-
console.log('匹配动作:', result5.matchedActions);
|
|
322
309
|
|
|
323
310
|
// 调试信息
|
|
324
|
-
console.log('\n引擎调试信息:', engine.getDebugInfo());
|
|
325
311
|
}
|
|
326
312
|
|
|
327
313
|
// 运行示例(如果直接执行此文件)
|
|
@@ -63,7 +63,6 @@ export var handleVariantProduct = function handleVariantProduct(product) {
|
|
|
63
63
|
*/
|
|
64
64
|
export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
65
65
|
var _product$custom_depos;
|
|
66
|
-
console.log('formatProductToCartItem>>>>>>', params);
|
|
67
66
|
var cartItem = params.cartItem,
|
|
68
67
|
product = params.product,
|
|
69
68
|
bundle = params.bundle,
|
|
@@ -294,8 +294,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
294
294
|
// 将 start_time 向上取整到下一个10分钟整数
|
|
295
295
|
var roundedStartTime = _this3.roundUpToNext10Minutes(resourceStartTime);
|
|
296
296
|
var roundedStartTimeDayjs = dayjs(roundedStartTime);
|
|
297
|
-
console.log("[DateModule] \u4FEE\u6B63\u65F6\u95F4\u6BB5\u5F00\u59CB\u65F6\u95F4: ".concat(timeSlot.start_at, " -> ").concat(roundedStartTime, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u539F\u59CBstart_time: ").concat(resource.start_time, ")"));
|
|
298
|
-
|
|
299
297
|
// 将 start_at 修正为向上取整后的时间
|
|
300
298
|
var correctedTimeSlot = _objectSpread(_objectSpread({}, timeSlot), {}, {
|
|
301
299
|
start_at: roundedStartTime
|
|
@@ -303,7 +301,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
303
301
|
|
|
304
302
|
// 检查修正后的 end_at 是否也早于修正后的 start_time
|
|
305
303
|
if (endAt.isBefore(roundedStartTimeDayjs)) {
|
|
306
|
-
console.log("[DateModule] \u65F6\u95F4\u6BB5\u65E0\u6548\uFF0C\u5C06\u88AB\u5220\u9664: ".concat(timeSlot.start_at, " - ").concat(timeSlot.end_at, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u4FEE\u6B63\u540Estart_time: ").concat(roundedStartTime, ")"));
|
|
307
304
|
return null; // 标记为删除
|
|
308
305
|
}
|
|
309
306
|
return correctedTimeSlot;
|
|
@@ -366,9 +363,8 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
366
363
|
case 18:
|
|
367
364
|
_context4.prev = 18;
|
|
368
365
|
_context4.t0 = _context4["catch"](7);
|
|
369
|
-
console.log('getAvailableTimeList_error', _context4.t0);
|
|
370
366
|
return _context4.abrupt("return", disableAllDates(dates));
|
|
371
|
-
case
|
|
367
|
+
case 21:
|
|
372
368
|
case "end":
|
|
373
369
|
return _context4.stop();
|
|
374
370
|
}
|
|
@@ -468,9 +468,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
468
468
|
_context7.next = 4;
|
|
469
469
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
470
470
|
case 4:
|
|
471
|
-
console.log('[Discount] 已销毁');
|
|
472
471
|
_get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
|
|
473
|
-
case
|
|
472
|
+
case 5:
|
|
474
473
|
case "end":
|
|
475
474
|
return _context7.stop();
|
|
476
475
|
}
|
|
@@ -490,8 +489,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
490
489
|
case 0:
|
|
491
490
|
this.store.discountList = [];
|
|
492
491
|
this.store.originalDiscountList = [];
|
|
493
|
-
|
|
494
|
-
case 3:
|
|
492
|
+
case 2:
|
|
495
493
|
case "end":
|
|
496
494
|
return _context8.stop();
|
|
497
495
|
}
|
|
@@ -562,7 +562,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
562
562
|
*/
|
|
563
563
|
hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
|
|
564
564
|
recalcOnHydrate?: boolean;
|
|
565
|
-
source?: 'salesDetail' | 'sessionStorage';
|
|
565
|
+
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
566
566
|
}): Promise<OrderTempOrder>;
|
|
567
567
|
/**
|
|
568
568
|
* 兼容后端详情将 holder 放在 metadata.holder 的历史形态,统一补到运行时展示路径。
|
|
@@ -2305,6 +2305,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2305
2305
|
}, {
|
|
2306
2306
|
key: "restoreOriginalSnapshotIfProductsUnchanged",
|
|
2307
2307
|
value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
|
|
2308
|
+
// merge hydrate 的商品集合包含本地未提交行,但 summary 仍来自远端旧订单,不能复用。
|
|
2309
|
+
if (snapshot.requiresFullSummaryRecalculation === true) return null;
|
|
2308
2310
|
var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
|
|
2309
2311
|
var manualDepositOverride = this.getManualDepositOverride(tempOrder);
|
|
2310
2312
|
if (currentFingerprint !== snapshot.productFingerprint) {
|
|
@@ -5272,7 +5274,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5272
5274
|
request_unique_idempotency_token: params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token,
|
|
5273
5275
|
enhance: enhancePayload
|
|
5274
5276
|
});
|
|
5275
|
-
console.log('[Order.runSubmitTempOrder.payload]', payload);
|
|
5276
5277
|
if (params !== null && params !== void 0 && params.syncMode) {
|
|
5277
5278
|
payload.sync_mode = true;
|
|
5278
5279
|
}
|
|
@@ -5280,10 +5281,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5280
5281
|
if (!payload.created_at) {
|
|
5281
5282
|
payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5282
5283
|
}
|
|
5283
|
-
_context35.next =
|
|
5284
|
+
_context35.next = 25;
|
|
5284
5285
|
return this.saveDraft();
|
|
5285
|
-
case
|
|
5286
|
-
_context35.prev =
|
|
5286
|
+
case 25:
|
|
5287
|
+
_context35.prev = 25;
|
|
5287
5288
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
5288
5289
|
orderId: payload.order_id,
|
|
5289
5290
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -5293,26 +5294,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5293
5294
|
smallTicketDataFlag: payload.small_ticket_data_flag,
|
|
5294
5295
|
syncMode: payload.sync_mode
|
|
5295
5296
|
});
|
|
5296
|
-
_context35.next =
|
|
5297
|
+
_context35.next = 29;
|
|
5297
5298
|
return this.submitSalesOrder({
|
|
5298
5299
|
query: payload
|
|
5299
5300
|
});
|
|
5300
|
-
case
|
|
5301
|
+
case 29:
|
|
5301
5302
|
result = _context35.sent;
|
|
5302
|
-
_context35.next =
|
|
5303
|
+
_context35.next = 42;
|
|
5303
5304
|
break;
|
|
5304
|
-
case
|
|
5305
|
-
_context35.prev =
|
|
5306
|
-
_context35.t2 = _context35["catch"](
|
|
5305
|
+
case 32:
|
|
5306
|
+
_context35.prev = 32;
|
|
5307
|
+
_context35.t2 = _context35["catch"](25);
|
|
5307
5308
|
backendErrorResponse = this.extractSubmitErrorResponse(_context35.t2);
|
|
5308
5309
|
if (!backendErrorResponse) {
|
|
5309
|
-
_context35.next =
|
|
5310
|
+
_context35.next = 39;
|
|
5310
5311
|
break;
|
|
5311
5312
|
}
|
|
5312
5313
|
this.store.syncState = 'failed';
|
|
5313
5314
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
5314
5315
|
return _context35.abrupt("return", backendErrorResponse);
|
|
5315
|
-
case
|
|
5316
|
+
case 39:
|
|
5316
5317
|
this.store.syncState = 'failed';
|
|
5317
5318
|
this.logError('submitTempOrder failed', {
|
|
5318
5319
|
error: _context35.t2 instanceof Error ? _context35.t2.message : String(_context35.t2),
|
|
@@ -5322,15 +5323,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5322
5323
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
5323
5324
|
});
|
|
5324
5325
|
throw _context35.t2;
|
|
5325
|
-
case
|
|
5326
|
+
case 42:
|
|
5326
5327
|
if (!this.isSubmitResponseRejected(result)) {
|
|
5327
|
-
_context35.next =
|
|
5328
|
+
_context35.next = 46;
|
|
5328
5329
|
break;
|
|
5329
5330
|
}
|
|
5330
5331
|
this.store.syncState = 'failed';
|
|
5331
5332
|
this.logSubmitBackendRejected(result, payload);
|
|
5332
5333
|
return _context35.abrupt("return", result);
|
|
5333
|
-
case
|
|
5334
|
+
case 46:
|
|
5334
5335
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
5335
5336
|
this.logInfo('runSubmitTempOrder: 提交成功', {
|
|
5336
5337
|
submittedOrderId: submittedOrderId,
|
|
@@ -5340,29 +5341,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5340
5341
|
})
|
|
5341
5342
|
});
|
|
5342
5343
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
5343
|
-
_context35.next =
|
|
5344
|
+
_context35.next = 55;
|
|
5344
5345
|
break;
|
|
5345
5346
|
}
|
|
5346
5347
|
tempOrder.order_id = submittedOrderId;
|
|
5347
5348
|
resultRecord = result;
|
|
5348
|
-
_context35.next =
|
|
5349
|
+
_context35.next = 53;
|
|
5349
5350
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
5350
|
-
case
|
|
5351
|
-
_context35.next =
|
|
5351
|
+
case 53:
|
|
5352
|
+
_context35.next = 56;
|
|
5352
5353
|
break;
|
|
5353
|
-
case
|
|
5354
|
+
case 55:
|
|
5354
5355
|
if (this.isLocalPendingSubmitResult(result)) {
|
|
5355
5356
|
this.store.syncState = 'local';
|
|
5356
5357
|
} else {
|
|
5357
5358
|
this.store.syncState = 'submitted';
|
|
5358
5359
|
}
|
|
5359
|
-
case
|
|
5360
|
+
case 56:
|
|
5360
5361
|
return _context35.abrupt("return", result);
|
|
5361
|
-
case
|
|
5362
|
+
case 57:
|
|
5362
5363
|
case "end":
|
|
5363
5364
|
return _context35.stop();
|
|
5364
5365
|
}
|
|
5365
|
-
}, _callee32, this, [[
|
|
5366
|
+
}, _callee32, this, [[25, 32]]);
|
|
5366
5367
|
}));
|
|
5367
5368
|
function runSubmitTempOrder(_x39) {
|
|
5368
5369
|
return _runSubmitTempOrder.apply(this, arguments);
|
|
@@ -5790,8 +5791,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5790
5791
|
key: "createOrderByCheckout",
|
|
5791
5792
|
value: (function () {
|
|
5792
5793
|
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
5793
|
-
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3
|
|
5794
|
-
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3,
|
|
5794
|
+
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
|
|
5795
|
+
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
|
|
5795
5796
|
return _regeneratorRuntime().wrap(function _callee38$(_context41) {
|
|
5796
5797
|
while (1) switch (_context41.prev = _context41.next) {
|
|
5797
5798
|
case 0:
|
|
@@ -5818,16 +5819,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5818
5819
|
return p.code;
|
|
5819
5820
|
})) || []
|
|
5820
5821
|
});
|
|
5821
|
-
|
|
5822
|
-
type: params.type,
|
|
5823
|
-
platform: params.platform,
|
|
5824
|
-
is_deposit: params.is_deposit,
|
|
5825
|
-
customer_id: params.customer_id,
|
|
5826
|
-
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
5827
|
-
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
5828
|
-
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
5829
|
-
});
|
|
5830
|
-
_context41.prev = 4;
|
|
5822
|
+
_context41.prev = 3;
|
|
5831
5823
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
5832
5824
|
orderData = _objectSpread({
|
|
5833
5825
|
sales_channel: 'my_pisel',
|
|
@@ -5849,20 +5841,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5849
5841
|
if (!params.order_id && !orderData.schedule_date) {
|
|
5850
5842
|
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
5851
5843
|
}
|
|
5852
|
-
console.log('[Order] 调用后端接口创建订单:', {
|
|
5853
|
-
url: '/shop/order/checkout',
|
|
5854
|
-
orderType: orderData.type,
|
|
5855
|
-
platform: orderData.platform,
|
|
5856
|
-
isDeposit: orderData.is_deposit,
|
|
5857
|
-
customerId: orderData.customer_id,
|
|
5858
|
-
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
5859
|
-
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
5860
|
-
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
5861
|
-
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
5862
|
-
return p.code;
|
|
5863
|
-
})) || []
|
|
5864
|
-
});
|
|
5865
|
-
|
|
5866
5844
|
// 记录接口调用详情
|
|
5867
5845
|
this.logInfo('Calling backend checkout API', {
|
|
5868
5846
|
url: '/shop/order/checkout',
|
|
@@ -5871,10 +5849,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5871
5849
|
isDeposit: orderData.is_deposit,
|
|
5872
5850
|
customerId: orderData.customer_id,
|
|
5873
5851
|
depositAmount: orderData.deposit_amount,
|
|
5874
|
-
bookingsCount: ((_orderData$
|
|
5875
|
-
relationProductsCount: ((_orderData$
|
|
5876
|
-
paymentsCount: ((_orderData$
|
|
5877
|
-
paymentMethods: ((_orderData$
|
|
5852
|
+
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
5853
|
+
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
5854
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
5855
|
+
paymentMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
5878
5856
|
return {
|
|
5879
5857
|
code: p.code,
|
|
5880
5858
|
amount: p.amount,
|
|
@@ -5889,34 +5867,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5889
5867
|
hasOrderId: !!orderData.order_id,
|
|
5890
5868
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
5891
5869
|
});
|
|
5892
|
-
_context41.next =
|
|
5870
|
+
_context41.next = 10;
|
|
5893
5871
|
return this.request.post('/order/checkout', orderData, {
|
|
5894
5872
|
osServer: true,
|
|
5895
5873
|
customToast: function customToast() {}
|
|
5896
5874
|
});
|
|
5897
|
-
case
|
|
5875
|
+
case 10:
|
|
5898
5876
|
response = _context41.sent;
|
|
5899
5877
|
this.logInfo('Order API called successfully', {
|
|
5900
5878
|
response: response
|
|
5901
5879
|
});
|
|
5902
|
-
console.log('[Order] 订单创建成功,后端响应:', {
|
|
5903
|
-
success: !!response,
|
|
5904
|
-
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
5905
|
-
});
|
|
5906
5880
|
return _context41.abrupt("return", response);
|
|
5907
|
-
case
|
|
5908
|
-
_context41.prev =
|
|
5909
|
-
_context41.t0 = _context41["catch"](
|
|
5881
|
+
case 15:
|
|
5882
|
+
_context41.prev = 15;
|
|
5883
|
+
_context41.t0 = _context41["catch"](3);
|
|
5910
5884
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context41.t0);
|
|
5911
5885
|
this.logInfo('Order API called failed', {
|
|
5912
5886
|
error: _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0)
|
|
5913
5887
|
});
|
|
5914
5888
|
throw _context41.t0;
|
|
5915
|
-
case
|
|
5889
|
+
case 20:
|
|
5916
5890
|
case "end":
|
|
5917
5891
|
return _context41.stop();
|
|
5918
5892
|
}
|
|
5919
|
-
}, _callee38, this, [[
|
|
5893
|
+
}, _callee38, this, [[3, 15]]);
|
|
5920
5894
|
}));
|
|
5921
5895
|
function createOrderByCheckout(_x46) {
|
|
5922
5896
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -6047,7 +6021,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6047
6021
|
value: (function () {
|
|
6048
6022
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(record, options) {
|
|
6049
6023
|
var _sourceRaw$_extend, _this$store$discount22;
|
|
6050
|
-
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
|
|
6024
|
+
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
|
|
6051
6025
|
return _regeneratorRuntime().wrap(function _callee42$(_context45) {
|
|
6052
6026
|
while (1) switch (_context45.prev = _context45.next) {
|
|
6053
6027
|
case 0:
|
|
@@ -6082,12 +6056,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6082
6056
|
}
|
|
6083
6057
|
}
|
|
6084
6058
|
isSessionStorageHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'sessionStorage';
|
|
6059
|
+
isMergedSalesDetailHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'mergedSalesDetail';
|
|
6085
6060
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
6086
|
-
|
|
6061
|
+
// merge 前已只给远端商品补标记;这里不能把本地未提交商品一并变成 saved item。
|
|
6062
|
+
makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
|
|
6087
6063
|
});
|
|
6088
6064
|
this.store.tempOrder = nextTempOrder;
|
|
6089
6065
|
if (!isSessionStorageHydrate) {
|
|
6090
|
-
_context45.next =
|
|
6066
|
+
_context45.next = 30;
|
|
6091
6067
|
break;
|
|
6092
6068
|
}
|
|
6093
6069
|
// 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
|
|
@@ -6103,24 +6079,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6103
6079
|
nextTempOrder.discount_list = restoredSessionDiscounts;
|
|
6104
6080
|
this.store.summary = createEmptySummary();
|
|
6105
6081
|
this.store.lastOrderInfo = undefined;
|
|
6106
|
-
_context45.next =
|
|
6082
|
+
_context45.next = 23;
|
|
6107
6083
|
return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6108
|
-
case
|
|
6109
|
-
_context45.next =
|
|
6084
|
+
case 23:
|
|
6085
|
+
_context45.next = 25;
|
|
6110
6086
|
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6111
|
-
case
|
|
6087
|
+
case 25:
|
|
6112
6088
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6113
|
-
_context45.next =
|
|
6089
|
+
_context45.next = 28;
|
|
6114
6090
|
break;
|
|
6115
6091
|
}
|
|
6116
|
-
_context45.next =
|
|
6092
|
+
_context45.next = 28;
|
|
6117
6093
|
return this.recalculateSummary({
|
|
6118
6094
|
createIfMissing: false
|
|
6119
6095
|
});
|
|
6120
|
-
case
|
|
6096
|
+
case 28:
|
|
6121
6097
|
this.persistTempOrder();
|
|
6122
6098
|
return _context45.abrupt("return", nextTempOrder);
|
|
6123
|
-
case
|
|
6099
|
+
case 30:
|
|
6124
6100
|
// Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
|
|
6125
6101
|
sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
|
|
6126
6102
|
isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
@@ -6136,7 +6112,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6136
6112
|
surcharges: summarySurcharges
|
|
6137
6113
|
});
|
|
6138
6114
|
nextTempOrder._extend = _objectSpread(_objectSpread({}, nextTempOrder._extend || {}), {}, {
|
|
6139
|
-
originalSalesSnapshot: {
|
|
6115
|
+
originalSalesSnapshot: _objectSpread({
|
|
6140
6116
|
summary: cloneDeep(this.store.summary),
|
|
6141
6117
|
products: cloneDeep(nextTempOrder.products || []),
|
|
6142
6118
|
bookings: cloneDeep(nextTempOrder.bookings || []),
|
|
@@ -6144,7 +6120,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6144
6120
|
surcharges: cloneDeep(nextTempOrder.surcharges || []),
|
|
6145
6121
|
shop_discount: nextTempOrder.shop_discount || '0.00',
|
|
6146
6122
|
productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
|
|
6147
|
-
}
|
|
6123
|
+
}, isMergedSalesDetailHydrate ? {
|
|
6124
|
+
requiresFullSummaryRecalculation: true
|
|
6125
|
+
} : {})
|
|
6148
6126
|
});
|
|
6149
6127
|
this.store.lastOrderInfo = this.withoutSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
|
|
6150
6128
|
hadSyntheticDraftOrderId = this.isSyntheticDraftOrderIdForRuntime(raw, syntheticIdentityOptions) || this.isSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
|
|
@@ -6165,28 +6143,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6165
6143
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
6166
6144
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
6167
6145
|
if (shouldSkipEmptyDiscountSync) {
|
|
6168
|
-
_context45.next =
|
|
6146
|
+
_context45.next = 53;
|
|
6169
6147
|
break;
|
|
6170
6148
|
}
|
|
6171
6149
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
6172
|
-
_context45.next =
|
|
6150
|
+
_context45.next = 51;
|
|
6173
6151
|
return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList(nextDiscounts);
|
|
6174
|
-
case
|
|
6175
|
-
_context45.next =
|
|
6152
|
+
case 51:
|
|
6153
|
+
_context45.next = 53;
|
|
6176
6154
|
return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setDiscountList(nextDiscounts);
|
|
6177
|
-
case
|
|
6155
|
+
case 53:
|
|
6178
6156
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6179
|
-
_context45.next =
|
|
6157
|
+
_context45.next = 56;
|
|
6180
6158
|
break;
|
|
6181
6159
|
}
|
|
6182
|
-
_context45.next =
|
|
6160
|
+
_context45.next = 56;
|
|
6183
6161
|
return this.recalculateSummary({
|
|
6184
6162
|
createIfMissing: false
|
|
6185
6163
|
});
|
|
6186
|
-
case
|
|
6164
|
+
case 56:
|
|
6187
6165
|
this.persistTempOrder();
|
|
6188
6166
|
return _context45.abrupt("return", nextTempOrder);
|
|
6189
|
-
case
|
|
6167
|
+
case 58:
|
|
6190
6168
|
case "end":
|
|
6191
6169
|
return _context45.stop();
|
|
6192
6170
|
}
|
|
@@ -821,7 +821,7 @@ export interface OrderModuleAPI {
|
|
|
821
821
|
saveDraft: () => Promise<void>;
|
|
822
822
|
hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
|
|
823
823
|
recalcOnHydrate?: boolean;
|
|
824
|
-
source?: 'salesDetail' | 'sessionStorage';
|
|
824
|
+
source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
|
|
825
825
|
}) => Promise<OrderTempOrder>;
|
|
826
826
|
syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
|
|
827
827
|
getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;
|