@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.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +21 -16
- package/dist/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +230 -145
- package/dist/modules/Order/types.d.ts +10 -0
- package/dist/modules/Order/utils.js +7 -5
- package/dist/server/index.d.ts +136 -0
- package/dist/server/index.js +2055 -781
- package/dist/server/modules/order/index.d.ts +7 -0
- package/dist/server/modules/order/index.js +375 -337
- package/dist/server/modules/order/types.d.ts +15 -0
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/utils/small-ticket.d.ts +69 -0
- package/dist/server/utils/small-ticket.js +528 -0
- package/dist/solution/BaseSales/index.d.ts +4 -2
- package/dist/solution/BaseSales/index.js +248 -188
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +443 -263
- package/dist/solution/BookingTicket/types.d.ts +2 -1
- package/dist/solution/BookingTicket/types.js +3 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +6 -4
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +59 -3
- package/lib/modules/Order/types.d.ts +10 -0
- package/lib/modules/Order/utils.js +4 -3
- package/lib/server/index.d.ts +136 -0
- package/lib/server/index.js +823 -50
- package/lib/server/modules/order/index.d.ts +7 -0
- package/lib/server/modules/order/index.js +21 -7
- package/lib/server/modules/order/types.d.ts +15 -0
- package/lib/server/utils/small-ticket.d.ts +69 -0
- package/lib/server/utils/small-ticket.js +555 -0
- package/lib/solution/BaseSales/index.d.ts +4 -2
- package/lib/solution/BaseSales/index.js +47 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +108 -1
- package/lib/solution/BookingTicket/types.d.ts +2 -1
- package/lib/solution/BookingTicket/types.js +5 -0
- package/package.json +1 -1
|
@@ -46,6 +46,8 @@ import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils
|
|
|
46
46
|
import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
|
|
47
47
|
import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
|
|
48
48
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
49
|
+
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
50
|
+
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
49
51
|
function withProductOptionString(cacheItem) {
|
|
50
52
|
var _cacheItem$_extend;
|
|
51
53
|
var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
|
|
@@ -79,6 +81,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
79
81
|
_defineProperty(_assertThisInitialized(_this), "productCatalog", []);
|
|
80
82
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
81
83
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
84
|
+
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
82
85
|
return _this;
|
|
83
86
|
}
|
|
84
87
|
_createClass(BookingTicketImpl, [{
|
|
@@ -89,7 +92,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
89
92
|
* bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
|
|
90
93
|
*/
|
|
91
94
|
function getRegisteredModuleNames() {
|
|
92
|
-
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext']);
|
|
95
|
+
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext', 'openData']);
|
|
93
96
|
}
|
|
94
97
|
}, {
|
|
95
98
|
key: "getSubmitOrderSalesChannel",
|
|
@@ -130,8 +133,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
130
133
|
throw new Error('bookingTicket解决方案需要 request 插件支持');
|
|
131
134
|
case 6:
|
|
132
135
|
this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
|
|
136
|
+
_context.next = 9;
|
|
137
|
+
return this.configureIdGeneratorFromOpenData();
|
|
138
|
+
case 9:
|
|
133
139
|
console.log('[BookingTicket] 初始化完成');
|
|
134
|
-
case
|
|
140
|
+
case 10:
|
|
135
141
|
case "end":
|
|
136
142
|
return _context.stop();
|
|
137
143
|
}
|
|
@@ -142,6 +148,180 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
142
148
|
}
|
|
143
149
|
return initialize;
|
|
144
150
|
}()
|
|
151
|
+
}, {
|
|
152
|
+
key: "getBookingTicketBusinessCode",
|
|
153
|
+
value: function getBookingTicketBusinessCode() {
|
|
154
|
+
var _this$otherParams$bus, _this$otherParams2, _this$otherParams3;
|
|
155
|
+
var businessCode = (_this$otherParams$bus = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code;
|
|
156
|
+
if (businessCode === undefined || businessCode === null) return null;
|
|
157
|
+
var normalized = String(businessCode).trim();
|
|
158
|
+
return normalized || null;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "getIdGeneratorPlugin",
|
|
162
|
+
value: function getIdGeneratorPlugin() {
|
|
163
|
+
var _appPlugin$getApp, _app$getPlugin;
|
|
164
|
+
var appPlugin = this.core.getPlugin('app');
|
|
165
|
+
var app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
166
|
+
return (app === null || app === void 0 || (_app$getPlugin = app.getPlugin) === null || _app$getPlugin === void 0 ? void 0 : _app$getPlugin.call(app, 'idGenerator')) || null;
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "loadOpenDataConfig",
|
|
170
|
+
value: function () {
|
|
171
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
172
|
+
var businessCode, lastFetchedAt, cachedData, openDataConfig;
|
|
173
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
174
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
175
|
+
case 0:
|
|
176
|
+
if (this.store.openData) {
|
|
177
|
+
_context2.next = 2;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
throw new Error('openData 模块未初始化');
|
|
181
|
+
case 2:
|
|
182
|
+
businessCode = this.getBookingTicketBusinessCode();
|
|
183
|
+
if (businessCode) {
|
|
184
|
+
_context2.next = 6;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载');
|
|
188
|
+
return _context2.abrupt("return", null);
|
|
189
|
+
case 6:
|
|
190
|
+
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
191
|
+
cachedData = this.store.openData.getOpenData();
|
|
192
|
+
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
193
|
+
_context2.next = 11;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
this.otherParams.openData = cachedData;
|
|
197
|
+
return _context2.abrupt("return", cachedData);
|
|
198
|
+
case 11:
|
|
199
|
+
if (!this.loadOpenDataConfigInFlight) {
|
|
200
|
+
_context2.next = 15;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
_context2.next = 14;
|
|
204
|
+
return this.loadOpenDataConfigInFlight;
|
|
205
|
+
case 14:
|
|
206
|
+
return _context2.abrupt("return", _context2.sent);
|
|
207
|
+
case 15:
|
|
208
|
+
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
209
|
+
scope: 'board',
|
|
210
|
+
target: "".concat(businessCode, "+pos"),
|
|
211
|
+
// target: `dine_in+pos`,
|
|
212
|
+
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
213
|
+
});
|
|
214
|
+
_context2.prev = 16;
|
|
215
|
+
_context2.next = 19;
|
|
216
|
+
return this.loadOpenDataConfigInFlight;
|
|
217
|
+
case 19:
|
|
218
|
+
openDataConfig = _context2.sent;
|
|
219
|
+
this.otherParams.openData = openDataConfig;
|
|
220
|
+
return _context2.abrupt("return", openDataConfig);
|
|
221
|
+
case 22:
|
|
222
|
+
_context2.prev = 22;
|
|
223
|
+
this.loadOpenDataConfigInFlight = null;
|
|
224
|
+
return _context2.finish(22);
|
|
225
|
+
case 25:
|
|
226
|
+
case "end":
|
|
227
|
+
return _context2.stop();
|
|
228
|
+
}
|
|
229
|
+
}, _callee2, this, [[16,, 22, 25]]);
|
|
230
|
+
}));
|
|
231
|
+
function loadOpenDataConfig() {
|
|
232
|
+
return _loadOpenDataConfig.apply(this, arguments);
|
|
233
|
+
}
|
|
234
|
+
return loadOpenDataConfig;
|
|
235
|
+
}()
|
|
236
|
+
}, {
|
|
237
|
+
key: "configureIdGeneratorFromOpenData",
|
|
238
|
+
value: function () {
|
|
239
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
240
|
+
var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, resetReceiptSequenceDaily, operatingDayBoundary;
|
|
241
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
242
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
243
|
+
case 0:
|
|
244
|
+
openDataConfig = null;
|
|
245
|
+
_context3.prev = 1;
|
|
246
|
+
_context3.next = 4;
|
|
247
|
+
return this.loadOpenDataConfig();
|
|
248
|
+
case 4:
|
|
249
|
+
openDataConfig = _context3.sent;
|
|
250
|
+
_context3.next = 11;
|
|
251
|
+
break;
|
|
252
|
+
case 7:
|
|
253
|
+
_context3.prev = 7;
|
|
254
|
+
_context3.t0 = _context3["catch"](1);
|
|
255
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context3.t0);
|
|
256
|
+
return _context3.abrupt("return");
|
|
257
|
+
case 11:
|
|
258
|
+
if (openDataConfig) {
|
|
259
|
+
_context3.next = 13;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
return _context3.abrupt("return");
|
|
263
|
+
case 13:
|
|
264
|
+
idGenerator = this.getIdGeneratorPlugin();
|
|
265
|
+
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
266
|
+
_context3.next = 17;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
270
|
+
return _context3.abrupt("return");
|
|
271
|
+
case 17:
|
|
272
|
+
receiptSequenceLength = this.normalizePositiveInteger(openDataConfig['sale.short_number_digits'], 5);
|
|
273
|
+
receiptSequenceStart = this.normalizePositiveInteger(openDataConfig['sale.short_number_start_number'], 1);
|
|
274
|
+
prefix = this.normalizeIdPrefix(openDataConfig['sale.short_number_prefix'], 'R');
|
|
275
|
+
resetReceiptSequenceDaily = typeof openDataConfig['sale.short_number_daily_reset'] === 'boolean' ? openDataConfig['sale.short_number_daily_reset'] : true;
|
|
276
|
+
operatingDayBoundary = this.getAppData('operating_day_boundary');
|
|
277
|
+
_context3.prev = 22;
|
|
278
|
+
_context3.next = 25;
|
|
279
|
+
return idGenerator.configure({
|
|
280
|
+
biz: 'ticket',
|
|
281
|
+
config: {
|
|
282
|
+
prefix: prefix,
|
|
283
|
+
deviceCode: this.getAppData('device_id') || 0,
|
|
284
|
+
// TODO 现在 picoding 没这个配置的 key
|
|
285
|
+
padReceiptSequence: true,
|
|
286
|
+
receiptSequenceLength: receiptSequenceLength,
|
|
287
|
+
resetReceiptSequenceDaily: resetReceiptSequenceDaily,
|
|
288
|
+
receiptSequenceResetTime: operatingDayBoundary.time,
|
|
289
|
+
receiptSequenceStart: receiptSequenceStart
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
case 25:
|
|
293
|
+
_context3.next = 30;
|
|
294
|
+
break;
|
|
295
|
+
case 27:
|
|
296
|
+
_context3.prev = 27;
|
|
297
|
+
_context3.t1 = _context3["catch"](22);
|
|
298
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context3.t1);
|
|
299
|
+
case 30:
|
|
300
|
+
case "end":
|
|
301
|
+
return _context3.stop();
|
|
302
|
+
}
|
|
303
|
+
}, _callee3, this, [[1, 7], [22, 27]]);
|
|
304
|
+
}));
|
|
305
|
+
function configureIdGeneratorFromOpenData() {
|
|
306
|
+
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
307
|
+
}
|
|
308
|
+
return configureIdGeneratorFromOpenData;
|
|
309
|
+
}()
|
|
310
|
+
}, {
|
|
311
|
+
key: "normalizePositiveInteger",
|
|
312
|
+
value: function normalizePositiveInteger(value, fallback) {
|
|
313
|
+
var numeric = Number(value);
|
|
314
|
+
if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
|
|
315
|
+
return numeric;
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "normalizeIdPrefix",
|
|
319
|
+
value: function normalizeIdPrefix(value, fallback) {
|
|
320
|
+
if (value === undefined || value === null) return fallback;
|
|
321
|
+
var normalized = String(value).trim().toUpperCase();
|
|
322
|
+
return normalized || fallback;
|
|
323
|
+
}
|
|
324
|
+
|
|
145
325
|
/**
|
|
146
326
|
* 加载销售详情,并在父类基础上把 customer 信息装配到 CustomerModule。
|
|
147
327
|
*
|
|
@@ -152,16 +332,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
152
332
|
}, {
|
|
153
333
|
key: "loadSalesDetail",
|
|
154
334
|
value: (function () {
|
|
155
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
335
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderIdOrParams) {
|
|
156
336
|
var _ref;
|
|
157
337
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
158
|
-
return _regeneratorRuntime().wrap(function
|
|
159
|
-
while (1) switch (
|
|
338
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
339
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
160
340
|
case 0:
|
|
161
|
-
|
|
341
|
+
_context4.next = 2;
|
|
162
342
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
163
343
|
case 2:
|
|
164
|
-
sales =
|
|
344
|
+
sales = _context4.sent;
|
|
165
345
|
customerModule = this.store.customer;
|
|
166
346
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
167
347
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -175,7 +355,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
175
355
|
} : null;
|
|
176
356
|
selectedCustomer = (_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref !== void 0 ? _ref : protocolCustomer;
|
|
177
357
|
if (!(customerModule && selectedCustomer)) {
|
|
178
|
-
|
|
358
|
+
_context4.next = 17;
|
|
179
359
|
break;
|
|
180
360
|
}
|
|
181
361
|
_ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
|
|
@@ -189,15 +369,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
189
369
|
});
|
|
190
370
|
customerModule.setSelectedCustomer(customer);
|
|
191
371
|
this.setOrderCustomer(customer);
|
|
192
|
-
|
|
372
|
+
_context4.next = 17;
|
|
193
373
|
return this.store.order.saveDraft();
|
|
194
374
|
case 17:
|
|
195
|
-
return
|
|
375
|
+
return _context4.abrupt("return", sales);
|
|
196
376
|
case 18:
|
|
197
377
|
case "end":
|
|
198
|
-
return
|
|
378
|
+
return _context4.stop();
|
|
199
379
|
}
|
|
200
|
-
},
|
|
380
|
+
}, _callee4, this);
|
|
201
381
|
}));
|
|
202
382
|
function loadSalesDetail(_x2) {
|
|
203
383
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -207,45 +387,45 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
207
387
|
}, {
|
|
208
388
|
key: "scanPromotionCode",
|
|
209
389
|
value: function () {
|
|
210
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
390
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
|
|
211
391
|
var raw;
|
|
212
|
-
return _regeneratorRuntime().wrap(function
|
|
213
|
-
while (1) switch (
|
|
392
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
393
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
214
394
|
case 0:
|
|
215
395
|
if (this.store.order) {
|
|
216
|
-
|
|
396
|
+
_context5.next = 2;
|
|
217
397
|
break;
|
|
218
398
|
}
|
|
219
399
|
throw new Error('order 模块未初始化');
|
|
220
400
|
case 2:
|
|
221
|
-
|
|
401
|
+
_context5.next = 4;
|
|
222
402
|
return this.store.order.scanCode(code, customerId);
|
|
223
403
|
case 4:
|
|
224
|
-
raw =
|
|
404
|
+
raw = _context5.sent;
|
|
225
405
|
if (!raw.isAvailable) {
|
|
226
|
-
|
|
406
|
+
_context5.next = 11;
|
|
227
407
|
break;
|
|
228
408
|
}
|
|
229
|
-
|
|
409
|
+
_context5.next = 8;
|
|
230
410
|
return this.hydrateOrderCustomerFromScanDiscounts(raw.scannedDiscountList || []);
|
|
231
411
|
case 8:
|
|
232
|
-
|
|
412
|
+
_context5.next = 10;
|
|
233
413
|
return this.store.order.recalculateSummary({
|
|
234
414
|
createIfMissing: true
|
|
235
415
|
});
|
|
236
416
|
case 10:
|
|
237
417
|
this.store.order.persistTempOrder();
|
|
238
418
|
case 11:
|
|
239
|
-
return
|
|
419
|
+
return _context5.abrupt("return", {
|
|
240
420
|
isAvailable: raw.isAvailable,
|
|
241
421
|
type: raw.type,
|
|
242
422
|
unavailableReason: raw.unavailableReason
|
|
243
423
|
});
|
|
244
424
|
case 12:
|
|
245
425
|
case "end":
|
|
246
|
-
return
|
|
426
|
+
return _context5.stop();
|
|
247
427
|
}
|
|
248
|
-
},
|
|
428
|
+
}, _callee5, this);
|
|
249
429
|
}));
|
|
250
430
|
function scanPromotionCode(_x3, _x4) {
|
|
251
431
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -255,42 +435,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
255
435
|
}, {
|
|
256
436
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
257
437
|
value: function () {
|
|
258
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
438
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(discounts) {
|
|
259
439
|
var currentOrderCustomer, customerId, customer;
|
|
260
|
-
return _regeneratorRuntime().wrap(function
|
|
261
|
-
while (1) switch (
|
|
440
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
441
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
262
442
|
case 0:
|
|
263
443
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
264
444
|
if (!currentOrderCustomer) {
|
|
265
|
-
|
|
445
|
+
_context6.next = 3;
|
|
266
446
|
break;
|
|
267
447
|
}
|
|
268
|
-
return
|
|
448
|
+
return _context6.abrupt("return");
|
|
269
449
|
case 3:
|
|
270
450
|
customerId = this.getDiscountCustomerId(discounts);
|
|
271
451
|
if (customerId) {
|
|
272
|
-
|
|
452
|
+
_context6.next = 6;
|
|
273
453
|
break;
|
|
274
454
|
}
|
|
275
|
-
return
|
|
455
|
+
return _context6.abrupt("return");
|
|
276
456
|
case 6:
|
|
277
|
-
|
|
457
|
+
_context6.next = 8;
|
|
278
458
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
279
459
|
case 8:
|
|
280
|
-
customer =
|
|
460
|
+
customer = _context6.sent;
|
|
281
461
|
if (customer) {
|
|
282
|
-
|
|
462
|
+
_context6.next = 11;
|
|
283
463
|
break;
|
|
284
464
|
}
|
|
285
|
-
return
|
|
465
|
+
return _context6.abrupt("return");
|
|
286
466
|
case 11:
|
|
287
467
|
this.store.customer.setSelectedCustomer(customer);
|
|
288
468
|
this.setOrderCustomer(customer);
|
|
289
469
|
case 13:
|
|
290
470
|
case "end":
|
|
291
|
-
return
|
|
471
|
+
return _context6.stop();
|
|
292
472
|
}
|
|
293
|
-
},
|
|
473
|
+
}, _callee6, this);
|
|
294
474
|
}));
|
|
295
475
|
function hydrateOrderCustomerFromScanDiscounts(_x5) {
|
|
296
476
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -310,36 +490,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
310
490
|
}, {
|
|
311
491
|
key: "resolveCustomerByDiscountCustomerId",
|
|
312
492
|
value: function () {
|
|
313
|
-
var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
493
|
+
var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(customerId) {
|
|
314
494
|
var _result$list;
|
|
315
495
|
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
|
|
316
|
-
return _regeneratorRuntime().wrap(function
|
|
317
|
-
while (1) switch (
|
|
496
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
497
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
318
498
|
case 0:
|
|
319
499
|
localCustomers = this.store.customer.getCustomers();
|
|
320
500
|
localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
321
501
|
normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
|
|
322
502
|
if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
|
|
323
|
-
|
|
503
|
+
_context7.next = 5;
|
|
324
504
|
break;
|
|
325
505
|
}
|
|
326
|
-
return
|
|
506
|
+
return _context7.abrupt("return", normalizedLocalCustomer);
|
|
327
507
|
case 5:
|
|
328
|
-
|
|
508
|
+
_context7.next = 7;
|
|
329
509
|
return this.store.customer.queryCustomerList({
|
|
330
510
|
ids: [customerId],
|
|
331
511
|
skip: 1,
|
|
332
512
|
num: 1
|
|
333
513
|
});
|
|
334
514
|
case 7:
|
|
335
|
-
result =
|
|
515
|
+
result = _context7.sent;
|
|
336
516
|
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
337
|
-
return
|
|
517
|
+
return _context7.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
|
|
338
518
|
case 10:
|
|
339
519
|
case "end":
|
|
340
|
-
return
|
|
520
|
+
return _context7.stop();
|
|
341
521
|
}
|
|
342
|
-
},
|
|
522
|
+
}, _callee7, this);
|
|
343
523
|
}));
|
|
344
524
|
function resolveCustomerByDiscountCustomerId(_x6) {
|
|
345
525
|
return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
|
|
@@ -402,60 +582,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
402
582
|
}, {
|
|
403
583
|
key: "setBookingStatus",
|
|
404
584
|
value: (function () {
|
|
405
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
585
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(status) {
|
|
406
586
|
var _this$store$order, _this$store$order$get;
|
|
407
587
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
408
|
-
return _regeneratorRuntime().wrap(function
|
|
409
|
-
while (1) switch (
|
|
588
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
589
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
410
590
|
case 0:
|
|
411
591
|
tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
412
592
|
if (tempOrder) {
|
|
413
|
-
|
|
593
|
+
_context8.next = 3;
|
|
414
594
|
break;
|
|
415
595
|
}
|
|
416
596
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
417
597
|
case 3:
|
|
418
598
|
orderId = tempOrder.order_id;
|
|
419
599
|
if (!(orderId === undefined || orderId === null)) {
|
|
420
|
-
|
|
600
|
+
_context8.next = 6;
|
|
421
601
|
break;
|
|
422
602
|
}
|
|
423
603
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
424
604
|
case 6:
|
|
425
605
|
scheduleId = resolveScheduleId(tempOrder);
|
|
426
606
|
if (!(scheduleId === null)) {
|
|
427
|
-
|
|
607
|
+
_context8.next = 9;
|
|
428
608
|
break;
|
|
429
609
|
}
|
|
430
610
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
431
611
|
case 9:
|
|
432
612
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
433
613
|
previous = applyBookingsStatus(bookings, status);
|
|
434
|
-
|
|
435
|
-
|
|
614
|
+
_context8.prev = 11;
|
|
615
|
+
_context8.next = 14;
|
|
436
616
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
437
617
|
appointment_status: status
|
|
438
618
|
});
|
|
439
619
|
case 14:
|
|
440
|
-
res =
|
|
441
|
-
|
|
620
|
+
res = _context8.sent;
|
|
621
|
+
_context8.next = 17;
|
|
442
622
|
return this.refreshSalesDetail();
|
|
443
623
|
case 17:
|
|
444
624
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
445
625
|
orderId: orderId,
|
|
446
626
|
status: status
|
|
447
627
|
});
|
|
448
|
-
return
|
|
628
|
+
return _context8.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
449
629
|
case 21:
|
|
450
|
-
|
|
451
|
-
|
|
630
|
+
_context8.prev = 21;
|
|
631
|
+
_context8.t0 = _context8["catch"](11);
|
|
452
632
|
restoreBookingsStatus(bookings, previous);
|
|
453
|
-
throw
|
|
633
|
+
throw _context8.t0;
|
|
454
634
|
case 25:
|
|
455
635
|
case "end":
|
|
456
|
-
return
|
|
636
|
+
return _context8.stop();
|
|
457
637
|
}
|
|
458
|
-
},
|
|
638
|
+
}, _callee8, this, [[11, 21]]);
|
|
459
639
|
}));
|
|
460
640
|
function setBookingStatus(_x7) {
|
|
461
641
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -486,35 +666,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
486
666
|
}, {
|
|
487
667
|
key: "transitionChildBooking",
|
|
488
668
|
value: (function () {
|
|
489
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
669
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
490
670
|
var _this$store$order2, _this$store$order2$ge;
|
|
491
671
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
492
|
-
return _regeneratorRuntime().wrap(function
|
|
493
|
-
while (1) switch (
|
|
672
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
673
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
494
674
|
case 0:
|
|
495
675
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
496
676
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
497
|
-
|
|
677
|
+
_context9.next = 3;
|
|
498
678
|
break;
|
|
499
679
|
}
|
|
500
680
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
501
681
|
case 3:
|
|
502
682
|
if (action) {
|
|
503
|
-
|
|
683
|
+
_context9.next = 5;
|
|
504
684
|
break;
|
|
505
685
|
}
|
|
506
686
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
507
687
|
case 5:
|
|
508
688
|
tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
509
689
|
if (tempOrder) {
|
|
510
|
-
|
|
690
|
+
_context9.next = 8;
|
|
511
691
|
break;
|
|
512
692
|
}
|
|
513
693
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
514
694
|
case 8:
|
|
515
695
|
orderId = tempOrder.order_id;
|
|
516
696
|
if (!(orderId === undefined || orderId === null)) {
|
|
517
|
-
|
|
697
|
+
_context9.next = 11;
|
|
518
698
|
break;
|
|
519
699
|
}
|
|
520
700
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -522,14 +702,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
522
702
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
523
703
|
targetStatus = resolveStatusAfterTransition(action);
|
|
524
704
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
525
|
-
|
|
526
|
-
|
|
705
|
+
_context9.prev = 14;
|
|
706
|
+
_context9.next = 17;
|
|
527
707
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
528
708
|
action: action
|
|
529
709
|
});
|
|
530
710
|
case 17:
|
|
531
|
-
res =
|
|
532
|
-
|
|
711
|
+
res = _context9.sent;
|
|
712
|
+
_context9.next = 20;
|
|
533
713
|
return this.refreshSalesDetail();
|
|
534
714
|
case 20:
|
|
535
715
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -538,19 +718,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
538
718
|
action: action,
|
|
539
719
|
status: targetStatus
|
|
540
720
|
});
|
|
541
|
-
return
|
|
721
|
+
return _context9.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
542
722
|
case 24:
|
|
543
|
-
|
|
544
|
-
|
|
723
|
+
_context9.prev = 24;
|
|
724
|
+
_context9.t0 = _context9["catch"](14);
|
|
545
725
|
if (previous !== undefined) {
|
|
546
726
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
547
727
|
}
|
|
548
|
-
throw
|
|
728
|
+
throw _context9.t0;
|
|
549
729
|
case 28:
|
|
550
730
|
case "end":
|
|
551
|
-
return
|
|
731
|
+
return _context9.stop();
|
|
552
732
|
}
|
|
553
|
-
},
|
|
733
|
+
}, _callee9, this, [[14, 24]]);
|
|
554
734
|
}));
|
|
555
735
|
function transitionChildBooking(_x8) {
|
|
556
736
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -571,35 +751,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
571
751
|
}, {
|
|
572
752
|
key: "refreshSalesDetail",
|
|
573
753
|
value: (function () {
|
|
574
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
754
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
575
755
|
var _this$store$order3, _this$store$order3$ge;
|
|
576
756
|
var tempOrder, orderId;
|
|
577
|
-
return _regeneratorRuntime().wrap(function
|
|
578
|
-
while (1) switch (
|
|
757
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
758
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
579
759
|
case 0:
|
|
580
760
|
tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
581
761
|
if (tempOrder) {
|
|
582
|
-
|
|
762
|
+
_context10.next = 3;
|
|
583
763
|
break;
|
|
584
764
|
}
|
|
585
765
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
586
766
|
case 3:
|
|
587
767
|
orderId = tempOrder.order_id;
|
|
588
768
|
if (!(orderId === undefined || orderId === null)) {
|
|
589
|
-
|
|
769
|
+
_context10.next = 6;
|
|
590
770
|
break;
|
|
591
771
|
}
|
|
592
772
|
throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
|
|
593
773
|
case 6:
|
|
594
|
-
return
|
|
774
|
+
return _context10.abrupt("return", this.loadSalesDetail({
|
|
595
775
|
orderId: Number(orderId),
|
|
596
776
|
forceRemote: true
|
|
597
777
|
}));
|
|
598
778
|
case 7:
|
|
599
779
|
case "end":
|
|
600
|
-
return
|
|
780
|
+
return _context10.stop();
|
|
601
781
|
}
|
|
602
|
-
},
|
|
782
|
+
}, _callee10, this);
|
|
603
783
|
}));
|
|
604
784
|
function refreshSalesDetail() {
|
|
605
785
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -615,7 +795,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
615
795
|
}, {
|
|
616
796
|
key: "loadProducts",
|
|
617
797
|
value: (function () {
|
|
618
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
798
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
619
799
|
var params,
|
|
620
800
|
options,
|
|
621
801
|
schedule_date,
|
|
@@ -624,20 +804,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
624
804
|
schedule_datetime,
|
|
625
805
|
bookingDate,
|
|
626
806
|
_result,
|
|
627
|
-
|
|
628
|
-
return _regeneratorRuntime().wrap(function
|
|
629
|
-
while (1) switch (
|
|
807
|
+
_args11 = arguments;
|
|
808
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
809
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
630
810
|
case 0:
|
|
631
|
-
params =
|
|
632
|
-
options =
|
|
811
|
+
params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
812
|
+
options = _args11.length > 1 ? _args11[1] : undefined;
|
|
633
813
|
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
|
|
634
814
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
635
815
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
636
816
|
if (bookingDate) {
|
|
637
817
|
this.setBookingDate(bookingDate);
|
|
638
818
|
}
|
|
639
|
-
|
|
640
|
-
|
|
819
|
+
_context11.prev = 5;
|
|
820
|
+
_context11.next = 8;
|
|
641
821
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
642
822
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
643
823
|
with_schedule: 1
|
|
@@ -645,20 +825,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
645
825
|
cacheId: this.cacheId
|
|
646
826
|
}), options);
|
|
647
827
|
case 8:
|
|
648
|
-
_result =
|
|
828
|
+
_result = _context11.sent;
|
|
649
829
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
650
830
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
651
|
-
return
|
|
831
|
+
return _context11.abrupt("return", _result);
|
|
652
832
|
case 14:
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
console.error('Failed to load products:',
|
|
656
|
-
throw
|
|
833
|
+
_context11.prev = 14;
|
|
834
|
+
_context11.t0 = _context11["catch"](5);
|
|
835
|
+
console.error('Failed to load products:', _context11.t0);
|
|
836
|
+
throw _context11.t0;
|
|
657
837
|
case 18:
|
|
658
838
|
case "end":
|
|
659
|
-
return
|
|
839
|
+
return _context11.stop();
|
|
660
840
|
}
|
|
661
|
-
},
|
|
841
|
+
}, _callee11, this, [[5, 14]]);
|
|
662
842
|
}));
|
|
663
843
|
function loadProducts() {
|
|
664
844
|
return _loadProducts.apply(this, arguments);
|
|
@@ -683,14 +863,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
683
863
|
}, {
|
|
684
864
|
key: "queryProductDetail",
|
|
685
865
|
value: (function () {
|
|
686
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
866
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params, options) {
|
|
687
867
|
var product_id, queryParams, _result2, list;
|
|
688
|
-
return _regeneratorRuntime().wrap(function
|
|
689
|
-
while (1) switch (
|
|
868
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
869
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
690
870
|
case 0:
|
|
691
871
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
692
|
-
|
|
693
|
-
|
|
872
|
+
_context12.prev = 1;
|
|
873
|
+
_context12.next = 4;
|
|
694
874
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
695
875
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
696
876
|
with_schedule: 1
|
|
@@ -699,21 +879,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
699
879
|
cacheId: this.cacheId
|
|
700
880
|
}), options);
|
|
701
881
|
case 4:
|
|
702
|
-
_result2 =
|
|
882
|
+
_result2 = _context12.sent;
|
|
703
883
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
704
|
-
return
|
|
884
|
+
return _context12.abrupt("return", list.find(function (product) {
|
|
705
885
|
return Number(product.id) === Number(product_id);
|
|
706
886
|
}));
|
|
707
887
|
case 9:
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
console.error('Failed to query product detail:',
|
|
711
|
-
throw
|
|
888
|
+
_context12.prev = 9;
|
|
889
|
+
_context12.t0 = _context12["catch"](1);
|
|
890
|
+
console.error('Failed to query product detail:', _context12.t0);
|
|
891
|
+
throw _context12.t0;
|
|
712
892
|
case 13:
|
|
713
893
|
case "end":
|
|
714
|
-
return
|
|
894
|
+
return _context12.stop();
|
|
715
895
|
}
|
|
716
|
-
},
|
|
896
|
+
}, _callee12, this, [[1, 9]]);
|
|
717
897
|
}));
|
|
718
898
|
function queryProductDetail(_x9, _x10) {
|
|
719
899
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -728,26 +908,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
728
908
|
}, {
|
|
729
909
|
key: "loadProductDetail",
|
|
730
910
|
value: (function () {
|
|
731
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
911
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params, options) {
|
|
732
912
|
var product_id, queryParams, products;
|
|
733
|
-
return _regeneratorRuntime().wrap(function
|
|
734
|
-
while (1) switch (
|
|
913
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
914
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
735
915
|
case 0:
|
|
736
916
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
737
|
-
|
|
917
|
+
_context13.next = 3;
|
|
738
918
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
739
919
|
product_ids: [product_id]
|
|
740
920
|
}), options);
|
|
741
921
|
case 3:
|
|
742
|
-
products =
|
|
743
|
-
return
|
|
922
|
+
products = _context13.sent;
|
|
923
|
+
return _context13.abrupt("return", products.find(function (product) {
|
|
744
924
|
return Number(product.id) === Number(product_id);
|
|
745
925
|
}));
|
|
746
926
|
case 5:
|
|
747
927
|
case "end":
|
|
748
|
-
return
|
|
928
|
+
return _context13.stop();
|
|
749
929
|
}
|
|
750
|
-
},
|
|
930
|
+
}, _callee13, this);
|
|
751
931
|
}));
|
|
752
932
|
function loadProductDetail(_x11, _x12) {
|
|
753
933
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -782,16 +962,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
782
962
|
}, {
|
|
783
963
|
key: "getProducts",
|
|
784
964
|
value: (function () {
|
|
785
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
786
|
-
return _regeneratorRuntime().wrap(function
|
|
787
|
-
while (1) switch (
|
|
965
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
967
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
788
968
|
case 0:
|
|
789
|
-
return
|
|
969
|
+
return _context14.abrupt("return", this.store.products.getProducts());
|
|
790
970
|
case 1:
|
|
791
971
|
case "end":
|
|
792
|
-
return
|
|
972
|
+
return _context14.stop();
|
|
793
973
|
}
|
|
794
|
-
},
|
|
974
|
+
}, _callee14, this);
|
|
795
975
|
}));
|
|
796
976
|
function getProducts() {
|
|
797
977
|
return _getProducts.apply(this, arguments);
|
|
@@ -844,16 +1024,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
844
1024
|
}, {
|
|
845
1025
|
key: "getProductByIds",
|
|
846
1026
|
value: (function () {
|
|
847
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
848
|
-
return _regeneratorRuntime().wrap(function
|
|
849
|
-
while (1) switch (
|
|
1027
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(ids) {
|
|
1028
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1029
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
850
1030
|
case 0:
|
|
851
|
-
return
|
|
1031
|
+
return _context15.abrupt("return", this.store.products.getProductByIds(ids));
|
|
852
1032
|
case 1:
|
|
853
1033
|
case "end":
|
|
854
|
-
return
|
|
1034
|
+
return _context15.stop();
|
|
855
1035
|
}
|
|
856
|
-
},
|
|
1036
|
+
}, _callee15, this);
|
|
857
1037
|
}));
|
|
858
1038
|
function getProductByIds(_x13) {
|
|
859
1039
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -869,25 +1049,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
869
1049
|
}, {
|
|
870
1050
|
key: "getScheduleTimePoints",
|
|
871
1051
|
value: (function () {
|
|
872
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1052
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
873
1053
|
var result;
|
|
874
|
-
return _regeneratorRuntime().wrap(function
|
|
875
|
-
while (1) switch (
|
|
1054
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1055
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
876
1056
|
case 0:
|
|
877
|
-
|
|
1057
|
+
_context16.next = 2;
|
|
878
1058
|
return this.request.post('/menu/schedule-time-points', {
|
|
879
1059
|
menu_list_ids: params.menu_list_ids
|
|
880
1060
|
}, {
|
|
881
1061
|
osServer: true
|
|
882
1062
|
});
|
|
883
1063
|
case 2:
|
|
884
|
-
result =
|
|
885
|
-
return
|
|
1064
|
+
result = _context16.sent;
|
|
1065
|
+
return _context16.abrupt("return", result.data || []);
|
|
886
1066
|
case 4:
|
|
887
1067
|
case "end":
|
|
888
|
-
return
|
|
1068
|
+
return _context16.stop();
|
|
889
1069
|
}
|
|
890
|
-
},
|
|
1070
|
+
}, _callee16, this);
|
|
891
1071
|
}));
|
|
892
1072
|
function getScheduleTimePoints(_x14) {
|
|
893
1073
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -903,30 +1083,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
903
1083
|
}, {
|
|
904
1084
|
key: "getCustomerList",
|
|
905
1085
|
value: (function () {
|
|
906
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1086
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
907
1087
|
var params,
|
|
908
1088
|
_result3,
|
|
909
|
-
|
|
910
|
-
return _regeneratorRuntime().wrap(function
|
|
911
|
-
while (1) switch (
|
|
1089
|
+
_args17 = arguments;
|
|
1090
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1091
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
912
1092
|
case 0:
|
|
913
|
-
params =
|
|
914
|
-
|
|
915
|
-
|
|
1093
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1094
|
+
_context17.prev = 1;
|
|
1095
|
+
_context17.next = 4;
|
|
916
1096
|
return this.store.customer.getCustomerList(params);
|
|
917
1097
|
case 4:
|
|
918
|
-
_result3 =
|
|
919
|
-
return
|
|
1098
|
+
_result3 = _context17.sent;
|
|
1099
|
+
return _context17.abrupt("return", _result3);
|
|
920
1100
|
case 8:
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
console.error('Failed to get customer list:',
|
|
924
|
-
throw
|
|
1101
|
+
_context17.prev = 8;
|
|
1102
|
+
_context17.t0 = _context17["catch"](1);
|
|
1103
|
+
console.error('Failed to get customer list:', _context17.t0);
|
|
1104
|
+
throw _context17.t0;
|
|
925
1105
|
case 12:
|
|
926
1106
|
case "end":
|
|
927
|
-
return
|
|
1107
|
+
return _context17.stop();
|
|
928
1108
|
}
|
|
929
|
-
},
|
|
1109
|
+
}, _callee17, this, [[1, 8]]);
|
|
930
1110
|
}));
|
|
931
1111
|
function getCustomerList() {
|
|
932
1112
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1124,24 +1304,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1124
1304
|
}, {
|
|
1125
1305
|
key: "restoreOrder",
|
|
1126
1306
|
value: (function () {
|
|
1127
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1307
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1128
1308
|
var _this$store$customer;
|
|
1129
1309
|
var tempOrder;
|
|
1130
|
-
return _regeneratorRuntime().wrap(function
|
|
1131
|
-
while (1) switch (
|
|
1310
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1311
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1132
1312
|
case 0:
|
|
1133
|
-
|
|
1313
|
+
_context18.next = 2;
|
|
1134
1314
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1135
1315
|
case 2:
|
|
1136
|
-
tempOrder =
|
|
1316
|
+
tempOrder = _context18.sent;
|
|
1137
1317
|
this.clearOrderCustomer();
|
|
1138
1318
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1139
|
-
return
|
|
1319
|
+
return _context18.abrupt("return", tempOrder);
|
|
1140
1320
|
case 6:
|
|
1141
1321
|
case "end":
|
|
1142
|
-
return
|
|
1322
|
+
return _context18.stop();
|
|
1143
1323
|
}
|
|
1144
|
-
},
|
|
1324
|
+
}, _callee18, this);
|
|
1145
1325
|
}));
|
|
1146
1326
|
function restoreOrder() {
|
|
1147
1327
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1167,36 +1347,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1167
1347
|
return;
|
|
1168
1348
|
}
|
|
1169
1349
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1170
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1350
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1171
1351
|
var currentCustomer;
|
|
1172
|
-
return _regeneratorRuntime().wrap(function
|
|
1173
|
-
while (1) switch (
|
|
1352
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1353
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1174
1354
|
case 0:
|
|
1175
1355
|
if (!previousRefresh) {
|
|
1176
|
-
|
|
1356
|
+
_context19.next = 3;
|
|
1177
1357
|
break;
|
|
1178
1358
|
}
|
|
1179
|
-
|
|
1359
|
+
_context19.next = 3;
|
|
1180
1360
|
return previousRefresh.catch(function () {
|
|
1181
1361
|
return undefined;
|
|
1182
1362
|
});
|
|
1183
1363
|
case 3:
|
|
1184
1364
|
currentCustomer = _this4.store.order.getOrderCustomer();
|
|
1185
1365
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1186
|
-
|
|
1366
|
+
_context19.next = 6;
|
|
1187
1367
|
break;
|
|
1188
1368
|
}
|
|
1189
|
-
return
|
|
1369
|
+
return _context19.abrupt("return");
|
|
1190
1370
|
case 6:
|
|
1191
|
-
|
|
1371
|
+
_context19.next = 8;
|
|
1192
1372
|
return _this4.loadDiscountConfig({
|
|
1193
1373
|
customerId: customerId
|
|
1194
1374
|
});
|
|
1195
1375
|
case 8:
|
|
1196
1376
|
case "end":
|
|
1197
|
-
return
|
|
1377
|
+
return _context19.stop();
|
|
1198
1378
|
}
|
|
1199
|
-
},
|
|
1379
|
+
}, _callee19);
|
|
1200
1380
|
}))();
|
|
1201
1381
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1202
1382
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1249,27 +1429,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1249
1429
|
}, {
|
|
1250
1430
|
key: "changeCustomerPage",
|
|
1251
1431
|
value: (function () {
|
|
1252
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1432
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(page, pageSize) {
|
|
1253
1433
|
var _result4;
|
|
1254
|
-
return _regeneratorRuntime().wrap(function
|
|
1255
|
-
while (1) switch (
|
|
1434
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1435
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1256
1436
|
case 0:
|
|
1257
|
-
|
|
1258
|
-
|
|
1437
|
+
_context20.prev = 0;
|
|
1438
|
+
_context20.next = 3;
|
|
1259
1439
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
1260
1440
|
case 3:
|
|
1261
|
-
_result4 =
|
|
1262
|
-
return
|
|
1441
|
+
_result4 = _context20.sent;
|
|
1442
|
+
return _context20.abrupt("return", _result4);
|
|
1263
1443
|
case 7:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
console.error('Failed to change customer page:',
|
|
1267
|
-
throw
|
|
1444
|
+
_context20.prev = 7;
|
|
1445
|
+
_context20.t0 = _context20["catch"](0);
|
|
1446
|
+
console.error('Failed to change customer page:', _context20.t0);
|
|
1447
|
+
throw _context20.t0;
|
|
1268
1448
|
case 11:
|
|
1269
1449
|
case "end":
|
|
1270
|
-
return
|
|
1450
|
+
return _context20.stop();
|
|
1271
1451
|
}
|
|
1272
|
-
},
|
|
1452
|
+
}, _callee20, this, [[0, 7]]);
|
|
1273
1453
|
}));
|
|
1274
1454
|
function changeCustomerPage(_x15, _x16) {
|
|
1275
1455
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -1284,28 +1464,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1284
1464
|
}, {
|
|
1285
1465
|
key: "loadMoreCustomers",
|
|
1286
1466
|
value: (function () {
|
|
1287
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1467
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1288
1468
|
var _result5;
|
|
1289
|
-
return _regeneratorRuntime().wrap(function
|
|
1290
|
-
while (1) switch (
|
|
1469
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1470
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1291
1471
|
case 0:
|
|
1292
|
-
|
|
1293
|
-
|
|
1472
|
+
_context21.prev = 0;
|
|
1473
|
+
_context21.next = 3;
|
|
1294
1474
|
return this.store.customer.loadMoreCustomers();
|
|
1295
1475
|
case 3:
|
|
1296
|
-
_result5 =
|
|
1476
|
+
_result5 = _context21.sent;
|
|
1297
1477
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
1298
|
-
return
|
|
1478
|
+
return _context21.abrupt("return", _result5);
|
|
1299
1479
|
case 8:
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
console.error('Failed to load more customers:',
|
|
1303
|
-
throw
|
|
1480
|
+
_context21.prev = 8;
|
|
1481
|
+
_context21.t0 = _context21["catch"](0);
|
|
1482
|
+
console.error('Failed to load more customers:', _context21.t0);
|
|
1483
|
+
throw _context21.t0;
|
|
1304
1484
|
case 12:
|
|
1305
1485
|
case "end":
|
|
1306
|
-
return
|
|
1486
|
+
return _context21.stop();
|
|
1307
1487
|
}
|
|
1308
|
-
},
|
|
1488
|
+
}, _callee21, this, [[0, 8]]);
|
|
1309
1489
|
}));
|
|
1310
1490
|
function loadMoreCustomers() {
|
|
1311
1491
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -1321,31 +1501,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1321
1501
|
}, {
|
|
1322
1502
|
key: "resetAndLoadCustomers",
|
|
1323
1503
|
value: (function () {
|
|
1324
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1504
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1325
1505
|
var params,
|
|
1326
1506
|
_result6,
|
|
1327
|
-
|
|
1328
|
-
return _regeneratorRuntime().wrap(function
|
|
1329
|
-
while (1) switch (
|
|
1507
|
+
_args22 = arguments;
|
|
1508
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1509
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1330
1510
|
case 0:
|
|
1331
|
-
params =
|
|
1332
|
-
|
|
1333
|
-
|
|
1511
|
+
params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
1512
|
+
_context22.prev = 1;
|
|
1513
|
+
_context22.next = 4;
|
|
1334
1514
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
1335
1515
|
case 4:
|
|
1336
|
-
_result6 =
|
|
1516
|
+
_result6 = _context22.sent;
|
|
1337
1517
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
1338
|
-
return
|
|
1518
|
+
return _context22.abrupt("return", _result6);
|
|
1339
1519
|
case 9:
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
console.error('Failed to reset and load customers:',
|
|
1343
|
-
throw
|
|
1520
|
+
_context22.prev = 9;
|
|
1521
|
+
_context22.t0 = _context22["catch"](1);
|
|
1522
|
+
console.error('Failed to reset and load customers:', _context22.t0);
|
|
1523
|
+
throw _context22.t0;
|
|
1344
1524
|
case 13:
|
|
1345
1525
|
case "end":
|
|
1346
|
-
return
|
|
1526
|
+
return _context22.stop();
|
|
1347
1527
|
}
|
|
1348
|
-
},
|
|
1528
|
+
}, _callee22, this, [[1, 9]]);
|
|
1349
1529
|
}));
|
|
1350
1530
|
function resetAndLoadCustomers() {
|
|
1351
1531
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -1507,15 +1687,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1507
1687
|
}, {
|
|
1508
1688
|
key: "setOtherParams",
|
|
1509
1689
|
value: (function () {
|
|
1510
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1690
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
1511
1691
|
var _ref10,
|
|
1512
1692
|
_ref10$cover,
|
|
1513
1693
|
cover,
|
|
1514
|
-
|
|
1515
|
-
return _regeneratorRuntime().wrap(function
|
|
1516
|
-
while (1) switch (
|
|
1694
|
+
_args23 = arguments;
|
|
1695
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1696
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1517
1697
|
case 0:
|
|
1518
|
-
_ref10 =
|
|
1698
|
+
_ref10 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
|
|
1519
1699
|
if (cover) {
|
|
1520
1700
|
this.otherParams = params;
|
|
1521
1701
|
} else {
|
|
@@ -1523,9 +1703,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1523
1703
|
}
|
|
1524
1704
|
case 2:
|
|
1525
1705
|
case "end":
|
|
1526
|
-
return
|
|
1706
|
+
return _context23.stop();
|
|
1527
1707
|
}
|
|
1528
|
-
},
|
|
1708
|
+
}, _callee23, this);
|
|
1529
1709
|
}));
|
|
1530
1710
|
function setOtherParams(_x17) {
|
|
1531
1711
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -1540,16 +1720,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1540
1720
|
}, {
|
|
1541
1721
|
key: "getOtherParams",
|
|
1542
1722
|
value: (function () {
|
|
1543
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1544
|
-
return _regeneratorRuntime().wrap(function
|
|
1545
|
-
while (1) switch (
|
|
1723
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1724
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1725
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1546
1726
|
case 0:
|
|
1547
|
-
return
|
|
1727
|
+
return _context24.abrupt("return", this.otherParams);
|
|
1548
1728
|
case 1:
|
|
1549
1729
|
case "end":
|
|
1550
|
-
return
|
|
1730
|
+
return _context24.stop();
|
|
1551
1731
|
}
|
|
1552
|
-
},
|
|
1732
|
+
}, _callee24, this);
|
|
1553
1733
|
}));
|
|
1554
1734
|
function getOtherParams() {
|
|
1555
1735
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1867,16 +2047,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1867
2047
|
}, {
|
|
1868
2048
|
key: "updateProductInOrder",
|
|
1869
2049
|
value: (function () {
|
|
1870
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1871
|
-
return _regeneratorRuntime().wrap(function
|
|
1872
|
-
while (1) switch (
|
|
2050
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2051
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2052
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1873
2053
|
case 0:
|
|
1874
|
-
return
|
|
2054
|
+
return _context25.abrupt("return", this.updateOrderProduct(params));
|
|
1875
2055
|
case 1:
|
|
1876
2056
|
case "end":
|
|
1877
|
-
return
|
|
2057
|
+
return _context25.stop();
|
|
1878
2058
|
}
|
|
1879
|
-
},
|
|
2059
|
+
}, _callee25, this);
|
|
1880
2060
|
}));
|
|
1881
2061
|
function updateProductInOrder(_x18) {
|
|
1882
2062
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -1900,47 +2080,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1900
2080
|
}, {
|
|
1901
2081
|
key: "handleGlobalScanCode",
|
|
1902
2082
|
value: (function () {
|
|
1903
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2083
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(code, bridge) {
|
|
1904
2084
|
var _this6 = this;
|
|
1905
2085
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
1906
|
-
return _regeneratorRuntime().wrap(function
|
|
1907
|
-
while (1) switch (
|
|
2086
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2087
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1908
2088
|
case 0:
|
|
1909
2089
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
1910
2090
|
if (trimmed) {
|
|
1911
|
-
|
|
2091
|
+
_context26.next = 4;
|
|
1912
2092
|
break;
|
|
1913
2093
|
}
|
|
1914
2094
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
1915
|
-
return
|
|
2095
|
+
return _context26.abrupt("return", {
|
|
1916
2096
|
status: 'failed',
|
|
1917
2097
|
reason: 'empty_code'
|
|
1918
2098
|
});
|
|
1919
2099
|
case 4:
|
|
1920
|
-
|
|
2100
|
+
_context26.prev = 4;
|
|
1921
2101
|
localSearch = function localSearch(v) {
|
|
1922
2102
|
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
1923
2103
|
};
|
|
1924
2104
|
scanCallback = handleGlobalScan(this.request, localSearch);
|
|
1925
|
-
|
|
2105
|
+
_context26.next = 9;
|
|
1926
2106
|
return scanCallback({
|
|
1927
2107
|
type: 'nativeScanner',
|
|
1928
2108
|
value: trimmed
|
|
1929
2109
|
});
|
|
1930
2110
|
case 9:
|
|
1931
|
-
raw =
|
|
2111
|
+
raw = _context26.sent;
|
|
1932
2112
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
1933
2113
|
if (formatted) {
|
|
1934
|
-
|
|
2114
|
+
_context26.next = 14;
|
|
1935
2115
|
break;
|
|
1936
2116
|
}
|
|
1937
2117
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
1938
|
-
return
|
|
2118
|
+
return _context26.abrupt("return", {
|
|
1939
2119
|
status: 'failed',
|
|
1940
2120
|
reason: 'not_found'
|
|
1941
2121
|
});
|
|
1942
2122
|
case 14:
|
|
1943
|
-
|
|
2123
|
+
_context26.next = 16;
|
|
1944
2124
|
return applyGlobalScan({
|
|
1945
2125
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
1946
2126
|
return _this6.setOrderCustomer(customer);
|
|
@@ -1969,23 +2149,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1969
2149
|
}
|
|
1970
2150
|
}, formatted, bridge);
|
|
1971
2151
|
case 16:
|
|
1972
|
-
_result7 =
|
|
2152
|
+
_result7 = _context26.sent;
|
|
1973
2153
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
1974
|
-
return
|
|
2154
|
+
return _context26.abrupt("return", _result7);
|
|
1975
2155
|
case 21:
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2156
|
+
_context26.prev = 21;
|
|
2157
|
+
_context26.t0 = _context26["catch"](4);
|
|
2158
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context26.t0);
|
|
1979
2159
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
1980
|
-
return
|
|
2160
|
+
return _context26.abrupt("return", {
|
|
1981
2161
|
status: 'failed',
|
|
1982
2162
|
reason: 'not_found'
|
|
1983
2163
|
});
|
|
1984
2164
|
case 26:
|
|
1985
2165
|
case "end":
|
|
1986
|
-
return
|
|
2166
|
+
return _context26.stop();
|
|
1987
2167
|
}
|
|
1988
|
-
},
|
|
2168
|
+
}, _callee26, this, [[4, 21]]);
|
|
1989
2169
|
}));
|
|
1990
2170
|
function handleGlobalScanCode(_x19, _x20) {
|
|
1991
2171
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -2000,12 +2180,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2000
2180
|
}, {
|
|
2001
2181
|
key: "destroy",
|
|
2002
2182
|
value: (function () {
|
|
2003
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2183
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2004
2184
|
var _this$scan;
|
|
2005
|
-
return _regeneratorRuntime().wrap(function
|
|
2006
|
-
while (1) switch (
|
|
2185
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2186
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2007
2187
|
case 0:
|
|
2008
|
-
|
|
2188
|
+
_context27.next = 2;
|
|
2009
2189
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
2010
2190
|
case 2:
|
|
2011
2191
|
try {
|
|
@@ -2016,9 +2196,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2016
2196
|
scanCache.clear();
|
|
2017
2197
|
case 4:
|
|
2018
2198
|
case "end":
|
|
2019
|
-
return
|
|
2199
|
+
return _context27.stop();
|
|
2020
2200
|
}
|
|
2021
|
-
},
|
|
2201
|
+
}, _callee27, this);
|
|
2022
2202
|
}));
|
|
2023
2203
|
function destroy() {
|
|
2024
2204
|
return _destroy.apply(this, arguments);
|