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