@pisell/pisellos 2.3.38 → 2.3.40

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 (229) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  11. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  12. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
  13. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
  14. package/dist/modules/Discount/index.d.ts +1 -0
  15. package/dist/modules/Discount/index.js +40 -11
  16. package/dist/modules/Discount/types.d.ts +1 -0
  17. package/dist/modules/Holder/index.d.ts +48 -0
  18. package/dist/modules/Holder/index.js +640 -0
  19. package/dist/modules/Holder/types.d.ts +123 -0
  20. package/dist/modules/Holder/types.js +1 -0
  21. package/dist/modules/Holder/utils.d.ts +13 -0
  22. package/dist/modules/Holder/utils.js +34 -0
  23. package/dist/modules/OpenData/index.d.ts +0 -2
  24. package/dist/modules/OpenData/index.js +2 -10
  25. package/dist/modules/Order/index.d.ts +11 -28
  26. package/dist/modules/Order/index.js +509 -750
  27. package/dist/modules/Order/types.d.ts +10 -33
  28. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  29. package/dist/modules/Order/utils.d.ts +10 -0
  30. package/dist/modules/Order/utils.js +41 -13
  31. package/dist/modules/Payment/index.d.ts +0 -2
  32. package/dist/modules/Payment/index.js +50 -79
  33. package/dist/modules/Payment/types.d.ts +28 -99
  34. package/dist/modules/Payment/types.js +3 -20
  35. package/dist/modules/Payment/walletpass.d.ts +1 -25
  36. package/dist/modules/Payment/walletpass.js +157 -707
  37. package/dist/modules/Product/types.d.ts +1 -0
  38. package/dist/modules/ProductList/index.js +33 -14
  39. package/dist/modules/Quotation/index.d.ts +1 -1
  40. package/dist/modules/Quotation/index.js +2 -2
  41. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  42. package/dist/modules/ResourcePlanner/index.js +181 -0
  43. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  44. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  45. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  46. package/dist/modules/ResourcePlanner/types.js +1 -0
  47. package/dist/modules/Rules/index.d.ts +0 -1
  48. package/dist/modules/Rules/index.js +96 -89
  49. package/dist/modules/SalesSummary/index.js +12 -13
  50. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/index.js +15 -2
  52. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  53. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  54. package/dist/modules/Schedule/index.d.ts +3 -1
  55. package/dist/modules/Schedule/index.js +21 -16
  56. package/dist/modules/Summary/utils.js +38 -13
  57. package/dist/modules/index.d.ts +2 -0
  58. package/dist/modules/index.js +3 -1
  59. package/dist/plugins/window.d.ts +1 -0
  60. package/dist/server/index.d.ts +14 -16
  61. package/dist/server/index.js +1148 -1930
  62. package/dist/server/modules/order/index.d.ts +4 -54
  63. package/dist/server/modules/order/index.js +695 -1595
  64. package/dist/server/modules/order/types.d.ts +3 -11
  65. package/dist/server/modules/order/types.js +1 -1
  66. package/dist/solution/BaseSales/index.d.ts +20 -109
  67. package/dist/solution/BaseSales/index.js +481 -1797
  68. package/dist/solution/BaseSales/types.d.ts +0 -52
  69. package/dist/solution/BaseSales/types.js +1 -2
  70. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  71. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  72. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  73. package/dist/solution/BookingByStep/index.d.ts +17 -2
  74. package/dist/solution/BookingByStep/index.js +294 -215
  75. package/dist/solution/BookingByStep/types.d.ts +2 -1
  76. package/dist/solution/BookingByStep/types.js +3 -1
  77. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  78. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  79. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  80. package/dist/solution/BookingTicket/index.d.ts +4 -8
  81. package/dist/solution/BookingTicket/index.js +51 -134
  82. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
  83. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  84. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
  85. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  86. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  87. package/dist/solution/Sales/index.d.ts +0 -1
  88. package/dist/solution/Sales/index.js +2 -10
  89. package/dist/solution/ScanOrder/index.d.ts +26 -14
  90. package/dist/solution/ScanOrder/index.js +1148 -756
  91. package/dist/solution/ScanOrder/types.d.ts +21 -1
  92. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  93. package/dist/solution/ScanOrder/utils.js +66 -25
  94. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  95. package/dist/solution/ShopDiscount/index.js +125 -87
  96. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  97. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  98. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  99. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  100. package/dist/solution/VenueBooking/index.d.ts +39 -11
  101. package/dist/solution/VenueBooking/index.js +1176 -860
  102. package/dist/solution/VenueBooking/types.d.ts +3 -0
  103. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  104. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  105. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  106. package/dist/solution/index.d.ts +1 -0
  107. package/dist/solution/index.js +2 -1
  108. package/dist/types/index.d.ts +1 -1
  109. package/lib/core/index.d.ts +0 -2
  110. package/lib/core/index.js +0 -4
  111. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  112. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  113. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  114. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  115. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  116. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  117. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  118. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  119. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  120. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  121. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
  122. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  123. package/lib/modules/Discount/index.d.ts +1 -0
  124. package/lib/modules/Discount/index.js +9 -0
  125. package/lib/modules/Discount/types.d.ts +1 -0
  126. package/lib/modules/Holder/index.d.ts +48 -0
  127. package/lib/modules/Holder/index.js +402 -0
  128. package/lib/modules/Holder/types.d.ts +123 -0
  129. package/lib/modules/Holder/types.js +17 -0
  130. package/lib/modules/Holder/utils.d.ts +13 -0
  131. package/lib/modules/Holder/utils.js +71 -0
  132. package/lib/modules/OpenData/index.d.ts +0 -2
  133. package/lib/modules/OpenData/index.js +1 -6
  134. package/lib/modules/Order/index.d.ts +11 -28
  135. package/lib/modules/Order/index.js +86 -196
  136. package/lib/modules/Order/types.d.ts +10 -33
  137. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  138. package/lib/modules/Order/utils.d.ts +10 -0
  139. package/lib/modules/Order/utils.js +40 -16
  140. package/lib/modules/Payment/index.d.ts +0 -2
  141. package/lib/modules/Payment/index.js +13 -34
  142. package/lib/modules/Payment/types.d.ts +28 -99
  143. package/lib/modules/Payment/types.js +3 -4
  144. package/lib/modules/Payment/walletpass.d.ts +1 -25
  145. package/lib/modules/Payment/walletpass.js +21 -470
  146. package/lib/modules/Product/types.d.ts +1 -0
  147. package/lib/modules/ProductList/index.js +40 -31
  148. package/lib/modules/Quotation/index.d.ts +1 -1
  149. package/lib/modules/Quotation/index.js +2 -2
  150. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  151. package/lib/modules/ResourcePlanner/index.js +148 -0
  152. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  153. package/lib/modules/ResourcePlanner/planner.js +933 -0
  154. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  155. package/lib/modules/ResourcePlanner/types.js +17 -0
  156. package/lib/modules/Rules/index.d.ts +0 -1
  157. package/lib/modules/Rules/index.js +40 -47
  158. package/lib/modules/SalesSummary/index.js +6 -7
  159. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  160. package/lib/modules/ScanOrderLogger/index.js +13 -1
  161. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  162. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  163. package/lib/modules/Schedule/index.d.ts +3 -1
  164. package/lib/modules/Schedule/index.js +10 -8
  165. package/lib/modules/Summary/utils.js +21 -1
  166. package/lib/modules/index.d.ts +2 -0
  167. package/lib/modules/index.js +5 -1
  168. package/lib/plugins/window.d.ts +1 -0
  169. package/lib/server/index.d.ts +14 -16
  170. package/lib/server/index.js +83 -675
  171. package/lib/server/modules/order/index.d.ts +4 -54
  172. package/lib/server/modules/order/index.js +66 -679
  173. package/lib/server/modules/order/types.d.ts +3 -11
  174. package/lib/solution/BaseSales/index.d.ts +20 -109
  175. package/lib/solution/BaseSales/index.js +70 -881
  176. package/lib/solution/BaseSales/types.d.ts +0 -52
  177. package/lib/solution/BaseSales/types.js +1 -2
  178. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  179. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  180. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  181. package/lib/solution/BookingByStep/index.d.ts +17 -2
  182. package/lib/solution/BookingByStep/index.js +60 -18
  183. package/lib/solution/BookingByStep/types.d.ts +2 -1
  184. package/lib/solution/BookingByStep/types.js +5 -0
  185. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  186. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  187. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  188. package/lib/solution/BookingTicket/index.d.ts +4 -8
  189. package/lib/solution/BookingTicket/index.js +19 -64
  190. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
  191. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  192. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
  193. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  194. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  195. package/lib/solution/Sales/index.d.ts +0 -1
  196. package/lib/solution/Sales/index.js +3 -5
  197. package/lib/solution/ScanOrder/index.d.ts +26 -14
  198. package/lib/solution/ScanOrder/index.js +449 -190
  199. package/lib/solution/ScanOrder/types.d.ts +21 -1
  200. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  201. package/lib/solution/ScanOrder/utils.js +31 -0
  202. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  203. package/lib/solution/ShopDiscount/index.js +14 -0
  204. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  205. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  206. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  207. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  208. package/lib/solution/VenueBooking/index.d.ts +39 -11
  209. package/lib/solution/VenueBooking/index.js +328 -123
  210. package/lib/solution/VenueBooking/types.d.ts +3 -0
  211. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  212. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  213. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  214. package/lib/solution/index.d.ts +1 -0
  215. package/lib/solution/index.js +3 -1
  216. package/lib/types/index.d.ts +1 -1
  217. package/package.json +1 -1
  218. package/dist/modules/Order/payment-utils.d.ts +0 -26
  219. package/dist/modules/Order/payment-utils.js +0 -225
  220. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  221. package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
  222. package/dist/utils/payment-number.d.ts +0 -9
  223. package/dist/utils/payment-number.js +0 -69
  224. package/lib/modules/Order/payment-utils.d.ts +0 -26
  225. package/lib/modules/Order/payment-utils.js +0 -224
  226. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  227. package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
  228. package/lib/utils/payment-number.d.ts +0 -9
  229. package/lib/utils/payment-number.js +0 -64
@@ -77,10 +77,15 @@ function calculateResourceAvailableTime({
77
77
  function findFastestAvailableResource({
78
78
  resources,
79
79
  currentCapacity = 1,
80
- countMap = {}
80
+ countMap = {},
81
+ targetDate,
82
+ durationMinutes = 30
81
83
  }) {
82
84
  var _a, _b, _c;
83
85
  const currentTime = (0, import_dayjs.default)();
86
+ const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
87
+ const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
88
+ const isTargetDayToday = targetDay.isSame(currentTime, "day");
84
89
  let fastestTime = null;
85
90
  let fastestResources = [];
86
91
  console.log("[TimeslotUtils] 查找最快可用资源:", {
@@ -90,19 +95,22 @@ function findFastestAvailableResource({
90
95
  countMap
91
96
  });
92
97
  for (const resource of resources) {
93
- const todayTimes = resource.times.filter((time) => {
94
- const isToday = (0, import_dayjs.default)(time.start_at).isSame(currentTime, "day");
95
- const isStillWorking = (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
96
- return isToday && isStillWorking;
98
+ const targetDayTimes = resource.times.filter((time) => {
99
+ const isSameTargetDay = (0, import_dayjs.default)(time.start_at).isSame(targetDay, "day");
100
+ if (!isSameTargetDay)
101
+ return false;
102
+ if (!isTargetDayToday)
103
+ return true;
104
+ return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
97
105
  });
98
- if (todayTimes.length === 0) {
106
+ if (targetDayTimes.length === 0) {
99
107
  console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
100
108
  continue;
101
109
  }
102
- for (const time of todayTimes) {
110
+ for (const time of targetDayTimes) {
103
111
  const workStartTime = (0, import_dayjs.default)(time.start_at);
104
112
  const workEndTime = (0, import_dayjs.default)(time.end_at);
105
- let nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
113
+ let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
106
114
  console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
107
115
  workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
108
116
  checkStartTime: nextAvailableTime.format("HH:mm:ss"),
@@ -126,7 +134,7 @@ function findFastestAvailableResource({
126
134
  pax: event.pax || 1
127
135
  });
128
136
  if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
129
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
137
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
130
138
  finalAvailableTime = eventEnd;
131
139
  console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
132
140
  }
@@ -134,7 +142,7 @@ function findFastestAvailableResource({
134
142
  const totalCapacity = resource.capacity || 0;
135
143
  const currentUsedCapacity = countMap[resource.id] || 0;
136
144
  const eventUsedCapacity = event.pax || 1;
137
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
145
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
138
146
  const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
139
147
  if (totalRequiredCapacity > totalCapacity) {
140
148
  finalAvailableTime = eventEnd;
@@ -143,7 +151,7 @@ function findFastestAvailableResource({
143
151
  }
144
152
  }
145
153
  }
146
- if (finalAvailableTime.isAfter(workEndTime)) {
154
+ if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
147
155
  console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
148
156
  continue;
149
157
  }
@@ -46,8 +46,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
46
46
  private getIdGeneratorPlugin;
47
47
  private loadOpenDataConfig;
48
48
  getOpenData(): Promise<OpenDataConfig | null>;
49
- /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
50
- clearOpenDataCache(): void;
51
49
  private getShortNumberOrDeviceId;
52
50
  private configureIdGeneratorFromOpenData;
53
51
  private normalizePositiveInteger;
@@ -191,12 +189,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
191
189
  */
192
190
  getCustomer(): ICustomer | null;
193
191
  /**
194
- * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
195
- * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
192
+ * 通过 ids 获取商品列表(不加载到模块中)
193
+ * @returns 商品列表
196
194
  */
197
- getProductByIds(ids: number[], options?: {
198
- loadMissing?: boolean;
199
- }): Promise<ProductData[]>;
195
+ getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
200
196
  /**
201
197
  * 获取日程时间段点
202
198
  * @param params 参数
@@ -326,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
326
322
  * 获取当前的客户搜索条件
327
323
  * @returns 当前搜索条件
328
324
  */
329
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
325
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
330
326
  /**
331
327
  * 获取客户列表状态(包含滚动加载相关状态)
332
328
  * @returns 客户状态
@@ -219,14 +219,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
219
219
  }
220
220
  }
221
221
  async getOpenData() {
222
- return this.loadOpenDataConfig();
223
- }
224
- /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
225
- clearOpenDataCache() {
226
222
  var _a;
227
- this.loadOpenDataConfigInFlight = null;
228
- this.otherParams.openData = null;
229
- (_a = this.store.openData) == null ? void 0 : _a.clearCache();
223
+ return (_a = this.store.openData) == null ? void 0 : _a.getOpenData();
230
224
  }
231
225
  async getShortNumberOrDeviceId() {
232
226
  const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
@@ -239,7 +233,6 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
239
233
  return String(this.getAppData("device_id") || 0).slice(-2);
240
234
  }
241
235
  async configureIdGeneratorFromOpenData() {
242
- this.setPaymentNumberDevicePrefix(null);
243
236
  let openDataConfig = null;
244
237
  try {
245
238
  openDataConfig = await this.loadOpenDataConfig();
@@ -271,7 +264,6 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
271
264
  const resetReceiptSequenceDaily = typeof (openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"]) === "boolean" ? openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"] : false;
272
265
  const operatingDayBoundary = this.getAppData("operating_day_boundary");
273
266
  const deviceId = await this.getShortNumberOrDeviceId();
274
- this.setPaymentNumberDevicePrefix(deviceId);
275
267
  const businessCode = this.getBookingTicketBusinessCode();
276
268
  if (!businessCode) {
277
269
  console.warn("[BookingTicket] businessCode 缺失,跳过 idGenerator 配置");
@@ -722,53 +714,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
722
714
  return this.getOrderCustomerSnapshot();
723
715
  }
724
716
  /**
725
- * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
726
- * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
717
+ * 通过 ids 获取商品列表(不加载到模块中)
718
+ * @returns 商品列表
727
719
  */
728
- async getProductByIds(ids, options) {
729
- var _a, _b;
730
- const normalizedIds = Array.from(
731
- new Set(
732
- (ids || []).map((id) => Number(id)).filter((id) => Number.isFinite(id))
733
- )
734
- );
735
- const localProducts = await this.store.products.getProductByIds(normalizedIds) || [];
736
- if (!(options == null ? void 0 : options.loadMissing)) {
737
- return localProducts;
738
- }
739
- const localProductIds = new Set(
740
- localProducts.map((product) => Number(product.id))
741
- );
742
- const missingIds = normalizedIds.filter(
743
- (id) => !localProductIds.has(id)
744
- );
745
- if (!missingIds.length) {
746
- return localProducts;
747
- }
748
- const rawBookingDate = this.getBookingDate();
749
- const bookingDate = rawBookingDate && (0, import_dayjs.default)(rawBookingDate).isValid() ? (0, import_dayjs.default)(rawBookingDate) : null;
750
- const customerId = Number(
751
- ((_a = this.getOrderCustomerSnapshot()) == null ? void 0 : _a.id) ?? ((_b = this.getOrderCustomer()) == null ? void 0 : _b.customer_id)
752
- );
753
- const loadedProducts = await this.store.products.loadProducts({
754
- product_ids: missingIds,
755
- with_count: ["bundleGroup", "optionGroup"],
756
- with_schedule: 1,
757
- cacheId: this.cacheId,
758
- ...bookingDate ? {
759
- schedule_date: bookingDate.format("YYYY-MM-DD"),
760
- schedule_datetime: bookingDate.format("YYYY-MM-DD HH:mm:ss")
761
- } : {},
762
- ...Number.isFinite(customerId) && customerId > 0 ? { customer_id: customerId } : {}
763
- });
764
- const productById = /* @__PURE__ */ new Map();
765
- [...localProducts, ...loadedProducts || []].forEach((product) => {
766
- const productId = Number(product.id);
767
- if (Number.isFinite(productId)) {
768
- productById.set(productId, product);
769
- }
770
- });
771
- return normalizedIds.map((id) => productById.get(id)).filter((product) => Boolean(product));
720
+ async getProductByIds(ids) {
721
+ return this.store.products.getProductByIds(ids);
772
722
  }
773
723
  /**
774
724
  * 获取日程时间段点
@@ -1092,7 +1042,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1092
1042
  */
1093
1043
  scanGlobalListener(callback) {
1094
1044
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1095
- const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1045
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(
1046
+ this.request,
1047
+ localSearch,
1048
+ this.getSubmitOrderSalesChannel()
1049
+ );
1096
1050
  const safeCallback = (d) => {
1097
1051
  try {
1098
1052
  callback(d);
@@ -1203,8 +1157,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1203
1157
  }
1204
1158
  /** 读取当前 booking config。 */
1205
1159
  getBookingConfig() {
1206
- var _a;
1207
- return (_a = this.store.bookingContext) == null ? void 0 : _a.getBookingConfig();
1160
+ return this.store.bookingContext.getBookingConfig();
1208
1161
  }
1209
1162
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
1210
1163
  setResources(resources) {
@@ -1421,7 +1374,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1421
1374
  }
1422
1375
  try {
1423
1376
  const localSearch = (v) => this.store.products.findProductsByCodeOrBarcode(v);
1424
- const scanCallback = (0, import_handleScan.handleGlobalScan)(this.request, localSearch);
1377
+ const scanCallback = (0, import_handleScan.handleGlobalScan)(
1378
+ this.request,
1379
+ localSearch,
1380
+ this.getSubmitOrderSalesChannel()
1381
+ );
1425
1382
  const raw = await scanCallback({ type: "nativeScanner", value: trimmed });
1426
1383
  const formatted = (0, import_formatGlobalScan.formatGlobalScanResult)(raw, trimmed);
1427
1384
  if (!formatted) {
@@ -1440,9 +1397,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1440
1397
  decideAddProduct: (item, options) => this.decideAddProduct(item, options),
1441
1398
  decideAfterDetail: (cacheItem, options) => this.decideAfterDetail(cacheItem, options),
1442
1399
  transformDetailToProductAndBooking: (input) => this.transformDetailToProductAndBooking(input),
1443
- addProductToOrder: (product, booking) => this.addProductToOrder(product, booking),
1444
- refreshWalletAssets: (params) => this.refreshWalletAssets(params),
1445
- scanWalletAsset: (scanCode) => this.scanWalletAsset(scanCode)
1400
+ addProductToOrder: (product, booking) => this.addProductToOrder(product, booking)
1446
1401
  },
1447
1402
  formatted,
1448
1403
  bridge
@@ -1579,8 +1534,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1579
1534
  return result;
1580
1535
  }
1581
1536
  async setOtherParams(params, { cover = false } = {}) {
1582
- await super.setOtherParams(params, { cover });
1583
- if ((params == null ? void 0 : params.businessCode) !== void 0 || (params == null ? void 0 : params.business_code) !== void 0) {
1537
+ super.setOtherParams(params, { cover });
1538
+ if (params == null ? void 0 : params.businessCode) {
1584
1539
  await this.configureIdGeneratorFromOpenData();
1585
1540
  }
1586
1541
  }
@@ -44,7 +44,6 @@ module.exports = __toCommonJS(addProductDecision_exports);
44
44
  var import_dayjs = __toESM(require("dayjs"));
45
45
  var import_BookingContext = require("../../../modules/BookingContext");
46
46
  var import_transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
47
- var import_weighingProductSku = require("./weighingProductSku");
48
47
  function needsSpecDetailModal(item) {
49
48
  if (item == null ? void 0 : item.open_sold_weight)
50
49
  return true;
@@ -282,14 +281,11 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
282
281
  const quantity = (ctx == null ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.quantity) ?? 1;
283
282
  const resolvedPid = (cacheItem == null ? void 0 : cacheItem.product_id) ?? (cacheItem == null ? void 0 : cacheItem.id);
284
283
  const extend = (cacheItem == null ? void 0 : cacheItem._extend) || {};
285
- const productSku = (0, import_weighingProductSku.buildProductSkuFromCacheItem)(cacheItem);
286
284
  return {
287
285
  id: (cacheItem == null ? void 0 : cacheItem.id) ?? (cacheItem == null ? void 0 : cacheItem.product_id),
288
286
  product_id: resolvedPid,
289
287
  variant_id: (other == null ? void 0 : other.product_variant_id) ?? (other == null ? void 0 : other.variant_id) ?? 0,
290
288
  quantity,
291
- // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
292
- product_sku: productSku ? { ...productSku, option: (other == null ? void 0 : other.option) || [] } : void 0,
293
289
  option: (other == null ? void 0 : other.option) || [],
294
290
  bundle: (other == null ? void 0 : other.bundle) || ((_c = extend == null ? void 0 : extend.skuValue) == null ? void 0 : _c.bundle) || ((_d = extend == null ? void 0 : extend._skuValue) == null ? void 0 : _d.bundle) || [],
295
291
  unique: other == null ? void 0 : other.unique,
@@ -24,14 +24,6 @@ export interface GlobalScanApplyHost {
24
24
  cacheItem: any;
25
25
  };
26
26
  addProductToOrder(product: any, booking?: any): Promise<any>;
27
- refreshWalletAssets?(params?: {
28
- preserveSelection?: boolean;
29
- }): Promise<any>;
30
- scanWalletAsset?(code: string): Promise<{
31
- type: 'walletCode' | 'normalCode';
32
- asset?: any;
33
- selected: boolean;
34
- }>;
35
27
  }
36
28
  /**
37
29
  * 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
@@ -101,32 +101,13 @@ async function applyGlobalScan(host, formatted, bridge) {
101
101
  return { status: "success", kind: "customer" };
102
102
  }
103
103
  if (searchType === "walletPass") {
104
+ if (!data) {
105
+ (_c = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _c.call(bridge, "fail", "pisell2.text.scan-global-failed");
106
+ return { status: "failed", reason: "invalid_data" };
107
+ }
104
108
  const snapshot = host.getOrderCustomerSnapshot();
105
109
  const scannedCustomerIsWalkIn = (0, import_cartView.isWalkInCustomer)(data);
106
- const trySelectWalletAsset = async () => {
107
- var _a2, _b2;
108
- if (!host.scanWalletAsset)
109
- return null;
110
- const walletResult = await host.scanWalletAsset(scanCode).catch((error) => {
111
- console.warn("[GlobalScan] Wallet asset lookup failed", error);
112
- return null;
113
- });
114
- if (!walletResult)
115
- return null;
116
- if (walletResult.type !== "normalCode" || !walletResult.asset) {
117
- return null;
118
- }
119
- if (walletResult.selected) {
120
- (_a2 = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _a2.call(bridge, "success");
121
- return { status: "success", kind: "promotion" };
122
- }
123
- (_b2 = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _b2.call(bridge, "fail", "pisell2.text.goodpass.code-invalid-cart");
124
- return { status: "failed", reason: "invalid_data" };
125
- };
126
110
  if ((0, import_cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
127
- const walletSelection2 = await trySelectWalletAsset();
128
- if (walletSelection2)
129
- return walletSelection2;
130
111
  if (!(bridge == null ? void 0 : bridge.applyPromotionCode)) {
131
112
  return { status: "failed", reason: "no_bridge" };
132
113
  }
@@ -137,19 +118,6 @@ async function applyGlobalScan(host, formatted, bridge) {
137
118
  return { status: "failed", reason: "invalid_data" };
138
119
  }
139
120
  host.setOrderCustomer(data);
140
- await ((_c = host.refreshWalletAssets) == null ? void 0 : _c.call(host, { preserveSelection: false }));
141
- const walletSelection = await trySelectWalletAsset();
142
- if (walletSelection)
143
- return walletSelection;
144
- if (bridge == null ? void 0 : bridge.applyPromotionCode) {
145
- const promotionResult = await bridge.applyPromotionCode(
146
- scanCode,
147
- Number((data == null ? void 0 : data.id) ?? (data == null ? void 0 : data.customer_id)) || void 0
148
- );
149
- if (promotionResult == null ? void 0 : promotionResult.isAvailable) {
150
- return { status: "success", kind: "promotion" };
151
- }
152
- }
153
121
  (_d = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _d.call(bridge, "success", "pisell2.text.add-client-success");
154
122
  return { status: "success", kind: "customer" };
155
123
  }
@@ -2,9 +2,11 @@ import { RequestPlugin } from '../../../../plugins';
2
2
  /**
3
3
  * 处理全局扫码
4
4
  * @param request 请求插件
5
+ * @param localSearch 本地商品搜索
6
+ * @param channel 当前销售渠道
5
7
  * @returns 处理结果
6
8
  */
7
- export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
9
+ export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[], channel?: string) => (scanResult: {
8
10
  type: string;
9
11
  value: string;
10
12
  }) => Promise<any>;
@@ -102,14 +102,14 @@ var handleScanFn = (getRequestList, localSearch) => {
102
102
  }
103
103
  };
104
104
  };
105
- var handleGlobalScan = (request, localSearch) => {
105
+ var handleGlobalScan = (request, localSearch, channel) => {
106
106
  const getRequestList = (value) => {
107
107
  let requestList = [];
108
108
  if (value.startsWith("WL")) {
109
109
  requestList = [(0, import_cloudSearch.searchWallet)(request, value)];
110
110
  } else {
111
111
  requestList = [
112
- (0, import_cloudSearch.searchOrder)(request, value),
112
+ ...channel === "kiosk" ? [] : [(0, import_cloudSearch.searchOrder)(request, value)],
113
113
  (0, import_cloudSearch.searchWalletPass)(request, value),
114
114
  (0, import_cloudSearch.searchWallet)(request, value),
115
115
  (0, import_cloudSearch.searchProduct)(request, value)
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
83
83
  private getBookingAppointmentStatus;
84
84
  private isBookingIncludedInStats;
85
85
  private getBookingOrderPaymentStatus;
86
- private isUnpaidBooking;
87
86
  private countBookingOrders;
88
87
  private countCompletedBookings;
89
88
  private groupBookingsByResource;
@@ -39,7 +39,6 @@ var import_dayjs = __toESM(require("dayjs"));
39
39
  var import_BaseModule = require("../../modules/BaseModule");
40
40
  var import_types = require("./types");
41
41
  __reExport(Sales_exports, require("./types"), module.exports);
42
- var UNPAID_PAYMENT_STATUSES = /* @__PURE__ */ new Set(["unpaid", "partially_paid", "payment_processing"]);
43
42
  var SalesImpl = class extends import_BaseModule.BaseModule {
44
43
  // LoggerManager 实例
45
44
  constructor(name, version) {
@@ -259,9 +258,6 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
259
258
  var _a;
260
259
  return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
261
260
  }
262
- isUnpaidBooking(booking) {
263
- return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
264
- }
265
261
  countBookingOrders(bookings) {
266
262
  const orderIds = /* @__PURE__ */ new Set();
267
263
  bookings.forEach((booking) => {
@@ -635,7 +631,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
635
631
  const completedBookingList = matchedBookingList.filter(
636
632
  (booking) => this.getBookingAppointmentStatus(booking) === "completed"
637
633
  );
638
- const unpaidBookingList = matchedBookingList.filter((booking) => this.isUnpaidBooking(booking));
634
+ const unpaidBookingList = matchedBookingList.filter(
635
+ (booking) => this.getBookingOrderPaymentStatus(booking) === "unpaid" || this.getBookingOrderPaymentStatus(booking) === "payment_processing"
636
+ );
639
637
  const bookings = this.pickBookingsForCurrentPoint(
640
638
  current,
641
639
  this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
@@ -1,8 +1,9 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
- import { BaseModule } from '../../modules/BaseModule';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
2
+ import { BaseSalesImpl } from '../BaseSales';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
4
4
  import type { UpdateOrderProductParams } from '../../modules/Order/types';
5
5
  import type { Discount } from '../../modules/Discount/types';
6
+ import { RequestPlugin, WindowPlugin } from '../../plugins';
6
7
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
7
8
  import type { StrategyConfig } from '../../model/strategy/type';
8
9
  import type { ProductData } from '../../modules/Product/types';
@@ -15,16 +16,16 @@ interface ScanOrderItemRuleRuntimeConfig {
15
16
  submissionIndex?: number;
16
17
  custom?: Record<string, any>;
17
18
  }
18
- export declare class ScanOrderImpl extends BaseModule implements Module {
19
+ export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
19
20
  protected defaultName: string;
20
21
  protected defaultVersion: string;
21
22
  isSolution: boolean;
22
- private initializeOptions;
23
- private store;
24
- private otherParams;
25
- private cacheId;
26
- private window;
27
- private request;
23
+ protected initializeOptions: ModuleOptions;
24
+ protected store: ScanOrderState;
25
+ protected otherParams: Record<string, any>;
26
+ protected cacheId: string | undefined;
27
+ window: WindowPlugin;
28
+ request: RequestPlugin;
28
29
  private itemRuleEvaluator;
29
30
  private itemRuleConfigs;
30
31
  private itemRuleConfigsPromise;
@@ -53,9 +54,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
53
54
  private registerCustomerLoginListeners;
54
55
  private refreshOrderMarketingAfterLogin;
55
56
  constructor(name?: string, version?: string);
57
+ protected getRegisteredModuleNames(): readonly string[];
58
+ protected createSubModule(moduleName: string): Module | null;
56
59
  /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
57
60
  getCacheId(): string | undefined;
58
- private destroyRegisteredChildModules;
59
61
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
60
62
  destroy(): Promise<void>;
61
63
  retryInit(): Promise<void>;
@@ -71,12 +73,14 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
71
73
  };
72
74
  getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
73
75
  updateTempOrderNote(note: string): string;
76
+ updateTempOrderNote(note: string, sync: true): Promise<string>;
77
+ updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
74
78
  setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
75
- service_type: 'dine_in';
79
+ service_type: 'dine_in' | '';
76
80
  pickup_reference_mode: 'counter_pickup' | 'table_service';
77
81
  };
78
82
  setPickupRef(buzzer: string): string;
79
- private ensureTempOrder;
83
+ private ensureScanOrderTempOrder;
80
84
  addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
81
85
  restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
82
86
  getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
@@ -92,7 +96,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
92
96
  }): Promise<void>;
93
97
  private findReservationRuleResource;
94
98
  private buildScanOrderResourceMetadata;
99
+ private prepareRetailAvailability;
95
100
  private buildSubmitPayloadEnhancer;
101
+ private isScanOrderMoreMode;
102
+ private submitScanOrderMore;
96
103
  submitScanOrder<T = any>(): Promise<T>;
97
104
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
98
105
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -117,8 +124,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
117
124
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
118
125
  private normalizeResourceState;
119
126
  private resolveResourceSelectType;
120
- private fetchResourceOccupyDetailByResourceId;
121
- checkResourceAvailable(resourceId: string, hasOrderId: boolean): Promise<ScanOrderAvailabilityInfo>;
127
+ private fetchResourceOccupyDetailsByResourceId;
128
+ private resolveAdditionalOrderFromOccupyDetail;
129
+ checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
130
+ restorePreviousOrderData(): Promise<void>;
122
131
  getAdditionalOrderInfo(): Promise<{
123
132
  orderId: string;
124
133
  orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
@@ -141,6 +150,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
141
150
  clearUIState(): void;
142
151
  setEntryPaxNumber(number: number): Promise<void>;
143
152
  getEntryPaxNumber(): number | null;
153
+ syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
154
+ getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
155
+ checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
144
156
  getFulfillmentModes(): {
145
157
  enablePickup: boolean;
146
158
  enableTableService: boolean;