@pisell/pisellos 2.3.8 → 2.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +32 -8
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +50 -28
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +321 -210
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Sales/index.js +2 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +28 -11
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +18 -1
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +67 -5
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Sales/index.js +1 -0
- package/package.json +1 -1
|
@@ -153,6 +153,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
153
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
154
154
|
_defineProperty(_assertThisInitialized(_this), "reusedSharedSubModuleNames", new Set());
|
|
155
155
|
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
156
|
+
_defineProperty(_assertThisInitialized(_this), "queuedAutoPaymentSync", false);
|
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncFlushing", false);
|
|
158
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
156
159
|
return _this;
|
|
157
160
|
}
|
|
158
161
|
|
|
@@ -2309,24 +2312,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2309
2312
|
} : {});
|
|
2310
2313
|
syncState = this.store.order.getOrderSyncState();
|
|
2311
2314
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2312
|
-
_context24.next =
|
|
2315
|
+
_context24.next = 9;
|
|
2313
2316
|
break;
|
|
2314
2317
|
}
|
|
2318
|
+
this.queueLatestAutoPaymentSync();
|
|
2315
2319
|
return _context24.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2316
|
-
case
|
|
2320
|
+
case 9:
|
|
2317
2321
|
payments = params.payments || [];
|
|
2318
|
-
_context24.next =
|
|
2322
|
+
_context24.next = 12;
|
|
2319
2323
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2320
2324
|
payments: payments,
|
|
2321
2325
|
params: syncParams,
|
|
2322
2326
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2323
2327
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2324
2328
|
});
|
|
2325
|
-
case
|
|
2326
|
-
_context24.prev =
|
|
2327
|
-
_context24.next =
|
|
2329
|
+
case 12:
|
|
2330
|
+
_context24.prev = 12;
|
|
2331
|
+
_context24.next = 15;
|
|
2328
2332
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2329
|
-
case
|
|
2333
|
+
case 15:
|
|
2330
2334
|
syncResult = _context24.sent;
|
|
2331
2335
|
latestPayments = this.store.order.getOrderPayments();
|
|
2332
2336
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
@@ -2345,21 +2349,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2345
2349
|
depositAmount: syncResult.depositAmount,
|
|
2346
2350
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2347
2351
|
};
|
|
2348
|
-
_context24.next =
|
|
2352
|
+
_context24.next = 22;
|
|
2349
2353
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2350
|
-
case
|
|
2354
|
+
case 22:
|
|
2351
2355
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2352
|
-
_context24.next =
|
|
2356
|
+
_context24.next = 25;
|
|
2353
2357
|
break;
|
|
2354
2358
|
}
|
|
2355
|
-
_context24.next =
|
|
2359
|
+
_context24.next = 25;
|
|
2356
2360
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2357
|
-
case
|
|
2361
|
+
case 25:
|
|
2362
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2358
2363
|
return _context24.abrupt("return", syncResult);
|
|
2359
|
-
case
|
|
2360
|
-
_context24.prev =
|
|
2361
|
-
_context24.t0 = _context24["catch"](
|
|
2362
|
-
_context24.next =
|
|
2364
|
+
case 29:
|
|
2365
|
+
_context24.prev = 29;
|
|
2366
|
+
_context24.t0 = _context24["catch"](12);
|
|
2367
|
+
_context24.next = 33;
|
|
2363
2368
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2364
2369
|
ok: false,
|
|
2365
2370
|
error: _context24.t0,
|
|
@@ -2368,13 +2373,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2368
2373
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2369
2374
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2370
2375
|
});
|
|
2371
|
-
case
|
|
2376
|
+
case 33:
|
|
2377
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2372
2378
|
throw _context24.t0;
|
|
2373
|
-
case
|
|
2379
|
+
case 35:
|
|
2374
2380
|
case "end":
|
|
2375
2381
|
return _context24.stop();
|
|
2376
2382
|
}
|
|
2377
|
-
}, _callee24, this, [[
|
|
2383
|
+
}, _callee24, this, [[12, 29]]);
|
|
2378
2384
|
}));
|
|
2379
2385
|
function syncPaymentsToOrder(_x20) {
|
|
2380
2386
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -2396,8 +2402,111 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2396
2402
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2397
2403
|
return this.store.order.setOrderPayments(payments);
|
|
2398
2404
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2405
|
+
}, {
|
|
2406
|
+
key: "getPaymentStatusForSync",
|
|
2407
|
+
value: function getPaymentStatusForSync(payments) {
|
|
2408
|
+
var order = this.store.order;
|
|
2409
|
+
if (!order) throw new Error('order 模块未初始化');
|
|
2410
|
+
var completion = order.getPaymentCompletion(payments);
|
|
2411
|
+
return completion.isOrderFullyPaid ? 'paid' : 'partially_paid';
|
|
2412
|
+
}
|
|
2413
|
+
}, {
|
|
2414
|
+
key: "queueLatestAutoPaymentSync",
|
|
2415
|
+
value: function queueLatestAutoPaymentSync() {
|
|
2416
|
+
this.queuedAutoPaymentSync = true;
|
|
2417
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2418
|
+
}
|
|
2419
|
+
}, {
|
|
2420
|
+
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
2421
|
+
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
2422
|
+
var _this8 = this;
|
|
2423
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
2424
|
+
if (!this.queuedAutoPaymentSync) return;
|
|
2425
|
+
if (this.autoPaymentSyncTimer) return;
|
|
2426
|
+
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
2427
|
+
_this8.autoPaymentSyncTimer = null;
|
|
2428
|
+
void _this8.flushQueuedAutoPaymentSync();
|
|
2429
|
+
}, delay);
|
|
2430
|
+
}
|
|
2431
|
+
}, {
|
|
2432
|
+
key: "flushQueuedAutoPaymentSync",
|
|
2433
|
+
value: function () {
|
|
2434
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2435
|
+
var payments;
|
|
2436
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2437
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2438
|
+
case 0:
|
|
2439
|
+
if (this.store.order) {
|
|
2440
|
+
_context25.next = 2;
|
|
2441
|
+
break;
|
|
2442
|
+
}
|
|
2443
|
+
return _context25.abrupt("return");
|
|
2444
|
+
case 2:
|
|
2445
|
+
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2446
|
+
_context25.next = 4;
|
|
2447
|
+
break;
|
|
2448
|
+
}
|
|
2449
|
+
return _context25.abrupt("return");
|
|
2450
|
+
case 4:
|
|
2451
|
+
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2452
|
+
_context25.next = 7;
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2456
|
+
return _context25.abrupt("return");
|
|
2457
|
+
case 7:
|
|
2458
|
+
this.autoPaymentSyncFlushing = true;
|
|
2459
|
+
_context25.prev = 8;
|
|
2460
|
+
case 9:
|
|
2461
|
+
if (!this.queuedAutoPaymentSync) {
|
|
2462
|
+
_context25.next = 18;
|
|
2463
|
+
break;
|
|
2464
|
+
}
|
|
2465
|
+
this.queuedAutoPaymentSync = false;
|
|
2466
|
+
payments = this.store.order.getOrderPayments();
|
|
2467
|
+
if (payments.length) {
|
|
2468
|
+
_context25.next = 14;
|
|
2469
|
+
break;
|
|
2470
|
+
}
|
|
2471
|
+
return _context25.abrupt("continue", 9);
|
|
2472
|
+
case 14:
|
|
2473
|
+
_context25.next = 16;
|
|
2474
|
+
return this.syncPaymentsToOrder({
|
|
2475
|
+
payments: payments,
|
|
2476
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2477
|
+
submitWhenPaid: true,
|
|
2478
|
+
smallTicketDataFlag: 1
|
|
2479
|
+
});
|
|
2480
|
+
case 16:
|
|
2481
|
+
_context25.next = 9;
|
|
2482
|
+
break;
|
|
2483
|
+
case 18:
|
|
2484
|
+
_context25.next = 23;
|
|
2485
|
+
break;
|
|
2486
|
+
case 20:
|
|
2487
|
+
_context25.prev = 20;
|
|
2488
|
+
_context25.t0 = _context25["catch"](8);
|
|
2489
|
+
this.logError('queued auto sync payments failed', {
|
|
2490
|
+
error: _context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0)
|
|
2491
|
+
});
|
|
2492
|
+
case 23:
|
|
2493
|
+
_context25.prev = 23;
|
|
2494
|
+
this.autoPaymentSyncFlushing = false;
|
|
2495
|
+
if (this.queuedAutoPaymentSync) {
|
|
2496
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2497
|
+
}
|
|
2498
|
+
return _context25.finish(23);
|
|
2499
|
+
case 27:
|
|
2500
|
+
case "end":
|
|
2501
|
+
return _context25.stop();
|
|
2502
|
+
}
|
|
2503
|
+
}, _callee25, this, [[8, 20, 23, 27]]);
|
|
2504
|
+
}));
|
|
2505
|
+
function flushQueuedAutoPaymentSync() {
|
|
2506
|
+
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
2507
|
+
}
|
|
2508
|
+
return flushQueuedAutoPaymentSync;
|
|
2509
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
2401
2510
|
}, {
|
|
2402
2511
|
key: "addOrderPayment",
|
|
2403
2512
|
value: function addOrderPayment(payment) {
|
|
@@ -2406,7 +2515,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2406
2515
|
_paymentRecord$create,
|
|
2407
2516
|
_ref20,
|
|
2408
2517
|
_paymentRecord$origin,
|
|
2409
|
-
|
|
2518
|
+
_this9 = this;
|
|
2410
2519
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2411
2520
|
var paymentRecord = payment;
|
|
2412
2521
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -2438,20 +2547,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2438
2547
|
}));
|
|
2439
2548
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2440
2549
|
var syncState = this.store.order.getOrderSyncState();
|
|
2441
|
-
if (amountSnapshot
|
|
2442
|
-
|
|
2443
|
-
|
|
2550
|
+
if (amountSnapshot) {
|
|
2551
|
+
if (syncState === 'submitting') {
|
|
2552
|
+
this.queueLatestAutoPaymentSync();
|
|
2553
|
+
return payments;
|
|
2554
|
+
}
|
|
2444
2555
|
void this.syncPaymentsToOrder({
|
|
2445
2556
|
payments: payments,
|
|
2446
|
-
paymentStatus:
|
|
2557
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2447
2558
|
submitWhenPaid: true,
|
|
2448
2559
|
smallTicketDataFlag: 1
|
|
2449
2560
|
}).catch(function (error) {
|
|
2450
|
-
|
|
2561
|
+
_this9.logError('auto sync payments failed', {
|
|
2451
2562
|
error: error instanceof Error ? error.message : String(error)
|
|
2452
2563
|
});
|
|
2453
2564
|
});
|
|
2454
|
-
}
|
|
2565
|
+
}
|
|
2455
2566
|
return payments;
|
|
2456
2567
|
}
|
|
2457
2568
|
|
|
@@ -2551,20 +2662,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2551
2662
|
}, {
|
|
2552
2663
|
key: "initWalletData",
|
|
2553
2664
|
value: function () {
|
|
2554
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2665
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2555
2666
|
var _params$order_wait_pa, _ref21, _tempOrder$is_price_i;
|
|
2556
2667
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2557
|
-
return _regeneratorRuntime().wrap(function
|
|
2558
|
-
while (1) switch (
|
|
2668
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2669
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2559
2670
|
case 0:
|
|
2560
2671
|
if (this.store.order) {
|
|
2561
|
-
|
|
2672
|
+
_context26.next = 2;
|
|
2562
2673
|
break;
|
|
2563
2674
|
}
|
|
2564
2675
|
throw new Error('order 模块未初始化');
|
|
2565
2676
|
case 2:
|
|
2566
2677
|
if (this.store.payment) {
|
|
2567
|
-
|
|
2678
|
+
_context26.next = 4;
|
|
2568
2679
|
break;
|
|
2569
2680
|
}
|
|
2570
2681
|
throw new Error('payment 模块未初始化');
|
|
@@ -2573,10 +2684,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2573
2684
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2574
2685
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2575
2686
|
if (!(!tempOrder || !amount)) {
|
|
2576
|
-
|
|
2687
|
+
_context26.next = 9;
|
|
2577
2688
|
break;
|
|
2578
2689
|
}
|
|
2579
|
-
return
|
|
2690
|
+
return _context26.abrupt("return", {
|
|
2580
2691
|
walletRecommendList: [],
|
|
2581
2692
|
userIdentificationCodes: [],
|
|
2582
2693
|
transformList: [],
|
|
@@ -2599,11 +2710,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2599
2710
|
}, snapshot.identity.orderId ? {
|
|
2600
2711
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2601
2712
|
} : {});
|
|
2602
|
-
|
|
2713
|
+
_context26.next = 12;
|
|
2603
2714
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2604
2715
|
case 12:
|
|
2605
|
-
result =
|
|
2606
|
-
|
|
2716
|
+
result = _context26.sent;
|
|
2717
|
+
_context26.next = 15;
|
|
2607
2718
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2608
2719
|
orderId: snapshot.identity.orderId,
|
|
2609
2720
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2615,12 +2726,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2615
2726
|
timestamp: Date.now()
|
|
2616
2727
|
});
|
|
2617
2728
|
case 15:
|
|
2618
|
-
return
|
|
2729
|
+
return _context26.abrupt("return", result);
|
|
2619
2730
|
case 16:
|
|
2620
2731
|
case "end":
|
|
2621
|
-
return
|
|
2732
|
+
return _context26.stop();
|
|
2622
2733
|
}
|
|
2623
|
-
},
|
|
2734
|
+
}, _callee26, this);
|
|
2624
2735
|
}));
|
|
2625
2736
|
function initWalletData(_x21) {
|
|
2626
2737
|
return _initWalletData.apply(this, arguments);
|
|
@@ -2649,35 +2760,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2649
2760
|
}, {
|
|
2650
2761
|
key: "getPaymentMethodsAsync",
|
|
2651
2762
|
value: (function () {
|
|
2652
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2763
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2653
2764
|
var response, paymentMethods;
|
|
2654
|
-
return _regeneratorRuntime().wrap(function
|
|
2655
|
-
while (1) switch (
|
|
2765
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2766
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2656
2767
|
case 0:
|
|
2657
|
-
|
|
2658
|
-
|
|
2768
|
+
_context27.prev = 0;
|
|
2769
|
+
_context27.next = 3;
|
|
2659
2770
|
return this.request.get('/pay/custom-payment/all', {
|
|
2660
2771
|
filterPaymentMethods: true
|
|
2661
2772
|
}, {
|
|
2662
2773
|
osServer: true
|
|
2663
2774
|
});
|
|
2664
2775
|
case 3:
|
|
2665
|
-
response =
|
|
2776
|
+
response = _context27.sent;
|
|
2666
2777
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2667
2778
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2668
|
-
return
|
|
2779
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2669
2780
|
case 9:
|
|
2670
|
-
|
|
2671
|
-
|
|
2781
|
+
_context27.prev = 9;
|
|
2782
|
+
_context27.t0 = _context27["catch"](0);
|
|
2672
2783
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2673
|
-
error:
|
|
2784
|
+
error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0)
|
|
2674
2785
|
});
|
|
2675
|
-
return
|
|
2786
|
+
return _context27.abrupt("return", this.getPaymentMethods());
|
|
2676
2787
|
case 13:
|
|
2677
2788
|
case "end":
|
|
2678
|
-
return
|
|
2789
|
+
return _context27.stop();
|
|
2679
2790
|
}
|
|
2680
|
-
},
|
|
2791
|
+
}, _callee27, this, [[0, 9]]);
|
|
2681
2792
|
}));
|
|
2682
2793
|
function getPaymentMethodsAsync() {
|
|
2683
2794
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2725,47 +2836,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2725
2836
|
}, {
|
|
2726
2837
|
key: "sendCustomerPayLink",
|
|
2727
2838
|
value: (function () {
|
|
2728
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2839
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2729
2840
|
var orderIds, _ref22, _ref23, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2730
|
-
return _regeneratorRuntime().wrap(function
|
|
2731
|
-
while (1) switch (
|
|
2841
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2842
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2732
2843
|
case 0:
|
|
2733
2844
|
if (this.store.order) {
|
|
2734
|
-
|
|
2845
|
+
_context28.next = 2;
|
|
2735
2846
|
break;
|
|
2736
2847
|
}
|
|
2737
2848
|
throw new Error('order 模块未初始化');
|
|
2738
2849
|
case 2:
|
|
2739
2850
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2740
2851
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2741
|
-
|
|
2852
|
+
_context28.next = 11;
|
|
2742
2853
|
break;
|
|
2743
2854
|
}
|
|
2744
|
-
|
|
2855
|
+
_context28.next = 6;
|
|
2745
2856
|
return this.submitSalesOrder({
|
|
2746
2857
|
smallTicketDataFlag: 1
|
|
2747
2858
|
});
|
|
2748
2859
|
case 6:
|
|
2749
|
-
submitResult =
|
|
2860
|
+
submitResult = _context28.sent;
|
|
2750
2861
|
orderId = (_ref22 = (_ref23 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref22 !== void 0 ? _ref22 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2751
2862
|
if (orderId) {
|
|
2752
|
-
|
|
2863
|
+
_context28.next = 10;
|
|
2753
2864
|
break;
|
|
2754
2865
|
}
|
|
2755
2866
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2756
2867
|
case 10:
|
|
2757
2868
|
orderIds = [orderId];
|
|
2758
2869
|
case 11:
|
|
2759
|
-
return
|
|
2870
|
+
return _context28.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2760
2871
|
emails: params.emails,
|
|
2761
2872
|
notify_action: params.notify_action,
|
|
2762
2873
|
order_ids: orderIds
|
|
2763
2874
|
}));
|
|
2764
2875
|
case 12:
|
|
2765
2876
|
case "end":
|
|
2766
|
-
return
|
|
2877
|
+
return _context28.stop();
|
|
2767
2878
|
}
|
|
2768
|
-
},
|
|
2879
|
+
}, _callee28, this);
|
|
2769
2880
|
}));
|
|
2770
2881
|
function sendCustomerPayLink(_x22) {
|
|
2771
2882
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -2780,27 +2891,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2780
2891
|
}, {
|
|
2781
2892
|
key: "calculateProductBookingPrice",
|
|
2782
2893
|
value: function () {
|
|
2783
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2894
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
2784
2895
|
var _params$customer_id;
|
|
2785
2896
|
var quotation, customerId, authoritativeProduct, product;
|
|
2786
|
-
return _regeneratorRuntime().wrap(function
|
|
2787
|
-
while (1) switch (
|
|
2897
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2898
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2788
2899
|
case 0:
|
|
2789
2900
|
quotation = this.store.quotation;
|
|
2790
2901
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2791
|
-
|
|
2902
|
+
_context29.next = 4;
|
|
2792
2903
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2793
2904
|
case 4:
|
|
2794
|
-
authoritativeProduct =
|
|
2905
|
+
authoritativeProduct = _context29.sent;
|
|
2795
2906
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2796
|
-
|
|
2907
|
+
_context29.next = 8;
|
|
2797
2908
|
return this.loadQuotationForPriceQuery({
|
|
2798
2909
|
quotation: quotation,
|
|
2799
2910
|
customer_id: customerId,
|
|
2800
2911
|
channel: params.channel
|
|
2801
2912
|
});
|
|
2802
2913
|
case 8:
|
|
2803
|
-
return
|
|
2914
|
+
return _context29.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2804
2915
|
product: product,
|
|
2805
2916
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2806
2917
|
customer_id: customerId,
|
|
@@ -2808,9 +2919,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2808
2919
|
})));
|
|
2809
2920
|
case 9:
|
|
2810
2921
|
case "end":
|
|
2811
|
-
return
|
|
2922
|
+
return _context29.stop();
|
|
2812
2923
|
}
|
|
2813
|
-
},
|
|
2924
|
+
}, _callee29, this);
|
|
2814
2925
|
}));
|
|
2815
2926
|
function calculateProductBookingPrice(_x23) {
|
|
2816
2927
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -2820,7 +2931,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2820
2931
|
}, {
|
|
2821
2932
|
key: "getQuotationCustomerScopeInfo",
|
|
2822
2933
|
value: function getQuotationCustomerScopeInfo() {
|
|
2823
|
-
var
|
|
2934
|
+
var _this10 = this;
|
|
2824
2935
|
var quotation = this.store.quotation;
|
|
2825
2936
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
2826
2937
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -2832,7 +2943,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2832
2943
|
}).map(function (item) {
|
|
2833
2944
|
var localSeen = new Set();
|
|
2834
2945
|
var customers = item.customer.filter(function (customer) {
|
|
2835
|
-
var customerId =
|
|
2946
|
+
var customerId = _this10.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
2836
2947
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
2837
2948
|
localSeen.add(customerId);
|
|
2838
2949
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -2882,32 +2993,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2882
2993
|
}, {
|
|
2883
2994
|
key: "calculateProductBookingPrices",
|
|
2884
2995
|
value: function () {
|
|
2885
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2996
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(paramsList) {
|
|
2886
2997
|
var _paramsList$0$custome,
|
|
2887
2998
|
_paramsList$,
|
|
2888
|
-
|
|
2999
|
+
_this11 = this,
|
|
2889
3000
|
_paramsList$2;
|
|
2890
3001
|
var quotation, customerId, productMapsByGroup, groups;
|
|
2891
|
-
return _regeneratorRuntime().wrap(function
|
|
2892
|
-
while (1) switch (
|
|
3002
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3003
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2893
3004
|
case 0:
|
|
2894
3005
|
if (paramsList.length) {
|
|
2895
|
-
|
|
3006
|
+
_context31.next = 2;
|
|
2896
3007
|
break;
|
|
2897
3008
|
}
|
|
2898
|
-
return
|
|
3009
|
+
return _context31.abrupt("return", []);
|
|
2899
3010
|
case 2:
|
|
2900
3011
|
quotation = this.store.quotation;
|
|
2901
3012
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
2902
3013
|
productMapsByGroup = new Map();
|
|
2903
3014
|
groups = new Map();
|
|
2904
3015
|
paramsList.forEach(function (params) {
|
|
2905
|
-
var
|
|
3016
|
+
var _this11$otherParams;
|
|
2906
3017
|
var product = params.product || {};
|
|
2907
|
-
var productId =
|
|
3018
|
+
var productId = _this11.getPriceQueryProductId(product);
|
|
2908
3019
|
if (productId === null) return;
|
|
2909
|
-
var schedule =
|
|
2910
|
-
var channel = params.channel || ((
|
|
3020
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3021
|
+
var channel = params.channel || ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams.channel);
|
|
2911
3022
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2912
3023
|
var group = groups.get(groupKey) || {
|
|
2913
3024
|
ids: new Set(),
|
|
@@ -2917,51 +3028,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2917
3028
|
group.ids.add(productId);
|
|
2918
3029
|
groups.set(groupKey, group);
|
|
2919
3030
|
});
|
|
2920
|
-
|
|
3031
|
+
_context31.next = 9;
|
|
2921
3032
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2922
|
-
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3033
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(_ref24) {
|
|
2923
3034
|
var _ref26, groupKey, group, productsById;
|
|
2924
|
-
return _regeneratorRuntime().wrap(function
|
|
2925
|
-
while (1) switch (
|
|
3035
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3036
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2926
3037
|
case 0:
|
|
2927
3038
|
_ref26 = _slicedToArray(_ref24, 2), groupKey = _ref26[0], group = _ref26[1];
|
|
2928
|
-
|
|
2929
|
-
return
|
|
3039
|
+
_context30.next = 3;
|
|
3040
|
+
return _this11.loadProductsForPriceQuery({
|
|
2930
3041
|
ids: Array.from(group.ids),
|
|
2931
3042
|
schedule: group.schedule,
|
|
2932
3043
|
customerId: customerId,
|
|
2933
3044
|
channel: group.channel
|
|
2934
3045
|
});
|
|
2935
3046
|
case 3:
|
|
2936
|
-
productsById =
|
|
3047
|
+
productsById = _context30.sent;
|
|
2937
3048
|
productMapsByGroup.set(groupKey, productsById);
|
|
2938
3049
|
case 5:
|
|
2939
3050
|
case "end":
|
|
2940
|
-
return
|
|
3051
|
+
return _context30.stop();
|
|
2941
3052
|
}
|
|
2942
|
-
},
|
|
3053
|
+
}, _callee30);
|
|
2943
3054
|
}));
|
|
2944
3055
|
return function (_x25) {
|
|
2945
3056
|
return _ref25.apply(this, arguments);
|
|
2946
3057
|
};
|
|
2947
3058
|
}()));
|
|
2948
3059
|
case 9:
|
|
2949
|
-
|
|
3060
|
+
_context31.next = 11;
|
|
2950
3061
|
return this.loadQuotationForPriceQuery({
|
|
2951
3062
|
quotation: quotation,
|
|
2952
3063
|
customer_id: customerId,
|
|
2953
3064
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
2954
3065
|
});
|
|
2955
3066
|
case 11:
|
|
2956
|
-
return
|
|
2957
|
-
var
|
|
3067
|
+
return _context31.abrupt("return", paramsList.map(function (params) {
|
|
3068
|
+
var _this11$otherParams2, _productMapsByGroup$g;
|
|
2958
3069
|
var productInput = params.product || {};
|
|
2959
|
-
var productId =
|
|
2960
|
-
var schedule =
|
|
2961
|
-
var channel = params.channel || ((
|
|
3070
|
+
var productId = _this11.getPriceQueryProductId(productInput);
|
|
3071
|
+
var schedule = _this11.getPriceQuerySchedule(params);
|
|
3072
|
+
var channel = params.channel || ((_this11$otherParams2 = _this11.otherParams) === null || _this11$otherParams2 === void 0 ? void 0 : _this11$otherParams2.channel);
|
|
2962
3073
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2963
3074
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
2964
|
-
var product =
|
|
3075
|
+
var product = _this11.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
2965
3076
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2966
3077
|
product: product,
|
|
2967
3078
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -2971,9 +3082,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2971
3082
|
}));
|
|
2972
3083
|
case 12:
|
|
2973
3084
|
case "end":
|
|
2974
|
-
return
|
|
3085
|
+
return _context31.stop();
|
|
2975
3086
|
}
|
|
2976
|
-
},
|
|
3087
|
+
}, _callee31, this);
|
|
2977
3088
|
}));
|
|
2978
3089
|
function calculateProductBookingPrices(_x24) {
|
|
2979
3090
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
@@ -2983,42 +3094,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2983
3094
|
}, {
|
|
2984
3095
|
key: "addProductToOrder",
|
|
2985
3096
|
value: function () {
|
|
2986
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2987
|
-
var products;
|
|
2988
|
-
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2989
|
-
while (1) switch (_context31.prev = _context31.next) {
|
|
2990
|
-
case 0:
|
|
2991
|
-
_context31.prev = 0;
|
|
2992
|
-
if (this.store.order) {
|
|
2993
|
-
_context31.next = 3;
|
|
2994
|
-
break;
|
|
2995
|
-
}
|
|
2996
|
-
throw new Error('order 模块未初始化');
|
|
2997
|
-
case 3:
|
|
2998
|
-
_context31.next = 5;
|
|
2999
|
-
return this.store.order.addProductToOrder(product, booking);
|
|
3000
|
-
case 5:
|
|
3001
|
-
products = _context31.sent;
|
|
3002
|
-
return _context31.abrupt("return", products);
|
|
3003
|
-
case 9:
|
|
3004
|
-
_context31.prev = 9;
|
|
3005
|
-
_context31.t0 = _context31["catch"](0);
|
|
3006
|
-
throw _context31.t0;
|
|
3007
|
-
case 12:
|
|
3008
|
-
case "end":
|
|
3009
|
-
return _context31.stop();
|
|
3010
|
-
}
|
|
3011
|
-
}, _callee31, this, [[0, 9]]);
|
|
3012
|
-
}));
|
|
3013
|
-
function addProductToOrder(_x26, _x27) {
|
|
3014
|
-
return _addProductToOrder.apply(this, arguments);
|
|
3015
|
-
}
|
|
3016
|
-
return addProductToOrder;
|
|
3017
|
-
}()
|
|
3018
|
-
}, {
|
|
3019
|
-
key: "updateOrderProduct",
|
|
3020
|
-
value: function () {
|
|
3021
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
3097
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(product, booking) {
|
|
3022
3098
|
var products;
|
|
3023
3099
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3024
3100
|
while (1) switch (_context32.prev = _context32.next) {
|
|
@@ -3031,7 +3107,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3031
3107
|
throw new Error('order 模块未初始化');
|
|
3032
3108
|
case 3:
|
|
3033
3109
|
_context32.next = 5;
|
|
3034
|
-
return this.store.order.
|
|
3110
|
+
return this.store.order.addProductToOrder(product, booking);
|
|
3035
3111
|
case 5:
|
|
3036
3112
|
products = _context32.sent;
|
|
3037
3113
|
return _context32.abrupt("return", products);
|
|
@@ -3045,15 +3121,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3045
3121
|
}
|
|
3046
3122
|
}, _callee32, this, [[0, 9]]);
|
|
3047
3123
|
}));
|
|
3048
|
-
function
|
|
3049
|
-
return
|
|
3124
|
+
function addProductToOrder(_x26, _x27) {
|
|
3125
|
+
return _addProductToOrder.apply(this, arguments);
|
|
3050
3126
|
}
|
|
3051
|
-
return
|
|
3127
|
+
return addProductToOrder;
|
|
3052
3128
|
}()
|
|
3053
3129
|
}, {
|
|
3054
|
-
key: "
|
|
3130
|
+
key: "updateOrderProduct",
|
|
3055
3131
|
value: function () {
|
|
3056
|
-
var
|
|
3132
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
3057
3133
|
var products;
|
|
3058
3134
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3059
3135
|
while (1) switch (_context33.prev = _context33.next) {
|
|
@@ -3066,7 +3142,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3066
3142
|
throw new Error('order 模块未初始化');
|
|
3067
3143
|
case 3:
|
|
3068
3144
|
_context33.next = 5;
|
|
3069
|
-
return this.store.order.
|
|
3145
|
+
return this.store.order.updateOrderProduct(params);
|
|
3070
3146
|
case 5:
|
|
3071
3147
|
products = _context33.sent;
|
|
3072
3148
|
return _context33.abrupt("return", products);
|
|
@@ -3080,15 +3156,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3080
3156
|
}
|
|
3081
3157
|
}, _callee33, this, [[0, 9]]);
|
|
3082
3158
|
}));
|
|
3083
|
-
function
|
|
3084
|
-
return
|
|
3159
|
+
function updateOrderProduct(_x28) {
|
|
3160
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
3085
3161
|
}
|
|
3086
|
-
return
|
|
3162
|
+
return updateOrderProduct;
|
|
3087
3163
|
}()
|
|
3088
3164
|
}, {
|
|
3089
|
-
key: "
|
|
3165
|
+
key: "updateOrderProducts",
|
|
3090
3166
|
value: function () {
|
|
3091
|
-
var
|
|
3167
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(paramsList) {
|
|
3092
3168
|
var products;
|
|
3093
3169
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3094
3170
|
while (1) switch (_context34.prev = _context34.next) {
|
|
@@ -3101,7 +3177,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3101
3177
|
throw new Error('order 模块未初始化');
|
|
3102
3178
|
case 3:
|
|
3103
3179
|
_context34.next = 5;
|
|
3104
|
-
return this.store.order.
|
|
3180
|
+
return this.store.order.updateOrderProducts(paramsList);
|
|
3105
3181
|
case 5:
|
|
3106
3182
|
products = _context34.sent;
|
|
3107
3183
|
return _context34.abrupt("return", products);
|
|
@@ -3115,6 +3191,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3115
3191
|
}
|
|
3116
3192
|
}, _callee34, this, [[0, 9]]);
|
|
3117
3193
|
}));
|
|
3194
|
+
function updateOrderProducts(_x29) {
|
|
3195
|
+
return _updateOrderProducts.apply(this, arguments);
|
|
3196
|
+
}
|
|
3197
|
+
return updateOrderProducts;
|
|
3198
|
+
}()
|
|
3199
|
+
}, {
|
|
3200
|
+
key: "updateOrderProductQuantity",
|
|
3201
|
+
value: function () {
|
|
3202
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3203
|
+
var products;
|
|
3204
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3205
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3206
|
+
case 0:
|
|
3207
|
+
_context35.prev = 0;
|
|
3208
|
+
if (this.store.order) {
|
|
3209
|
+
_context35.next = 3;
|
|
3210
|
+
break;
|
|
3211
|
+
}
|
|
3212
|
+
throw new Error('order 模块未初始化');
|
|
3213
|
+
case 3:
|
|
3214
|
+
_context35.next = 5;
|
|
3215
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
3216
|
+
case 5:
|
|
3217
|
+
products = _context35.sent;
|
|
3218
|
+
return _context35.abrupt("return", products);
|
|
3219
|
+
case 9:
|
|
3220
|
+
_context35.prev = 9;
|
|
3221
|
+
_context35.t0 = _context35["catch"](0);
|
|
3222
|
+
throw _context35.t0;
|
|
3223
|
+
case 12:
|
|
3224
|
+
case "end":
|
|
3225
|
+
return _context35.stop();
|
|
3226
|
+
}
|
|
3227
|
+
}, _callee35, this, [[0, 9]]);
|
|
3228
|
+
}));
|
|
3118
3229
|
function updateOrderProductQuantity(_x30) {
|
|
3119
3230
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3120
3231
|
}
|
|
@@ -3138,12 +3249,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3138
3249
|
}, {
|
|
3139
3250
|
key: "setOrderProductLineNote",
|
|
3140
3251
|
value: (function () {
|
|
3141
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3252
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(identity, note) {
|
|
3142
3253
|
var params, products;
|
|
3143
|
-
return _regeneratorRuntime().wrap(function
|
|
3144
|
-
while (1) switch (
|
|
3254
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3255
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3145
3256
|
case 0:
|
|
3146
|
-
|
|
3257
|
+
_context36.prev = 0;
|
|
3147
3258
|
params = {
|
|
3148
3259
|
product_id: identity.product_id,
|
|
3149
3260
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3158,20 +3269,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3158
3269
|
params.product_sku = identity.product_sku;
|
|
3159
3270
|
}
|
|
3160
3271
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3161
|
-
|
|
3272
|
+
_context36.next = 7;
|
|
3162
3273
|
return this.updateOrderProduct(params);
|
|
3163
3274
|
case 7:
|
|
3164
|
-
products =
|
|
3165
|
-
return
|
|
3275
|
+
products = _context36.sent;
|
|
3276
|
+
return _context36.abrupt("return", products);
|
|
3166
3277
|
case 11:
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
throw
|
|
3278
|
+
_context36.prev = 11;
|
|
3279
|
+
_context36.t0 = _context36["catch"](0);
|
|
3280
|
+
throw _context36.t0;
|
|
3170
3281
|
case 14:
|
|
3171
3282
|
case "end":
|
|
3172
|
-
return
|
|
3283
|
+
return _context36.stop();
|
|
3173
3284
|
}
|
|
3174
|
-
},
|
|
3285
|
+
}, _callee36, this, [[0, 11]]);
|
|
3175
3286
|
}));
|
|
3176
3287
|
function setOrderProductLineNote(_x31, _x32) {
|
|
3177
3288
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -3188,30 +3299,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3188
3299
|
}, {
|
|
3189
3300
|
key: "removeProductsFromOrder",
|
|
3190
3301
|
value: (function () {
|
|
3191
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3192
|
-
return _regeneratorRuntime().wrap(function
|
|
3193
|
-
while (1) switch (
|
|
3302
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(identities) {
|
|
3303
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3304
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3194
3305
|
case 0:
|
|
3195
|
-
|
|
3306
|
+
_context37.prev = 0;
|
|
3196
3307
|
if (this.store.order) {
|
|
3197
|
-
|
|
3308
|
+
_context37.next = 3;
|
|
3198
3309
|
break;
|
|
3199
3310
|
}
|
|
3200
3311
|
throw new Error('order 模块未初始化');
|
|
3201
3312
|
case 3:
|
|
3202
|
-
|
|
3313
|
+
_context37.next = 5;
|
|
3203
3314
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3204
3315
|
case 5:
|
|
3205
|
-
return
|
|
3316
|
+
return _context37.abrupt("return", _context37.sent);
|
|
3206
3317
|
case 8:
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
throw
|
|
3318
|
+
_context37.prev = 8;
|
|
3319
|
+
_context37.t0 = _context37["catch"](0);
|
|
3320
|
+
throw _context37.t0;
|
|
3210
3321
|
case 11:
|
|
3211
3322
|
case "end":
|
|
3212
|
-
return
|
|
3323
|
+
return _context37.stop();
|
|
3213
3324
|
}
|
|
3214
|
-
},
|
|
3325
|
+
}, _callee37, this, [[0, 8]]);
|
|
3215
3326
|
}));
|
|
3216
3327
|
function removeProductsFromOrder(_x33) {
|
|
3217
3328
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -3221,16 +3332,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3221
3332
|
}, {
|
|
3222
3333
|
key: "removeProductFromOrder",
|
|
3223
3334
|
value: function () {
|
|
3224
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3225
|
-
return _regeneratorRuntime().wrap(function
|
|
3226
|
-
while (1) switch (
|
|
3335
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity) {
|
|
3336
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3337
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3227
3338
|
case 0:
|
|
3228
|
-
return
|
|
3339
|
+
return _context38.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3229
3340
|
case 1:
|
|
3230
3341
|
case "end":
|
|
3231
|
-
return
|
|
3342
|
+
return _context38.stop();
|
|
3232
3343
|
}
|
|
3233
|
-
},
|
|
3344
|
+
}, _callee38, this);
|
|
3234
3345
|
}));
|
|
3235
3346
|
function removeProductFromOrder(_x34) {
|
|
3236
3347
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -3282,23 +3393,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3282
3393
|
}, {
|
|
3283
3394
|
key: "applyPromotion",
|
|
3284
3395
|
value: (function () {
|
|
3285
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3286
|
-
return _regeneratorRuntime().wrap(function
|
|
3287
|
-
while (1) switch (
|
|
3396
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3397
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3398
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3288
3399
|
case 0:
|
|
3289
3400
|
if (this.store.order) {
|
|
3290
|
-
|
|
3401
|
+
_context39.next = 2;
|
|
3291
3402
|
break;
|
|
3292
3403
|
}
|
|
3293
3404
|
throw new Error('order 模块未初始化');
|
|
3294
3405
|
case 2:
|
|
3295
|
-
|
|
3406
|
+
_context39.next = 4;
|
|
3296
3407
|
return this.store.order.applyPromotion();
|
|
3297
3408
|
case 4:
|
|
3298
3409
|
case "end":
|
|
3299
|
-
return
|
|
3410
|
+
return _context39.stop();
|
|
3300
3411
|
}
|
|
3301
|
-
},
|
|
3412
|
+
}, _callee39, this);
|
|
3302
3413
|
}));
|
|
3303
3414
|
function applyPromotion() {
|
|
3304
3415
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3325,18 +3436,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3325
3436
|
}, {
|
|
3326
3437
|
key: "getProductList",
|
|
3327
3438
|
value: function () {
|
|
3328
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3439
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3329
3440
|
var _this$otherParams21;
|
|
3330
3441
|
var menu_list_ids, _this$store$products, res;
|
|
3331
|
-
return _regeneratorRuntime().wrap(function
|
|
3332
|
-
while (1) switch (
|
|
3442
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3443
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3333
3444
|
case 0:
|
|
3334
3445
|
// 可以直接通过配置里的 menu 读取
|
|
3335
3446
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3336
3447
|
return Number(n.value);
|
|
3337
3448
|
})) || [];
|
|
3338
|
-
|
|
3339
|
-
|
|
3449
|
+
_context40.prev = 1;
|
|
3450
|
+
_context40.next = 4;
|
|
3340
3451
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3341
3452
|
menu_list_ids: menu_list_ids,
|
|
3342
3453
|
cacheId: this.cacheId,
|
|
@@ -3344,17 +3455,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3344
3455
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3345
3456
|
});
|
|
3346
3457
|
case 4:
|
|
3347
|
-
res =
|
|
3348
|
-
return
|
|
3458
|
+
res = _context40.sent;
|
|
3459
|
+
return _context40.abrupt("return", res);
|
|
3349
3460
|
case 8:
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
throw
|
|
3461
|
+
_context40.prev = 8;
|
|
3462
|
+
_context40.t0 = _context40["catch"](1);
|
|
3463
|
+
throw _context40.t0;
|
|
3353
3464
|
case 11:
|
|
3354
3465
|
case "end":
|
|
3355
|
-
return
|
|
3466
|
+
return _context40.stop();
|
|
3356
3467
|
}
|
|
3357
|
-
},
|
|
3468
|
+
}, _callee40, this, [[1, 8]]);
|
|
3358
3469
|
}));
|
|
3359
3470
|
function getProductList() {
|
|
3360
3471
|
return _getProductList.apply(this, arguments);
|
|
@@ -3369,31 +3480,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3369
3480
|
}, {
|
|
3370
3481
|
key: "setOtherParams",
|
|
3371
3482
|
value: function () {
|
|
3372
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3483
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
|
|
3373
3484
|
var _this$otherParams22;
|
|
3374
3485
|
var _ref27,
|
|
3375
3486
|
_ref27$cover,
|
|
3376
3487
|
cover,
|
|
3377
|
-
|
|
3378
|
-
return _regeneratorRuntime().wrap(function
|
|
3379
|
-
while (1) switch (
|
|
3488
|
+
_args41 = arguments;
|
|
3489
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3490
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3380
3491
|
case 0:
|
|
3381
|
-
_ref27 =
|
|
3492
|
+
_ref27 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref27$cover = _ref27.cover, cover = _ref27$cover === void 0 ? false : _ref27$cover;
|
|
3382
3493
|
if (cover) {
|
|
3383
3494
|
this.otherParams = _objectSpread({}, params);
|
|
3384
3495
|
} else {
|
|
3385
3496
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3386
3497
|
}
|
|
3387
3498
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3388
|
-
|
|
3499
|
+
_context41.next = 5;
|
|
3389
3500
|
return this.syncOtherParamsToSubModules(params, {
|
|
3390
3501
|
cover: cover
|
|
3391
3502
|
});
|
|
3392
3503
|
case 5:
|
|
3393
3504
|
case "end":
|
|
3394
|
-
return
|
|
3505
|
+
return _context41.stop();
|
|
3395
3506
|
}
|
|
3396
|
-
},
|
|
3507
|
+
}, _callee41, this);
|
|
3397
3508
|
}));
|
|
3398
3509
|
function setOtherParams(_x35) {
|
|
3399
3510
|
return _setOtherParams.apply(this, arguments);
|