@pisell/pisellos 0.0.567 → 0.0.568
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 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- 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 +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- 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 +32 -40
- package/dist/server/utils/product.js +0 -1
- 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 -1
- package/dist/solution/BookingTicket/index.js +5 -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 -246
- 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.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- 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 +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- 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 +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- 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 +652 -402
- 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 +22 -45
- 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 +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- 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 +117 -113
- 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 +63 -74
- 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 +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- 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 +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- 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 +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- 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/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- 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 -167
- package/lib/modules/Schedule/index.js +97 -107
- 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 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- 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 +882 -623
- package/lib/server/modules/index.js +85 -59
- 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 +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- 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/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- 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 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- 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 +227 -158
- 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 +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- 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
|
@@ -106,21 +106,20 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
106
106
|
_context.next = 16;
|
|
107
107
|
return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
|
|
108
108
|
case 16:
|
|
109
|
-
console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
|
|
110
109
|
this.log('[PisellOS] Server 初始化完成');
|
|
111
|
-
_context.next =
|
|
110
|
+
_context.next = 24;
|
|
112
111
|
break;
|
|
113
|
-
case
|
|
114
|
-
_context.prev =
|
|
112
|
+
case 19:
|
|
113
|
+
_context.prev = 19;
|
|
115
114
|
_context.t0 = _context["catch"](6);
|
|
116
115
|
console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
|
|
117
116
|
this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
|
|
118
117
|
throw _context.t0;
|
|
119
|
-
case
|
|
118
|
+
case 24:
|
|
120
119
|
case "end":
|
|
121
120
|
return _context.stop();
|
|
122
121
|
}
|
|
123
|
-
}, _callee, this, [[6,
|
|
122
|
+
}, _callee, this, [[6, 19]]);
|
|
124
123
|
}));
|
|
125
124
|
function initializeServer(_x) {
|
|
126
125
|
return _initializeServer.apply(this, arguments);
|
|
@@ -138,11 +137,10 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
138
137
|
var prefix = '[PisellOS]';
|
|
139
138
|
switch (level) {
|
|
140
139
|
case 'info':
|
|
141
|
-
console.log("".concat(prefix, " ").concat(message));
|
|
142
140
|
break;
|
|
143
141
|
case 'warn':
|
|
144
142
|
// 使用 console.log 避免显示堆栈跟踪,提升性能
|
|
145
|
-
|
|
143
|
+
|
|
146
144
|
break;
|
|
147
145
|
case 'error':
|
|
148
146
|
console.error("".concat(prefix, " ").concat(message));
|
|
@@ -249,7 +247,6 @@ var PisellOSCore = /*#__PURE__*/function () {
|
|
|
249
247
|
}
|
|
250
248
|
// 预先给模块初始化值系统
|
|
251
249
|
var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
|
|
252
|
-
console.log('core 检测到模块值更新', module.name, path, value);
|
|
253
250
|
_this3.effects.emit("".concat(module.name, ":changed"), {
|
|
254
251
|
path: path,
|
|
255
252
|
value: value
|
|
@@ -257,7 +257,6 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
|
|
|
257
257
|
var rawText = this.getText(reasonCode);
|
|
258
258
|
// 金额类型字段:从 otherParams.getData 取货币符号;非金额或取不到则留空
|
|
259
259
|
var currency = failedField && AMOUNT_FIELDS.has(failedField) ? ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 || (_this$otherParams$get = (_this$otherParams2 = _this$otherParams).getData) === null || _this$otherParams$get === void 0 ? void 0 : _this$otherParams$get.call(_this$otherParams2, 'shop_symbol')) || '' : '';
|
|
260
|
-
console.log(currency, 'currency12345');
|
|
261
260
|
var reason = thresholdValue !== undefined ? formatReason(rawText, thresholdValue, currency) : rawText;
|
|
262
261
|
results.push({
|
|
263
262
|
voucher: voucher,
|
|
@@ -506,7 +505,6 @@ export var WalletPassEvaluator = /*#__PURE__*/function () {
|
|
|
506
505
|
}, {
|
|
507
506
|
key: "calculateApplicableProducts",
|
|
508
507
|
value: function calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
|
|
509
|
-
console.log(products, 'products1234');
|
|
510
508
|
var total = 0;
|
|
511
509
|
var count = 0;
|
|
512
510
|
|
|
@@ -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
|
|
|
@@ -72,7 +72,6 @@ function applyMaxPassUsageIncrements(usageMap, walletPassProductId, maxPassesPer
|
|
|
72
72
|
// 辅助函数:根据 deductTaxAndFee 配置获取推荐使用金额
|
|
73
73
|
var getRecommendedAmount = function getRecommendedAmount(voucher) {
|
|
74
74
|
var _config$deductTaxAndF;
|
|
75
|
-
console.log('voucher312', voucher);
|
|
76
75
|
var config = voucher.config,
|
|
77
76
|
recommended_usage_amount = voucher.recommended_usage_amount,
|
|
78
77
|
recommended_pure_product_usage_amount = voucher.recommended_pure_product_usage_amount;
|
|
@@ -166,8 +165,6 @@ var getApplicableProducts = function getApplicableProducts(voucher, productsData
|
|
|
166
165
|
* @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
|
|
167
166
|
*/
|
|
168
167
|
export function processVouchers(applicableVouchers, orderTotalAmount, products) {
|
|
169
|
-
console.log(products, 'products123');
|
|
170
|
-
|
|
171
168
|
// 拆分商品数据,同时维护含税和不含税两个金额池
|
|
172
169
|
// remainingAmountWithTax: 含税费的剩余可抵扣金额
|
|
173
170
|
// remainingAmountPure: 纯商品金额(不含税费)的剩余可抵扣金额
|
|
@@ -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
|
// 运行示例(如果直接执行此文件)
|
|
@@ -62,7 +62,6 @@ export var handleVariantProduct = function handleVariantProduct(product) {
|
|
|
62
62
|
*/
|
|
63
63
|
export var formatProductToCartItem = function formatProductToCartItem(params) {
|
|
64
64
|
var _product$custom_depos;
|
|
65
|
-
console.log('formatProductToCartItem>>>>>>', params);
|
|
66
65
|
var cartItem = params.cartItem,
|
|
67
66
|
product = params.product,
|
|
68
67
|
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
|
}
|
|
@@ -459,8 +459,6 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
459
459
|
_context7.next = 4;
|
|
460
460
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
461
461
|
case 4:
|
|
462
|
-
console.log('[Discount] 已销毁');
|
|
463
|
-
case 5:
|
|
464
462
|
case "end":
|
|
465
463
|
return _context7.stop();
|
|
466
464
|
}
|
|
@@ -480,8 +478,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
480
478
|
case 0:
|
|
481
479
|
this.store.discountList = [];
|
|
482
480
|
this.store.originalDiscountList = [];
|
|
483
|
-
|
|
484
|
-
case 3:
|
|
481
|
+
case 2:
|
|
485
482
|
case "end":
|
|
486
483
|
return _context8.stop();
|
|
487
484
|
}
|
|
@@ -85,7 +85,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
85
85
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
86
86
|
}): Promise<T>;
|
|
87
87
|
createOrder(params: CommitOrderParams['query']): {
|
|
88
|
-
type: "
|
|
88
|
+
type: "appointment_booking" | "virtual";
|
|
89
89
|
platform: string;
|
|
90
90
|
sales_channel: string;
|
|
91
91
|
order_sales_channel: string;
|
|
@@ -1019,8 +1019,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1019
1019
|
key: "createOrderByCheckout",
|
|
1020
1020
|
value: (function () {
|
|
1021
1021
|
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
1022
|
-
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3
|
|
1023
|
-
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3,
|
|
1022
|
+
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
|
|
1023
|
+
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
|
|
1024
1024
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1025
1025
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1026
1026
|
case 0:
|
|
@@ -1047,16 +1047,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1047
1047
|
return p.code;
|
|
1048
1048
|
})) || []
|
|
1049
1049
|
});
|
|
1050
|
-
|
|
1051
|
-
type: params.type,
|
|
1052
|
-
platform: params.platform,
|
|
1053
|
-
is_deposit: params.is_deposit,
|
|
1054
|
-
customer_id: params.customer_id,
|
|
1055
|
-
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
1056
|
-
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
1057
|
-
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
1058
|
-
});
|
|
1059
|
-
_context12.prev = 4;
|
|
1050
|
+
_context12.prev = 3;
|
|
1060
1051
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
1061
1052
|
orderData = _objectSpread({
|
|
1062
1053
|
sales_channel: 'my_pisel',
|
|
@@ -1078,20 +1069,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1078
1069
|
if (!params.order_id && !orderData.schedule_date) {
|
|
1079
1070
|
orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
1080
1071
|
}
|
|
1081
|
-
console.log('[Order] 调用后端接口创建订单:', {
|
|
1082
|
-
url: '/order/checkout',
|
|
1083
|
-
orderType: orderData.type,
|
|
1084
|
-
platform: orderData.platform,
|
|
1085
|
-
isDeposit: orderData.is_deposit,
|
|
1086
|
-
customerId: orderData.customer_id,
|
|
1087
|
-
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
1088
|
-
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
1089
|
-
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
1090
|
-
paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
1091
|
-
return p.code;
|
|
1092
|
-
})) || []
|
|
1093
|
-
});
|
|
1094
|
-
|
|
1095
1072
|
// 记录接口调用详情
|
|
1096
1073
|
this.logInfo('Calling backend checkout API', {
|
|
1097
1074
|
url: '/order/checkout',
|
|
@@ -1100,10 +1077,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1100
1077
|
isDeposit: orderData.is_deposit,
|
|
1101
1078
|
customerId: orderData.customer_id,
|
|
1102
1079
|
depositAmount: orderData.deposit_amount,
|
|
1103
|
-
bookingsCount: ((_orderData$
|
|
1104
|
-
relationProductsCount: ((_orderData$
|
|
1105
|
-
paymentsCount: ((_orderData$
|
|
1106
|
-
paymentMethods: ((_orderData$
|
|
1080
|
+
bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
|
|
1081
|
+
relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
|
|
1082
|
+
paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
|
|
1083
|
+
paymentMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
|
|
1107
1084
|
return {
|
|
1108
1085
|
code: p.code,
|
|
1109
1086
|
amount: p.amount,
|
|
@@ -1120,31 +1097,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1120
1097
|
});
|
|
1121
1098
|
|
|
1122
1099
|
// 调用后端接口
|
|
1123
|
-
_context12.next =
|
|
1100
|
+
_context12.next = 10;
|
|
1124
1101
|
return this.request.post('/order/checkout', orderData);
|
|
1125
|
-
case
|
|
1102
|
+
case 10:
|
|
1126
1103
|
response = _context12.sent;
|
|
1127
1104
|
this.logInfo('Order API called successfully', {
|
|
1128
1105
|
response: response
|
|
1129
1106
|
});
|
|
1130
|
-
console.log('[Order] 订单创建成功,后端响应:', {
|
|
1131
|
-
success: !!response,
|
|
1132
|
-
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)
|
|
1133
|
-
});
|
|
1134
1107
|
return _context12.abrupt("return", response);
|
|
1135
|
-
case
|
|
1136
|
-
_context12.prev =
|
|
1137
|
-
_context12.t0 = _context12["catch"](
|
|
1108
|
+
case 15:
|
|
1109
|
+
_context12.prev = 15;
|
|
1110
|
+
_context12.t0 = _context12["catch"](3);
|
|
1138
1111
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context12.t0);
|
|
1139
1112
|
this.logInfo('Order API called failed', {
|
|
1140
1113
|
error: _context12.t0 instanceof Error ? _context12.t0.message : String(_context12.t0)
|
|
1141
1114
|
});
|
|
1142
1115
|
throw _context12.t0;
|
|
1143
|
-
case
|
|
1116
|
+
case 20:
|
|
1144
1117
|
case "end":
|
|
1145
1118
|
return _context12.stop();
|
|
1146
1119
|
}
|
|
1147
|
-
}, _callee12, this, [[
|
|
1120
|
+
}, _callee12, this, [[3, 15]]);
|
|
1148
1121
|
}));
|
|
1149
1122
|
function createOrderByCheckout(_x12) {
|
|
1150
1123
|
return _createOrderByCheckout.apply(this, arguments);
|