@pisell/pisellos 0.10.66 → 0.10.68
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/solution/BaseSales/index.js +14 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +24 -1
- package/dist/solution/BookingTicket/index.js +509 -256
- package/dist/solution/UnifiedBookingSales/index.js +1 -1
- package/lib/solution/BaseSales/index.js +3 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +24 -1
- package/lib/solution/BookingTicket/index.js +115 -0
- package/lib/solution/UnifiedBookingSales/index.js +1 -1
- package/package.json +1 -1
|
@@ -51,7 +51,8 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
|
|
|
51
51
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
52
52
|
import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
|
|
53
53
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
54
|
-
import { extractCustomerContactInfo } from "../../modules/OpenData/contactInfo";
|
|
54
|
+
import { extractCustomerContactInfo, isContactRecord } from "../../modules/OpenData/contactInfo";
|
|
55
|
+
import { isCustomerUserPlatform } from "../../utils/platform";
|
|
55
56
|
import { cloneDeep } from 'lodash-es';
|
|
56
57
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
|
|
57
58
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
@@ -184,6 +185,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
184
185
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
185
186
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
186
187
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
188
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerContactRequest", null);
|
|
187
189
|
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
188
190
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
189
191
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
@@ -1773,9 +1775,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1773
1775
|
this.hasManualDiscountSelection = false;
|
|
1774
1776
|
}
|
|
1775
1777
|
if (!customerUnchanged && (options === null || options === void 0 ? void 0 : options.source) !== 'detailHydrate') {
|
|
1778
|
+
this.resetOrderCustomerContactInfo();
|
|
1776
1779
|
this.store.order.updateTempOrderContactsInfo(cloneDeep(extractCustomerContactInfo(customer)));
|
|
1777
1780
|
}
|
|
1778
1781
|
this.store.order.setOrderCustomer(patch, customer);
|
|
1782
|
+
if ((options === null || options === void 0 ? void 0 : options.source) === 'detailHydrate') {
|
|
1783
|
+
this.orderCustomerContactRequest = null;
|
|
1784
|
+
} else {
|
|
1785
|
+
this.prefillOrderCustomerContactInfo(customer, !customerUnchanged);
|
|
1786
|
+
}
|
|
1779
1787
|
var snapshotAfterOrderSet = this.store.order.getOrderCustomerSnapshot();
|
|
1780
1788
|
if (customerUnchanged) {
|
|
1781
1789
|
// hydrate 后 customer_id 已存在但 _extend.customerSnapshot 仍为空时,
|
|
@@ -1808,7 +1816,242 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1808
1816
|
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1809
1817
|
});
|
|
1810
1818
|
}
|
|
1819
|
+
}, {
|
|
1820
|
+
key: "resetOrderCustomerContactInfo",
|
|
1821
|
+
value: function resetOrderCustomerContactInfo() {
|
|
1822
|
+
this.orderCustomerContactRequest = null;
|
|
1823
|
+
var order = this.getTempOrder();
|
|
1824
|
+
if (order !== null && order !== void 0 && order._extend) delete order._extend.contactInfoEdited;
|
|
1825
|
+
}
|
|
1811
1826
|
|
|
1827
|
+
/** Explicit edits, including clearing the contact, must win over a pending default. */
|
|
1828
|
+
}, {
|
|
1829
|
+
key: "updateTempOrderContactsInfo",
|
|
1830
|
+
value: function updateTempOrderContactsInfo(contact) {
|
|
1831
|
+
var order = this.store.order.ensureTempOrder();
|
|
1832
|
+
order._extend || (order._extend = {});
|
|
1833
|
+
order._extend.contactInfoEdited = true;
|
|
1834
|
+
this.orderCustomerContactRequest = null;
|
|
1835
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "updateTempOrderContactsInfo", this).call(this, contact);
|
|
1836
|
+
}
|
|
1837
|
+
}, {
|
|
1838
|
+
key: "getCustomerContactScope",
|
|
1839
|
+
value: function getCustomerContactScope() {
|
|
1840
|
+
var _this$otherParams5, _this$otherParams6, _this$otherParams7;
|
|
1841
|
+
return JSON.stringify([this.getPickupTimingScope(), (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.channel, (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.shop_id, (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.tenantId]);
|
|
1842
|
+
}
|
|
1843
|
+
}, {
|
|
1844
|
+
key: "getCustomerContactOrderKey",
|
|
1845
|
+
value: function getCustomerContactOrderKey() {
|
|
1846
|
+
var _order$_extend;
|
|
1847
|
+
var order = this.getTempOrder();
|
|
1848
|
+
// Cart mutations can replace the object without changing the order.
|
|
1849
|
+
var identity = (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.request_unique_idempotency_token) || (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.order_id);
|
|
1850
|
+
return identity ? JSON.stringify([identity, order === null || order === void 0 ? void 0 : order.order_id]) : order;
|
|
1851
|
+
}
|
|
1852
|
+
}, {
|
|
1853
|
+
key: "replaceTempOrder",
|
|
1854
|
+
value: function () {
|
|
1855
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1856
|
+
var _get2;
|
|
1857
|
+
var _len2,
|
|
1858
|
+
args,
|
|
1859
|
+
_key2,
|
|
1860
|
+
_args25 = arguments;
|
|
1861
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1862
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1863
|
+
case 0:
|
|
1864
|
+
this.orderCustomerContactRequest = null;
|
|
1865
|
+
for (_len2 = _args25.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1866
|
+
args[_key2] = _args25[_key2];
|
|
1867
|
+
}
|
|
1868
|
+
return _context25.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
|
|
1869
|
+
case 3:
|
|
1870
|
+
case "end":
|
|
1871
|
+
return _context25.stop();
|
|
1872
|
+
}
|
|
1873
|
+
}, _callee25, this);
|
|
1874
|
+
}));
|
|
1875
|
+
function replaceTempOrder() {
|
|
1876
|
+
return _replaceTempOrder.apply(this, arguments);
|
|
1877
|
+
}
|
|
1878
|
+
return replaceTempOrder;
|
|
1879
|
+
}()
|
|
1880
|
+
}, {
|
|
1881
|
+
key: "applyDefaultOrderCustomerContactInfo",
|
|
1882
|
+
value: function () {
|
|
1883
|
+
var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(contact) {
|
|
1884
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1885
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1886
|
+
case 0:
|
|
1887
|
+
this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
|
|
1888
|
+
// Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
|
|
1889
|
+
_context26.next = 3;
|
|
1890
|
+
return this.effectsEmit('onTempOrderReplaced', {
|
|
1891
|
+
tempOrder: this.getTempOrder()
|
|
1892
|
+
});
|
|
1893
|
+
case 3:
|
|
1894
|
+
case "end":
|
|
1895
|
+
return _context26.stop();
|
|
1896
|
+
}
|
|
1897
|
+
}, _callee26, this);
|
|
1898
|
+
}));
|
|
1899
|
+
function applyDefaultOrderCustomerContactInfo(_x17) {
|
|
1900
|
+
return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
|
|
1901
|
+
}
|
|
1902
|
+
return applyDefaultOrderCustomerContactInfo;
|
|
1903
|
+
}()
|
|
1904
|
+
}, {
|
|
1905
|
+
key: "prefillOrderCustomerContactInfo",
|
|
1906
|
+
value: function prefillOrderCustomerContactInfo(customer, customerChanged) {
|
|
1907
|
+
var _order$_extend2,
|
|
1908
|
+
_this$otherParams8,
|
|
1909
|
+
_this4 = this;
|
|
1910
|
+
var order = this.getTempOrder();
|
|
1911
|
+
var customerId = Number(order === null || order === void 0 ? void 0 : order.customer_id);
|
|
1912
|
+
if (!order || !Number.isInteger(customerId) || customerId <= 1 || order.contacts_info != null || (_order$_extend2 = order._extend) !== null && _order$_extend2 !== void 0 && _order$_extend2.contactInfoEdited) return;
|
|
1913
|
+
// A restored new cart may already have its customer ID. Existing sales keep their snapshot,
|
|
1914
|
+
// even when it is empty; only an explicit customer switch replaces it.
|
|
1915
|
+
if (!customerChanged && order.order_id && !String(order.order_id).startsWith('local_order')) return;
|
|
1916
|
+
var contact = extractCustomerContactInfo(customer);
|
|
1917
|
+
if (contact) {
|
|
1918
|
+
this.orderCustomerContactRequest = null;
|
|
1919
|
+
void this.applyDefaultOrderCustomerContactInfo(contact);
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
// A relation explicitly returned as null is authoritative. Only a missing relation needs fetching.
|
|
1923
|
+
if (customer.contacts_info !== undefined) return;
|
|
1924
|
+
var userPlatform = isCustomerUserPlatform((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform);
|
|
1925
|
+
var getAuthenticatedCustomerId = function getAuthenticatedCustomerId() {
|
|
1926
|
+
var _this4$core, _this4$core$getPlugin, _this4$core$getPlugin2;
|
|
1927
|
+
return Number((_this4$core = _this4.core) === null || _this4$core === void 0 || (_this4$core$getPlugin = _this4$core.getPlugin) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin = _this4$core$getPlugin.call(_this4$core, 'user')) === null || _this4$core$getPlugin === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin.get) === null || _this4$core$getPlugin2 === void 0 || (_this4$core$getPlugin2 = _this4$core$getPlugin2.call(_this4$core$getPlugin)) === null || _this4$core$getPlugin2 === void 0 ? void 0 : _this4$core$getPlugin2.id);
|
|
1928
|
+
};
|
|
1929
|
+
if (userPlatform && getAuthenticatedCustomerId() !== customerId) return;
|
|
1930
|
+
var scope = this.getCustomerContactScope();
|
|
1931
|
+
var orderKey = this.getCustomerContactOrderKey();
|
|
1932
|
+
var previous = this.orderCustomerContactRequest;
|
|
1933
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.orderKey) === orderKey && previous.customerId === customerId && previous.scope === scope) return;
|
|
1934
|
+
var pending = {
|
|
1935
|
+
orderKey: orderKey,
|
|
1936
|
+
customerId: customerId,
|
|
1937
|
+
scope: scope,
|
|
1938
|
+
promise: Promise.resolve()
|
|
1939
|
+
};
|
|
1940
|
+
this.orderCustomerContactRequest = pending;
|
|
1941
|
+
var loadContact = /*#__PURE__*/function () {
|
|
1942
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1943
|
+
var _result4, resolved;
|
|
1944
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
1945
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1946
|
+
case 0:
|
|
1947
|
+
if (!userPlatform) {
|
|
1948
|
+
_context27.next = 7;
|
|
1949
|
+
break;
|
|
1950
|
+
}
|
|
1951
|
+
_context27.next = 3;
|
|
1952
|
+
return _this4.request.get('/customer/metadata', {
|
|
1953
|
+
key: 'contacts_info'
|
|
1954
|
+
});
|
|
1955
|
+
case 3:
|
|
1956
|
+
_result4 = _context27.sent;
|
|
1957
|
+
if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
|
|
1958
|
+
_context27.next = 6;
|
|
1959
|
+
break;
|
|
1960
|
+
}
|
|
1961
|
+
throw new Error('Customer contact lookup failed');
|
|
1962
|
+
case 6:
|
|
1963
|
+
return _context27.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
|
|
1964
|
+
case 7:
|
|
1965
|
+
_context27.next = 9;
|
|
1966
|
+
return _this4.resolveCustomerById(customerId);
|
|
1967
|
+
case 9:
|
|
1968
|
+
resolved = _context27.sent;
|
|
1969
|
+
return _context27.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
|
|
1970
|
+
case 11:
|
|
1971
|
+
case "end":
|
|
1972
|
+
return _context27.stop();
|
|
1973
|
+
}
|
|
1974
|
+
}, _callee27);
|
|
1975
|
+
}));
|
|
1976
|
+
return function loadContact() {
|
|
1977
|
+
return _ref11.apply(this, arguments);
|
|
1978
|
+
};
|
|
1979
|
+
}();
|
|
1980
|
+
pending.promise = loadContact().then( /*#__PURE__*/function () {
|
|
1981
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(value) {
|
|
1982
|
+
var _current$_extend;
|
|
1983
|
+
var current;
|
|
1984
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
1985
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1986
|
+
case 0:
|
|
1987
|
+
current = _this4.getTempOrder();
|
|
1988
|
+
if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
|
|
1989
|
+
_context28.next = 3;
|
|
1990
|
+
break;
|
|
1991
|
+
}
|
|
1992
|
+
return _context28.abrupt("return");
|
|
1993
|
+
case 3:
|
|
1994
|
+
if (!value) {
|
|
1995
|
+
_context28.next = 6;
|
|
1996
|
+
break;
|
|
1997
|
+
}
|
|
1998
|
+
_context28.next = 6;
|
|
1999
|
+
return _this4.applyDefaultOrderCustomerContactInfo(value);
|
|
2000
|
+
case 6:
|
|
2001
|
+
case "end":
|
|
2002
|
+
return _context28.stop();
|
|
2003
|
+
}
|
|
2004
|
+
}, _callee28);
|
|
2005
|
+
}));
|
|
2006
|
+
return function (_x18) {
|
|
2007
|
+
return _ref12.apply(this, arguments);
|
|
2008
|
+
};
|
|
2009
|
+
}()).catch(function () {
|
|
2010
|
+
// A failed default does not prevent manual entry; a subsequent sync can retry.
|
|
2011
|
+
if (_this4.orderCustomerContactRequest === pending) _this4.orderCustomerContactRequest = null;
|
|
2012
|
+
console.warn('[BookingTicket] Failed to load saved customer contact information');
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
}, {
|
|
2016
|
+
key: "waitForOrderCustomerContactInfo",
|
|
2017
|
+
value: function waitForOrderCustomerContactInfo() {
|
|
2018
|
+
var _this$orderCustomerCo, _this$orderCustomerCo2;
|
|
2019
|
+
return (_this$orderCustomerCo = (_this$orderCustomerCo2 = this.orderCustomerContactRequest) === null || _this$orderCustomerCo2 === void 0 ? void 0 : _this$orderCustomerCo2.promise) !== null && _this$orderCustomerCo !== void 0 ? _this$orderCustomerCo : Promise.resolve();
|
|
2020
|
+
}
|
|
2021
|
+
}, {
|
|
2022
|
+
key: "validateContactInfo",
|
|
2023
|
+
value: function () {
|
|
2024
|
+
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2025
|
+
var _this$getTempOrder, _this$getTempOrder2;
|
|
2026
|
+
var orderKey, customerId, scope;
|
|
2027
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2028
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2029
|
+
case 0:
|
|
2030
|
+
orderKey = this.getCustomerContactOrderKey();
|
|
2031
|
+
customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
|
|
2032
|
+
scope = this.getCustomerContactScope();
|
|
2033
|
+
_context29.next = 5;
|
|
2034
|
+
return this.waitForOrderCustomerContactInfo();
|
|
2035
|
+
case 5:
|
|
2036
|
+
if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
|
|
2037
|
+
_context29.next = 7;
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2040
|
+
throw new Error('The order changed. Please try again.');
|
|
2041
|
+
case 7:
|
|
2042
|
+
_context29.next = 9;
|
|
2043
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
|
|
2044
|
+
case 9:
|
|
2045
|
+
case "end":
|
|
2046
|
+
return _context29.stop();
|
|
2047
|
+
}
|
|
2048
|
+
}, _callee29, this);
|
|
2049
|
+
}));
|
|
2050
|
+
function validateContactInfo() {
|
|
2051
|
+
return _validateContactInfo.apply(this, arguments);
|
|
2052
|
+
}
|
|
2053
|
+
return validateContactInfo;
|
|
2054
|
+
}()
|
|
1812
2055
|
/**
|
|
1813
2056
|
* 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
|
|
1814
2057
|
*/
|
|
@@ -1835,7 +2078,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1835
2078
|
value: function clearOrderCustomer(options) {
|
|
1836
2079
|
var _discountModule$setOr,
|
|
1837
2080
|
_discountModule$setDi,
|
|
1838
|
-
|
|
2081
|
+
_this5 = this;
|
|
2082
|
+
this.orderCustomerContactRequest = null;
|
|
2083
|
+
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.resetOrderCustomerContactInfo();
|
|
1839
2084
|
if (!(options !== null && options !== void 0 && options.preserveContactInfo)) this.store.order.updateTempOrderContactsInfo(null);
|
|
1840
2085
|
this.store.order.clearOrderCustomer();
|
|
1841
2086
|
this.discountConfigCacheKey = null;
|
|
@@ -1849,9 +2094,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1849
2094
|
createIfMissing: true
|
|
1850
2095
|
}).then(function () {
|
|
1851
2096
|
var _discountModule$getDi;
|
|
1852
|
-
var tempOrder =
|
|
1853
|
-
|
|
1854
|
-
return
|
|
2097
|
+
var tempOrder = _this5.store.order.ensureTempOrder();
|
|
2098
|
+
_this5.store.order.persistTempOrder();
|
|
2099
|
+
return _this5.effectsEmit('onDiscountApplied', {
|
|
1855
2100
|
productList: tempOrder.products || [],
|
|
1856
2101
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1857
2102
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
@@ -1875,24 +2120,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1875
2120
|
}, {
|
|
1876
2121
|
key: "restoreOrder",
|
|
1877
2122
|
value: (function () {
|
|
1878
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2123
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
1879
2124
|
var _this$store$customer;
|
|
1880
2125
|
var tempOrder;
|
|
1881
|
-
return _regeneratorRuntime().wrap(function
|
|
1882
|
-
while (1) switch (
|
|
2126
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2127
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
1883
2128
|
case 0:
|
|
1884
|
-
|
|
2129
|
+
_context30.next = 2;
|
|
1885
2130
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1886
2131
|
case 2:
|
|
1887
|
-
tempOrder =
|
|
2132
|
+
tempOrder = _context30.sent;
|
|
1888
2133
|
this.clearOrderCustomer();
|
|
1889
2134
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1890
|
-
return
|
|
2135
|
+
return _context30.abrupt("return", tempOrder);
|
|
1891
2136
|
case 6:
|
|
1892
2137
|
case "end":
|
|
1893
|
-
return
|
|
2138
|
+
return _context30.stop();
|
|
1894
2139
|
}
|
|
1895
|
-
},
|
|
2140
|
+
}, _callee30, this);
|
|
1896
2141
|
}));
|
|
1897
2142
|
function restoreOrder() {
|
|
1898
2143
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1915,7 +2160,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1915
2160
|
var _this$store$order$get4,
|
|
1916
2161
|
_this$store$order6,
|
|
1917
2162
|
_this$getOrderIdentit,
|
|
1918
|
-
|
|
2163
|
+
_this6 = this;
|
|
1919
2164
|
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1920
2165
|
var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
|
|
1921
2166
|
var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
|
|
@@ -1927,50 +2172,50 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1927
2172
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1928
2173
|
}
|
|
1929
2174
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1930
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1931
|
-
var
|
|
2175
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2176
|
+
var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
|
|
1932
2177
|
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
1933
|
-
return _regeneratorRuntime().wrap(function
|
|
1934
|
-
while (1) switch (
|
|
2178
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2179
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1935
2180
|
case 0:
|
|
1936
2181
|
if (!previousRefresh) {
|
|
1937
|
-
|
|
2182
|
+
_context31.next = 3;
|
|
1938
2183
|
break;
|
|
1939
2184
|
}
|
|
1940
|
-
|
|
2185
|
+
_context31.next = 3;
|
|
1941
2186
|
return previousRefresh.catch(function () {
|
|
1942
2187
|
return undefined;
|
|
1943
2188
|
});
|
|
1944
2189
|
case 3:
|
|
1945
|
-
currentCustomer =
|
|
2190
|
+
currentCustomer = _this6.store.order.getOrderCustomer();
|
|
1946
2191
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1947
|
-
|
|
2192
|
+
_context31.next = 6;
|
|
1948
2193
|
break;
|
|
1949
2194
|
}
|
|
1950
|
-
return
|
|
2195
|
+
return _context31.abrupt("return");
|
|
1951
2196
|
case 6:
|
|
1952
|
-
currentTempOrder = (
|
|
1953
|
-
currentOrderIdentity = (
|
|
2197
|
+
currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
|
|
2198
|
+
currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
|
|
1954
2199
|
currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
|
|
1955
2200
|
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1956
2201
|
currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
|
|
1957
2202
|
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
1958
|
-
|
|
2203
|
+
_context31.next = 13;
|
|
1959
2204
|
break;
|
|
1960
2205
|
}
|
|
1961
|
-
return
|
|
2206
|
+
return _context31.abrupt("return");
|
|
1962
2207
|
case 13:
|
|
1963
|
-
|
|
1964
|
-
return
|
|
2208
|
+
_context31.next = 15;
|
|
2209
|
+
return _this6.loadDiscountConfig({
|
|
1965
2210
|
customerId: customerId,
|
|
1966
2211
|
action: action,
|
|
1967
2212
|
force: true
|
|
1968
2213
|
});
|
|
1969
2214
|
case 15:
|
|
1970
2215
|
case "end":
|
|
1971
|
-
return
|
|
2216
|
+
return _context31.stop();
|
|
1972
2217
|
}
|
|
1973
|
-
},
|
|
2218
|
+
}, _callee31);
|
|
1974
2219
|
}))();
|
|
1975
2220
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1976
2221
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1978,10 +2223,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1978
2223
|
refreshTask.catch(function (error) {
|
|
1979
2224
|
console.error('Failed to load discount config after customer change:', error);
|
|
1980
2225
|
}).finally(function () {
|
|
1981
|
-
if (
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2226
|
+
if (_this6.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
2227
|
+
_this6.orderCustomerDiscountRefreshInFlight = null;
|
|
2228
|
+
_this6.orderCustomerDiscountRefreshCustomerId = null;
|
|
2229
|
+
_this6.orderCustomerDiscountRefreshTarget = null;
|
|
1985
2230
|
});
|
|
1986
2231
|
return refreshTask;
|
|
1987
2232
|
}
|
|
@@ -1993,30 +2238,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1993
2238
|
}, {
|
|
1994
2239
|
key: "prepareProductPriceQueryContext",
|
|
1995
2240
|
value: function () {
|
|
1996
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2241
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(customerId) {
|
|
1997
2242
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1998
|
-
return _regeneratorRuntime().wrap(function
|
|
1999
|
-
while (1) switch (
|
|
2243
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2244
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2000
2245
|
case 0:
|
|
2001
|
-
|
|
2246
|
+
_context32.next = 2;
|
|
2002
2247
|
return Promise.resolve();
|
|
2003
2248
|
case 2:
|
|
2004
2249
|
normalizedCustomerId = Number(customerId || 0);
|
|
2005
2250
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
2006
2251
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
2007
2252
|
if (!(shouldWait && refreshTask)) {
|
|
2008
|
-
|
|
2253
|
+
_context32.next = 8;
|
|
2009
2254
|
break;
|
|
2010
2255
|
}
|
|
2011
|
-
|
|
2256
|
+
_context32.next = 8;
|
|
2012
2257
|
return refreshTask;
|
|
2013
2258
|
case 8:
|
|
2014
2259
|
case "end":
|
|
2015
|
-
return
|
|
2260
|
+
return _context32.stop();
|
|
2016
2261
|
}
|
|
2017
|
-
},
|
|
2262
|
+
}, _callee32, this);
|
|
2018
2263
|
}));
|
|
2019
|
-
function prepareProductPriceQueryContext(
|
|
2264
|
+
function prepareProductPriceQueryContext(_x19) {
|
|
2020
2265
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
2021
2266
|
}
|
|
2022
2267
|
return prepareProductPriceQueryContext;
|
|
@@ -2069,29 +2314,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2069
2314
|
}, {
|
|
2070
2315
|
key: "changeCustomerPage",
|
|
2071
2316
|
value: (function () {
|
|
2072
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2073
|
-
var
|
|
2074
|
-
return _regeneratorRuntime().wrap(function
|
|
2075
|
-
while (1) switch (
|
|
2317
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(page, pageSize) {
|
|
2318
|
+
var _result5;
|
|
2319
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2320
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2076
2321
|
case 0:
|
|
2077
|
-
|
|
2078
|
-
|
|
2322
|
+
_context33.prev = 0;
|
|
2323
|
+
_context33.next = 3;
|
|
2079
2324
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
2080
2325
|
case 3:
|
|
2081
|
-
|
|
2082
|
-
return
|
|
2326
|
+
_result5 = _context33.sent;
|
|
2327
|
+
return _context33.abrupt("return", _result5);
|
|
2083
2328
|
case 7:
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
console.error('Failed to change customer page:',
|
|
2087
|
-
throw
|
|
2329
|
+
_context33.prev = 7;
|
|
2330
|
+
_context33.t0 = _context33["catch"](0);
|
|
2331
|
+
console.error('Failed to change customer page:', _context33.t0);
|
|
2332
|
+
throw _context33.t0;
|
|
2088
2333
|
case 11:
|
|
2089
2334
|
case "end":
|
|
2090
|
-
return
|
|
2335
|
+
return _context33.stop();
|
|
2091
2336
|
}
|
|
2092
|
-
},
|
|
2337
|
+
}, _callee33, this, [[0, 7]]);
|
|
2093
2338
|
}));
|
|
2094
|
-
function changeCustomerPage(
|
|
2339
|
+
function changeCustomerPage(_x20, _x21) {
|
|
2095
2340
|
return _changeCustomerPage.apply(this, arguments);
|
|
2096
2341
|
}
|
|
2097
2342
|
return changeCustomerPage;
|
|
@@ -2104,28 +2349,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2104
2349
|
}, {
|
|
2105
2350
|
key: "loadMoreCustomers",
|
|
2106
2351
|
value: (function () {
|
|
2107
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2108
|
-
var
|
|
2109
|
-
return _regeneratorRuntime().wrap(function
|
|
2110
|
-
while (1) switch (
|
|
2352
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2353
|
+
var _result6;
|
|
2354
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2355
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2111
2356
|
case 0:
|
|
2112
|
-
|
|
2113
|
-
|
|
2357
|
+
_context34.prev = 0;
|
|
2358
|
+
_context34.next = 3;
|
|
2114
2359
|
return this.store.customer.loadMoreCustomers();
|
|
2115
2360
|
case 3:
|
|
2116
|
-
|
|
2117
|
-
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"),
|
|
2118
|
-
return
|
|
2361
|
+
_result6 = _context34.sent;
|
|
2362
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
|
|
2363
|
+
return _context34.abrupt("return", _result6);
|
|
2119
2364
|
case 8:
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
console.error('Failed to load more customers:',
|
|
2123
|
-
throw
|
|
2365
|
+
_context34.prev = 8;
|
|
2366
|
+
_context34.t0 = _context34["catch"](0);
|
|
2367
|
+
console.error('Failed to load more customers:', _context34.t0);
|
|
2368
|
+
throw _context34.t0;
|
|
2124
2369
|
case 12:
|
|
2125
2370
|
case "end":
|
|
2126
|
-
return
|
|
2371
|
+
return _context34.stop();
|
|
2127
2372
|
}
|
|
2128
|
-
},
|
|
2373
|
+
}, _callee34, this, [[0, 8]]);
|
|
2129
2374
|
}));
|
|
2130
2375
|
function loadMoreCustomers() {
|
|
2131
2376
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2141,31 +2386,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2141
2386
|
}, {
|
|
2142
2387
|
key: "resetAndLoadCustomers",
|
|
2143
2388
|
value: (function () {
|
|
2144
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2389
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2145
2390
|
var params,
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
return _regeneratorRuntime().wrap(function
|
|
2149
|
-
while (1) switch (
|
|
2391
|
+
_result7,
|
|
2392
|
+
_args35 = arguments;
|
|
2393
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2394
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2150
2395
|
case 0:
|
|
2151
|
-
params =
|
|
2152
|
-
|
|
2153
|
-
|
|
2396
|
+
params = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
|
|
2397
|
+
_context35.prev = 1;
|
|
2398
|
+
_context35.next = 4;
|
|
2154
2399
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2155
2400
|
case 4:
|
|
2156
|
-
|
|
2157
|
-
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"),
|
|
2158
|
-
return
|
|
2401
|
+
_result7 = _context35.sent;
|
|
2402
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
|
|
2403
|
+
return _context35.abrupt("return", _result7);
|
|
2159
2404
|
case 9:
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
console.error('Failed to reset and load customers:',
|
|
2163
|
-
throw
|
|
2405
|
+
_context35.prev = 9;
|
|
2406
|
+
_context35.t0 = _context35["catch"](1);
|
|
2407
|
+
console.error('Failed to reset and load customers:', _context35.t0);
|
|
2408
|
+
throw _context35.t0;
|
|
2164
2409
|
case 13:
|
|
2165
2410
|
case "end":
|
|
2166
|
-
return
|
|
2411
|
+
return _context35.stop();
|
|
2167
2412
|
}
|
|
2168
|
-
},
|
|
2413
|
+
}, _callee35, this, [[1, 9]]);
|
|
2169
2414
|
}));
|
|
2170
2415
|
function resetAndLoadCustomers() {
|
|
2171
2416
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2210,9 +2455,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2210
2455
|
}, {
|
|
2211
2456
|
key: "scanGlobalListener",
|
|
2212
2457
|
value: function scanGlobalListener(callback) {
|
|
2213
|
-
var
|
|
2458
|
+
var _this7 = this;
|
|
2214
2459
|
var localSearch = function localSearch(v) {
|
|
2215
|
-
return
|
|
2460
|
+
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2216
2461
|
};
|
|
2217
2462
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2218
2463
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2326,16 +2571,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2326
2571
|
}, {
|
|
2327
2572
|
key: "getOtherParams",
|
|
2328
2573
|
value: (function () {
|
|
2329
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2330
|
-
return _regeneratorRuntime().wrap(function
|
|
2331
|
-
while (1) switch (
|
|
2574
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2575
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2576
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2332
2577
|
case 0:
|
|
2333
|
-
return
|
|
2578
|
+
return _context36.abrupt("return", this.otherParams);
|
|
2334
2579
|
case 1:
|
|
2335
2580
|
case "end":
|
|
2336
|
-
return
|
|
2581
|
+
return _context36.stop();
|
|
2337
2582
|
}
|
|
2338
|
-
},
|
|
2583
|
+
}, _callee36, this);
|
|
2339
2584
|
}));
|
|
2340
2585
|
function getOtherParams() {
|
|
2341
2586
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2507,10 +2752,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2507
2752
|
}, {
|
|
2508
2753
|
key: "logSessionCatalogDateMismatch",
|
|
2509
2754
|
value: function logSessionCatalogDateMismatch(item, bookingDate) {
|
|
2510
|
-
var _this$
|
|
2755
|
+
var _this$getTempOrder3, _tempOrder$order_id, _tempOrder$external_s, _item$cartDetailValue, _item$cartDetailValue2;
|
|
2511
2756
|
var logger = this.logger;
|
|
2512
2757
|
if (!(logger !== null && logger !== void 0 && logger.addLog)) return;
|
|
2513
|
-
var tempOrder = (_this$
|
|
2758
|
+
var tempOrder = (_this$getTempOrder3 = this.getTempOrder) === null || _this$getTempOrder3 === void 0 ? void 0 : _this$getTempOrder3.call(this);
|
|
2514
2759
|
var staleInfo = buildSessionCatalogStaleInfo(item, bookingDate);
|
|
2515
2760
|
logger.addLog({
|
|
2516
2761
|
type: 'warning',
|
|
@@ -2545,10 +2790,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2545
2790
|
}, {
|
|
2546
2791
|
key: "buildAddProductCtx",
|
|
2547
2792
|
value: function buildAddProductCtx(extra) {
|
|
2548
|
-
var _extra$date2,
|
|
2793
|
+
var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
|
|
2549
2794
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2550
2795
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2551
|
-
var orderCustomerId = (
|
|
2796
|
+
var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
|
|
2552
2797
|
return _objectSpread(_objectSpread({
|
|
2553
2798
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2554
2799
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2659,18 +2904,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2659
2904
|
}, {
|
|
2660
2905
|
key: "updateProductInOrder",
|
|
2661
2906
|
value: (function () {
|
|
2662
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2663
|
-
return _regeneratorRuntime().wrap(function
|
|
2664
|
-
while (1) switch (
|
|
2907
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
2908
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2909
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2665
2910
|
case 0:
|
|
2666
|
-
return
|
|
2911
|
+
return _context37.abrupt("return", this.updateOrderProduct(params));
|
|
2667
2912
|
case 1:
|
|
2668
2913
|
case "end":
|
|
2669
|
-
return
|
|
2914
|
+
return _context37.stop();
|
|
2670
2915
|
}
|
|
2671
|
-
},
|
|
2916
|
+
}, _callee37, this);
|
|
2672
2917
|
}));
|
|
2673
|
-
function updateProductInOrder(
|
|
2918
|
+
function updateProductInOrder(_x22) {
|
|
2674
2919
|
return _updateProductInOrder.apply(this, arguments);
|
|
2675
2920
|
}
|
|
2676
2921
|
return updateProductInOrder;
|
|
@@ -2692,24 +2937,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2692
2937
|
}, {
|
|
2693
2938
|
key: "handleGlobalScanCode",
|
|
2694
2939
|
value: (function () {
|
|
2695
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2696
|
-
var
|
|
2697
|
-
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2,
|
|
2698
|
-
return _regeneratorRuntime().wrap(function
|
|
2699
|
-
while (1) switch (
|
|
2940
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(code, bridge) {
|
|
2941
|
+
var _this8 = this;
|
|
2942
|
+
var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result8, _bridge$onNotify3;
|
|
2943
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2944
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2700
2945
|
case 0:
|
|
2701
2946
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2702
2947
|
if (trimmed) {
|
|
2703
|
-
|
|
2948
|
+
_context38.next = 4;
|
|
2704
2949
|
break;
|
|
2705
2950
|
}
|
|
2706
2951
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2707
|
-
return
|
|
2952
|
+
return _context38.abrupt("return", {
|
|
2708
2953
|
status: 'failed',
|
|
2709
2954
|
reason: 'empty_code'
|
|
2710
2955
|
});
|
|
2711
2956
|
case 4:
|
|
2712
|
-
|
|
2957
|
+
_context38.prev = 4;
|
|
2713
2958
|
// Capture before lookup/UI awaits, so a result cannot land in a new cart.
|
|
2714
2959
|
// Unscoped POS Order modules return a no-op guard.
|
|
2715
2960
|
beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
|
|
@@ -2736,23 +2981,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2736
2981
|
} : undefined
|
|
2737
2982
|
}) : undefined;
|
|
2738
2983
|
if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
|
|
2739
|
-
|
|
2984
|
+
_context38.next = 16;
|
|
2740
2985
|
break;
|
|
2741
2986
|
}
|
|
2742
2987
|
if (guardedBridge.applyPromotionCode) {
|
|
2743
|
-
|
|
2988
|
+
_context38.next = 12;
|
|
2744
2989
|
break;
|
|
2745
2990
|
}
|
|
2746
|
-
return
|
|
2991
|
+
return _context38.abrupt("return", {
|
|
2747
2992
|
status: 'failed',
|
|
2748
2993
|
reason: 'no_bridge'
|
|
2749
2994
|
});
|
|
2750
2995
|
case 12:
|
|
2751
|
-
|
|
2996
|
+
_context38.next = 14;
|
|
2752
2997
|
return guardedBridge.applyPromotionCode(trimmed);
|
|
2753
2998
|
case 14:
|
|
2754
|
-
promotion =
|
|
2755
|
-
return
|
|
2999
|
+
promotion = _context38.sent;
|
|
3000
|
+
return _context38.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
|
|
2756
3001
|
status: 'success',
|
|
2757
3002
|
kind: 'promotion'
|
|
2758
3003
|
} : {
|
|
@@ -2761,87 +3006,87 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2761
3006
|
});
|
|
2762
3007
|
case 16:
|
|
2763
3008
|
localSearch = function localSearch(v) {
|
|
2764
|
-
return
|
|
3009
|
+
return _this8.store.products.findProductsByCodeOrBarcode(v);
|
|
2765
3010
|
};
|
|
2766
3011
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2767
|
-
|
|
3012
|
+
_context38.next = 20;
|
|
2768
3013
|
return scanCallback({
|
|
2769
3014
|
type: 'nativeScanner',
|
|
2770
3015
|
value: trimmed
|
|
2771
3016
|
});
|
|
2772
3017
|
case 20:
|
|
2773
|
-
raw =
|
|
3018
|
+
raw = _context38.sent;
|
|
2774
3019
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2775
3020
|
if (formatted) {
|
|
2776
|
-
|
|
3021
|
+
_context38.next = 25;
|
|
2777
3022
|
break;
|
|
2778
3023
|
}
|
|
2779
3024
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2780
|
-
return
|
|
3025
|
+
return _context38.abrupt("return", {
|
|
2781
3026
|
status: 'failed',
|
|
2782
3027
|
reason: 'not_found'
|
|
2783
3028
|
});
|
|
2784
3029
|
case 25:
|
|
2785
|
-
|
|
3030
|
+
_context38.next = 27;
|
|
2786
3031
|
return applyGlobalScan({
|
|
2787
3032
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2788
3033
|
beforeScanCommit();
|
|
2789
|
-
|
|
3034
|
+
_this8.setOrderCustomer(customer);
|
|
2790
3035
|
},
|
|
2791
3036
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2792
|
-
return
|
|
3037
|
+
return _this8.getOrderCustomerSnapshot();
|
|
2793
3038
|
},
|
|
2794
3039
|
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
2795
|
-
return
|
|
3040
|
+
return _this8.resolveCustomerById(customerId);
|
|
2796
3041
|
},
|
|
2797
3042
|
getBusinessCode: function getBusinessCode() {
|
|
2798
|
-
var
|
|
2799
|
-
return (
|
|
3043
|
+
var _this8$otherParams;
|
|
3044
|
+
return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
|
|
2800
3045
|
},
|
|
2801
3046
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
2802
|
-
return
|
|
3047
|
+
return _this8.buildAddProductCtx(extra);
|
|
2803
3048
|
},
|
|
2804
3049
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
2805
|
-
return
|
|
3050
|
+
return _this8.decideAddProduct(item, options);
|
|
2806
3051
|
},
|
|
2807
3052
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
2808
|
-
return
|
|
3053
|
+
return _this8.decideAfterDetail(cacheItem, options);
|
|
2809
3054
|
},
|
|
2810
3055
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
2811
|
-
return
|
|
3056
|
+
return _this8.transformDetailToProductAndBooking(input);
|
|
2812
3057
|
},
|
|
2813
3058
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2814
3059
|
beforeScanCommit();
|
|
2815
|
-
return
|
|
3060
|
+
return _this8.addProductToOrder(product, booking);
|
|
2816
3061
|
},
|
|
2817
3062
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2818
|
-
return
|
|
3063
|
+
return _this8.refreshWalletAssets(params);
|
|
2819
3064
|
},
|
|
2820
3065
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2821
3066
|
beforeScanCommit();
|
|
2822
|
-
return
|
|
3067
|
+
return _this8.scanWalletAsset(scanCode);
|
|
2823
3068
|
}
|
|
2824
3069
|
}, formatted, guardedBridge);
|
|
2825
3070
|
case 27:
|
|
2826
|
-
|
|
3071
|
+
_result8 = _context38.sent;
|
|
2827
3072
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2828
|
-
return
|
|
3073
|
+
return _context38.abrupt("return", _result8);
|
|
2829
3074
|
case 32:
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
3075
|
+
_context38.prev = 32;
|
|
3076
|
+
_context38.t0 = _context38["catch"](4);
|
|
3077
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context38.t0);
|
|
2833
3078
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2834
|
-
return
|
|
3079
|
+
return _context38.abrupt("return", {
|
|
2835
3080
|
status: 'failed',
|
|
2836
3081
|
reason: 'not_found'
|
|
2837
3082
|
});
|
|
2838
3083
|
case 37:
|
|
2839
3084
|
case "end":
|
|
2840
|
-
return
|
|
3085
|
+
return _context38.stop();
|
|
2841
3086
|
}
|
|
2842
|
-
},
|
|
3087
|
+
}, _callee38, this, [[4, 32]]);
|
|
2843
3088
|
}));
|
|
2844
|
-
function handleGlobalScanCode(
|
|
3089
|
+
function handleGlobalScanCode(_x23, _x24) {
|
|
2845
3090
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2846
3091
|
}
|
|
2847
3092
|
return handleGlobalScanCode;
|
|
@@ -2849,39 +3094,39 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2849
3094
|
}, {
|
|
2850
3095
|
key: "getGlobalScanCodeType",
|
|
2851
3096
|
value: (function () {
|
|
2852
|
-
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2853
|
-
var
|
|
3097
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code) {
|
|
3098
|
+
var _this9 = this,
|
|
2854
3099
|
_formatGlobalScanResu,
|
|
2855
3100
|
_formatGlobalScanResu2;
|
|
2856
3101
|
var trimmed, scan, raw;
|
|
2857
|
-
return _regeneratorRuntime().wrap(function
|
|
2858
|
-
while (1) switch (
|
|
3102
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3103
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2859
3104
|
case 0:
|
|
2860
3105
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2861
3106
|
if (trimmed) {
|
|
2862
|
-
|
|
3107
|
+
_context39.next = 3;
|
|
2863
3108
|
break;
|
|
2864
3109
|
}
|
|
2865
|
-
return
|
|
3110
|
+
return _context39.abrupt("return", null);
|
|
2866
3111
|
case 3:
|
|
2867
3112
|
scan = handleGlobalScan(this.request, function (value) {
|
|
2868
|
-
return
|
|
3113
|
+
return _this9.store.products.findProductsByCodeOrBarcode(value);
|
|
2869
3114
|
}, this.getSubmitOrderSalesChannel());
|
|
2870
|
-
|
|
3115
|
+
_context39.next = 6;
|
|
2871
3116
|
return scan({
|
|
2872
3117
|
type: 'nativeScanner',
|
|
2873
3118
|
value: trimmed
|
|
2874
3119
|
});
|
|
2875
3120
|
case 6:
|
|
2876
|
-
raw =
|
|
2877
|
-
return
|
|
3121
|
+
raw = _context39.sent;
|
|
3122
|
+
return _context39.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
2878
3123
|
case 8:
|
|
2879
3124
|
case "end":
|
|
2880
|
-
return
|
|
3125
|
+
return _context39.stop();
|
|
2881
3126
|
}
|
|
2882
|
-
},
|
|
3127
|
+
}, _callee39, this);
|
|
2883
3128
|
}));
|
|
2884
|
-
function getGlobalScanCodeType(
|
|
3129
|
+
function getGlobalScanCodeType(_x25) {
|
|
2885
3130
|
return _getGlobalScanCodeType.apply(this, arguments);
|
|
2886
3131
|
}
|
|
2887
3132
|
return getGlobalScanCodeType;
|
|
@@ -2901,7 +3146,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2901
3146
|
}, {
|
|
2902
3147
|
key: "buildAddTimeOrderLine",
|
|
2903
3148
|
value: function buildAddTimeOrderLine(input, bookingUid) {
|
|
2904
|
-
var _input$num, _product$id, _product$product_id,
|
|
3149
|
+
var _input$num, _product$id, _product$product_id, _ref15, _product$product_vari, _ref16, _product$variant_id, _product$original_pri, _ref17, _ref18, _product$option, _product$product_sku, _ref19, _ref20, _product$bundle, _product$id2;
|
|
2905
3150
|
var product = input === null || input === void 0 ? void 0 : input.product;
|
|
2906
3151
|
if (!product || _typeof(product) !== 'object') {
|
|
2907
3152
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: product 不能为空');
|
|
@@ -2912,8 +3157,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2912
3157
|
var payload = {
|
|
2913
3158
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id,
|
|
2914
3159
|
product_id: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
|
|
2915
|
-
product_variant_id: (
|
|
2916
|
-
variant_id: (
|
|
3160
|
+
product_variant_id: (_ref15 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0,
|
|
3161
|
+
variant_id: (_ref16 = (_product$variant_id = product.variant_id) !== null && _product$variant_id !== void 0 ? _product$variant_id : product.product_variant_id) !== null && _ref16 !== void 0 ? _ref16 : 0,
|
|
2917
3162
|
quantity: quantity,
|
|
2918
3163
|
num: quantity,
|
|
2919
3164
|
price: price,
|
|
@@ -2922,8 +3167,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2922
3167
|
line_total: price,
|
|
2923
3168
|
total: price,
|
|
2924
3169
|
product_sku: product.product_sku,
|
|
2925
|
-
option: (
|
|
2926
|
-
bundle: (
|
|
3170
|
+
option: (_ref17 = (_ref18 = (_product$option = product.option) !== null && _product$option !== void 0 ? _product$option : product.options) !== null && _ref18 !== void 0 ? _ref18 : (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.option) !== null && _ref17 !== void 0 ? _ref17 : [],
|
|
3171
|
+
bundle: (_ref19 = (_ref20 = (_product$bundle = product.bundle) !== null && _product$bundle !== void 0 ? _product$bundle : product.bundles) !== null && _ref20 !== void 0 ? _ref20 : product.product_bundle) !== null && _ref19 !== void 0 ? _ref19 : []
|
|
2927
3172
|
};
|
|
2928
3173
|
var orderLine = this.transformBaseProductToOrderProduct({
|
|
2929
3174
|
payload: payload,
|
|
@@ -2963,11 +3208,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2963
3208
|
}, {
|
|
2964
3209
|
key: "addAddTimeProductToBooking",
|
|
2965
3210
|
value: (function () {
|
|
2966
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2967
|
-
return _regeneratorRuntime().wrap(function
|
|
2968
|
-
while (1) switch (
|
|
3211
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(input) {
|
|
3212
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3213
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2969
3214
|
case 0:
|
|
2970
|
-
return
|
|
3215
|
+
return _context40.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2971
3216
|
booking: input.booking,
|
|
2972
3217
|
products: [input],
|
|
2973
3218
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2975,11 +3220,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2975
3220
|
}));
|
|
2976
3221
|
case 1:
|
|
2977
3222
|
case "end":
|
|
2978
|
-
return
|
|
3223
|
+
return _context40.stop();
|
|
2979
3224
|
}
|
|
2980
|
-
},
|
|
3225
|
+
}, _callee40, this);
|
|
2981
3226
|
}));
|
|
2982
|
-
function addAddTimeProductToBooking(
|
|
3227
|
+
function addAddTimeProductToBooking(_x26) {
|
|
2983
3228
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2984
3229
|
}
|
|
2985
3230
|
return addAddTimeProductToBooking;
|
|
@@ -2997,27 +3242,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2997
3242
|
}, {
|
|
2998
3243
|
key: "addAddTimeProductsToBooking",
|
|
2999
3244
|
value: (function () {
|
|
3000
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3001
|
-
var
|
|
3245
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
|
|
3246
|
+
var _this10 = this,
|
|
3002
3247
|
_input$bookingPatch;
|
|
3003
3248
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
3004
|
-
return _regeneratorRuntime().wrap(function
|
|
3005
|
-
while (1) switch (
|
|
3249
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3250
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3006
3251
|
case 0:
|
|
3007
3252
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
3008
3253
|
if (bookingUid) {
|
|
3009
|
-
|
|
3254
|
+
_context41.next = 3;
|
|
3010
3255
|
break;
|
|
3011
3256
|
}
|
|
3012
3257
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
3013
3258
|
case 3:
|
|
3014
3259
|
orderLines = (input.products || []).map(function (line) {
|
|
3015
3260
|
return {
|
|
3016
|
-
product:
|
|
3261
|
+
product: _this10.buildAddTimeOrderLine(line, bookingUid)
|
|
3017
3262
|
};
|
|
3018
3263
|
});
|
|
3019
3264
|
if (this.store.order) {
|
|
3020
|
-
|
|
3265
|
+
_context41.next = 6;
|
|
3021
3266
|
break;
|
|
3022
3267
|
}
|
|
3023
3268
|
throw new Error('order 模块未初始化');
|
|
@@ -3031,55 +3276,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3031
3276
|
});
|
|
3032
3277
|
}
|
|
3033
3278
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
3034
|
-
|
|
3279
|
+
_context41.next = 11;
|
|
3035
3280
|
break;
|
|
3036
3281
|
}
|
|
3037
|
-
return
|
|
3282
|
+
return _context41.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
3038
3283
|
case 11:
|
|
3039
3284
|
result = [];
|
|
3040
3285
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
3041
|
-
|
|
3286
|
+
_context41.prev = 13;
|
|
3042
3287
|
_iterator2.s();
|
|
3043
3288
|
case 15:
|
|
3044
3289
|
if ((_step2 = _iterator2.n()).done) {
|
|
3045
|
-
|
|
3290
|
+
_context41.next = 29;
|
|
3046
3291
|
break;
|
|
3047
3292
|
}
|
|
3048
3293
|
line = _step2.value;
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3294
|
+
_context41.t0 = result.splice;
|
|
3295
|
+
_context41.t1 = result;
|
|
3296
|
+
_context41.t2 = [0, result.length];
|
|
3297
|
+
_context41.t3 = _toConsumableArray;
|
|
3298
|
+
_context41.next = 23;
|
|
3054
3299
|
return this.addProductToOrder(line.product);
|
|
3055
3300
|
case 23:
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3301
|
+
_context41.t4 = _context41.sent;
|
|
3302
|
+
_context41.t5 = (0, _context41.t3)(_context41.t4);
|
|
3303
|
+
_context41.t6 = _context41.t2.concat.call(_context41.t2, _context41.t5);
|
|
3304
|
+
_context41.t0.apply.call(_context41.t0, _context41.t1, _context41.t6);
|
|
3060
3305
|
case 27:
|
|
3061
|
-
|
|
3306
|
+
_context41.next = 15;
|
|
3062
3307
|
break;
|
|
3063
3308
|
case 29:
|
|
3064
|
-
|
|
3309
|
+
_context41.next = 34;
|
|
3065
3310
|
break;
|
|
3066
3311
|
case 31:
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
_iterator2.e(
|
|
3312
|
+
_context41.prev = 31;
|
|
3313
|
+
_context41.t7 = _context41["catch"](13);
|
|
3314
|
+
_iterator2.e(_context41.t7);
|
|
3070
3315
|
case 34:
|
|
3071
|
-
|
|
3316
|
+
_context41.prev = 34;
|
|
3072
3317
|
_iterator2.f();
|
|
3073
|
-
return
|
|
3318
|
+
return _context41.finish(34);
|
|
3074
3319
|
case 37:
|
|
3075
|
-
return
|
|
3320
|
+
return _context41.abrupt("return", result);
|
|
3076
3321
|
case 38:
|
|
3077
3322
|
case "end":
|
|
3078
|
-
return
|
|
3323
|
+
return _context41.stop();
|
|
3079
3324
|
}
|
|
3080
|
-
},
|
|
3325
|
+
}, _callee41, this, [[13, 31, 34, 37]]);
|
|
3081
3326
|
}));
|
|
3082
|
-
function addAddTimeProductsToBooking(
|
|
3327
|
+
function addAddTimeProductsToBooking(_x27) {
|
|
3083
3328
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
3084
3329
|
}
|
|
3085
3330
|
return addAddTimeProductsToBooking;
|
|
@@ -3087,42 +3332,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3087
3332
|
}, {
|
|
3088
3333
|
key: "setOtherParams",
|
|
3089
3334
|
value: function () {
|
|
3090
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3091
|
-
var
|
|
3092
|
-
|
|
3335
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
|
|
3336
|
+
var _this11 = this;
|
|
3337
|
+
var _ref21,
|
|
3338
|
+
_ref21$cover,
|
|
3093
3339
|
cover,
|
|
3340
|
+
nextParams,
|
|
3094
3341
|
invoiceContextChanged,
|
|
3095
|
-
|
|
3096
|
-
return _regeneratorRuntime().wrap(function
|
|
3097
|
-
while (1) switch (
|
|
3342
|
+
_args42 = arguments;
|
|
3343
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3344
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3098
3345
|
case 0:
|
|
3099
|
-
|
|
3100
|
-
|
|
3346
|
+
_ref21 = _args42.length > 1 && _args42[1] !== undefined ? _args42[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
|
|
3347
|
+
nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3348
|
+
if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
|
|
3349
|
+
var _this11$otherParams;
|
|
3350
|
+
return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
|
|
3351
|
+
})) this.orderCustomerContactRequest = null;
|
|
3352
|
+
_context42.next = 5;
|
|
3101
3353
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
3102
3354
|
cover: cover
|
|
3103
3355
|
});
|
|
3104
|
-
case
|
|
3356
|
+
case 5:
|
|
3105
3357
|
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3106
3358
|
if (!invoiceContextChanged) {
|
|
3107
|
-
|
|
3359
|
+
_context42.next = 9;
|
|
3108
3360
|
break;
|
|
3109
3361
|
}
|
|
3110
|
-
|
|
3362
|
+
_context42.next = 9;
|
|
3111
3363
|
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3112
|
-
case
|
|
3364
|
+
case 9:
|
|
3113
3365
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3114
|
-
|
|
3366
|
+
_context42.next = 12;
|
|
3115
3367
|
break;
|
|
3116
3368
|
}
|
|
3117
|
-
|
|
3369
|
+
_context42.next = 12;
|
|
3118
3370
|
return this.configureIdGeneratorFromOpenData();
|
|
3119
|
-
case
|
|
3371
|
+
case 12:
|
|
3120
3372
|
case "end":
|
|
3121
|
-
return
|
|
3373
|
+
return _context42.stop();
|
|
3122
3374
|
}
|
|
3123
|
-
},
|
|
3375
|
+
}, _callee42, this);
|
|
3124
3376
|
}));
|
|
3125
|
-
function setOtherParams(
|
|
3377
|
+
function setOtherParams(_x28) {
|
|
3126
3378
|
return _setOtherParams.apply(this, arguments);
|
|
3127
3379
|
}
|
|
3128
3380
|
return setOtherParams;
|
|
@@ -3139,15 +3391,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3139
3391
|
}, {
|
|
3140
3392
|
key: "handlePrintWristband",
|
|
3141
3393
|
value: function () {
|
|
3142
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3394
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3143
3395
|
var _this$getOrderIdentit2;
|
|
3144
3396
|
var deviceTask, deviceId, idempotencyKey;
|
|
3145
|
-
return _regeneratorRuntime().wrap(function
|
|
3146
|
-
while (1) switch (
|
|
3397
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3398
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3147
3399
|
case 0:
|
|
3148
3400
|
deviceTask = this.getDeviceTaskPlugin();
|
|
3149
3401
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
3150
|
-
|
|
3402
|
+
_context43.next = 4;
|
|
3151
3403
|
break;
|
|
3152
3404
|
}
|
|
3153
3405
|
this.logger.addLog({
|
|
@@ -3157,7 +3409,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3157
3409
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3158
3410
|
}
|
|
3159
3411
|
});
|
|
3160
|
-
return
|
|
3412
|
+
return _context43.abrupt("return");
|
|
3161
3413
|
case 4:
|
|
3162
3414
|
this.logger.addLog({
|
|
3163
3415
|
type: 'info',
|
|
@@ -3166,10 +3418,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3166
3418
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3167
3419
|
}
|
|
3168
3420
|
});
|
|
3169
|
-
|
|
3421
|
+
_context43.next = 7;
|
|
3170
3422
|
return this.getShortNumberOrDeviceId();
|
|
3171
3423
|
case 7:
|
|
3172
|
-
deviceId =
|
|
3424
|
+
deviceId = _context43.sent;
|
|
3173
3425
|
idempotencyKey = createUuidV4();
|
|
3174
3426
|
deviceTask.dispatch({
|
|
3175
3427
|
action: 'print_all',
|
|
@@ -3189,11 +3441,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3189
3441
|
});
|
|
3190
3442
|
case 10:
|
|
3191
3443
|
case "end":
|
|
3192
|
-
return
|
|
3444
|
+
return _context43.stop();
|
|
3193
3445
|
}
|
|
3194
|
-
},
|
|
3446
|
+
}, _callee43, this);
|
|
3195
3447
|
}));
|
|
3196
|
-
function handlePrintWristband(
|
|
3448
|
+
function handlePrintWristband(_x29) {
|
|
3197
3449
|
return _handlePrintWristband.apply(this, arguments);
|
|
3198
3450
|
}
|
|
3199
3451
|
return handlePrintWristband;
|
|
@@ -3201,11 +3453,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3201
3453
|
}, {
|
|
3202
3454
|
key: "handleRedeem",
|
|
3203
3455
|
value: function () {
|
|
3204
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3205
|
-
var _this$store$order8, _this$store$order8$ge, _this$store$order9,
|
|
3456
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3457
|
+
var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
|
|
3206
3458
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3207
|
-
return _regeneratorRuntime().wrap(function
|
|
3208
|
-
while (1) switch (
|
|
3459
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3460
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3209
3461
|
case 0:
|
|
3210
3462
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3211
3463
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3229,20 +3481,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3229
3481
|
});
|
|
3230
3482
|
});
|
|
3231
3483
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3232
|
-
|
|
3484
|
+
_context44.next = 11;
|
|
3233
3485
|
break;
|
|
3234
3486
|
}
|
|
3235
|
-
|
|
3487
|
+
_context44.next = 11;
|
|
3236
3488
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3237
3489
|
vouchers: nextVouchers
|
|
3238
3490
|
}));
|
|
3239
3491
|
case 11:
|
|
3240
3492
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3241
3493
|
if (!(voucherIds.length === 0)) {
|
|
3242
|
-
|
|
3494
|
+
_context44.next = 14;
|
|
3243
3495
|
break;
|
|
3244
3496
|
}
|
|
3245
|
-
return
|
|
3497
|
+
return _context44.abrupt("return", {
|
|
3246
3498
|
code: 200,
|
|
3247
3499
|
status: true,
|
|
3248
3500
|
message: '',
|
|
@@ -3251,9 +3503,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3251
3503
|
case 14:
|
|
3252
3504
|
identity = this.getOrderIdentity();
|
|
3253
3505
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3254
|
-
orderId = (
|
|
3506
|
+
orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
|
|
3255
3507
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3256
|
-
return
|
|
3508
|
+
return _context44.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3257
3509
|
ids: voucherIds,
|
|
3258
3510
|
status: status,
|
|
3259
3511
|
order_lookup: orderLookup,
|
|
@@ -3264,11 +3516,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3264
3516
|
}));
|
|
3265
3517
|
case 19:
|
|
3266
3518
|
case "end":
|
|
3267
|
-
return
|
|
3519
|
+
return _context44.stop();
|
|
3268
3520
|
}
|
|
3269
|
-
},
|
|
3521
|
+
}, _callee44, this);
|
|
3270
3522
|
}));
|
|
3271
|
-
function handleRedeem(
|
|
3523
|
+
function handleRedeem(_x30) {
|
|
3272
3524
|
return _handleRedeem.apply(this, arguments);
|
|
3273
3525
|
}
|
|
3274
3526
|
return handleRedeem;
|
|
@@ -3280,25 +3532,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3280
3532
|
}, {
|
|
3281
3533
|
key: "destroy",
|
|
3282
3534
|
value: (function () {
|
|
3283
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3535
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3284
3536
|
var _this$scan;
|
|
3285
|
-
return _regeneratorRuntime().wrap(function
|
|
3286
|
-
while (1) switch (
|
|
3537
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3538
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3287
3539
|
case 0:
|
|
3288
|
-
|
|
3540
|
+
this.orderCustomerContactRequest = null;
|
|
3541
|
+
_context45.next = 3;
|
|
3289
3542
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3290
|
-
case
|
|
3543
|
+
case 3:
|
|
3291
3544
|
try {
|
|
3292
3545
|
(_this$scan = this.scan) === null || _this$scan === void 0 || _this$scan.removeAllListeners();
|
|
3293
3546
|
} catch (error) {
|
|
3294
3547
|
console.warn('[BookingTicket] scan removeAllListeners 失败', error);
|
|
3295
3548
|
}
|
|
3296
3549
|
scanCache.clear();
|
|
3297
|
-
case
|
|
3550
|
+
case 5:
|
|
3298
3551
|
case "end":
|
|
3299
|
-
return
|
|
3552
|
+
return _context45.stop();
|
|
3300
3553
|
}
|
|
3301
|
-
},
|
|
3554
|
+
}, _callee45, this);
|
|
3302
3555
|
}));
|
|
3303
3556
|
function destroy() {
|
|
3304
3557
|
return _destroy.apply(this, arguments);
|