@pisell/pisellos 2.3.82 → 2.3.84

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 (32) hide show
  1. package/dist/modules/BookingContext/index.d.ts +3 -0
  2. package/dist/modules/BookingContext/index.js +42 -13
  3. package/dist/modules/BookingContext/types.d.ts +4 -4
  4. package/dist/modules/BookingContext/types.js +3 -3
  5. package/dist/modules/Quotation/index.d.ts +16 -0
  6. package/dist/modules/Quotation/index.js +241 -32
  7. package/dist/solution/BaseSales/index.js +92 -72
  8. package/dist/solution/BookingByStep/index.d.ts +2 -2
  9. package/dist/solution/BookingTicket/index.d.ts +1 -1
  10. package/dist/solution/VenueBooking/index.d.ts +2 -0
  11. package/dist/solution/VenueBooking/index.js +542 -494
  12. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  13. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  14. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  15. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  16. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  17. package/lib/modules/BookingContext/index.d.ts +3 -0
  18. package/lib/modules/BookingContext/index.js +35 -8
  19. package/lib/modules/BookingContext/types.d.ts +4 -4
  20. package/lib/modules/BookingContext/types.js +3 -3
  21. package/lib/modules/Quotation/index.d.ts +16 -0
  22. package/lib/modules/Quotation/index.js +117 -11
  23. package/lib/solution/BaseSales/index.js +25 -9
  24. package/lib/solution/BookingByStep/index.d.ts +2 -2
  25. package/lib/solution/BookingTicket/index.d.ts +1 -1
  26. package/lib/solution/VenueBooking/index.d.ts +2 -0
  27. package/lib/solution/VenueBooking/index.js +28 -8
  28. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  29. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  30. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  31. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  32. package/package.json +1 -1
@@ -370,7 +370,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
370
370
  });
371
371
  }
372
372
  if (this.store.quotation) {
373
- await this.store.quotation.loadQuotations({
373
+ await this.ensureQuotationsLoaded({
374
374
  channel: this.otherParams?.channel
375
375
  });
376
376
  }
@@ -566,7 +566,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
566
566
  if (this.store.schedule) {
567
567
  await this.store.schedule.loadAllSchedule();
568
568
  this.injectScheduleResolverToQuotation();
569
- this.store.quotation?.loadQuotations({
569
+ this.preloadQuotations({
570
570
  channel: this.otherParams?.channel
571
571
  });
572
572
  }
@@ -720,6 +720,19 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
720
720
 
721
721
  // ─── 报价单 ───
722
722
 
723
+ async ensureQuotationsLoaded(params) {
724
+ const quotation = this.store.quotation;
725
+ if (!quotation) return;
726
+ const load = typeof quotation.ensureQuotations === 'function' ? quotation.ensureQuotations.bind(quotation) : quotation.loadQuotations.bind(quotation);
727
+ await load(params);
728
+ }
729
+ preloadQuotations(params) {
730
+ void this.ensureQuotationsLoaded(params).catch(error => {
731
+ this.logMethodError('preloadQuotations', error, {
732
+ channel: params?.channel
733
+ });
734
+ });
735
+ }
723
736
  async loadQuotations(params) {
724
737
  this.logMethodStart('loadQuotations');
725
738
  try {
@@ -854,6 +867,7 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
854
867
  rawResources: this.store.rawResourceData,
855
868
  resourceProductMap: this.resourceProductMap,
856
869
  quotationModule: this.store.quotation,
870
+ channel: this.otherParams?.channel,
857
871
  resolveConfig: date => this.resolveSlotConfigForDate(date)
858
872
  });
859
873
  }
@@ -866,7 +880,8 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
866
880
  const timePoints = timeLabels.map(label => `${date} ${label}`);
867
881
  quotationPriceMap = this.store.quotation.buildProductPriceMap({
868
882
  productIds,
869
- timePoints
883
+ timePoints,
884
+ channel: this.otherParams?.channel
870
885
  });
871
886
  }
872
887
  return (0, _timeSlot.buildTimeSlotGrid)({
@@ -1185,7 +1200,8 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1185
1200
  price_breakdown: (0, _slotMerge.buildPriceBreakdown)({
1186
1201
  group,
1187
1202
  productId: mapping.productId,
1188
- quotation: this.store.quotation
1203
+ quotation: this.store.quotation,
1204
+ channel: this.otherParams?.channel
1189
1205
  })
1190
1206
  },
1191
1207
  _origin: venueProductOrigin
@@ -1325,7 +1341,8 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1325
1341
  productId: mapping.productId,
1326
1342
  price: this.store.quotation.getPriceForProduct({
1327
1343
  productId: mapping.productId,
1328
- datetime: slot.startTime
1344
+ datetime: slot.startTime,
1345
+ channel: this.otherParams?.channel
1329
1346
  }) ?? mapping.price
1330
1347
  }));
1331
1348
  const merged = (0, _slotMerge.mergeConsecutiveSlots)(updatedSlots);
@@ -1335,14 +1352,16 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1335
1352
  product.metadata.price_breakdown = (0, _slotMerge.buildPriceBreakdown)({
1336
1353
  group: merged[0],
1337
1354
  productId: mapping.productId,
1338
- quotation: this.store.quotation
1355
+ quotation: this.store.quotation,
1356
+ channel: this.otherParams?.channel
1339
1357
  });
1340
1358
  }
1341
1359
  } else if (product.product_id != null) {
1342
1360
  const quotationPrice = this.store.quotation.getPriceForProduct({
1343
1361
  productId: product.product_id,
1344
1362
  variantId: product.product_variant_id ?? undefined,
1345
- datetime: now
1363
+ datetime: now,
1364
+ channel: this.otherParams?.channel
1346
1365
  });
1347
1366
  if (quotationPrice !== null) {
1348
1367
  product.selling_price = quotationPrice;
@@ -1550,7 +1569,8 @@ class VenueBookingImpl extends _BaseSales.BaseSalesImpl {
1550
1569
  const quotationPrice = this.store.quotation.getPriceForProduct({
1551
1570
  productId: product.product_id,
1552
1571
  variantId: product.product_variant_id ?? undefined,
1553
- datetime: (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss')
1572
+ datetime: (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss'),
1573
+ channel: this.otherParams?.channel
1554
1574
  });
1555
1575
  if (quotationPrice !== null) {
1556
1576
  product.selling_price = quotationPrice;
@@ -7,5 +7,6 @@ export declare function buildDateRangeSummary(params: {
7
7
  rawResources: VenueResourceRawData[];
8
8
  resourceProductMap: Map<number | string, ResourceProductMapping[]>;
9
9
  quotationModule?: QuotationModule;
10
+ channel?: string;
10
11
  resolveConfig?: (date: string) => VenueBookingSlotConfig;
11
12
  }): VenueDateSummaryItem[];
@@ -15,6 +15,7 @@ function buildDateRangeSummary(params) {
15
15
  rawResources,
16
16
  resourceProductMap,
17
17
  quotationModule,
18
+ channel,
18
19
  resolveConfig
19
20
  } = params;
20
21
  const result = [];
@@ -30,7 +31,8 @@ function buildDateRangeSummary(params) {
30
31
  const timePoints = timeLabels.map(label => `${date} ${label}`);
31
32
  quotationPriceMap = quotationModule.buildProductPriceMap({
32
33
  productIds,
33
- timePoints
34
+ timePoints,
35
+ channel
34
36
  });
35
37
  }
36
38
  const grid = (0, _timeSlot.buildTimeSlotGrid)({
@@ -5,10 +5,12 @@ export declare function mergeConsecutiveSlots(slots: VenueSlotSelection[]): Merg
5
5
  export declare function buildPriceBreakdown(params: {
6
6
  group: MergedSlotGroup;
7
7
  productId: number;
8
+ channel?: string;
8
9
  quotation?: {
9
10
  getQuotationShelfId: (p: {
10
11
  productId: number;
11
12
  datetime: string;
13
+ channel?: string;
12
14
  }) => number;
13
15
  };
14
16
  }): PriceBreakdownEntry[];
@@ -57,6 +57,7 @@ function buildPriceBreakdown(params) {
57
57
  const {
58
58
  group,
59
59
  productId,
60
+ channel,
60
61
  quotation
61
62
  } = params;
62
63
  if (!group.slots.length) return [];
@@ -65,7 +66,8 @@ function buildPriceBreakdown(params) {
65
66
  const unitPrice = Number(slot.price || '0');
66
67
  const shelfId = quotation ? quotation.getQuotationShelfId({
67
68
  productId,
68
- datetime: slot.startTime
69
+ datetime: slot.startTime,
70
+ channel
69
71
  }) : 0;
70
72
  const startHm = (0, _dayjs.default)(slot.startTime, 'YYYY-MM-DD HH:mm').format('YYYY-MM-DD HH:mm');
71
73
  const endHm = (0, _dayjs.default)(slot.endTime, 'YYYY-MM-DD HH:mm').format('YYYY-MM-DD HH:mm');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.82",
4
+ "version": "2.3.84",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",