@pisell/pisellos 2.3.17 → 2.3.19

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 (37) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Order/index.d.ts +4 -1
  3. package/dist/modules/Order/index.js +56 -29
  4. package/dist/modules/Order/types.d.ts +13 -0
  5. package/dist/modules/Product/index.d.ts +1 -1
  6. package/dist/modules/Rules/index.d.ts +2 -8
  7. package/dist/modules/Rules/index.js +55 -9
  8. package/dist/modules/Rules/types.d.ts +10 -1
  9. package/dist/modules/SalesSummary/index.d.ts +7 -3
  10. package/dist/modules/SalesSummary/index.js +67 -39
  11. package/dist/modules/SalesSummary/types.d.ts +1 -0
  12. package/dist/modules/SurchargeList/index.d.ts +6 -4
  13. package/dist/modules/SurchargeList/index.js +62 -39
  14. package/dist/modules/SurchargeList/types.d.ts +6 -2
  15. package/dist/server/modules/order/index.js +1 -2
  16. package/dist/solution/BaseSales/index.d.ts +6 -0
  17. package/dist/solution/BaseSales/index.js +782 -658
  18. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
  19. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  20. package/lib/modules/Order/index.d.ts +4 -1
  21. package/lib/modules/Order/index.js +39 -16
  22. package/lib/modules/Order/types.d.ts +13 -0
  23. package/lib/modules/Product/index.d.ts +1 -1
  24. package/lib/modules/Rules/index.d.ts +2 -8
  25. package/lib/modules/Rules/index.js +57 -6
  26. package/lib/modules/Rules/types.d.ts +10 -1
  27. package/lib/modules/SalesSummary/index.d.ts +7 -3
  28. package/lib/modules/SalesSummary/index.js +28 -11
  29. package/lib/modules/SalesSummary/types.d.ts +1 -0
  30. package/lib/modules/SurchargeList/index.d.ts +6 -4
  31. package/lib/modules/SurchargeList/index.js +41 -21
  32. package/lib/modules/SurchargeList/types.d.ts +6 -2
  33. package/lib/server/modules/order/index.js +1 -2
  34. package/lib/solution/BaseSales/index.d.ts +6 -0
  35. package/lib/solution/BaseSales/index.js +103 -29
  36. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +2 -1
  37. package/package.json +1 -1
@@ -30,6 +30,7 @@ var salesSummaryDataKeys = {
30
30
  taxTitle: 'tax_title',
31
31
  taxCountryCode: 'tax_country_code'
32
32
  };
33
+ var DEFAULT_SURCHARGE_CHANNEL = 'online-store';
33
34
  export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
34
35
  _inherits(SalesSummaryModule, _BaseModule);
35
36
  var _super = _createSuper(SalesSummaryModule);
@@ -43,13 +44,15 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
43
44
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
44
45
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
45
46
  _defineProperty(_assertThisInitialized(_this), "surchargeListModuleName", 'surchargeList');
47
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
48
+ _defineProperty(_assertThisInitialized(_this), "surchargeListChannel", DEFAULT_SURCHARGE_CHANNEL);
46
49
  return _this;
47
50
  }
48
51
  _createClass(SalesSummaryModule, [{
49
52
  key: "initialize",
50
53
  value: function () {
51
54
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
52
- var _options$initialState, _options$initialState2, _options$otherParams;
55
+ var _options$initialState, _options$initialState2, _this$otherParams;
53
56
  return _regeneratorRuntime().wrap(function _callee$(_context) {
54
57
  while (1) switch (_context.prev = _context.next) {
55
58
  case 0:
@@ -57,24 +60,25 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
57
60
  this.store = options.store;
58
61
  this.appPlugin = this.core.getPlugin('app');
59
62
  this.request = this.core.getPlugin('request');
63
+ this.otherParams = options.otherParams || {};
60
64
  this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
61
65
  this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
62
- this.surchargeListModuleName = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.surchargeListModuleName) || 'surchargeList';
66
+ this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
63
67
  if (this.appPlugin) {
64
- _context.next = 9;
68
+ _context.next = 10;
65
69
  break;
66
70
  }
67
71
  throw new Error('SalesSummaryModule 需要 app 插件支持');
68
- case 9:
72
+ case 10:
69
73
  if (this.request) {
70
- _context.next = 11;
74
+ _context.next = 12;
71
75
  break;
72
76
  }
73
77
  throw new Error('SalesSummaryModule 需要 request 插件支持');
74
- case 11:
75
- _context.next = 13;
78
+ case 12:
79
+ _context.next = 14;
76
80
  return this.getSurchargeList();
77
- case 13:
81
+ case 14:
78
82
  case "end":
79
83
  return _context.stop();
80
84
  }
@@ -86,30 +90,32 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
86
90
  return initialize;
87
91
  }()
88
92
  /**
89
- * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
93
+ * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名或渠道变化时刷新附加费列表。
90
94
  *
91
95
  * @example
92
- * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
96
+ * await salesSummaryModule.updateOtherParams({ channel: 'pos', surchargeListModuleName: 'custom_surchargeList' });
93
97
  */
94
98
  }, {
95
99
  key: "updateOtherParams",
96
100
  value: (function () {
97
101
  var _updateOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
98
- var nextSurchargeListModuleName;
102
+ var previousChannel, nextSurchargeListModuleName, nextChannel, shouldReload;
99
103
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
100
104
  while (1) switch (_context2.prev = _context2.next) {
101
105
  case 0:
106
+ previousChannel = this.resolveChannel();
102
107
  nextSurchargeListModuleName = (params === null || params === void 0 ? void 0 : params.surchargeListModuleName) || 'surchargeList';
103
- if (!(nextSurchargeListModuleName === this.surchargeListModuleName)) {
104
- _context2.next = 3;
108
+ nextChannel = this.resolveChannel(params);
109
+ shouldReload = nextSurchargeListModuleName !== this.surchargeListModuleName || nextChannel !== previousChannel;
110
+ this.otherParams = params || {};
111
+ this.surchargeListModuleName = nextSurchargeListModuleName;
112
+ if (!shouldReload) {
113
+ _context2.next = 9;
105
114
  break;
106
115
  }
107
- return _context2.abrupt("return");
108
- case 3:
109
- this.surchargeListModuleName = nextSurchargeListModuleName;
110
- _context2.next = 6;
111
- return this.getSurchargeList();
112
- case 6:
116
+ _context2.next = 9;
117
+ return this.getSurchargeList(nextChannel);
118
+ case 9:
113
119
  case "end":
114
120
  return _context2.stop();
115
121
  }
@@ -120,49 +126,63 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
120
126
  }
121
127
  return updateOtherParams;
122
128
  }())
129
+ }, {
130
+ key: "resolveChannel",
131
+ value: function resolveChannel() {
132
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.otherParams;
133
+ return (params === null || params === void 0 ? void 0 : params.channel) || DEFAULT_SURCHARGE_CHANNEL;
134
+ }
123
135
  }, {
124
136
  key: "getSurchargeList",
125
137
  value: function () {
126
138
  var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
127
- var surchargeListModule, surchargeList;
139
+ var channel,
140
+ surchargeListModule,
141
+ surchargeList,
142
+ _args3 = arguments;
128
143
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
129
144
  while (1) switch (_context3.prev = _context3.next) {
130
145
  case 0:
131
- _context3.prev = 0;
146
+ channel = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : this.resolveChannel();
147
+ _context3.prev = 1;
132
148
  surchargeListModule = this.core.getModule(this.surchargeListModuleName);
133
149
  if (!(surchargeListModule !== null && surchargeListModule !== void 0 && surchargeListModule.getSurchargeList)) {
134
- _context3.next = 7;
150
+ _context3.next = 9;
135
151
  break;
136
152
  }
137
- _context3.next = 5;
138
- return surchargeListModule.getSurchargeList();
139
- case 5:
153
+ _context3.next = 6;
154
+ return surchargeListModule.getSurchargeList({
155
+ channel: channel
156
+ });
157
+ case 6:
140
158
  this.store.surchargeList = _context3.sent;
159
+ this.surchargeListChannel = channel;
141
160
  return _context3.abrupt("return");
142
- case 7:
143
- _context3.next = 9;
161
+ case 9:
162
+ _context3.next = 11;
144
163
  return this.request.get('/order/custom-surcharge/available/v2', {
145
- // TODO 真实的渠道
146
- channel: 'online-store',
164
+ channel: channel,
147
165
  is_assemble_product_data: 1,
148
166
  is_assemble_schedule_data: 1,
149
167
  with: ['relationSchedule']
150
168
  });
151
- case 9:
169
+ case 11:
152
170
  surchargeList = _context3.sent;
153
171
  this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
154
- _context3.next = 17;
172
+ this.surchargeListChannel = channel;
173
+ _context3.next = 21;
155
174
  break;
156
- case 13:
157
- _context3.prev = 13;
158
- _context3.t0 = _context3["catch"](0);
175
+ case 16:
176
+ _context3.prev = 16;
177
+ _context3.t0 = _context3["catch"](1);
159
178
  console.warn('[SalesSummaryModule] 加载附加费配置失败', _context3.t0);
160
179
  this.store.surchargeList = [];
161
- case 17:
180
+ this.surchargeListChannel = channel;
181
+ case 21:
162
182
  case "end":
163
183
  return _context3.stop();
164
184
  }
165
- }, _callee3, this, [[0, 13]]);
185
+ }, _callee3, this, [[1, 16]]);
166
186
  }));
167
187
  function getSurchargeList() {
168
188
  return _getSurchargeList.apply(this, arguments);
@@ -194,11 +214,19 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
194
214
  value: function () {
195
215
  var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
196
216
  var _this$store$surcharge, _ref;
197
- var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
217
+ var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, channel, summaryChannel, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
198
218
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
199
219
  while (1) switch (_context4.prev = _context4.next) {
200
220
  case 0:
201
- _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
221
+ _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount, channel = params.channel;
222
+ summaryChannel = channel || this.resolveChannel();
223
+ if (!(summaryChannel !== this.surchargeListChannel)) {
224
+ _context4.next = 5;
225
+ break;
226
+ }
227
+ _context4.next = 5;
228
+ return this.getSurchargeList(summaryChannel);
229
+ case 5:
202
230
  taxConfig = this.getTaxConfig();
203
231
  summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
204
232
  needScheduleIds = (((_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
@@ -237,7 +265,7 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
237
265
  });
238
266
  this.store.summary = summaryWithTaxMeta;
239
267
  return _context4.abrupt("return", summaryWithTaxMeta);
240
- case 11:
268
+ case 15:
241
269
  case "end":
242
270
  return _context4.stop();
243
271
  }
@@ -63,5 +63,6 @@ export interface SalesSummaryModuleAPI {
63
63
  isPriceIncludeTax?: number;
64
64
  taxRate?: number;
65
65
  shopDiscount?: string | number;
66
+ channel?: string;
66
67
  }): Promise<SalesSummaryData>;
67
68
  }
@@ -1,16 +1,18 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { SurchargeListItem, SurchargeListModuleAPI } from './types';
3
+ import { SurchargeListItem, SurchargeListModuleAPI, SurchargeListQuery } from './types';
4
4
  export * from './types';
5
5
  export declare class SurchargeListModule extends BaseModule implements Module, SurchargeListModuleAPI {
6
6
  protected defaultName: string;
7
7
  protected defaultVersion: string;
8
8
  private request;
9
9
  private store;
10
- private loadingPromise;
10
+ private loadingPromises;
11
+ private requestVersion;
11
12
  constructor(name?: string, version?: string);
12
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
13
- getSurchargeList(): Promise<SurchargeListItem[]>;
14
- refreshSurchargeList(): Promise<SurchargeListItem[]>;
14
+ private resolveChannel;
15
+ getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
16
+ refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
15
17
  private loadSurchargeList;
16
18
  }
@@ -17,6 +17,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
17
17
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  import { BaseModule } from "../BaseModule";
19
19
  export * from "./types";
20
+ var DEFAULT_SURCHARGE_CHANNEL = 'online-store';
20
21
  export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
21
22
  _inherits(SurchargeListModule, _BaseModule);
22
23
  var _super = _createSuper(SurchargeListModule);
@@ -28,14 +29,15 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
28
29
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
29
30
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
30
31
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
31
- _defineProperty(_assertThisInitialized(_this), "loadingPromise", null);
32
+ _defineProperty(_assertThisInitialized(_this), "loadingPromises", new Map());
33
+ _defineProperty(_assertThisInitialized(_this), "requestVersion", 0);
32
34
  return _this;
33
35
  }
34
36
  _createClass(SurchargeListModule, [{
35
37
  key: "initialize",
36
38
  value: function () {
37
39
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
38
- var _options$initialState, _options$initialState2, _options$initialState3;
40
+ var _options$initialState, _options$initialState2, _options$initialState3, _options$otherParams, _options$initialState4;
39
41
  var hasInitialSurchargeList;
40
42
  return _regeneratorRuntime().wrap(function _callee$(_context) {
41
43
  while (1) switch (_context.prev = _context.next) {
@@ -45,13 +47,14 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
45
47
  this.request = this.core.getPlugin('request');
46
48
  hasInitialSurchargeList = Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList);
47
49
  this.store.surchargeList = hasInitialSurchargeList ? (_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.surchargeList : [];
48
- this.store.isLoaded = Boolean((_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.isLoaded) || hasInitialSurchargeList;
50
+ this.store.channel = ((_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.channel) || ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.channel) || DEFAULT_SURCHARGE_CHANNEL;
51
+ this.store.isLoaded = Boolean((_options$initialState4 = options.initialState) === null || _options$initialState4 === void 0 ? void 0 : _options$initialState4.isLoaded) || hasInitialSurchargeList;
49
52
  if (this.request) {
50
- _context.next = 8;
53
+ _context.next = 9;
51
54
  break;
52
55
  }
53
56
  throw new Error('SurchargeListModule 需要 request 插件支持');
54
- case 8:
57
+ case 9:
55
58
  case "end":
56
59
  return _context.stop();
57
60
  }
@@ -62,34 +65,43 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
62
65
  }
63
66
  return initialize;
64
67
  }()
68
+ }, {
69
+ key: "resolveChannel",
70
+ value: function resolveChannel(query) {
71
+ return (query === null || query === void 0 ? void 0 : query.channel) || DEFAULT_SURCHARGE_CHANNEL;
72
+ }
65
73
  }, {
66
74
  key: "getSurchargeList",
67
75
  value: function () {
68
- var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
+ var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query) {
77
+ var channel, loadingPromise, nextPromise;
69
78
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
70
79
  while (1) switch (_context2.prev = _context2.next) {
71
80
  case 0:
72
- if (!this.store.isLoaded) {
73
- _context2.next = 2;
81
+ channel = this.resolveChannel(query);
82
+ if (!(this.store.isLoaded && this.store.channel === channel)) {
83
+ _context2.next = 3;
74
84
  break;
75
85
  }
76
86
  return _context2.abrupt("return", this.store.surchargeList);
77
- case 2:
78
- if (!this.loadingPromise) {
79
- _context2.next = 4;
87
+ case 3:
88
+ loadingPromise = this.loadingPromises.get(channel);
89
+ if (!loadingPromise) {
90
+ _context2.next = 6;
80
91
  break;
81
92
  }
82
- return _context2.abrupt("return", this.loadingPromise);
83
- case 4:
84
- this.loadingPromise = this.loadSurchargeList();
85
- return _context2.abrupt("return", this.loadingPromise);
93
+ return _context2.abrupt("return", loadingPromise);
86
94
  case 6:
95
+ nextPromise = this.loadSurchargeList(channel);
96
+ this.loadingPromises.set(channel, nextPromise);
97
+ return _context2.abrupt("return", nextPromise);
98
+ case 9:
87
99
  case "end":
88
100
  return _context2.stop();
89
101
  }
90
102
  }, _callee2, this);
91
103
  }));
92
- function getSurchargeList() {
104
+ function getSurchargeList(_x3) {
93
105
  return _getSurchargeList.apply(this, arguments);
94
106
  }
95
107
  return getSurchargeList;
@@ -97,19 +109,22 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
97
109
  }, {
98
110
  key: "refreshSurchargeList",
99
111
  value: function () {
100
- var _refreshSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
112
+ var _refreshSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query) {
113
+ var channel, nextPromise;
101
114
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
102
115
  while (1) switch (_context3.prev = _context3.next) {
103
116
  case 0:
104
- this.loadingPromise = this.loadSurchargeList();
105
- return _context3.abrupt("return", this.loadingPromise);
106
- case 2:
117
+ channel = this.resolveChannel(query);
118
+ nextPromise = this.loadSurchargeList(channel);
119
+ this.loadingPromises.set(channel, nextPromise);
120
+ return _context3.abrupt("return", nextPromise);
121
+ case 4:
107
122
  case "end":
108
123
  return _context3.stop();
109
124
  }
110
125
  }, _callee3, this);
111
126
  }));
112
- function refreshSurchargeList() {
127
+ function refreshSurchargeList(_x4) {
113
128
  return _refreshSurchargeList.apply(this, arguments);
114
129
  }
115
130
  return refreshSurchargeList;
@@ -117,42 +132,50 @@ export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
117
132
  }, {
118
133
  key: "loadSurchargeList",
119
134
  value: function () {
120
- var _loadSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
121
- var surchargeList;
135
+ var _loadSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(channel) {
136
+ var currentRequestVersion, surchargeList, nextSurchargeList;
122
137
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
123
138
  while (1) switch (_context4.prev = _context4.next) {
124
139
  case 0:
125
- _context4.prev = 0;
126
- _context4.next = 3;
140
+ currentRequestVersion = ++this.requestVersion;
141
+ _context4.prev = 1;
142
+ _context4.next = 4;
127
143
  return this.request.get('/order/custom-surcharge/available/v2', {
128
- channel: 'online-store',
144
+ channel: channel,
129
145
  is_assemble_product_data: 1,
130
146
  is_assemble_schedule_data: 1,
131
147
  with: ['relationSchedule']
132
148
  });
133
- case 3:
149
+ case 4:
134
150
  surchargeList = _context4.sent;
135
- this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
136
- this.store.isLoaded = true;
137
- return _context4.abrupt("return", this.store.surchargeList);
138
- case 9:
139
- _context4.prev = 9;
140
- _context4.t0 = _context4["catch"](0);
151
+ nextSurchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
152
+ if (currentRequestVersion === this.requestVersion) {
153
+ this.store.surchargeList = nextSurchargeList;
154
+ this.store.channel = channel;
155
+ this.store.isLoaded = true;
156
+ }
157
+ return _context4.abrupt("return", nextSurchargeList);
158
+ case 10:
159
+ _context4.prev = 10;
160
+ _context4.t0 = _context4["catch"](1);
141
161
  console.warn('[SurchargeListModule] 加载附加费配置失败', _context4.t0);
142
- this.store.surchargeList = [];
143
- this.store.isLoaded = true;
144
- return _context4.abrupt("return", this.store.surchargeList);
162
+ if (currentRequestVersion === this.requestVersion) {
163
+ this.store.surchargeList = [];
164
+ this.store.channel = channel;
165
+ this.store.isLoaded = true;
166
+ }
167
+ return _context4.abrupt("return", []);
145
168
  case 15:
146
169
  _context4.prev = 15;
147
- this.loadingPromise = null;
170
+ this.loadingPromises.delete(channel);
148
171
  return _context4.finish(15);
149
172
  case 18:
150
173
  case "end":
151
174
  return _context4.stop();
152
175
  }
153
- }, _callee4, this, [[0, 9, 15, 18]]);
176
+ }, _callee4, this, [[1, 10, 15, 18]]);
154
177
  }));
155
- function loadSurchargeList() {
178
+ function loadSurchargeList(_x5) {
156
179
  return _loadSurchargeList.apply(this, arguments);
157
180
  }
158
181
  return loadSurchargeList;
@@ -4,8 +4,12 @@ export interface SurchargeListItem {
4
4
  export interface SurchargeListState {
5
5
  surchargeList: SurchargeListItem[];
6
6
  isLoaded: boolean;
7
+ channel?: string;
8
+ }
9
+ export interface SurchargeListQuery {
10
+ channel?: string;
7
11
  }
8
12
  export interface SurchargeListModuleAPI {
9
- getSurchargeList(): Promise<SurchargeListItem[]>;
10
- refreshSurchargeList(): Promise<SurchargeListItem[]>;
13
+ getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
14
+ refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
11
15
  }
@@ -448,9 +448,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
448
448
  var appPlugin = this.core.getPlugin('app');
449
449
  var app = appPlugin === null || appPlugin === void 0 ? void 0 : appPlugin.getApp();
450
450
  if (app) {
451
- var _this$store$createdAt;
452
451
  var coreData = app.data.store.getStore().getDataByModel('core');
453
- if (!((_this$store$createdAt = this.store.createdAtQuery) !== null && _this$store$createdAt !== void 0 && _this$store$createdAt.sales_time_between) && coreData !== null && coreData !== void 0 && coreData.core) {
452
+ if (coreData !== null && coreData !== void 0 && coreData.core) {
454
453
  var today = dayjs();
455
454
  if (coreData !== null && coreData !== void 0 && coreData.core.operating_day_boundary) {
456
455
  var operatingDayBoundary = coreData.core.operating_day_boundary;
@@ -49,6 +49,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
49
49
  private queuedAutoPaymentSync;
50
50
  private autoPaymentSyncFlushing;
51
51
  private autoPaymentSyncTimer;
52
+ private salesDetailLoadInFlight;
53
+ private serverOrderChangeUnsubscribe;
54
+ private serverOrderChangeHydrateInFlight;
52
55
  constructor(name?: string, version?: string);
53
56
  /**
54
57
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
@@ -69,6 +72,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
69
72
  * 记录错误日志
70
73
  */
71
74
  private logError;
75
+ private isCurrentSalesOrderRecord;
76
+ private syncCurrentSalesDetailFromServerOrderChange;
77
+ private registerServerOrderChangeSync;
72
78
  private hydrateOrderPaymentNames;
73
79
  get payment(): PaymentModule | undefined;
74
80
  private getCurrentOrderCustomerId;