@pisell/pisellos 2.3.60 → 2.3.61
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 +66 -109
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -24
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +204 -49
- package/dist/modules/ProductList/index.js +2 -1
- 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 +90 -130
- 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 +7 -12
- package/dist/server/modules/order/index.js +96 -248
- 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/index.d.ts +5 -0
- package/dist/solution/BaseSales/index.js +311 -281
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +3 -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/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -10
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +183 -15
- package/lib/modules/ProductList/index.js +2 -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 +8 -18
- 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 +7 -12
- package/lib/server/modules/order/index.js +28 -143
- 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/index.d.ts +5 -0
- package/lib/solution/BaseSales/index.js +11 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2717,7 +2717,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
2717
2717
|
key: "setupProductsQuotationPriceBridge",
|
|
2718
2718
|
value: (function () {
|
|
2719
2719
|
var _setupProductsQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2720
|
-
var _this5 = this;
|
|
2721
2720
|
var _this$core$context, errorMessage;
|
|
2722
2721
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2723
2722
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -2737,42 +2736,31 @@ var Server = /*#__PURE__*/function () {
|
|
|
2737
2736
|
return _context33.abrupt("return");
|
|
2738
2737
|
case 6:
|
|
2739
2738
|
_context33.prev = 6;
|
|
2739
|
+
_context33.next = 9;
|
|
2740
|
+
return this.schedule.loadAllSchedule();
|
|
2741
|
+
case 9:
|
|
2740
2742
|
this.products.clearPriceCache();
|
|
2741
|
-
_context33.next =
|
|
2743
|
+
_context33.next = 12;
|
|
2742
2744
|
return this.products.setupQuotationPriceBridge({
|
|
2743
2745
|
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
|
-
});
|
|
2746
|
+
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
2760
2747
|
});
|
|
2748
|
+
case 12:
|
|
2761
2749
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
2762
|
-
_context33.next =
|
|
2750
|
+
_context33.next = 19;
|
|
2763
2751
|
break;
|
|
2764
|
-
case
|
|
2765
|
-
_context33.prev =
|
|
2752
|
+
case 15:
|
|
2753
|
+
_context33.prev = 15;
|
|
2766
2754
|
_context33.t0 = _context33["catch"](6);
|
|
2767
2755
|
errorMessage = _context33.t0 instanceof Error ? _context33.t0.message : String(_context33.t0);
|
|
2768
2756
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
2769
2757
|
error: errorMessage
|
|
2770
2758
|
});
|
|
2771
|
-
case
|
|
2759
|
+
case 19:
|
|
2772
2760
|
case "end":
|
|
2773
2761
|
return _context33.stop();
|
|
2774
2762
|
}
|
|
2775
|
-
}, _callee33, this, [[6,
|
|
2763
|
+
}, _callee33, this, [[6, 15]]);
|
|
2776
2764
|
}));
|
|
2777
2765
|
function setupProductsQuotationPriceBridge() {
|
|
2778
2766
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -2842,58 +2830,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2842
2830
|
key: "refreshProductsInBackground",
|
|
2843
2831
|
value: (function () {
|
|
2844
2832
|
var _refreshProductsInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2845
|
-
var
|
|
2846
|
-
trigger,
|
|
2847
|
-
startTime,
|
|
2848
|
-
duration,
|
|
2849
|
-
_duration2,
|
|
2850
|
-
errorMessage,
|
|
2851
|
-
_args34 = arguments;
|
|
2833
|
+
var startTime, duration, _duration2, errorMessage;
|
|
2852
2834
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2853
2835
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2854
2836
|
case 0:
|
|
2855
|
-
options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
|
|
2856
2837
|
if (this.products) {
|
|
2857
|
-
_context34.next =
|
|
2838
|
+
_context34.next = 3;
|
|
2858
2839
|
break;
|
|
2859
2840
|
}
|
|
2860
2841
|
this.logWarning('refreshProductsInBackground: Products 模块未注册');
|
|
2861
2842
|
return _context34.abrupt("return");
|
|
2862
|
-
case
|
|
2863
|
-
|
|
2864
|
-
this.logInfo('refreshProductsInBackground 开始', {
|
|
2865
|
-
trigger: trigger
|
|
2866
|
-
});
|
|
2843
|
+
case 3:
|
|
2844
|
+
this.logInfo('refreshProductsInBackground 开始');
|
|
2867
2845
|
startTime = Date.now();
|
|
2868
|
-
_context34.prev =
|
|
2869
|
-
_context34.next =
|
|
2870
|
-
return this.products.silentRefresh(
|
|
2871
|
-
|
|
2872
|
-
});
|
|
2873
|
-
case 10:
|
|
2846
|
+
_context34.prev = 5;
|
|
2847
|
+
_context34.next = 8;
|
|
2848
|
+
return this.products.silentRefresh();
|
|
2849
|
+
case 8:
|
|
2874
2850
|
duration = Date.now() - startTime;
|
|
2875
2851
|
this.logInfo('refreshProductsInBackground 完成', {
|
|
2876
|
-
trigger: trigger,
|
|
2877
2852
|
duration: "".concat(duration, "ms")
|
|
2878
2853
|
});
|
|
2879
|
-
_context34.next =
|
|
2854
|
+
_context34.next = 18;
|
|
2880
2855
|
break;
|
|
2881
|
-
case
|
|
2882
|
-
_context34.prev =
|
|
2883
|
-
_context34.t0 = _context34["catch"](
|
|
2856
|
+
case 12:
|
|
2857
|
+
_context34.prev = 12;
|
|
2858
|
+
_context34.t0 = _context34["catch"](5);
|
|
2884
2859
|
_duration2 = Date.now() - startTime;
|
|
2885
2860
|
errorMessage = _context34.t0 instanceof Error ? _context34.t0.message : String(_context34.t0);
|
|
2886
2861
|
console.error('[Server] refreshProductsInBackground 失败:', _context34.t0);
|
|
2887
2862
|
this.logError('refreshProductsInBackground 失败', {
|
|
2888
|
-
trigger: trigger,
|
|
2889
2863
|
duration: "".concat(_duration2, "ms"),
|
|
2890
2864
|
error: errorMessage
|
|
2891
2865
|
});
|
|
2892
|
-
case
|
|
2866
|
+
case 18:
|
|
2893
2867
|
case "end":
|
|
2894
2868
|
return _context34.stop();
|
|
2895
2869
|
}
|
|
2896
|
-
}, _callee34, this, [[
|
|
2870
|
+
}, _callee34, this, [[5, 12]]);
|
|
2897
2871
|
}));
|
|
2898
2872
|
function refreshProductsInBackground() {
|
|
2899
2873
|
return _refreshProductsInBackground.apply(this, arguments);
|
|
@@ -2910,58 +2884,44 @@ var Server = /*#__PURE__*/function () {
|
|
|
2910
2884
|
key: "refreshOrdersInBackground",
|
|
2911
2885
|
value: (function () {
|
|
2912
2886
|
var _refreshOrdersInBackground = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2913
|
-
var
|
|
2914
|
-
trigger,
|
|
2915
|
-
startTime,
|
|
2916
|
-
duration,
|
|
2917
|
-
_duration3,
|
|
2918
|
-
errorMessage,
|
|
2919
|
-
_args35 = arguments;
|
|
2887
|
+
var startTime, duration, _duration3, errorMessage;
|
|
2920
2888
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2921
2889
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2922
2890
|
case 0:
|
|
2923
|
-
options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
2924
2891
|
if (this.order) {
|
|
2925
|
-
_context35.next =
|
|
2892
|
+
_context35.next = 3;
|
|
2926
2893
|
break;
|
|
2927
2894
|
}
|
|
2928
2895
|
this.logWarning('refreshOrdersInBackground: Order 模块未注册');
|
|
2929
2896
|
return _context35.abrupt("return");
|
|
2930
|
-
case
|
|
2931
|
-
|
|
2932
|
-
this.logInfo('refreshOrdersInBackground 开始', {
|
|
2933
|
-
trigger: trigger
|
|
2934
|
-
});
|
|
2897
|
+
case 3:
|
|
2898
|
+
this.logInfo('refreshOrdersInBackground 开始');
|
|
2935
2899
|
startTime = Date.now();
|
|
2936
|
-
_context35.prev =
|
|
2937
|
-
_context35.next =
|
|
2938
|
-
return this.order.silentRefresh(
|
|
2939
|
-
|
|
2940
|
-
});
|
|
2941
|
-
case 10:
|
|
2900
|
+
_context35.prev = 5;
|
|
2901
|
+
_context35.next = 8;
|
|
2902
|
+
return this.order.silentRefresh();
|
|
2903
|
+
case 8:
|
|
2942
2904
|
duration = Date.now() - startTime;
|
|
2943
2905
|
this.logInfo('refreshOrdersInBackground 完成', {
|
|
2944
|
-
trigger: trigger,
|
|
2945
2906
|
duration: "".concat(duration, "ms")
|
|
2946
2907
|
});
|
|
2947
|
-
_context35.next =
|
|
2908
|
+
_context35.next = 18;
|
|
2948
2909
|
break;
|
|
2949
|
-
case
|
|
2950
|
-
_context35.prev =
|
|
2951
|
-
_context35.t0 = _context35["catch"](
|
|
2910
|
+
case 12:
|
|
2911
|
+
_context35.prev = 12;
|
|
2912
|
+
_context35.t0 = _context35["catch"](5);
|
|
2952
2913
|
_duration3 = Date.now() - startTime;
|
|
2953
2914
|
errorMessage = _context35.t0 instanceof Error ? _context35.t0.message : String(_context35.t0);
|
|
2954
2915
|
console.error('[Server] refreshOrdersInBackground 失败:', _context35.t0);
|
|
2955
2916
|
this.logError('refreshOrdersInBackground 失败', {
|
|
2956
|
-
trigger: trigger,
|
|
2957
2917
|
duration: "".concat(_duration3, "ms"),
|
|
2958
2918
|
error: errorMessage
|
|
2959
2919
|
});
|
|
2960
|
-
case
|
|
2920
|
+
case 18:
|
|
2961
2921
|
case "end":
|
|
2962
2922
|
return _context35.stop();
|
|
2963
2923
|
}
|
|
2964
|
-
}, _callee35, this, [[
|
|
2924
|
+
}, _callee35, this, [[5, 12]]);
|
|
2965
2925
|
}));
|
|
2966
2926
|
function refreshOrdersInBackground() {
|
|
2967
2927
|
return _refreshOrdersInBackground.apply(this, arguments);
|
|
@@ -3275,10 +3235,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3275
3235
|
}, {
|
|
3276
3236
|
key: "getAllRoutes",
|
|
3277
3237
|
value: function getAllRoutes() {
|
|
3278
|
-
var
|
|
3238
|
+
var _this5 = this;
|
|
3279
3239
|
var routes = [];
|
|
3280
3240
|
['get', 'post', 'put', 'remove'].forEach(function (method) {
|
|
3281
|
-
Object.keys(
|
|
3241
|
+
Object.keys(_this5.router[method]).forEach(function (path) {
|
|
3282
3242
|
routes.push({
|
|
3283
3243
|
method: method,
|
|
3284
3244
|
path: path
|
|
@@ -3408,7 +3368,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3408
3368
|
key: "getPaymentRouteModule",
|
|
3409
3369
|
value: function () {
|
|
3410
3370
|
var _getPaymentRouteModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3411
|
-
var
|
|
3371
|
+
var _this6 = this;
|
|
3412
3372
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3413
3373
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3414
3374
|
case 0:
|
|
@@ -3437,13 +3397,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3437
3397
|
case 0:
|
|
3438
3398
|
module = new PaymentServerModule('server_payment_route', '1.0.0');
|
|
3439
3399
|
_context39.next = 3;
|
|
3440
|
-
return module.initialize(
|
|
3400
|
+
return module.initialize(_this6.core, {
|
|
3441
3401
|
store: {
|
|
3442
3402
|
payMethods: []
|
|
3443
3403
|
}
|
|
3444
3404
|
});
|
|
3445
3405
|
case 3:
|
|
3446
|
-
|
|
3406
|
+
_this6.paymentRouteModule = module;
|
|
3447
3407
|
return _context39.abrupt("return", module);
|
|
3448
3408
|
case 5:
|
|
3449
3409
|
case "end":
|
|
@@ -3451,7 +3411,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3451
3411
|
}
|
|
3452
3412
|
}, _callee39);
|
|
3453
3413
|
}))().finally(function () {
|
|
3454
|
-
|
|
3414
|
+
_this6.paymentRouteModuleInFlight = undefined;
|
|
3455
3415
|
});
|
|
3456
3416
|
return _context40.abrupt("return", this.paymentRouteModuleInFlight);
|
|
3457
3417
|
case 8:
|
|
@@ -3627,7 +3587,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3627
3587
|
}, {
|
|
3628
3588
|
key: "scheduleSubscriberTimePointReloads",
|
|
3629
3589
|
value: function scheduleSubscriberTimePointReloads(subscriberId, timePoints) {
|
|
3630
|
-
var
|
|
3590
|
+
var _this7 = this;
|
|
3631
3591
|
var subscriber = this.productQuerySubscribers.get(subscriberId);
|
|
3632
3592
|
if (!subscriber || !timePoints.length) return;
|
|
3633
3593
|
var scheduleDate = subscriber.context.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
@@ -3648,7 +3608,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3648
3608
|
setInterval(function () {
|
|
3649
3609
|
var currentTime = dayjs().format('hh:mm');
|
|
3650
3610
|
if (timePoints.includes(currentTime)) {
|
|
3651
|
-
|
|
3611
|
+
_this7.onScheduleTimePointTimerFire(subscriberId);
|
|
3652
3612
|
}
|
|
3653
3613
|
}, 60000);
|
|
3654
3614
|
if (timerIds.length > 0) {
|
|
@@ -3817,7 +3777,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3817
3777
|
key: "refreshMenuScheduleCacheAfterEmptyResult",
|
|
3818
3778
|
value: (function () {
|
|
3819
3779
|
var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3820
|
-
var
|
|
3780
|
+
var _this8 = this;
|
|
3821
3781
|
var now;
|
|
3822
3782
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3823
3783
|
while (1) switch (_context44.prev = _context44.next) {
|
|
@@ -3840,11 +3800,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
3840
3800
|
this.menuScheduleRefreshInFlight = Promise.all([this.menu.loadMenuList(), this.schedule.loadAllSchedule()]).then(function () {
|
|
3841
3801
|
return undefined;
|
|
3842
3802
|
}).catch(function (error) {
|
|
3843
|
-
|
|
3803
|
+
_this8.logWarning('刷新菜单/日程缓存失败,继续使用现有缓存', {
|
|
3844
3804
|
error: error instanceof Error ? error.message : String(error)
|
|
3845
3805
|
});
|
|
3846
3806
|
}).finally(function () {
|
|
3847
|
-
|
|
3807
|
+
_this8.menuScheduleRefreshInFlight = null;
|
|
3848
3808
|
});
|
|
3849
3809
|
}
|
|
3850
3810
|
_context44.next = 8;
|
|
@@ -4030,10 +3990,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
4030
3990
|
}, {
|
|
4031
3991
|
key: "stripSalesSearchPageParams",
|
|
4032
3992
|
value: function stripSalesSearchPageParams(value) {
|
|
4033
|
-
var
|
|
3993
|
+
var _this9 = this;
|
|
4034
3994
|
if (Array.isArray(value)) {
|
|
4035
3995
|
return value.map(function (item) {
|
|
4036
|
-
return
|
|
3996
|
+
return _this9.stripSalesSearchPageParams(item);
|
|
4037
3997
|
});
|
|
4038
3998
|
}
|
|
4039
3999
|
if (!value || _typeof(value) !== 'object') return value;
|
|
@@ -4071,12 +4031,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4071
4031
|
key: "extractSalesSearchOrderIds",
|
|
4072
4032
|
value: function extractSalesSearchOrderIds(kind, result) {
|
|
4073
4033
|
var _this$findSalesSearch,
|
|
4074
|
-
|
|
4034
|
+
_this10 = this;
|
|
4075
4035
|
var data = this.extractSalesSearchResponseData(result);
|
|
4076
4036
|
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
4037
|
if (!Array.isArray(list)) return [];
|
|
4078
4038
|
return list.map(function (item) {
|
|
4079
|
-
return
|
|
4039
|
+
return _this10.getSalesSearchOrderId(item);
|
|
4080
4040
|
}).filter(function (id) {
|
|
4081
4041
|
return !!id;
|
|
4082
4042
|
});
|
|
@@ -4243,11 +4203,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
4243
4203
|
}, {
|
|
4244
4204
|
key: "stableSerialize",
|
|
4245
4205
|
value: function stableSerialize(value) {
|
|
4246
|
-
var
|
|
4206
|
+
var _this11 = this;
|
|
4247
4207
|
if (value === null || value === undefined) return 'null';
|
|
4248
4208
|
if (Array.isArray(value)) {
|
|
4249
4209
|
return "[".concat(value.map(function (item) {
|
|
4250
|
-
return
|
|
4210
|
+
return _this11.stableSerialize(item);
|
|
4251
4211
|
}).join(','), "]");
|
|
4252
4212
|
}
|
|
4253
4213
|
if (_typeof(value) === 'object') {
|
|
@@ -4256,7 +4216,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4256
4216
|
return obj[k] !== undefined;
|
|
4257
4217
|
}).sort();
|
|
4258
4218
|
return "{".concat(keys.map(function (k) {
|
|
4259
|
-
return "".concat(JSON.stringify(k), ":").concat(
|
|
4219
|
+
return "".concat(JSON.stringify(k), ":").concat(_this11.stableSerialize(obj[k]));
|
|
4260
4220
|
}).join(','), "}");
|
|
4261
4221
|
}
|
|
4262
4222
|
return JSON.stringify(value);
|
|
@@ -4796,7 +4756,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4796
4756
|
key: "runLocalPaymentUpdateInQueue",
|
|
4797
4757
|
value: function () {
|
|
4798
4758
|
var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(key, task, context) {
|
|
4799
|
-
var
|
|
4759
|
+
var _this12 = this;
|
|
4800
4760
|
var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
|
|
4801
4761
|
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
|
4802
4762
|
while (1) switch (_context50.prev = _context50.next) {
|
|
@@ -4815,7 +4775,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4815
4775
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4816
4776
|
while (1) switch (_context49.prev = _context49.next) {
|
|
4817
4777
|
case 0:
|
|
4818
|
-
|
|
4778
|
+
_this12.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
|
|
4819
4779
|
queue_key: key,
|
|
4820
4780
|
queue_wait_ms: Date.now() - queuedAt
|
|
4821
4781
|
}));
|
|
@@ -6210,7 +6170,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6210
6170
|
key: "handlePendingSyncCheckoutOrder",
|
|
6211
6171
|
value: function () {
|
|
6212
6172
|
var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
|
|
6213
|
-
var
|
|
6173
|
+
var _this13 = this;
|
|
6214
6174
|
var backendPath, data, title, reason, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
|
|
6215
6175
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
6216
6176
|
while (1) switch (_context63.prev = _context63.next) {
|
|
@@ -6263,7 +6223,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6263
6223
|
});
|
|
6264
6224
|
changeGivenAmount = pendingOrder === null || pendingOrder === void 0 || (_pendingOrder$payment = pendingOrder.payments) === null || _pendingOrder$payment === void 0 ? void 0 : _pendingOrder$payment.reduce(function (sum, payment) {
|
|
6265
6225
|
var _payment$metadata;
|
|
6266
|
-
return sum +
|
|
6226
|
+
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
6227
|
}, 0);
|
|
6268
6228
|
return _context63.abrupt("return", {
|
|
6269
6229
|
code: 200,
|
|
@@ -6403,13 +6363,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6403
6363
|
}, {
|
|
6404
6364
|
key: "sumPaidOrderPayments",
|
|
6405
6365
|
value: function sumPaidOrderPayments(payments) {
|
|
6406
|
-
var
|
|
6366
|
+
var _this14 = this;
|
|
6407
6367
|
if (!Array.isArray(payments)) return 0;
|
|
6408
6368
|
return payments.reduce(function (sum, payment) {
|
|
6409
6369
|
var _payment$amount;
|
|
6410
6370
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
6411
6371
|
if (status !== 'paid') return sum;
|
|
6412
|
-
return sum +
|
|
6372
|
+
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
6373
|
}, 0);
|
|
6414
6374
|
}
|
|
6415
6375
|
}, {
|
|
@@ -6425,7 +6385,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6425
6385
|
value: function () {
|
|
6426
6386
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(order) {
|
|
6427
6387
|
var _this$products3,
|
|
6428
|
-
|
|
6388
|
+
_this15 = this;
|
|
6429
6389
|
var products, productIdSet, productIds, entries;
|
|
6430
6390
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6431
6391
|
while (1) switch (_context66.prev = _context66.next) {
|
|
@@ -6458,20 +6418,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6458
6418
|
_context66.next = 8;
|
|
6459
6419
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
6460
6420
|
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
|
|
6461
|
-
var
|
|
6421
|
+
var _this15$products, _this15$products$getP, product;
|
|
6462
6422
|
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
6463
6423
|
while (1) switch (_context65.prev = _context65.next) {
|
|
6464
6424
|
case 0:
|
|
6465
6425
|
_context65.prev = 0;
|
|
6466
6426
|
_context65.next = 3;
|
|
6467
|
-
return (
|
|
6427
|
+
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
6428
|
case 3:
|
|
6469
6429
|
product = _context65.sent;
|
|
6470
6430
|
return _context65.abrupt("return", product ? [String(id), product] : null);
|
|
6471
6431
|
case 7:
|
|
6472
6432
|
_context65.prev = 7;
|
|
6473
6433
|
_context65.t0 = _context65["catch"](0);
|
|
6474
|
-
|
|
6434
|
+
_this15.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
6475
6435
|
product_id: id,
|
|
6476
6436
|
error: _context65.t0 instanceof Error ? _context65.t0.message : String(_context65.t0)
|
|
6477
6437
|
});
|
|
@@ -6622,7 +6582,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6622
6582
|
key: "withSalesDetailProductSnapshots",
|
|
6623
6583
|
value: function () {
|
|
6624
6584
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(order) {
|
|
6625
|
-
var
|
|
6585
|
+
var _this16 = this;
|
|
6626
6586
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
6627
6587
|
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
6628
6588
|
while (1) switch (_context68.prev = _context68.next) {
|
|
@@ -6646,8 +6606,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
6646
6606
|
case 8:
|
|
6647
6607
|
hasChanged = false;
|
|
6648
6608
|
enrichedProducts = products.map(function (product) {
|
|
6649
|
-
var productWithBundleSnapshots =
|
|
6650
|
-
var nextProduct =
|
|
6609
|
+
var productWithBundleSnapshots = _this16.withBundleCatalogSnapshots(product, snapshotMap);
|
|
6610
|
+
var nextProduct = _this16.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
6651
6611
|
if (nextProduct !== product) hasChanged = true;
|
|
6652
6612
|
return nextProduct;
|
|
6653
6613
|
});
|
|
@@ -6675,13 +6635,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6675
6635
|
}, {
|
|
6676
6636
|
key: "withPendingSyncProductTitles",
|
|
6677
6637
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
6678
|
-
var
|
|
6638
|
+
var _this17 = this;
|
|
6679
6639
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
6680
6640
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
6681
6641
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
6682
6642
|
products: products.map(function (product) {
|
|
6683
6643
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
6684
|
-
product_title:
|
|
6644
|
+
product_title: _this17.buildProductTitleSnapshot(product, productMap)
|
|
6685
6645
|
});
|
|
6686
6646
|
})
|
|
6687
6647
|
});
|
|
@@ -6692,7 +6652,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6692
6652
|
var _product$product_id4,
|
|
6693
6653
|
_product$product,
|
|
6694
6654
|
_fallbackProduct$prod,
|
|
6695
|
-
|
|
6655
|
+
_this18 = this;
|
|
6696
6656
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
6697
6657
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
6698
6658
|
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 +6660,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6700
6660
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
6701
6661
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
6702
6662
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
6703
|
-
snapshot[key] =
|
|
6663
|
+
snapshot[key] = _this18.resolveProductTitleValue(ownTitle, key, currentLocale) || _this18.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
6704
6664
|
return snapshot;
|
|
6705
6665
|
}, {});
|
|
6706
6666
|
}
|
|
@@ -6799,14 +6759,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
6799
6759
|
key: "enrichPaymentNamesByCode",
|
|
6800
6760
|
value: function () {
|
|
6801
6761
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(order) {
|
|
6802
|
-
var
|
|
6762
|
+
var _this19 = this;
|
|
6803
6763
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
6804
6764
|
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
6805
6765
|
while (1) switch (_context69.prev = _context69.next) {
|
|
6806
6766
|
case 0:
|
|
6807
6767
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
6808
6768
|
hasMissingName = payments.some(function (payment) {
|
|
6809
|
-
return
|
|
6769
|
+
return _this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
6810
6770
|
});
|
|
6811
6771
|
if (hasMissingName) {
|
|
6812
6772
|
_context69.next = 4;
|
|
@@ -6839,9 +6799,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6839
6799
|
}
|
|
6840
6800
|
hasResolvedName = false;
|
|
6841
6801
|
enrichedPayments = payments.map(function (payment) {
|
|
6842
|
-
if (!
|
|
6843
|
-
if (!
|
|
6844
|
-
var name = nameByCode.get(
|
|
6802
|
+
if (!_this19.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
6803
|
+
if (!_this19.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
6804
|
+
var name = nameByCode.get(_this19.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
6845
6805
|
if (!name) return payment;
|
|
6846
6806
|
hasResolvedName = true;
|
|
6847
6807
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -7423,10 +7383,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
7423
7383
|
value: function extractBackendErrorResponse(error) {
|
|
7424
7384
|
var _error$response3,
|
|
7425
7385
|
_error$response4,
|
|
7426
|
-
|
|
7386
|
+
_this20 = this;
|
|
7427
7387
|
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
7388
|
return candidates.find(function (candidate) {
|
|
7429
|
-
return
|
|
7389
|
+
return _this20.isExplicitBackendErrorResponse(candidate);
|
|
7430
7390
|
}) || null;
|
|
7431
7391
|
}
|
|
7432
7392
|
}, {
|
|
@@ -7787,7 +7747,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7787
7747
|
value: (function () {
|
|
7788
7748
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(context, options) {
|
|
7789
7749
|
var _menu_list_ids$length3,
|
|
7790
|
-
|
|
7750
|
+
_this21 = this;
|
|
7791
7751
|
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
7752
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7793
7753
|
while (1) switch (_context75.prev = _context75.next) {
|
|
@@ -7986,9 +7946,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7986
7946
|
}
|
|
7987
7947
|
tMenu = performance.now();
|
|
7988
7948
|
getActiveMenus = function getActiveMenus() {
|
|
7989
|
-
return
|
|
7990
|
-
var
|
|
7991
|
-
return ((
|
|
7949
|
+
return _this21.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
7950
|
+
var _this21$schedule;
|
|
7951
|
+
return ((_this21$schedule = _this21.schedule) === null || _this21$schedule === void 0 ? void 0 : _this21$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
7992
7952
|
});
|
|
7993
7953
|
};
|
|
7994
7954
|
activeMenuList = getActiveMenus();
|
|
@@ -8297,7 +8257,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8297
8257
|
}, {
|
|
8298
8258
|
key: "notifySalesSearchSubscribers",
|
|
8299
8259
|
value: function notifySalesSearchSubscribers(payload) {
|
|
8300
|
-
var
|
|
8260
|
+
var _this22 = this;
|
|
8301
8261
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
8302
8262
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
8303
8263
|
if (changedOrders.length === 0) {
|
|
@@ -8315,21 +8275,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
8315
8275
|
subscriber = _step20$value[1];
|
|
8316
8276
|
try {
|
|
8317
8277
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
8318
|
-
var orderId =
|
|
8278
|
+
var orderId = _this22.getSalesSearchOrderId(order);
|
|
8319
8279
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
8320
8280
|
});
|
|
8321
8281
|
if (changedVisibleOrders.length === 0) {
|
|
8322
8282
|
return 1; // continue
|
|
8323
8283
|
}
|
|
8324
|
-
subscriber.callback(
|
|
8325
|
-
|
|
8284
|
+
subscriber.callback(_this22.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
8285
|
+
_this22.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
8326
8286
|
subscriberId: subscriberId,
|
|
8327
8287
|
kind: subscriber.kind,
|
|
8328
8288
|
count: changedVisibleOrders.length
|
|
8329
8289
|
});
|
|
8330
8290
|
} catch (error) {
|
|
8331
8291
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
8332
|
-
|
|
8292
|
+
_this22.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
8333
8293
|
subscriberId: subscriberId,
|
|
8334
8294
|
error: errorMessage
|
|
8335
8295
|
});
|
|
@@ -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>;
|