@pisell/pisellos 2.2.205 → 2.2.207

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 (44) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/index.d.ts +1 -0
  3. package/dist/modules/OpenData/index.js +21 -16
  4. package/dist/modules/Order/index.d.ts +9 -0
  5. package/dist/modules/Order/index.js +230 -145
  6. package/dist/modules/Order/types.d.ts +10 -0
  7. package/dist/modules/Order/utils.js +7 -5
  8. package/dist/server/index.d.ts +136 -0
  9. package/dist/server/index.js +2055 -781
  10. package/dist/server/modules/order/index.d.ts +7 -0
  11. package/dist/server/modules/order/index.js +375 -337
  12. package/dist/server/modules/order/types.d.ts +15 -0
  13. package/dist/server/modules/order/types.js +8 -0
  14. package/dist/server/utils/small-ticket.d.ts +69 -0
  15. package/dist/server/utils/small-ticket.js +528 -0
  16. package/dist/solution/BaseSales/index.d.ts +4 -2
  17. package/dist/solution/BaseSales/index.js +248 -188
  18. package/dist/solution/BookingByStep/index.d.ts +1 -1
  19. package/dist/solution/BookingTicket/index.d.ts +8 -1
  20. package/dist/solution/BookingTicket/index.js +443 -263
  21. package/dist/solution/BookingTicket/types.d.ts +2 -1
  22. package/dist/solution/BookingTicket/types.js +3 -1
  23. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  24. package/lib/modules/OpenData/index.d.ts +1 -0
  25. package/lib/modules/OpenData/index.js +6 -4
  26. package/lib/modules/Order/index.d.ts +9 -0
  27. package/lib/modules/Order/index.js +59 -3
  28. package/lib/modules/Order/types.d.ts +10 -0
  29. package/lib/modules/Order/utils.js +4 -3
  30. package/lib/server/index.d.ts +136 -0
  31. package/lib/server/index.js +823 -50
  32. package/lib/server/modules/order/index.d.ts +7 -0
  33. package/lib/server/modules/order/index.js +21 -7
  34. package/lib/server/modules/order/types.d.ts +15 -0
  35. package/lib/server/utils/small-ticket.d.ts +69 -0
  36. package/lib/server/utils/small-ticket.js +555 -0
  37. package/lib/solution/BaseSales/index.d.ts +4 -2
  38. package/lib/solution/BaseSales/index.js +47 -1
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/lib/solution/BookingTicket/index.d.ts +8 -1
  41. package/lib/solution/BookingTicket/index.js +108 -1
  42. package/lib/solution/BookingTicket/types.d.ts +2 -1
  43. package/lib/solution/BookingTicket/types.js +5 -0
  44. package/package.json +1 -1
@@ -0,0 +1,9 @@
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";
@@ -9,6 +9,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
9
9
  protected defaultVersion: string;
10
10
  private request;
11
11
  private window;
12
+ private appPlugin;
12
13
  private store;
13
14
  private cacheId;
14
15
  private openCache;
@@ -30,6 +30,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
30
30
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
31
31
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
32
32
  _defineProperty(_assertThisInitialized(_this), "window", void 0);
33
+ _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
33
34
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
34
35
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
35
36
  _defineProperty(_assertThisInitialized(_this), "openCache", false);
@@ -60,20 +61,21 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
60
61
  }
61
62
  this.request = core.getPlugin('request');
62
63
  this.window = core.getPlugin('window');
64
+ this.appPlugin = core.getPlugin('app');
63
65
  if (this.request) {
64
- _context.next = 11;
66
+ _context.next = 12;
65
67
  break;
66
68
  }
67
69
  throw new Error('OpenDataModule 需要 request 插件支持');
68
- case 11:
70
+ case 12:
69
71
  if (this.window) {
70
- _context.next = 13;
72
+ _context.next = 14;
71
73
  break;
72
74
  }
73
75
  throw new Error('OpenDataModule 需要 window 插件支持');
74
- case 13:
75
- console.log('[OpenDataModule] 初始化完成');
76
76
  case 14:
77
+ console.log('[OpenDataModule] 初始化完成');
78
+ case 15:
77
79
  case "end":
78
80
  return _context.stop();
79
81
  }
@@ -88,43 +90,46 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
88
90
  key: "fetchOpenData",
89
91
  value: function () {
90
92
  var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
91
- var _this$otherParams, _this$otherParams$get, _this$otherParams2, _this$otherParams2$ge;
92
- var shopId, tenantId, headers, response, data;
93
+ var _this$appPlugin$getDa, _this$appPlugin;
94
+ var getData, shopId, tenantId, headers, response, data;
93
95
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
94
96
  while (1) switch (_context2.prev = _context2.next) {
95
97
  case 0:
96
- shopId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 || (_this$otherParams$get = _this$otherParams.getStateData) === null || _this$otherParams$get === void 0 ? void 0 : _this$otherParams$get.call(_this$otherParams, 'shop_id');
98
+ getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
99
+ shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
97
100
  if (shopId) {
98
- _context2.next = 3;
101
+ _context2.next = 4;
99
102
  break;
100
103
  }
101
104
  throw new Error('[OpenDataModule] 无法获取 shop_id');
102
- case 3:
103
- tenantId = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 || (_this$otherParams2$ge = _this$otherParams2.getStateData) === null || _this$otherParams2$ge === void 0 ? void 0 : _this$otherParams2$ge.call(_this$otherParams2, 'tenant_id');
105
+ case 4:
106
+ tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
104
107
  headers = {};
105
108
  if (tenantId) headers['Tenant-Id'] = String(tenantId);
106
- _context2.next = 8;
109
+ _context2.next = 9;
107
110
  return this.request.post("/open/my-pisell/".concat(shopId, "/setting"), {
108
111
  scope: params.scope,
109
112
  target: params.target,
110
113
  section_code: params.section_code
111
114
  }, {
112
115
  pisell2: true,
116
+ isPisell2: true,
117
+ prefix: false,
113
118
  headers: headers
114
119
  });
115
- case 8:
120
+ case 9:
116
121
  response = _context2.sent;
117
122
  if (!((response === null || response === void 0 ? void 0 : response.status) === false)) {
118
- _context2.next = 11;
123
+ _context2.next = 12;
119
124
  break;
120
125
  }
121
126
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取 OpenData 配置失败');
122
- case 11:
127
+ case 12:
123
128
  data = (response === null || response === void 0 ? void 0 : response.data) || {};
124
129
  this.store.data = data;
125
130
  this.store.lastFetchedAt = Date.now();
126
131
  return _context2.abrupt("return", data);
127
- case 15:
132
+ case 16:
128
133
  case "end":
129
134
  return _context2.stop();
130
135
  }
@@ -149,6 +149,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
149
149
  private updateTempOrderPaymentStatus;
150
150
  private shouldKeepPaymentStatusAfterAmountRecalc;
151
151
  private resolveWalletPassUseValue;
152
+ private adjustVoucherFundRecord;
152
153
  private capVoucherPaymentsByRemainingAmount;
153
154
  private calculatePaidPaymentSummary;
154
155
  private calculatePaymentServiceFee;
@@ -300,6 +301,14 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
300
301
  * 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
301
302
  */
302
303
  clearOrderCartLines(): Promise<OrderTempOrder>;
304
+ buildCurrentSubmitPayloadForLocalPrint(params?: {
305
+ cacheId?: string;
306
+ platform?: string;
307
+ businessCode?: string;
308
+ channel?: string;
309
+ type?: string;
310
+ }): import("./types").OrderSubmitPayload;
311
+ applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
303
312
  /**
304
313
  * 提交当前 Sales tempOrder。
305
314
  *