@pisell/pisellos 2.3.62 → 2.3.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.js +65 -109
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.js +4 -1
- package/dist/modules/Order/utils.js +36 -30
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -6
- package/dist/server/index.js +92 -133
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/menu/index.js +23 -48
- package/dist/server/modules/order/index.d.ts +8 -12
- package/dist/server/modules/order/index.js +348 -342
- package/dist/server/modules/products/index.d.ts +2 -8
- package/dist/server/modules/products/index.js +75 -167
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingTicket/index.d.ts +2 -0
- package/dist/solution/BookingTicket/index.js +34 -10
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.js +3 -2
- package/lib/modules/Order/utils.js +3 -0
- package/lib/modules/Payment/walletpass.js +0 -1
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -6
- package/lib/server/index.js +12 -34
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/menu/index.js +5 -31
- package/lib/server/modules/order/index.d.ts +8 -12
- package/lib/server/modules/order/index.js +94 -145
- package/lib/server/modules/products/index.d.ts +2 -8
- package/lib/server/modules/products/index.js +24 -97
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
- package/lib/solution/BookingTicket/index.d.ts +2 -0
- package/lib/solution/BookingTicket/index.js +18 -2
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1243,8 +1243,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
1243
1243
|
checkoutData: checkoutData,
|
|
1244
1244
|
order: printableOrder,
|
|
1245
1245
|
response: null,
|
|
1246
|
-
requireFullyPaid: false
|
|
1247
|
-
isManualPrint: true
|
|
1246
|
+
requireFullyPaid: false
|
|
1248
1247
|
});
|
|
1249
1248
|
case 27:
|
|
1250
1249
|
printResult = _context19.sent;
|
|
@@ -2717,7 +2716,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2717
2716
|
key: "setupProductsQuotationPriceBridge",
|
|
2718
2717
|
value: (function () {
|
|
2719
2718
|
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2720
|
-
var _this5 = this;
|
|
2721
2719
|
var _this$core$context, errorMessage;
|
|
2722
2720
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2723
2721
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -2737,42 +2735,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2737
2735
|
return _context33.abrupt("return");
|
|
2738
2736
|
case 6:
|
|
2739
2737
|
_context33.prev = 6;
|
|
2738
|
+
_context33.next = 9;
|
|
2739
|
+
return this.schedule.loadAllSchedule();
|
|
2740
|
+
case 9:
|
|
2740
2741
|
this.products.clearPriceCache();
|
|
2741
|
-
_context33.next =
|
|
2742
|
+
_context33.next = 12;
|
|
2742
2743
|
return this.products.setupQuotationPriceBridge({
|
|
2743
2744
|
scheduleModule: this.schedule,
|
|
2744
|
-
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2745
|
-
onQuotationUpdated: function onQuotationUpdated() {
|
|
2746
|
-
void _this5.recomputeAndNotifyProductQuery();
|
|
2747
|
-
}
|
|
2748
|
-
});
|
|
2749
|
-
case 10:
|
|
2750
|
-
// Schedule 已在模块 preload 阶段加载完成。价格桥接先使用本地数据,
|
|
2751
|
-
// 远端刷新转为后台校准,避免二次启动重复阻塞请求。
|
|
2752
|
-
void this.schedule.loadAllSchedule().then(function () {
|
|
2753
|
-
var _this5$products;
|
|
2754
|
-
(_this5$products = _this5.products) === null || _this5$products === void 0 || _this5$products.clearPriceCache();
|
|
2755
|
-
void _this5.recomputeAndNotifyProductQuery();
|
|
2756
|
-
}).catch(function (error) {
|
|
2757
|
-
_this5.logWarning('Products 报价单价格桥接后台刷新 Schedule 失败,继续使用本地数据', {
|
|
2758
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2759
|
-
});
|
|
2745
|
+
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2760
2746
|
});
|
|
2747
|
+
case 12:
|
|
2761
2748
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2762
|
-
_context33.next =
|
|
2749
|
+
_context33.next = 19;
|
|
2763
2750
|
break;
|
|
2764
|
-
case
|
|
2765
|
-
_context33.prev =
|
|
2751
|
+
case 15:
|
|
2752
|
+
_context33.prev = 15;
|
|
2766
2753
|
_context33.t0 = _context33["catch"](6);
|
|
2767
2754
|
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2768
2755
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2769
2756
|
error: errorMessage
|
|
2770
2757
|
});
|
|
2771
|
-
case
|
|
2758
|
+
case 19:
|
|
2772
2759
|
case "end":
|
|
2773
2760
|
return _context33.stop();
|
|
2774
2761
|
}
|
|
2775
|
-
}, _callee33, this, [[6,
|
|
2762
|
+
}, _callee33, this, [[6, 15]]);
|
|
2776
2763
|
}));
|
|
2777
2764
|
function setupProductsQuotationPriceBridge() {
|
|
2778
2765
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2842,58 +2829,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2842
2829
|
key: "refreshProductsInBackground",
|
|
2843
2830
|
value: (function () {
|
|
2844
2831
|
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2845
|
-
var
|
|
2846
|
-
trigger,
|
|
2847
|
-
startTime,
|
|
2848
|
-
duration,
|
|
2849
|
-
_duration2,
|
|
2850
|
-
errorMessage,
|
|
2851
|
-
_args34 = arguments;
|
|
2832
|
+
var startTime, duration, _duration2, errorMessage;
|
|
2852
2833
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2853
2834
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2854
2835
|
case 0:
|
|
2855
|
-
options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
|
|
2856
2836
|
if (this.products) {
|
|
2857
|
-
_context34.next =
|
|
2837
|
+
_context34.next = 3;
|
|
2858
2838
|
break;
|
|
2859
2839
|
}
|
|
2860
2840
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2861
2841
|
return _context34.abrupt("return");
|
|
2862
|
-
case
|
|
2863
|
-
|
|
2864
|
-
this.logInfo('refreshProductsInBackground 开始', {
|
|
2865
|
-
trigger: trigger
|
|
2866
|
-
});
|
|
2842
|
+
case 3:
|
|
2843
|
+
this.logInfo('refreshProductsInBackground 开始');
|
|
2867
2844
|
startTime = Date.now();
|
|
2868
|
-
_context34.prev =
|
|
2869
|
-
_context34.next =
|
|
2870
|
-
return this.products.silentRefresh(
|
|
2871
|
-
|
|
2872
|
-
});
|
|
2873
|
-
case 10:
|
|
2845
|
+
_context34.prev = 5;
|
|
2846
|
+
_context34.next = 8;
|
|
2847
|
+
return this.products.silentRefresh();
|
|
2848
|
+
case 8:
|
|
2874
2849
|
duration = Date.now() - startTime;
|
|
2875
2850
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2876
|
-
trigger: trigger,
|
|
2877
2851
|
duration: "".concat(duration, "ms")
|
|
2878
2852
|
});
|
|
2879
|
-
_context34.next =
|
|
2853
|
+
_context34.next = 18;
|
|
2880
2854
|
break;
|
|
2881
|
-
case
|
|
2882
|
-
_context34.prev =
|
|
2883
|
-
_context34.t0 = _context34["catch"](
|
|
2855
|
+
case 12:
|
|
2856
|
+
_context34.prev = 12;
|
|
2857
|
+
_context34.t0 = _context34["catch"](5);
|
|
2884
2858
|
_duration2 = Date.now() - startTime;
|
|
2885
2859
|
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
2886
2860
|
console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
|
|
2887
2861
|
this.logError('refreshProductsInBackground 失败', {
|
|
2888
|
-
trigger: trigger,
|
|
2889
2862
|
duration: "".concat(_duration2, "ms"),
|
|
2890
2863
|
error: errorMessage
|
|
2891
2864
|
});
|
|
2892
|
-
case
|
|
2865
|
+
case 18:
|
|
2893
2866
|
case "end":
|
|
2894
2867
|
return _context34.stop();
|
|
2895
2868
|
}
|
|
2896
|
-
}, _callee34, this, [[
|
|
2869
|
+
}, _callee34, this, [[5, 12]]);
|
|
2897
2870
|
}));
|
|
2898
2871
|
function refreshProductsInBackground() {
|
|
2899
2872
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2910,58 +2883,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2910
2883
|
key: "refreshOrdersInBackground",
|
|
2911
2884
|
value: (function () {
|
|
2912
2885
|
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2913
|
-
var
|
|
2914
|
-
trigger,
|
|
2915
|
-
startTime,
|
|
2916
|
-
duration,
|
|
2917
|
-
_duration3,
|
|
2918
|
-
errorMessage,
|
|
2919
|
-
_args35 = arguments;
|
|
2886
|
+
var startTime, duration, _duration3, errorMessage;
|
|
2920
2887
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2921
2888
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2922
2889
|
case 0:
|
|
2923
|
-
options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
2924
2890
|
if (this.order) {
|
|
2925
|
-
_context35.next =
|
|
2891
|
+
_context35.next = 3;
|
|
2926
2892
|
break;
|
|
2927
2893
|
}
|
|
2928
2894
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2929
2895
|
return _context35.abrupt("return");
|
|
2930
|
-
case
|
|
2931
|
-
|
|
2932
|
-
this.logInfo('refreshOrdersInBackground 开始', {
|
|
2933
|
-
trigger: trigger
|
|
2934
|
-
});
|
|
2896
|
+
case 3:
|
|
2897
|
+
this.logInfo('refreshOrdersInBackground 开始');
|
|
2935
2898
|
startTime = Date.now();
|
|
2936
|
-
_context35.prev =
|
|
2937
|
-
_context35.next =
|
|
2938
|
-
return this.order.silentRefresh(
|
|
2939
|
-
|
|
2940
|
-
});
|
|
2941
|
-
case 10:
|
|
2899
|
+
_context35.prev = 5;
|
|
2900
|
+
_context35.next = 8;
|
|
2901
|
+
return this.order.silentRefresh();
|
|
2902
|
+
case 8:
|
|
2942
2903
|
duration = Date.now() - startTime;
|
|
2943
2904
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2944
|
-
trigger: trigger,
|
|
2945
2905
|
duration: "".concat(duration, "ms")
|
|
2946
2906
|
});
|
|
2947
|
-
_context35.next =
|
|
2907
|
+
_context35.next = 18;
|
|
2948
2908
|
break;
|
|
2949
|
-
case
|
|
2950
|
-
_context35.prev =
|
|
2951
|
-
_context35.t0 = _context35["catch"](
|
|
2909
|
+
case 12:
|
|
2910
|
+
_context35.prev = 12;
|
|
2911
|
+
_context35.t0 = _context35["catch"](5);
|
|
2952
2912
|
_duration3 = Date.now() - startTime;
|
|
2953
2913
|
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
2954
2914
|
console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
|
|
2955
2915
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2956
|
-
trigger: trigger,
|
|
2957
2916
|
duration: "".concat(_duration3, "ms"),
|
|
2958
2917
|
error: errorMessage
|
|
2959
2918
|
});
|
|
2960
|
-
case
|
|
2919
|
+
case 18:
|
|
2961
2920
|
case "end":
|
|
2962
2921
|
return _context35.stop();
|
|
2963
2922
|
}
|
|
2964
|
-
}, _callee35, this, [[
|
|
2923
|
+
}, _callee35, this, [[5, 12]]);
|
|
2965
2924
|
}));
|
|
2966
2925
|
function refreshOrdersInBackground() {
|
|
2967
2926
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -3275,10 +3234,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3275
3234
|
}, {
|
|
3276
3235
|
key: "getAllRoutes",
|
|
3277
3236
|
value: function getAllRoutes() {
|
|
3278
|
-
var
|
|
3237
|
+
var _this5 = this;
|
|
3279
3238
|
var routes = [];
|
|
3280
3239
|
['get', 'post', 'put', 'remove'].forEach(function (method) {
|
|
3281
|
-
Object.keys(
|
|
3240
|
+
Object.keys(_this5.router[method]).forEach(function (path) {
|
|
3282
3241
|
routes.push({
|
|
3283
3242
|
method: method,
|
|
3284
3243
|
path: path
|
|
@@ -3408,7 +3367,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3408
3367
|
key: "getPaymentRouteModule",
|
|
3409
3368
|
value: function () {
|
|
3410
3369
|
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3411
|
-
var
|
|
3370
|
+
var _this6 = this;
|
|
3412
3371
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3413
3372
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3414
3373
|
case 0:
|
|
@@ -3437,13 +3396,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3437
3396
|
case 0:
|
|
3438
3397
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
3439
3398
|
_context39.next = 3;
|
|
3440
|
-
return module.initialize(
|
|
3399
|
+
return module.initialize(_this6.core, {
|
|
3441
3400
|
store: {
|
|
3442
3401
|
payMethods: []
|
|
3443
3402
|
}
|
|
3444
3403
|
});
|
|
3445
3404
|
case 3:
|
|
3446
|
-
|
|
3405
|
+
_this6.paymentRouteModule = module;
|
|
3447
3406
|
return _context39.abrupt("return", module);
|
|
3448
3407
|
case 5:
|
|
3449
3408
|
case "end":
|
|
@@ -3451,7 +3410,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3451
3410
|
}
|
|
3452
3411
|
}, _callee39);
|
|
3453
3412
|
}))().finally(function () {
|
|
3454
|
-
|
|
3413
|
+
_this6.paymentRouteModuleInFlight = undefined;
|
|
3455
3414
|
});
|
|
3456
3415
|
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3457
3416
|
case 8:
|
|
@@ -3627,7 +3586,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3627
3586
|
}, {
|
|
3628
3587
|
key: "scheduleSubscriberTimePointReloads",
|
|
3629
3588
|
value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
|
|
3630
|
-
var
|
|
3589
|
+
var _this7 = this;
|
|
3631
3590
|
var subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3632
3591
|
if (!subscriber || !timePoints.length) return;
|
|
3633
3592
|
var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
@@ -3648,7 +3607,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3648
3607
|
setInterval(function () {
|
|
3649
3608
|
var currentTime = dayjs().format('hh:mm');
|
|
3650
3609
|
if (timePoints.includes(currentTime)) {
|
|
3651
|
-
|
|
3610
|
+
_this7.onScheduleTimePointTimerFire(subscriberId);
|
|
3652
3611
|
}
|
|
3653
3612
|
}, 60000);
|
|
3654
3613
|
if (timerIds.length > 0) {
|
|
@@ -3817,7 +3776,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3817
3776
|
key: "refreshMenuScheduleCacheAfterEmptyResult",
|
|
3818
3777
|
value: (function () {
|
|
3819
3778
|
var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3820
|
-
var
|
|
3779
|
+
var _this8 = this;
|
|
3821
3780
|
var now;
|
|
3822
3781
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3823
3782
|
while (1) switch (_context44.prev = _context44.next) {
|
|
@@ -3840,11 +3799,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3840
3799
|
this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
|
|
3841
3800
|
return undefined;
|
|
3842
3801
|
}).catch(function (error) {
|
|
3843
|
-
|
|
3802
|
+
_this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
|
|
3844
3803
|
error: error instanceof Error ? error.message : String(error)
|
|
3845
3804
|
});
|
|
3846
3805
|
}).finally(function () {
|
|
3847
|
-
|
|
3806
|
+
_this8.menuScheduleRefreshInFlight = null;
|
|
3848
3807
|
});
|
|
3849
3808
|
}
|
|
3850
3809
|
_context44.next = 8;
|
|
@@ -4030,10 +3989,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4030
3989
|
}, {
|
|
4031
3990
|
key: "stripSalesSearchPageParams",
|
|
4032
3991
|
value: function stripSalesSearchPageParams(value) {
|
|
4033
|
-
var
|
|
3992
|
+
var _this9 = this;
|
|
4034
3993
|
if (Array.isArray(value)) {
|
|
4035
3994
|
return value.map(function (item) {
|
|
4036
|
-
return
|
|
3995
|
+
return _this9.stripSalesSearchPageParams(item);
|
|
4037
3996
|
});
|
|
4038
3997
|
}
|
|
4039
3998
|
if (!value || _typeof(value) !== 'object') return value;
|
|
@@ -4071,12 +4030,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4071
4030
|
key: "extractSalesSearchOrderIds",
|
|
4072
4031
|
value: function extractSalesSearchOrderIds(kind, result) {
|
|
4073
4032
|
var _this$findSalesSearch,
|
|
4074
|
-
|
|
4033
|
+
_this10 = this;
|
|
4075
4034
|
var data = this.extractSalesSearchResponseData(result);
|
|
4076
4035
|
var list = kind === 'aggregate' ? (_this$findSalesSearch = this.findSalesSearchAggregateGroup(data)) === null || _this$findSalesSearch === void 0 ? void 0 : _this$findSalesSearch.list : data === null || data === void 0 ? void 0 : data.list;
|
|
4077
4036
|
if (!Array.isArray(list)) return [];
|
|
4078
4037
|
return list.map(function (item) {
|
|
4079
|
-
return
|
|
4038
|
+
return _this10.getSalesSearchOrderId(item);
|
|
4080
4039
|
}).filter(function (id) {
|
|
4081
4040
|
return !!id;
|
|
4082
4041
|
});
|
|
@@ -4243,11 +4202,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4243
4202
|
}, {
|
|
4244
4203
|
key: "stableSerialize",
|
|
4245
4204
|
value: function stableSerialize(value) {
|
|
4246
|
-
var
|
|
4205
|
+
var _this11 = this;
|
|
4247
4206
|
if (value === null || value === undefined) return 'null';
|
|
4248
4207
|
if (Array.isArray(value)) {
|
|
4249
4208
|
return "[".concat(value.map(function (item) {
|
|
4250
|
-
return
|
|
4209
|
+
return _this11.stableSerialize(item);
|
|
4251
4210
|
}).join(','), "]");
|
|
4252
4211
|
}
|
|
4253
4212
|
if (_typeof(value) === 'object') {
|
|
@@ -4256,7 +4215,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4256
4215
|
return obj[k] !== undefined;
|
|
4257
4216
|
}).sort();
|
|
4258
4217
|
return "{".concat(keys.map(function (k) {
|
|
4259
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
4218
|
+
return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
|
|
4260
4219
|
}).join(','), "}");
|
|
4261
4220
|
}
|
|
4262
4221
|
return JSON.stringify(value);
|
|
@@ -4796,7 +4755,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4796
4755
|
key: "runLocalPaymentUpdateInQueue",
|
|
4797
4756
|
value: function () {
|
|
4798
4757
|
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
|
|
4799
|
-
var
|
|
4758
|
+
var _this12 = this;
|
|
4800
4759
|
var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
|
|
4801
4760
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4802
4761
|
while (1) switch (_context50.prev = _context50.next) {
|
|
@@ -4815,7 +4774,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4815
4774
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4816
4775
|
while (1) switch (_context49.prev = _context49.next) {
|
|
4817
4776
|
case 0:
|
|
4818
|
-
|
|
4777
|
+
_this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
|
|
4819
4778
|
queue_key: key,
|
|
4820
4779
|
queue_wait_ms: Date.now() - queuedAt
|
|
4821
4780
|
}));
|
|
@@ -6210,7 +6169,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6210
6169
|
key: "handlePendingSyncCheckoutOrder",
|
|
6211
6170
|
value: function () {
|
|
6212
6171
|
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6213
|
-
var
|
|
6172
|
+
var _this13 = this;
|
|
6214
6173
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6215
6174
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6216
6175
|
while (1) switch (_context63.prev = _context63.next) {
|
|
@@ -6263,7 +6222,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6263
6222
|
});
|
|
6264
6223
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6265
6224
|
var _payment$metadata;
|
|
6266
|
-
return sum +
|
|
6225
|
+
return sum + _this13.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
|
|
6267
6226
|
}, 0);
|
|
6268
6227
|
return _context63.abrupt("return", {
|
|
6269
6228
|
code: 200,
|
|
@@ -6358,7 +6317,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6358
6317
|
value: function shouldAutoPrintCheckoutReceipt() {
|
|
6359
6318
|
var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
|
|
6360
6319
|
if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
|
|
6361
|
-
return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY))
|
|
6320
|
+
return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) !== 'false';
|
|
6362
6321
|
}
|
|
6363
6322
|
}, {
|
|
6364
6323
|
key: "shouldBuildSmallTicketData",
|
|
@@ -6403,13 +6362,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6403
6362
|
}, {
|
|
6404
6363
|
key: "sumPaidOrderPayments",
|
|
6405
6364
|
value: function sumPaidOrderPayments(payments) {
|
|
6406
|
-
var
|
|
6365
|
+
var _this14 = this;
|
|
6407
6366
|
if (!Array.isArray(payments)) return 0;
|
|
6408
6367
|
return payments.reduce(function (sum, payment) {
|
|
6409
6368
|
var _payment$amount;
|
|
6410
6369
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6411
6370
|
if (status !== 'paid') return sum;
|
|
6412
|
-
return sum +
|
|
6371
|
+
return sum + _this14.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
6413
6372
|
}, 0);
|
|
6414
6373
|
}
|
|
6415
6374
|
}, {
|
|
@@ -6425,7 +6384,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6425
6384
|
value: function () {
|
|
6426
6385
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6427
6386
|
var _this$products3,
|
|
6428
|
-
|
|
6387
|
+
_this15 = this;
|
|
6429
6388
|
var products, productIdSet, productIds, entries;
|
|
6430
6389
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6431
6390
|
while (1) switch (_context66.prev = _context66.next) {
|
|
@@ -6458,20 +6417,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6458
6417
|
_context66.next = 8;
|
|
6459
6418
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6460
6419
|
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6461
|
-
var
|
|
6420
|
+
var _this15$products, _this15$products$getP, product;
|
|
6462
6421
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6463
6422
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6464
6423
|
case 0:
|
|
6465
6424
|
_context65.prev = 0;
|
|
6466
6425
|
_context65.next = 3;
|
|
6467
|
-
return (
|
|
6426
|
+
return (_this15$products = _this15.products) === null || _this15$products === void 0 || (_this15$products$getP = _this15$products.getProductById) === null || _this15$products$getP === void 0 ? void 0 : _this15$products$getP.call(_this15$products, Number(id));
|
|
6468
6427
|
case 3:
|
|
6469
6428
|
product = _context65.sent;
|
|
6470
6429
|
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6471
6430
|
case 7:
|
|
6472
6431
|
_context65.prev = 7;
|
|
6473
6432
|
_context65.t0 = _context65["catch"](0);
|
|
6474
|
-
|
|
6433
|
+
_this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6475
6434
|
product_id: id,
|
|
6476
6435
|
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6477
6436
|
});
|
|
@@ -6622,7 +6581,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6622
6581
|
key: "withSalesDetailProductSnapshots",
|
|
6623
6582
|
value: function () {
|
|
6624
6583
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6625
|
-
var
|
|
6584
|
+
var _this16 = this;
|
|
6626
6585
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6627
6586
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6628
6587
|
while (1) switch (_context68.prev = _context68.next) {
|
|
@@ -6646,8 +6605,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6646
6605
|
case 8:
|
|
6647
6606
|
hasChanged = false;
|
|
6648
6607
|
enrichedProducts = products.map(function (product) {
|
|
6649
|
-
var productWithBundleSnapshots =
|
|
6650
|
-
var nextProduct =
|
|
6608
|
+
var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6609
|
+
var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6651
6610
|
if (nextProduct !== product) hasChanged = true;
|
|
6652
6611
|
return nextProduct;
|
|
6653
6612
|
});
|
|
@@ -6675,13 +6634,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6675
6634
|
}, {
|
|
6676
6635
|
key: "withPendingSyncProductTitles",
|
|
6677
6636
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6678
|
-
var
|
|
6637
|
+
var _this17 = this;
|
|
6679
6638
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6680
6639
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6681
6640
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6682
6641
|
products: products.map(function (product) {
|
|
6683
6642
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6684
|
-
product_title:
|
|
6643
|
+
product_title: _this17.buildProductTitleSnapshot(product, productMap)
|
|
6685
6644
|
});
|
|
6686
6645
|
})
|
|
6687
6646
|
});
|
|
@@ -6692,7 +6651,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6692
6651
|
var _product$product_id4,
|
|
6693
6652
|
_product$product,
|
|
6694
6653
|
_fallbackProduct$prod,
|
|
6695
|
-
|
|
6654
|
+
_this18 = this;
|
|
6696
6655
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6697
6656
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6698
6657
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -6700,7 +6659,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6700
6659
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6701
6660
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6702
6661
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6703
|
-
snapshot[key] =
|
|
6662
|
+
snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6704
6663
|
return snapshot;
|
|
6705
6664
|
}, {});
|
|
6706
6665
|
}
|
|
@@ -6799,14 +6758,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6799
6758
|
key: "enrichPaymentNamesByCode",
|
|
6800
6759
|
value: function () {
|
|
6801
6760
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6802
|
-
var
|
|
6761
|
+
var _this19 = this;
|
|
6803
6762
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6804
6763
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6805
6764
|
while (1) switch (_context69.prev = _context69.next) {
|
|
6806
6765
|
case 0:
|
|
6807
6766
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6808
6767
|
hasMissingName = payments.some(function (payment) {
|
|
6809
|
-
return
|
|
6768
|
+
return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
6810
6769
|
});
|
|
6811
6770
|
if (hasMissingName) {
|
|
6812
6771
|
_context69.next = 4;
|
|
@@ -6839,9 +6798,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6839
6798
|
}
|
|
6840
6799
|
hasResolvedName = false;
|
|
6841
6800
|
enrichedPayments = payments.map(function (payment) {
|
|
6842
|
-
if (!
|
|
6843
|
-
if (!
|
|
6844
|
-
var name = nameByCode.get(
|
|
6801
|
+
if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
6802
|
+
if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
6803
|
+
var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
6845
6804
|
if (!name) return payment;
|
|
6846
6805
|
hasResolvedName = true;
|
|
6847
6806
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7423,10 +7382,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7423
7382
|
value: function extractBackendErrorResponse(error) {
|
|
7424
7383
|
var _error$response3,
|
|
7425
7384
|
_error$response4,
|
|
7426
|
-
|
|
7385
|
+
_this20 = this;
|
|
7427
7386
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
7428
7387
|
return candidates.find(function (candidate) {
|
|
7429
|
-
return
|
|
7388
|
+
return _this20.isExplicitBackendErrorResponse(candidate);
|
|
7430
7389
|
}) || null;
|
|
7431
7390
|
}
|
|
7432
7391
|
}, {
|
|
@@ -7787,7 +7746,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7787
7746
|
value: (function () {
|
|
7788
7747
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7789
7748
|
var _menu_list_ids$length3,
|
|
7790
|
-
|
|
7749
|
+
_this21 = this;
|
|
7791
7750
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
7792
7751
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7793
7752
|
while (1) switch (_context75.prev = _context75.next) {
|
|
@@ -7986,9 +7945,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7986
7945
|
}
|
|
7987
7946
|
tMenu = performance.now();
|
|
7988
7947
|
getActiveMenus = function getActiveMenus() {
|
|
7989
|
-
return
|
|
7990
|
-
var
|
|
7991
|
-
return ((
|
|
7948
|
+
return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
7949
|
+
var _this21$schedule;
|
|
7950
|
+
return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
7992
7951
|
});
|
|
7993
7952
|
};
|
|
7994
7953
|
activeMenuList = getActiveMenus();
|
|
@@ -8297,7 +8256,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8297
8256
|
}, {
|
|
8298
8257
|
key: "notifySalesSearchSubscribers",
|
|
8299
8258
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8300
|
-
var
|
|
8259
|
+
var _this22 = this;
|
|
8301
8260
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8302
8261
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8303
8262
|
if (changedOrders.length === 0) {
|
|
@@ -8315,21 +8274,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8315
8274
|
subscriber = _step20$value[1];
|
|
8316
8275
|
try {
|
|
8317
8276
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8318
|
-
var orderId =
|
|
8277
|
+
var orderId = _this22.getSalesSearchOrderId(order);
|
|
8319
8278
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8320
8279
|
});
|
|
8321
8280
|
if (changedVisibleOrders.length === 0) {
|
|
8322
8281
|
return 1; // continue
|
|
8323
8282
|
}
|
|
8324
|
-
subscriber.callback(
|
|
8325
|
-
|
|
8283
|
+
subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8284
|
+
_this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8326
8285
|
subscriberId: subscriberId,
|
|
8327
8286
|
kind: subscriber.kind,
|
|
8328
8287
|
count: changedVisibleOrders.length
|
|
8329
8288
|
});
|
|
8330
8289
|
} catch (error) {
|
|
8331
8290
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8332
|
-
|
|
8291
|
+
_this22.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8333
8292
|
subscriberId: subscriberId,
|
|
8334
8293
|
error: errorMessage
|
|
8335
8294
|
});
|
|
@@ -10,7 +10,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
10
10
|
private store;
|
|
11
11
|
private request;
|
|
12
12
|
private logger;
|
|
13
|
-
private dbManager;
|
|
14
13
|
private floorPlanDataSource;
|
|
15
14
|
private pendingSyncMessages;
|
|
16
15
|
private syncTimer?;
|
|
@@ -29,9 +28,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
29
28
|
private mergeItems;
|
|
30
29
|
private removeByIds;
|
|
31
30
|
private loadListFromServer;
|
|
32
|
-
private loadListFromSQLite;
|
|
33
|
-
private saveListToSQLite;
|
|
34
|
-
private refreshListFromServer;
|
|
35
31
|
fetchByIdFromServer(id: number | string): Promise<FloorPlanItem | null>;
|
|
36
32
|
fetchByCodeFromServer(code: string): Promise<FloorPlanItem | null>;
|
|
37
33
|
preload(): Promise<void>;
|