@pisell/pisellos 3.0.90 → 3.0.91

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 (240) hide show
  1. package/dist/apis/picoding.d.ts +0 -0
  2. package/dist/apis/picoding.js +1 -0
  3. package/dist/model/index.d.ts +1 -0
  4. package/dist/model/index.js +1 -0
  5. package/dist/model/strategy/adapter/index.d.ts +7 -0
  6. package/dist/model/strategy/adapter/index.js +7 -0
  7. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  8. package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
  9. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  10. package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
  11. package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  12. package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
  13. package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
  14. package/dist/model/strategy/adapter/itemRule/index.js +5 -0
  15. package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
  16. package/dist/model/strategy/adapter/itemRule/type.js +101 -0
  17. package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  18. package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
  19. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  20. package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
  21. package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
  22. package/dist/model/strategy/adapter/promotion/examples.js +166 -0
  23. package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
  24. package/dist/model/strategy/adapter/promotion/index.js +0 -0
  25. package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
  26. package/dist/model/strategy/adapter/promotion/type.js +209 -0
  27. package/dist/model/strategy/adapter/type.d.ts +28 -0
  28. package/dist/model/strategy/adapter/type.js +1 -0
  29. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  30. package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
  31. package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
  32. package/dist/model/strategy/adapter/walletPass/example.js +258 -0
  33. package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
  34. package/dist/model/strategy/adapter/walletPass/index.js +182 -0
  35. package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  36. package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
  37. package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
  38. package/dist/model/strategy/adapter/walletPass/type.js +1 -0
  39. package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  40. package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
  41. package/dist/model/strategy/engine.d.ts +106 -0
  42. package/dist/model/strategy/engine.js +611 -0
  43. package/dist/model/strategy/index.d.ts +3 -0
  44. package/dist/model/strategy/index.js +8 -0
  45. package/dist/model/strategy/strategy-example.d.ts +5 -0
  46. package/dist/model/strategy/strategy-example.js +331 -0
  47. package/dist/model/strategy/type.d.ts +228 -0
  48. package/dist/model/strategy/type.js +94 -0
  49. package/dist/modules/Cart/utils/cartProduct.js +1 -0
  50. package/dist/modules/Discount/index.d.ts +4 -2
  51. package/dist/modules/Discount/index.js +90 -3
  52. package/dist/modules/Discount/types.d.ts +6 -0
  53. package/dist/modules/OpenData/index.d.ts +24 -0
  54. package/dist/modules/OpenData/index.js +173 -0
  55. package/dist/modules/OpenData/types.d.ts +73 -0
  56. package/dist/modules/OpenData/types.js +1 -0
  57. package/dist/modules/OpenData/utils.d.ts +2 -0
  58. package/dist/modules/OpenData/utils.js +75 -0
  59. package/dist/modules/Order/index.d.ts +66 -1
  60. package/dist/modules/Order/index.js +884 -10
  61. package/dist/modules/Order/types.d.ts +174 -12
  62. package/dist/modules/Order/types.js +2 -0
  63. package/dist/modules/Order/utils.d.ts +118 -0
  64. package/dist/modules/Order/utils.js +586 -2
  65. package/dist/modules/Product/utils.js +2 -2
  66. package/dist/modules/ProductList/index.d.ts +3 -1
  67. package/dist/modules/ProductList/index.js +19 -11
  68. package/dist/modules/Quotation/index.d.ts +48 -0
  69. package/dist/modules/Quotation/index.js +248 -0
  70. package/dist/modules/Quotation/types.d.ts +42 -0
  71. package/dist/modules/Quotation/types.js +1 -0
  72. package/dist/modules/Rules/index.js +17 -18
  73. package/dist/modules/SalesSummary/index.d.ts +63 -0
  74. package/dist/modules/SalesSummary/index.js +174 -0
  75. package/dist/modules/SalesSummary/types.d.ts +60 -0
  76. package/dist/modules/SalesSummary/types.js +1 -0
  77. package/dist/modules/SalesSummary/utils.d.ts +30 -0
  78. package/dist/modules/SalesSummary/utils.js +480 -0
  79. package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
  80. package/dist/modules/ScanOrderLogger/index.js +174 -0
  81. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  82. package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
  83. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  84. package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
  85. package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
  86. package/dist/modules/ScanOrderLogger/types.js +1 -0
  87. package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
  88. package/dist/modules/Schedule/utils.d.ts +1 -1
  89. package/dist/modules/Summary/utils.d.ts +3 -3
  90. package/dist/modules/Summary/utils.js +41 -31
  91. package/dist/modules/index.d.ts +4 -0
  92. package/dist/modules/index.js +5 -1
  93. package/dist/solution/BookingByStep/index.d.ts +2 -2
  94. package/dist/solution/BookingByStep/types.d.ts +3 -1
  95. package/dist/solution/BookingByStep/types.js +5 -1
  96. package/dist/solution/ScanOrder/index.d.ts +158 -0
  97. package/dist/solution/ScanOrder/index.js +3474 -0
  98. package/dist/solution/ScanOrder/types.d.ts +306 -0
  99. package/dist/solution/ScanOrder/types.js +35 -0
  100. package/dist/solution/ScanOrder/utils.d.ts +172 -0
  101. package/dist/solution/ScanOrder/utils.js +796 -0
  102. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  103. package/dist/solution/ShopDiscount/index.js +23 -18
  104. package/dist/solution/VenueBooking/index.d.ts +201 -0
  105. package/dist/solution/VenueBooking/index.js +3472 -0
  106. package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  107. package/dist/solution/VenueBooking/types.d.ts +154 -0
  108. package/dist/solution/VenueBooking/types.js +21 -0
  109. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  110. package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
  111. package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
  112. package/dist/solution/VenueBooking/utils/resource.js +131 -0
  113. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
  114. package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
  115. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  116. package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
  117. package/dist/solution/VenueBooking/utils.d.ts +1 -0
  118. package/dist/solution/VenueBooking/utils.js +1 -0
  119. package/dist/solution/index.d.ts +2 -0
  120. package/dist/solution/index.js +3 -1
  121. package/lib/apis/picoding.d.ts +0 -0
  122. package/lib/apis/picoding.js +0 -0
  123. package/lib/model/index.d.ts +1 -0
  124. package/lib/model/index.js +23 -0
  125. package/lib/model/strategy/adapter/index.d.ts +7 -0
  126. package/lib/model/strategy/adapter/index.js +57 -0
  127. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
  128. package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
  129. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
  130. package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
  131. package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
  132. package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
  133. package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
  134. package/lib/model/strategy/adapter/itemRule/index.js +60 -0
  135. package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
  136. package/lib/model/strategy/adapter/itemRule/type.js +46 -0
  137. package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
  138. package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
  139. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
  140. package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
  141. package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
  142. package/lib/model/strategy/adapter/promotion/examples.js +192 -0
  143. package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
  144. package/lib/model/strategy/adapter/promotion/index.js +0 -0
  145. package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
  146. package/lib/model/strategy/adapter/promotion/type.js +51 -0
  147. package/lib/model/strategy/adapter/type.d.ts +28 -0
  148. package/lib/model/strategy/adapter/type.js +17 -0
  149. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  150. package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
  151. package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
  152. package/lib/model/strategy/adapter/walletPass/example.js +207 -0
  153. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  154. package/lib/model/strategy/adapter/walletPass/index.js +142 -0
  155. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  156. package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
  157. package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
  158. package/lib/model/strategy/adapter/walletPass/type.js +17 -0
  159. package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
  160. package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
  161. package/lib/model/strategy/engine.d.ts +106 -0
  162. package/lib/model/strategy/engine.js +450 -0
  163. package/lib/model/strategy/index.d.ts +3 -0
  164. package/lib/model/strategy/index.js +38 -0
  165. package/lib/model/strategy/strategy-example.d.ts +5 -0
  166. package/lib/model/strategy/strategy-example.js +318 -0
  167. package/lib/model/strategy/type.d.ts +228 -0
  168. package/lib/model/strategy/type.js +44 -0
  169. package/lib/modules/Cart/utils/cartProduct.js +1 -0
  170. package/lib/modules/Discount/index.d.ts +4 -2
  171. package/lib/modules/Discount/index.js +60 -2
  172. package/lib/modules/Discount/types.d.ts +6 -0
  173. package/lib/modules/OpenData/index.d.ts +24 -0
  174. package/lib/modules/OpenData/index.js +119 -0
  175. package/lib/modules/OpenData/types.d.ts +73 -0
  176. package/lib/modules/OpenData/types.js +17 -0
  177. package/lib/modules/OpenData/utils.d.ts +2 -0
  178. package/lib/modules/OpenData/utils.js +111 -0
  179. package/lib/modules/Order/index.d.ts +66 -1
  180. package/lib/modules/Order/index.js +525 -0
  181. package/lib/modules/Order/types.d.ts +174 -12
  182. package/lib/modules/Order/utils.d.ts +118 -0
  183. package/lib/modules/Order/utils.js +483 -2
  184. package/lib/modules/Product/utils.js +2 -2
  185. package/lib/modules/ProductList/index.d.ts +3 -1
  186. package/lib/modules/ProductList/index.js +45 -34
  187. package/lib/modules/Quotation/index.d.ts +48 -0
  188. package/lib/modules/Quotation/index.js +152 -0
  189. package/lib/modules/Quotation/types.d.ts +42 -0
  190. package/lib/modules/Quotation/types.js +17 -0
  191. package/lib/modules/Rules/index.js +17 -18
  192. package/lib/modules/SalesSummary/index.d.ts +63 -0
  193. package/lib/modules/SalesSummary/index.js +105 -0
  194. package/lib/modules/SalesSummary/types.d.ts +60 -0
  195. package/lib/modules/SalesSummary/types.js +17 -0
  196. package/lib/modules/SalesSummary/utils.d.ts +30 -0
  197. package/lib/modules/SalesSummary/utils.js +420 -0
  198. package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
  199. package/lib/modules/ScanOrderLogger/index.js +147 -0
  200. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
  201. package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
  202. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
  203. package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
  204. package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
  205. package/lib/modules/ScanOrderLogger/types.js +17 -0
  206. package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
  207. package/lib/modules/Schedule/utils.d.ts +1 -1
  208. package/lib/modules/Summary/utils.d.ts +3 -3
  209. package/lib/modules/Summary/utils.js +22 -16
  210. package/lib/modules/index.d.ts +4 -0
  211. package/lib/modules/index.js +9 -1
  212. package/lib/solution/BookingByStep/index.d.ts +2 -2
  213. package/lib/solution/BookingByStep/types.d.ts +3 -1
  214. package/lib/solution/BookingByStep/types.js +10 -0
  215. package/lib/solution/ScanOrder/index.d.ts +158 -0
  216. package/lib/solution/ScanOrder/index.js +2135 -0
  217. package/lib/solution/ScanOrder/types.d.ts +306 -0
  218. package/lib/solution/ScanOrder/types.js +36 -0
  219. package/lib/solution/ScanOrder/utils.d.ts +172 -0
  220. package/lib/solution/ScanOrder/utils.js +658 -0
  221. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  222. package/lib/solution/ShopDiscount/index.js +4 -2
  223. package/lib/solution/VenueBooking/index.d.ts +201 -0
  224. package/lib/solution/VenueBooking/index.js +1937 -0
  225. package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
  226. package/lib/solution/VenueBooking/types.d.ts +154 -0
  227. package/lib/solution/VenueBooking/types.js +44 -0
  228. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
  229. package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
  230. package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
  231. package/lib/solution/VenueBooking/utils/resource.js +92 -0
  232. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
  233. package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
  234. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
  235. package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
  236. package/lib/solution/VenueBooking/utils.d.ts +1 -0
  237. package/lib/solution/VenueBooking/utils.js +69 -0
  238. package/lib/solution/index.d.ts +2 -0
  239. package/lib/solution/index.js +5 -1
  240. package/package.json +1 -1
@@ -46,7 +46,7 @@ export declare const formatScheduleResult: (schedule: ScheduleItem) => {
46
46
  };
47
47
  export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
48
48
  export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
49
- export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => {};
49
+ export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => ScheduleAllMap;
50
50
  /**
51
51
  * @title: 格式化日程数据
52
52
  * @description:
@@ -7,8 +7,8 @@ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], i
7
7
  * @param item
8
8
  */
9
9
  export declare const getBundleDiscountList: (bundle: any[]) => any[];
10
- export declare const calcDiscountListDifference: (discountList: any[]) => any;
11
- export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => any;
10
+ export declare const calcDiscountListDifference: (discountList: any[]) => number;
11
+ export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => number;
12
12
  /**
13
13
  * 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
14
14
  *
@@ -94,7 +94,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
94
94
  export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
95
95
  bookingDetail?: any;
96
96
  bookingId?: number | undefined;
97
- }, surcharge: any[], options: any) => any;
97
+ }, surcharge: any[], options: any) => number;
98
98
  /**
99
99
  * 订单附加费各项信息
100
100
  *
@@ -94,8 +94,8 @@ export var getBundleDiscountList = function getBundleDiscountList(bundle) {
94
94
  export var calcDiscountListDifference = function calcDiscountListDifference(discountList) {
95
95
  return discountList.reduce(function (pre, cur) {
96
96
  var _cur$metadata;
97
- return pre + ((cur === null || cur === void 0 || (_cur$metadata = cur.metadata) === null || _cur$metadata === void 0 ? void 0 : _cur$metadata.product_discount_difference) || 0);
98
- }, 0);
97
+ return pre.plus((cur === null || cur === void 0 || (_cur$metadata = cur.metadata) === null || _cur$metadata === void 0 ? void 0 : _cur$metadata.product_discount_difference) || 0);
98
+ }, new Decimal(0)).toNumber();
99
99
  };
100
100
  export var getProductDiscountProductDiscountDifference = function getProductDiscountProductDiscountDifference(item) {
101
101
  var _item$_origin, _item$_origin2;
@@ -662,8 +662,8 @@ export var getSurchargeAmount = function getSurchargeAmount(_ref7, surcharge, op
662
662
  if (!Array.isArray(surcharge)) return 0;
663
663
  // 新增状态使用 getSurcharge 的返回值进行求和
664
664
  return surcharge.reduce(function (total, item) {
665
- return total + (item.value || 0);
666
- }, 0);
665
+ return total.plus(item.value || 0);
666
+ }, new Decimal(0)).toNumber();
667
667
  };
668
668
 
669
669
  // bundle商品是否是原价
@@ -695,20 +695,30 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
695
695
  * 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
696
696
  */
697
697
  var getMainProductTotal = function getMainProductTotal(item) {
698
- var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$_origin3, _item$_originData;
699
- 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.price) !== null && _ref8 !== void 0 ? _ref8 : 0);
700
- 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) {
701
- var _item$metadata2;
702
- return !(item !== null && item !== void 0 && (_item$metadata2 = item.metadata) !== null && _item$metadata2 !== void 0 && _item$metadata2.custom_product_bundle_map_id);
703
- })) || [];
704
- var mainProductDiscountAmount = getDiscountAmount(discount);
705
- total = total.minus(mainProductDiscountAmount);
706
-
707
- // 单规格
708
- if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
709
- total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
710
- return t.add(new Decimal(option.price || 0).mul(option.num || 1));
711
- }, new Decimal(0)));
698
+ var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
699
+ // 新语义 v2 `main_product_selling_price` / `metadata.main_product_selling_price`
700
+ // 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
701
+ // 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
702
+ 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);
703
+
704
+ // 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
705
+ 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;
706
+ if (!hasMainProductPrice) {
707
+ var _ref10, _ref11, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
708
+ 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);
709
+ 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) {
710
+ var _item$metadata6;
711
+ return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
712
+ })) || [];
713
+ var mainProductDiscountAmount = getDiscountAmount(discount);
714
+ total = total.minus(mainProductDiscountAmount);
715
+
716
+ // 单规格
717
+ if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
718
+ total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
719
+ return t.add(new Decimal(option.price || 0).mul(option.num || 1));
720
+ }, new Decimal(0)));
721
+ }
712
722
  }
713
723
  var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
714
724
  _step4;
@@ -716,9 +726,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
716
726
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
717
727
  var bundleItem = _step4.value;
718
728
  if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
719
- var _ref10, _bundleItem$bundle_se2;
720
- // IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price和 price 其实都已经是折后价格了,不需要单独再减一次
721
- 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);
729
+ var _ref12, _bundleItem$bundle_se2;
730
+ // IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
731
+ 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);
722
732
  total = total.add(bundleItemTotal);
723
733
  }
724
734
  }
@@ -838,12 +848,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
838
848
  * @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
839
849
  * @returns 附加费列表(仅返回金额 > 0 的项)
840
850
  */
841
- export var getSurcharge = function getSurcharge(_ref11, options) {
851
+ export var getSurcharge = function getSurcharge(_ref13, options) {
842
852
  var _service$filter;
843
- var service = _ref11.service,
844
- addons = _ref11.addons,
845
- bookingDetail = _ref11.bookingDetail,
846
- bookingId = _ref11.bookingId;
853
+ var service = _ref13.service,
854
+ addons = _ref13.addons,
855
+ bookingDetail = _ref13.bookingDetail,
856
+ bookingId = _ref13.bookingId;
847
857
  var isEdit = options.isEdit,
848
858
  isInScheduleByDate = options.isInScheduleByDate,
849
859
  surcharge_list = options.surcharge_list,
@@ -965,11 +975,11 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
965
975
  scheduleById: scheduleById || {},
966
976
  isInScheduleByDate: isInScheduleByDate
967
977
  })) {
968
- var _ref12, _bundleItem$bundle_se3;
978
+ var _ref14, _bundleItem$bundle_se3;
969
979
  var _mainQuantity = item.num || 1;
970
980
  matchedItems.push({
971
981
  isMain: false,
972
- 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),
982
+ 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),
973
983
  quantity: bundleItem.num || bundleItem.quantity || 1,
974
984
  item: bundleItem,
975
985
  mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
@@ -1185,9 +1195,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
1185
1195
  }
1186
1196
  return surchargeWithAmount;
1187
1197
  };
1188
- function resetItemsSurchargeSideEffects(_ref13) {
1189
- var service = _ref13.service,
1190
- addons = _ref13.addons;
1198
+ function resetItemsSurchargeSideEffects(_ref15) {
1199
+ var service = _ref15.service,
1200
+ addons = _ref15.addons;
1191
1201
  var resetItem = function resetItem(item) {
1192
1202
  if (!item) return;
1193
1203
  item.surcharge_fee = 0;
@@ -10,4 +10,8 @@ export * from './Payment';
10
10
  export * from './Resource';
11
11
  export * from './Step';
12
12
  export * from './Summary';
13
+ export * from './SalesSummary';
13
14
  export * from './Schedule';
15
+ export * from './Quotation';
16
+ export * from './ScanOrderLogger';
17
+ export * from './OpenData';
@@ -10,4 +10,8 @@ export * from "./Payment";
10
10
  export * from "./Resource";
11
11
  export * from "./Step";
12
12
  export * from "./Summary";
13
- export * from "./Schedule";
13
+ export * from "./SalesSummary";
14
+ export * from "./Schedule";
15
+ export * from "./Quotation";
16
+ export * from "./ScanOrderLogger";
17
+ export * from "./OpenData";
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
313
+ weekNum: 0 | 1 | 3 | 2 | 4 | 5 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -357,7 +357,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
357
357
  };
358
358
  setOtherData(key: string, value: any): void;
359
359
  getOtherData(key: string): any;
360
- getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
360
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
361
361
  /**
362
362
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
363
363
  *
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -14,6 +14,8 @@ export interface BookingByStepState {
14
14
  currentProduct?: ProductData;
15
15
  currentProductMeta?: Record<string, any>;
16
16
  schedule: ScheduleModule;
17
+ salesSummary?: SalesSummaryModule;
18
+ scanOrderLogger?: ScanOrderLoggerModule;
17
19
  }
18
20
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
19
21
  export declare enum BookingByStepHooks {
@@ -1,10 +1,12 @@
1
- import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, ScheduleModule } from "../../modules";
1
+ import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
2
2
  export function createModule(moduleName, solutionName, name, version) {
3
3
  switch (moduleName) {
4
4
  case 'cart':
5
5
  return new CartModule("".concat(solutionName, "_").concat(name || moduleName), version);
6
6
  case 'summary':
7
7
  return new SummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
8
+ case 'salesSummary':
9
+ return new SalesSummaryModule("".concat(solutionName, "_").concat(name || moduleName), version);
8
10
  case 'step':
9
11
  return new StepModule("".concat(solutionName, "_").concat(name || moduleName), version);
10
12
  case 'products':
@@ -19,6 +21,8 @@ export function createModule(moduleName, solutionName, name, version) {
19
21
  return new PaymentModule("".concat(solutionName, "_").concat(name || moduleName), version);
20
22
  case 'schedule':
21
23
  return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
24
+ case 'scanOrderLogger':
25
+ return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
22
26
  default:
23
27
  throw new Error("Unknown module type: ".concat(moduleName));
24
28
  }
@@ -0,0 +1,158 @@
1
+ import { Module, ModuleOptions, PisellCore } from '../../types';
2
+ import { BaseModule } from '../../modules/BaseModule';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult, ScanOrderTempOrder } from './types';
4
+ import type { UpdateProductInOrderParams } from '../../modules/Order/types';
5
+ import type { Discount } from '../../modules/Discount/types';
6
+ import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
7
+ import type { StrategyConfig } from '../../model/strategy/type';
8
+ import type { ProductData } from '../../modules/Product/types';
9
+ export * from './types';
10
+ interface ScanOrderItemRuleRuntimeConfig {
11
+ strategyConfigs?: StrategyConfig[];
12
+ pax?: Partial<PaxInfo>;
13
+ historicalItems?: CartItemSummary[];
14
+ serviceType?: string;
15
+ submissionIndex?: number;
16
+ custom?: Record<string, any>;
17
+ }
18
+ export declare class ScanOrderImpl extends BaseModule implements Module {
19
+ protected defaultName: string;
20
+ protected defaultVersion: string;
21
+ isSolution: boolean;
22
+ private initializeOptions;
23
+ private store;
24
+ private otherParams;
25
+ private cacheId;
26
+ private window;
27
+ private request;
28
+ private itemRuleEvaluator;
29
+ private itemRuleConfigs;
30
+ private itemRuleConfigsPromise;
31
+ private itemRulePrefillApplied;
32
+ private itemRuleRuntimeConfig;
33
+ /** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
34
+ private enabledReservationRuleProducts;
35
+ private loginEffectDisposers;
36
+ private customerLoginRefreshInFlight;
37
+ private customerLoginRefreshIdInFlight;
38
+ private static readonly PISELL1_LOGIN_SUCCESS;
39
+ private getScanOrderLoggerContext;
40
+ private safeStringify;
41
+ private pickErrorMessage;
42
+ private serializeError;
43
+ private addScanOrderLog;
44
+ private logMethodStart;
45
+ private logMethodSuccess;
46
+ private logMethodError;
47
+ private assertProductListLoaded;
48
+ addLog(params: ScanOrderAddLogParams): Promise<void>;
49
+ private normalizeCustomerId;
50
+ private resolveCustomerIdFromLoginPayload;
51
+ private clearLoginEffectListeners;
52
+ private registerLoginEffect;
53
+ private registerCustomerLoginListeners;
54
+ private refreshOrderMarketingAfterLogin;
55
+ constructor(name?: string, version?: string);
56
+ /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
57
+ getCacheId(): string | undefined;
58
+ private destroyRegisteredChildModules;
59
+ initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
60
+ destroy(): Promise<void>;
61
+ retryInit(): Promise<void>;
62
+ refresh(): Promise<void>;
63
+ getStatus(): import("./types").ScanOrderStatus;
64
+ getEntryContext(): import("./types").ScanOrderEntryContext | null;
65
+ getConfig(): Record<string, any>;
66
+ getItemRuleQuantityLimits(): QuantityLimitResult[];
67
+ getCartValidationPassed(): boolean | null;
68
+ getCartValidation(): {
69
+ passed: boolean | null;
70
+ failures: QuantityCheckResult[];
71
+ };
72
+ getTempOrder(): ScanOrderTempOrder | null;
73
+ updateTempOrderNote(note: string): string;
74
+ setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
75
+ service_type: 'dine_in' | '';
76
+ pickup_reference_mode: 'counter_pickup' | 'table_service';
77
+ };
78
+ setPickupRef(buzzer: string): string;
79
+ private ensureTempOrder;
80
+ addNewOrder(): Promise<ScanOrderTempOrder>;
81
+ restoreOrder(): Promise<ScanOrderTempOrder>;
82
+ getOrderProducts(): ScanOrderOrderProduct[];
83
+ getSummary(): Promise<import("./types").ScanOrderSummary>;
84
+ getDiscountList(): Discount[];
85
+ scanCode(code: string, customerId?: number): Promise<ScanOrderScanCodeResult>;
86
+ setDiscountSelected(params: {
87
+ discountId: number;
88
+ isSelected: boolean;
89
+ }): Promise<void>;
90
+ onCustomerLogin(params: {
91
+ customerId: number;
92
+ }): Promise<void>;
93
+ private findReservationRuleResource;
94
+ private buildScanOrderResourceMetadata;
95
+ private prepareRetailAvailability;
96
+ private buildSubmitPayloadEnhancer;
97
+ submitScanOrder<T = any>(): Promise<T>;
98
+ addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
99
+ updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
100
+ /**
101
+ * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
102
+ * 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
103
+ */
104
+ setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<ScanOrderOrderProduct[]>;
105
+ removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
106
+ private loadRuntimeConfigs;
107
+ private syncItemRuleConfigsFromDineInConfig;
108
+ private fetchItemRuleConfigsByModelIds;
109
+ private buildPrefillProductSourceMap;
110
+ private getItemRuleRuntimeConfig;
111
+ private ensureItemRuleConfigsLoaded;
112
+ private refreshItemRuleQuantityLimits;
113
+ private applyPrefillByItemRule;
114
+ applyItemRulePrefill(): Promise<void>;
115
+ private evaluateCartValidationByItemRule;
116
+ private validateBeforeSubmitByItemRule;
117
+ private refreshCartValidationPassed;
118
+ setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
119
+ private normalizeResourceState;
120
+ private resolveResourceSelectType;
121
+ private fetchResourceOccupyDetailsByResourceId;
122
+ private resolveAdditionalOrderFromOccupyDetail;
123
+ checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
124
+ restorePreviousOrderData(): Promise<void>;
125
+ getAdditionalOrderInfo(): Promise<{
126
+ orderId: string;
127
+ orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
128
+ orderTime: string;
129
+ orderAmount: number;
130
+ orderItems: any[];
131
+ }>;
132
+ getProductList(): Promise<ProductData[]>;
133
+ getOtherParams(): Record<string, any>;
134
+ setOtherParams(params: Record<string, any>, { cover }?: {
135
+ cover?: boolean;
136
+ }): Promise<void>;
137
+ private static readonly UI_STATE_KEY_PREFIX;
138
+ private getUIStateBucketKey;
139
+ private readUIStateBucket;
140
+ private writeUIStateBucket;
141
+ setUIState(key: string, value: any): void;
142
+ getUIState<T = any>(key: string): T | undefined;
143
+ deleteUIState(key: string): void;
144
+ clearUIState(): void;
145
+ setEntryPaxNumber(number: number): Promise<void>;
146
+ getEntryPaxNumber(): number | null;
147
+ syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
148
+ getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
149
+ checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
150
+ getFulfillmentModes(): {
151
+ enablePickup: boolean;
152
+ enableTableService: boolean;
153
+ };
154
+ checkManualPickupRef(): {
155
+ enabled: boolean;
156
+ manualInputType?: string;
157
+ };
158
+ }