@pisell/pisellos 2.3.38 → 2.3.40
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -191,300 +191,210 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
191
191
|
return _applyGlobalScan.apply(this, arguments);
|
|
192
192
|
}
|
|
193
193
|
function _applyGlobalScan() {
|
|
194
|
-
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
195
|
-
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify,
|
|
196
|
-
return _regeneratorRuntime().wrap(function
|
|
197
|
-
while (1) switch (
|
|
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, scannedCustomerIsWalkIn, result, list, _bridge$onNotify5, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify6, _data$order_id, _data$business_code, orderId, _bridge$onNotify7;
|
|
196
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
197
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
198
198
|
case 0:
|
|
199
199
|
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
|
|
200
200
|
if (!(searchType === 'wallet')) {
|
|
201
|
-
|
|
201
|
+
_context4.next = 8;
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
if (data) {
|
|
205
|
-
|
|
205
|
+
_context4.next = 5;
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
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');
|
|
209
|
-
return
|
|
209
|
+
return _context4.abrupt("return", {
|
|
210
210
|
status: 'failed',
|
|
211
211
|
reason: 'invalid_data'
|
|
212
212
|
});
|
|
213
213
|
case 5:
|
|
214
214
|
host.setOrderCustomer(data);
|
|
215
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');
|
|
216
|
-
return
|
|
216
|
+
return _context4.abrupt("return", {
|
|
217
217
|
status: 'success',
|
|
218
218
|
kind: 'customer'
|
|
219
219
|
});
|
|
220
220
|
case 8:
|
|
221
221
|
if (!(searchType === 'walletPass')) {
|
|
222
|
-
|
|
222
|
+
_context4.next = 26;
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
|
+
if (data) {
|
|
226
|
+
_context4.next = 12;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
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');
|
|
230
|
+
return _context4.abrupt("return", {
|
|
231
|
+
status: 'failed',
|
|
232
|
+
reason: 'invalid_data'
|
|
233
|
+
});
|
|
234
|
+
case 12:
|
|
225
235
|
snapshot = host.getOrderCustomerSnapshot();
|
|
226
236
|
scannedCustomerIsWalkIn = isWalkInCustomer(data);
|
|
227
|
-
trySelectWalletAsset = /*#__PURE__*/function () {
|
|
228
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
229
|
-
var _bridge$onNotify4;
|
|
230
|
-
var walletResult, _bridge$onNotify3;
|
|
231
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
232
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
233
|
-
case 0:
|
|
234
|
-
if (host.scanWalletAsset) {
|
|
235
|
-
_context4.next = 2;
|
|
236
|
-
break;
|
|
237
|
-
}
|
|
238
|
-
return _context4.abrupt("return", null);
|
|
239
|
-
case 2:
|
|
240
|
-
_context4.next = 4;
|
|
241
|
-
return host.scanWalletAsset(scanCode).catch(function (error) {
|
|
242
|
-
console.warn('[GlobalScan] Wallet asset lookup failed', error);
|
|
243
|
-
return null;
|
|
244
|
-
});
|
|
245
|
-
case 4:
|
|
246
|
-
walletResult = _context4.sent;
|
|
247
|
-
if (walletResult) {
|
|
248
|
-
_context4.next = 7;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
return _context4.abrupt("return", null);
|
|
252
|
-
case 7:
|
|
253
|
-
if (!(walletResult.type !== 'normalCode' || !walletResult.asset)) {
|
|
254
|
-
_context4.next = 9;
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
return _context4.abrupt("return", null);
|
|
258
|
-
case 9:
|
|
259
|
-
if (!walletResult.selected) {
|
|
260
|
-
_context4.next = 12;
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'success');
|
|
264
|
-
return _context4.abrupt("return", {
|
|
265
|
-
status: 'success',
|
|
266
|
-
kind: 'promotion'
|
|
267
|
-
});
|
|
268
|
-
case 12:
|
|
269
|
-
// 已识别为 Wallet 支付资产但当前不可用:保留禁用展示,不回退优惠码。
|
|
270
|
-
bridge === null || bridge === void 0 || (_bridge$onNotify4 = bridge.onNotify) === null || _bridge$onNotify4 === void 0 || _bridge$onNotify4.call(bridge, 'fail', 'pisell2.text.goodpass.code-invalid-cart');
|
|
271
|
-
return _context4.abrupt("return", {
|
|
272
|
-
status: 'failed',
|
|
273
|
-
reason: 'invalid_data'
|
|
274
|
-
});
|
|
275
|
-
case 14:
|
|
276
|
-
case "end":
|
|
277
|
-
return _context4.stop();
|
|
278
|
-
}
|
|
279
|
-
}, _callee4);
|
|
280
|
-
}));
|
|
281
|
-
return function trySelectWalletAsset() {
|
|
282
|
-
return _ref2.apply(this, arguments);
|
|
283
|
-
};
|
|
284
|
-
}();
|
|
285
237
|
if (!(isWalkInCustomer(snapshot) || scannedCustomerIsWalkIn)) {
|
|
286
|
-
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
_context5.next = 15;
|
|
290
|
-
return trySelectWalletAsset();
|
|
291
|
-
case 15:
|
|
292
|
-
_walletSelection = _context5.sent;
|
|
293
|
-
if (!_walletSelection) {
|
|
294
|
-
_context5.next = 18;
|
|
238
|
+
_context4.next = 23;
|
|
295
239
|
break;
|
|
296
240
|
}
|
|
297
|
-
return _context5.abrupt("return", _walletSelection);
|
|
298
|
-
case 18:
|
|
299
241
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
300
|
-
|
|
242
|
+
_context4.next = 17;
|
|
301
243
|
break;
|
|
302
244
|
}
|
|
303
|
-
return
|
|
245
|
+
return _context4.abrupt("return", {
|
|
304
246
|
status: 'failed',
|
|
305
247
|
reason: 'no_bridge'
|
|
306
248
|
});
|
|
307
|
-
case
|
|
308
|
-
|
|
249
|
+
case 17:
|
|
250
|
+
_context4.next = 19;
|
|
309
251
|
return bridge.applyPromotionCode(scanCode);
|
|
310
|
-
case
|
|
311
|
-
result =
|
|
252
|
+
case 19:
|
|
253
|
+
result = _context4.sent;
|
|
312
254
|
if (!(result !== null && result !== void 0 && result.isAvailable)) {
|
|
313
|
-
|
|
255
|
+
_context4.next = 22;
|
|
314
256
|
break;
|
|
315
257
|
}
|
|
316
|
-
return
|
|
258
|
+
return _context4.abrupt("return", {
|
|
317
259
|
status: 'success',
|
|
318
260
|
kind: 'promotion'
|
|
319
261
|
});
|
|
320
|
-
case
|
|
321
|
-
return
|
|
262
|
+
case 22:
|
|
263
|
+
return _context4.abrupt("return", {
|
|
322
264
|
status: 'failed',
|
|
323
265
|
reason: 'invalid_data'
|
|
324
266
|
});
|
|
325
|
-
case
|
|
267
|
+
case 23:
|
|
326
268
|
host.setOrderCustomer(data);
|
|
327
|
-
|
|
328
|
-
return
|
|
329
|
-
preserveSelection: false
|
|
330
|
-
});
|
|
331
|
-
case 29:
|
|
332
|
-
_context5.next = 31;
|
|
333
|
-
return trySelectWalletAsset();
|
|
334
|
-
case 31:
|
|
335
|
-
walletSelection = _context5.sent;
|
|
336
|
-
if (!walletSelection) {
|
|
337
|
-
_context5.next = 34;
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
return _context5.abrupt("return", walletSelection);
|
|
341
|
-
case 34:
|
|
342
|
-
if (!(bridge !== null && bridge !== void 0 && bridge.applyPromotionCode)) {
|
|
343
|
-
_context5.next = 40;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
_context5.next = 37;
|
|
347
|
-
return bridge.applyPromotionCode(scanCode, Number((_data$id = data === null || data === void 0 ? void 0 : data.id) !== null && _data$id !== void 0 ? _data$id : data === null || data === void 0 ? void 0 : data.customer_id) || undefined);
|
|
348
|
-
case 37:
|
|
349
|
-
promotionResult = _context5.sent;
|
|
350
|
-
if (!(promotionResult !== null && promotionResult !== void 0 && promotionResult.isAvailable)) {
|
|
351
|
-
_context5.next = 40;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
return _context5.abrupt("return", {
|
|
355
|
-
status: 'success',
|
|
356
|
-
kind: 'promotion'
|
|
357
|
-
});
|
|
358
|
-
case 40:
|
|
359
|
-
bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'success', 'pisell2.text.add-client-success');
|
|
360
|
-
return _context5.abrupt("return", {
|
|
269
|
+
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
|
+
return _context4.abrupt("return", {
|
|
361
271
|
status: 'success',
|
|
362
272
|
kind: 'customer'
|
|
363
273
|
});
|
|
364
|
-
case
|
|
274
|
+
case 26:
|
|
365
275
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
366
|
-
|
|
276
|
+
_context4.next = 59;
|
|
367
277
|
break;
|
|
368
278
|
}
|
|
369
279
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
370
280
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
371
|
-
|
|
281
|
+
_context4.next = 31;
|
|
372
282
|
break;
|
|
373
283
|
}
|
|
374
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
375
|
-
return
|
|
284
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify5 = bridge.onNotify) === null || _bridge$onNotify5 === void 0 || _bridge$onNotify5.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
285
|
+
return _context4.abrupt("return", {
|
|
376
286
|
status: 'failed',
|
|
377
287
|
reason: 'invalid_data'
|
|
378
288
|
});
|
|
379
|
-
case
|
|
289
|
+
case 31:
|
|
380
290
|
addedCount = 0;
|
|
381
291
|
_iterator = _createForOfIteratorHelper(list);
|
|
382
|
-
|
|
292
|
+
_context4.prev = 33;
|
|
383
293
|
_iterator.s();
|
|
384
|
-
case
|
|
294
|
+
case 35:
|
|
385
295
|
if ((_step = _iterator.n()).done) {
|
|
386
|
-
|
|
296
|
+
_context4.next = 47;
|
|
387
297
|
break;
|
|
388
298
|
}
|
|
389
299
|
_item = _step.value;
|
|
390
|
-
|
|
300
|
+
_context4.next = 39;
|
|
391
301
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
392
|
-
case
|
|
393
|
-
outcome =
|
|
302
|
+
case 39:
|
|
303
|
+
outcome = _context4.sent;
|
|
394
304
|
if (outcome === 'added') {
|
|
395
305
|
addedCount += 1;
|
|
396
306
|
}
|
|
397
307
|
if (!(outcome === 'cancelled')) {
|
|
398
|
-
|
|
308
|
+
_context4.next = 43;
|
|
399
309
|
break;
|
|
400
310
|
}
|
|
401
|
-
return
|
|
311
|
+
return _context4.abrupt("return", {
|
|
402
312
|
status: 'cancelled'
|
|
403
313
|
});
|
|
404
|
-
case
|
|
314
|
+
case 43:
|
|
405
315
|
if (!(outcome === 'pending')) {
|
|
406
|
-
|
|
316
|
+
_context4.next = 45;
|
|
407
317
|
break;
|
|
408
318
|
}
|
|
409
|
-
return
|
|
319
|
+
return _context4.abrupt("return", {
|
|
410
320
|
status: 'pending',
|
|
411
321
|
kind: 'requiresDetail'
|
|
412
322
|
});
|
|
413
|
-
case
|
|
414
|
-
|
|
323
|
+
case 45:
|
|
324
|
+
_context4.next = 35;
|
|
415
325
|
break;
|
|
416
|
-
case
|
|
417
|
-
|
|
326
|
+
case 47:
|
|
327
|
+
_context4.next = 52;
|
|
418
328
|
break;
|
|
419
|
-
case
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
_iterator.e(
|
|
423
|
-
case
|
|
424
|
-
|
|
329
|
+
case 49:
|
|
330
|
+
_context4.prev = 49;
|
|
331
|
+
_context4.t0 = _context4["catch"](33);
|
|
332
|
+
_iterator.e(_context4.t0);
|
|
333
|
+
case 52:
|
|
334
|
+
_context4.prev = 52;
|
|
425
335
|
_iterator.f();
|
|
426
|
-
return
|
|
427
|
-
case
|
|
336
|
+
return _context4.finish(52);
|
|
337
|
+
case 55:
|
|
428
338
|
if (!(addedCount > 0)) {
|
|
429
|
-
|
|
339
|
+
_context4.next = 58;
|
|
430
340
|
break;
|
|
431
341
|
}
|
|
432
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
433
|
-
return
|
|
342
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'success');
|
|
343
|
+
return _context4.abrupt("return", {
|
|
434
344
|
status: 'success',
|
|
435
345
|
kind: 'products',
|
|
436
346
|
meta: {
|
|
437
347
|
count: addedCount
|
|
438
348
|
}
|
|
439
349
|
});
|
|
440
|
-
case
|
|
441
|
-
return
|
|
350
|
+
case 58:
|
|
351
|
+
return _context4.abrupt("return", {
|
|
442
352
|
status: 'failed',
|
|
443
353
|
reason: 'no_bridge'
|
|
444
354
|
});
|
|
445
|
-
case
|
|
355
|
+
case 59:
|
|
446
356
|
if (!(searchType === 'order')) {
|
|
447
|
-
|
|
357
|
+
_context4.next = 68;
|
|
448
358
|
break;
|
|
449
359
|
}
|
|
450
360
|
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;
|
|
451
361
|
if (orderId) {
|
|
452
|
-
|
|
362
|
+
_context4.next = 64;
|
|
453
363
|
break;
|
|
454
364
|
}
|
|
455
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
456
|
-
return
|
|
365
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
366
|
+
return _context4.abrupt("return", {
|
|
457
367
|
status: 'failed',
|
|
458
368
|
reason: 'invalid_data'
|
|
459
369
|
});
|
|
460
|
-
case
|
|
370
|
+
case 64:
|
|
461
371
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
462
|
-
|
|
372
|
+
_context4.next = 66;
|
|
463
373
|
break;
|
|
464
374
|
}
|
|
465
|
-
return
|
|
375
|
+
return _context4.abrupt("return", {
|
|
466
376
|
status: 'pending',
|
|
467
377
|
kind: 'openOrder'
|
|
468
378
|
});
|
|
469
|
-
case
|
|
379
|
+
case 66:
|
|
470
380
|
bridge.openOrder({
|
|
471
381
|
order_id: Number(orderId),
|
|
472
382
|
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()
|
|
473
383
|
});
|
|
474
|
-
return
|
|
384
|
+
return _context4.abrupt("return", {
|
|
475
385
|
status: 'pending',
|
|
476
386
|
kind: 'openOrder'
|
|
477
387
|
});
|
|
478
|
-
case
|
|
479
|
-
return
|
|
388
|
+
case 68:
|
|
389
|
+
return _context4.abrupt("return", {
|
|
480
390
|
status: 'failed',
|
|
481
391
|
reason: 'invalid_data'
|
|
482
392
|
});
|
|
483
|
-
case
|
|
393
|
+
case 69:
|
|
484
394
|
case "end":
|
|
485
|
-
return
|
|
395
|
+
return _context4.stop();
|
|
486
396
|
}
|
|
487
|
-
},
|
|
397
|
+
}, _callee4, null, [[33, 49, 52, 55]]);
|
|
488
398
|
}));
|
|
489
399
|
return _applyGlobalScan.apply(this, arguments);
|
|
490
400
|
}
|
|
@@ -2,9 +2,11 @@ import { RequestPlugin } from '../../../../plugins';
|
|
|
2
2
|
/**
|
|
3
3
|
* 处理全局扫码
|
|
4
4
|
* @param request 请求插件
|
|
5
|
+
* @param localSearch 本地商品搜索
|
|
6
|
+
* @param channel 当前销售渠道
|
|
5
7
|
* @returns 处理结果
|
|
6
8
|
*/
|
|
7
|
-
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
|
|
9
|
+
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[], channel?: string) => (scanResult: {
|
|
8
10
|
type: string;
|
|
9
11
|
value: string;
|
|
10
12
|
}) => Promise<any>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
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
9
|
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); } }
|
|
4
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -150,16 +156,18 @@ var handleScanFn = function handleScanFn(getRequestList, localSearch) {
|
|
|
150
156
|
/**
|
|
151
157
|
* 处理全局扫码
|
|
152
158
|
* @param request 请求插件
|
|
159
|
+
* @param localSearch 本地商品搜索
|
|
160
|
+
* @param channel 当前销售渠道
|
|
153
161
|
* @returns 处理结果
|
|
154
162
|
*/
|
|
155
|
-
export var handleGlobalScan = function handleGlobalScan(request, localSearch) {
|
|
163
|
+
export var handleGlobalScan = function handleGlobalScan(request, localSearch, channel) {
|
|
156
164
|
var getRequestList = function getRequestList(value) {
|
|
157
165
|
var requestList = [];
|
|
158
166
|
// 如果value是已WL开头的,则认为是钱包识别码
|
|
159
167
|
if (value.startsWith('WL')) {
|
|
160
168
|
requestList = [searchWallet(request, value)];
|
|
161
169
|
} else {
|
|
162
|
-
requestList = [searchOrder(request, value), searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)];
|
|
170
|
+
requestList = [].concat(_toConsumableArray(channel === 'kiosk' ? [] : [searchOrder(request, value)]), [searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)]);
|
|
163
171
|
}
|
|
164
172
|
return requestList;
|
|
165
173
|
};
|
|
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
84
|
private isBookingIncludedInStats;
|
|
85
85
|
private getBookingOrderPaymentStatus;
|
|
86
|
-
private isUnpaidBooking;
|
|
87
86
|
private countBookingOrders;
|
|
88
87
|
private countCompletedBookings;
|
|
89
88
|
private groupBookingsByResource;
|
|
@@ -29,7 +29,6 @@ import dayjs from 'dayjs';
|
|
|
29
29
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
30
|
import { SalesHooks } from "./types";
|
|
31
31
|
export * from "./types";
|
|
32
|
-
var UNPAID_PAYMENT_STATUSES = new Set(['unpaid', 'partially_paid', 'payment_processing']);
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* Sales 解决方案基础骨架
|
|
@@ -416,11 +415,6 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
416
415
|
var _booking$order$paymen, _booking$order;
|
|
417
416
|
return String((_booking$order$paymen = (_booking$order = booking.order) === null || _booking$order === void 0 ? void 0 : _booking$order.payment_status) !== null && _booking$order$paymen !== void 0 ? _booking$order$paymen : '');
|
|
418
417
|
}
|
|
419
|
-
}, {
|
|
420
|
-
key: "isUnpaidBooking",
|
|
421
|
-
value: function isUnpaidBooking(booking) {
|
|
422
|
-
return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
|
|
423
|
-
}
|
|
424
418
|
}, {
|
|
425
419
|
key: "countBookingOrders",
|
|
426
420
|
value: function countBookingOrders(bookings) {
|
|
@@ -901,11 +895,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
901
895
|
});
|
|
902
896
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
903
897
|
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
904
|
-
});
|
|
905
|
-
// (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
|
|
906
|
-
// );
|
|
898
|
+
});
|
|
907
899
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
908
|
-
return _this7.
|
|
900
|
+
return _this7.getBookingOrderPaymentStatus(booking) === 'unpaid' || _this7.getBookingOrderPaymentStatus(booking) === 'payment_processing';
|
|
909
901
|
});
|
|
910
902
|
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
911
903
|
completedBookings = completedBookingList.map(function (booking) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
-
import {
|
|
3
|
-
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
|
|
2
|
+
import { BaseSalesImpl } from '../BaseSales';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
|
|
4
4
|
import type { UpdateOrderProductParams } from '../../modules/Order/types';
|
|
5
5
|
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
+
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
6
7
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
8
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
9
|
import type { ProductData } from '../../modules/Product/types';
|
|
@@ -15,16 +16,16 @@ interface ScanOrderItemRuleRuntimeConfig {
|
|
|
15
16
|
submissionIndex?: number;
|
|
16
17
|
custom?: Record<string, any>;
|
|
17
18
|
}
|
|
18
|
-
export declare class ScanOrderImpl extends
|
|
19
|
+
export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
|
|
19
20
|
protected defaultName: string;
|
|
20
21
|
protected defaultVersion: string;
|
|
21
22
|
isSolution: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
protected initializeOptions: ModuleOptions;
|
|
24
|
+
protected store: ScanOrderState;
|
|
25
|
+
protected otherParams: Record<string, any>;
|
|
26
|
+
protected cacheId: string | undefined;
|
|
27
|
+
window: WindowPlugin;
|
|
28
|
+
request: RequestPlugin;
|
|
28
29
|
private itemRuleEvaluator;
|
|
29
30
|
private itemRuleConfigs;
|
|
30
31
|
private itemRuleConfigsPromise;
|
|
@@ -53,9 +54,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
53
54
|
private registerCustomerLoginListeners;
|
|
54
55
|
private refreshOrderMarketingAfterLogin;
|
|
55
56
|
constructor(name?: string, version?: string);
|
|
57
|
+
protected getRegisteredModuleNames(): readonly string[];
|
|
58
|
+
protected createSubModule(moduleName: string): Module | null;
|
|
56
59
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
60
|
getCacheId(): string | undefined;
|
|
58
|
-
private destroyRegisteredChildModules;
|
|
59
61
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
62
|
destroy(): Promise<void>;
|
|
61
63
|
retryInit(): Promise<void>;
|
|
@@ -71,12 +73,14 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
71
73
|
};
|
|
72
74
|
getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
|
|
73
75
|
updateTempOrderNote(note: string): string;
|
|
76
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
77
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
74
78
|
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
|
-
service_type: 'dine_in';
|
|
79
|
+
service_type: 'dine_in' | '';
|
|
76
80
|
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
81
|
};
|
|
78
82
|
setPickupRef(buzzer: string): string;
|
|
79
|
-
private
|
|
83
|
+
private ensureScanOrderTempOrder;
|
|
80
84
|
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
81
85
|
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
82
86
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
@@ -92,7 +96,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
92
96
|
}): Promise<void>;
|
|
93
97
|
private findReservationRuleResource;
|
|
94
98
|
private buildScanOrderResourceMetadata;
|
|
99
|
+
private prepareRetailAvailability;
|
|
95
100
|
private buildSubmitPayloadEnhancer;
|
|
101
|
+
private isScanOrderMoreMode;
|
|
102
|
+
private submitScanOrderMore;
|
|
96
103
|
submitScanOrder<T = any>(): Promise<T>;
|
|
97
104
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
98
105
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
@@ -117,8 +124,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
117
124
|
setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
|
|
118
125
|
private normalizeResourceState;
|
|
119
126
|
private resolveResourceSelectType;
|
|
120
|
-
private
|
|
121
|
-
|
|
127
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
128
|
+
private resolveAdditionalOrderFromOccupyDetail;
|
|
129
|
+
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
130
|
+
restorePreviousOrderData(): Promise<void>;
|
|
122
131
|
getAdditionalOrderInfo(): Promise<{
|
|
123
132
|
orderId: string;
|
|
124
133
|
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|
|
@@ -141,6 +150,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
141
150
|
clearUIState(): void;
|
|
142
151
|
setEntryPaxNumber(number: number): Promise<void>;
|
|
143
152
|
getEntryPaxNumber(): number | null;
|
|
153
|
+
syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
|
|
154
|
+
getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
|
|
155
|
+
checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
|
|
144
156
|
getFulfillmentModes(): {
|
|
145
157
|
enablePickup: boolean;
|
|
146
158
|
enableTableService: boolean;
|