@pisell/pisellos 2.2.40 → 2.2.42

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.
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -25,6 +25,15 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
25
25
  setOtherProductsIds(ids: number[]): void;
26
26
  getOtherProductsIds(): number[];
27
27
  storeChange(): void;
28
+ /**
29
+ * 传入一个时间, 判断改时间是否在schedule 内
30
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
31
+ * @returns
32
+ */
33
+ isInScheduleByDate({ date, schedule, }: {
34
+ date: string;
35
+ schedule: any;
36
+ }): boolean | undefined;
28
37
  /**
29
38
  * 传入一个时间, 判断改时间是否在schedule 内
30
39
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -248,12 +248,28 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
248
248
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
249
249
  * @returns
250
250
  */
251
- }], [{
251
+ }, {
252
252
  key: "isInScheduleByDate",
253
253
  value: function isInScheduleByDate(_ref2) {
254
- var _schedule$repeat_rule, _schedule$repeat_rule2;
255
254
  var date = _ref2.date,
256
255
  schedule = _ref2.schedule;
256
+ return ScheduleModule.isInScheduleByDate({
257
+ date: date,
258
+ schedule: schedule
259
+ });
260
+ }
261
+
262
+ /**
263
+ * 传入一个时间, 判断改时间是否在schedule 内
264
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
265
+ * @returns
266
+ */
267
+ }], [{
268
+ key: "isInScheduleByDate",
269
+ value: function isInScheduleByDate(_ref3) {
270
+ var _schedule$repeat_rule, _schedule$repeat_rule2;
271
+ var date = _ref3.date,
272
+ schedule = _ref3.schedule;
257
273
  if (schedule.start_time && schedule.end_time) {
258
274
  var isBeforeStartTime = dayjs(date).isBefore(dayjs(schedule.start_time));
259
275
  var isAfterEndTime = dayjs(date).isAfter(dayjs(schedule.end_time));
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -1800,7 +1800,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1800
1800
  case 6:
1801
1801
  paymentItems = _context18.sent;
1802
1802
  if (!(!voucherPaymentItems || (voucherPaymentItems === null || voucherPaymentItems === void 0 ? void 0 : voucherPaymentItems.length) === 0)) {
1803
- _context18.next = 12;
1803
+ _context18.next = 13;
1804
1804
  break;
1805
1805
  }
1806
1806
  savedVoucherPaymentItems = (paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.filter(function (item) {
@@ -1811,22 +1811,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1811
1811
  savedVoucherPaymentItems: savedVoucherPaymentItems
1812
1812
  });
1813
1813
  if (!((savedVoucherPaymentItems === null || savedVoucherPaymentItems === void 0 ? void 0 : savedVoucherPaymentItems.length) === 0)) {
1814
- _context18.next = 12;
1814
+ _context18.next = 13;
1815
1815
  break;
1816
1816
  }
1817
+ this.updateStateAmountToRemaining(false);
1817
1818
  return _context18.abrupt("return");
1818
- case 12:
1819
+ case 13:
1819
1820
  allPaymentItemsSynced = paymentItems.every(function (item) {
1820
1821
  return item.isSynced;
1821
1822
  });
1822
- _context18.next = 15;
1823
+ _context18.next = 16;
1823
1824
  return this.calculateRemainingAmountAsync();
1824
- case 15:
1825
+ case 16:
1825
1826
  remainingAmount = _context18.sent;
1826
1827
  remainingValue = new Decimal(remainingAmount);
1827
1828
  isOrderSynced = this.store.isOrderSynced;
1828
1829
  if (!(remainingValue.lte(0) && isOrderSynced && voucherPaymentItems.length === 0 && allPaymentItemsSynced)) {
1829
- _context18.next = 21;
1830
+ _context18.next = 22;
1830
1831
  break;
1831
1832
  }
1832
1833
  this.logInfo('订单已同步且支付完成,跳过清空代金券操作避免重复同步:', {
@@ -1838,7 +1839,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1838
1839
  reason: 'Order synced and payment completed, skip clear vouchers to avoid duplicate sync'
1839
1840
  });
1840
1841
  return _context18.abrupt("return");
1841
- case 21:
1842
+ case 22:
1842
1843
  this.logInfo('开始批量更新代金券支付项:', {
1843
1844
  voucherPaymentItems: voucherPaymentItems
1844
1845
  });
@@ -1860,18 +1861,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1860
1861
  metadata: metadata
1861
1862
  });
1862
1863
  }); // 调用 Payment 模块的批量更新方法
1863
- _context18.next = 26;
1864
+ _context18.next = 27;
1864
1865
  return this.payment.updateVoucherPaymentItemsAsync(this.store.currentOrder.uuid, voucherPaymentItemsWithType);
1865
- case 26:
1866
+ case 27:
1866
1867
  // 🚀 清除计算缓存,确保获取最新数据
1867
1868
  this.clearCalculationCache();
1868
1869
 
1869
1870
  // 重新从Payment模块获取最新的订单数据,确保支付项同步
1870
1871
  currentOrderId = this.store.currentOrder.order_id; // 保存当前的订单ID
1871
1872
  isCurrentOrderReal = currentOrderId && !isVirtualOrderId(currentOrderId);
1872
- _context18.next = 31;
1873
+ _context18.next = 32;
1873
1874
  return this.payment.getPaymentOrderByUuidAsync(this.store.currentOrder.uuid);
1874
- case 31:
1875
+ case 32:
1875
1876
  updatedOrder = _context18.sent;
1876
1877
  if (updatedOrder) {
1877
1878
  // 如果当前订单ID是真实ID,但获取到的订单ID是虚拟ID,需要保护真实ID
@@ -1886,10 +1887,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1886
1887
  }
1887
1888
 
1888
1889
  // 更新 stateAmount 为剩余未支付金额
1889
- _context18.next = 35;
1890
+ _context18.next = 36;
1890
1891
  return this.updateStateAmountToRemaining(false);
1891
- case 35:
1892
- _context18.next = 37;
1892
+ case 36:
1893
+ _context18.next = 38;
1893
1894
  return this.core.effects.emit("".concat(this.name, ":onPaymentStarted"), {
1894
1895
  orderUuid: this.store.currentOrder.uuid,
1895
1896
  paymentMethodCode: 'VOUCHER_BATCH',
@@ -1898,23 +1899,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
1898
1899
  }, 0).toFixed(2),
1899
1900
  timestamp: Date.now()
1900
1901
  });
1901
- case 37:
1902
+ case 38:
1902
1903
  this.logInfo('代金券支付项批量更新成功');
1903
- _context18.next = 46;
1904
+ _context18.next = 47;
1904
1905
  break;
1905
- case 40:
1906
- _context18.prev = 40;
1906
+ case 41:
1907
+ _context18.prev = 41;
1907
1908
  _context18.t0 = _context18["catch"](0);
1908
1909
  this.logError('[Checkout] 批量更新代金券支付项失败:', _context18.t0);
1909
- _context18.next = 45;
1910
+ _context18.next = 46;
1910
1911
  return this.handleError(_context18.t0, CheckoutErrorType.PaymentFailed);
1911
- case 45:
1912
- throw _context18.t0;
1913
1912
  case 46:
1913
+ throw _context18.t0;
1914
+ case 47:
1914
1915
  case "end":
1915
1916
  return _context18.stop();
1916
1917
  }
1917
- }, _callee18, this, [[0, 40]]);
1918
+ }, _callee18, this, [[0, 41]]);
1918
1919
  }));
1919
1920
  function updateVoucherPaymentItemsAsync(_x18) {
1920
1921
  return _updateVoucherPaymentItemsAsync.apply(this, arguments);
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -25,6 +25,15 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
25
25
  setOtherProductsIds(ids: number[]): void;
26
26
  getOtherProductsIds(): number[];
27
27
  storeChange(): void;
28
+ /**
29
+ * 传入一个时间, 判断改时间是否在schedule 内
30
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
31
+ * @returns
32
+ */
33
+ isInScheduleByDate({ date, schedule, }: {
34
+ date: string;
35
+ schedule: any;
36
+ }): boolean | undefined;
28
37
  /**
29
38
  * 传入一个时间, 判断改时间是否在schedule 内
30
39
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -159,6 +159,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
159
159
  });
160
160
  }
161
161
  }
162
+ /**
163
+ * 传入一个时间, 判断改时间是否在schedule 内
164
+ * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
165
+ * @returns
166
+ */
167
+ isInScheduleByDate({
168
+ date,
169
+ schedule
170
+ }) {
171
+ return ScheduleModule.isInScheduleByDate({ date, schedule });
172
+ }
162
173
  /**
163
174
  * 传入一个时间, 判断改时间是否在schedule 内
164
175
  * @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
123
123
  * 获取当前的客户搜索条件
124
124
  * @returns 当前搜索条件
125
125
  */
126
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
126
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
127
127
  /**
128
128
  * 获取客户列表状态(包含滚动加载相关状态)
129
129
  * @returns 客户状态
@@ -1212,8 +1212,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
1212
1212
  voucherPaymentItems,
1213
1213
  savedVoucherPaymentItems
1214
1214
  });
1215
- if ((savedVoucherPaymentItems == null ? void 0 : savedVoucherPaymentItems.length) === 0)
1215
+ if ((savedVoucherPaymentItems == null ? void 0 : savedVoucherPaymentItems.length) === 0) {
1216
+ this.updateStateAmountToRemaining(false);
1216
1217
  return;
1218
+ }
1217
1219
  }
1218
1220
  const allPaymentItemsSynced = paymentItems.every((item) => item.isSynced);
1219
1221
  const remainingAmount = await this.calculateRemainingAmountAsync();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.40",
4
+ "version": "2.2.42",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",