@pisell/pisellos 2.3.50 → 2.3.53

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 (177) hide show
  1. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
  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 +6 -8
  7. package/dist/modules/Order/index.js +165 -140
  8. package/dist/modules/Order/types.d.ts +21 -12
  9. package/dist/modules/Order/types.js +11 -0
  10. package/dist/modules/Order/utils.d.ts +0 -10
  11. package/dist/modules/Order/utils.js +3 -35
  12. package/dist/modules/Payment/types.d.ts +8 -0
  13. package/dist/modules/Payment/walletpass.d.ts +7 -1
  14. package/dist/modules/Payment/walletpass.js +155 -45
  15. package/dist/modules/Product/types.d.ts +0 -1
  16. package/dist/modules/ProductList/index.js +14 -33
  17. package/dist/modules/Quotation/index.d.ts +1 -1
  18. package/dist/modules/Quotation/index.js +2 -2
  19. package/dist/modules/Rules/index.js +32 -56
  20. package/dist/modules/SalesSummary/index.js +13 -12
  21. package/dist/modules/SalesSummary/utils.js +7 -1
  22. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  23. package/dist/modules/ScanOrderLogger/index.js +2 -15
  24. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  25. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  26. package/dist/modules/Schedule/index.d.ts +1 -3
  27. package/dist/modules/Schedule/index.js +16 -21
  28. package/dist/modules/Summary/utils.js +13 -38
  29. package/dist/modules/index.d.ts +0 -2
  30. package/dist/modules/index.js +1 -3
  31. package/dist/plugins/window.d.ts +0 -1
  32. package/dist/server/index.d.ts +0 -14
  33. package/dist/server/index.js +793 -907
  34. package/dist/server/modules/index.d.ts +1 -1
  35. package/dist/server/modules/order/index.d.ts +16 -0
  36. package/dist/server/modules/order/index.js +964 -776
  37. package/dist/server/modules/order/types.d.ts +14 -0
  38. package/dist/server/modules/order/types.js +6 -0
  39. package/dist/solution/BaseSales/index.d.ts +18 -13
  40. package/dist/solution/BaseSales/index.js +202 -178
  41. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
  42. package/dist/solution/BookingByStep/index.d.ts +2 -17
  43. package/dist/solution/BookingByStep/index.js +215 -294
  44. package/dist/solution/BookingByStep/types.d.ts +1 -2
  45. package/dist/solution/BookingByStep/types.js +1 -3
  46. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  47. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  48. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  49. package/dist/solution/BookingTicket/index.d.ts +1 -13
  50. package/dist/solution/BookingTicket/index.js +2 -2
  51. package/dist/solution/BookingTicket/types.d.ts +3 -0
  52. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  53. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  54. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  55. package/dist/solution/Sales/index.d.ts +1 -0
  56. package/dist/solution/Sales/index.js +16 -2
  57. package/dist/solution/ScanOrder/index.d.ts +14 -26
  58. package/dist/solution/ScanOrder/index.js +739 -1142
  59. package/dist/solution/ScanOrder/types.d.ts +1 -21
  60. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  61. package/dist/solution/ScanOrder/utils.js +25 -66
  62. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  63. package/dist/solution/ShopDiscount/index.js +87 -125
  64. package/dist/solution/VenueBooking/index.d.ts +11 -39
  65. package/dist/solution/VenueBooking/index.js +841 -1167
  66. package/dist/solution/VenueBooking/types.d.ts +0 -3
  67. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  68. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  69. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  70. package/dist/solution/index.d.ts +0 -1
  71. package/dist/solution/index.js +1 -2
  72. package/dist/types/index.d.ts +0 -1
  73. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  74. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
  75. package/lib/modules/Discount/index.d.ts +0 -1
  76. package/lib/modules/Discount/index.js +0 -9
  77. package/lib/modules/Discount/types.d.ts +0 -1
  78. package/lib/modules/OpenData/index.js +1 -1
  79. package/lib/modules/Order/index.d.ts +6 -8
  80. package/lib/modules/Order/index.js +89 -38
  81. package/lib/modules/Order/types.d.ts +21 -12
  82. package/lib/modules/Order/utils.d.ts +0 -10
  83. package/lib/modules/Order/utils.js +5 -36
  84. package/lib/modules/Payment/types.d.ts +8 -0
  85. package/lib/modules/Payment/walletpass.d.ts +7 -1
  86. package/lib/modules/Payment/walletpass.js +107 -9
  87. package/lib/modules/Product/types.d.ts +0 -1
  88. package/lib/modules/ProductList/index.js +31 -40
  89. package/lib/modules/Quotation/index.d.ts +1 -1
  90. package/lib/modules/Quotation/index.js +2 -2
  91. package/lib/modules/Rules/index.js +32 -44
  92. package/lib/modules/SalesSummary/index.js +7 -6
  93. package/lib/modules/SalesSummary/utils.js +5 -1
  94. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  95. package/lib/modules/ScanOrderLogger/index.js +1 -13
  96. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  97. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  98. package/lib/modules/Schedule/index.d.ts +1 -3
  99. package/lib/modules/Schedule/index.js +8 -10
  100. package/lib/modules/Summary/utils.js +1 -21
  101. package/lib/modules/index.d.ts +0 -2
  102. package/lib/modules/index.js +1 -5
  103. package/lib/plugins/window.d.ts +0 -1
  104. package/lib/server/index.d.ts +0 -14
  105. package/lib/server/index.js +15 -72
  106. package/lib/server/modules/index.d.ts +1 -1
  107. package/lib/server/modules/order/index.d.ts +16 -0
  108. package/lib/server/modules/order/index.js +140 -4
  109. package/lib/server/modules/order/types.d.ts +14 -0
  110. package/lib/server/modules/order/types.js +1 -0
  111. package/lib/solution/BaseSales/index.d.ts +18 -13
  112. package/lib/solution/BaseSales/index.js +58 -35
  113. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  114. package/lib/solution/BookingByStep/index.d.ts +2 -17
  115. package/lib/solution/BookingByStep/index.js +18 -60
  116. package/lib/solution/BookingByStep/types.d.ts +1 -2
  117. package/lib/solution/BookingByStep/types.js +0 -5
  118. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  119. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  120. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  121. package/lib/solution/BookingTicket/index.d.ts +1 -13
  122. package/lib/solution/BookingTicket/index.js +2 -10
  123. package/lib/solution/BookingTicket/types.d.ts +3 -0
  124. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  125. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  126. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  127. package/lib/solution/Sales/index.d.ts +1 -0
  128. package/lib/solution/Sales/index.js +15 -3
  129. package/lib/solution/ScanOrder/index.d.ts +14 -26
  130. package/lib/solution/ScanOrder/index.js +182 -449
  131. package/lib/solution/ScanOrder/types.d.ts +1 -21
  132. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  133. package/lib/solution/ScanOrder/utils.js +0 -31
  134. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  135. package/lib/solution/ShopDiscount/index.js +0 -14
  136. package/lib/solution/VenueBooking/index.d.ts +11 -39
  137. package/lib/solution/VenueBooking/index.js +110 -322
  138. package/lib/solution/VenueBooking/types.d.ts +0 -3
  139. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  140. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  141. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  142. package/lib/solution/index.d.ts +0 -1
  143. package/lib/solution/index.js +1 -3
  144. package/lib/types/index.d.ts +0 -1
  145. package/package.json +1 -1
  146. package/dist/modules/Holder/index.d.ts +0 -48
  147. package/dist/modules/Holder/index.js +0 -640
  148. package/dist/modules/Holder/types.d.ts +0 -123
  149. package/dist/modules/Holder/types.js +0 -1
  150. package/dist/modules/Holder/utils.d.ts +0 -13
  151. package/dist/modules/Holder/utils.js +0 -34
  152. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  153. package/dist/modules/ResourcePlanner/index.js +0 -181
  154. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  155. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  156. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  157. package/dist/modules/ResourcePlanner/types.js +0 -1
  158. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  159. package/dist/solution/UnifiedBookingSales/index.js +0 -1891
  160. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  161. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  162. package/lib/modules/Holder/index.d.ts +0 -48
  163. package/lib/modules/Holder/index.js +0 -402
  164. package/lib/modules/Holder/types.d.ts +0 -123
  165. package/lib/modules/Holder/types.js +0 -17
  166. package/lib/modules/Holder/utils.d.ts +0 -13
  167. package/lib/modules/Holder/utils.js +0 -71
  168. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  169. package/lib/modules/ResourcePlanner/index.js +0 -148
  170. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  171. package/lib/modules/ResourcePlanner/planner.js +0 -933
  172. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  173. package/lib/modules/ResourcePlanner/types.js +0 -17
  174. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  175. package/lib/solution/UnifiedBookingSales/index.js +0 -1084
  176. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  177. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -243,7 +243,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
243
243
  const discountType = selectedDiscount.tag || selectedDiscount.type;
244
244
  return selectedDiscount.isEditMode === true && selectedDiscount.isSelected === true && ["good_pass", "discount_card", "product_discount_card"].includes(discountType);
245
245
  };
246
- const resolveReapplyEditModeDiscountPercent = (originProduct, selectedDiscount) => {
246
+ const resolveReapplyBookingDiscountPercent = (originProduct, selectedDiscount) => {
247
247
  var _a2;
248
248
  if (!shouldReapplyBookingDiscount(originProduct, selectedDiscount))
249
249
  return void 0;
@@ -305,8 +305,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
305
305
  _id: product._id,
306
306
  parentId: product._id,
307
307
  quantity: product.quantity,
308
- num: product.num,
309
- booking_id: product.booking_id
308
+ num: product.num
310
309
  });
311
310
  if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
312
311
  product.bundle.forEach((bundleItem, bundleIndex) => {
@@ -318,6 +317,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
318
317
  bundleIndex,
319
318
  // 虚拟商品属性
320
319
  price: Number(bundleItem.price || 0),
320
+ // 新增商品运行态通常带 _bundle_product_id;订单 hydrate 后只有
321
+ // bundle_product_id。Change time 必须兼容两种结构,否则 bundle
322
+ // 子项无法命中折扣卡的 limited_relation_product_data.product_ids。
321
323
  id: bundleItem.bundle_product_id ?? bundleItem._bundle_product_id ?? bundleItem.product_id,
322
324
  _id: `${product._id}_bundle_${bundleIndex}`,
323
325
  parentId: product._id,
@@ -327,7 +329,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
327
329
  origin_total: new import_decimal.default(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
328
330
  original_price: bundleItem.original_price,
329
331
  // 继承主商品属性
330
- booking_id: bundleItem.booking_id,
332
+ booking_id: product.booking_id,
331
333
  discount_list: bundleItem.discount_list || []
332
334
  });
333
335
  });
@@ -689,8 +691,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
689
691
  discount_product_id: discount.product_id
690
692
  },
691
693
  metadata: {
692
- num,
693
- discount_rule_uncheck_flag: discount == null ? void 0 : discount.discount_rule_uncheck_flag
694
+ num
694
695
  }
695
696
  };
696
697
  applicableProducts.push(productData);
@@ -779,13 +780,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
779
780
  if (isPersistedProduct && hasExistingWalletDiscount) {
780
781
  if (flatItem.type === "main") {
781
782
  processedProductsMap.set(product._id, [originProduct]);
782
- } else {
783
- processedFlatItemsMap.set(flatItem._id, [
784
- {
785
- ...flatItem,
786
- processed: true
787
- }
788
- ]);
789
783
  }
790
784
  return;
791
785
  }
@@ -1091,8 +1085,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1091
1085
  amount = productAllocation.discountAmount;
1092
1086
  productDiscountDifference = productAllocation.difference;
1093
1087
  mainProductSellingPrice = Math.max(new import_decimal.default(product.price).minus(amount).toNumber(), 0);
1094
- } else if (resolveReapplyEditModeDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
1095
- const percent = resolveReapplyEditModeDiscountPercent(originProduct, selectedDiscount2);
1088
+ } else if (resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
1089
+ const percent = resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2);
1096
1090
  reapplyDiscountPercent = new import_decimal.default(percent).toFixed(2);
1097
1091
  mainProductSellingPrice = new import_decimal.default(product.price || 0).mul(new import_decimal.default(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
1098
1092
  amount = new import_decimal.default(product.price).minus(mainProductSellingPrice).toNumber();
@@ -1138,7 +1132,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1138
1132
  config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
1139
1133
  metadata: {
1140
1134
  num: 1,
1141
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1142
1135
  // 🔥 order_level 分摊差值
1143
1136
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference },
1144
1137
  /** 仅主商品上的优惠金额(不含 option) */
@@ -1219,7 +1212,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1219
1212
  metadata: {
1220
1213
  // 🔥 使用拆分后的唯一 _id
1221
1214
  custom_product_bundle_map_id: uniqueId,
1222
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1223
1215
  num: 1
1224
1216
  },
1225
1217
  _num: 1,
@@ -1249,7 +1241,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1249
1241
  _id: `${flatItem._id}_split_rest`,
1250
1242
  num: normalNum,
1251
1243
  quantity: normalNum,
1252
- discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion"),
1244
+ discount_list: [],
1253
1245
  processed: true
1254
1246
  });
1255
1247
  }
@@ -1267,10 +1259,19 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1267
1259
  let targetProductTotal;
1268
1260
  let fixedAmountPerItem;
1269
1261
  let productDiscountDifference;
1262
+ let reapplyDiscountPercent;
1270
1263
  if (isOrderLevel && productAllocation) {
1271
1264
  fixedAmountPerItem = productAllocation.discountAmount;
1272
1265
  productDiscountDifference = productAllocation.difference;
1273
1266
  targetProductTotal = Math.max(new import_decimal.default(productOriginTotal).minus(fixedAmountPerItem).toNumber(), 0);
1267
+ } else if (resolveReapplyBookingDiscountPercent(originProduct, selectedDiscount2) !== void 0) {
1268
+ const percent = resolveReapplyBookingDiscountPercent(
1269
+ originProduct,
1270
+ selectedDiscount2
1271
+ );
1272
+ reapplyDiscountPercent = new import_decimal.default(percent).toFixed(2);
1273
+ targetProductTotal = new import_decimal.default(productOriginTotal).mul(new import_decimal.default(100).minus(percent)).div(100).toDecimalPlaces(2).toNumber();
1274
+ fixedAmountPerItem = new import_decimal.default(productOriginTotal).minus(targetProductTotal).toNumber();
1274
1275
  } else {
1275
1276
  targetProductTotal = (0, import_utils.getDiscountAmount)(
1276
1277
  selectedDiscount2,
@@ -1292,13 +1293,12 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1292
1293
  title: selectedDiscount2.format_title,
1293
1294
  original_amount: product.original_price,
1294
1295
  product_id: product.id || product.product_id,
1295
- percent: selectedDiscount2.par_value,
1296
+ percent: reapplyDiscountPercent ?? selectedDiscount2.par_value,
1296
1297
  discount_product_id: selectedDiscount2.product_id
1297
1298
  },
1298
1299
  metadata: {
1299
1300
  // 🔥 使用唯一的 _id
1300
1301
  custom_product_bundle_map_id: uniqueId,
1301
- discount_rule_uncheck_flag: selectedDiscount2 == null ? void 0 : selectedDiscount2.discount_rule_uncheck_flag,
1302
1302
  num: product.num || 1,
1303
1303
  // 🔥 order_level 分摊差值
1304
1304
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
@@ -1313,7 +1313,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1313
1313
  ...flatItem,
1314
1314
  total: targetProductTotal,
1315
1315
  price: new import_decimal.default(productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
1316
- discount_list: this.filterDiscountListByType(flatItem.discount_list, "promotion").concat([discountDetail]),
1316
+ discount_list: [discountDetail],
1317
1317
  processed: true
1318
1318
  });
1319
1319
  }
@@ -1734,7 +1734,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1734
1734
  * @returns 是否可用
1735
1735
  */
1736
1736
  checkPackageSubItemUsageRules(discount, flatItem) {
1737
- var _a, _b, _c, _d, _e, _f, _g, _h;
1737
+ var _a, _b, _c, _d, _e, _f, _g;
1738
1738
  const limitedData = discount.limited_relation_product_data;
1739
1739
  const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
1740
1740
  const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
@@ -1746,7 +1746,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1746
1746
  const { type: scopeType, exclude_bundle_product_ids = [], include_bundle_product_ids = [], filter = 0 } = packageScope || {};
1747
1747
  const isMainProduct = flatItem.type === "main";
1748
1748
  const isBundleItem = flatItem.type === "bundle";
1749
- const bundleMainProductId = (_a = flatItem.product) == null ? void 0 : _a.product_id;
1750
1749
  if (isMainProduct) {
1751
1750
  return true;
1752
1751
  }
@@ -1755,9 +1754,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1755
1754
  return true;
1756
1755
  }
1757
1756
  if (isBundleItem) {
1758
- const priceType = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type;
1759
- const priceTypeExt = (_c = flatItem.bundleItem) == null ? void 0 : _c.price_type_ext;
1760
- const mainProductId = ((_e = (_d = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _d._productOrigin) == null ? void 0 : _e.id) || ((_f = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _f.id) || 0;
1757
+ const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
1758
+ const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
1759
+ const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
1761
1760
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1762
1761
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1763
1762
  if (rules.length > 0) {
@@ -1769,11 +1768,11 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1769
1768
  if (!filter) {
1770
1769
  isScopeValid = true;
1771
1770
  } else {
1772
- isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1771
+ isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
1773
1772
  }
1774
1773
  }
1775
1774
  if (scopeType === "specific_packages" || scopeType === "products") {
1776
- isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1775
+ isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
1777
1776
  }
1778
1777
  if (isPriceValid && isScopeValid) {
1779
1778
  return true;
@@ -1789,26 +1788,15 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1789
1788
  return false;
1790
1789
  }
1791
1790
  if (isBundleItem) {
1792
- const priceType = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type;
1793
- const priceTypeExt = (_h = flatItem.bundleItem) == null ? void 0 : _h.price_type_ext;
1791
+ const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
1792
+ const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
1794
1793
  const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
1795
1794
  const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
1796
1795
  if (rules.length > 0) {
1797
- const _isOriginalPrice = isOriginalPrice && rules.includes("original_price");
1798
- const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
1799
- const isPriceValid = _isOriginalPrice || _isMarkupPrice;
1800
- let isScopeValid = false;
1801
- if (scopeType === "all_packages" || scopeType === "product_all") {
1802
- if (!filter) {
1803
- isScopeValid = true;
1804
- } else {
1805
- isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
1806
- }
1807
- }
1808
- if (scopeType === "specific_packages" || scopeType === "products") {
1809
- isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
1796
+ if (isOriginalPrice && rules.includes("original_price")) {
1797
+ return true;
1810
1798
  }
1811
- if (isPriceValid && isScopeValid) {
1799
+ if (isMarkupPrice && rules.includes("markup_price")) {
1812
1800
  return true;
1813
1801
  }
1814
1802
  return false;
@@ -53,6 +53,9 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
53
53
  this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
54
54
  this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
55
55
  this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
56
+ if (!this.appPlugin) {
57
+ throw new Error("SalesSummaryModule 需要 app 插件支持");
58
+ }
56
59
  if (!this.request) {
57
60
  throw new Error("SalesSummaryModule 需要 request 插件支持");
58
61
  }
@@ -106,14 +109,12 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
106
109
  }
107
110
  }
108
111
  getAppData(key) {
109
- var _a, _b, _c, _d, _e, _f, _g, _h;
110
- const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
112
+ var _a, _b, _c, _d, _e, _f;
113
+ const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
111
114
  if (typeof getData === "function")
112
115
  return getData(key);
113
- const app = (_d = (_c = this.appPlugin) == null ? void 0 : _c.getApp) == null ? void 0 : _d.call(_c);
114
- if (!app)
115
- return void 0;
116
- const coreData = (_h = (_f = (_e = app == null ? void 0 : app.models) == null ? void 0 : _e.getStore) == null ? void 0 : (_g = _f.call(_e)).getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
116
+ const app = this.appPlugin.getApp();
117
+ const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
117
118
  return coreData == null ? void 0 : coreData[key];
118
119
  }
119
120
  getTaxConfig() {
@@ -99,7 +99,11 @@ function getUnitOriginalTotal(product) {
99
99
  function isGeneratedVoucherProduct(product) {
100
100
  const record = product;
101
101
  const metadata = (record == null ? void 0 : record.metadata) || {};
102
- return (record == null ? void 0 : record.extension_type) === "product_voucher" || metadata.parent_order_detail_id !== void 0 || metadata.gift_card_type !== void 0;
102
+ const isGeneratedChild = metadata.parent_order_detail_id !== void 0 || metadata.gift_card_type !== void 0;
103
+ if (isGeneratedChild)
104
+ return true;
105
+ const isPersisted = (record == null ? void 0 : record.order_detail_id) !== void 0 && (record == null ? void 0 : record.order_detail_id) !== null;
106
+ return (record == null ? void 0 : record.extension_type) === "product_voucher" && !isPersisted;
103
107
  }
104
108
  function buildSurchargeServiceItems(products) {
105
109
  return products.map((product) => {
@@ -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
  }
@@ -60,7 +60,6 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
60
60
  var _a, _b, _c;
61
61
  this.core = core;
62
62
  this.store = options.store;
63
- this.window = core.getPlugin("window") || void 0;
64
63
  const provider = ((_a = options.otherParams) == null ? void 0 : _a.provider) || "feishu";
65
64
  const providerConfig = ((_b = options.otherParams) == null ? void 0 : _b.providerConfig) || {};
66
65
  const context = ((_c = options.otherParams) == null ? void 0 : _c.context) || {};
@@ -102,25 +101,14 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
102
101
  }
103
102
  };
104
103
  }
105
- getCurrentHost() {
106
- var _a, _b;
107
- const host = (_b = (_a = this.window) == null ? void 0 : _a.location) == null ? void 0 : _b.host;
108
- if (typeof host === "string" && host.length > 0)
109
- return host;
110
- return void 0;
111
- }
112
104
  buildRecord(params) {
113
- const host = this.getCurrentHost();
114
105
  return {
115
106
  level: params.level || "info",
116
107
  title: params.title,
117
108
  timestamp: params.timestamp || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
118
109
  payload: params.payload || {},
119
110
  extra: params.extra || {},
120
- context: {
121
- ...this.store.context || {},
122
- ...host ? { host } : {}
123
- }
111
+ context: this.store.context || {}
124
112
  };
125
113
  }
126
114
  async addLog(params) {
@@ -112,29 +112,20 @@ async function flushQueue() {
112
112
  }
113
113
  var feishuLoggerProvider = {
114
114
  async send(payload) {
115
- var _a, _b, _c, _d, _e, _f;
115
+ var _a, _b, _c, _d;
116
116
  cachedProviderConfig = payload.providerConfig;
117
117
  const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
118
- const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
119
- if (typeof fetch !== "function") {
120
- console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
121
- return;
122
- }
123
- if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
124
- try {
125
- await postToFeishu(errorHook, buildFeishuBody([payload.record]));
126
- } catch (error) {
127
- console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
128
- }
129
- return;
130
- }
131
118
  if (!webhook) {
132
119
  console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
133
120
  return;
134
121
  }
135
122
  if (!isWebhookUsable(webhook))
136
123
  return;
137
- const throttleMs = ((_f = (_e = payload.providerConfig) == null ? void 0 : _e.feishu) == null ? void 0 : _f.throttleMs) ?? DEFAULT_THROTTLE_MS;
124
+ if (typeof fetch !== "function") {
125
+ console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
126
+ return;
127
+ }
128
+ const throttleMs = ((_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.throttleMs) ?? DEFAULT_THROTTLE_MS;
138
129
  if (throttleMs <= 0) {
139
130
  try {
140
131
  await postToFeishu(webhook, buildFeishuBody([payload.record]));
@@ -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[];
@@ -95,12 +95,12 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
95
95
  *
96
96
  * @memberof ScheduleModule
97
97
  */
98
- async loadAllSchedule(options = {}) {
98
+ async loadAllSchedule() {
99
99
  var _a;
100
100
  const scheduleList = await this.request.get(
101
101
  `/schedule`,
102
102
  { num: 999 },
103
- { useCache: options.useCache ?? true }
103
+ { useCache: true }
104
104
  );
105
105
  this.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
106
106
  }
@@ -126,6 +126,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
126
126
  custom_page_id,
127
127
  channel
128
128
  }) {
129
+ var _a, _b, _c;
129
130
  if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
130
131
  startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
131
132
  }
@@ -143,20 +144,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
143
144
  channel
144
145
  }
145
146
  );
146
- const responseData = res.data || {};
147
- const dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
148
- const otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
149
- this.setAvailabilityScheduleDateList(dateList);
150
- this.setOtherProductsIds(otherProductIds);
151
- if (!dateList.length && !otherProductIds.length || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
147
+ this.setAvailabilityScheduleDateList(res.data.date_list);
148
+ this.setOtherProductsIds(res.data.other_product_ids || []);
149
+ if (!((_a = res.data.date_list) == null ? void 0 : _a.length) && !((_b = res.data.other_product_ids) == null ? void 0 : _b.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
152
150
  return dates;
153
151
  }
154
- if (otherProductIds.length) {
152
+ if ((_c = res.data.other_product_ids) == null ? void 0 : _c.length) {
155
153
  dates.forEach((n) => {
156
154
  n.status = "available";
157
155
  });
158
156
  } else {
159
- dateList.forEach((n) => {
157
+ res.data.date_list.forEach((n) => {
160
158
  const index = dates.findIndex((m) => m.date === n.date);
161
159
  if (index !== -1) {
162
160
  dates[index].status = "available";
@@ -437,31 +437,11 @@ var getBundleItemIsDiscountPrice = (item) => {
437
437
  var getBundleItemIsMarkupOrDiscountPrice = (item) => {
438
438
  return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
439
439
  };
440
- var getDiscountAmount = (discounts) => {
441
- return (discounts || []).reduce((total, discount) => {
442
- return total.add(new import_decimal.default(discount.amount || 0));
443
- }, new import_decimal.default(0)).toNumber();
444
- };
445
440
  var getMainProductTotal = (item) => {
446
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
441
+ var _a, _b;
447
442
  let total = new import_decimal.default(
448
443
  (item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_original_price) ?? 0
449
444
  );
450
- const hasMainProductPrice = (item == null ? void 0 : item.main_product_selling_price) != null || ((_c = item == null ? void 0 : item.metadata) == null ? void 0 : _c.main_product_selling_price) != null || ((_d = item == null ? void 0 : item.metadata) == null ? void 0 : _d.main_product_original_price) != null;
451
- if (!hasMainProductPrice) {
452
- total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_e = item == null ? void 0 : item.metadata) == null ? void 0 : _e.main_product_selling_price) ?? item.price ?? 0);
453
- const discount = ((_g = (_f = item == null ? void 0 : item._origin) == null ? void 0 : _f.product) == null ? void 0 : _g.discount_list) || ((_j = (_i = (_h = item == null ? void 0 : item._originData) == null ? void 0 : _h.product) == null ? void 0 : _i.discount_list) == null ? void 0 : _j.filter((item2) => {
454
- var _a2;
455
- return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
456
- })) || [];
457
- const mainProductDiscountAmount = getDiscountAmount(discount);
458
- total = total.minus(mainProductDiscountAmount);
459
- if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
460
- total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
461
- return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
462
- }, new import_decimal.default(0)));
463
- }
464
- }
465
445
  for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
466
446
  if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
467
447
  const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 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';
@@ -36,8 +36,6 @@ __reExport(modules_exports, require("./Quotation"), module.exports);
36
36
  __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
37
37
  __reExport(modules_exports, require("./OpenData"), module.exports);
38
38
  __reExport(modules_exports, require("./BookingContext"), module.exports);
39
- __reExport(modules_exports, require("./Holder"), module.exports);
40
- __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
41
39
  // Annotate the CommonJS export names for ESM import in node:
42
40
  0 && (module.exports = {
43
41
  ...require("./Product"),
@@ -59,7 +57,5 @@ __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
59
57
  ...require("./Quotation"),
60
58
  ...require("./ScanOrderLogger"),
61
59
  ...require("./OpenData"),
62
- ...require("./BookingContext"),
63
- ...require("./Holder"),
64
- ...require("./ResourcePlanner")
60
+ ...require("./BookingContext")
65
61
  });
@@ -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 可选。不走订阅。