@pisell/pisellos 0.0.319 → 0.0.321

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.
@@ -14,6 +14,8 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
14
14
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
15
  setDiscountList(discountList: Discount[]): Promise<void>;
16
16
  getDiscountList(): Discount[];
17
+ setOriginalDiscountList(originalDiscountList: Discount[]): Promise<void>;
18
+ getOriginalDiscountList(): Discount[];
17
19
  loadPrepareConfig(params: {
18
20
  action?: 'create';
19
21
  with_good_pass: 0 | 1;
@@ -46,7 +46,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
46
46
  key: "initialize",
47
47
  value: function () {
48
48
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
49
- var _options$initialState, _options$otherParams, _options$otherParams2;
49
+ var _options$initialState, _options$initialState2, _options$otherParams, _options$otherParams2;
50
50
  return _regeneratorRuntime().wrap(function _callee$(_context) {
51
51
  while (1) switch (_context.prev = _context.next) {
52
52
  case 0:
@@ -57,6 +57,11 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
57
57
  } else {
58
58
  this.store.discountList = [];
59
59
  }
60
+ if (Array.isArray(options === null || options === void 0 || (_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.originalDiscountList)) {
61
+ this.store.originalDiscountList = options === null || options === void 0 ? void 0 : options.initialState.originalDiscountList;
62
+ } else {
63
+ this.store.originalDiscountList = [];
64
+ }
60
65
  if (options !== null && options !== void 0 && (_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
61
66
  this.openCache = options.otherParams.openCache;
62
67
  this.cacheId = options.otherParams.cacheId;
@@ -69,17 +74,17 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
69
74
  this.request = core.getPlugin('request');
70
75
  this.window = core.getPlugin('window');
71
76
  if (this.request) {
72
- _context.next = 9;
77
+ _context.next = 10;
73
78
  break;
74
79
  }
75
80
  throw new Error('discount模块需要 request 插件支持');
76
- case 9:
81
+ case 10:
77
82
  if (this.window) {
78
- _context.next = 11;
83
+ _context.next = 12;
79
84
  break;
80
85
  }
81
86
  throw new Error('discount模块需要 window 插件支持');
82
- case 11:
87
+ case 12:
83
88
  case "end":
84
89
  return _context.stop();
85
90
  }
@@ -116,28 +121,54 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
116
121
  value: function getDiscountList() {
117
122
  return this.store.discountList;
118
123
  }
124
+
125
+ // 设置原始优惠券列表
126
+ }, {
127
+ key: "setOriginalDiscountList",
128
+ value: function () {
129
+ var _setOriginalDiscountList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(originalDiscountList) {
130
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
131
+ while (1) switch (_context3.prev = _context3.next) {
132
+ case 0:
133
+ this.store.originalDiscountList = originalDiscountList;
134
+ case 1:
135
+ case "end":
136
+ return _context3.stop();
137
+ }
138
+ }, _callee3, this);
139
+ }));
140
+ function setOriginalDiscountList(_x4) {
141
+ return _setOriginalDiscountList.apply(this, arguments);
142
+ }
143
+ return setOriginalDiscountList;
144
+ }() // 获取原始优惠券列表
145
+ }, {
146
+ key: "getOriginalDiscountList",
147
+ value: function getOriginalDiscountList() {
148
+ return this.store.originalDiscountList || [];
149
+ }
119
150
  }, {
120
151
  key: "loadPrepareConfig",
121
152
  value: function () {
122
- var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
153
+ var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
123
154
  var _prepareConfig$data, _prepareConfig$data2;
124
155
  var prepareConfig, goodPassList;
125
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
126
- while (1) switch (_context3.prev = _context3.next) {
156
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
157
+ while (1) switch (_context4.prev = _context4.next) {
127
158
  case 0:
128
- _context3.next = 2;
159
+ _context4.next = 2;
129
160
  return this.request.post("/order/prepare/config", params);
130
161
  case 2:
131
- prepareConfig = _context3.sent;
162
+ prepareConfig = _context4.sent;
132
163
  goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || []; // this.setDiscountList(goodPassList);
133
- return _context3.abrupt("return", goodPassList);
164
+ return _context4.abrupt("return", goodPassList);
134
165
  case 5:
135
166
  case "end":
136
- return _context3.stop();
167
+ return _context4.stop();
137
168
  }
138
- }, _callee3, this);
169
+ }, _callee4, this);
139
170
  }));
140
- function loadPrepareConfig(_x4) {
171
+ function loadPrepareConfig(_x5) {
141
172
  return _loadPrepareConfig.apply(this, arguments);
142
173
  }
143
174
  return loadPrepareConfig;
@@ -145,12 +176,12 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
145
176
  }, {
146
177
  key: "batchSearch",
147
178
  value: function () {
148
- var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(code, customerId) {
179
+ var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
149
180
  var result, resultDiscountList;
150
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
151
- while (1) switch (_context4.prev = _context4.next) {
181
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
182
+ while (1) switch (_context5.prev = _context5.next) {
152
183
  case 0:
153
- _context4.next = 2;
184
+ _context5.next = 2;
154
185
  return this.request.get("/machinecode/batch-search", {
155
186
  code: code,
156
187
  translate_flag: 1,
@@ -162,16 +193,16 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
162
193
  order_behavior_count_customer_id: customerId || 1
163
194
  });
164
195
  case 2:
165
- result = _context4.sent;
196
+ result = _context5.sent;
166
197
  resultDiscountList = this.filterEnabledDiscountList((result === null || result === void 0 ? void 0 : result.data) || []) || [];
167
- return _context4.abrupt("return", resultDiscountList);
198
+ return _context5.abrupt("return", resultDiscountList);
168
199
  case 5:
169
200
  case "end":
170
- return _context4.stop();
201
+ return _context5.stop();
171
202
  }
172
- }, _callee4, this);
203
+ }, _callee5, this);
173
204
  }));
174
- function batchSearch(_x5, _x6) {
205
+ function batchSearch(_x6, _x7) {
175
206
  return _batchSearch.apply(this, arguments);
176
207
  }
177
208
  return batchSearch;
@@ -276,21 +307,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
276
307
  }, {
277
308
  key: "destroy",
278
309
  value: function () {
279
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
280
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
281
- while (1) switch (_context5.prev = _context5.next) {
310
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
311
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
312
+ while (1) switch (_context6.prev = _context6.next) {
282
313
  case 0:
283
314
  this.store.discountList = [];
284
315
  this.core.effects.offByModuleDestroy(this.name);
285
- _context5.next = 4;
316
+ _context6.next = 4;
286
317
  return this.core.effects.emit(DiscountHooks.OnDestroy, {});
287
318
  case 4:
288
319
  console.log('[Discount] 已销毁');
289
320
  case 5:
290
321
  case "end":
291
- return _context5.stop();
322
+ return _context6.stop();
292
323
  }
293
- }, _callee5, this);
324
+ }, _callee6, this);
294
325
  }));
295
326
  function destroy() {
296
327
  return _destroy.apply(this, arguments);
@@ -300,17 +331,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
300
331
  }, {
301
332
  key: "clear",
302
333
  value: function () {
303
- var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
304
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
305
- while (1) switch (_context6.prev = _context6.next) {
334
+ var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
335
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
336
+ while (1) switch (_context7.prev = _context7.next) {
306
337
  case 0:
307
338
  this.store.discountList = [];
339
+ this.store.originalDiscountList = [];
308
340
  console.log('[Discount] clear');
309
- case 2:
341
+ case 3:
310
342
  case "end":
311
- return _context6.stop();
343
+ return _context7.stop();
312
344
  }
313
- }, _callee6, this);
345
+ }, _callee7, this);
314
346
  }));
315
347
  function clear() {
316
348
  return _clear.apply(this, arguments);
@@ -72,6 +72,7 @@ export interface Discount {
72
72
  format_title: Formattitle;
73
73
  metadata?: {
74
74
  discount_card_type?: 'fixed_amount' | 'percent';
75
+ validity_type?: "custom_schedule_validity" | "fixed_validity";
75
76
  };
76
77
  product: Product;
77
78
  type: "product" | 'good_pass';
@@ -98,9 +99,13 @@ export interface Discount {
98
99
  week_order_behavior_count?: number;
99
100
  month_order_behavior_count?: number;
100
101
  customer_order_behavior_count?: number;
102
+ custom_schedule_snapshot?: {
103
+ data: any[];
104
+ };
101
105
  }
102
106
  export interface DiscountState {
103
107
  discountList: Discount[];
108
+ originalDiscountList?: Discount[];
104
109
  }
105
110
  export interface DiscountModuleAPI {
106
111
  setDiscountList: (discountList: Discount[]) => Promise<void>;
@@ -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
  }
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
111
111
  * 获取当前的客户搜索条件
112
112
  * @returns 当前搜索条件
113
113
  */
114
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
114
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
115
115
  /**
116
116
  * 获取客户列表状态(包含滚动加载相关状态)
117
117
  * @returns 客户状态
@@ -310,6 +310,10 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
310
310
  * 计算剩余未支付金额(从 Payment 模块获取最新数据)
311
311
  */
312
312
  private calculateRemainingAmountAsync;
313
+ /**
314
+ * 计算剩余未支付金额(排除定金计算,始终使用订单总金额)
315
+ */
316
+ private calculateRemainingTotalAmountAsync;
313
317
  /**
314
318
  * 更新 balanceDueAmount 为当前剩余未支付金额(系统内部计算)
315
319
  */