@pisell/pisellos 2.1.149 → 2.1.151

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 (197) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
  4. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  5. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  6. package/dist/model/strategy/adapter/walletPass/evaluator.js +61 -8
  7. package/dist/model/strategy/adapter/walletPass/locales.js +12 -3
  8. package/dist/model/strategy/engine.d.ts +18 -5
  9. package/dist/model/strategy/engine.js +145 -45
  10. package/dist/model/strategy/type.d.ts +17 -0
  11. package/dist/model/strategy/type.js +4 -0
  12. package/dist/modules/Cart/types.d.ts +2 -0
  13. package/dist/modules/Cart/utils/cartProduct.js +56 -25
  14. package/dist/modules/Discount/types.d.ts +19 -1
  15. package/dist/modules/Order/index.d.ts +1 -65
  16. package/dist/modules/Order/index.js +30 -899
  17. package/dist/modules/Order/types.d.ts +12 -174
  18. package/dist/modules/Order/types.js +0 -2
  19. package/dist/modules/Order/utils.d.ts +0 -118
  20. package/dist/modules/Order/utils.js +2 -586
  21. package/dist/modules/Payment/index.d.ts +2 -1
  22. package/dist/modules/Payment/index.js +10 -7
  23. package/dist/modules/Payment/utils.js +3 -0
  24. package/dist/modules/Payment/walletpass.d.ts +23 -0
  25. package/dist/modules/Payment/walletpass.js +191 -95
  26. package/dist/modules/Product/utils.js +2 -2
  27. package/dist/modules/ProductList/index.d.ts +1 -1
  28. package/dist/modules/ProductList/index.js +3 -4
  29. package/dist/modules/Rules/index.d.ts +9 -5
  30. package/dist/modules/Rules/index.js +677 -168
  31. package/dist/modules/Rules/types.d.ts +2 -0
  32. package/dist/modules/Schedule/getDateIsInSchedule.js +18 -11
  33. package/dist/modules/Schedule/utils.d.ts +1 -1
  34. package/dist/modules/Summary/types.d.ts +2 -0
  35. package/dist/modules/Summary/utils.d.ts +9 -3
  36. package/dist/modules/Summary/utils.js +52 -41
  37. package/dist/modules/index.d.ts +0 -4
  38. package/dist/modules/index.js +1 -5
  39. package/dist/plugins/window.d.ts +2 -0
  40. package/dist/solution/BookingByStep/index.d.ts +3 -2
  41. package/dist/solution/BookingByStep/index.js +43 -46
  42. package/dist/solution/BookingByStep/types.d.ts +1 -3
  43. package/dist/solution/BookingByStep/types.js +1 -5
  44. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  45. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  46. package/dist/solution/Checkout/index.js +2 -0
  47. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  48. package/dist/solution/ShopDiscount/index.js +23 -7
  49. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  50. package/dist/solution/ShopDiscount/types.js +2 -1
  51. package/dist/solution/ShopDiscount/utils.js +26 -12
  52. package/dist/solution/index.d.ts +0 -2
  53. package/dist/solution/index.js +1 -3
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +3 -1
  56. package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
  57. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  58. package/lib/model/strategy/adapter/walletPass/evaluator.js +34 -3
  59. package/lib/model/strategy/adapter/walletPass/locales.js +12 -3
  60. package/lib/model/strategy/engine.d.ts +18 -5
  61. package/lib/model/strategy/engine.js +85 -21
  62. package/lib/model/strategy/type.d.ts +17 -0
  63. package/lib/modules/Cart/types.d.ts +2 -0
  64. package/lib/modules/Cart/utils/cartProduct.js +39 -12
  65. package/lib/modules/Discount/types.d.ts +19 -1
  66. package/lib/modules/Order/index.d.ts +1 -65
  67. package/lib/modules/Order/index.js +1 -513
  68. package/lib/modules/Order/types.d.ts +12 -174
  69. package/lib/modules/Order/utils.d.ts +0 -118
  70. package/lib/modules/Order/utils.js +2 -483
  71. package/lib/modules/Payment/index.d.ts +2 -1
  72. package/lib/modules/Payment/index.js +1 -0
  73. package/lib/modules/Payment/utils.js +3 -0
  74. package/lib/modules/Payment/walletpass.d.ts +23 -0
  75. package/lib/modules/Payment/walletpass.js +94 -17
  76. package/lib/modules/Product/utils.js +2 -2
  77. package/lib/modules/ProductList/index.d.ts +1 -1
  78. package/lib/modules/ProductList/index.js +3 -5
  79. package/lib/modules/Rules/index.d.ts +9 -5
  80. package/lib/modules/Rules/index.js +780 -288
  81. package/lib/modules/Rules/types.d.ts +2 -0
  82. package/lib/modules/Schedule/getDateIsInSchedule.js +11 -9
  83. package/lib/modules/Schedule/utils.d.ts +1 -1
  84. package/lib/modules/Summary/types.d.ts +2 -0
  85. package/lib/modules/Summary/utils.d.ts +9 -3
  86. package/lib/modules/Summary/utils.js +31 -22
  87. package/lib/modules/index.d.ts +0 -4
  88. package/lib/modules/index.js +1 -9
  89. package/lib/plugins/window.d.ts +2 -0
  90. package/lib/solution/BookingByStep/index.d.ts +3 -2
  91. package/lib/solution/BookingByStep/index.js +4 -6
  92. package/lib/solution/BookingByStep/types.d.ts +1 -3
  93. package/lib/solution/BookingByStep/types.js +0 -10
  94. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  95. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  96. package/lib/solution/Checkout/index.js +2 -0
  97. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  98. package/lib/solution/ShopDiscount/index.js +22 -8
  99. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  100. package/lib/solution/ShopDiscount/utils.js +10 -6
  101. package/lib/solution/index.d.ts +0 -2
  102. package/lib/solution/index.js +1 -5
  103. package/package.json +1 -1
  104. package/dist/apis/picoding.d.ts +0 -0
  105. package/dist/apis/picoding.js +0 -1
  106. package/dist/modules/OpenData/index.d.ts +0 -24
  107. package/dist/modules/OpenData/index.js +0 -173
  108. package/dist/modules/OpenData/types.d.ts +0 -73
  109. package/dist/modules/OpenData/types.js +0 -1
  110. package/dist/modules/OpenData/utils.d.ts +0 -2
  111. package/dist/modules/OpenData/utils.js +0 -75
  112. package/dist/modules/Quotation/index.d.ts +0 -48
  113. package/dist/modules/Quotation/index.js +0 -248
  114. package/dist/modules/Quotation/types.d.ts +0 -42
  115. package/dist/modules/Quotation/types.js +0 -1
  116. package/dist/modules/SalesSummary/index.d.ts +0 -63
  117. package/dist/modules/SalesSummary/index.js +0 -174
  118. package/dist/modules/SalesSummary/types.d.ts +0 -60
  119. package/dist/modules/SalesSummary/types.js +0 -1
  120. package/dist/modules/SalesSummary/utils.d.ts +0 -30
  121. package/dist/modules/SalesSummary/utils.js +0 -480
  122. package/dist/modules/ScanOrderLogger/index.d.ts +0 -23
  123. package/dist/modules/ScanOrderLogger/index.js +0 -174
  124. package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  125. package/dist/modules/ScanOrderLogger/providers/feishu.js +0 -221
  126. package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  127. package/dist/modules/ScanOrderLogger/providers/grafana.js +0 -50
  128. package/dist/modules/ScanOrderLogger/types.d.ts +0 -53
  129. package/dist/modules/ScanOrderLogger/types.js +0 -1
  130. package/dist/solution/ScanOrder/index.d.ts +0 -152
  131. package/dist/solution/ScanOrder/index.js +0 -3132
  132. package/dist/solution/ScanOrder/types.d.ts +0 -287
  133. package/dist/solution/ScanOrder/types.js +0 -35
  134. package/dist/solution/ScanOrder/utils.d.ts +0 -167
  135. package/dist/solution/ScanOrder/utils.js +0 -764
  136. package/dist/solution/VenueBooking/index.d.ts +0 -199
  137. package/dist/solution/VenueBooking/index.js +0 -3459
  138. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  139. package/dist/solution/VenueBooking/types.d.ts +0 -154
  140. package/dist/solution/VenueBooking/types.js +0 -21
  141. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  142. package/dist/solution/VenueBooking/utils/dateSummary.js +0 -104
  143. package/dist/solution/VenueBooking/utils/resource.d.ts +0 -14
  144. package/dist/solution/VenueBooking/utils/resource.js +0 -131
  145. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
  146. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -239
  147. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
  148. package/dist/solution/VenueBooking/utils/timeSlot.js +0 -453
  149. package/dist/solution/VenueBooking/utils.d.ts +0 -1
  150. package/dist/solution/VenueBooking/utils.js +0 -1
  151. package/lib/apis/picoding.d.ts +0 -0
  152. package/lib/apis/picoding.js +0 -0
  153. package/lib/modules/OpenData/index.d.ts +0 -24
  154. package/lib/modules/OpenData/index.js +0 -119
  155. package/lib/modules/OpenData/types.d.ts +0 -73
  156. package/lib/modules/OpenData/types.js +0 -17
  157. package/lib/modules/OpenData/utils.d.ts +0 -2
  158. package/lib/modules/OpenData/utils.js +0 -111
  159. package/lib/modules/Quotation/index.d.ts +0 -48
  160. package/lib/modules/Quotation/index.js +0 -152
  161. package/lib/modules/Quotation/types.d.ts +0 -42
  162. package/lib/modules/Quotation/types.js +0 -17
  163. package/lib/modules/SalesSummary/index.d.ts +0 -63
  164. package/lib/modules/SalesSummary/index.js +0 -105
  165. package/lib/modules/SalesSummary/types.d.ts +0 -60
  166. package/lib/modules/SalesSummary/types.js +0 -17
  167. package/lib/modules/SalesSummary/utils.d.ts +0 -30
  168. package/lib/modules/SalesSummary/utils.js +0 -420
  169. package/lib/modules/ScanOrderLogger/index.d.ts +0 -23
  170. package/lib/modules/ScanOrderLogger/index.js +0 -147
  171. package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +0 -2
  172. package/lib/modules/ScanOrderLogger/providers/feishu.js +0 -157
  173. package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +0 -2
  174. package/lib/modules/ScanOrderLogger/providers/grafana.js +0 -52
  175. package/lib/modules/ScanOrderLogger/types.d.ts +0 -53
  176. package/lib/modules/ScanOrderLogger/types.js +0 -17
  177. package/lib/solution/ScanOrder/index.d.ts +0 -152
  178. package/lib/solution/ScanOrder/index.js +0 -1901
  179. package/lib/solution/ScanOrder/types.d.ts +0 -287
  180. package/lib/solution/ScanOrder/types.js +0 -36
  181. package/lib/solution/ScanOrder/utils.d.ts +0 -167
  182. package/lib/solution/ScanOrder/utils.js +0 -635
  183. package/lib/solution/VenueBooking/index.d.ts +0 -199
  184. package/lib/solution/VenueBooking/index.js +0 -1926
  185. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -343
  186. package/lib/solution/VenueBooking/types.d.ts +0 -154
  187. package/lib/solution/VenueBooking/types.js +0 -44
  188. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +0 -11
  189. package/lib/solution/VenueBooking/utils/dateSummary.js +0 -110
  190. package/lib/solution/VenueBooking/utils/resource.d.ts +0 -14
  191. package/lib/solution/VenueBooking/utils/resource.js +0 -92
  192. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -38
  193. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -237
  194. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -32
  195. package/lib/solution/VenueBooking/utils/timeSlot.js +0 -339
  196. package/lib/solution/VenueBooking/utils.d.ts +0 -1
  197. package/lib/solution/VenueBooking/utils.js +0 -69
@@ -28,6 +28,7 @@ export interface RulesModuleAPI {
28
28
  calcDiscount: (params: {
29
29
  discountList: any[];
30
30
  productList: any[];
31
+ orderTotalAmount: number;
31
32
  holders: {
32
33
  form_record_id: number;
33
34
  }[];
@@ -66,6 +67,7 @@ export interface RulesParamsHooks {
66
67
  quantity?: number;
67
68
  bundle?: any[];
68
69
  main_product_selling_price?: string | number;
70
+ options?: any[];
69
71
  }) => Record<string, any>;
70
72
  }
71
73
  export {};
@@ -70,7 +70,7 @@ var isInStandardSchedule = (targetDate, targetDateString, targetTimeString, sche
70
70
  }
71
71
  const startDate = (0, import_dayjs.default)(schedule.start_time);
72
72
  const endDate = (0, import_dayjs.default)(schedule.end_time);
73
- const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate);
73
+ const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate);
74
74
  if (schedule.repeat_type === "none") {
75
75
  return isInBasicRange;
76
76
  }
@@ -80,14 +80,16 @@ var isInTimeSlotsSchedule = (targetDate, targetDateString, targetTimeString, sch
80
80
  if (!schedule.start_time) {
81
81
  return false;
82
82
  }
83
- const scheduleStartDate = (0, import_dayjs.default)(schedule.start_time.split(" ")[0]);
84
- if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
83
+ const scheduleDate = schedule.start_time.split(" ")[0];
84
+ if (targetDateString !== scheduleDate) {
85
85
  return false;
86
86
  }
87
87
  for (const timeSlot of schedule.time_slot) {
88
- const slotStart = (0, import_dayjs.default)(`${targetDateString} ${timeSlot.start_time}:00`);
89
- const slotEnd = (0, import_dayjs.default)(`${targetDateString} ${timeSlot.end_time}:00`);
90
- if (targetDate.isSameOrAfter(slotStart) && targetDate.isBefore(slotEnd)) {
88
+ const slotStart = `${scheduleDate} ${timeSlot.start_time}:00`;
89
+ const slotEnd = `${scheduleDate} ${timeSlot.end_time}:00`;
90
+ const slotStartDate = (0, import_dayjs.default)(slotStart);
91
+ const slotEndDate = (0, import_dayjs.default)(slotEnd);
92
+ if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
91
93
  return true;
92
94
  }
93
95
  }
@@ -102,7 +104,7 @@ var isInDesignationSchedule = (targetDate, targetDateString, targetTimeString, s
102
104
  const endDateTime = `${designation.end_date} ${designation.end_time}:00`;
103
105
  const startDate = (0, import_dayjs.default)(startDateTime);
104
106
  const endDate = (0, import_dayjs.default)(endDateTime);
105
- if (targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate)) {
107
+ if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
106
108
  return true;
107
109
  }
108
110
  }
@@ -156,7 +158,7 @@ var isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
156
158
  const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
157
159
  const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
158
160
  const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
159
- return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
161
+ return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
160
162
  };
161
163
  var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
162
164
  const targetDayOfWeek = targetDate.day();
@@ -173,7 +175,7 @@ var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
173
175
  const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
174
176
  const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
175
177
  const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
176
- return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
178
+ return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
177
179
  };
178
180
  var getScheduleStartEndTimePoints = (date, scheduleList) => {
179
181
  if (!date || !scheduleList || scheduleList.length === 0) {
@@ -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) => ScheduleAllMap;
49
+ export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => {};
50
50
  /**
51
51
  * @title: 格式化日程数据
52
52
  * @description:
@@ -6,6 +6,8 @@ export interface ISummaryState {
6
6
  subtotal: string | number;
7
7
  /** 最终总价 */
8
8
  total: string | number;
9
+ /** 最终原始价格 不包含折扣卡商品券折扣 */
10
+ originTotal: string | number;
9
11
  /** 税率标题 */
10
12
  taxTitle?: string;
11
13
  /** 商品总费率 */
@@ -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[]) => number;
11
- export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => number;
10
+ export declare const calcDiscountListDifference: (discountList: any[]) => any;
11
+ export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => any;
12
12
  /**
13
13
  * 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
14
14
  *
@@ -58,6 +58,12 @@ export declare const getTax: ({ service, addons, bookingDetail, bookingId }: {
58
58
  * @returns 商品总价字符串,保留2位小数
59
59
  */
60
60
  export declare const calculateSubtotal: (items: CartItem[]) => string;
61
+ /**
62
+ * 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
63
+ * @param items - 购物车商品数组
64
+ * @returns 商品总价字符串,保留2位小数
65
+ */
66
+ export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
61
67
  /**
62
68
  * @title: 单个商品的税费
63
69
  * @description:
@@ -94,7 +100,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
94
100
  export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
95
101
  bookingDetail?: any;
96
102
  bookingId?: number | undefined;
97
- }, surcharge: any[], options: any) => number;
103
+ }, surcharge: any[], options: any) => any;
98
104
  /**
99
105
  * 订单附加费各项信息
100
106
  *
@@ -31,6 +31,7 @@ var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  calcDiscountListDifference: () => calcDiscountListDifference,
33
33
  calculateDeposit: () => calculateDeposit,
34
+ calculateOriginSubtotal: () => calculateOriginSubtotal,
34
35
  calculatePriceDetails: () => calculatePriceDetails,
35
36
  calculateSubtotal: () => calculateSubtotal,
36
37
  calculateTaxFee: () => calculateTaxFee,
@@ -46,6 +47,7 @@ var import_utils = require("../Product/utils");
46
47
  var import_dayjs = __toESM(require("dayjs"));
47
48
  var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) => {
48
49
  const subtotal = new import_decimal.default(calculateSubtotal(items));
50
+ const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
49
51
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
50
52
  const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById });
51
53
  const surchargeAmount = new import_decimal.default(getSurchargeAmount({ bookingDetail: null, bookingId: void 0 }, surcharge, { isEdit: false }));
@@ -59,10 +61,12 @@ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList,
59
61
  is_price_include_tax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
60
62
  });
61
63
  const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
64
+ const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
62
65
  const deposit = calculateDeposit(items);
63
66
  return {
64
67
  subtotal: subtotal.toFixed(2),
65
68
  total: total.toFixed(2),
69
+ originTotal: originTotal.toFixed(2),
66
70
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
67
71
  taxRate: shopInfo == null ? void 0 : shopInfo.tax_rate,
68
72
  totalTaxFee: tax,
@@ -87,8 +91,8 @@ var getBundleDiscountList = (bundle) => {
87
91
  var calcDiscountListDifference = (discountList) => {
88
92
  return discountList.reduce((pre, cur) => {
89
93
  var _a;
90
- return pre.plus(((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
91
- }, new import_decimal.default(0)).toNumber();
94
+ return pre + (((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
95
+ }, 0);
92
96
  };
93
97
  var getProductDiscountProductDiscountDifference = (item) => {
94
98
  var _a, _b, _c, _d;
@@ -360,6 +364,16 @@ var calculateSubtotal = (items) => {
360
364
  }, new import_decimal.default(0));
361
365
  return subtotal.toFixed(2);
362
366
  };
367
+ var calculateOriginSubtotal = (items) => {
368
+ if (!(items == null ? void 0 : items.length)) {
369
+ return "0.00";
370
+ }
371
+ const subtotal = items.reduce((sum, item) => {
372
+ const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
373
+ return sum.plus(cartItemTotalPrice);
374
+ }, new import_decimal.default(0));
375
+ return subtotal.toFixed(2);
376
+ };
363
377
  var calculateTaxFee = (shopInfo, items) => {
364
378
  if (!(items == null ? void 0 : items.length)) {
365
379
  return "0.00";
@@ -408,8 +422,8 @@ var getSurchargeAmount = ({ bookingDetail, bookingId }, surcharge, options) => {
408
422
  if (!Array.isArray(surcharge))
409
423
  return 0;
410
424
  return surcharge.reduce((total, item) => {
411
- return total.plus(item.value || 0);
412
- }, new import_decimal.default(0)).toNumber();
425
+ return total + (item.value || 0);
426
+ }, 0);
413
427
  };
414
428
  var getBundleItemIsOriginalPrice = (item) => {
415
429
  return (item == null ? void 0 : item.price_type) === "markup" && (item == null ? void 0 : item.price_type_ext) === "product_price";
@@ -429,24 +443,18 @@ var getDiscountAmount = (discounts) => {
429
443
  }, new import_decimal.default(0)).toNumber();
430
444
  };
431
445
  var getMainProductTotal = (item) => {
432
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
433
- let total = new import_decimal.default(
434
- (item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_original_price) ?? 0
435
- );
436
- const hasMainProductPrice = (item == null ? void 0 : item.main_product_selling_price) != null || ((_c = item == null ? void 0 : item.metadata) == null ? void 0 : _c.main_product_selling_price) != null || ((_d = item == null ? void 0 : item.metadata) == null ? void 0 : _d.main_product_original_price) != null;
437
- if (!hasMainProductPrice) {
438
- total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_e = item == null ? void 0 : item.metadata) == null ? void 0 : _e.main_product_selling_price) ?? item.price ?? 0);
439
- const discount = ((_g = (_f = item == null ? void 0 : item._origin) == null ? void 0 : _f.product) == null ? void 0 : _g.discount_list) || ((_j = (_i = (_h = item == null ? void 0 : item._originData) == null ? void 0 : _h.product) == null ? void 0 : _i.discount_list) == null ? void 0 : _j.filter((item2) => {
440
- var _a2;
441
- return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
442
- })) || [];
443
- const mainProductDiscountAmount = getDiscountAmount(discount);
444
- total = total.minus(mainProductDiscountAmount);
445
- if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
446
- total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
447
- return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
448
- }, new import_decimal.default(0)));
449
- }
446
+ var _a, _b, _c, _d, _e, _f;
447
+ let total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? item.price ?? 0);
448
+ const discount = ((_c = (_b = item == null ? void 0 : item._origin) == null ? void 0 : _b.product) == null ? void 0 : _c.discount_list) || ((_f = (_e = (_d = item == null ? void 0 : item._originData) == null ? void 0 : _d.product) == null ? void 0 : _e.discount_list) == null ? void 0 : _f.filter((item2) => {
449
+ var _a2;
450
+ return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
451
+ })) || [];
452
+ const mainProductDiscountAmount = getDiscountAmount(discount);
453
+ total = total.minus(mainProductDiscountAmount);
454
+ if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
455
+ total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
456
+ return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
457
+ }, new import_decimal.default(0)));
450
458
  }
451
459
  for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
452
460
  if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
@@ -791,6 +799,7 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
791
799
  0 && (module.exports = {
792
800
  calcDiscountListDifference,
793
801
  calculateDeposit,
802
+ calculateOriginSubtotal,
794
803
  calculatePriceDetails,
795
804
  calculateSubtotal,
796
805
  calculateTaxFee,
@@ -11,8 +11,4 @@ export * from './Payment';
11
11
  export * from './Resource';
12
12
  export * from './Step';
13
13
  export * from './Summary';
14
- export * from './SalesSummary';
15
14
  export * from './Schedule';
16
- export * from './Quotation';
17
- export * from './ScanOrderLogger';
18
- export * from './OpenData';
@@ -29,11 +29,7 @@ __reExport(modules_exports, require("./Payment"), module.exports);
29
29
  __reExport(modules_exports, require("./Resource"), module.exports);
30
30
  __reExport(modules_exports, require("./Step"), module.exports);
31
31
  __reExport(modules_exports, require("./Summary"), module.exports);
32
- __reExport(modules_exports, require("./SalesSummary"), module.exports);
33
32
  __reExport(modules_exports, require("./Schedule"), module.exports);
34
- __reExport(modules_exports, require("./Quotation"), module.exports);
35
- __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
36
- __reExport(modules_exports, require("./OpenData"), module.exports);
37
33
  // Annotate the CommonJS export names for ESM import in node:
38
34
  0 && (module.exports = {
39
35
  ...require("./Product"),
@@ -49,9 +45,5 @@ __reExport(modules_exports, require("./OpenData"), module.exports);
49
45
  ...require("./Resource"),
50
46
  ...require("./Step"),
51
47
  ...require("./Summary"),
52
- ...require("./SalesSummary"),
53
- ...require("./Schedule"),
54
- ...require("./Quotation"),
55
- ...require("./ScanOrderLogger"),
56
- ...require("./OpenData")
48
+ ...require("./Schedule")
57
49
  });
@@ -1,3 +1,4 @@
1
+ import { WalletPassEvaluator } from '../model';
1
2
  import { Plugin } from '../types';
2
3
  /**
3
4
  * WindowPlugin 接口定义
@@ -14,6 +15,7 @@ export interface WindowPlugin extends Plugin {
14
15
  document: Partial<Document>;
15
16
  history: History;
16
17
  interaction?: any;
18
+ getWalletPassEvaluator?: () => WalletPassEvaluator;
17
19
  }
18
20
  /**
19
21
  * 简单的 Storage 接口实现
@@ -144,6 +144,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
144
144
  getSummary(): Promise<{
145
145
  subtotal: string | number;
146
146
  total: string | number;
147
+ originTotal: string | number;
147
148
  taxTitle?: string | undefined;
148
149
  totalTaxFee?: string | number | undefined;
149
150
  isPriceIncludeTax?: 0 | 1 | undefined;
@@ -301,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
301
302
  autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
302
303
  errorList: any[];
303
304
  };
304
- getTimeSlotByAllResources(resources_code: string, split?: number): any[];
305
+ getTimeSlotByAllResources(resources_code: string): any[];
305
306
  getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
306
307
  resources_code: string;
307
308
  startDate: string;
@@ -310,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
311
  date: string;
311
312
  status: string;
312
313
  week: string;
313
- weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
314
315
  }[]>;
315
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
317
  private getScheduleDataByIds;
@@ -1235,7 +1235,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1235
1235
  }
1236
1236
  );
1237
1237
  cartItems2.forEach((item, index) => {
1238
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1238
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1239
1239
  const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
1240
1240
  const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
1241
1241
  if (hasOriginTimeSlot) {
@@ -1368,9 +1368,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1368
1368
  const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
1369
1369
  resources: targetRenderList,
1370
1370
  currentCapacity,
1371
- countMap: selectResourcesMap,
1372
- targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
1373
- durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
1371
+ countMap: selectResourcesMap
1374
1372
  });
1375
1373
  const targetResource = fastestResource || targetRenderList[0];
1376
1374
  targetResource.capacity = currentCapacity;
@@ -1407,7 +1405,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1407
1405
  return { errorList };
1408
1406
  }
1409
1407
  // 从购物车中获取已经分配好第一步资源的所有时间片
1410
- getTimeSlotByAllResources(resources_code, split = 10) {
1408
+ getTimeSlotByAllResources(resources_code) {
1411
1409
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1412
1410
  let dateRange = this.store.date.getDateRange();
1413
1411
  const resources = [];
@@ -1565,7 +1563,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1565
1563
  resourcesMap,
1566
1564
  duration,
1567
1565
  currentDate: dateRange[0].date,
1568
- split,
1566
+ split: 10,
1569
1567
  resourcesUseableMap,
1570
1568
  capacity: maxCapacity,
1571
1569
  cut_off_time: maxCutOffTime,
@@ -1,4 +1,4 @@
1
- import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
1
+ import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
2
2
  export interface BookingByStepState {
3
3
  cart: CartModule;
4
4
  summary: SummaryModule;
@@ -14,8 +14,6 @@ export interface BookingByStepState {
14
14
  currentProduct?: ProductData;
15
15
  currentProductMeta?: Record<string, any>;
16
16
  schedule: ScheduleModule;
17
- salesSummary?: SalesSummaryModule;
18
- scanOrderLogger?: ScanOrderLoggerModule;
19
17
  }
20
18
  export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
21
19
  export declare enum BookingByStepHooks {
@@ -36,11 +36,6 @@ function createModule(moduleName, solutionName, name, version) {
36
36
  `${solutionName}_${name || moduleName}`,
37
37
  version
38
38
  );
39
- case "salesSummary":
40
- return new import_modules.SalesSummaryModule(
41
- `${solutionName}_${name || moduleName}`,
42
- version
43
- );
44
39
  case "step":
45
40
  return new import_modules.StepModule(
46
41
  `${solutionName}_${name || moduleName}`,
@@ -76,11 +71,6 @@ function createModule(moduleName, solutionName, name, version) {
76
71
  `${solutionName}_${name || moduleName}`,
77
72
  version
78
73
  );
79
- case "scanOrderLogger":
80
- return new import_modules.ScanOrderLoggerModule(
81
- `${solutionName}_${name || moduleName}`,
82
- version
83
- );
84
74
  default:
85
75
  throw new Error(`Unknown module type: ${moduleName}`);
86
76
  }
@@ -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
  * 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
@@ -77,15 +77,10 @@ function calculateResourceAvailableTime({
77
77
  function findFastestAvailableResource({
78
78
  resources,
79
79
  currentCapacity = 1,
80
- countMap = {},
81
- targetDate,
82
- durationMinutes = 30
80
+ countMap = {}
83
81
  }) {
84
82
  var _a, _b, _c;
85
83
  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");
89
84
  let fastestTime = null;
90
85
  let fastestResources = [];
91
86
  console.log("[TimeslotUtils] 查找最快可用资源:", {
@@ -95,22 +90,19 @@ function findFastestAvailableResource({
95
90
  countMap
96
91
  });
97
92
  for (const resource of resources) {
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);
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;
105
97
  });
106
- if (targetDayTimes.length === 0) {
98
+ if (todayTimes.length === 0) {
107
99
  console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
108
100
  continue;
109
101
  }
110
- for (const time of targetDayTimes) {
102
+ for (const time of todayTimes) {
111
103
  const workStartTime = (0, import_dayjs.default)(time.start_at);
112
104
  const workEndTime = (0, import_dayjs.default)(time.end_at);
113
- let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
105
+ let nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
114
106
  console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
115
107
  workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
116
108
  checkStartTime: nextAvailableTime.format("HH:mm:ss"),
@@ -134,7 +126,7 @@ function findFastestAvailableResource({
134
126
  pax: event.pax || 1
135
127
  });
136
128
  if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
137
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
129
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
138
130
  finalAvailableTime = eventEnd;
139
131
  console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
140
132
  }
@@ -142,7 +134,7 @@ function findFastestAvailableResource({
142
134
  const totalCapacity = resource.capacity || 0;
143
135
  const currentUsedCapacity = countMap[resource.id] || 0;
144
136
  const eventUsedCapacity = event.pax || 1;
145
- if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
137
+ if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
146
138
  const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
147
139
  if (totalRequiredCapacity > totalCapacity) {
148
140
  finalAvailableTime = eventEnd;
@@ -151,7 +143,7 @@ function findFastestAvailableResource({
151
143
  }
152
144
  }
153
145
  }
154
- if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
146
+ if (finalAvailableTime.isAfter(workEndTime)) {
155
147
  console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
156
148
  continue;
157
149
  }
@@ -222,6 +222,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
222
222
  product_id: item.product_id,
223
223
  product_variant_id: item.product_variant_id,
224
224
  quantity: item.num,
225
+ is_price_include_tax: item.is_price_include_tax,
225
226
  // 商品是否含税:1;0
226
227
  is_charge_tax: item.is_charge_tax ?? 0,
227
228
  // 若商品不含税,计算得到的税费,单位(元)
@@ -246,6 +247,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
246
247
  },
247
248
  product_bundle: (item.product_bundle || []).map((bundle) => {
248
249
  return {
250
+ is_price_include_tax: item.is_price_include_tax,
249
251
  bundle_id: bundle.bundle_id,
250
252
  bundle_product_id: bundle.bundle_product_id,
251
253
  bundle_variant_id: bundle.bundle_variant_id,
@@ -22,6 +22,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
22
22
  getCurrentBookingTime(): string | null;
23
23
  private filterDiscountListByBookingTime;
24
24
  setCustomer(customer: Customer): Promise<void>;
25
+ setOriginTotalAmount(amount: number): void;
25
26
  setHolders(holders: {
26
27
  form_record_id: number;
27
28
  }[]): void;
@@ -56,7 +56,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
56
56
  originalDiscountList: [],
57
57
  currentBookingTime: "",
58
58
  filteredDiscountList: [],
59
- bookingSubject: void 0
59
+ bookingSubject: void 0,
60
+ orderTotalAmount: 0
60
61
  };
61
62
  }
62
63
  // =========== 生命周期方法 ===========
@@ -194,6 +195,9 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
194
195
  );
195
196
  }
196
197
  }
198
+ setOriginTotalAmount(amount) {
199
+ this.store.orderTotalAmount = amount;
200
+ }
197
201
  // 设置holders
198
202
  setHolders(holders) {
199
203
  this.store.holders = holders;
@@ -213,6 +217,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
213
217
  {
214
218
  productList,
215
219
  discountList: this.getDiscountList(),
220
+ orderTotalAmount: this.store.orderTotalAmount || 0,
216
221
  holders: this.store.holders || [],
217
222
  isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
218
223
  },
@@ -320,6 +325,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
320
325
  productList: this.store.productList || [],
321
326
  oldDiscountList: this.getDiscountList(),
322
327
  newDiscountList: withScanList,
328
+ orderTotalAmount: this.store.orderTotalAmount || 0,
323
329
  holders: this.store.holders || [],
324
330
  isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
325
331
  }) || {
@@ -388,7 +394,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
388
394
  if (item.booking_id) {
389
395
  const product = (_a2 = this.hooks) == null ? void 0 : _a2.getProduct(item);
390
396
  (item.discount_list || []).forEach((discount) => {
391
- var _a3, _b, _c, _d, _e;
397
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
392
398
  if (discount.id && ["good_pass", "discount_card"].includes(discount.type)) {
393
399
  const index = editModeDiscountList.findIndex((n) => {
394
400
  var _a4;
@@ -397,8 +403,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
397
403
  if (index !== -1) {
398
404
  editModeDiscountList[index] = {
399
405
  ...editModeDiscountList[index],
406
+ metadata: {
407
+ ...discount.metadata || {},
408
+ num: (((_b = (_a3 = editModeDiscountList == null ? void 0 : editModeDiscountList[index]) == null ? void 0 : _a3.metadata) == null ? void 0 : _b.num) || 1) + (((_c = discount.metadata) == null ? void 0 : _c.num) || 1)
409
+ },
400
410
  amount: new import_decimal.default(discount.amount || 0).plus(new import_decimal.default(editModeDiscountList[index].amount || 0)).toNumber(),
401
- savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_a3 = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a3.product_discount_difference) || 0).plus(new import_decimal.default(editModeDiscountList[index].savedAmount || 0)).toNumber()
411
+ savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_d = discount == null ? void 0 : discount.metadata) == null ? void 0 : _d.product_discount_difference) || 0).plus(new import_decimal.default(editModeDiscountList[index].savedAmount || 0)).toNumber()
402
412
  };
403
413
  } else {
404
414
  if (discount.type && !discount.tag) {
@@ -406,16 +416,20 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
406
416
  }
407
417
  editModeDiscountList.push({
408
418
  ...discount,
419
+ metadata: {
420
+ ...discount.metadata || {},
421
+ num: ((_e = discount.metadata) == null ? void 0 : _e.num) || 1
422
+ },
409
423
  name: discount.name || discount.discount.title.auto,
410
424
  isEditMode: true,
411
425
  limited_relation_product_data: {},
412
- savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.product_discount_difference) || 0).toNumber(),
426
+ savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_f = discount == null ? void 0 : discount.metadata) == null ? void 0 : _f.product_discount_difference) || 0).toNumber(),
413
427
  isAvailable: true,
414
- id: ((_c = discount.discount) == null ? void 0 : _c.resource_id) || discount.id,
415
- format_title: ((_d = discount.discount) == null ? void 0 : _d.title) || discount.format_title,
428
+ id: ((_g = discount.discount) == null ? void 0 : _g.resource_id) || discount.id,
429
+ format_title: ((_h = discount.discount) == null ? void 0 : _h.title) || discount.format_title,
416
430
  isDisabled: true,
417
431
  isSelected: true,
418
- product_id: ((_e = discount.discount) == null ? void 0 : _e.product_id) || discount.product_id
432
+ product_id: ((_i = discount.discount) == null ? void 0 : _i.product_id) || discount.product_id
419
433
  });
420
434
  }
421
435
  }
@@ -532,7 +546,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
532
546
  }
533
547
  await this.core.effects.emit(
534
548
  `${this.name}:onLoadDiscountList`,
535
- filteredDiscountList
549
+ newDiscountList
536
550
  );
537
551
  } catch (error) {
538
552
  console.error("[ShopDiscount] 加载准备配置出错:", error);
@@ -23,6 +23,7 @@ export interface ShopDiscountState {
23
23
  discount: DiscountModule | null;
24
24
  rules: RulesModule | null;
25
25
  productList: Record<string, any>[];
26
+ orderTotalAmount?: number;
26
27
  holders?: {
27
28
  form_record_id: number;
28
29
  form_id?: number;
@@ -56,14 +56,18 @@ var isAllNormalProduct = (items) => {
56
56
  };
57
57
  var getDiscountAmount = (discount, total, price) => {
58
58
  var _a;
59
+ let discountedPrice = 0;
59
60
  if (discount.tag === "good_pass") {
60
- return new import_decimal.default(price).minus(new import_decimal.default(price || 0)).toNumber();
61
- }
62
- const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
63
- if (isFixedAmount) {
64
- return Math.max(new import_decimal.default(price).minus(new import_decimal.default((discount.amount ?? discount.par_value) || 0)).toNumber(), 0);
61
+ discountedPrice = new import_decimal.default(price).minus(new import_decimal.default(price || 0)).toNumber();
62
+ } else {
63
+ const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
64
+ if (isFixedAmount) {
65
+ discountedPrice = Math.max(new import_decimal.default(price).minus(new import_decimal.default(discount.par_value || 0)).toNumber(), 0);
66
+ } else {
67
+ discountedPrice = new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
68
+ }
65
69
  }
66
- return new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
70
+ return discountedPrice;
67
71
  };
68
72
  var getDiscountListAmountTotal = (discount) => {
69
73
  return discount.reduce((acc, cur) => {
@@ -4,5 +4,3 @@ export * from './BookingTicket';
4
4
  export * from './ShopDiscount';
5
5
  export * from './RegisterAndLogin';
6
6
  export * from './Checkout';
7
- export * from './ScanOrder';
8
- export * from './VenueBooking';