@pisell/pisellos 2.3.39 → 2.3.41

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 (226) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +750 -509
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +7 -3
  72. package/dist/solution/BookingTicket/index.js +132 -49
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  77. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  78. package/dist/solution/Sales/index.d.ts +1 -0
  79. package/dist/solution/Sales/index.js +10 -2
  80. package/dist/solution/ScanOrder/index.d.ts +14 -26
  81. package/dist/solution/ScanOrder/index.js +756 -1148
  82. package/dist/solution/ScanOrder/types.d.ts +1 -21
  83. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  84. package/dist/solution/ScanOrder/utils.js +25 -66
  85. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  86. package/dist/solution/ShopDiscount/index.js +87 -125
  87. package/dist/solution/VenueBooking/index.d.ts +11 -39
  88. package/dist/solution/VenueBooking/index.js +860 -1176
  89. package/dist/solution/VenueBooking/types.d.ts +0 -3
  90. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  93. package/dist/solution/index.d.ts +0 -1
  94. package/dist/solution/index.js +1 -2
  95. package/dist/types/index.d.ts +1 -1
  96. package/dist/utils/payment-number.d.ts +9 -0
  97. package/dist/utils/payment-number.js +69 -0
  98. package/lib/core/index.d.ts +2 -0
  99. package/lib/core/index.js +4 -0
  100. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  101. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  102. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  103. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  104. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  105. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  106. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  107. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  108. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  109. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  110. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  111. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  112. package/lib/modules/Discount/index.d.ts +0 -1
  113. package/lib/modules/Discount/index.js +0 -9
  114. package/lib/modules/Discount/types.d.ts +0 -1
  115. package/lib/modules/OpenData/index.d.ts +2 -0
  116. package/lib/modules/OpenData/index.js +6 -1
  117. package/lib/modules/Order/index.d.ts +29 -12
  118. package/lib/modules/Order/index.js +196 -86
  119. package/lib/modules/Order/payment-utils.d.ts +26 -0
  120. package/lib/modules/Order/payment-utils.js +224 -0
  121. package/lib/modules/Order/types.d.ts +33 -10
  122. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  123. package/lib/modules/Order/utils.d.ts +0 -10
  124. package/lib/modules/Order/utils.js +16 -40
  125. package/lib/modules/Payment/index.d.ts +2 -0
  126. package/lib/modules/Payment/index.js +34 -13
  127. package/lib/modules/Payment/types.d.ts +99 -28
  128. package/lib/modules/Payment/types.js +4 -3
  129. package/lib/modules/Payment/walletpass.d.ts +25 -1
  130. package/lib/modules/Payment/walletpass.js +470 -21
  131. package/lib/modules/Product/types.d.ts +0 -1
  132. package/lib/modules/ProductList/index.js +31 -40
  133. package/lib/modules/Quotation/index.d.ts +1 -1
  134. package/lib/modules/Quotation/index.js +2 -2
  135. package/lib/modules/Rules/index.d.ts +1 -0
  136. package/lib/modules/Rules/index.js +47 -40
  137. package/lib/modules/SalesSummary/index.js +7 -6
  138. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  139. package/lib/modules/ScanOrderLogger/index.js +1 -13
  140. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  141. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  142. package/lib/modules/Schedule/index.d.ts +1 -3
  143. package/lib/modules/Schedule/index.js +8 -10
  144. package/lib/modules/Summary/utils.js +1 -21
  145. package/lib/modules/index.d.ts +0 -2
  146. package/lib/modules/index.js +1 -5
  147. package/lib/plugins/window.d.ts +0 -1
  148. package/lib/server/index.d.ts +16 -14
  149. package/lib/server/index.js +675 -83
  150. package/lib/server/modules/order/index.d.ts +54 -4
  151. package/lib/server/modules/order/index.js +679 -66
  152. package/lib/server/modules/order/types.d.ts +11 -3
  153. package/lib/solution/BaseSales/index.d.ts +109 -20
  154. package/lib/solution/BaseSales/index.js +883 -70
  155. package/lib/solution/BaseSales/types.d.ts +52 -0
  156. package/lib/solution/BaseSales/types.js +2 -1
  157. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  158. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  159. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  160. package/lib/solution/BookingByStep/index.d.ts +2 -17
  161. package/lib/solution/BookingByStep/index.js +18 -60
  162. package/lib/solution/BookingByStep/types.d.ts +1 -2
  163. package/lib/solution/BookingByStep/types.js +0 -5
  164. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  166. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  167. package/lib/solution/BookingTicket/index.d.ts +7 -3
  168. package/lib/solution/BookingTicket/index.js +62 -9
  169. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  170. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  171. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  172. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  173. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  174. package/lib/solution/Sales/index.d.ts +1 -0
  175. package/lib/solution/Sales/index.js +5 -3
  176. package/lib/solution/ScanOrder/index.d.ts +14 -26
  177. package/lib/solution/ScanOrder/index.js +190 -449
  178. package/lib/solution/ScanOrder/types.d.ts +1 -21
  179. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  180. package/lib/solution/ScanOrder/utils.js +0 -31
  181. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  182. package/lib/solution/ShopDiscount/index.js +0 -14
  183. package/lib/solution/VenueBooking/index.d.ts +11 -39
  184. package/lib/solution/VenueBooking/index.js +123 -328
  185. package/lib/solution/VenueBooking/types.d.ts +0 -3
  186. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  187. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  188. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  189. package/lib/solution/index.d.ts +0 -1
  190. package/lib/solution/index.js +1 -3
  191. package/lib/types/index.d.ts +1 -1
  192. package/lib/utils/payment-number.d.ts +9 -0
  193. package/lib/utils/payment-number.js +64 -0
  194. package/package.json +1 -1
  195. package/dist/modules/Holder/index.d.ts +0 -48
  196. package/dist/modules/Holder/index.js +0 -640
  197. package/dist/modules/Holder/types.d.ts +0 -123
  198. package/dist/modules/Holder/types.js +0 -1
  199. package/dist/modules/Holder/utils.d.ts +0 -13
  200. package/dist/modules/Holder/utils.js +0 -34
  201. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  202. package/dist/modules/ResourcePlanner/index.js +0 -181
  203. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  204. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  205. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  206. package/dist/modules/ResourcePlanner/types.js +0 -1
  207. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  208. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  209. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  210. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  211. package/lib/modules/Holder/index.d.ts +0 -48
  212. package/lib/modules/Holder/index.js +0 -402
  213. package/lib/modules/Holder/types.d.ts +0 -123
  214. package/lib/modules/Holder/types.js +0 -17
  215. package/lib/modules/Holder/utils.d.ts +0 -13
  216. package/lib/modules/Holder/utils.js +0 -71
  217. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  218. package/lib/modules/ResourcePlanner/index.js +0 -148
  219. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  220. package/lib/modules/ResourcePlanner/planner.js +0 -933
  221. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  222. package/lib/modules/ResourcePlanner/types.js +0 -17
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  224. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  225. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  226. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } 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;
@@ -16,7 +16,6 @@ export interface BookingByStepState {
16
16
  schedule: ScheduleModule;
17
17
  salesSummary?: SalesSummaryModule;
18
18
  scanOrderLogger?: ScanOrderLoggerModule;
19
- holder: HolderModule;
20
19
  }
21
20
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
22
21
  export declare enum BookingByStepHooks {
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } 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':
@@ -23,8 +23,6 @@ export function createModule(moduleName, solutionName, name, version) {
23
23
  return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
24
24
  case 'scanOrderLogger':
25
25
  return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
26
- case 'holder':
27
- return new HolderModule("".concat(solutionName, "_").concat(name || moduleName), version);
28
26
  default:
29
27
  throw new Error("Unknown module type: ".concat(moduleName));
30
28
  }
@@ -23,27 +23,11 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
23
23
  product_bundle = _ref.product_bundle;
24
24
  if ((capacity === null || capacity === void 0 ? void 0 : capacity.type) === 'package') {
25
25
  return (product_bundle || []).map(function (d) {
26
- var _window;
27
26
  var id = d.bundle_product_id;
28
27
  var variantId = d.bundle_variant_id;
29
28
  var item = ((capacity === null || capacity === void 0 ? void 0 : capacity.package) || []).find(function (item) {
30
- return item.product_id == id || item.product_id == variantId;
29
+ return item.product_id === id || item.product_id === variantId;
31
30
  });
32
- if (!item && (_window = window) !== null && _window !== void 0 && _window.sendWarningLog) {
33
- window.sendWarningLog({
34
- title: '未找到套餐 capacity 配置',
35
- content: [{
36
- key: 'product_id',
37
- value: id
38
- }, {
39
- key: 'variant_id',
40
- value: variantId
41
- }, {
42
- key: 'package',
43
- value: JSON.stringify((capacity === null || capacity === void 0 ? void 0 : capacity.package) || [])
44
- }]
45
- });
46
- }
47
31
  return {
48
32
  id: id,
49
33
  value: item ? d.num || 0 : 0,
@@ -19,12 +19,10 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
19
19
  * @param countMap 已预约数量映射
20
20
  * @returns 最快可用的资源
21
21
  */
22
- export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
22
+ export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
23
23
  resources: ResourceItem[];
24
24
  currentCapacity?: number;
25
25
  countMap?: Record<number, number>;
26
- targetDate?: string | Dayjs;
27
- durationMinutes?: number;
28
26
  }): ResourceItem | null;
29
27
  /**
30
28
  * 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
@@ -91,14 +91,8 @@ export function findFastestAvailableResource(_ref2) {
91
91
  _ref2$currentCapacity = _ref2.currentCapacity,
92
92
  currentCapacity = _ref2$currentCapacity === void 0 ? 1 : _ref2$currentCapacity,
93
93
  _ref2$countMap = _ref2.countMap,
94
- countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap,
95
- targetDate = _ref2.targetDate,
96
- _ref2$durationMinutes = _ref2.durationMinutes,
97
- durationMinutes = _ref2$durationMinutes === void 0 ? 30 : _ref2$durationMinutes;
94
+ countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap;
98
95
  var currentTime = dayjs();
99
- var resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
100
- var targetDay = targetDate ? dayjs(targetDate) : currentTime;
101
- var isTargetDayToday = targetDay.isSame(currentTime, 'day');
102
96
  var fastestTime = null;
103
97
  var fastestResources = [];
104
98
  console.log('[TimeslotUtils] 查找最快可用资源:', {
@@ -114,18 +108,17 @@ export function findFastestAvailableResource(_ref2) {
114
108
  try {
115
109
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
116
110
  var _resource = _step2.value;
117
- // 获取资源在目标日期且还在工作时间内的时间段
118
- var targetDayTimes = _resource.times.filter(function (time) {
119
- var isSameTargetDay = dayjs(time.start_at).isSame(targetDay, 'day');
120
- if (!isSameTargetDay) return false;
121
- if (!isTargetDayToday) return true;
122
- return dayjs(time.end_at).isAfter(currentTime);
111
+ // 获取资源当天且还在工作时间内的时间段
112
+ var todayTimes = _resource.times.filter(function (time) {
113
+ var isToday = dayjs(time.start_at).isSame(currentTime, 'day');
114
+ var isStillWorking = dayjs(time.end_at).isAfter(currentTime);
115
+ return isToday && isStillWorking;
123
116
  });
124
- if (targetDayTimes.length === 0) {
117
+ if (todayTimes.length === 0) {
125
118
  console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
126
119
  continue;
127
120
  }
128
- var _iterator4 = _createForOfIteratorHelper(targetDayTimes),
121
+ var _iterator4 = _createForOfIteratorHelper(todayTimes),
129
122
  _step4;
130
123
  try {
131
124
  var _loop = function _loop() {
@@ -135,7 +128,7 @@ export function findFastestAvailableResource(_ref2) {
135
128
  var workEndTime = dayjs(time.end_at);
136
129
 
137
130
  // 确定检查的起始时间(当前时间 vs 工作开始时间)
138
- var nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
131
+ var nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
139
132
  console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
140
133
  workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
141
134
  checkStartTime: nextAvailableTime.format('HH:mm:ss'),
@@ -172,7 +165,7 @@ export function findFastestAvailableResource(_ref2) {
172
165
  // 检查资源类型和容量
173
166
  if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
174
167
  // 单人预约资源:检查时间冲突
175
- if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
168
+ if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
176
169
  // 有冲突,使用事件结束时间
177
170
  finalAvailableTime = _eventEnd;
178
171
  console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
@@ -184,7 +177,7 @@ export function findFastestAvailableResource(_ref2) {
184
177
  var eventUsedCapacity = _event.pax || 1;
185
178
 
186
179
  // 如果在事件时间范围内,检查容量是否足够
187
- if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
180
+ if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
188
181
  var totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
189
182
  if (totalRequiredCapacity > totalCapacity) {
190
183
  // 容量不足,使用事件结束时间
@@ -201,7 +194,7 @@ export function findFastestAvailableResource(_ref2) {
201
194
  } finally {
202
195
  _iterator5.f();
203
196
  }
204
- if (finalAvailableTime.add(resolvedDuration, 'minute').isAfter(workEndTime)) {
197
+ if (finalAvailableTime.isAfter(workEndTime)) {
205
198
  console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
206
199
  return 0; // continue
207
200
  }
@@ -46,6 +46,8 @@ 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;
49
51
  private getShortNumberOrDeviceId;
50
52
  private configureIdGeneratorFromOpenData;
51
53
  private normalizePositiveInteger;
@@ -189,10 +191,12 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
189
191
  */
190
192
  getCustomer(): ICustomer | null;
191
193
  /**
192
- * 通过 ids 获取商品列表(不加载到模块中)
193
- * @returns 商品列表
194
+ * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
195
+ * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
194
196
  */
195
- getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
197
+ getProductByIds(ids: number[], options?: {
198
+ loadMissing?: boolean;
199
+ }): Promise<ProductData[]>;
196
200
  /**
197
201
  * 获取日程时间段点
198
202
  * @param params 参数
@@ -337,11 +337,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
337
337
  key: "getOpenData",
338
338
  value: function () {
339
339
  var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
340
- var _this$store$openData;
341
340
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
342
341
  while (1) switch (_context3.prev = _context3.next) {
343
342
  case 0:
344
- return _context3.abrupt("return", (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData());
343
+ return _context3.abrupt("return", this.loadOpenDataConfig());
345
344
  case 1:
346
345
  case "end":
347
346
  return _context3.stop();
@@ -352,7 +351,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
352
351
  return _getOpenData.apply(this, arguments);
353
352
  }
354
353
  return getOpenData;
355
- }()
354
+ }() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
355
+ }, {
356
+ key: "clearOpenDataCache",
357
+ value: function clearOpenDataCache() {
358
+ var _this$store$openData;
359
+ this.loadOpenDataConfigInFlight = null;
360
+ this.otherParams.openData = null;
361
+ (_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
362
+ }
356
363
  }, {
357
364
  key: "getShortNumberOrDeviceId",
358
365
  value: function () {
@@ -397,49 +404,52 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
397
404
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
398
405
  while (1) switch (_context5.prev = _context5.next) {
399
406
  case 0:
407
+ // 业务码切换或配置失败时不能复用上一次初始化的短号。
408
+ this.setPaymentNumberDevicePrefix(null);
400
409
  openDataConfig = null;
401
- _context5.prev = 1;
402
- _context5.next = 4;
410
+ _context5.prev = 2;
411
+ _context5.next = 5;
403
412
  return this.loadOpenDataConfig();
404
- case 4:
413
+ case 5:
405
414
  openDataConfig = _context5.sent;
406
- _context5.next = 11;
415
+ _context5.next = 12;
407
416
  break;
408
- case 7:
409
- _context5.prev = 7;
410
- _context5.t0 = _context5["catch"](1);
417
+ case 8:
418
+ _context5.prev = 8;
419
+ _context5.t0 = _context5["catch"](2);
411
420
  console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
412
421
  return _context5.abrupt("return");
413
- case 11:
422
+ case 12:
414
423
  // if (!openDataConfig) return;
415
424
  idGenerator = this.getIdGeneratorPlugin();
416
425
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
417
- _context5.next = 15;
426
+ _context5.next = 16;
418
427
  break;
419
428
  }
420
429
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
421
430
  return _context5.abrupt("return");
422
- case 15:
431
+ case 16:
423
432
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
424
433
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
425
434
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
426
435
  shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
427
436
  resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
428
437
  operatingDayBoundary = this.getAppData('operating_day_boundary');
429
- _context5.next = 23;
438
+ _context5.next = 24;
430
439
  return this.getShortNumberOrDeviceId();
431
- case 23:
440
+ case 24:
432
441
  deviceId = _context5.sent;
442
+ this.setPaymentNumberDevicePrefix(deviceId);
433
443
  businessCode = this.getBookingTicketBusinessCode();
434
444
  if (businessCode) {
435
- _context5.next = 28;
445
+ _context5.next = 30;
436
446
  break;
437
447
  }
438
448
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
439
449
  return _context5.abrupt("return");
440
- case 28:
441
- _context5.prev = 28;
442
- _context5.next = 31;
450
+ case 30:
451
+ _context5.prev = 30;
452
+ _context5.next = 33;
443
453
  return idGenerator.configure({
444
454
  biz: businessCode,
445
455
  config: {
@@ -454,18 +464,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
454
464
  shopOrderPrefix: shopOrderPrefix
455
465
  }
456
466
  });
457
- case 31:
458
- _context5.next = 36;
459
- break;
460
467
  case 33:
461
- _context5.prev = 33;
462
- _context5.t1 = _context5["catch"](28);
468
+ _context5.next = 38;
469
+ break;
470
+ case 35:
471
+ _context5.prev = 35;
472
+ _context5.t1 = _context5["catch"](30);
463
473
  console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
464
- case 36:
474
+ case 38:
465
475
  case "end":
466
476
  return _context5.stop();
467
477
  }
468
- }, _callee5, this, [[1, 7], [28, 33]]);
478
+ }, _callee5, this, [[2, 8], [30, 35]]);
469
479
  }));
470
480
  function configureIdGeneratorFromOpenData() {
471
481
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -1260,24 +1270,88 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1260
1270
  }
1261
1271
 
1262
1272
  /**
1263
- * 通过 ids 获取商品列表(不加载到模块中)
1264
- * @returns 商品列表
1273
+ * 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
1274
+ * 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
1265
1275
  */
1266
1276
  }, {
1267
1277
  key: "getProductByIds",
1268
1278
  value: (function () {
1269
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
1279
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids, options) {
1280
+ var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1281
+ var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1270
1282
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1271
1283
  while (1) switch (_context18.prev = _context18.next) {
1272
1284
  case 0:
1273
- return _context18.abrupt("return", this.store.products.getProductByIds(ids));
1274
- case 1:
1285
+ normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1286
+ return Number(id);
1287
+ }).filter(function (id) {
1288
+ return Number.isFinite(id);
1289
+ })));
1290
+ _context18.next = 3;
1291
+ return this.store.products.getProductByIds(normalizedIds);
1292
+ case 3:
1293
+ _context18.t0 = _context18.sent;
1294
+ if (_context18.t0) {
1295
+ _context18.next = 6;
1296
+ break;
1297
+ }
1298
+ _context18.t0 = [];
1299
+ case 6:
1300
+ localProducts = _context18.t0;
1301
+ if (options !== null && options !== void 0 && options.loadMissing) {
1302
+ _context18.next = 9;
1303
+ break;
1304
+ }
1305
+ return _context18.abrupt("return", localProducts);
1306
+ case 9:
1307
+ localProductIds = new Set(localProducts.map(function (product) {
1308
+ return Number(product.id);
1309
+ }));
1310
+ missingIds = normalizedIds.filter(function (id) {
1311
+ return !localProductIds.has(id);
1312
+ });
1313
+ if (missingIds.length) {
1314
+ _context18.next = 13;
1315
+ break;
1316
+ }
1317
+ return _context18.abrupt("return", localProducts);
1318
+ case 13:
1319
+ rawBookingDate = this.getBookingDate();
1320
+ bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1321
+ customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1322
+ _context18.next = 18;
1323
+ return this.store.products.loadProducts(_objectSpread(_objectSpread({
1324
+ product_ids: missingIds,
1325
+ with_count: ['bundleGroup', 'optionGroup'],
1326
+ with_schedule: 1,
1327
+ cacheId: this.cacheId
1328
+ }, bookingDate ? {
1329
+ schedule_date: bookingDate.format('YYYY-MM-DD'),
1330
+ schedule_datetime: bookingDate.format('YYYY-MM-DD HH:mm:ss')
1331
+ } : {}), Number.isFinite(customerId) && customerId > 0 ? {
1332
+ customer_id: customerId
1333
+ } : {}));
1334
+ case 18:
1335
+ loadedProducts = _context18.sent;
1336
+ productById = new Map();
1337
+ [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1338
+ var productId = Number(product.id);
1339
+ if (Number.isFinite(productId)) {
1340
+ productById.set(productId, product);
1341
+ }
1342
+ });
1343
+ return _context18.abrupt("return", normalizedIds.map(function (id) {
1344
+ return productById.get(id);
1345
+ }).filter(function (product) {
1346
+ return Boolean(product);
1347
+ }));
1348
+ case 22:
1275
1349
  case "end":
1276
1350
  return _context18.stop();
1277
1351
  }
1278
1352
  }, _callee18, this);
1279
1353
  }));
1280
- function getProductByIds(_x13) {
1354
+ function getProductByIds(_x13, _x14) {
1281
1355
  return _getProductByIds.apply(this, arguments);
1282
1356
  }
1283
1357
  return getProductByIds;
@@ -1311,7 +1385,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1311
1385
  }
1312
1386
  }, _callee19, this);
1313
1387
  }));
1314
- function getScheduleTimePoints(_x14) {
1388
+ function getScheduleTimePoints(_x15) {
1315
1389
  return _getScheduleTimePoints.apply(this, arguments);
1316
1390
  }
1317
1391
  return getScheduleTimePoints;
@@ -1701,7 +1775,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1701
1775
  }
1702
1776
  }, _callee23, this, [[0, 7]]);
1703
1777
  }));
1704
- function changeCustomerPage(_x15, _x16) {
1778
+ function changeCustomerPage(_x16, _x17) {
1705
1779
  return _changeCustomerPage.apply(this, arguments);
1706
1780
  }
1707
1781
  return changeCustomerPage;
@@ -1993,7 +2067,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1993
2067
  }, {
1994
2068
  key: "getBookingConfig",
1995
2069
  value: function getBookingConfig() {
1996
- return this.store.bookingContext.getBookingConfig();
2070
+ var _this$store$bookingCo;
2071
+ return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
1997
2072
  }
1998
2073
 
1999
2074
  /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
@@ -2154,10 +2229,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2154
2229
  }, {
2155
2230
  key: "buildAddProductCtx",
2156
2231
  value: function buildAddProductCtx(extra) {
2157
- var _extra$date2, _ref12, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
2232
+ var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
2158
2233
  var bookingContextState = this.store.bookingContext.getState();
2159
2234
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2160
- var orderCustomerId = (_ref12 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2235
+ var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
2161
2236
  return _objectSpread({
2162
2237
  bookingConfig: bookingContextState.bookingConfig,
2163
2238
  resourcesOrigin: bookingContextState.resourcesOrigin,
@@ -2274,7 +2349,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2274
2349
  }
2275
2350
  }, _callee27, this);
2276
2351
  }));
2277
- function updateProductInOrder(_x17) {
2352
+ function updateProductInOrder(_x18) {
2278
2353
  return _updateProductInOrder.apply(this, arguments);
2279
2354
  }
2280
2355
  return updateProductInOrder;
@@ -2362,6 +2437,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2362
2437
  },
2363
2438
  addProductToOrder: function addProductToOrder(product, booking) {
2364
2439
  return _this6.addProductToOrder(product, booking);
2440
+ },
2441
+ refreshWalletAssets: function refreshWalletAssets(params) {
2442
+ return _this6.refreshWalletAssets(params);
2443
+ },
2444
+ scanWalletAsset: function scanWalletAsset(scanCode) {
2445
+ return _this6.scanWalletAsset(scanCode);
2365
2446
  }
2366
2447
  }, formatted, bridge);
2367
2448
  case 16:
@@ -2383,7 +2464,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2383
2464
  }
2384
2465
  }, _callee28, this, [[4, 21]]);
2385
2466
  }));
2386
- function handleGlobalScanCode(_x18, _x19) {
2467
+ function handleGlobalScanCode(_x19, _x20) {
2387
2468
  return _handleGlobalScanCode.apply(this, arguments);
2388
2469
  }
2389
2470
  return handleGlobalScanCode;
@@ -2481,7 +2562,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2481
2562
  }
2482
2563
  }, _callee29, this);
2483
2564
  }));
2484
- function addAddTimeProductToBooking(_x20) {
2565
+ function addAddTimeProductToBooking(_x21) {
2485
2566
  return _addAddTimeProductToBooking.apply(this, arguments);
2486
2567
  }
2487
2568
  return addAddTimeProductToBooking;
@@ -2584,7 +2665,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2584
2665
  }
2585
2666
  }, _callee30, this, [[13, 31, 34, 37]]);
2586
2667
  }));
2587
- function addAddTimeProductsToBooking(_x21) {
2668
+ function addAddTimeProductsToBooking(_x22) {
2588
2669
  return _addAddTimeProductsToBooking.apply(this, arguments);
2589
2670
  }
2590
2671
  return addAddTimeProductsToBooking;
@@ -2601,22 +2682,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2601
2682
  while (1) switch (_context31.prev = _context31.next) {
2602
2683
  case 0:
2603
2684
  _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2604
- _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2685
+ _context31.next = 3;
2686
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2605
2687
  cover: cover
2606
2688
  });
2607
- if (!(params !== null && params !== void 0 && params.businessCode)) {
2608
- _context31.next = 5;
2689
+ case 3:
2690
+ if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2691
+ _context31.next = 6;
2609
2692
  break;
2610
2693
  }
2611
- _context31.next = 5;
2694
+ _context31.next = 6;
2612
2695
  return this.configureIdGeneratorFromOpenData();
2613
- case 5:
2696
+ case 6:
2614
2697
  case "end":
2615
2698
  return _context31.stop();
2616
2699
  }
2617
2700
  }, _callee31, this);
2618
2701
  }));
2619
- function setOtherParams(_x22) {
2702
+ function setOtherParams(_x23) {
2620
2703
  return _setOtherParams.apply(this, arguments);
2621
2704
  }
2622
2705
  return setOtherParams;
@@ -2687,7 +2770,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2687
2770
  }
2688
2771
  }, _callee32, this);
2689
2772
  }));
2690
- function handlePrintWristband(_x23) {
2773
+ function handlePrintWristband(_x24) {
2691
2774
  return _handlePrintWristband.apply(this, arguments);
2692
2775
  }
2693
2776
  return handlePrintWristband;
@@ -2762,7 +2845,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2762
2845
  }
2763
2846
  }, _callee33, this);
2764
2847
  }));
2765
- function handleRedeem(_x24) {
2848
+ function handleRedeem(_x25) {
2766
2849
  return _handleRedeem.apply(this, arguments);
2767
2850
  }
2768
2851
  return handleRedeem;
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import dayjs from 'dayjs';
8
8
  import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
9
9
  import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
10
+ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
10
11
 
11
12
  /**
12
13
  * cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
@@ -322,11 +323,16 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
322
323
  var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
323
324
  var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
324
325
  var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
326
+ var productSku = buildProductSkuFromCacheItem(cacheItem);
325
327
  return {
326
328
  id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
327
329
  product_id: resolvedPid,
328
330
  variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
329
331
  quantity: quantity,
332
+ // 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
333
+ product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
334
+ option: (other === null || other === void 0 ? void 0 : other.option) || []
335
+ }) : undefined,
330
336
  option: (other === null || other === void 0 ? void 0 : other.option) || [],
331
337
  bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
332
338
  unique: other === null || other === void 0 ? void 0 : other.unique,
@@ -24,6 +24,14 @@ 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
+ }>;
27
35
  }
28
36
  /**
29
37
  * 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。