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