@pisell/pisellos 2.3.44 → 2.3.45

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.
Files changed (146) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Discount/index.d.ts +0 -1
  3. package/dist/modules/Discount/index.js +11 -40
  4. package/dist/modules/Discount/types.d.ts +0 -1
  5. package/dist/modules/OpenData/index.js +2 -2
  6. package/dist/modules/Order/index.d.ts +2 -4
  7. package/dist/modules/Order/index.js +25 -54
  8. package/dist/modules/Order/types.d.ts +0 -9
  9. package/dist/modules/Order/utils.d.ts +0 -10
  10. package/dist/modules/Order/utils.js +3 -35
  11. package/dist/modules/Product/types.d.ts +0 -1
  12. package/dist/modules/ProductList/index.js +14 -33
  13. package/dist/modules/Quotation/index.d.ts +1 -1
  14. package/dist/modules/Quotation/index.js +2 -2
  15. package/dist/modules/Rules/index.js +13 -47
  16. package/dist/modules/SalesSummary/index.js +13 -12
  17. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  18. package/dist/modules/ScanOrderLogger/index.js +2 -15
  19. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  20. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  21. package/dist/modules/Schedule/index.d.ts +1 -3
  22. package/dist/modules/Schedule/index.js +16 -21
  23. package/dist/modules/Summary/utils.js +13 -38
  24. package/dist/modules/index.d.ts +0 -2
  25. package/dist/modules/index.js +1 -3
  26. package/dist/plugins/window.d.ts +0 -1
  27. package/dist/server/index.d.ts +0 -14
  28. package/dist/server/index.js +657 -772
  29. package/dist/solution/BaseSales/index.d.ts +0 -7
  30. package/dist/solution/BaseSales/index.js +42 -64
  31. package/dist/solution/BookingByStep/index.d.ts +1 -16
  32. package/dist/solution/BookingByStep/index.js +215 -294
  33. package/dist/solution/BookingByStep/types.d.ts +1 -2
  34. package/dist/solution/BookingByStep/types.js +1 -3
  35. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  36. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  37. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  38. package/dist/solution/BookingTicket/index.d.ts +2 -14
  39. package/dist/solution/BookingTicket/index.js +2 -2
  40. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  41. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  42. package/dist/solution/ScanOrder/index.d.ts +14 -26
  43. package/dist/solution/ScanOrder/index.js +739 -1142
  44. package/dist/solution/ScanOrder/types.d.ts +1 -21
  45. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  46. package/dist/solution/ScanOrder/utils.js +25 -66
  47. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  48. package/dist/solution/ShopDiscount/index.js +87 -125
  49. package/dist/solution/VenueBooking/index.d.ts +11 -39
  50. package/dist/solution/VenueBooking/index.js +841 -1167
  51. package/dist/solution/VenueBooking/types.d.ts +0 -3
  52. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  53. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  54. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  55. package/dist/solution/index.d.ts +0 -1
  56. package/dist/solution/index.js +1 -2
  57. package/dist/types/index.d.ts +0 -1
  58. package/lib/modules/Discount/index.d.ts +0 -1
  59. package/lib/modules/Discount/index.js +0 -9
  60. package/lib/modules/Discount/types.d.ts +0 -1
  61. package/lib/modules/OpenData/index.js +1 -1
  62. package/lib/modules/Order/index.d.ts +2 -4
  63. package/lib/modules/Order/index.js +10 -26
  64. package/lib/modules/Order/types.d.ts +0 -9
  65. package/lib/modules/Order/utils.d.ts +0 -10
  66. package/lib/modules/Order/utils.js +5 -36
  67. package/lib/modules/Product/types.d.ts +0 -1
  68. package/lib/modules/ProductList/index.js +31 -40
  69. package/lib/modules/Quotation/index.d.ts +1 -1
  70. package/lib/modules/Quotation/index.js +2 -2
  71. package/lib/modules/Rules/index.js +16 -33
  72. package/lib/modules/SalesSummary/index.js +7 -6
  73. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  74. package/lib/modules/ScanOrderLogger/index.js +1 -13
  75. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  76. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  77. package/lib/modules/Schedule/index.d.ts +1 -3
  78. package/lib/modules/Schedule/index.js +8 -10
  79. package/lib/modules/Summary/utils.js +1 -21
  80. package/lib/modules/index.d.ts +0 -2
  81. package/lib/modules/index.js +1 -5
  82. package/lib/plugins/window.d.ts +0 -1
  83. package/lib/server/index.d.ts +0 -14
  84. package/lib/server/index.js +5 -65
  85. package/lib/solution/BaseSales/index.d.ts +0 -7
  86. package/lib/solution/BaseSales/index.js +8 -24
  87. package/lib/solution/BookingByStep/index.d.ts +1 -16
  88. package/lib/solution/BookingByStep/index.js +18 -60
  89. package/lib/solution/BookingByStep/types.d.ts +1 -2
  90. package/lib/solution/BookingByStep/types.js +0 -5
  91. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  92. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  93. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  94. package/lib/solution/BookingTicket/index.d.ts +2 -14
  95. package/lib/solution/BookingTicket/index.js +2 -10
  96. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  97. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  98. package/lib/solution/ScanOrder/index.d.ts +14 -26
  99. package/lib/solution/ScanOrder/index.js +182 -449
  100. package/lib/solution/ScanOrder/types.d.ts +1 -21
  101. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  102. package/lib/solution/ScanOrder/utils.js +0 -31
  103. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  104. package/lib/solution/ShopDiscount/index.js +0 -14
  105. package/lib/solution/VenueBooking/index.d.ts +11 -39
  106. package/lib/solution/VenueBooking/index.js +110 -322
  107. package/lib/solution/VenueBooking/types.d.ts +0 -3
  108. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  109. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  110. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  111. package/lib/solution/index.d.ts +0 -1
  112. package/lib/solution/index.js +1 -3
  113. package/lib/types/index.d.ts +0 -1
  114. package/package.json +1 -1
  115. package/dist/modules/Holder/index.d.ts +0 -48
  116. package/dist/modules/Holder/index.js +0 -640
  117. package/dist/modules/Holder/types.d.ts +0 -123
  118. package/dist/modules/Holder/types.js +0 -1
  119. package/dist/modules/Holder/utils.d.ts +0 -13
  120. package/dist/modules/Holder/utils.js +0 -34
  121. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  122. package/dist/modules/ResourcePlanner/index.js +0 -181
  123. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  124. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  125. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  126. package/dist/modules/ResourcePlanner/types.js +0 -1
  127. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  128. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  129. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  130. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  131. package/lib/modules/Holder/index.d.ts +0 -48
  132. package/lib/modules/Holder/index.js +0 -402
  133. package/lib/modules/Holder/types.d.ts +0 -123
  134. package/lib/modules/Holder/types.js +0 -17
  135. package/lib/modules/Holder/utils.d.ts +0 -13
  136. package/lib/modules/Holder/utils.js +0 -71
  137. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  138. package/lib/modules/ResourcePlanner/index.js +0 -148
  139. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  140. package/lib/modules/ResourcePlanner/planner.js +0 -933
  141. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  142. package/lib/modules/ResourcePlanner/types.js +0 -17
  143. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  144. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  145. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  146. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -438,8 +438,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
438
438
  _id: product._id,
439
439
  parentId: product._id,
440
440
  quantity: product.quantity,
441
- num: product.num,
442
- booking_id: product.booking_id
441
+ num: product.num
443
442
  });
444
443
 
445
444
  // 2. 展开 bundle 子商品
@@ -463,7 +462,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
463
462
  origin_total: new Decimal(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
464
463
  original_price: bundleItem.original_price,
465
464
  // 继承主商品属性
466
- booking_id: bundleItem.booking_id,
465
+ booking_id: product.booking_id,
467
466
  discount_list: bundleItem.discount_list || []
468
467
  });
469
468
  });
@@ -988,8 +987,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
988
987
  discount_product_id: discount.product_id
989
988
  },
990
989
  metadata: {
991
- num: num,
992
- discount_rule_uncheck_flag: discount === null || discount === void 0 ? void 0 : discount.discount_rule_uncheck_flag
990
+ num: num
993
991
  }
994
992
  };
995
993
  applicableProducts.push(productData);
@@ -1485,8 +1483,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1485
1483
  _num: isGoodPass ? 1 : product.num,
1486
1484
  config: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.config,
1487
1485
  metadata: _objectSpread(_objectSpread({
1488
- num: 1,
1489
- discount_rule_uncheck_flag: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.discount_rule_uncheck_flag
1486
+ num: 1
1490
1487
  }, productDiscountDifference !== undefined && {
1491
1488
  product_discount_difference: productDiscountDifference
1492
1489
  }), {}, {
@@ -1573,7 +1570,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1573
1570
  metadata: {
1574
1571
  // 🔥 使用拆分后的唯一 _id
1575
1572
  custom_product_bundle_map_id: uniqueId,
1576
- discount_rule_uncheck_flag: _selectedDiscount2 === null || _selectedDiscount2 === void 0 ? void 0 : _selectedDiscount2.discount_rule_uncheck_flag,
1577
1573
  num: 1
1578
1574
  },
1579
1575
  _num: 1,
@@ -1605,7 +1601,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1605
1601
  _id: "".concat(flatItem._id, "_split_rest"),
1606
1602
  num: normalNum,
1607
1603
  quantity: normalNum,
1608
- discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion'),
1604
+ discount_list: [],
1609
1605
  processed: true
1610
1606
  }));
1611
1607
  }
@@ -1659,7 +1655,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1659
1655
  metadata: _objectSpread({
1660
1656
  // 🔥 使用唯一的 _id
1661
1657
  custom_product_bundle_map_id: _uniqueId,
1662
- discount_rule_uncheck_flag: _selectedDiscount3 === null || _selectedDiscount3 === void 0 ? void 0 : _selectedDiscount3.discount_rule_uncheck_flag,
1663
1658
  num: product.num || 1
1664
1659
  }, _productDiscountDifference !== undefined && {
1665
1660
  product_discount_difference: _productDiscountDifference
@@ -1675,7 +1670,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1675
1670
  processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
1676
1671
  total: targetProductTotal,
1677
1672
  price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
1678
- discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail2]),
1673
+ discount_list: [_discountDetail2],
1679
1674
  processed: true
1680
1675
  }));
1681
1676
  }
@@ -2150,7 +2145,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2150
2145
  }, {
2151
2146
  key: "checkPackageSubItemUsageRules",
2152
2147
  value: function checkPackageSubItemUsageRules(discount, flatItem) {
2153
- var _flatItem$product;
2154
2148
  var limitedData = discount.limited_relation_product_data;
2155
2149
  var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
2156
2150
  var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
@@ -2172,7 +2166,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2172
2166
  filter = _ref17$filter === void 0 ? 0 : _ref17$filter;
2173
2167
  var isMainProduct = flatItem.type === 'main'; // 单独购买
2174
2168
  var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
2175
- var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
2176
2169
 
2177
2170
  // 主商品直接可用
2178
2171
  if (isMainProduct) {
@@ -2215,13 +2208,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2215
2208
  if (!filter) {
2216
2209
  isScopeValid = true;
2217
2210
  } else {
2218
- isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
2211
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
2219
2212
  }
2220
2213
  }
2221
2214
 
2222
2215
  // 包含套餐判断, products值兼容旧数据
2223
2216
  if (scopeType === 'specific_packages' || scopeType === 'products') {
2224
- isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
2217
+ isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
2225
2218
  }
2226
2219
 
2227
2220
  // 价格和套餐适用范围都符合,则可用
@@ -2271,42 +2264,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2271
2264
 
2272
2265
  // 检查 rules
2273
2266
  if (rules.length > 0) {
2274
- var _isOriginalPrice3 = _isOriginalPrice2 && rules.includes('original_price');
2275
- var _isMarkupPrice3 = _isMarkupPrice2 && rules.includes('markup_price');
2276
- // 价格是否符合规则:原价或加价
2277
- var _isPriceValid = _isOriginalPrice3 || _isMarkupPrice3;
2278
- // 套餐适用范围校验
2279
- var _isScopeValid = false;
2280
-
2281
- // 排除套餐判断, product_all值兼容旧数据
2282
- if (scopeType === 'all_packages' || scopeType === 'product_all') {
2283
- // 所有套餐可用
2284
- if (!filter) {
2285
- _isScopeValid = true;
2286
- } else {
2287
- _isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
2288
- }
2289
- }
2290
-
2291
- // 包含套餐判断, products值兼容旧数据
2292
- if (scopeType === 'specific_packages' || scopeType === 'products') {
2293
- _isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
2294
- }
2295
-
2296
- // 价格和套餐适用范围都符合,则可用
2297
- if (_isPriceValid && _isScopeValid) {
2267
+ // 检查原价
2268
+ if (_isOriginalPrice2 && rules.includes('original_price')) {
2298
2269
  return true;
2299
2270
  }
2300
2271
 
2301
- // 检查原价
2302
- // if (isOriginalPrice && rules.includes('original_price')) {
2303
- // return true;
2304
- // }
2305
-
2306
2272
  // 检查加价
2307
- // if (isMarkupPrice && rules.includes('markup_price')) {
2308
- // return true;
2309
- // }
2273
+ if (_isMarkupPrice2 && rules.includes('markup_price')) {
2274
+ return true;
2275
+ }
2310
2276
 
2311
2277
  // 如果都不匹配,则不可用
2312
2278
  return false;
@@ -64,19 +64,21 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
64
64
  this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
65
65
  this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
66
66
  this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
67
-
68
- // if (!this.appPlugin) {
69
- // throw new Error('SalesSummaryModule 需要 app 插件支持');
70
- // }
71
- if (this.request) {
67
+ if (this.appPlugin) {
72
68
  _context.next = 10;
73
69
  break;
74
70
  }
75
- throw new Error('SalesSummaryModule 需要 request 插件支持');
71
+ throw new Error('SalesSummaryModule 需要 app 插件支持');
76
72
  case 10:
77
- _context.next = 12;
78
- return this.getSurchargeList();
73
+ if (this.request) {
74
+ _context.next = 12;
75
+ break;
76
+ }
77
+ throw new Error('SalesSummaryModule 需要 request 插件支持');
79
78
  case 12:
79
+ _context.next = 14;
80
+ return this.getSurchargeList();
81
+ case 14:
80
82
  case "end":
81
83
  return _context.stop();
82
84
  }
@@ -190,11 +192,10 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
190
192
  }, {
191
193
  key: "getAppData",
192
194
  value: function getAppData(key) {
193
- var _this$appPlugin, _this$appPlugin$getDa, _this$appPlugin2, _this$appPlugin2$getA, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
194
- var getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
195
+ var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
196
+ var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
195
197
  if (typeof getData === 'function') return getData(key);
196
- var app = (_this$appPlugin2 = this.appPlugin) === null || _this$appPlugin2 === void 0 || (_this$appPlugin2$getA = _this$appPlugin2.getApp) === null || _this$appPlugin2$getA === void 0 ? void 0 : _this$appPlugin2$getA.call(_this$appPlugin2);
197
- if (!app) return undefined;
198
+ var app = this.appPlugin.getApp();
198
199
  var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
199
200
  return coreData === null || coreData === void 0 ? void 0 : coreData[key];
200
201
  }
@@ -11,12 +11,10 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
11
11
  protected defaultName: string;
12
12
  protected defaultVersion: string;
13
13
  private store;
14
- private window?;
15
14
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
16
15
  setContext(context: ScanOrderLoggerContext): void;
17
16
  setProvider(provider: ScanOrderLoggerProviderType): void;
18
17
  setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
19
- private getCurrentHost;
20
18
  private buildRecord;
21
19
  addLog(params: ScanOrderLogInput): Promise<void>;
22
20
  }
@@ -46,7 +46,6 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
46
46
  _defineProperty(_assertThisInitialized(_this), "defaultName", 'scanOrderLogger');
47
47
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
48
48
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
49
- _defineProperty(_assertThisInitialized(_this), "window", void 0);
50
49
  return _this;
51
50
  }
52
51
  _createClass(ScanOrderLoggerModule, [{
@@ -65,7 +64,6 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
65
64
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
66
65
  this.core = core;
67
66
  this.store = options.store;
68
- this.window = core.getPlugin('window') || undefined;
69
67
  provider = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.provider) || 'feishu';
70
68
  providerConfig = ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.providerConfig) || {};
71
69
  context = ((_options$otherParams3 = options.otherParams) === null || _options$otherParams3 === void 0 ? void 0 : _options$otherParams3.context) || {};
@@ -75,7 +73,7 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
75
73
  grafana: _objectSpread(_objectSpread({}, defaultProviderConfig.grafana), providerConfig.grafana || {})
76
74
  });
77
75
  this.store.context = context;
78
- case 10:
76
+ case 9:
79
77
  case "end":
80
78
  return _context.stop();
81
79
  }
@@ -104,27 +102,16 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
104
102
  grafana: _objectSpread(_objectSpread({}, this.store.providerConfig.grafana || {}), providerConfig.grafana || {})
105
103
  });
106
104
  }
107
- }, {
108
- key: "getCurrentHost",
109
- value: function getCurrentHost() {
110
- var _this$window;
111
- var host = (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.location) === null || _this$window === void 0 ? void 0 : _this$window.host;
112
- if (typeof host === 'string' && host.length > 0) return host;
113
- return undefined;
114
- }
115
105
  }, {
116
106
  key: "buildRecord",
117
107
  value: function buildRecord(params) {
118
- var host = this.getCurrentHost();
119
108
  return {
120
109
  level: params.level || 'info',
121
110
  title: params.title,
122
111
  timestamp: params.timestamp || dayjs().format('YYYY-MM-DD HH:mm:ss'),
123
112
  payload: params.payload || {},
124
113
  extra: params.extra || {},
125
- context: _objectSpread(_objectSpread({}, this.store.context || {}), host ? {
126
- host: host
127
- } : {})
114
+ context: this.store.context || {}
128
115
  };
129
116
  }
130
117
  }, {
@@ -142,80 +142,62 @@ function _flushQueue() {
142
142
  export var feishuLoggerProvider = {
143
143
  send: function send(payload) {
144
144
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
145
- var _payload$providerConf, _payload$providerConf2, _payload$providerConf3, _payload$providerConf4;
146
- var webhook, errorHook, throttleMs;
145
+ var _payload$providerConf, _payload$providerConf2, _payload$providerConf3;
146
+ var webhook, throttleMs;
147
147
  return _regeneratorRuntime().wrap(function _callee$(_context) {
148
148
  while (1) switch (_context.prev = _context.next) {
149
149
  case 0:
150
150
  cachedProviderConfig = payload.providerConfig;
151
151
  webhook = (_payload$providerConf = payload.providerConfig) === null || _payload$providerConf === void 0 || (_payload$providerConf = _payload$providerConf.feishu) === null || _payload$providerConf === void 0 ? void 0 : _payload$providerConf.webhook;
152
- errorHook = (_payload$providerConf2 = payload.providerConfig) === null || _payload$providerConf2 === void 0 || (_payload$providerConf2 = _payload$providerConf2.feishu) === null || _payload$providerConf2 === void 0 ? void 0 : _payload$providerConf2.errorHook;
153
- if (!(typeof fetch !== 'function')) {
154
- _context.next = 6;
155
- break;
156
- }
157
- console.warn('[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报');
158
- return _context.abrupt("return");
159
- case 6:
160
- if (!(payload.record.level === 'error' && isWebhookUsable(errorHook))) {
161
- _context.next = 16;
162
- break;
163
- }
164
- _context.prev = 7;
165
- _context.next = 10;
166
- return postToFeishu(errorHook, buildFeishuBody([payload.record]));
167
- case 10:
168
- _context.next = 15;
169
- break;
170
- case 12:
171
- _context.prev = 12;
172
- _context.t0 = _context["catch"](7);
173
- console.warn('[ScanOrderLogger] Feishu errorHook 上报失败', _context.t0);
174
- case 15:
175
- return _context.abrupt("return");
176
- case 16:
177
152
  if (webhook) {
178
- _context.next = 19;
153
+ _context.next = 5;
179
154
  break;
180
155
  }
181
156
  console.warn('[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报');
182
157
  return _context.abrupt("return");
183
- case 19:
158
+ case 5:
184
159
  if (isWebhookUsable(webhook)) {
185
- _context.next = 21;
160
+ _context.next = 7;
186
161
  break;
187
162
  }
188
163
  return _context.abrupt("return");
189
- case 21:
190
- throttleMs = (_payload$providerConf3 = (_payload$providerConf4 = payload.providerConfig) === null || _payload$providerConf4 === void 0 || (_payload$providerConf4 = _payload$providerConf4.feishu) === null || _payload$providerConf4 === void 0 ? void 0 : _payload$providerConf4.throttleMs) !== null && _payload$providerConf3 !== void 0 ? _payload$providerConf3 : DEFAULT_THROTTLE_MS;
164
+ case 7:
165
+ if (!(typeof fetch !== 'function')) {
166
+ _context.next = 10;
167
+ break;
168
+ }
169
+ console.warn('[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报');
170
+ return _context.abrupt("return");
171
+ case 10:
172
+ throttleMs = (_payload$providerConf2 = (_payload$providerConf3 = payload.providerConfig) === null || _payload$providerConf3 === void 0 || (_payload$providerConf3 = _payload$providerConf3.feishu) === null || _payload$providerConf3 === void 0 ? void 0 : _payload$providerConf3.throttleMs) !== null && _payload$providerConf2 !== void 0 ? _payload$providerConf2 : DEFAULT_THROTTLE_MS;
191
173
  if (!(throttleMs <= 0)) {
192
- _context.next = 32;
174
+ _context.next = 21;
193
175
  break;
194
176
  }
195
- _context.prev = 23;
196
- _context.next = 26;
177
+ _context.prev = 12;
178
+ _context.next = 15;
197
179
  return postToFeishu(webhook, buildFeishuBody([payload.record]));
198
- case 26:
199
- _context.next = 31;
180
+ case 15:
181
+ _context.next = 20;
200
182
  break;
201
- case 28:
202
- _context.prev = 28;
203
- _context.t1 = _context["catch"](23);
204
- console.warn('[ScanOrderLogger] Feishu 日志上报失败', _context.t1);
205
- case 31:
183
+ case 17:
184
+ _context.prev = 17;
185
+ _context.t0 = _context["catch"](12);
186
+ console.warn('[ScanOrderLogger] Feishu 日志上报失败', _context.t0);
187
+ case 20:
206
188
  return _context.abrupt("return");
207
- case 32:
189
+ case 21:
208
190
  pendingQueue.push(payload.record);
209
191
  if (!flushTimer) {
210
192
  flushTimer = setTimeout(function () {
211
193
  void flushQueue();
212
194
  }, throttleMs);
213
195
  }
214
- case 34:
196
+ case 23:
215
197
  case "end":
216
198
  return _context.stop();
217
199
  }
218
- }, _callee, null, [[7, 12], [23, 28]]);
200
+ }, _callee, null, [[12, 17]]);
219
201
  }))();
220
202
  }
221
203
  };
@@ -2,7 +2,6 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
2
2
  export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
3
3
  export interface ScanOrderLoggerProviderFeishuConfig {
4
4
  webhook?: string;
5
- errorHook?: string;
6
5
  /**
7
6
  * 节流窗口毫秒数,默认 3000ms
8
7
  * - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
@@ -24,9 +24,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
24
24
  *
25
25
  * @memberof ScheduleModule
26
26
  */
27
- loadAllSchedule(options?: {
28
- useCache?: boolean;
29
- }): Promise<void>;
27
+ loadAllSchedule(): Promise<void>;
30
28
  setScheduleList(list: ScheduleItem[]): void;
31
29
  private syncScheduleMap;
32
30
  getScheduleList(): ScheduleItem[];
@@ -123,24 +123,21 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
123
123
  key: "loadAllSchedule",
124
124
  value: (function () {
125
125
  var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
126
- var _options$useCache, _scheduleList$data;
127
- var options,
128
- scheduleList,
129
- _args2 = arguments;
126
+ var _scheduleList$data;
127
+ var scheduleList;
130
128
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
131
129
  while (1) switch (_context2.prev = _context2.next) {
132
130
  case 0:
133
- options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
134
- _context2.next = 3;
131
+ _context2.next = 2;
135
132
  return this.request.get("/schedule", {
136
133
  num: 999
137
134
  }, {
138
- useCache: (_options$useCache = options.useCache) !== null && _options$useCache !== void 0 ? _options$useCache : true
135
+ useCache: true
139
136
  });
140
- case 3:
137
+ case 2:
141
138
  scheduleList = _context2.sent;
142
139
  this.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
143
- case 5:
140
+ case 4:
144
141
  case "end":
145
142
  return _context2.stop();
146
143
  }
@@ -179,7 +176,8 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
179
176
  key: "loadScheduleAvailableDate",
180
177
  value: function () {
181
178
  var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
182
- var startDate, endDate, custom_page_id, channel, dates, res, responseData, dateList, otherProductIds;
179
+ var _res$data$date_list, _res$data$other_produ, _res$data$other_produ2;
180
+ var startDate, endDate, custom_page_id, channel, dates, res;
183
181
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
184
182
  while (1) switch (_context3.prev = _context3.next) {
185
183
  case 0:
@@ -207,25 +205,22 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
207
205
  });
208
206
  case 8:
209
207
  res = _context3.sent;
210
- responseData = res.data || {};
211
- dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
212
- otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
213
- this.setAvailabilityScheduleDateList(dateList);
214
- this.setOtherProductsIds(otherProductIds);
208
+ this.setAvailabilityScheduleDateList(res.data.date_list);
209
+ this.setOtherProductsIds(res.data.other_product_ids || []);
215
210
  // 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
216
- if (!(!dateList.length && !otherProductIds.length || dayjs(endDate).isBefore(dayjs(), 'day'))) {
217
- _context3.next = 16;
211
+ if (!(!((_res$data$date_list = res.data.date_list) !== null && _res$data$date_list !== void 0 && _res$data$date_list.length) && !((_res$data$other_produ = res.data.other_product_ids) !== null && _res$data$other_produ !== void 0 && _res$data$other_produ.length) || dayjs(endDate).isBefore(dayjs(), 'day'))) {
212
+ _context3.next = 13;
218
213
  break;
219
214
  }
220
215
  return _context3.abrupt("return", dates);
221
- case 16:
222
- if (otherProductIds.length) {
216
+ case 13:
217
+ if ((_res$data$other_produ2 = res.data.other_product_ids) !== null && _res$data$other_produ2 !== void 0 && _res$data$other_produ2.length) {
223
218
  // 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
224
219
  dates.forEach(function (n) {
225
220
  n.status = 'available';
226
221
  });
227
222
  } else {
228
- dateList.forEach(function (n) {
223
+ res.data.date_list.forEach(function (n) {
229
224
  var index = dates.findIndex(function (m) {
230
225
  return m.date === n.date;
231
226
  });
@@ -236,7 +231,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
236
231
  }
237
232
  dates = disableDatesBeforeOneDay(dates);
238
233
  return _context3.abrupt("return", dates);
239
- case 19:
234
+ case 16:
240
235
  case "end":
241
236
  return _context3.stop();
242
237
  }
@@ -706,50 +706,25 @@ var getBundleItemIsDiscountPrice = function getBundleItemIsDiscountPrice(item) {
706
706
  var getBundleItemIsMarkupOrDiscountPrice = function getBundleItemIsMarkupOrDiscountPrice(item) {
707
707
  return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
708
708
  };
709
- var getDiscountAmount = function getDiscountAmount(discounts) {
710
- return (discounts || []).reduce(function (total, discount) {
711
- return total.add(new Decimal(discount.amount || 0));
712
- }, new Decimal(0)).toNumber();
713
- };
714
709
 
715
710
  /**
716
711
  * 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
717
712
  */
718
713
  var getMainProductTotal = function getMainProductTotal(item) {
719
- var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
714
+ var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2;
720
715
  // 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
721
716
  // 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
722
717
  // 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
723
718
  var total = new Decimal((_ref8 = (_ref9 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref9 !== void 0 ? _ref9 : item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref8 !== void 0 ? _ref8 : 0);
724
-
725
- // 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
726
- var hasMainProductPrice = (item === null || item === void 0 ? void 0 : item.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.main_product_original_price) != null;
727
- if (!hasMainProductPrice) {
728
- var _ref10, _ref11, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
729
- total = new Decimal((_ref10 = (_ref11 = (_item$main_product_se2 = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se2 !== void 0 ? _item$main_product_se2 : item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.main_product_selling_price) !== null && _ref11 !== void 0 ? _ref11 : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
730
- var discount = (item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.discount_list) === null || _item$_originData === void 0 ? void 0 : _item$_originData.filter(function (item) {
731
- var _item$metadata6;
732
- return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
733
- })) || [];
734
- var mainProductDiscountAmount = getDiscountAmount(discount);
735
- total = total.minus(mainProductDiscountAmount);
736
-
737
- // 单规格
738
- if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
739
- total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
740
- return t.add(new Decimal(option.price || 0).mul(option.num || 1));
741
- }, new Decimal(0)));
742
- }
743
- }
744
719
  var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
745
720
  _step4;
746
721
  try {
747
722
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
748
723
  var bundleItem = _step4.value;
749
724
  if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
750
- var _ref12, _bundleItem$bundle_se2;
725
+ var _ref10, _bundleItem$bundle_se2;
751
726
  // IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
752
- var bundleItemTotal = new Decimal((_ref12 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0);
727
+ var bundleItemTotal = new Decimal((_ref10 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
753
728
  total = total.add(bundleItemTotal);
754
729
  }
755
730
  }
@@ -869,12 +844,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
869
844
  * @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
870
845
  * @returns 附加费列表(仅返回金额 > 0 的项)
871
846
  */
872
- export var getSurcharge = function getSurcharge(_ref13, options) {
847
+ export var getSurcharge = function getSurcharge(_ref11, options) {
873
848
  var _service$filter;
874
- var service = _ref13.service,
875
- addons = _ref13.addons,
876
- bookingDetail = _ref13.bookingDetail,
877
- bookingId = _ref13.bookingId;
849
+ var service = _ref11.service,
850
+ addons = _ref11.addons,
851
+ bookingDetail = _ref11.bookingDetail,
852
+ bookingId = _ref11.bookingId;
878
853
  var isEdit = options.isEdit,
879
854
  isInScheduleByDate = options.isInScheduleByDate,
880
855
  surcharge_list = options.surcharge_list,
@@ -996,11 +971,11 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
996
971
  scheduleById: scheduleById || {},
997
972
  isInScheduleByDate: isInScheduleByDate
998
973
  })) {
999
- var _ref14, _bundleItem$bundle_se3;
974
+ var _ref12, _bundleItem$bundle_se3;
1000
975
  var _mainQuantity = item.num || 1;
1001
976
  matchedItems.push({
1002
977
  isMain: false,
1003
- total: Number((_ref14 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref14 !== void 0 ? _ref14 : 0),
978
+ total: Number((_ref12 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0),
1004
979
  quantity: bundleItem.num || bundleItem.quantity || 1,
1005
980
  item: bundleItem,
1006
981
  mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
@@ -1216,9 +1191,9 @@ export var getSurcharge = function getSurcharge(_ref13, options) {
1216
1191
  }
1217
1192
  return surchargeWithAmount;
1218
1193
  };
1219
- function resetItemsSurchargeSideEffects(_ref15) {
1220
- var service = _ref15.service,
1221
- addons = _ref15.addons;
1194
+ function resetItemsSurchargeSideEffects(_ref13) {
1195
+ var service = _ref13.service,
1196
+ addons = _ref13.addons;
1222
1197
  var resetItem = function resetItem(item) {
1223
1198
  if (!item) return;
1224
1199
  item.surcharge_fee = 0;
@@ -18,5 +18,3 @@ export * from './Quotation';
18
18
  export * from './ScanOrderLogger';
19
19
  export * from './OpenData';
20
20
  export * from './BookingContext';
21
- export * from './Holder';
22
- export * from './ResourcePlanner';
@@ -17,6 +17,4 @@ export * from "./Schedule";
17
17
  export * from "./Quotation";
18
18
  export * from "./ScanOrderLogger";
19
19
  export * from "./OpenData";
20
- export * from "./BookingContext";
21
- export * from "./Holder";
22
- export * from "./ResourcePlanner";
20
+ export * from "./BookingContext";
@@ -16,7 +16,6 @@ export interface WindowPlugin extends Plugin {
16
16
  history: History;
17
17
  interaction?: any;
18
18
  getWalletPassEvaluator?: () => WalletPassEvaluator;
19
- getLocalStorage?: (key: string) => string | null;
20
19
  }
21
20
  /**
22
21
  * 简单的 Storage 接口实现
@@ -49,10 +49,6 @@ declare class Server {
49
49
  private productQuerySubscribers;
50
50
  /** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
51
51
  private productQueryScheduleTimers;
52
- /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
53
- private menuScheduleRefreshInFlight;
54
- private lastMenuScheduleRefreshAt;
55
- private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
56
52
  private orderQuerySubscribers;
57
53
  private bookingQuerySubscribers;
58
54
  private bookingRemoteQuerySubscribers;
@@ -266,16 +262,6 @@ declare class Server {
266
262
  * 存储订阅者信息,便于数据变更时推送最新结果
267
263
  */
268
264
  private handleProductQuery;
269
- /**
270
- * ProductList callers such as standalone retail pages do not always have a selected schedule.
271
- * In that case query against the current local time so menu availability can still be evaluated.
272
- */
273
- private resolveProductQueryScheduleContext;
274
- /**
275
- * OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
276
- * 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
277
- */
278
- private refreshMenuScheduleCacheAfterEmptyResult;
279
265
  /**
280
266
  * 按商品 id 查询单条(GET /shop/product/query/:productId)
281
267
  * schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。