@pisell/pisellos 2.2.204 → 2.2.205
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 +0 -9
- package/dist/modules/Order/index.js +9 -3
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +730 -619
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/solution/BaseSales/index.d.ts +6 -1
- package/dist/solution/BaseSales/index.js +67 -18
- package/dist/solution/BookingTicket/index.js +1 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Order/index.js +5 -1
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +46 -0
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/solution/BaseSales/index.d.ts +6 -1
- package/lib/solution/BaseSales/index.js +51 -5
- package/lib/solution/BookingTicket/index.js +1 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
|
@@ -192,18 +192,17 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
192
192
|
}
|
|
193
193
|
function _applyGlobalScan() {
|
|
194
194
|
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(host, formatted, bridge) {
|
|
195
|
-
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _bridge$onNotify4, _bridge$onNotify3, snapshot, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, orderId, _bridge$onNotify7;
|
|
195
|
+
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _bridge$onNotify4, _bridge$onNotify3, snapshot, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, _data$business_code, orderId, _bridge$onNotify7;
|
|
196
196
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
197
197
|
while (1) switch (_context4.prev = _context4.next) {
|
|
198
198
|
case 0:
|
|
199
199
|
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
|
|
200
|
-
debugger;
|
|
201
200
|
if (!(searchType === 'wallet')) {
|
|
202
|
-
_context4.next =
|
|
201
|
+
_context4.next = 8;
|
|
203
202
|
break;
|
|
204
203
|
}
|
|
205
204
|
if (data) {
|
|
206
|
-
_context4.next =
|
|
205
|
+
_context4.next = 5;
|
|
207
206
|
break;
|
|
208
207
|
}
|
|
209
208
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -211,20 +210,20 @@ function _applyGlobalScan() {
|
|
|
211
210
|
status: 'failed',
|
|
212
211
|
reason: 'invalid_data'
|
|
213
212
|
});
|
|
214
|
-
case
|
|
213
|
+
case 5:
|
|
215
214
|
host.setOrderCustomer(data);
|
|
216
215
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
217
216
|
return _context4.abrupt("return", {
|
|
218
217
|
status: 'success',
|
|
219
218
|
kind: 'customer'
|
|
220
219
|
});
|
|
221
|
-
case
|
|
220
|
+
case 8:
|
|
222
221
|
if (!(searchType === 'walletPass')) {
|
|
223
|
-
_context4.next =
|
|
222
|
+
_context4.next = 25;
|
|
224
223
|
break;
|
|
225
224
|
}
|
|
226
225
|
if (data) {
|
|
227
|
-
_context4.next =
|
|
226
|
+
_context4.next = 12;
|
|
228
227
|
break;
|
|
229
228
|
}
|
|
230
229
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -232,53 +231,53 @@ function _applyGlobalScan() {
|
|
|
232
231
|
status: 'failed',
|
|
233
232
|
reason: 'invalid_data'
|
|
234
233
|
});
|
|
235
|
-
case
|
|
234
|
+
case 12:
|
|
236
235
|
snapshot = host.getOrderCustomerSnapshot();
|
|
237
236
|
if (!isWalkInCustomer(snapshot)) {
|
|
238
|
-
_context4.next =
|
|
237
|
+
_context4.next = 22;
|
|
239
238
|
break;
|
|
240
239
|
}
|
|
241
240
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
242
|
-
_context4.next =
|
|
241
|
+
_context4.next = 16;
|
|
243
242
|
break;
|
|
244
243
|
}
|
|
245
244
|
return _context4.abrupt("return", {
|
|
246
245
|
status: 'failed',
|
|
247
246
|
reason: 'no_bridge'
|
|
248
247
|
});
|
|
249
|
-
case
|
|
250
|
-
_context4.next =
|
|
248
|
+
case 16:
|
|
249
|
+
_context4.next = 18;
|
|
251
250
|
return bridge.applyPromotionCode(scanCode);
|
|
252
|
-
case
|
|
251
|
+
case 18:
|
|
253
252
|
result = _context4.sent;
|
|
254
253
|
if (!(result !== null && result !== void 0 && result.isAvailable)) {
|
|
255
|
-
_context4.next =
|
|
254
|
+
_context4.next = 21;
|
|
256
255
|
break;
|
|
257
256
|
}
|
|
258
257
|
return _context4.abrupt("return", {
|
|
259
258
|
status: 'success',
|
|
260
259
|
kind: 'promotion'
|
|
261
260
|
});
|
|
262
|
-
case
|
|
261
|
+
case 21:
|
|
263
262
|
return _context4.abrupt("return", {
|
|
264
263
|
status: 'failed',
|
|
265
264
|
reason: 'invalid_data'
|
|
266
265
|
});
|
|
267
|
-
case
|
|
266
|
+
case 22:
|
|
268
267
|
host.setOrderCustomer(data);
|
|
269
268
|
bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
270
269
|
return _context4.abrupt("return", {
|
|
271
270
|
status: 'success',
|
|
272
271
|
kind: 'customer'
|
|
273
272
|
});
|
|
274
|
-
case
|
|
273
|
+
case 25:
|
|
275
274
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
276
|
-
_context4.next =
|
|
275
|
+
_context4.next = 58;
|
|
277
276
|
break;
|
|
278
277
|
}
|
|
279
278
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
280
279
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
281
|
-
_context4.next =
|
|
280
|
+
_context4.next = 30;
|
|
282
281
|
break;
|
|
283
282
|
}
|
|
284
283
|
bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -286,57 +285,57 @@ function _applyGlobalScan() {
|
|
|
286
285
|
status: 'failed',
|
|
287
286
|
reason: 'invalid_data'
|
|
288
287
|
});
|
|
289
|
-
case
|
|
288
|
+
case 30:
|
|
290
289
|
addedCount = 0;
|
|
291
290
|
_iterator = _createForOfIteratorHelper(list);
|
|
292
|
-
_context4.prev =
|
|
291
|
+
_context4.prev = 32;
|
|
293
292
|
_iterator.s();
|
|
294
|
-
case
|
|
293
|
+
case 34:
|
|
295
294
|
if ((_step = _iterator.n()).done) {
|
|
296
|
-
_context4.next =
|
|
295
|
+
_context4.next = 46;
|
|
297
296
|
break;
|
|
298
297
|
}
|
|
299
298
|
_item = _step.value;
|
|
300
|
-
_context4.next =
|
|
299
|
+
_context4.next = 38;
|
|
301
300
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
302
|
-
case
|
|
301
|
+
case 38:
|
|
303
302
|
outcome = _context4.sent;
|
|
304
303
|
if (outcome === 'added') {
|
|
305
304
|
addedCount += 1;
|
|
306
305
|
}
|
|
307
306
|
if (!(outcome === 'cancelled')) {
|
|
308
|
-
_context4.next =
|
|
307
|
+
_context4.next = 42;
|
|
309
308
|
break;
|
|
310
309
|
}
|
|
311
310
|
return _context4.abrupt("return", {
|
|
312
311
|
status: 'cancelled'
|
|
313
312
|
});
|
|
314
|
-
case
|
|
313
|
+
case 42:
|
|
315
314
|
if (!(outcome === 'pending')) {
|
|
316
|
-
_context4.next =
|
|
315
|
+
_context4.next = 44;
|
|
317
316
|
break;
|
|
318
317
|
}
|
|
319
318
|
return _context4.abrupt("return", {
|
|
320
319
|
status: 'pending',
|
|
321
320
|
kind: 'requiresDetail'
|
|
322
321
|
});
|
|
323
|
-
case
|
|
324
|
-
_context4.next =
|
|
322
|
+
case 44:
|
|
323
|
+
_context4.next = 34;
|
|
325
324
|
break;
|
|
326
|
-
case
|
|
327
|
-
_context4.next =
|
|
325
|
+
case 46:
|
|
326
|
+
_context4.next = 51;
|
|
328
327
|
break;
|
|
329
|
-
case
|
|
330
|
-
_context4.prev =
|
|
331
|
-
_context4.t0 = _context4["catch"](
|
|
328
|
+
case 48:
|
|
329
|
+
_context4.prev = 48;
|
|
330
|
+
_context4.t0 = _context4["catch"](32);
|
|
332
331
|
_iterator.e(_context4.t0);
|
|
333
|
-
case
|
|
334
|
-
_context4.prev =
|
|
332
|
+
case 51:
|
|
333
|
+
_context4.prev = 51;
|
|
335
334
|
_iterator.f();
|
|
336
|
-
return _context4.finish(
|
|
337
|
-
case
|
|
335
|
+
return _context4.finish(51);
|
|
336
|
+
case 54:
|
|
338
337
|
if (!(addedCount > 0)) {
|
|
339
|
-
_context4.next =
|
|
338
|
+
_context4.next = 57;
|
|
340
339
|
break;
|
|
341
340
|
}
|
|
342
341
|
bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'success');
|
|
@@ -347,19 +346,19 @@ function _applyGlobalScan() {
|
|
|
347
346
|
count: addedCount
|
|
348
347
|
}
|
|
349
348
|
});
|
|
350
|
-
case
|
|
349
|
+
case 57:
|
|
351
350
|
return _context4.abrupt("return", {
|
|
352
351
|
status: 'failed',
|
|
353
352
|
reason: 'no_bridge'
|
|
354
353
|
});
|
|
355
|
-
case
|
|
354
|
+
case 58:
|
|
356
355
|
if (!(searchType === 'order')) {
|
|
357
|
-
_context4.next =
|
|
356
|
+
_context4.next = 67;
|
|
358
357
|
break;
|
|
359
358
|
}
|
|
360
359
|
orderId = (_data$order_id = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id !== void 0 ? _data$order_id : data === null || data === void 0 ? void 0 : data.id;
|
|
361
360
|
if (orderId) {
|
|
362
|
-
_context4.next =
|
|
361
|
+
_context4.next = 63;
|
|
363
362
|
break;
|
|
364
363
|
}
|
|
365
364
|
bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -367,34 +366,34 @@ function _applyGlobalScan() {
|
|
|
367
366
|
status: 'failed',
|
|
368
367
|
reason: 'invalid_data'
|
|
369
368
|
});
|
|
370
|
-
case
|
|
369
|
+
case 63:
|
|
371
370
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
372
|
-
_context4.next =
|
|
371
|
+
_context4.next = 65;
|
|
373
372
|
break;
|
|
374
373
|
}
|
|
375
374
|
return _context4.abrupt("return", {
|
|
376
375
|
status: 'pending',
|
|
377
376
|
kind: 'openOrder'
|
|
378
377
|
});
|
|
379
|
-
case
|
|
378
|
+
case 65:
|
|
380
379
|
bridge.openOrder({
|
|
381
380
|
order_id: Number(orderId),
|
|
382
|
-
business_code: host.getBusinessCode()
|
|
381
|
+
business_code: (_data$business_code = data === null || data === void 0 ? void 0 : data.business_code) !== null && _data$business_code !== void 0 ? _data$business_code : host.getBusinessCode()
|
|
383
382
|
});
|
|
384
383
|
return _context4.abrupt("return", {
|
|
385
384
|
status: 'pending',
|
|
386
385
|
kind: 'openOrder'
|
|
387
386
|
});
|
|
388
|
-
case
|
|
387
|
+
case 67:
|
|
389
388
|
return _context4.abrupt("return", {
|
|
390
389
|
status: 'failed',
|
|
391
390
|
reason: 'invalid_data'
|
|
392
391
|
});
|
|
393
|
-
case
|
|
392
|
+
case 68:
|
|
394
393
|
case "end":
|
|
395
394
|
return _context4.stop();
|
|
396
395
|
}
|
|
397
|
-
}, _callee4, null, [[
|
|
396
|
+
}, _callee4, null, [[32, 48, 51, 54]]);
|
|
398
397
|
}));
|
|
399
398
|
return _applyGlobalScan.apply(this, arguments);
|
|
400
399
|
}
|
|
@@ -14,12 +14,17 @@ declare enum ScanResultType {
|
|
|
14
14
|
NativeScanner = "nativeScanner"
|
|
15
15
|
}
|
|
16
16
|
export default class Scan {
|
|
17
|
+
private static scanInstances;
|
|
18
|
+
private static peripheralsListenerMounted;
|
|
17
19
|
private solution;
|
|
18
20
|
private watchKey;
|
|
19
21
|
private listenerConfig;
|
|
20
22
|
constructor(solution: BookingTicketImpl, watchKey: string);
|
|
21
23
|
/**
|
|
22
24
|
* 初始化外设扫码结果监听
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* scan.initPeripheralsListener();
|
|
23
28
|
*/
|
|
24
29
|
initPeripheralsListener(): void;
|
|
25
30
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _class;
|
|
1
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -24,6 +25,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
24
25
|
_defineProperty(this, "listenerConfig", new Map());
|
|
25
26
|
this.solution = solution;
|
|
26
27
|
this.watchKey = watchKey;
|
|
28
|
+
Scan.scanInstances.add(this);
|
|
27
29
|
|
|
28
30
|
// 初始化扫码监听
|
|
29
31
|
// this.initPeripheralsListener();
|
|
@@ -31,18 +33,23 @@ var Scan = /*#__PURE__*/function () {
|
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* 初始化外设扫码结果监听
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* scan.initPeripheralsListener();
|
|
34
39
|
*/
|
|
35
40
|
_createClass(Scan, [{
|
|
36
41
|
key: "initPeripheralsListener",
|
|
37
42
|
value: function initPeripheralsListener() {
|
|
38
|
-
var _this$solution,
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
var _this$solution, _this$solution$mountF;
|
|
44
|
+
if (Scan.peripheralsListenerMounted) return;
|
|
45
|
+
Scan.peripheralsListenerMounted = true;
|
|
41
46
|
(_this$solution = this.solution) === null || _this$solution === void 0 || (_this$solution = _this$solution.window) === null || _this$solution === void 0 || (_this$solution = _this$solution.interaction) === null || _this$solution === void 0 || (_this$solution = _this$solution.utils) === null || _this$solution === void 0 || (_this$solution$mountF = _this$solution.mountFunction) === null || _this$solution$mountF === void 0 || _this$solution$mountF.call(_this$solution, 'global', 'peripheralsResult', function (strVal) {
|
|
42
47
|
try {
|
|
43
48
|
var _result = JSON.parse(strVal);
|
|
44
49
|
console.log('nativeScannerResult>>>>>>>', _result);
|
|
45
|
-
|
|
50
|
+
Scan.scanInstances.forEach(function (instance) {
|
|
51
|
+
instance.handleScan(_result);
|
|
52
|
+
});
|
|
46
53
|
} catch (err) {
|
|
47
54
|
console.error(err);
|
|
48
55
|
}
|
|
@@ -61,8 +68,9 @@ var Scan = /*#__PURE__*/function () {
|
|
|
61
68
|
if (lastEnableEventKey) {
|
|
62
69
|
var listenerConfig = this.listenerConfig.get(lastEnableEventKey);
|
|
63
70
|
if (listenerConfig) {
|
|
71
|
+
var taskUuid = this.generateUuid();
|
|
64
72
|
listenerConfig.task.addTask({
|
|
65
|
-
uuid:
|
|
73
|
+
uuid: taskUuid,
|
|
66
74
|
type: lastEnableEventKey,
|
|
67
75
|
actionParams: {
|
|
68
76
|
scanResult: result
|
|
@@ -91,7 +99,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
91
99
|
}, {
|
|
92
100
|
key: "addListener",
|
|
93
101
|
value: function addListener(event, scanCallback) {
|
|
94
|
-
var
|
|
102
|
+
var _this = this;
|
|
95
103
|
// 订阅事件
|
|
96
104
|
watch.subscribe(this.watchKey, event);
|
|
97
105
|
// 创建任务
|
|
@@ -100,7 +108,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
100
108
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
101
109
|
args[_key] = arguments[_key];
|
|
102
110
|
}
|
|
103
|
-
return
|
|
111
|
+
return _this.scanTaskAction.apply(_this, [event.key].concat(args));
|
|
104
112
|
});
|
|
105
113
|
|
|
106
114
|
// 创建监听配置
|
|
@@ -110,7 +118,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
110
118
|
});
|
|
111
119
|
return {
|
|
112
120
|
remove: function remove() {
|
|
113
|
-
|
|
121
|
+
_this.removeListener(event);
|
|
114
122
|
}
|
|
115
123
|
};
|
|
116
124
|
}
|
|
@@ -136,6 +144,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
136
144
|
key: "removeAllListeners",
|
|
137
145
|
value: function removeAllListeners() {
|
|
138
146
|
var _this$listenerConfig, _this$listenerConfig$2, _this$listenerConfig2, _this$listenerConfig3;
|
|
147
|
+
Scan.scanInstances.delete(this);
|
|
139
148
|
watch.clearEvent(this.watchKey);
|
|
140
149
|
(_this$listenerConfig = this.listenerConfig) === null || _this$listenerConfig === void 0 || (_this$listenerConfig$2 = _this$listenerConfig.forEach) === null || _this$listenerConfig$2 === void 0 || _this$listenerConfig$2.call(_this$listenerConfig, function (item) {
|
|
141
150
|
var _item$task;
|
|
@@ -291,4 +300,7 @@ var Scan = /*#__PURE__*/function () {
|
|
|
291
300
|
}]);
|
|
292
301
|
return Scan;
|
|
293
302
|
}();
|
|
303
|
+
_class = Scan;
|
|
304
|
+
_defineProperty(Scan, "scanInstances", new Set());
|
|
305
|
+
_defineProperty(Scan, "peripheralsListenerMounted", false);
|
|
294
306
|
export { Scan as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
|
@@ -2014,6 +2014,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2014
2014
|
const matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex((item) => {
|
|
2015
2015
|
if (this.hasGoodPassDiscount(item))
|
|
2016
2016
|
return false;
|
|
2017
|
+
if (item.order_detail_id !== void 0 && item.order_detail_id !== null)
|
|
2018
|
+
return false;
|
|
2017
2019
|
if (item.product_id !== productToAdd.product_id)
|
|
2018
2020
|
return false;
|
|
2019
2021
|
if (item.product_variant_id !== productToAdd.product_variant_id)
|
|
@@ -2589,6 +2591,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2589
2591
|
submittedOrderId,
|
|
2590
2592
|
(resultRecord == null ? void 0 : resultRecord.data) || resultRecord || {}
|
|
2591
2593
|
);
|
|
2594
|
+
} else {
|
|
2595
|
+
this.store.syncState = "submitted";
|
|
2592
2596
|
}
|
|
2593
2597
|
return result;
|
|
2594
2598
|
}
|
|
@@ -2907,7 +2911,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2907
2911
|
hasOrderId: !!orderData.order_id,
|
|
2908
2912
|
smallTicketDataFlag: orderData.small_ticket_data_flag
|
|
2909
2913
|
});
|
|
2910
|
-
const response = await this.request.post("/
|
|
2914
|
+
const response = await this.request.post("/order/checkout", orderData, {
|
|
2911
2915
|
osServer: true,
|
|
2912
2916
|
customToast: () => {
|
|
2913
2917
|
}
|
|
@@ -25,9 +25,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
25
25
|
private dbManager;
|
|
26
26
|
private logger;
|
|
27
27
|
private voucherUpdateLockByOrderUuid;
|
|
28
|
-
private payMethodMemoryCache;
|
|
29
|
-
private payMethodListInFlight;
|
|
30
|
-
private isRefreshingPaymentMethods;
|
|
31
28
|
protected otherParams: any;
|
|
32
29
|
cash: CashPayment;
|
|
33
30
|
eftpos: EftposPayment;
|
|
@@ -57,20 +54,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
57
54
|
*
|
|
58
55
|
*/
|
|
59
56
|
private registerNetworkHandlers;
|
|
60
|
-
private filterPayMethods;
|
|
61
57
|
/**
|
|
62
58
|
* 获取支付方式列表
|
|
63
59
|
*/
|
|
64
60
|
getPayMethodListAsync(): Promise<PaymentMethod[]>;
|
|
65
|
-
private loadPayMethodListAsync;
|
|
66
|
-
/**
|
|
67
|
-
* 后台刷新支付方式列表
|
|
68
|
-
*/
|
|
69
|
-
private refreshPaymentMethodsInBackground;
|
|
70
|
-
/**
|
|
71
|
-
* 检查支付方式列表是否有变化
|
|
72
|
-
*/
|
|
73
|
-
private hasPaymentMethodsChanged;
|
|
74
61
|
/**
|
|
75
62
|
* 获取订单列表
|
|
76
63
|
*/
|