@pisell/pisellos 2.2.152 → 2.2.154
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.js +1 -0
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -1
- package/dist/modules/Discount/index.d.ts +6 -2
- package/dist/modules/Discount/index.js +14 -8
- package/dist/modules/Order/index.d.ts +2 -0
- package/dist/modules/Order/index.js +234 -161
- package/dist/modules/Order/types.d.ts +19 -0
- package/dist/modules/Order/utils.js +7 -6
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +567 -505
- package/dist/modules/Payment/types.d.ts +29 -9
- package/dist/modules/SalesSummary/index.d.ts +7 -5
- package/dist/modules/SalesSummary/index.js +35 -11
- package/dist/plugins/app.d.ts +2 -0
- package/dist/server/index.d.ts +2 -5
- package/dist/server/index.js +58 -66
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/products/index.d.ts +12 -1
- package/dist/server/modules/products/index.js +169 -78
- package/dist/server/modules/products/types.d.ts +11 -0
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/utils/product.js +2 -2
- package/dist/solution/BaseSales/index.d.ts +26 -2
- package/dist/solution/BaseSales/index.js +342 -112
- package/dist/solution/BaseSales/types.d.ts +4 -4
- package/dist/solution/BaseSales/types.js +4 -4
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +116 -0
- package/dist/solution/BaseSales/utils.js +3 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +11 -13
- package/dist/solution/BookingTicket/index.js +23 -37
- package/dist/solution/BookingTicket/types.d.ts +9 -6
- package/dist/solution/BookingTicket/types.js +6 -3
- package/dist/solution/BookingTicket/utils/cartView.d.ts +7 -12
- package/dist/solution/BookingTicket/utils/cartView.js +52 -14
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/Sales/index.d.ts +3 -0
- package/dist/solution/Sales/index.js +85 -43
- package/dist/solution/Sales/types.d.ts +3 -0
- package/dist/solution/ScanOrder/types.d.ts +4 -4
- package/dist/solution/ScanOrder/types.js +4 -4
- package/dist/solution/ScanOrder/utils.js +3 -3
- package/dist/solution/ShopDiscount/index.d.ts +2 -1
- package/dist/solution/ShopDiscount/index.js +32 -20
- package/dist/solution/ShopDiscount/types.d.ts +1 -0
- package/lib/core/index.js +1 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -1
- package/lib/modules/Discount/index.d.ts +6 -2
- package/lib/modules/Discount/index.js +3 -1
- package/lib/modules/Order/index.d.ts +2 -0
- package/lib/modules/Order/index.js +40 -8
- package/lib/modules/Order/types.d.ts +19 -0
- package/lib/modules/Order/utils.js +4 -2
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +26 -2
- package/lib/modules/Payment/types.d.ts +29 -9
- package/lib/modules/SalesSummary/index.d.ts +7 -5
- package/lib/modules/SalesSummary/index.js +29 -9
- package/lib/plugins/app.d.ts +2 -0
- package/lib/server/index.d.ts +2 -5
- package/lib/server/index.js +38 -58
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/products/index.d.ts +12 -1
- package/lib/server/modules/products/index.js +69 -9
- package/lib/server/modules/products/types.d.ts +11 -0
- package/lib/server/utils/product.js +2 -2
- package/lib/solution/BaseSales/index.d.ts +26 -2
- package/lib/solution/BaseSales/index.js +169 -3
- package/lib/solution/BaseSales/types.d.ts +4 -4
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +62 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +155 -0
- package/lib/solution/BaseSales/utils.js +3 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +11 -13
- package/lib/solution/BookingTicket/index.js +17 -27
- package/lib/solution/BookingTicket/types.d.ts +9 -6
- package/lib/solution/BookingTicket/utils/cartView.d.ts +7 -12
- package/lib/solution/BookingTicket/utils/cartView.js +44 -18
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
- package/lib/solution/Sales/index.d.ts +3 -0
- package/lib/solution/Sales/index.js +50 -15
- package/lib/solution/Sales/types.d.ts +3 -0
- package/lib/solution/ScanOrder/types.d.ts +4 -4
- package/lib/solution/ScanOrder/utils.js +3 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -1
- package/lib/solution/ShopDiscount/index.js +10 -4
- package/lib/solution/ShopDiscount/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -54,6 +54,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
54
54
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
55
55
|
_defineProperty(_assertThisInitialized(_this), "salesSummaryModuleName", void 0);
|
|
56
56
|
_defineProperty(_assertThisInitialized(_this), "rulesHooksOverride", void 0);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "orderHooks", void 0);
|
|
57
58
|
_defineProperty(_assertThisInitialized(_this), "otherParams", void 0);
|
|
58
59
|
return _this;
|
|
59
60
|
}
|
|
@@ -61,7 +62,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
61
62
|
key: "initialize",
|
|
62
63
|
value: function () {
|
|
63
64
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
64
|
-
var _otherParams$rules;
|
|
65
|
+
var _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
65
66
|
var appPlugin, app, otherParams;
|
|
66
67
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
68
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -90,11 +91,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
90
91
|
this.cacheId = otherParams.cacheId;
|
|
91
92
|
this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
|
|
92
93
|
this.rulesHooksOverride = (_otherParams$rules = otherParams.rules) === null || _otherParams$rules === void 0 ? void 0 : _otherParams$rules.hooks;
|
|
94
|
+
this.orderHooks = options.hooks || ((_otherParams$order = otherParams.order) === null || _otherParams$order === void 0 ? void 0 : _otherParams$order.hooks) || ((_otherParams$hooks = otherParams.hooks) === null || _otherParams$hooks === void 0 ? void 0 : _otherParams$hooks.order);
|
|
93
95
|
this.otherParams = otherParams;
|
|
94
96
|
this.registerDiscountModules(options);
|
|
95
97
|
this.restoreTempOrderFromStorage();
|
|
96
98
|
this.logInfo('OrderModule initialized successfully');
|
|
97
|
-
case
|
|
99
|
+
case 21:
|
|
98
100
|
case "end":
|
|
99
101
|
return _context.stop();
|
|
100
102
|
}
|
|
@@ -243,7 +245,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
243
245
|
while (1) switch (_context3.prev = _context3.next) {
|
|
244
246
|
case 0:
|
|
245
247
|
_context3.next = 2;
|
|
246
|
-
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code,
|
|
248
|
+
return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code, {
|
|
249
|
+
customerId: customerId
|
|
250
|
+
});
|
|
247
251
|
case 2:
|
|
248
252
|
_context3.t0 = _context3.sent;
|
|
249
253
|
if (_context3.t0) {
|
|
@@ -1346,16 +1350,60 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1346
1350
|
this.persistTempOrder();
|
|
1347
1351
|
return tempOrder.payments;
|
|
1348
1352
|
}
|
|
1349
|
-
|
|
1350
|
-
// ─── TempOrder: 商品 CRUD ───
|
|
1351
1353
|
}, {
|
|
1352
|
-
key: "
|
|
1354
|
+
key: "shouldMergeProductToOrder",
|
|
1353
1355
|
value: function () {
|
|
1354
|
-
var
|
|
1355
|
-
var
|
|
1356
|
-
var
|
|
1356
|
+
var _shouldMergeProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
1357
|
+
var _this$orderHooks;
|
|
1358
|
+
var onBeforeMergeProductToOrder, result;
|
|
1357
1359
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1358
1360
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1361
|
+
case 0:
|
|
1362
|
+
onBeforeMergeProductToOrder = (_this$orderHooks = this.orderHooks) === null || _this$orderHooks === void 0 ? void 0 : _this$orderHooks.onBeforeMergeProductToOrder;
|
|
1363
|
+
if (onBeforeMergeProductToOrder) {
|
|
1364
|
+
_context12.next = 3;
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
return _context12.abrupt("return", true);
|
|
1368
|
+
case 3:
|
|
1369
|
+
_context12.next = 5;
|
|
1370
|
+
return onBeforeMergeProductToOrder(_objectSpread(_objectSpread({}, params), {}, {
|
|
1371
|
+
defaultShouldMerge: true
|
|
1372
|
+
}));
|
|
1373
|
+
case 5:
|
|
1374
|
+
result = _context12.sent;
|
|
1375
|
+
if (!(typeof result === 'boolean')) {
|
|
1376
|
+
_context12.next = 8;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
return _context12.abrupt("return", result);
|
|
1380
|
+
case 8:
|
|
1381
|
+
if (!(result && _typeof(result) === 'object' && typeof result.shouldMerge === 'boolean')) {
|
|
1382
|
+
_context12.next = 10;
|
|
1383
|
+
break;
|
|
1384
|
+
}
|
|
1385
|
+
return _context12.abrupt("return", result.shouldMerge);
|
|
1386
|
+
case 10:
|
|
1387
|
+
return _context12.abrupt("return", true);
|
|
1388
|
+
case 11:
|
|
1389
|
+
case "end":
|
|
1390
|
+
return _context12.stop();
|
|
1391
|
+
}
|
|
1392
|
+
}, _callee12, this);
|
|
1393
|
+
}));
|
|
1394
|
+
function shouldMergeProductToOrder(_x11) {
|
|
1395
|
+
return _shouldMergeProductToOrder.apply(this, arguments);
|
|
1396
|
+
}
|
|
1397
|
+
return shouldMergeProductToOrder;
|
|
1398
|
+
}() // ─── TempOrder: 商品 CRUD ───
|
|
1399
|
+
}, {
|
|
1400
|
+
key: "addProductToOrder",
|
|
1401
|
+
value: function () {
|
|
1402
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(product, booking) {
|
|
1403
|
+
var _this3 = this;
|
|
1404
|
+
var tempOrder, linked, productToAdd, incomingFingerprint, normalizedIncoming, hasIncomingGoodPass, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct;
|
|
1405
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1406
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1359
1407
|
case 0:
|
|
1360
1408
|
tempOrder = this.ensureTempOrder();
|
|
1361
1409
|
linked = booking ? this.createLinkedProductAndBooking({
|
|
@@ -1374,7 +1422,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1374
1422
|
var existedFingerprint = buildProductLineFingerprint(item.product_option_item, item.product_bundle);
|
|
1375
1423
|
return existedFingerprint === incomingFingerprint;
|
|
1376
1424
|
});
|
|
1377
|
-
|
|
1425
|
+
matchedProduct = matchedIndex === -1 ? null : tempOrder.products[matchedIndex];
|
|
1426
|
+
existedFingerprint = matchedProduct ? buildProductLineFingerprint(matchedProduct.product_option_item, matchedProduct.product_bundle) : '';
|
|
1427
|
+
if (!matchedProduct) {
|
|
1428
|
+
_context13.next = 16;
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
_context13.next = 13;
|
|
1432
|
+
return this.shouldMergeProductToOrder({
|
|
1433
|
+
incomingProduct: productToAdd,
|
|
1434
|
+
normalizedIncoming: normalizedIncoming,
|
|
1435
|
+
matchedProduct: matchedProduct,
|
|
1436
|
+
matchedIndex: matchedIndex,
|
|
1437
|
+
incomingFingerprint: incomingFingerprint,
|
|
1438
|
+
existedFingerprint: existedFingerprint,
|
|
1439
|
+
tempOrder: tempOrder,
|
|
1440
|
+
booking: booking
|
|
1441
|
+
});
|
|
1442
|
+
case 13:
|
|
1443
|
+
_context13.t0 = _context13.sent;
|
|
1444
|
+
_context13.next = 17;
|
|
1445
|
+
break;
|
|
1446
|
+
case 16:
|
|
1447
|
+
_context13.t0 = false;
|
|
1448
|
+
case 17:
|
|
1449
|
+
shouldMerge = _context13.t0;
|
|
1450
|
+
if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
|
|
1378
1451
|
this.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
|
|
1379
1452
|
if (linked) {
|
|
1380
1453
|
normalizedIncoming.booking_uid = linked.bookingUid;
|
|
@@ -1384,7 +1457,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1384
1457
|
}
|
|
1385
1458
|
tempOrder.products.push(normalizedIncoming);
|
|
1386
1459
|
} else {
|
|
1387
|
-
targetProduct =
|
|
1460
|
+
targetProduct = matchedProduct;
|
|
1388
1461
|
targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
|
|
1389
1462
|
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
|
|
1390
1463
|
metadata: _objectSpread(_objectSpread({}, productToAdd.metadata || {}), {}, {
|
|
@@ -1405,20 +1478,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1405
1478
|
tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
|
|
1406
1479
|
}
|
|
1407
1480
|
this.applyDiscount();
|
|
1408
|
-
|
|
1481
|
+
_context13.next = 23;
|
|
1409
1482
|
return this.recalculateSummary({
|
|
1410
1483
|
createIfMissing: true
|
|
1411
1484
|
});
|
|
1412
|
-
case
|
|
1485
|
+
case 23:
|
|
1413
1486
|
this.persistTempOrder();
|
|
1414
|
-
return
|
|
1415
|
-
case
|
|
1487
|
+
return _context13.abrupt("return", tempOrder.products);
|
|
1488
|
+
case 25:
|
|
1416
1489
|
case "end":
|
|
1417
|
-
return
|
|
1490
|
+
return _context13.stop();
|
|
1418
1491
|
}
|
|
1419
|
-
},
|
|
1492
|
+
}, _callee13, this);
|
|
1420
1493
|
}));
|
|
1421
|
-
function addProductToOrder(
|
|
1494
|
+
function addProductToOrder(_x12, _x13) {
|
|
1422
1495
|
return _addProductToOrder.apply(this, arguments);
|
|
1423
1496
|
}
|
|
1424
1497
|
return addProductToOrder;
|
|
@@ -1445,11 +1518,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1445
1518
|
}, {
|
|
1446
1519
|
key: "updateProductInOrder",
|
|
1447
1520
|
value: function () {
|
|
1448
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1521
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1449
1522
|
var _targetProduct$metada2, _metadata, _metadata2, _metadata3, _tempOrder$products$p;
|
|
1450
1523
|
var product_id, product_variant_id, updates, unique_identification_number, product_option_item, product_bundle, tempOrder, identityLookup, productIndex, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, existedMeta;
|
|
1451
|
-
return _regeneratorRuntime().wrap(function
|
|
1452
|
-
while (1) switch (
|
|
1524
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1525
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1453
1526
|
case 0:
|
|
1454
1527
|
product_id = params.product_id, product_variant_id = params.product_variant_id, updates = params.updates, unique_identification_number = params.unique_identification_number, product_option_item = params.product_option_item, product_bundle = params.product_bundle;
|
|
1455
1528
|
tempOrder = this.ensureTempOrder();
|
|
@@ -1464,7 +1537,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1464
1537
|
if (product_bundle !== undefined) identityLookup.product_bundle = product_bundle;
|
|
1465
1538
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
1466
1539
|
if (!(productIndex === -1)) {
|
|
1467
|
-
|
|
1540
|
+
_context14.next = 9;
|
|
1468
1541
|
break;
|
|
1469
1542
|
}
|
|
1470
1543
|
throw new Error('[Order] 目标商品不存在,无法更新');
|
|
@@ -1499,20 +1572,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1499
1572
|
tempOrder.products[productIndex] = normalizeOrderProduct(nextProduct);
|
|
1500
1573
|
this.captureProductRuntime(tempOrder, updates, tempOrder.products[productIndex], (_tempOrder$products$p = tempOrder.products[productIndex].metadata) === null || _tempOrder$products$p === void 0 ? void 0 : _tempOrder$products$p.unique_identification_number);
|
|
1501
1574
|
this.applyDiscount();
|
|
1502
|
-
|
|
1575
|
+
_context14.next = 20;
|
|
1503
1576
|
return this.recalculateSummary({
|
|
1504
1577
|
createIfMissing: true
|
|
1505
1578
|
});
|
|
1506
1579
|
case 20:
|
|
1507
1580
|
this.persistTempOrder();
|
|
1508
|
-
return
|
|
1581
|
+
return _context14.abrupt("return", tempOrder.products);
|
|
1509
1582
|
case 22:
|
|
1510
1583
|
case "end":
|
|
1511
|
-
return
|
|
1584
|
+
return _context14.stop();
|
|
1512
1585
|
}
|
|
1513
|
-
},
|
|
1586
|
+
}, _callee14, this);
|
|
1514
1587
|
}));
|
|
1515
|
-
function updateProductInOrder(
|
|
1588
|
+
function updateProductInOrder(_x14) {
|
|
1516
1589
|
return _updateProductInOrder.apply(this, arguments);
|
|
1517
1590
|
}
|
|
1518
1591
|
return updateProductInOrder;
|
|
@@ -1520,30 +1593,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1520
1593
|
}, {
|
|
1521
1594
|
key: "removeProductFromOrder",
|
|
1522
1595
|
value: function () {
|
|
1523
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1596
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(identity) {
|
|
1524
1597
|
var tempOrder;
|
|
1525
|
-
return _regeneratorRuntime().wrap(function
|
|
1526
|
-
while (1) switch (
|
|
1598
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1599
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1527
1600
|
case 0:
|
|
1528
1601
|
tempOrder = this.ensureTempOrder();
|
|
1529
1602
|
tempOrder.products = tempOrder.products.filter(function (item) {
|
|
1530
1603
|
return !isIdentityMatch(item, identity);
|
|
1531
1604
|
});
|
|
1532
1605
|
this.applyDiscount();
|
|
1533
|
-
|
|
1606
|
+
_context15.next = 5;
|
|
1534
1607
|
return this.recalculateSummary({
|
|
1535
1608
|
createIfMissing: true
|
|
1536
1609
|
});
|
|
1537
1610
|
case 5:
|
|
1538
1611
|
this.persistTempOrder();
|
|
1539
|
-
return
|
|
1612
|
+
return _context15.abrupt("return", tempOrder.products);
|
|
1540
1613
|
case 7:
|
|
1541
1614
|
case "end":
|
|
1542
|
-
return
|
|
1615
|
+
return _context15.stop();
|
|
1543
1616
|
}
|
|
1544
|
-
},
|
|
1617
|
+
}, _callee15, this);
|
|
1545
1618
|
}));
|
|
1546
|
-
function removeProductFromOrder(
|
|
1619
|
+
function removeProductFromOrder(_x15) {
|
|
1547
1620
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1548
1621
|
}
|
|
1549
1622
|
return removeProductFromOrder;
|
|
@@ -1557,11 +1630,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1557
1630
|
}, {
|
|
1558
1631
|
key: "submitTempOrder",
|
|
1559
1632
|
value: function () {
|
|
1560
|
-
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1633
|
+
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1561
1634
|
var _params$cacheId, _this$otherParams;
|
|
1562
1635
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
1563
|
-
return _regeneratorRuntime().wrap(function
|
|
1564
|
-
while (1) switch (
|
|
1636
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1637
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1565
1638
|
case 0:
|
|
1566
1639
|
tempOrder = this.ensureTempOrder();
|
|
1567
1640
|
this.persistTempOrder();
|
|
@@ -1588,10 +1661,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1588
1661
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
1589
1662
|
enhance: enhancePayload
|
|
1590
1663
|
});
|
|
1591
|
-
|
|
1664
|
+
_context16.next = 10;
|
|
1592
1665
|
return this.saveDraft();
|
|
1593
1666
|
case 10:
|
|
1594
|
-
|
|
1667
|
+
_context16.prev = 10;
|
|
1595
1668
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
1596
1669
|
orderId: payload.order_id,
|
|
1597
1670
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -1599,62 +1672,62 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1599
1672
|
paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
|
|
1600
1673
|
smallTicketDataFlag: payload.small_ticket_data_flag
|
|
1601
1674
|
});
|
|
1602
|
-
|
|
1675
|
+
_context16.next = 14;
|
|
1603
1676
|
return this.submitSalesOrder({
|
|
1604
1677
|
query: payload
|
|
1605
1678
|
});
|
|
1606
1679
|
case 14:
|
|
1607
|
-
result =
|
|
1608
|
-
|
|
1680
|
+
result = _context16.sent;
|
|
1681
|
+
_context16.next = 27;
|
|
1609
1682
|
break;
|
|
1610
1683
|
case 17:
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
backendErrorResponse = this.extractSubmitErrorResponse(
|
|
1684
|
+
_context16.prev = 17;
|
|
1685
|
+
_context16.t0 = _context16["catch"](10);
|
|
1686
|
+
backendErrorResponse = this.extractSubmitErrorResponse(_context16.t0);
|
|
1614
1687
|
if (!backendErrorResponse) {
|
|
1615
|
-
|
|
1688
|
+
_context16.next = 24;
|
|
1616
1689
|
break;
|
|
1617
1690
|
}
|
|
1618
1691
|
this.store.syncState = 'failed';
|
|
1619
1692
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
1620
|
-
return
|
|
1693
|
+
return _context16.abrupt("return", backendErrorResponse);
|
|
1621
1694
|
case 24:
|
|
1622
1695
|
this.store.syncState = 'failed';
|
|
1623
1696
|
this.logError('submitTempOrder failed', {
|
|
1624
|
-
error:
|
|
1697
|
+
error: _context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0),
|
|
1625
1698
|
orderId: payload.order_id,
|
|
1626
1699
|
externalSaleNumber: payload.external_sale_number,
|
|
1627
1700
|
paymentStatus: payload.payment_status,
|
|
1628
1701
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
1629
1702
|
});
|
|
1630
|
-
throw
|
|
1703
|
+
throw _context16.t0;
|
|
1631
1704
|
case 27:
|
|
1632
1705
|
if (!this.isSubmitResponseRejected(result)) {
|
|
1633
|
-
|
|
1706
|
+
_context16.next = 31;
|
|
1634
1707
|
break;
|
|
1635
1708
|
}
|
|
1636
1709
|
this.store.syncState = 'failed';
|
|
1637
1710
|
this.logSubmitBackendRejected(result, payload);
|
|
1638
|
-
return
|
|
1711
|
+
return _context16.abrupt("return", result);
|
|
1639
1712
|
case 31:
|
|
1640
1713
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
1641
1714
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
1642
|
-
|
|
1715
|
+
_context16.next = 37;
|
|
1643
1716
|
break;
|
|
1644
1717
|
}
|
|
1645
1718
|
tempOrder.order_id = submittedOrderId;
|
|
1646
1719
|
resultRecord = result;
|
|
1647
|
-
|
|
1720
|
+
_context16.next = 37;
|
|
1648
1721
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
1649
1722
|
case 37:
|
|
1650
|
-
return
|
|
1723
|
+
return _context16.abrupt("return", result);
|
|
1651
1724
|
case 38:
|
|
1652
1725
|
case "end":
|
|
1653
|
-
return
|
|
1726
|
+
return _context16.stop();
|
|
1654
1727
|
}
|
|
1655
|
-
},
|
|
1728
|
+
}, _callee16, this, [[10, 17]]);
|
|
1656
1729
|
}));
|
|
1657
|
-
function submitTempOrder(
|
|
1730
|
+
function submitTempOrder(_x16) {
|
|
1658
1731
|
return _submitTempOrder.apply(this, arguments);
|
|
1659
1732
|
}
|
|
1660
1733
|
return submitTempOrder;
|
|
@@ -1662,25 +1735,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1662
1735
|
}, {
|
|
1663
1736
|
key: "markLocalOrderSynced",
|
|
1664
1737
|
value: function () {
|
|
1665
|
-
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1738
|
+
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orderId, remoteOrder) {
|
|
1666
1739
|
var tempOrder;
|
|
1667
|
-
return _regeneratorRuntime().wrap(function
|
|
1668
|
-
while (1) switch (
|
|
1740
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1741
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1669
1742
|
case 0:
|
|
1670
1743
|
tempOrder = this.ensureTempOrder();
|
|
1671
1744
|
tempOrder.order_id = orderId;
|
|
1672
1745
|
this.store.lastOrderInfo = remoteOrder;
|
|
1673
1746
|
this.store.syncState = 'submitted';
|
|
1674
1747
|
this.persistTempOrder();
|
|
1675
|
-
|
|
1748
|
+
_context17.next = 7;
|
|
1676
1749
|
return this.saveDraft();
|
|
1677
1750
|
case 7:
|
|
1678
1751
|
case "end":
|
|
1679
|
-
return
|
|
1752
|
+
return _context17.stop();
|
|
1680
1753
|
}
|
|
1681
|
-
},
|
|
1754
|
+
}, _callee17, this);
|
|
1682
1755
|
}));
|
|
1683
|
-
function markLocalOrderSynced(
|
|
1756
|
+
function markLocalOrderSynced(_x17, _x18) {
|
|
1684
1757
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
1685
1758
|
}
|
|
1686
1759
|
return markLocalOrderSynced;
|
|
@@ -1727,49 +1800,49 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1727
1800
|
}, {
|
|
1728
1801
|
key: "syncPaymentsToOrder",
|
|
1729
1802
|
value: function () {
|
|
1730
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1803
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1731
1804
|
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, submitResult;
|
|
1732
|
-
return _regeneratorRuntime().wrap(function
|
|
1733
|
-
while (1) switch (
|
|
1805
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1806
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1734
1807
|
case 0:
|
|
1735
1808
|
tempOrder = this.ensureTempOrder();
|
|
1736
1809
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
1737
1810
|
tempOrder.payments = mappedPayments;
|
|
1738
1811
|
if (params.paymentStatus) tempOrder.payment_status = params.paymentStatus;
|
|
1739
1812
|
this.persistTempOrder();
|
|
1740
|
-
|
|
1813
|
+
_context18.next = 7;
|
|
1741
1814
|
return this.saveDraft();
|
|
1742
1815
|
case 7:
|
|
1743
1816
|
paymentTotal = this.calculatePaymentTotal(mappedPayments);
|
|
1744
1817
|
targetAmount = this.getPaymentTargetAmount();
|
|
1745
1818
|
isFullyPaid = targetAmount.lte(0) ? false : paymentTotal.gte(targetAmount);
|
|
1746
1819
|
if (!(!isFullyPaid || !params.submitWhenPaid)) {
|
|
1747
|
-
|
|
1820
|
+
_context18.next = 12;
|
|
1748
1821
|
break;
|
|
1749
1822
|
}
|
|
1750
|
-
return
|
|
1823
|
+
return _context18.abrupt("return", {
|
|
1751
1824
|
isFullyPaid: isFullyPaid
|
|
1752
1825
|
});
|
|
1753
1826
|
case 12:
|
|
1754
|
-
|
|
1827
|
+
_context18.next = 14;
|
|
1755
1828
|
return this.submitTempOrder({
|
|
1756
1829
|
payments: mappedPayments,
|
|
1757
1830
|
paymentStatus: params.paymentStatus || 'paid',
|
|
1758
1831
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
1759
1832
|
});
|
|
1760
1833
|
case 14:
|
|
1761
|
-
submitResult =
|
|
1762
|
-
return
|
|
1834
|
+
submitResult = _context18.sent;
|
|
1835
|
+
return _context18.abrupt("return", {
|
|
1763
1836
|
isFullyPaid: isFullyPaid,
|
|
1764
1837
|
submitResult: submitResult
|
|
1765
1838
|
});
|
|
1766
1839
|
case 16:
|
|
1767
1840
|
case "end":
|
|
1768
|
-
return
|
|
1841
|
+
return _context18.stop();
|
|
1769
1842
|
}
|
|
1770
|
-
},
|
|
1843
|
+
}, _callee18, this);
|
|
1771
1844
|
}));
|
|
1772
|
-
function syncPaymentsToOrder(
|
|
1845
|
+
function syncPaymentsToOrder(_x19) {
|
|
1773
1846
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
1774
1847
|
}
|
|
1775
1848
|
return syncPaymentsToOrder;
|
|
@@ -1858,11 +1931,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1858
1931
|
}, {
|
|
1859
1932
|
key: "submitOrder",
|
|
1860
1933
|
value: function () {
|
|
1861
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1934
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(order) {
|
|
1862
1935
|
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
1863
1936
|
var url, query, fetchUrl, params;
|
|
1864
|
-
return _regeneratorRuntime().wrap(function
|
|
1865
|
-
while (1) switch (
|
|
1937
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1938
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1866
1939
|
case 0:
|
|
1867
1940
|
this.logInfo('submitOrder called', {
|
|
1868
1941
|
url: order.url,
|
|
@@ -1882,14 +1955,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1882
1955
|
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
1883
1956
|
scheduleDate: params.schedule_date
|
|
1884
1957
|
});
|
|
1885
|
-
return
|
|
1958
|
+
return _context19.abrupt("return", this.request.post(fetchUrl, params));
|
|
1886
1959
|
case 6:
|
|
1887
1960
|
case "end":
|
|
1888
|
-
return
|
|
1961
|
+
return _context19.stop();
|
|
1889
1962
|
}
|
|
1890
|
-
},
|
|
1963
|
+
}, _callee19, this);
|
|
1891
1964
|
}));
|
|
1892
|
-
function submitOrder(
|
|
1965
|
+
function submitOrder(_x20) {
|
|
1893
1966
|
return _submitOrder.apply(this, arguments);
|
|
1894
1967
|
}
|
|
1895
1968
|
return submitOrder;
|
|
@@ -1897,13 +1970,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1897
1970
|
}, {
|
|
1898
1971
|
key: "cancelOrder",
|
|
1899
1972
|
value: function () {
|
|
1900
|
-
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1973
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1901
1974
|
var payload;
|
|
1902
|
-
return _regeneratorRuntime().wrap(function
|
|
1903
|
-
while (1) switch (
|
|
1975
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1976
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1904
1977
|
case 0:
|
|
1905
1978
|
if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
|
|
1906
|
-
|
|
1979
|
+
_context20.next = 2;
|
|
1907
1980
|
break;
|
|
1908
1981
|
}
|
|
1909
1982
|
throw new Error('取消订单失败:order_ids 不能为空');
|
|
@@ -1919,16 +1992,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1919
1992
|
method: 'PUT',
|
|
1920
1993
|
orderIdsCount: params.order_ids.length
|
|
1921
1994
|
});
|
|
1922
|
-
return
|
|
1995
|
+
return _context20.abrupt("return", this.request.put('/order/update-status', payload, {
|
|
1923
1996
|
isShopApi: true
|
|
1924
1997
|
}));
|
|
1925
1998
|
case 5:
|
|
1926
1999
|
case "end":
|
|
1927
|
-
return
|
|
2000
|
+
return _context20.stop();
|
|
1928
2001
|
}
|
|
1929
|
-
},
|
|
2002
|
+
}, _callee20, this);
|
|
1930
2003
|
}));
|
|
1931
|
-
function cancelOrder(
|
|
2004
|
+
function cancelOrder(_x21) {
|
|
1932
2005
|
return _cancelOrder.apply(this, arguments);
|
|
1933
2006
|
}
|
|
1934
2007
|
return cancelOrder;
|
|
@@ -1936,19 +2009,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1936
2009
|
}, {
|
|
1937
2010
|
key: "changeBookingStatus",
|
|
1938
2011
|
value: function () {
|
|
1939
|
-
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2012
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1940
2013
|
var url, payload;
|
|
1941
|
-
return _regeneratorRuntime().wrap(function
|
|
1942
|
-
while (1) switch (
|
|
2014
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2015
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1943
2016
|
case 0:
|
|
1944
2017
|
if (params.booking_id) {
|
|
1945
|
-
|
|
2018
|
+
_context21.next = 2;
|
|
1946
2019
|
break;
|
|
1947
2020
|
}
|
|
1948
2021
|
throw new Error('变更预约状态失败:booking_id 不能为空');
|
|
1949
2022
|
case 2:
|
|
1950
2023
|
if (params.appointment_status) {
|
|
1951
|
-
|
|
2024
|
+
_context21.next = 4;
|
|
1952
2025
|
break;
|
|
1953
2026
|
}
|
|
1954
2027
|
throw new Error('变更预约状态失败:appointment_status 不能为空');
|
|
@@ -1963,16 +2036,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1963
2036
|
bookingId: params.booking_id,
|
|
1964
2037
|
appointmentStatus: params.appointment_status
|
|
1965
2038
|
});
|
|
1966
|
-
return
|
|
2039
|
+
return _context21.abrupt("return", this.request.put(url, payload, {
|
|
1967
2040
|
isShopApi: true
|
|
1968
2041
|
}));
|
|
1969
2042
|
case 8:
|
|
1970
2043
|
case "end":
|
|
1971
|
-
return
|
|
2044
|
+
return _context21.stop();
|
|
1972
2045
|
}
|
|
1973
|
-
},
|
|
2046
|
+
}, _callee21, this);
|
|
1974
2047
|
}));
|
|
1975
|
-
function changeBookingStatus(
|
|
2048
|
+
function changeBookingStatus(_x22) {
|
|
1976
2049
|
return _changeBookingStatus.apply(this, arguments);
|
|
1977
2050
|
}
|
|
1978
2051
|
return changeBookingStatus;
|
|
@@ -1990,11 +2063,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1990
2063
|
}, {
|
|
1991
2064
|
key: "createOrderByCheckout",
|
|
1992
2065
|
value: (function () {
|
|
1993
|
-
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2066
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1994
2067
|
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
1995
2068
|
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
1996
|
-
return _regeneratorRuntime().wrap(function
|
|
1997
|
-
while (1) switch (
|
|
2069
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2070
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1998
2071
|
case 0:
|
|
1999
2072
|
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
2000
2073
|
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
@@ -2028,7 +2101,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2028
2101
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
2029
2102
|
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
2030
2103
|
});
|
|
2031
|
-
|
|
2104
|
+
_context22.prev = 4;
|
|
2032
2105
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
2033
2106
|
orderData = _objectSpread({
|
|
2034
2107
|
sales_channel: 'my_pisel',
|
|
@@ -2092,10 +2165,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2092
2165
|
});
|
|
2093
2166
|
|
|
2094
2167
|
// 调用后端接口
|
|
2095
|
-
|
|
2168
|
+
_context22.next = 12;
|
|
2096
2169
|
return this.request.post('/order/checkout', orderData);
|
|
2097
2170
|
case 12:
|
|
2098
|
-
response =
|
|
2171
|
+
response = _context22.sent;
|
|
2099
2172
|
this.logInfo('Order API called successfully', {
|
|
2100
2173
|
response: response
|
|
2101
2174
|
});
|
|
@@ -2103,22 +2176,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2103
2176
|
success: !!response,
|
|
2104
2177
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
2105
2178
|
});
|
|
2106
|
-
return
|
|
2179
|
+
return _context22.abrupt("return", response);
|
|
2107
2180
|
case 18:
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
console.error('[Order] createOrderByCheckout 创建订单失败:',
|
|
2181
|
+
_context22.prev = 18;
|
|
2182
|
+
_context22.t0 = _context22["catch"](4);
|
|
2183
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context22.t0);
|
|
2111
2184
|
this.logInfo('Order API called failed', {
|
|
2112
|
-
error:
|
|
2185
|
+
error: _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0)
|
|
2113
2186
|
});
|
|
2114
|
-
throw
|
|
2187
|
+
throw _context22.t0;
|
|
2115
2188
|
case 23:
|
|
2116
2189
|
case "end":
|
|
2117
|
-
return
|
|
2190
|
+
return _context22.stop();
|
|
2118
2191
|
}
|
|
2119
|
-
},
|
|
2192
|
+
}, _callee22, this, [[4, 18]]);
|
|
2120
2193
|
}));
|
|
2121
|
-
function createOrderByCheckout(
|
|
2194
|
+
function createOrderByCheckout(_x23) {
|
|
2122
2195
|
return _createOrderByCheckout.apply(this, arguments);
|
|
2123
2196
|
}
|
|
2124
2197
|
return createOrderByCheckout;
|
|
@@ -2126,23 +2199,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2126
2199
|
}, {
|
|
2127
2200
|
key: "submitSalesOrder",
|
|
2128
2201
|
value: function () {
|
|
2129
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2202
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2130
2203
|
var url, query, fetchUrl;
|
|
2131
|
-
return _regeneratorRuntime().wrap(function
|
|
2132
|
-
while (1) switch (
|
|
2204
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2205
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2133
2206
|
case 0:
|
|
2134
2207
|
url = params.url, query = params.query;
|
|
2135
2208
|
fetchUrl = url || '/order/sales/checkout';
|
|
2136
|
-
return
|
|
2209
|
+
return _context23.abrupt("return", this.request.post(fetchUrl, query, {
|
|
2137
2210
|
customToast: function customToast() {}
|
|
2138
2211
|
}));
|
|
2139
2212
|
case 3:
|
|
2140
2213
|
case "end":
|
|
2141
|
-
return
|
|
2214
|
+
return _context23.stop();
|
|
2142
2215
|
}
|
|
2143
|
-
},
|
|
2216
|
+
}, _callee23, this);
|
|
2144
2217
|
}));
|
|
2145
|
-
function submitSalesOrder(
|
|
2218
|
+
function submitSalesOrder(_x24) {
|
|
2146
2219
|
return _submitSalesOrder.apply(this, arguments);
|
|
2147
2220
|
}
|
|
2148
2221
|
return submitSalesOrder;
|
|
@@ -2156,37 +2229,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2156
2229
|
}, {
|
|
2157
2230
|
key: "sendCustomerPayLink",
|
|
2158
2231
|
value: (function () {
|
|
2159
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2232
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2160
2233
|
var _params$emails;
|
|
2161
2234
|
var orderIds;
|
|
2162
|
-
return _regeneratorRuntime().wrap(function
|
|
2163
|
-
while (1) switch (
|
|
2235
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2236
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2164
2237
|
case 0:
|
|
2165
2238
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2166
2239
|
if (orderIds.length) {
|
|
2167
|
-
|
|
2240
|
+
_context24.next = 3;
|
|
2168
2241
|
break;
|
|
2169
2242
|
}
|
|
2170
2243
|
throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
|
|
2171
2244
|
case 3:
|
|
2172
2245
|
if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
|
|
2173
|
-
|
|
2246
|
+
_context24.next = 5;
|
|
2174
2247
|
break;
|
|
2175
2248
|
}
|
|
2176
2249
|
throw new Error('发送支付链接需要至少一个邮箱');
|
|
2177
2250
|
case 5:
|
|
2178
|
-
return
|
|
2251
|
+
return _context24.abrupt("return", this.request.post('/order/batch-email', {
|
|
2179
2252
|
order_ids: orderIds,
|
|
2180
2253
|
notify_action: params.notify_action || 'order_payment_reminder',
|
|
2181
2254
|
emails: params.emails
|
|
2182
2255
|
}));
|
|
2183
2256
|
case 6:
|
|
2184
2257
|
case "end":
|
|
2185
|
-
return
|
|
2258
|
+
return _context24.stop();
|
|
2186
2259
|
}
|
|
2187
|
-
},
|
|
2260
|
+
}, _callee24, this);
|
|
2188
2261
|
}));
|
|
2189
|
-
function sendCustomerPayLink(
|
|
2262
|
+
function sendCustomerPayLink(_x25) {
|
|
2190
2263
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2191
2264
|
}
|
|
2192
2265
|
return sendCustomerPayLink;
|
|
@@ -2195,28 +2268,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2268
|
}, {
|
|
2196
2269
|
key: "getOrderInfoByRemote",
|
|
2197
2270
|
value: function () {
|
|
2198
|
-
var _getOrderInfoByRemote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2271
|
+
var _getOrderInfoByRemote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(order_id) {
|
|
2199
2272
|
var res;
|
|
2200
|
-
return _regeneratorRuntime().wrap(function
|
|
2201
|
-
while (1) switch (
|
|
2273
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2274
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2202
2275
|
case 0:
|
|
2203
|
-
|
|
2276
|
+
_context25.next = 2;
|
|
2204
2277
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
2205
|
-
with: ['products', '
|
|
2278
|
+
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
2206
2279
|
});
|
|
2207
2280
|
case 2:
|
|
2208
|
-
res =
|
|
2281
|
+
res = _context25.sent;
|
|
2209
2282
|
if (res.code === 200) {
|
|
2210
2283
|
this.store.lastOrderInfo = res.data;
|
|
2211
2284
|
}
|
|
2212
|
-
return
|
|
2285
|
+
return _context25.abrupt("return", res);
|
|
2213
2286
|
case 5:
|
|
2214
2287
|
case "end":
|
|
2215
|
-
return
|
|
2288
|
+
return _context25.stop();
|
|
2216
2289
|
}
|
|
2217
|
-
},
|
|
2290
|
+
}, _callee25, this);
|
|
2218
2291
|
}));
|
|
2219
|
-
function getOrderInfoByRemote(
|
|
2292
|
+
function getOrderInfoByRemote(_x26) {
|
|
2220
2293
|
return _getOrderInfoByRemote.apply(this, arguments);
|
|
2221
2294
|
}
|
|
2222
2295
|
return getOrderInfoByRemote;
|
|
@@ -2230,11 +2303,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2230
2303
|
}, {
|
|
2231
2304
|
key: "hydrateTempOrderFromRecord",
|
|
2232
2305
|
value: (function () {
|
|
2233
|
-
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2306
|
+
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(record, options) {
|
|
2234
2307
|
var _this5 = this;
|
|
2235
2308
|
var raw, defaults, nextTempOrder, TEMP_ORDER_KEYS;
|
|
2236
|
-
return _regeneratorRuntime().wrap(function
|
|
2237
|
-
while (1) switch (
|
|
2309
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2310
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2238
2311
|
case 0:
|
|
2239
2312
|
raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
2240
2313
|
defaults = this.createDefaultTempOrderInstance();
|
|
@@ -2282,23 +2355,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2282
2355
|
this.store.summary = raw.summary && _typeof(raw.summary) === 'object' ? _objectSpread(_objectSpread({}, createEmptySummary()), raw.summary) : createEmptySummary();
|
|
2283
2356
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
2284
2357
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
2285
|
-
|
|
2358
|
+
_context26.next = 23;
|
|
2286
2359
|
break;
|
|
2287
2360
|
}
|
|
2288
|
-
|
|
2361
|
+
_context26.next = 23;
|
|
2289
2362
|
return this.recalculateSummary({
|
|
2290
2363
|
createIfMissing: false
|
|
2291
2364
|
});
|
|
2292
2365
|
case 23:
|
|
2293
2366
|
this.persistTempOrder();
|
|
2294
|
-
return
|
|
2367
|
+
return _context26.abrupt("return", nextTempOrder);
|
|
2295
2368
|
case 25:
|
|
2296
2369
|
case "end":
|
|
2297
|
-
return
|
|
2370
|
+
return _context26.stop();
|
|
2298
2371
|
}
|
|
2299
|
-
},
|
|
2372
|
+
}, _callee26, this);
|
|
2300
2373
|
}));
|
|
2301
|
-
function hydrateTempOrderFromRecord(
|
|
2374
|
+
function hydrateTempOrderFromRecord(_x27, _x28) {
|
|
2302
2375
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
2303
2376
|
}
|
|
2304
2377
|
return hydrateTempOrderFromRecord;
|
|
@@ -2333,25 +2406,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2333
2406
|
}, {
|
|
2334
2407
|
key: "getOrderInfo",
|
|
2335
2408
|
value: function () {
|
|
2336
|
-
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2409
|
+
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(order_id) {
|
|
2337
2410
|
var res;
|
|
2338
|
-
return _regeneratorRuntime().wrap(function
|
|
2339
|
-
while (1) switch (
|
|
2411
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2412
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2340
2413
|
case 0:
|
|
2341
|
-
|
|
2414
|
+
_context27.next = 2;
|
|
2342
2415
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
2343
|
-
with: ['products', '
|
|
2416
|
+
with: ['products', 'bookings']
|
|
2344
2417
|
});
|
|
2345
2418
|
case 2:
|
|
2346
|
-
res =
|
|
2347
|
-
return
|
|
2419
|
+
res = _context27.sent;
|
|
2420
|
+
return _context27.abrupt("return", res);
|
|
2348
2421
|
case 4:
|
|
2349
2422
|
case "end":
|
|
2350
|
-
return
|
|
2423
|
+
return _context27.stop();
|
|
2351
2424
|
}
|
|
2352
|
-
},
|
|
2425
|
+
}, _callee27, this);
|
|
2353
2426
|
}));
|
|
2354
|
-
function getOrderInfo(
|
|
2427
|
+
function getOrderInfo(_x29) {
|
|
2355
2428
|
return _getOrderInfo.apply(this, arguments);
|
|
2356
2429
|
}
|
|
2357
2430
|
return getOrderInfo;
|