@pisell/pisellos 2.2.227 → 2.2.228

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -175,6 +175,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
175
175
  private buildProductStructuralFingerprintItem;
176
176
  private buildOrderProductsStructuralFingerprint;
177
177
  private getOriginalSalesSnapshot;
178
+ private isSnapshotPayableAmountUnchanged;
178
179
  private restoreOriginalSnapshotIfProductsUnchanged;
179
180
  private clearPersistedAmountFieldsForFullRecalc;
180
181
  private getPaymentTargetAmount;
@@ -1688,6 +1688,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1688
1688
  if (typeof snapshot.productFingerprint !== 'string') return null;
1689
1689
  return snapshot;
1690
1690
  }
1691
+ }, {
1692
+ key: "isSnapshotPayableAmountUnchanged",
1693
+ value: function isSnapshotPayableAmountUnchanged(tempOrder, snapshot, snapshotSummary) {
1694
+ var currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1695
+ var currentAmountGap = this.calculateSummaryAmountGap({
1696
+ tempOrder: tempOrder,
1697
+ summary: snapshotSummary,
1698
+ orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
1699
+ });
1700
+ var snapshotPaidPaymentSummary = this.calculatePaidPaymentSummary(Array.isArray(snapshot.payments) ? snapshot.payments : []);
1701
+ var snapshotAmountGap = this.calculateSummaryAmountGap({
1702
+ tempOrder: tempOrder,
1703
+ summary: snapshotSummary,
1704
+ orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount
1705
+ });
1706
+ return currentAmountGap === snapshotAmountGap;
1707
+ }
1691
1708
  }, {
1692
1709
  key: "restoreOriginalSnapshotIfProductsUnchanged",
1693
1710
  value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder) {
@@ -1700,6 +1717,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1700
1717
  if (currentStructuralFingerprint !== snapshotStructuralFingerprint) return null;
1701
1718
  }
1702
1719
  var summary = _objectSpread(_objectSpread({}, createEmptySummary()), cloneDeep(snapshot.summary || {}));
1720
+ if (!this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary)) return null;
1703
1721
  if (Array.isArray(snapshot.products)) {
1704
1722
  tempOrder.products = cloneDeep(snapshot.products);
1705
1723
  }
@@ -3097,7 +3115,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3097
3115
  return _regeneratorRuntime().wrap(function _callee16$(_context18) {
3098
3116
  while (1) switch (_context18.prev = _context18.next) {
3099
3117
  case 0:
3100
- tempOrder = this.ensureTempOrder();
3118
+ tempOrder = this.ensureTempOrder(); // TODO note 改对象
3101
3119
  if (!booking) {
3102
3120
  _context18.next = 18;
3103
3121
  break;
@@ -3722,6 +3740,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3722
3740
  var enhancedPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(nextPayload, ctx) : nextPayload;
3723
3741
  return enhancedPayload;
3724
3742
  } : undefined;
3743
+ debugger;
3725
3744
  payload = buildSubmitPayload({
3726
3745
  tempOrder: tempOrder,
3727
3746
  cacheId: effectiveCacheId,
@@ -3735,10 +3754,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3735
3754
  if (!payload.created_at) {
3736
3755
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
3737
3756
  }
3738
- _context26.next = 20;
3757
+ _context26.next = 21;
3739
3758
  return this.saveDraft();
3740
- case 20:
3741
- _context26.prev = 20;
3759
+ case 21:
3760
+ _context26.prev = 21;
3742
3761
  this.logInfo('submitTempOrder calling sales checkout', {
3743
3762
  orderId: payload.order_id,
3744
3763
  externalSaleNumber: payload.external_sale_number,
@@ -3747,26 +3766,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3747
3766
  paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
3748
3767
  smallTicketDataFlag: payload.small_ticket_data_flag
3749
3768
  });
3750
- _context26.next = 24;
3769
+ _context26.next = 25;
3751
3770
  return this.submitSalesOrder({
3752
3771
  query: payload
3753
3772
  });
3754
- case 24:
3773
+ case 25:
3755
3774
  result = _context26.sent;
3756
- _context26.next = 37;
3775
+ _context26.next = 38;
3757
3776
  break;
3758
- case 27:
3759
- _context26.prev = 27;
3760
- _context26.t2 = _context26["catch"](20);
3777
+ case 28:
3778
+ _context26.prev = 28;
3779
+ _context26.t2 = _context26["catch"](21);
3761
3780
  backendErrorResponse = this.extractSubmitErrorResponse(_context26.t2);
3762
3781
  if (!backendErrorResponse) {
3763
- _context26.next = 34;
3782
+ _context26.next = 35;
3764
3783
  break;
3765
3784
  }
3766
3785
  this.store.syncState = 'failed';
3767
3786
  this.logSubmitBackendRejected(backendErrorResponse, payload);
3768
3787
  return _context26.abrupt("return", backendErrorResponse);
3769
- case 34:
3788
+ case 35:
3770
3789
  this.store.syncState = 'failed';
3771
3790
  this.logError('submitTempOrder failed', {
3772
3791
  error: _context26.t2 instanceof Error ? _context26.t2.message : String(_context26.t2),
@@ -3776,40 +3795,40 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3776
3795
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
3777
3796
  });
3778
3797
  throw _context26.t2;
3779
- case 37:
3798
+ case 38:
3780
3799
  if (!this.isSubmitResponseRejected(result)) {
3781
- _context26.next = 41;
3800
+ _context26.next = 42;
3782
3801
  break;
3783
3802
  }
3784
3803
  this.store.syncState = 'failed';
3785
3804
  this.logSubmitBackendRejected(result, payload);
3786
3805
  return _context26.abrupt("return", result);
3787
- case 41:
3806
+ case 42:
3788
3807
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
3789
3808
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
3790
- _context26.next = 49;
3809
+ _context26.next = 50;
3791
3810
  break;
3792
3811
  }
3793
3812
  tempOrder.order_id = submittedOrderId;
3794
3813
  resultRecord = result;
3795
- _context26.next = 47;
3814
+ _context26.next = 48;
3796
3815
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
3797
- case 47:
3798
- _context26.next = 50;
3816
+ case 48:
3817
+ _context26.next = 51;
3799
3818
  break;
3800
- case 49:
3819
+ case 50:
3801
3820
  if (this.isLocalPendingSubmitResult(result)) {
3802
3821
  this.store.syncState = 'local';
3803
3822
  } else {
3804
3823
  this.store.syncState = 'submitted';
3805
3824
  }
3806
- case 50:
3807
- return _context26.abrupt("return", result);
3808
3825
  case 51:
3826
+ return _context26.abrupt("return", result);
3827
+ case 52:
3809
3828
  case "end":
3810
3829
  return _context26.stop();
3811
3830
  }
3812
- }, _callee24, this, [[20, 27]]);
3831
+ }, _callee24, this, [[21, 28]]);
3813
3832
  }));
3814
3833
  function submitTempOrder(_x26) {
3815
3834
  return _submitTempOrder.apply(this, arguments);
@@ -4404,11 +4423,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4404
4423
  });
4405
4424
  case 6:
4406
4425
  res = _context35.sent;
4426
+ debugger;
4407
4427
  if (res.code === 200) {
4408
4428
  this.store.lastOrderInfo = res.data;
4409
4429
  }
4410
4430
  return _context35.abrupt("return", res);
4411
- case 9:
4431
+ case 10:
4412
4432
  case "end":
4413
4433
  return _context35.stop();
4414
4434
  }
@@ -2719,6 +2719,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2719
2719
  params = {
2720
2720
  product_id: identity.product_id,
2721
2721
  product_variant_id: identity.product_variant_id,
2722
+ // TODO: 改成对象
2722
2723
  updates: {
2723
2724
  note: String(note || '')
2724
2725
  }
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 6 | 4 | 5;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -312,7 +312,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
312
312
  * 获取当前的客户搜索条件
313
313
  * @returns 当前搜索条件
314
314
  */
315
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
315
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
316
316
  /**
317
317
  * 获取客户列表状态(包含滚动加载相关状态)
318
318
  * @returns 客户状态
@@ -801,19 +801,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
801
801
  }
802
802
  throw new Error('refreshSalesDetail: tempOrder 未加载');
803
803
  case 4:
804
- orderId = tempOrder.order_id;
804
+ debugger;
805
+ orderId = tempOrder.order_id || tempOrder.external_sale_number;
805
806
  if (!(orderId === undefined || orderId === null)) {
806
- _context11.next = 7;
807
+ _context11.next = 8;
807
808
  break;
808
809
  }
809
810
  return _context11.abrupt("return", {});
810
- case 7:
811
+ case 8:
811
812
  return _context11.abrupt("return", this.loadSalesDetail({
812
- orderId: Number(orderId),
813
+ orderId: orderId,
813
814
  // merge: true
814
815
  forceRemote: params.forceRemote
815
816
  }));
816
- case 8:
817
+ case 9:
817
818
  case "end":
818
819
  return _context11.stop();
819
820
  }
@@ -175,6 +175,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
175
175
  private buildProductStructuralFingerprintItem;
176
176
  private buildOrderProductsStructuralFingerprint;
177
177
  private getOriginalSalesSnapshot;
178
+ private isSnapshotPayableAmountUnchanged;
178
179
  private restoreOriginalSnapshotIfProductsUnchanged;
179
180
  private clearPersistedAmountFieldsForFullRecalc;
180
181
  private getPaymentTargetAmount;
@@ -1185,6 +1185,23 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1185
1185
  return null;
1186
1186
  return snapshot;
1187
1187
  }
1188
+ isSnapshotPayableAmountUnchanged(tempOrder, snapshot, snapshotSummary) {
1189
+ const currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
1190
+ const currentAmountGap = this.calculateSummaryAmountGap({
1191
+ tempOrder,
1192
+ summary: snapshotSummary,
1193
+ orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
1194
+ });
1195
+ const snapshotPaidPaymentSummary = this.calculatePaidPaymentSummary(
1196
+ Array.isArray(snapshot.payments) ? snapshot.payments : []
1197
+ );
1198
+ const snapshotAmountGap = this.calculateSummaryAmountGap({
1199
+ tempOrder,
1200
+ summary: snapshotSummary,
1201
+ orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount
1202
+ });
1203
+ return currentAmountGap === snapshotAmountGap;
1204
+ }
1188
1205
  restoreOriginalSnapshotIfProductsUnchanged(tempOrder) {
1189
1206
  const snapshot = this.getOriginalSalesSnapshot(tempOrder);
1190
1207
  if (!snapshot)
@@ -1202,6 +1219,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1202
1219
  ...(0, import_utils.createEmptySummary)(),
1203
1220
  ...(0, import_lodash_es.cloneDeep)(snapshot.summary || {})
1204
1221
  };
1222
+ if (!this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary))
1223
+ return null;
1205
1224
  if (Array.isArray(snapshot.products)) {
1206
1225
  tempOrder.products = (0, import_lodash_es.cloneDeep)(snapshot.products);
1207
1226
  }
@@ -2742,6 +2761,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2742
2761
  const enhancedPayload = (params == null ? void 0 : params.enhancePayload) ? params.enhancePayload(nextPayload, ctx) : nextPayload;
2743
2762
  return enhancedPayload;
2744
2763
  } : void 0;
2764
+ debugger;
2745
2765
  const payload = (0, import_utils.buildSubmitPayload)({
2746
2766
  tempOrder,
2747
2767
  cacheId: effectiveCacheId,
@@ -3185,6 +3205,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3185
3205
  with: ["products", "bookings", "payments", "customer", "summary", "contacts_info"],
3186
3206
  ...params.forceRemote ? { forceRemote: true } : {}
3187
3207
  }, { osServer: true });
3208
+ debugger;
3188
3209
  if (res.code === 200) {
3189
3210
  this.store.lastOrderInfo = res.data;
3190
3211
  }
@@ -1721,6 +1721,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1721
1721
  const params = {
1722
1722
  product_id: identity.product_id,
1723
1723
  product_variant_id: identity.product_variant_id,
1724
+ // TODO: 改成对象
1724
1725
  updates: { note: String(note || "") }
1725
1726
  };
1726
1727
  if (identity.unique_identification_number !== void 0) {
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 3 | 6 | 4 | 5;
314
+ weekNum: 0 | 2 | 1 | 6 | 3 | 4 | 5;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -312,7 +312,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
312
312
  * 获取当前的客户搜索条件
313
313
  * @returns 当前搜索条件
314
314
  */
315
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
315
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
316
316
  /**
317
317
  * 获取客户列表状态(包含滚动加载相关状态)
318
318
  * @returns 客户状态
@@ -471,12 +471,13 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
471
471
  if (!tempOrder) {
472
472
  throw new Error("refreshSalesDetail: tempOrder 未加载");
473
473
  }
474
- const orderId = tempOrder.order_id;
474
+ debugger;
475
+ const orderId = tempOrder.order_id || tempOrder.external_sale_number;
475
476
  if (orderId === void 0 || orderId === null) {
476
477
  return {};
477
478
  }
478
479
  return this.loadSalesDetail({
479
- orderId: Number(orderId),
480
+ orderId,
480
481
  // merge: true
481
482
  forceRemote: params.forceRemote
482
483
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.227",
4
+ "version": "2.2.228",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",