@pisell/pisellos 2.1.84 → 2.1.85

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 (103) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/model/index.d.ts +1 -0
  4. package/dist/model/index.js +1 -0
  5. package/dist/model/strategy/adapter/index.d.ts +3 -0
  6. package/dist/model/strategy/adapter/index.js +4 -0
  7. package/dist/model/strategy/adapter/type.d.ts +28 -0
  8. package/dist/model/strategy/adapter/type.js +1 -0
  9. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  10. package/dist/model/strategy/adapter/walletPass/evaluator.js +497 -0
  11. package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
  12. package/dist/model/strategy/adapter/walletPass/example.js +258 -0
  13. package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
  14. package/dist/model/strategy/adapter/walletPass/index.js +182 -0
  15. package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  16. package/dist/model/strategy/adapter/walletPass/locales.js +23 -0
  17. package/dist/model/strategy/adapter/walletPass/type.d.ts +168 -0
  18. package/dist/model/strategy/adapter/walletPass/type.js +1 -0
  19. package/dist/model/strategy/adapter/walletPass/utils.d.ts +76 -0
  20. package/dist/model/strategy/adapter/walletPass/utils.js +1043 -0
  21. package/dist/model/strategy/index.d.ts +94 -0
  22. package/dist/model/strategy/index.js +551 -0
  23. package/dist/model/strategy/strategy-example.d.ts +5 -0
  24. package/dist/model/strategy/strategy-example.js +331 -0
  25. package/dist/model/strategy/type.d.ts +228 -0
  26. package/dist/model/strategy/type.js +94 -0
  27. package/dist/modules/Cart/types.d.ts +2 -0
  28. package/dist/modules/Cart/utils/cartProduct.js +11 -0
  29. package/dist/modules/Cart/utils/changePrice.js +0 -6
  30. package/dist/modules/Discount/index.d.ts +0 -1
  31. package/dist/modules/Discount/index.js +1 -2
  32. package/dist/modules/Discount/types.d.ts +15 -0
  33. package/dist/modules/Payment/index.d.ts +2 -1
  34. package/dist/modules/Payment/index.js +10 -7
  35. package/dist/modules/Payment/utils.js +3 -0
  36. package/dist/modules/Payment/walletpass.d.ts +23 -0
  37. package/dist/modules/Payment/walletpass.js +191 -95
  38. package/dist/modules/Rules/index.d.ts +7 -2
  39. package/dist/modules/Rules/index.js +141 -19
  40. package/dist/modules/Rules/types.d.ts +1 -0
  41. package/dist/modules/Summary/index.js +5 -47
  42. package/dist/modules/Summary/types.d.ts +2 -0
  43. package/dist/modules/Summary/utils.d.ts +7 -1
  44. package/dist/modules/Summary/utils.js +27 -21
  45. package/dist/plugins/window.d.ts +2 -0
  46. package/dist/solution/BookingByStep/index.d.ts +1 -0
  47. package/dist/solution/BookingByStep/index.js +35 -84
  48. package/dist/solution/Checkout/index.js +2 -0
  49. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  50. package/dist/solution/ShopDiscount/index.js +12 -3
  51. package/dist/solution/ShopDiscount/types.d.ts +1 -0
  52. package/lib/index.d.ts +1 -0
  53. package/lib/index.js +3 -1
  54. package/lib/model/index.d.ts +1 -0
  55. package/lib/model/index.js +23 -0
  56. package/lib/model/strategy/adapter/index.d.ts +3 -0
  57. package/lib/model/strategy/adapter/index.js +45 -0
  58. package/lib/model/strategy/adapter/type.d.ts +28 -0
  59. package/lib/model/strategy/adapter/type.js +17 -0
  60. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
  61. package/lib/model/strategy/adapter/walletPass/evaluator.js +421 -0
  62. package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
  63. package/lib/model/strategy/adapter/walletPass/example.js +207 -0
  64. package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
  65. package/lib/model/strategy/adapter/walletPass/index.js +142 -0
  66. package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
  67. package/lib/model/strategy/adapter/walletPass/locales.js +51 -0
  68. package/lib/model/strategy/adapter/walletPass/type.d.ts +168 -0
  69. package/lib/model/strategy/adapter/walletPass/type.js +17 -0
  70. package/lib/model/strategy/adapter/walletPass/utils.d.ts +76 -0
  71. package/lib/model/strategy/adapter/walletPass/utils.js +704 -0
  72. package/lib/model/strategy/index.d.ts +94 -0
  73. package/lib/model/strategy/index.js +413 -0
  74. package/lib/model/strategy/strategy-example.d.ts +5 -0
  75. package/lib/model/strategy/strategy-example.js +318 -0
  76. package/lib/model/strategy/type.d.ts +228 -0
  77. package/lib/model/strategy/type.js +44 -0
  78. package/lib/modules/Cart/types.d.ts +2 -0
  79. package/lib/modules/Cart/utils/cartProduct.js +9 -0
  80. package/lib/modules/Cart/utils/changePrice.js +0 -5
  81. package/lib/modules/Discount/index.d.ts +0 -1
  82. package/lib/modules/Discount/index.js +1 -2
  83. package/lib/modules/Discount/types.d.ts +15 -0
  84. package/lib/modules/Payment/index.d.ts +2 -1
  85. package/lib/modules/Payment/index.js +1 -0
  86. package/lib/modules/Payment/utils.js +3 -0
  87. package/lib/modules/Payment/walletpass.d.ts +23 -0
  88. package/lib/modules/Payment/walletpass.js +94 -17
  89. package/lib/modules/Rules/index.d.ts +7 -2
  90. package/lib/modules/Rules/index.js +285 -149
  91. package/lib/modules/Rules/types.d.ts +1 -0
  92. package/lib/modules/Summary/index.js +9 -22
  93. package/lib/modules/Summary/types.d.ts +2 -0
  94. package/lib/modules/Summary/utils.d.ts +7 -1
  95. package/lib/modules/Summary/utils.js +25 -21
  96. package/lib/plugins/window.d.ts +2 -0
  97. package/lib/solution/BookingByStep/index.d.ts +1 -0
  98. package/lib/solution/BookingByStep/index.js +3 -34
  99. package/lib/solution/Checkout/index.js +2 -0
  100. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  101. package/lib/solution/ShopDiscount/index.js +7 -2
  102. package/lib/solution/ShopDiscount/types.d.ts +1 -0
  103. package/package.json +1 -1
@@ -31,6 +31,7 @@ export interface RulesModuleAPI {
31
31
  holders: {
32
32
  form_record_id: number;
33
33
  }[];
34
+ orderTotalAmount: number;
34
35
  isFormSubject: boolean;
35
36
  }) => DiscountResult;
36
37
  }
@@ -65,7 +65,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
65
65
  this.getSurchargeList();
66
66
  }
67
67
  async getSurchargeList() {
68
- const surchargeList = await this.request.get("/order/custom-surcharge/available/v2", {
68
+ const surchargeList = await this.request.get("/order/custom-surcharge/available", {
69
69
  channel: "online-store",
70
70
  is_assemble_product_data: 1,
71
71
  is_assemble_schedule_data: 1,
@@ -74,18 +74,14 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
74
74
  this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
75
75
  }
76
76
  async getSummary(cartItems) {
77
- var _a, _b, _c;
77
+ var _a, _b;
78
78
  const shopInfo = ((_b = (_a = this.shopStore.get("core")) == null ? void 0 : _a.core) == null ? void 0 : _b.shop) || {};
79
- const scheduleModule = this.core.getModule("appointmentBooking_schedule");
80
- const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
81
- const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
82
- const scheduleById = {};
83
- if (Array.isArray(scheduleList)) {
84
- for (let item of scheduleList) {
85
- scheduleById[item.id] = item;
86
- }
87
- }
88
- const summary = (0, import_utils.calculatePriceDetails)(shopInfo, cartItems, (_c = import_Schedule.ScheduleModule) == null ? void 0 : _c.isInScheduleByDate, this.store.surchargeList, scheduleById);
79
+ const summary = (0, import_utils.calculatePriceDetails)(
80
+ shopInfo,
81
+ cartItems,
82
+ import_Schedule.ScheduleModule.isInScheduleByDate,
83
+ this.store.surchargeList
84
+ );
89
85
  this.store.summary = summary;
90
86
  return this.store.summary;
91
87
  }
@@ -119,16 +115,7 @@ var SummaryModule = class extends import_BaseModule.BaseModule {
119
115
  });
120
116
  }
121
117
  getSurchargeforUtils(items) {
122
- const scheduleModule = this.core.getModule("appointmentBooking_schedule");
123
- const needScheduleIds = this.store.surchargeList.map((item) => item.available_schedule_ids).flat();
124
- const scheduleList = scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
125
- const scheduleById = {};
126
- if (Array.isArray(scheduleList)) {
127
- for (let item of scheduleList) {
128
- scheduleById[item.id] = item;
129
- }
130
- }
131
- const surchargeList = (0, import_utils.getSurcharge)({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate: import_Schedule.ScheduleModule.isInScheduleByDate, surcharge_list: this.store.surchargeList, scheduleById });
118
+ const surchargeList = (0, import_utils.getSurcharge)({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate: import_Schedule.ScheduleModule.isInScheduleByDate, surcharge_list: this.store.surchargeList, scheduleById: {} });
132
119
  const surchargeAmount = new import_decimal.default((0, import_utils.getSurchargeAmount)({ bookingDetail: null, bookingId: void 0 }, surchargeList, { isEdit: false }));
133
120
  return {
134
121
  surchargeList,
@@ -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
  /** 商品总费率 */
@@ -1,7 +1,7 @@
1
1
  import Decimal from 'decimal.js';
2
2
  import { CartItem } from '../Cart/types';
3
3
  import { ISummaryState } from './types';
4
- export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[], scheduleById: Record<string, any>) => ISummaryState['summary'];
4
+ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], isInScheduleByDate: any, surchargeList: any[]) => ISummaryState['summary'];
5
5
  /**
6
6
  * 获取子商品折扣信息
7
7
  * @param item
@@ -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:
@@ -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,
@@ -42,12 +43,11 @@ __export(utils_exports, {
42
43
  });
43
44
  module.exports = __toCommonJS(utils_exports);
44
45
  var import_decimal = __toESM(require("decimal.js"));
45
- var import_utils = require("../Product/utils");
46
- var import_dayjs = __toESM(require("dayjs"));
47
- var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) => {
46
+ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList) => {
48
47
  const subtotal = new import_decimal.default(calculateSubtotal(items));
48
+ const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
49
49
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
50
- const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById });
50
+ const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById: {} });
51
51
  const surchargeAmount = new import_decimal.default(getSurchargeAmount({ bookingDetail: null, bookingId: void 0 }, surcharge, { isEdit: false }));
52
52
  const { tax, originTax } = getTax({ service: items, bookingDetail: null, bookingId: void 0 }, {
53
53
  computed: {
@@ -59,10 +59,12 @@ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList,
59
59
  is_price_include_tax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
60
60
  });
61
61
  const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
62
+ const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
62
63
  const deposit = calculateDeposit(items);
63
64
  return {
64
65
  subtotal: subtotal.toFixed(2),
65
66
  total: total.toFixed(2),
67
+ originTotal: originTotal.toFixed(2),
66
68
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
67
69
  taxRate: shopInfo == null ? void 0 : shopInfo.tax_rate,
68
70
  totalTaxFee: tax,
@@ -360,6 +362,16 @@ var calculateSubtotal = (items) => {
360
362
  }, new import_decimal.default(0));
361
363
  return subtotal.toFixed(2);
362
364
  };
365
+ var calculateOriginSubtotal = (items) => {
366
+ if (!(items == null ? void 0 : items.length)) {
367
+ return "0.00";
368
+ }
369
+ const subtotal = items.reduce((sum, item) => {
370
+ const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
371
+ return sum.plus(cartItemTotalPrice);
372
+ }, new import_decimal.default(0));
373
+ return subtotal.toFixed(2);
374
+ };
363
375
  var calculateTaxFee = (shopInfo, items) => {
364
376
  if (!(items == null ? void 0 : items.length)) {
365
377
  return "0.00";
@@ -510,17 +522,8 @@ var isProductMatchSurchargeCondition = (item, options) => {
510
522
  return isProductMatch && isScheduleMatch;
511
523
  };
512
524
  var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
513
- var _a, _b, _c, _d;
525
+ var _a, _b, _c;
514
526
  const { isEdit, isInScheduleByDate, surcharge_list, scheduleById } = options;
515
- const firstAppointmentCartItem = (_a = service.filter(
516
- (n) => !(0, import_utils.isNormalProduct)(n._productOrigin)
517
- )) == null ? void 0 : _a[0];
518
- let startDate = "";
519
- if (firstAppointmentCartItem) {
520
- startDate = firstAppointmentCartItem.start_date + " " + firstAppointmentCartItem.start_time + ":00";
521
- } else {
522
- startDate = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
523
- }
524
527
  if (!isEdit && bookingId) {
525
528
  if (Array.isArray(bookingDetail == null ? void 0 : bookingDetail.surcharge)) {
526
529
  return ((bookingDetail == null ? void 0 : bookingDetail.surcharge) || []).filter((d) => Number(d.amount) > 0).map(
@@ -567,7 +570,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
567
570
  if (isProductMatchSurchargeCondition(
568
571
  {
569
572
  isCustomItem: item.isCustomItem,
570
- startDate,
573
+ startDate: (item == null ? void 0 : item.startDate) || "",
571
574
  product_id: item.id
572
575
  },
573
576
  {
@@ -599,7 +602,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
599
602
  if (getBundleItemIsOriginalPrice(bundleItem) && isProductMatchSurchargeCondition(
600
603
  {
601
604
  isCustomItem: false,
602
- startDate,
605
+ startDate: item.startDate,
603
606
  product_id: bundleItem._bundle_product_id
604
607
  },
605
608
  {
@@ -625,7 +628,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
625
628
  if (isProductMatchSurchargeCondition(
626
629
  {
627
630
  isCustomItem: false,
628
- startDate,
631
+ startDate: item.startDate,
629
632
  product_id: relationDetail.product_id
630
633
  },
631
634
  {
@@ -637,7 +640,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
637
640
  matchedItems.push({
638
641
  isMain: false,
639
642
  total: Number(
640
- (relationDetail == null ? void 0 : relationDetail.price) || ((_b = relationDetail == null ? void 0 : relationDetail.metadata) == null ? void 0 : _b.main_product_attached_bundle_selling_price)
643
+ (relationDetail == null ? void 0 : relationDetail.price) || ((_a = relationDetail == null ? void 0 : relationDetail.metadata) == null ? void 0 : _a.main_product_attached_bundle_selling_price)
641
644
  ),
642
645
  quantity: relationDetail.num || relationDetail.quantity || 1,
643
646
  item: relationDetail,
@@ -650,7 +653,7 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
650
653
  }
651
654
  if (Array.isArray(addons == null ? void 0 : addons.value)) {
652
655
  for (let item of addons.value) {
653
- if (isProductMatchSurchargeCondition({ ...item, startDate }, {
656
+ if (isProductMatchSurchargeCondition(item, {
654
657
  surchargeConfig,
655
658
  scheduleById: scheduleById || {},
656
659
  isInScheduleByDate
@@ -711,13 +714,13 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
711
714
  const surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
712
715
  productTotalSurcharge = productTotalSurcharge.plus(new import_decimal.default(surchargeFee).times(itemQuantity).toNumber());
713
716
  item.item.surcharge_fee = surchargeFee;
714
- item.item.relation_surcharge_ids = [...((_c = item.item) == null ? void 0 : _c.relation_surcharge_ids) || [], id];
717
+ item.item.relation_surcharge_ids = [...((_b = item.item) == null ? void 0 : _b.relation_surcharge_ids) || [], id];
715
718
  } else {
716
719
  const originSurchargeFee = new import_decimal.default(item.item.surcharge_fee || 0);
717
720
  const surchargeFee = originSurchargeFee.plus(itemSurcharge).plus(fixedSurcharge).toDecimalPlaces(2, import_decimal.default.ROUND_DOWN).toNumber();
718
721
  productTotalSurcharge = productTotalSurcharge.plus(new import_decimal.default(surchargeFee).times(itemQuantity).toNumber());
719
722
  item.item.surcharge_fee = surchargeFee;
720
- item.item.relation_surcharge_ids = [...((_d = item.item) == null ? void 0 : _d.relation_surcharge_ids) || [], id];
723
+ item.item.relation_surcharge_ids = [...((_c = item.item) == null ? void 0 : _c.relation_surcharge_ids) || [], id];
721
724
  }
722
725
  }
723
726
  if (isLast && configTotal.minus(productTotalSurcharge).gt(0)) {
@@ -787,6 +790,7 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
787
790
  0 && (module.exports = {
788
791
  calcDiscountListDifference,
789
792
  calculateDeposit,
793
+ calculateOriginSubtotal,
790
794
  calculatePriceDetails,
791
795
  calculateSubtotal,
792
796
  calculateTaxFee,
@@ -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;
@@ -1766,28 +1766,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1766
1766
  newResources.forEach((resource) => {
1767
1767
  var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1768
1768
  if (((_b2 = (_a3 = item._productOrigin) == null ? void 0 : _a3.duration) == null ? void 0 : _b2.type) === "flexible") {
1769
- let getEarliestBlockedStartTime = function({
1770
- currentStartTime: currentStartTime2,
1771
- times
1772
- }) {
1773
- const currentStart = (0, import_dayjs.default)(currentStartTime2);
1774
- let earliestBlockStart;
1775
- for (const time of times || []) {
1776
- for (const event of time.event_list || []) {
1777
- const eventStart = (0, import_dayjs.default)(event.start_at);
1778
- const eventEnd = (0, import_dayjs.default)(event.end_at);
1779
- if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
1780
- return currentStart.format("YYYY-MM-DD HH:mm");
1781
- }
1782
- if (eventStart.isAfter(currentStart)) {
1783
- if (!earliestBlockStart || eventStart.isBefore(earliestBlockStart)) {
1784
- earliestBlockStart = eventStart;
1785
- }
1786
- }
1787
- }
1788
- }
1789
- return earliestBlockStart == null ? void 0 : earliestBlockStart.format("YYYY-MM-DD HH:mm");
1790
- };
1791
1769
  item.duration = {
1792
1770
  type: "minutes",
1793
1771
  value: 10
@@ -1802,22 +1780,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1802
1780
  },
1803
1781
  targetResourceTimes[0]
1804
1782
  );
1805
- const earliestBlockedStartTime = getEarliestBlockedStartTime({
1806
- currentStartTime,
1807
- times: targetResourceTimes
1808
- });
1809
1783
  const resourceDate = (0, import_dayjs.default)(resourcesEndTime.end_at).format(
1810
1784
  "YYYY-MM-DD"
1811
1785
  );
1812
1786
  const operatingBoundaryDateTime = `${resourceDate} ${operating_day_boundary.type === "start_time" ? "23:59" : operating_day_boundary.time}`;
1813
- const endTimeCandidates = [
1814
- resourcesEndTime.end_at,
1815
- operatingBoundaryDateTime,
1816
- ...earliestBlockedStartTime ? [earliestBlockedStartTime] : []
1817
- ];
1818
- const endTime = endTimeCandidates.reduce((earliest, value) => {
1819
- return (0, import_dayjs.default)(value).isBefore((0, import_dayjs.default)(earliest)) ? value : earliest;
1820
- }, endTimeCandidates[0]);
1787
+ const endTime = (0, import_dayjs.default)(resourcesEndTime.end_at).isBefore(
1788
+ (0, import_dayjs.default)(operatingBoundaryDateTime)
1789
+ ) ? resourcesEndTime.end_at : operatingBoundaryDateTime;
1821
1790
  let formattedEndTime;
1822
1791
  if (typeof endTime === "string" && endTime.includes(":") && !endTime.includes(" ") && !endTime.includes("T")) {
1823
1792
  const currentDate = timeSlots.start_at.format("YYYY-MM-DD");
@@ -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,6 +56,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
56
56
  originalDiscountList: [],
57
57
  currentBookingTime: "",
58
58
  filteredDiscountList: [],
59
+ orderTotalAmount: 0,
59
60
  bookingSubject: void 0
60
61
  };
61
62
  }
@@ -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;
@@ -214,6 +218,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
214
218
  productList,
215
219
  discountList: this.getDiscountList(),
216
220
  holders: this.store.holders || [],
221
+ orderTotalAmount: this.store.orderTotalAmount || 0,
217
222
  isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
218
223
  },
219
224
  options
@@ -307,6 +312,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
307
312
  oldDiscountList: this.getDiscountList(),
308
313
  newDiscountList: withScanList,
309
314
  holders: this.store.holders || [],
315
+ orderTotalAmount: this.store.orderTotalAmount || 0,
310
316
  isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
311
317
  }) || {
312
318
  isAvailable: false,
@@ -495,8 +501,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
495
501
  action: "create",
496
502
  with_good_pass: 1,
497
503
  with_discount_card: 1,
498
- with_wallet_pass_holder: 1,
499
- request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
504
+ with_wallet_pass_holder: 1
500
505
  }));
501
506
  const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
502
507
  (item) => item.isScan
@@ -31,6 +31,7 @@ export interface ShopDiscountState {
31
31
  originalDiscountList: Discount[];
32
32
  currentBookingTime: string | null;
33
33
  filteredDiscountList: Discount[];
34
+ orderTotalAmount?: number;
34
35
  bookingSubject?: {
35
36
  type?: 'form' | 'customer';
36
37
  [key: string]: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.84",
4
+ "version": "2.1.85",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",