@pisell/pisellos 2.3.40 → 2.3.41
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 +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +8 -4
- package/dist/solution/BookingTicket/index.js +134 -51
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +8 -4
- package/lib/solution/BookingTicket/index.js +64 -19
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -191,210 +191,300 @@ 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 _callee5(host, formatted, bridge) {
|
|
195
|
+
var searchType, data, scanCode, _bridge$onNotify2, _bridge$onNotify, _host$refreshWalletAs, _bridge$onNotify5, snapshot, scannedCustomerIsWalkIn, trySelectWalletAsset, _walletSelection, result, walletSelection, _data$id, promotionResult, list, _bridge$onNotify6, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify7, _data$order_id, _data$business_code, orderId, _bridge$onNotify8;
|
|
196
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
197
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
198
198
|
case 0:
|
|
199
199
|
searchType = formatted.searchType, data = formatted.data, scanCode = formatted.scanCode;
|
|
200
200
|
if (!(searchType === 'wallet')) {
|
|
201
|
-
|
|
201
|
+
_context5.next = 8;
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
if (data) {
|
|
205
|
-
|
|
205
|
+
_context5.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 _context5.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 _context5.abrupt("return", {
|
|
217
217
|
status: 'success',
|
|
218
218
|
kind: 'customer'
|
|
219
219
|
});
|
|
220
220
|
case 8:
|
|
221
221
|
if (!(searchType === 'walletPass')) {
|
|
222
|
-
|
|
222
|
+
_context5.next = 42;
|
|
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:
|
|
235
225
|
snapshot = host.getOrderCustomerSnapshot();
|
|
236
226
|
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
|
+
}();
|
|
237
285
|
if (!(isWalkInCustomer(snapshot) || scannedCustomerIsWalkIn)) {
|
|
238
|
-
|
|
286
|
+
_context5.next = 26;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
_context5.next = 15;
|
|
290
|
+
return trySelectWalletAsset();
|
|
291
|
+
case 15:
|
|
292
|
+
_walletSelection = _context5.sent;
|
|
293
|
+
if (!_walletSelection) {
|
|
294
|
+
_context5.next = 18;
|
|
239
295
|
break;
|
|
240
296
|
}
|
|
297
|
+
return _context5.abrupt("return", _walletSelection);
|
|
298
|
+
case 18:
|
|
241
299
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
242
|
-
|
|
300
|
+
_context5.next = 20;
|
|
243
301
|
break;
|
|
244
302
|
}
|
|
245
|
-
return
|
|
303
|
+
return _context5.abrupt("return", {
|
|
246
304
|
status: 'failed',
|
|
247
305
|
reason: 'no_bridge'
|
|
248
306
|
});
|
|
249
|
-
case
|
|
250
|
-
|
|
307
|
+
case 20:
|
|
308
|
+
_context5.next = 22;
|
|
251
309
|
return bridge.applyPromotionCode(scanCode);
|
|
252
|
-
case
|
|
253
|
-
result =
|
|
310
|
+
case 22:
|
|
311
|
+
result = _context5.sent;
|
|
254
312
|
if (!(result !== null && result !== void 0 && result.isAvailable)) {
|
|
255
|
-
|
|
313
|
+
_context5.next = 25;
|
|
256
314
|
break;
|
|
257
315
|
}
|
|
258
|
-
return
|
|
316
|
+
return _context5.abrupt("return", {
|
|
259
317
|
status: 'success',
|
|
260
318
|
kind: 'promotion'
|
|
261
319
|
});
|
|
262
|
-
case
|
|
263
|
-
return
|
|
320
|
+
case 25:
|
|
321
|
+
return _context5.abrupt("return", {
|
|
264
322
|
status: 'failed',
|
|
265
323
|
reason: 'invalid_data'
|
|
266
324
|
});
|
|
267
|
-
case
|
|
325
|
+
case 26:
|
|
268
326
|
host.setOrderCustomer(data);
|
|
269
|
-
|
|
270
|
-
return
|
|
327
|
+
_context5.next = 29;
|
|
328
|
+
return (_host$refreshWalletAs = host.refreshWalletAssets) === null || _host$refreshWalletAs === void 0 ? void 0 : _host$refreshWalletAs.call(host, {
|
|
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", {
|
|
271
361
|
status: 'success',
|
|
272
362
|
kind: 'customer'
|
|
273
363
|
});
|
|
274
|
-
case
|
|
364
|
+
case 42:
|
|
275
365
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
276
|
-
|
|
366
|
+
_context5.next = 75;
|
|
277
367
|
break;
|
|
278
368
|
}
|
|
279
369
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
280
370
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
281
|
-
|
|
371
|
+
_context5.next = 47;
|
|
282
372
|
break;
|
|
283
373
|
}
|
|
284
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
285
|
-
return
|
|
374
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify6 = bridge.onNotify) === null || _bridge$onNotify6 === void 0 || _bridge$onNotify6.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
375
|
+
return _context5.abrupt("return", {
|
|
286
376
|
status: 'failed',
|
|
287
377
|
reason: 'invalid_data'
|
|
288
378
|
});
|
|
289
|
-
case
|
|
379
|
+
case 47:
|
|
290
380
|
addedCount = 0;
|
|
291
381
|
_iterator = _createForOfIteratorHelper(list);
|
|
292
|
-
|
|
382
|
+
_context5.prev = 49;
|
|
293
383
|
_iterator.s();
|
|
294
|
-
case
|
|
384
|
+
case 51:
|
|
295
385
|
if ((_step = _iterator.n()).done) {
|
|
296
|
-
|
|
386
|
+
_context5.next = 63;
|
|
297
387
|
break;
|
|
298
388
|
}
|
|
299
389
|
_item = _step.value;
|
|
300
|
-
|
|
390
|
+
_context5.next = 55;
|
|
301
391
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
302
|
-
case
|
|
303
|
-
outcome =
|
|
392
|
+
case 55:
|
|
393
|
+
outcome = _context5.sent;
|
|
304
394
|
if (outcome === 'added') {
|
|
305
395
|
addedCount += 1;
|
|
306
396
|
}
|
|
307
397
|
if (!(outcome === 'cancelled')) {
|
|
308
|
-
|
|
398
|
+
_context5.next = 59;
|
|
309
399
|
break;
|
|
310
400
|
}
|
|
311
|
-
return
|
|
401
|
+
return _context5.abrupt("return", {
|
|
312
402
|
status: 'cancelled'
|
|
313
403
|
});
|
|
314
|
-
case
|
|
404
|
+
case 59:
|
|
315
405
|
if (!(outcome === 'pending')) {
|
|
316
|
-
|
|
406
|
+
_context5.next = 61;
|
|
317
407
|
break;
|
|
318
408
|
}
|
|
319
|
-
return
|
|
409
|
+
return _context5.abrupt("return", {
|
|
320
410
|
status: 'pending',
|
|
321
411
|
kind: 'requiresDetail'
|
|
322
412
|
});
|
|
323
|
-
case
|
|
324
|
-
|
|
413
|
+
case 61:
|
|
414
|
+
_context5.next = 51;
|
|
325
415
|
break;
|
|
326
|
-
case
|
|
327
|
-
|
|
416
|
+
case 63:
|
|
417
|
+
_context5.next = 68;
|
|
328
418
|
break;
|
|
329
|
-
case
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
_iterator.e(
|
|
333
|
-
case
|
|
334
|
-
|
|
419
|
+
case 65:
|
|
420
|
+
_context5.prev = 65;
|
|
421
|
+
_context5.t0 = _context5["catch"](49);
|
|
422
|
+
_iterator.e(_context5.t0);
|
|
423
|
+
case 68:
|
|
424
|
+
_context5.prev = 68;
|
|
335
425
|
_iterator.f();
|
|
336
|
-
return
|
|
337
|
-
case
|
|
426
|
+
return _context5.finish(68);
|
|
427
|
+
case 71:
|
|
338
428
|
if (!(addedCount > 0)) {
|
|
339
|
-
|
|
429
|
+
_context5.next = 74;
|
|
340
430
|
break;
|
|
341
431
|
}
|
|
342
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
343
|
-
return
|
|
432
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify7 = bridge.onNotify) === null || _bridge$onNotify7 === void 0 || _bridge$onNotify7.call(bridge, 'success');
|
|
433
|
+
return _context5.abrupt("return", {
|
|
344
434
|
status: 'success',
|
|
345
435
|
kind: 'products',
|
|
346
436
|
meta: {
|
|
347
437
|
count: addedCount
|
|
348
438
|
}
|
|
349
439
|
});
|
|
350
|
-
case
|
|
351
|
-
return
|
|
440
|
+
case 74:
|
|
441
|
+
return _context5.abrupt("return", {
|
|
352
442
|
status: 'failed',
|
|
353
443
|
reason: 'no_bridge'
|
|
354
444
|
});
|
|
355
|
-
case
|
|
445
|
+
case 75:
|
|
356
446
|
if (!(searchType === 'order')) {
|
|
357
|
-
|
|
447
|
+
_context5.next = 84;
|
|
358
448
|
break;
|
|
359
449
|
}
|
|
360
450
|
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
451
|
if (orderId) {
|
|
362
|
-
|
|
452
|
+
_context5.next = 80;
|
|
363
453
|
break;
|
|
364
454
|
}
|
|
365
|
-
bridge === null || bridge === void 0 || (_bridge$
|
|
366
|
-
return
|
|
455
|
+
bridge === null || bridge === void 0 || (_bridge$onNotify8 = bridge.onNotify) === null || _bridge$onNotify8 === void 0 || _bridge$onNotify8.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
456
|
+
return _context5.abrupt("return", {
|
|
367
457
|
status: 'failed',
|
|
368
458
|
reason: 'invalid_data'
|
|
369
459
|
});
|
|
370
|
-
case
|
|
460
|
+
case 80:
|
|
371
461
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
372
|
-
|
|
462
|
+
_context5.next = 82;
|
|
373
463
|
break;
|
|
374
464
|
}
|
|
375
|
-
return
|
|
465
|
+
return _context5.abrupt("return", {
|
|
376
466
|
status: 'pending',
|
|
377
467
|
kind: 'openOrder'
|
|
378
468
|
});
|
|
379
|
-
case
|
|
469
|
+
case 82:
|
|
380
470
|
bridge.openOrder({
|
|
381
471
|
order_id: Number(orderId),
|
|
382
472
|
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
473
|
});
|
|
384
|
-
return
|
|
474
|
+
return _context5.abrupt("return", {
|
|
385
475
|
status: 'pending',
|
|
386
476
|
kind: 'openOrder'
|
|
387
477
|
});
|
|
388
|
-
case
|
|
389
|
-
return
|
|
478
|
+
case 84:
|
|
479
|
+
return _context5.abrupt("return", {
|
|
390
480
|
status: 'failed',
|
|
391
481
|
reason: 'invalid_data'
|
|
392
482
|
});
|
|
393
|
-
case
|
|
483
|
+
case 85:
|
|
394
484
|
case "end":
|
|
395
|
-
return
|
|
485
|
+
return _context5.stop();
|
|
396
486
|
}
|
|
397
|
-
},
|
|
487
|
+
}, _callee5, null, [[49, 65, 68, 71]]);
|
|
398
488
|
}));
|
|
399
489
|
return _applyGlobalScan.apply(this, arguments);
|
|
400
490
|
}
|
|
@@ -2,11 +2,9 @@ import { RequestPlugin } from '../../../../plugins';
|
|
|
2
2
|
/**
|
|
3
3
|
* 处理全局扫码
|
|
4
4
|
* @param request 请求插件
|
|
5
|
-
* @param localSearch 本地商品搜索
|
|
6
|
-
* @param channel 当前销售渠道
|
|
7
5
|
* @returns 处理结果
|
|
8
6
|
*/
|
|
9
|
-
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]
|
|
7
|
+
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
|
|
10
8
|
type: string;
|
|
11
9
|
value: string;
|
|
12
10
|
}) => Promise<any>;
|
|
@@ -1,10 +1,4 @@
|
|
|
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; }
|
|
8
2
|
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; }
|
|
9
3
|
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); } }
|
|
10
4
|
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); }); }; }
|
|
@@ -156,18 +150,16 @@ var handleScanFn = function handleScanFn(getRequestList, localSearch) {
|
|
|
156
150
|
/**
|
|
157
151
|
* 处理全局扫码
|
|
158
152
|
* @param request 请求插件
|
|
159
|
-
* @param localSearch 本地商品搜索
|
|
160
|
-
* @param channel 当前销售渠道
|
|
161
153
|
* @returns 处理结果
|
|
162
154
|
*/
|
|
163
|
-
export var handleGlobalScan = function handleGlobalScan(request, localSearch
|
|
155
|
+
export var handleGlobalScan = function handleGlobalScan(request, localSearch) {
|
|
164
156
|
var getRequestList = function getRequestList(value) {
|
|
165
157
|
var requestList = [];
|
|
166
158
|
// 如果value是已WL开头的,则认为是钱包识别码
|
|
167
159
|
if (value.startsWith('WL')) {
|
|
168
160
|
requestList = [searchWallet(request, value)];
|
|
169
161
|
} else {
|
|
170
|
-
requestList = [
|
|
162
|
+
requestList = [searchOrder(request, value), searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)];
|
|
171
163
|
}
|
|
172
164
|
return requestList;
|
|
173
165
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
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); }
|
|
7
|
+
var WEIGHT_UNIT_MAP = {
|
|
8
|
+
KILOGRAMS: 'kg',
|
|
9
|
+
GRAMS: 'g',
|
|
10
|
+
POUNDS: 'lb',
|
|
11
|
+
OUNCES: 'oz'
|
|
12
|
+
};
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 将规格弹窗的称重结果写入订单行权威字段 product_sku。
|
|
19
|
+
* 商品目录已有的 SKU 字段会保留,本次称重结果只覆盖运行态称重字段。
|
|
20
|
+
*/
|
|
21
|
+
export function buildProductSkuFromCacheItem(cacheItem) {
|
|
22
|
+
var _cacheItem$_extend, _cacheItem$_extend2, _weighing$unit_weight, _weighing$tare$label, _weighing$tare, _weighing$tare$value, _weighing$tare2, _weighing$weight, _weighing$net_weight;
|
|
23
|
+
var currentSku = isRecord(cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_sku) ? cacheItem.product_sku : undefined;
|
|
24
|
+
var weighing = isRecord(cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.weighing) ? cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.weighing : undefined;
|
|
25
|
+
var hasRuntimeWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1 && ((currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.net_weight) !== undefined || (currentSku === null || currentSku === void 0 ? void 0 : currentSku.weight_source) !== undefined);
|
|
26
|
+
var isWeighingSku = Number((currentSku === null || currentSku === void 0 ? void 0 : currentSku.open_sold_weight) || 0) === 1;
|
|
27
|
+
|
|
28
|
+
// 普通商品维持旧转换行为,不把目录侧完整 SKU 引入订单行。
|
|
29
|
+
if (!isWeighingSku && !weighing) return undefined;
|
|
30
|
+
// 新版 SkuDetailModal 已直接生成 product_sku;_extend.weighing 只作为旧调用方回退。
|
|
31
|
+
if (hasRuntimeWeighingSku) return _objectSpread({}, currentSku);
|
|
32
|
+
if (!weighing) return currentSku ? _objectSpread({}, currentSku) : undefined;
|
|
33
|
+
return _objectSpread(_objectSpread({}, currentSku || {}), {}, {
|
|
34
|
+
open_sold_weight: 1,
|
|
35
|
+
unit_data_snapshot: weighing.scalePriceProduct,
|
|
36
|
+
unit: WEIGHT_UNIT_MAP[String(weighing.unit)] || weighing.unit,
|
|
37
|
+
unit_weight: (_weighing$unit_weight = weighing.unit_weight) !== null && _weighing$unit_weight !== void 0 ? _weighing$unit_weight : '1.000',
|
|
38
|
+
unit_price: weighing.unit_price,
|
|
39
|
+
weight_source: weighing.mode,
|
|
40
|
+
tare_name: (_weighing$tare$label = (_weighing$tare = weighing.tare) === null || _weighing$tare === void 0 ? void 0 : _weighing$tare.label) !== null && _weighing$tare$label !== void 0 ? _weighing$tare$label : '',
|
|
41
|
+
tare_weight: (_weighing$tare$value = (_weighing$tare2 = weighing.tare) === null || _weighing$tare2 === void 0 ? void 0 : _weighing$tare2.value) !== null && _weighing$tare$value !== void 0 ? _weighing$tare$value : 0,
|
|
42
|
+
weight: (_weighing$weight = weighing.weight) !== null && _weighing$weight !== void 0 ? _weighing$weight : 0,
|
|
43
|
+
net_weight: (_weighing$net_weight = weighing.net_weight) !== null && _weighing$net_weight !== void 0 ? _weighing$net_weight : 0
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -83,6 +83,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
84
|
private isBookingIncludedInStats;
|
|
85
85
|
private getBookingOrderPaymentStatus;
|
|
86
|
+
private isUnpaidBooking;
|
|
86
87
|
private countBookingOrders;
|
|
87
88
|
private countCompletedBookings;
|
|
88
89
|
private groupBookingsByResource;
|
|
@@ -29,6 +29,7 @@ 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']);
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* Sales 解决方案基础骨架
|
|
@@ -415,6 +416,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
415
416
|
var _booking$order$paymen, _booking$order;
|
|
416
417
|
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 : '');
|
|
417
418
|
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "isUnpaidBooking",
|
|
421
|
+
value: function isUnpaidBooking(booking) {
|
|
422
|
+
return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
|
|
423
|
+
}
|
|
418
424
|
}, {
|
|
419
425
|
key: "countBookingOrders",
|
|
420
426
|
value: function countBookingOrders(bookings) {
|
|
@@ -895,9 +901,11 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
895
901
|
});
|
|
896
902
|
completedBookingList = matchedBookingList.filter(function (booking) {
|
|
897
903
|
return _this7.getBookingAppointmentStatus(booking) === 'completed';
|
|
898
|
-
});
|
|
904
|
+
}); // const unpaidBookingList = matchedBookingList.filter(
|
|
905
|
+
// (booking) => this.getBookingOrderPaymentStatus(booking) === 'unpaid' || this.getBookingOrderPaymentStatus(booking) === 'payment_processing',
|
|
906
|
+
// );
|
|
899
907
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
900
|
-
return _this7.
|
|
908
|
+
return _this7.isUnpaidBooking(booking);
|
|
901
909
|
});
|
|
902
910
|
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList));
|
|
903
911
|
completedBookings = completedBookingList.map(function (booking) {
|