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