@pisell/pisellos 2.2.306 → 2.2.307

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.
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -105,6 +105,8 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
105
105
  private groupBookingsByResource;
106
106
  private isBookingMatchedResource;
107
107
  private sortMatchedBookings;
108
+ /** 已完成:按订单创建时间降序,避免实时追加和重新加载导致显示顺序不同。 */
109
+ private sortCompletedBookings;
108
110
  /** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
109
111
  private sortUnpaidBookings;
110
112
  /**
@@ -760,6 +760,20 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
760
760
  });
761
761
  }
762
762
 
763
+ /** 已完成:按订单创建时间降序,避免实时追加和重新加载导致显示顺序不同。 */
764
+ }, {
765
+ key: "sortCompletedBookings",
766
+ value: function sortCompletedBookings(bookings) {
767
+ var createdAt = function createdAt(booking) {
768
+ var _booking$order3;
769
+ var timestamp = dayjs(((_booking$order3 = booking.order) === null || _booking$order3 === void 0 ? void 0 : _booking$order3.created_at) || '').valueOf();
770
+ return Number.isFinite(timestamp) ? timestamp : 0;
771
+ };
772
+ return _toConsumableArray(bookings).sort(function (left, right) {
773
+ return createdAt(right) - createdAt(left);
774
+ });
775
+ }
776
+
763
777
  /** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
764
778
  }, {
765
779
  key: "sortUnpaidBookings",
@@ -1260,7 +1274,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
1260
1274
  bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
1261
1275
  includeAllFuture: true
1262
1276
  });
1263
- completedBookings = completedBookingList.map(function (booking) {
1277
+ completedBookings = this.sortCompletedBookings(completedBookingList).map(function (booking) {
1264
1278
  return _objectSpread(_objectSpread({}, booking), {}, {
1265
1279
  status: 'compelete',
1266
1280
  isTimeout: false,
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -105,6 +105,8 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
105
105
  private groupBookingsByResource;
106
106
  private isBookingMatchedResource;
107
107
  private sortMatchedBookings;
108
+ /** 已完成:按订单创建时间降序,避免实时追加和重新加载导致显示顺序不同。 */
109
+ private sortCompletedBookings;
108
110
  /** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
109
111
  private sortUnpaidBookings;
110
112
  /**
@@ -507,6 +507,15 @@ class SalesImpl extends _BaseModule.BaseModule {
507
507
  });
508
508
  }
509
509
 
510
+ /** 已完成:按订单创建时间降序,避免实时追加和重新加载导致显示顺序不同。 */
511
+ sortCompletedBookings(bookings) {
512
+ const createdAt = booking => {
513
+ const timestamp = (0, _dayjs.default)(booking.order?.created_at || '').valueOf();
514
+ return Number.isFinite(timestamp) ? timestamp : 0;
515
+ };
516
+ return [...bookings].sort((left, right) => createdAt(right) - createdAt(left));
517
+ }
518
+
510
519
  /** Unpaid:与 Current 重合的订单沿用 Current 顺序,其余欠款订单按开始时间降序追加。 */
511
520
  sortUnpaidBookings(bookings, currentBookings) {
512
521
  const currentOrderIndexes = new Map(currentBookings.map((booking, index) => [String(booking.order.order_id), index]));
@@ -881,7 +890,7 @@ class SalesImpl extends _BaseModule.BaseModule {
881
890
  const bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
882
891
  includeAllFuture: true
883
892
  });
884
- const completedBookings = completedBookingList.map(booking => {
893
+ const completedBookings = this.sortCompletedBookings(completedBookingList).map(booking => {
885
894
  return {
886
895
  ...booking,
887
896
  status: 'compelete',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.306",
4
+ "version": "2.2.307",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",