@pisell/pisellos 2.2.164 → 2.2.165
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/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +45 -15
- package/dist/modules/Order/index.d.ts +10 -3
- package/dist/modules/Order/index.js +272 -142
- package/dist/modules/Order/types.d.ts +14 -2
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +67 -15
- package/dist/server/index.js +1 -0
- package/dist/solution/BaseSales/index.d.ts +9 -1
- package/dist/solution/BaseSales/index.js +369 -240
- package/dist/solution/BaseSales/types.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
- package/dist/solution/BaseSales/utils.js +36 -7
- package/dist/solution/BookingTicket/index.d.ts +3 -0
- package/dist/solution/BookingTicket/index.js +155 -86
- package/dist/solution/BookingTicket/utils/addProductDecision.js +19 -11
- package/dist/solution/ScanOrder/utils.js +36 -7
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +35 -9
- package/lib/modules/Order/index.d.ts +10 -3
- package/lib/modules/Order/index.js +104 -4
- package/lib/modules/Order/types.d.ts +14 -2
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +58 -9
- package/lib/server/index.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +9 -1
- package/lib/solution/BaseSales/index.js +65 -3
- package/lib/solution/BaseSales/types.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
- package/lib/solution/BaseSales/utils.js +37 -5
- package/lib/solution/BookingTicket/index.d.ts +3 -0
- package/lib/solution/BookingTicket/index.js +48 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.js +16 -8
- package/lib/solution/ScanOrder/utils.js +37 -5
- package/package.json +1 -1
|
@@ -727,6 +727,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
727
727
|
}
|
|
728
728
|
return saveDraft;
|
|
729
729
|
}()
|
|
730
|
+
}, {
|
|
731
|
+
key: "saveDraftInBackground",
|
|
732
|
+
value: function saveDraftInBackground() {
|
|
733
|
+
void this.saveDraft();
|
|
734
|
+
}
|
|
730
735
|
}, {
|
|
731
736
|
key: "hydrateTempOrderFromLocalRecord",
|
|
732
737
|
value: function () {
|
|
@@ -1316,13 +1321,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1316
1321
|
if (snapshot === null) delete extend.customerSnapshot;else extend.customerSnapshot = cloneDeep(snapshot);
|
|
1317
1322
|
}
|
|
1318
1323
|
this.persistTempOrder();
|
|
1324
|
+
this.saveDraftInBackground();
|
|
1319
1325
|
this.emitOrderCustomerChange();
|
|
1320
1326
|
}
|
|
1321
1327
|
}, {
|
|
1322
1328
|
key: "getOrderCustomer",
|
|
1323
1329
|
value: function getOrderCustomer() {
|
|
1324
1330
|
var tempOrder = this.store.tempOrder;
|
|
1325
|
-
if (!tempOrder || tempOrder.customer_id
|
|
1331
|
+
if (!tempOrder || !tempOrder.customer_id) {
|
|
1326
1332
|
return null;
|
|
1327
1333
|
}
|
|
1328
1334
|
return {
|
|
@@ -1344,13 +1350,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1344
1350
|
key: "clearOrderCustomer",
|
|
1345
1351
|
value: function clearOrderCustomer() {
|
|
1346
1352
|
var tempOrder = this.ensureTempOrder();
|
|
1347
|
-
tempOrder.customer_id =
|
|
1353
|
+
tempOrder.customer_id = 0;
|
|
1348
1354
|
tempOrder.customer_name = '';
|
|
1349
1355
|
tempOrder.country_calling_code = '';
|
|
1350
1356
|
tempOrder.phone = '';
|
|
1351
1357
|
tempOrder.email = '';
|
|
1352
1358
|
if (tempOrder._extend) delete tempOrder._extend.customerSnapshot;
|
|
1353
1359
|
this.persistTempOrder();
|
|
1360
|
+
this.saveDraftInBackground();
|
|
1354
1361
|
this.core.effects.emit(OrderHooks.OnOrderCustomerChange, null);
|
|
1355
1362
|
}
|
|
1356
1363
|
}, {
|
|
@@ -1647,7 +1654,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1647
1654
|
value: function () {
|
|
1648
1655
|
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1649
1656
|
var _targetProduct$metada2, _metadata, _metadata2, _metadata3, _tempOrder$products$p;
|
|
1650
|
-
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_option_item, product_bundle, booking, tempOrder, identityLookup, productIndex, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, existedMeta, normalizedProduct, _normalizedProduct$me, _targetProduct$metada3, productUid, linked;
|
|
1657
|
+
var product_id, product_variant_id, updates, unique_identification_number, identity_key, product_option_item, product_bundle, booking, tempOrder, identityLookup, productIndex, targetUid, targetProduct, nextProduct, callerUpdatesTopPrice, callerUpdatesMainMeta, existedMeta, normalizedProduct, _normalizedProduct$me, _targetProduct$metada3, productUid, linked;
|
|
1651
1658
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1652
1659
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1653
1660
|
case 0:
|
|
@@ -1659,19 +1666,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1659
1666
|
};
|
|
1660
1667
|
if (unique_identification_number !== undefined) {
|
|
1661
1668
|
identityLookup.unique_identification_number = unique_identification_number;
|
|
1669
|
+
if (identity_key === undefined) {
|
|
1670
|
+
identityLookup.identity_key = unique_identification_number;
|
|
1671
|
+
}
|
|
1662
1672
|
}
|
|
1663
1673
|
if (identity_key !== undefined) {
|
|
1664
1674
|
identityLookup.identity_key = identity_key;
|
|
1665
1675
|
}
|
|
1666
1676
|
if (product_option_item !== undefined) identityLookup.product_option_item = product_option_item;
|
|
1667
1677
|
if (product_bundle !== undefined) identityLookup.product_bundle = product_bundle;
|
|
1668
|
-
productIndex =
|
|
1678
|
+
productIndex = -1;
|
|
1679
|
+
if (unique_identification_number !== undefined) {
|
|
1680
|
+
targetUid = String(unique_identification_number);
|
|
1681
|
+
productIndex = tempOrder.products.findIndex(function (item) {
|
|
1682
|
+
var _item$metadata;
|
|
1683
|
+
return String(((_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.unique_identification_number) || item.unique_identification_number || '') === targetUid;
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
if (productIndex === -1) {
|
|
1687
|
+
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
1688
|
+
}
|
|
1669
1689
|
if (!(productIndex === -1)) {
|
|
1670
|
-
_context16.next =
|
|
1690
|
+
_context16.next = 12;
|
|
1671
1691
|
break;
|
|
1672
1692
|
}
|
|
1673
1693
|
throw new Error('[Order] 目标商品不存在,无法更新');
|
|
1674
|
-
case
|
|
1694
|
+
case 12:
|
|
1675
1695
|
targetProduct = tempOrder.products[productIndex];
|
|
1676
1696
|
nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), updates), {}, {
|
|
1677
1697
|
product_id: product_id,
|
|
@@ -1724,14 +1744,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1724
1744
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
1725
1745
|
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);
|
|
1726
1746
|
this.applyDiscount();
|
|
1727
|
-
_context16.next =
|
|
1747
|
+
_context16.next = 25;
|
|
1728
1748
|
return this.recalculateSummary({
|
|
1729
1749
|
createIfMissing: true
|
|
1730
1750
|
});
|
|
1731
|
-
case
|
|
1751
|
+
case 25:
|
|
1732
1752
|
this.persistTempOrder();
|
|
1733
1753
|
return _context16.abrupt("return", tempOrder.products);
|
|
1734
|
-
case
|
|
1754
|
+
case 27:
|
|
1735
1755
|
case "end":
|
|
1736
1756
|
return _context16.stop();
|
|
1737
1757
|
}
|
|
@@ -1742,6 +1762,74 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1742
1762
|
}
|
|
1743
1763
|
return updateOrderProduct;
|
|
1744
1764
|
}()
|
|
1765
|
+
}, {
|
|
1766
|
+
key: "updateOrderProductQuantity",
|
|
1767
|
+
value: function () {
|
|
1768
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1769
|
+
var _targetProduct$metada4;
|
|
1770
|
+
var product_id, product_variant_id, num, unique_identification_number, identity_key, product_option_item, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, normalizedProduct;
|
|
1771
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1772
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1773
|
+
case 0:
|
|
1774
|
+
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_option_item = params.product_option_item, product_bundle = params.product_bundle;
|
|
1775
|
+
tempOrder = this.ensureTempOrder();
|
|
1776
|
+
identityLookup = {
|
|
1777
|
+
product_id: product_id,
|
|
1778
|
+
product_variant_id: product_variant_id
|
|
1779
|
+
};
|
|
1780
|
+
if (unique_identification_number !== undefined) {
|
|
1781
|
+
identityLookup.unique_identification_number = unique_identification_number;
|
|
1782
|
+
if (identity_key === undefined) {
|
|
1783
|
+
identityLookup.identity_key = unique_identification_number;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
if (identity_key !== undefined) identityLookup.identity_key = identity_key;
|
|
1787
|
+
if (product_option_item !== undefined) identityLookup.product_option_item = product_option_item;
|
|
1788
|
+
if (product_bundle !== undefined) identityLookup.product_bundle = product_bundle;
|
|
1789
|
+
productIndex = -1;
|
|
1790
|
+
if (unique_identification_number !== undefined) {
|
|
1791
|
+
targetUid = String(unique_identification_number);
|
|
1792
|
+
productIndex = tempOrder.products.findIndex(function (item) {
|
|
1793
|
+
var _item$metadata2;
|
|
1794
|
+
return String(((_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.unique_identification_number) || item.unique_identification_number || '') === targetUid;
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
if (productIndex === -1) {
|
|
1798
|
+
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
1799
|
+
}
|
|
1800
|
+
if (!(productIndex === -1)) {
|
|
1801
|
+
_context17.next = 12;
|
|
1802
|
+
break;
|
|
1803
|
+
}
|
|
1804
|
+
throw new Error('[Order] 目标商品不存在,无法更新数量');
|
|
1805
|
+
case 12:
|
|
1806
|
+
targetProduct = tempOrder.products[productIndex];
|
|
1807
|
+
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
|
|
1808
|
+
num: getSafeProductNum(num),
|
|
1809
|
+
metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
|
|
1810
|
+
unique_identification_number: ((_targetProduct$metada4 = targetProduct.metadata) === null || _targetProduct$metada4 === void 0 ? void 0 : _targetProduct$metada4.unique_identification_number) || unique_identification_number
|
|
1811
|
+
})
|
|
1812
|
+
}));
|
|
1813
|
+
tempOrder.products[productIndex] = normalizedProduct;
|
|
1814
|
+
this.applyDiscount();
|
|
1815
|
+
_context17.next = 18;
|
|
1816
|
+
return this.recalculateSummary({
|
|
1817
|
+
createIfMissing: true
|
|
1818
|
+
});
|
|
1819
|
+
case 18:
|
|
1820
|
+
this.persistTempOrder();
|
|
1821
|
+
return _context17.abrupt("return", tempOrder.products);
|
|
1822
|
+
case 20:
|
|
1823
|
+
case "end":
|
|
1824
|
+
return _context17.stop();
|
|
1825
|
+
}
|
|
1826
|
+
}, _callee17, this);
|
|
1827
|
+
}));
|
|
1828
|
+
function updateOrderProductQuantity(_x19) {
|
|
1829
|
+
return _updateOrderProductQuantity.apply(this, arguments);
|
|
1830
|
+
}
|
|
1831
|
+
return updateOrderProductQuantity;
|
|
1832
|
+
}()
|
|
1745
1833
|
}, {
|
|
1746
1834
|
key: "updateOrderBooking",
|
|
1747
1835
|
value: function updateOrderBooking(params) {
|
|
@@ -1768,10 +1856,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1768
1856
|
}, {
|
|
1769
1857
|
key: "removeProductFromOrder",
|
|
1770
1858
|
value: function () {
|
|
1771
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1859
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity) {
|
|
1772
1860
|
var tempOrder, removedProducts, _i, _removedProducts, product;
|
|
1773
|
-
return _regeneratorRuntime().wrap(function
|
|
1774
|
-
while (1) switch (
|
|
1861
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1862
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1775
1863
|
case 0:
|
|
1776
1864
|
tempOrder = this.ensureTempOrder();
|
|
1777
1865
|
removedProducts = [];
|
|
@@ -1785,23 +1873,63 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1785
1873
|
this.removeLinkedBookingsForProduct(tempOrder, product);
|
|
1786
1874
|
}
|
|
1787
1875
|
this.applyDiscount();
|
|
1788
|
-
|
|
1876
|
+
_context18.next = 7;
|
|
1789
1877
|
return this.recalculateSummary({
|
|
1790
1878
|
createIfMissing: true
|
|
1791
1879
|
});
|
|
1792
1880
|
case 7:
|
|
1793
1881
|
this.persistTempOrder();
|
|
1794
|
-
return
|
|
1882
|
+
return _context18.abrupt("return", tempOrder.products);
|
|
1795
1883
|
case 9:
|
|
1796
1884
|
case "end":
|
|
1797
|
-
return
|
|
1885
|
+
return _context18.stop();
|
|
1798
1886
|
}
|
|
1799
|
-
},
|
|
1887
|
+
}, _callee18, this);
|
|
1800
1888
|
}));
|
|
1801
|
-
function removeProductFromOrder(
|
|
1889
|
+
function removeProductFromOrder(_x20) {
|
|
1802
1890
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1803
1891
|
}
|
|
1804
1892
|
return removeProductFromOrder;
|
|
1893
|
+
}()
|
|
1894
|
+
/**
|
|
1895
|
+
* 仅清空购物车行(products / bookings / discount_list),不重置整单。
|
|
1896
|
+
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
1897
|
+
*/
|
|
1898
|
+
}, {
|
|
1899
|
+
key: "clearOrderCartLines",
|
|
1900
|
+
value: (function () {
|
|
1901
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1902
|
+
var tempOrder;
|
|
1903
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1904
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1905
|
+
case 0:
|
|
1906
|
+
tempOrder = this.ensureTempOrder();
|
|
1907
|
+
tempOrder.products = [];
|
|
1908
|
+
tempOrder.bookings = [];
|
|
1909
|
+
tempOrder.discount_list = [];
|
|
1910
|
+
if (tempOrder._extend && _typeof(tempOrder._extend) === 'object') {
|
|
1911
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend), {}, {
|
|
1912
|
+
productsByUid: {}
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
this.applyDiscount();
|
|
1916
|
+
_context19.next = 8;
|
|
1917
|
+
return this.recalculateSummary({
|
|
1918
|
+
createIfMissing: true
|
|
1919
|
+
});
|
|
1920
|
+
case 8:
|
|
1921
|
+
this.persistTempOrder();
|
|
1922
|
+
return _context19.abrupt("return", tempOrder);
|
|
1923
|
+
case 10:
|
|
1924
|
+
case "end":
|
|
1925
|
+
return _context19.stop();
|
|
1926
|
+
}
|
|
1927
|
+
}, _callee19, this);
|
|
1928
|
+
}));
|
|
1929
|
+
function clearOrderCartLines() {
|
|
1930
|
+
return _clearOrderCartLines.apply(this, arguments);
|
|
1931
|
+
}
|
|
1932
|
+
return clearOrderCartLines;
|
|
1805
1933
|
}() // ─── TempOrder: 提交 ───
|
|
1806
1934
|
/**
|
|
1807
1935
|
* 提交当前 Sales tempOrder。
|
|
@@ -1809,14 +1937,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1809
1937
|
* smallTicketDataFlag 用于 B 端 checkout 小票数据返回。PaymentModal 在支付提交时
|
|
1810
1938
|
* 应传 1,确保 /order/sales/checkout 返回打印所需数据。
|
|
1811
1939
|
*/
|
|
1940
|
+
)
|
|
1812
1941
|
}, {
|
|
1813
1942
|
key: "submitTempOrder",
|
|
1814
1943
|
value: function () {
|
|
1815
|
-
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1944
|
+
var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1816
1945
|
var _params$cacheId, _this$otherParams;
|
|
1817
1946
|
var tempOrder, effectiveCacheId, hasPaymentOverride, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
1818
|
-
return _regeneratorRuntime().wrap(function
|
|
1819
|
-
while (1) switch (
|
|
1947
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1948
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1820
1949
|
case 0:
|
|
1821
1950
|
tempOrder = this.ensureTempOrder();
|
|
1822
1951
|
this.persistTempOrder();
|
|
@@ -1843,10 +1972,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1843
1972
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
1844
1973
|
enhance: enhancePayload
|
|
1845
1974
|
});
|
|
1846
|
-
|
|
1975
|
+
_context20.next = 10;
|
|
1847
1976
|
return this.saveDraft();
|
|
1848
1977
|
case 10:
|
|
1849
|
-
|
|
1978
|
+
_context20.prev = 10;
|
|
1850
1979
|
this.logInfo('submitTempOrder calling sales checkout', {
|
|
1851
1980
|
orderId: payload.order_id,
|
|
1852
1981
|
externalSaleNumber: payload.external_sale_number,
|
|
@@ -1854,62 +1983,62 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1854
1983
|
paymentsCount: ((_payload$payments = payload.payments) === null || _payload$payments === void 0 ? void 0 : _payload$payments.length) || 0,
|
|
1855
1984
|
smallTicketDataFlag: payload.small_ticket_data_flag
|
|
1856
1985
|
});
|
|
1857
|
-
|
|
1986
|
+
_context20.next = 14;
|
|
1858
1987
|
return this.submitSalesOrder({
|
|
1859
1988
|
query: payload
|
|
1860
1989
|
});
|
|
1861
1990
|
case 14:
|
|
1862
|
-
result =
|
|
1863
|
-
|
|
1991
|
+
result = _context20.sent;
|
|
1992
|
+
_context20.next = 27;
|
|
1864
1993
|
break;
|
|
1865
1994
|
case 17:
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
backendErrorResponse = this.extractSubmitErrorResponse(
|
|
1995
|
+
_context20.prev = 17;
|
|
1996
|
+
_context20.t0 = _context20["catch"](10);
|
|
1997
|
+
backendErrorResponse = this.extractSubmitErrorResponse(_context20.t0);
|
|
1869
1998
|
if (!backendErrorResponse) {
|
|
1870
|
-
|
|
1999
|
+
_context20.next = 24;
|
|
1871
2000
|
break;
|
|
1872
2001
|
}
|
|
1873
2002
|
this.store.syncState = 'failed';
|
|
1874
2003
|
this.logSubmitBackendRejected(backendErrorResponse, payload);
|
|
1875
|
-
return
|
|
2004
|
+
return _context20.abrupt("return", backendErrorResponse);
|
|
1876
2005
|
case 24:
|
|
1877
2006
|
this.store.syncState = 'failed';
|
|
1878
2007
|
this.logError('submitTempOrder failed', {
|
|
1879
|
-
error:
|
|
2008
|
+
error: _context20.t0 instanceof Error ? _context20.t0.message : String(_context20.t0),
|
|
1880
2009
|
orderId: payload.order_id,
|
|
1881
2010
|
externalSaleNumber: payload.external_sale_number,
|
|
1882
2011
|
paymentStatus: payload.payment_status,
|
|
1883
2012
|
paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
|
|
1884
2013
|
});
|
|
1885
|
-
throw
|
|
2014
|
+
throw _context20.t0;
|
|
1886
2015
|
case 27:
|
|
1887
2016
|
if (!this.isSubmitResponseRejected(result)) {
|
|
1888
|
-
|
|
2017
|
+
_context20.next = 31;
|
|
1889
2018
|
break;
|
|
1890
2019
|
}
|
|
1891
2020
|
this.store.syncState = 'failed';
|
|
1892
2021
|
this.logSubmitBackendRejected(result, payload);
|
|
1893
|
-
return
|
|
2022
|
+
return _context20.abrupt("return", result);
|
|
1894
2023
|
case 31:
|
|
1895
2024
|
submittedOrderId = this.extractOrderIdFromSubmitResult(result);
|
|
1896
2025
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
1897
|
-
|
|
2026
|
+
_context20.next = 37;
|
|
1898
2027
|
break;
|
|
1899
2028
|
}
|
|
1900
2029
|
tempOrder.order_id = submittedOrderId;
|
|
1901
2030
|
resultRecord = result;
|
|
1902
|
-
|
|
2031
|
+
_context20.next = 37;
|
|
1903
2032
|
return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
|
|
1904
2033
|
case 37:
|
|
1905
|
-
return
|
|
2034
|
+
return _context20.abrupt("return", result);
|
|
1906
2035
|
case 38:
|
|
1907
2036
|
case "end":
|
|
1908
|
-
return
|
|
2037
|
+
return _context20.stop();
|
|
1909
2038
|
}
|
|
1910
|
-
},
|
|
2039
|
+
}, _callee20, this, [[10, 17]]);
|
|
1911
2040
|
}));
|
|
1912
|
-
function submitTempOrder(
|
|
2041
|
+
function submitTempOrder(_x21) {
|
|
1913
2042
|
return _submitTempOrder.apply(this, arguments);
|
|
1914
2043
|
}
|
|
1915
2044
|
return submitTempOrder;
|
|
@@ -1917,25 +2046,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1917
2046
|
}, {
|
|
1918
2047
|
key: "markLocalOrderSynced",
|
|
1919
2048
|
value: function () {
|
|
1920
|
-
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2049
|
+
var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(orderId, remoteOrder) {
|
|
1921
2050
|
var tempOrder;
|
|
1922
|
-
return _regeneratorRuntime().wrap(function
|
|
1923
|
-
while (1) switch (
|
|
2051
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2052
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1924
2053
|
case 0:
|
|
1925
2054
|
tempOrder = this.ensureTempOrder();
|
|
1926
2055
|
tempOrder.order_id = orderId;
|
|
1927
2056
|
this.store.lastOrderInfo = remoteOrder;
|
|
1928
2057
|
this.store.syncState = 'submitted';
|
|
1929
2058
|
this.persistTempOrder();
|
|
1930
|
-
|
|
2059
|
+
_context21.next = 7;
|
|
1931
2060
|
return this.saveDraft();
|
|
1932
2061
|
case 7:
|
|
1933
2062
|
case "end":
|
|
1934
|
-
return
|
|
2063
|
+
return _context21.stop();
|
|
1935
2064
|
}
|
|
1936
|
-
},
|
|
2065
|
+
}, _callee21, this);
|
|
1937
2066
|
}));
|
|
1938
|
-
function markLocalOrderSynced(
|
|
2067
|
+
function markLocalOrderSynced(_x22, _x23) {
|
|
1939
2068
|
return _markLocalOrderSynced.apply(this, arguments);
|
|
1940
2069
|
}
|
|
1941
2070
|
return markLocalOrderSynced;
|
|
@@ -1982,49 +2111,50 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1982
2111
|
}, {
|
|
1983
2112
|
key: "syncPaymentsToOrder",
|
|
1984
2113
|
value: function () {
|
|
1985
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2114
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1986
2115
|
var tempOrder, mappedPayments, paymentTotal, targetAmount, isFullyPaid, submitResult;
|
|
1987
|
-
return _regeneratorRuntime().wrap(function
|
|
1988
|
-
while (1) switch (
|
|
2116
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2117
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1989
2118
|
case 0:
|
|
1990
2119
|
tempOrder = this.ensureTempOrder();
|
|
1991
2120
|
mappedPayments = mapPaymentItemsToOrderPayments(params.payments || []);
|
|
1992
2121
|
tempOrder.payments = mappedPayments;
|
|
1993
2122
|
if (params.paymentStatus) tempOrder.payment_status = params.paymentStatus;
|
|
1994
2123
|
this.persistTempOrder();
|
|
1995
|
-
|
|
2124
|
+
_context22.next = 7;
|
|
1996
2125
|
return this.saveDraft();
|
|
1997
2126
|
case 7:
|
|
1998
2127
|
paymentTotal = this.calculatePaymentTotal(mappedPayments);
|
|
1999
2128
|
targetAmount = this.getPaymentTargetAmount();
|
|
2000
2129
|
isFullyPaid = targetAmount.lte(0) ? false : paymentTotal.gte(targetAmount);
|
|
2001
2130
|
if (!(!isFullyPaid || !params.submitWhenPaid)) {
|
|
2002
|
-
|
|
2131
|
+
_context22.next = 12;
|
|
2003
2132
|
break;
|
|
2004
2133
|
}
|
|
2005
|
-
return
|
|
2134
|
+
return _context22.abrupt("return", {
|
|
2006
2135
|
isFullyPaid: isFullyPaid
|
|
2007
2136
|
});
|
|
2008
2137
|
case 12:
|
|
2009
|
-
|
|
2138
|
+
_context22.next = 14;
|
|
2010
2139
|
return this.submitTempOrder({
|
|
2011
2140
|
payments: mappedPayments,
|
|
2012
2141
|
paymentStatus: params.paymentStatus || 'paid',
|
|
2013
|
-
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2142
|
+
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
2143
|
+
channel: params.channel
|
|
2014
2144
|
});
|
|
2015
2145
|
case 14:
|
|
2016
|
-
submitResult =
|
|
2017
|
-
return
|
|
2146
|
+
submitResult = _context22.sent;
|
|
2147
|
+
return _context22.abrupt("return", {
|
|
2018
2148
|
isFullyPaid: isFullyPaid,
|
|
2019
2149
|
submitResult: submitResult
|
|
2020
2150
|
});
|
|
2021
2151
|
case 16:
|
|
2022
2152
|
case "end":
|
|
2023
|
-
return
|
|
2153
|
+
return _context22.stop();
|
|
2024
2154
|
}
|
|
2025
|
-
},
|
|
2155
|
+
}, _callee22, this);
|
|
2026
2156
|
}));
|
|
2027
|
-
function syncPaymentsToOrder(
|
|
2157
|
+
function syncPaymentsToOrder(_x24) {
|
|
2028
2158
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2029
2159
|
}
|
|
2030
2160
|
return syncPaymentsToOrder;
|
|
@@ -2113,11 +2243,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2113
2243
|
}, {
|
|
2114
2244
|
key: "submitOrder",
|
|
2115
2245
|
value: function () {
|
|
2116
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2246
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(order) {
|
|
2117
2247
|
var _order$query$cartItem, _params$bookings, _params$relation_prod;
|
|
2118
2248
|
var url, query, fetchUrl, params;
|
|
2119
|
-
return _regeneratorRuntime().wrap(function
|
|
2120
|
-
while (1) switch (
|
|
2249
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2250
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2121
2251
|
case 0:
|
|
2122
2252
|
this.logInfo('submitOrder called', {
|
|
2123
2253
|
url: order.url,
|
|
@@ -2137,14 +2267,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2137
2267
|
relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
|
|
2138
2268
|
scheduleDate: params.schedule_date
|
|
2139
2269
|
});
|
|
2140
|
-
return
|
|
2270
|
+
return _context23.abrupt("return", this.request.post(fetchUrl, params));
|
|
2141
2271
|
case 6:
|
|
2142
2272
|
case "end":
|
|
2143
|
-
return
|
|
2273
|
+
return _context23.stop();
|
|
2144
2274
|
}
|
|
2145
|
-
},
|
|
2275
|
+
}, _callee23, this);
|
|
2146
2276
|
}));
|
|
2147
|
-
function submitOrder(
|
|
2277
|
+
function submitOrder(_x25) {
|
|
2148
2278
|
return _submitOrder.apply(this, arguments);
|
|
2149
2279
|
}
|
|
2150
2280
|
return submitOrder;
|
|
@@ -2152,13 +2282,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2152
2282
|
}, {
|
|
2153
2283
|
key: "cancelOrder",
|
|
2154
2284
|
value: function () {
|
|
2155
|
-
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2285
|
+
var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2156
2286
|
var payload;
|
|
2157
|
-
return _regeneratorRuntime().wrap(function
|
|
2158
|
-
while (1) switch (
|
|
2287
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2288
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2159
2289
|
case 0:
|
|
2160
2290
|
if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
|
|
2161
|
-
|
|
2291
|
+
_context24.next = 2;
|
|
2162
2292
|
break;
|
|
2163
2293
|
}
|
|
2164
2294
|
throw new Error('取消订单失败:order_ids 不能为空');
|
|
@@ -2174,16 +2304,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2174
2304
|
method: 'PUT',
|
|
2175
2305
|
orderIdsCount: params.order_ids.length
|
|
2176
2306
|
});
|
|
2177
|
-
return
|
|
2307
|
+
return _context24.abrupt("return", this.request.put('/order/update-status', payload, {
|
|
2178
2308
|
isShopApi: true
|
|
2179
2309
|
}));
|
|
2180
2310
|
case 5:
|
|
2181
2311
|
case "end":
|
|
2182
|
-
return
|
|
2312
|
+
return _context24.stop();
|
|
2183
2313
|
}
|
|
2184
|
-
},
|
|
2314
|
+
}, _callee24, this);
|
|
2185
2315
|
}));
|
|
2186
|
-
function cancelOrder(
|
|
2316
|
+
function cancelOrder(_x26) {
|
|
2187
2317
|
return _cancelOrder.apply(this, arguments);
|
|
2188
2318
|
}
|
|
2189
2319
|
return cancelOrder;
|
|
@@ -2191,19 +2321,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2191
2321
|
}, {
|
|
2192
2322
|
key: "changeBookingStatus",
|
|
2193
2323
|
value: function () {
|
|
2194
|
-
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2324
|
+
var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2195
2325
|
var url, payload;
|
|
2196
|
-
return _regeneratorRuntime().wrap(function
|
|
2197
|
-
while (1) switch (
|
|
2326
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2327
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2198
2328
|
case 0:
|
|
2199
2329
|
if (params.booking_id) {
|
|
2200
|
-
|
|
2330
|
+
_context25.next = 2;
|
|
2201
2331
|
break;
|
|
2202
2332
|
}
|
|
2203
2333
|
throw new Error('变更预约状态失败:booking_id 不能为空');
|
|
2204
2334
|
case 2:
|
|
2205
2335
|
if (params.appointment_status) {
|
|
2206
|
-
|
|
2336
|
+
_context25.next = 4;
|
|
2207
2337
|
break;
|
|
2208
2338
|
}
|
|
2209
2339
|
throw new Error('变更预约状态失败:appointment_status 不能为空');
|
|
@@ -2218,16 +2348,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2218
2348
|
bookingId: params.booking_id,
|
|
2219
2349
|
appointmentStatus: params.appointment_status
|
|
2220
2350
|
});
|
|
2221
|
-
return
|
|
2351
|
+
return _context25.abrupt("return", this.request.put(url, payload, {
|
|
2222
2352
|
isShopApi: true
|
|
2223
2353
|
}));
|
|
2224
2354
|
case 8:
|
|
2225
2355
|
case "end":
|
|
2226
|
-
return
|
|
2356
|
+
return _context25.stop();
|
|
2227
2357
|
}
|
|
2228
|
-
},
|
|
2358
|
+
}, _callee25, this);
|
|
2229
2359
|
}));
|
|
2230
|
-
function changeBookingStatus(
|
|
2360
|
+
function changeBookingStatus(_x27) {
|
|
2231
2361
|
return _changeBookingStatus.apply(this, arguments);
|
|
2232
2362
|
}
|
|
2233
2363
|
return changeBookingStatus;
|
|
@@ -2245,11 +2375,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2245
2375
|
}, {
|
|
2246
2376
|
key: "createOrderByCheckout",
|
|
2247
2377
|
value: (function () {
|
|
2248
|
-
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2378
|
+
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2249
2379
|
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
2250
2380
|
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;
|
|
2251
|
-
return _regeneratorRuntime().wrap(function
|
|
2252
|
-
while (1) switch (
|
|
2381
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2382
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2253
2383
|
case 0:
|
|
2254
2384
|
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
2255
2385
|
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
@@ -2283,7 +2413,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2283
2413
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
2284
2414
|
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
2285
2415
|
});
|
|
2286
|
-
|
|
2416
|
+
_context26.prev = 4;
|
|
2287
2417
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
2288
2418
|
orderData = _objectSpread({
|
|
2289
2419
|
sales_channel: 'my_pisel',
|
|
@@ -2347,10 +2477,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2347
2477
|
});
|
|
2348
2478
|
|
|
2349
2479
|
// 调用后端接口
|
|
2350
|
-
|
|
2480
|
+
_context26.next = 12;
|
|
2351
2481
|
return this.request.post('/order/checkout', orderData);
|
|
2352
2482
|
case 12:
|
|
2353
|
-
response =
|
|
2483
|
+
response = _context26.sent;
|
|
2354
2484
|
this.logInfo('Order API called successfully', {
|
|
2355
2485
|
response: response
|
|
2356
2486
|
});
|
|
@@ -2358,22 +2488,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2358
2488
|
success: !!response,
|
|
2359
2489
|
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)
|
|
2360
2490
|
});
|
|
2361
|
-
return
|
|
2491
|
+
return _context26.abrupt("return", response);
|
|
2362
2492
|
case 18:
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
console.error('[Order] createOrderByCheckout 创建订单失败:',
|
|
2493
|
+
_context26.prev = 18;
|
|
2494
|
+
_context26.t0 = _context26["catch"](4);
|
|
2495
|
+
console.error('[Order] createOrderByCheckout 创建订单失败:', _context26.t0);
|
|
2366
2496
|
this.logInfo('Order API called failed', {
|
|
2367
|
-
error:
|
|
2497
|
+
error: _context26.t0 instanceof Error ? _context26.t0.message : String(_context26.t0)
|
|
2368
2498
|
});
|
|
2369
|
-
throw
|
|
2499
|
+
throw _context26.t0;
|
|
2370
2500
|
case 23:
|
|
2371
2501
|
case "end":
|
|
2372
|
-
return
|
|
2502
|
+
return _context26.stop();
|
|
2373
2503
|
}
|
|
2374
|
-
},
|
|
2504
|
+
}, _callee26, this, [[4, 18]]);
|
|
2375
2505
|
}));
|
|
2376
|
-
function createOrderByCheckout(
|
|
2506
|
+
function createOrderByCheckout(_x28) {
|
|
2377
2507
|
return _createOrderByCheckout.apply(this, arguments);
|
|
2378
2508
|
}
|
|
2379
2509
|
return createOrderByCheckout;
|
|
@@ -2381,23 +2511,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2381
2511
|
}, {
|
|
2382
2512
|
key: "submitSalesOrder",
|
|
2383
2513
|
value: function () {
|
|
2384
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2514
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2385
2515
|
var url, query, fetchUrl;
|
|
2386
|
-
return _regeneratorRuntime().wrap(function
|
|
2387
|
-
while (1) switch (
|
|
2516
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2517
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2388
2518
|
case 0:
|
|
2389
2519
|
url = params.url, query = params.query;
|
|
2390
2520
|
fetchUrl = url || '/order/sales/checkout';
|
|
2391
|
-
return
|
|
2521
|
+
return _context27.abrupt("return", this.request.post(fetchUrl, query, {
|
|
2392
2522
|
customToast: function customToast() {}
|
|
2393
2523
|
}));
|
|
2394
2524
|
case 3:
|
|
2395
2525
|
case "end":
|
|
2396
|
-
return
|
|
2526
|
+
return _context27.stop();
|
|
2397
2527
|
}
|
|
2398
|
-
},
|
|
2528
|
+
}, _callee27, this);
|
|
2399
2529
|
}));
|
|
2400
|
-
function submitSalesOrder(
|
|
2530
|
+
function submitSalesOrder(_x29) {
|
|
2401
2531
|
return _submitSalesOrder.apply(this, arguments);
|
|
2402
2532
|
}
|
|
2403
2533
|
return submitSalesOrder;
|
|
@@ -2411,37 +2541,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2411
2541
|
}, {
|
|
2412
2542
|
key: "sendCustomerPayLink",
|
|
2413
2543
|
value: (function () {
|
|
2414
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2544
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2415
2545
|
var _params$emails;
|
|
2416
2546
|
var orderIds;
|
|
2417
|
-
return _regeneratorRuntime().wrap(function
|
|
2418
|
-
while (1) switch (
|
|
2547
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2548
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2419
2549
|
case 0:
|
|
2420
2550
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2421
2551
|
if (orderIds.length) {
|
|
2422
|
-
|
|
2552
|
+
_context28.next = 3;
|
|
2423
2553
|
break;
|
|
2424
2554
|
}
|
|
2425
2555
|
throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
|
|
2426
2556
|
case 3:
|
|
2427
2557
|
if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
|
|
2428
|
-
|
|
2558
|
+
_context28.next = 5;
|
|
2429
2559
|
break;
|
|
2430
2560
|
}
|
|
2431
2561
|
throw new Error('发送支付链接需要至少一个邮箱');
|
|
2432
2562
|
case 5:
|
|
2433
|
-
return
|
|
2563
|
+
return _context28.abrupt("return", this.request.post('/order/batch-email', {
|
|
2434
2564
|
order_ids: orderIds,
|
|
2435
2565
|
notify_action: params.notify_action || 'order_payment_reminder',
|
|
2436
2566
|
emails: params.emails
|
|
2437
2567
|
}));
|
|
2438
2568
|
case 6:
|
|
2439
2569
|
case "end":
|
|
2440
|
-
return
|
|
2570
|
+
return _context28.stop();
|
|
2441
2571
|
}
|
|
2442
|
-
},
|
|
2572
|
+
}, _callee28, this);
|
|
2443
2573
|
}));
|
|
2444
|
-
function sendCustomerPayLink(
|
|
2574
|
+
function sendCustomerPayLink(_x30) {
|
|
2445
2575
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2446
2576
|
}
|
|
2447
2577
|
return sendCustomerPayLink;
|
|
@@ -2450,28 +2580,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2580
|
}, {
|
|
2451
2581
|
key: "getOrderInfoByRemote",
|
|
2452
2582
|
value: function () {
|
|
2453
|
-
var _getOrderInfoByRemote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2583
|
+
var _getOrderInfoByRemote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(order_id) {
|
|
2454
2584
|
var res;
|
|
2455
|
-
return _regeneratorRuntime().wrap(function
|
|
2456
|
-
while (1) switch (
|
|
2585
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2586
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2457
2587
|
case 0:
|
|
2458
|
-
|
|
2588
|
+
_context29.next = 2;
|
|
2459
2589
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
2460
2590
|
with: ['products', 'bookings', 'payments', 'customer', 'summary', 'contacts_info']
|
|
2461
2591
|
});
|
|
2462
2592
|
case 2:
|
|
2463
|
-
res =
|
|
2593
|
+
res = _context29.sent;
|
|
2464
2594
|
if (res.code === 200) {
|
|
2465
2595
|
this.store.lastOrderInfo = res.data;
|
|
2466
2596
|
}
|
|
2467
|
-
return
|
|
2597
|
+
return _context29.abrupt("return", res);
|
|
2468
2598
|
case 5:
|
|
2469
2599
|
case "end":
|
|
2470
|
-
return
|
|
2600
|
+
return _context29.stop();
|
|
2471
2601
|
}
|
|
2472
|
-
},
|
|
2602
|
+
}, _callee29, this);
|
|
2473
2603
|
}));
|
|
2474
|
-
function getOrderInfoByRemote(
|
|
2604
|
+
function getOrderInfoByRemote(_x31) {
|
|
2475
2605
|
return _getOrderInfoByRemote.apply(this, arguments);
|
|
2476
2606
|
}
|
|
2477
2607
|
return getOrderInfoByRemote;
|
|
@@ -2485,10 +2615,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2485
2615
|
}, {
|
|
2486
2616
|
key: "hydrateTempOrderFromRecord",
|
|
2487
2617
|
value: (function () {
|
|
2488
|
-
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2618
|
+
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(record, options) {
|
|
2489
2619
|
var raw, nextTempOrder;
|
|
2490
|
-
return _regeneratorRuntime().wrap(function
|
|
2491
|
-
while (1) switch (
|
|
2620
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2621
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2492
2622
|
case 0:
|
|
2493
2623
|
raw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
2494
2624
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
@@ -2498,23 +2628,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2498
2628
|
this.store.summary = raw.summary && _typeof(raw.summary) === 'object' ? _objectSpread(_objectSpread({}, createEmptySummary()), raw.summary) : createEmptySummary();
|
|
2499
2629
|
this.store.lastOrderInfo = raw.lastOrderInfo || raw;
|
|
2500
2630
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
2501
|
-
|
|
2631
|
+
_context30.next = 8;
|
|
2502
2632
|
break;
|
|
2503
2633
|
}
|
|
2504
|
-
|
|
2634
|
+
_context30.next = 8;
|
|
2505
2635
|
return this.recalculateSummary({
|
|
2506
2636
|
createIfMissing: false
|
|
2507
2637
|
});
|
|
2508
2638
|
case 8:
|
|
2509
2639
|
this.persistTempOrder();
|
|
2510
|
-
return
|
|
2640
|
+
return _context30.abrupt("return", nextTempOrder);
|
|
2511
2641
|
case 10:
|
|
2512
2642
|
case "end":
|
|
2513
|
-
return
|
|
2643
|
+
return _context30.stop();
|
|
2514
2644
|
}
|
|
2515
|
-
},
|
|
2645
|
+
}, _callee30, this);
|
|
2516
2646
|
}));
|
|
2517
|
-
function hydrateTempOrderFromRecord(
|
|
2647
|
+
function hydrateTempOrderFromRecord(_x32, _x33) {
|
|
2518
2648
|
return _hydrateTempOrderFromRecord.apply(this, arguments);
|
|
2519
2649
|
}
|
|
2520
2650
|
return hydrateTempOrderFromRecord;
|
|
@@ -2593,25 +2723,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2593
2723
|
}, {
|
|
2594
2724
|
key: "getOrderInfo",
|
|
2595
2725
|
value: function () {
|
|
2596
|
-
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2726
|
+
var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(order_id) {
|
|
2597
2727
|
var res;
|
|
2598
|
-
return _regeneratorRuntime().wrap(function
|
|
2599
|
-
while (1) switch (
|
|
2728
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2729
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2600
2730
|
case 0:
|
|
2601
|
-
|
|
2731
|
+
_context31.next = 2;
|
|
2602
2732
|
return this.request.get("/order/sales/".concat(order_id), {
|
|
2603
2733
|
with: ['products', 'bookings']
|
|
2604
2734
|
});
|
|
2605
2735
|
case 2:
|
|
2606
|
-
res =
|
|
2607
|
-
return
|
|
2736
|
+
res = _context31.sent;
|
|
2737
|
+
return _context31.abrupt("return", res);
|
|
2608
2738
|
case 4:
|
|
2609
2739
|
case "end":
|
|
2610
|
-
return
|
|
2740
|
+
return _context31.stop();
|
|
2611
2741
|
}
|
|
2612
|
-
},
|
|
2742
|
+
}, _callee31, this);
|
|
2613
2743
|
}));
|
|
2614
|
-
function getOrderInfo(
|
|
2744
|
+
function getOrderInfo(_x34) {
|
|
2615
2745
|
return _getOrderInfo.apply(this, arguments);
|
|
2616
2746
|
}
|
|
2617
2747
|
return getOrderInfo;
|