@pisell/pisellos 2.2.178 → 2.2.180
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/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +17 -87
- package/dist/modules/Order/index.js +501 -1357
- package/dist/modules/Order/types.d.ts +19 -198
- package/dist/modules/Order/types.js +0 -31
- package/dist/modules/Order/utils.d.ts +1 -50
- package/dist/modules/Order/utils.js +32 -261
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +21 -23
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/SalesSummary/utils.js +7 -21
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +29 -87
- package/dist/server/modules/order/index.d.ts +0 -23
- package/dist/server/modules/order/index.js +46 -123
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +113 -130
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -89
- package/dist/solution/BaseSales/index.js +375 -1494
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -780
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/BookingTicket/utils/cartView.js +2 -4
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +17 -87
- package/lib/modules/Order/index.js +150 -677
- package/lib/modules/Order/types.d.ts +19 -198
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +1 -50
- package/lib/modules/Order/utils.js +22 -229
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +15 -18
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/SalesSummary/utils.js +7 -21
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +4 -41
- package/lib/server/modules/order/index.d.ts +0 -23
- package/lib/server/modules/order/index.js +14 -46
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +20 -30
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -89
- package/lib/solution/BaseSales/index.js +22 -736
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -352
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/BookingTicket/utils/cartView.js +2 -4
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -30,16 +30,12 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
30
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
31
31
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
32
|
import { createBookingTicketModule } from "./types";
|
|
33
|
-
import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
|
|
34
33
|
import { BaseSalesImpl } from "../BaseSales";
|
|
35
34
|
import Scan from "./utils/scan";
|
|
36
35
|
import { formatOrderCustomerPatch } from "./utils/orderCustomer";
|
|
37
36
|
import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
|
|
38
37
|
import scanCache from "./utils/scan/scanCache";
|
|
39
38
|
import { buildCartView } from "./utils/cartView";
|
|
40
|
-
import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
|
|
41
|
-
import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
|
|
42
|
-
import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
|
|
43
39
|
import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
|
|
44
40
|
export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
45
41
|
_inherits(BookingTicketImpl, _BaseSalesImpl);
|
|
@@ -61,24 +57,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
61
57
|
_defineProperty(_assertThisInitialized(_this), "platform", void 0);
|
|
62
58
|
_defineProperty(_assertThisInitialized(_this), "scan", void 0);
|
|
63
59
|
_defineProperty(_assertThisInitialized(_this), "productCatalog", []);
|
|
64
|
-
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
65
|
-
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
66
60
|
return _this;
|
|
67
61
|
}
|
|
68
62
|
_createClass(BookingTicketImpl, [{
|
|
69
63
|
key: "getRegisteredModuleNames",
|
|
70
64
|
value:
|
|
71
65
|
/**
|
|
72
|
-
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer
|
|
73
|
-
* bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
|
|
66
|
+
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
|
|
74
67
|
*/
|
|
75
68
|
function getRegisteredModuleNames() {
|
|
76
|
-
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer'
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
|
-
key: "getSubmitOrderSalesChannel",
|
|
80
|
-
value: function getSubmitOrderSalesChannel() {
|
|
81
|
-
return 'pos';
|
|
69
|
+
return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer']);
|
|
82
70
|
}
|
|
83
71
|
|
|
84
72
|
/**
|
|
@@ -137,8 +125,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
137
125
|
key: "loadSalesDetail",
|
|
138
126
|
value: (function () {
|
|
139
127
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
|
|
140
|
-
var _ref;
|
|
141
|
-
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
128
|
+
var sales, customerModule, detailCustomer, _detailCustomer$name, _ref, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
142
129
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
143
130
|
while (1) switch (_context2.prev = _context2.next) {
|
|
144
131
|
case 0:
|
|
@@ -149,36 +136,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
149
136
|
console.log(sales, '1234sales');
|
|
150
137
|
customerModule = this.store.customer;
|
|
151
138
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
break;
|
|
139
|
+
if (customerModule && detailCustomer) {
|
|
140
|
+
_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : {}, detailCustomerId = _ref.id, detailCustomerRest = _objectWithoutProperties(_ref, _excluded);
|
|
141
|
+
rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
|
|
142
|
+
customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
|
|
143
|
+
id: rawId == null ? '' : rawId,
|
|
144
|
+
name: (_detailCustomer$name = detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.name) !== null && _detailCustomer$name !== void 0 ? _detailCustomer$name : '',
|
|
145
|
+
phone: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.phone,
|
|
146
|
+
email: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.email,
|
|
147
|
+
country_calling_code: detailCustomer === null || detailCustomer === void 0 ? void 0 : detailCustomer.country_calling_code
|
|
148
|
+
});
|
|
149
|
+
customerModule.setSelectedCustomer(customer);
|
|
150
|
+
this.setOrderCustomer(customer);
|
|
165
151
|
}
|
|
166
|
-
_ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
|
|
167
|
-
rawId = detailCustomerId !== null && detailCustomerId !== void 0 ? detailCustomerId : '';
|
|
168
|
-
customer = _objectSpread(_objectSpread({}, detailCustomerRest), {}, {
|
|
169
|
-
id: rawId == null ? '' : rawId,
|
|
170
|
-
name: (_selectedCustomer$nam = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.name) !== null && _selectedCustomer$nam !== void 0 ? _selectedCustomer$nam : '',
|
|
171
|
-
phone: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.phone,
|
|
172
|
-
email: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.email,
|
|
173
|
-
country_calling_code: selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.country_calling_code
|
|
174
|
-
});
|
|
175
|
-
customerModule.setSelectedCustomer(customer);
|
|
176
|
-
this.setOrderCustomer(customer);
|
|
177
|
-
_context2.next = 18;
|
|
178
|
-
return this.store.order.saveDraft();
|
|
179
|
-
case 18:
|
|
180
152
|
return _context2.abrupt("return", sales);
|
|
181
|
-
case
|
|
153
|
+
case 8:
|
|
182
154
|
case "end":
|
|
183
155
|
return _context2.stop();
|
|
184
156
|
}
|
|
@@ -188,188 +160,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
188
160
|
return _loadSalesDetail.apply(this, arguments);
|
|
189
161
|
}
|
|
190
162
|
return loadSalesDetail;
|
|
191
|
-
}())
|
|
192
|
-
}, {
|
|
193
|
-
key: "scanPromotionCode",
|
|
194
|
-
value: function () {
|
|
195
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(code, customerId) {
|
|
196
|
-
var raw;
|
|
197
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
198
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
199
|
-
case 0:
|
|
200
|
-
if (this.store.order) {
|
|
201
|
-
_context3.next = 2;
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
throw new Error('order 模块未初始化');
|
|
205
|
-
case 2:
|
|
206
|
-
_context3.next = 4;
|
|
207
|
-
return this.store.order.scanCode(code, customerId);
|
|
208
|
-
case 4:
|
|
209
|
-
raw = _context3.sent;
|
|
210
|
-
if (!raw.isAvailable) {
|
|
211
|
-
_context3.next = 11;
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
_context3.next = 8;
|
|
215
|
-
return this.hydrateOrderCustomerFromScanDiscounts(raw.scannedDiscountList);
|
|
216
|
-
case 8:
|
|
217
|
-
_context3.next = 10;
|
|
218
|
-
return this.store.order.recalculateSummary({
|
|
219
|
-
createIfMissing: true
|
|
220
|
-
});
|
|
221
|
-
case 10:
|
|
222
|
-
this.store.order.persistTempOrder();
|
|
223
|
-
case 11:
|
|
224
|
-
return _context3.abrupt("return", {
|
|
225
|
-
isAvailable: raw.isAvailable,
|
|
226
|
-
type: raw.type,
|
|
227
|
-
unavailableReason: raw.unavailableReason
|
|
228
|
-
});
|
|
229
|
-
case 12:
|
|
230
|
-
case "end":
|
|
231
|
-
return _context3.stop();
|
|
232
|
-
}
|
|
233
|
-
}, _callee3, this);
|
|
234
|
-
}));
|
|
235
|
-
function scanPromotionCode(_x3, _x4) {
|
|
236
|
-
return _scanPromotionCode.apply(this, arguments);
|
|
237
|
-
}
|
|
238
|
-
return scanPromotionCode;
|
|
239
|
-
}()
|
|
240
|
-
}, {
|
|
241
|
-
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
242
|
-
value: function () {
|
|
243
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(discounts) {
|
|
244
|
-
var currentOrderCustomer, customerId, customer;
|
|
245
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
246
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
247
|
-
case 0:
|
|
248
|
-
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
249
|
-
if (!currentOrderCustomer) {
|
|
250
|
-
_context4.next = 3;
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
return _context4.abrupt("return");
|
|
254
|
-
case 3:
|
|
255
|
-
customerId = this.getDiscountCustomerId(discounts);
|
|
256
|
-
if (customerId) {
|
|
257
|
-
_context4.next = 6;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
return _context4.abrupt("return");
|
|
261
|
-
case 6:
|
|
262
|
-
_context4.next = 8;
|
|
263
|
-
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
264
|
-
case 8:
|
|
265
|
-
customer = _context4.sent;
|
|
266
|
-
if (customer) {
|
|
267
|
-
_context4.next = 11;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
return _context4.abrupt("return");
|
|
271
|
-
case 11:
|
|
272
|
-
this.store.customer.setSelectedCustomer(customer);
|
|
273
|
-
this.setOrderCustomer(customer);
|
|
274
|
-
case 13:
|
|
275
|
-
case "end":
|
|
276
|
-
return _context4.stop();
|
|
277
|
-
}
|
|
278
|
-
}, _callee4, this);
|
|
279
|
-
}));
|
|
280
|
-
function hydrateOrderCustomerFromScanDiscounts(_x5) {
|
|
281
|
-
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
282
|
-
}
|
|
283
|
-
return hydrateOrderCustomerFromScanDiscounts;
|
|
284
|
-
}()
|
|
285
|
-
}, {
|
|
286
|
-
key: "getDiscountCustomerId",
|
|
287
|
-
value: function getDiscountCustomerId(discounts) {
|
|
288
|
-
var discount = discounts.find(function (item) {
|
|
289
|
-
return item.customer_id != null;
|
|
290
|
-
});
|
|
291
|
-
var customerId = Number(discount === null || discount === void 0 ? void 0 : discount.customer_id);
|
|
292
|
-
if (!Number.isFinite(customerId) || customerId <= 0) return null;
|
|
293
|
-
return customerId;
|
|
294
|
-
}
|
|
295
|
-
}, {
|
|
296
|
-
key: "resolveCustomerByDiscountCustomerId",
|
|
297
|
-
value: function () {
|
|
298
|
-
var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(customerId) {
|
|
299
|
-
var _result$list;
|
|
300
|
-
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
|
|
301
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
302
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
303
|
-
case 0:
|
|
304
|
-
localCustomers = this.store.customer.getCustomers();
|
|
305
|
-
localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
306
|
-
normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
|
|
307
|
-
if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
|
|
308
|
-
_context5.next = 5;
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
return _context5.abrupt("return", normalizedLocalCustomer);
|
|
312
|
-
case 5:
|
|
313
|
-
_context5.next = 7;
|
|
314
|
-
return this.store.customer.queryCustomerList({
|
|
315
|
-
ids: [customerId],
|
|
316
|
-
skip: 1,
|
|
317
|
-
num: 1
|
|
318
|
-
});
|
|
319
|
-
case 7:
|
|
320
|
-
result = _context5.sent;
|
|
321
|
-
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
322
|
-
return _context5.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
|
|
323
|
-
case 10:
|
|
324
|
-
case "end":
|
|
325
|
-
return _context5.stop();
|
|
326
|
-
}
|
|
327
|
-
}, _callee5, this);
|
|
328
|
-
}));
|
|
329
|
-
function resolveCustomerByDiscountCustomerId(_x6) {
|
|
330
|
-
return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
|
|
331
|
-
}
|
|
332
|
-
return resolveCustomerByDiscountCustomerId;
|
|
333
163
|
}()
|
|
334
|
-
}, {
|
|
335
|
-
key: "findCustomerById",
|
|
336
|
-
value: function findCustomerById() {
|
|
337
|
-
var _this2 = this;
|
|
338
|
-
var customers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
339
|
-
var customerId = arguments.length > 1 ? arguments[1] : undefined;
|
|
340
|
-
return customers.find(function (customer) {
|
|
341
|
-
var rawId = _this2.getRawCustomerId(customer);
|
|
342
|
-
return rawId !== null && String(rawId) === String(customerId);
|
|
343
|
-
}) || null;
|
|
344
|
-
}
|
|
345
|
-
}, {
|
|
346
|
-
key: "normalizeCustomer",
|
|
347
|
-
value: function normalizeCustomer(customer) {
|
|
348
|
-
var _ref3, _ref4, _customer$phone, _ref5, _customer$email, _ref6, _customer$country_cal;
|
|
349
|
-
var raw = customer;
|
|
350
|
-
var rawId = this.getRawCustomerId(customer);
|
|
351
|
-
var name = customer.name || raw.display_name || raw.nickname || raw.customer_name || [raw.first_name, raw.last_name].filter(Boolean).join(' ') || '';
|
|
352
|
-
return _objectSpread(_objectSpread({}, customer), {}, {
|
|
353
|
-
id: rawId !== null && rawId !== void 0 ? rawId : customer.id,
|
|
354
|
-
name: name,
|
|
355
|
-
phone: (_ref3 = (_ref4 = (_customer$phone = customer.phone) !== null && _customer$phone !== void 0 ? _customer$phone : raw.phone) !== null && _ref4 !== void 0 ? _ref4 : raw.mobile) !== null && _ref3 !== void 0 ? _ref3 : '',
|
|
356
|
-
email: (_ref5 = (_customer$email = customer.email) !== null && _customer$email !== void 0 ? _customer$email : raw.email) !== null && _ref5 !== void 0 ? _ref5 : '',
|
|
357
|
-
country_calling_code: (_ref6 = (_customer$country_cal = customer.country_calling_code) !== null && _customer$country_cal !== void 0 ? _customer$country_cal : raw.country_calling_code) !== null && _ref6 !== void 0 ? _ref6 : ''
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
}, {
|
|
361
|
-
key: "getRawCustomerId",
|
|
362
|
-
value: function getRawCustomerId(customer) {
|
|
363
|
-
var _ref7, _ref8, _customer$id;
|
|
364
|
-
var raw = customer;
|
|
365
|
-
return (_ref7 = (_ref8 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref8 !== void 0 ? _ref8 : raw.customerId) !== null && _ref7 !== void 0 ? _ref7 : null;
|
|
366
|
-
}
|
|
367
|
-
}, {
|
|
368
|
-
key: "hasUsableCustomerDetails",
|
|
369
|
-
value: function hasUsableCustomerDetails(customer) {
|
|
370
|
-
return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
164
|
/**
|
|
374
165
|
* 更新当前预约的 appointment_status。
|
|
375
166
|
*
|
|
@@ -384,65 +175,66 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
384
175
|
* @param status 目标状态(如 'confirmed')
|
|
385
176
|
* @returns 接口返回的 data
|
|
386
177
|
*/
|
|
178
|
+
)
|
|
387
179
|
}, {
|
|
388
180
|
key: "setBookingStatus",
|
|
389
181
|
value: (function () {
|
|
390
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
182
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(status) {
|
|
391
183
|
var _this$store$order, _this$store$order$get;
|
|
392
184
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
393
|
-
return _regeneratorRuntime().wrap(function
|
|
394
|
-
while (1) switch (
|
|
185
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
186
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
395
187
|
case 0:
|
|
396
188
|
tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
397
189
|
if (tempOrder) {
|
|
398
|
-
|
|
190
|
+
_context3.next = 3;
|
|
399
191
|
break;
|
|
400
192
|
}
|
|
401
193
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
402
194
|
case 3:
|
|
403
195
|
orderId = tempOrder.order_id;
|
|
404
196
|
if (!(orderId === undefined || orderId === null)) {
|
|
405
|
-
|
|
197
|
+
_context3.next = 6;
|
|
406
198
|
break;
|
|
407
199
|
}
|
|
408
200
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
409
201
|
case 6:
|
|
410
202
|
scheduleId = resolveScheduleId(tempOrder);
|
|
411
203
|
if (!(scheduleId === null)) {
|
|
412
|
-
|
|
204
|
+
_context3.next = 9;
|
|
413
205
|
break;
|
|
414
206
|
}
|
|
415
207
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
416
208
|
case 9:
|
|
417
209
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
418
210
|
previous = applyBookingsStatus(bookings, status);
|
|
419
|
-
|
|
420
|
-
|
|
211
|
+
_context3.prev = 11;
|
|
212
|
+
_context3.next = 14;
|
|
421
213
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
422
214
|
appointment_status: status
|
|
423
215
|
});
|
|
424
216
|
case 14:
|
|
425
|
-
res =
|
|
426
|
-
|
|
217
|
+
res = _context3.sent;
|
|
218
|
+
_context3.next = 17;
|
|
427
219
|
return this.refreshSalesDetail();
|
|
428
220
|
case 17:
|
|
429
221
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
430
222
|
orderId: orderId,
|
|
431
223
|
status: status
|
|
432
224
|
});
|
|
433
|
-
return
|
|
225
|
+
return _context3.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
434
226
|
case 21:
|
|
435
|
-
|
|
436
|
-
|
|
227
|
+
_context3.prev = 21;
|
|
228
|
+
_context3.t0 = _context3["catch"](11);
|
|
437
229
|
restoreBookingsStatus(bookings, previous);
|
|
438
|
-
throw
|
|
230
|
+
throw _context3.t0;
|
|
439
231
|
case 25:
|
|
440
232
|
case "end":
|
|
441
|
-
return
|
|
233
|
+
return _context3.stop();
|
|
442
234
|
}
|
|
443
|
-
},
|
|
235
|
+
}, _callee3, this, [[11, 21]]);
|
|
444
236
|
}));
|
|
445
|
-
function setBookingStatus(
|
|
237
|
+
function setBookingStatus(_x3) {
|
|
446
238
|
return _setBookingStatus.apply(this, arguments);
|
|
447
239
|
}
|
|
448
240
|
return setBookingStatus;
|
|
@@ -461,35 +253,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
461
253
|
}, {
|
|
462
254
|
key: "refreshSalesDetail",
|
|
463
255
|
value: (function () {
|
|
464
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
256
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
465
257
|
var _this$store$order2, _this$store$order2$ge;
|
|
466
258
|
var tempOrder, orderId;
|
|
467
|
-
return _regeneratorRuntime().wrap(function
|
|
468
|
-
while (1) switch (
|
|
259
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
260
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
469
261
|
case 0:
|
|
470
262
|
tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
471
263
|
if (tempOrder) {
|
|
472
|
-
|
|
264
|
+
_context4.next = 3;
|
|
473
265
|
break;
|
|
474
266
|
}
|
|
475
267
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
476
268
|
case 3:
|
|
477
269
|
orderId = tempOrder.order_id;
|
|
478
270
|
if (!(orderId === undefined || orderId === null)) {
|
|
479
|
-
|
|
271
|
+
_context4.next = 6;
|
|
480
272
|
break;
|
|
481
273
|
}
|
|
482
274
|
throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
|
|
483
275
|
case 6:
|
|
484
|
-
return
|
|
276
|
+
return _context4.abrupt("return", this.loadSalesDetail({
|
|
485
277
|
orderId: Number(orderId),
|
|
486
278
|
forceRemote: true
|
|
487
279
|
}));
|
|
488
280
|
case 7:
|
|
489
281
|
case "end":
|
|
490
|
-
return
|
|
282
|
+
return _context4.stop();
|
|
491
283
|
}
|
|
492
|
-
},
|
|
284
|
+
}, _callee4, this);
|
|
493
285
|
}));
|
|
494
286
|
function refreshSalesDetail() {
|
|
495
287
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -505,50 +297,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
505
297
|
}, {
|
|
506
298
|
key: "loadProducts",
|
|
507
299
|
value: (function () {
|
|
508
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
300
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
509
301
|
var params,
|
|
510
302
|
options,
|
|
511
303
|
schedule_date,
|
|
512
304
|
customer_id,
|
|
513
305
|
menu_list_ids,
|
|
514
306
|
schedule_datetime,
|
|
515
|
-
bookingDate,
|
|
516
307
|
_result,
|
|
517
|
-
|
|
518
|
-
return _regeneratorRuntime().wrap(function
|
|
519
|
-
while (1) switch (
|
|
308
|
+
_args5 = arguments;
|
|
309
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
310
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
520
311
|
case 0:
|
|
521
|
-
params =
|
|
522
|
-
options =
|
|
523
|
-
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
if (bookingDate) {
|
|
527
|
-
this.setBookingDate(bookingDate);
|
|
528
|
-
}
|
|
529
|
-
_context8.prev = 5;
|
|
530
|
-
_context8.next = 8;
|
|
312
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
313
|
+
options = _args5.length > 1 ? _args5[1] : undefined;
|
|
314
|
+
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
|
|
315
|
+
_context5.prev = 3;
|
|
316
|
+
_context5.next = 6;
|
|
531
317
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
532
318
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
533
319
|
with_schedule: 1
|
|
534
320
|
}, params), {}, {
|
|
535
321
|
cacheId: this.cacheId
|
|
536
322
|
}), options);
|
|
537
|
-
case
|
|
538
|
-
_result =
|
|
323
|
+
case 6:
|
|
324
|
+
_result = _context5.sent;
|
|
539
325
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
540
326
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
541
|
-
return
|
|
542
|
-
case
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
console.error('Failed to load products:',
|
|
546
|
-
throw
|
|
547
|
-
case
|
|
327
|
+
return _context5.abrupt("return", _result);
|
|
328
|
+
case 12:
|
|
329
|
+
_context5.prev = 12;
|
|
330
|
+
_context5.t0 = _context5["catch"](3);
|
|
331
|
+
console.error('Failed to load products:', _context5.t0);
|
|
332
|
+
throw _context5.t0;
|
|
333
|
+
case 16:
|
|
548
334
|
case "end":
|
|
549
|
-
return
|
|
335
|
+
return _context5.stop();
|
|
550
336
|
}
|
|
551
|
-
},
|
|
337
|
+
}, _callee5, this, [[3, 12]]);
|
|
552
338
|
}));
|
|
553
339
|
function loadProducts() {
|
|
554
340
|
return _loadProducts.apply(this, arguments);
|
|
@@ -563,28 +349,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
563
349
|
}, {
|
|
564
350
|
key: "loadProductDetail",
|
|
565
351
|
value: (function () {
|
|
566
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
352
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params, options) {
|
|
567
353
|
var product_id, queryParams, products;
|
|
568
|
-
return _regeneratorRuntime().wrap(function
|
|
569
|
-
while (1) switch (
|
|
354
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
355
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
570
356
|
case 0:
|
|
571
357
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
572
|
-
|
|
358
|
+
_context6.next = 3;
|
|
573
359
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
574
360
|
product_ids: [product_id]
|
|
575
361
|
}), options);
|
|
576
362
|
case 3:
|
|
577
|
-
products =
|
|
578
|
-
return
|
|
363
|
+
products = _context6.sent;
|
|
364
|
+
return _context6.abrupt("return", products.find(function (product) {
|
|
579
365
|
return Number(product.id) === Number(product_id);
|
|
580
366
|
}));
|
|
581
367
|
case 5:
|
|
582
368
|
case "end":
|
|
583
|
-
return
|
|
369
|
+
return _context6.stop();
|
|
584
370
|
}
|
|
585
|
-
},
|
|
371
|
+
}, _callee6, this);
|
|
586
372
|
}));
|
|
587
|
-
function loadProductDetail(
|
|
373
|
+
function loadProductDetail(_x4, _x5) {
|
|
588
374
|
return _loadProductDetail.apply(this, arguments);
|
|
589
375
|
}
|
|
590
376
|
return loadProductDetail;
|
|
@@ -617,16 +403,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
617
403
|
}, {
|
|
618
404
|
key: "getProducts",
|
|
619
405
|
value: (function () {
|
|
620
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
621
|
-
return _regeneratorRuntime().wrap(function
|
|
622
|
-
while (1) switch (
|
|
406
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
408
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
623
409
|
case 0:
|
|
624
|
-
return
|
|
410
|
+
return _context7.abrupt("return", this.store.products.getProducts());
|
|
625
411
|
case 1:
|
|
626
412
|
case "end":
|
|
627
|
-
return
|
|
413
|
+
return _context7.stop();
|
|
628
414
|
}
|
|
629
|
-
},
|
|
415
|
+
}, _callee7, this);
|
|
630
416
|
}));
|
|
631
417
|
function getProducts() {
|
|
632
418
|
return _getProducts.apply(this, arguments);
|
|
@@ -679,18 +465,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
679
465
|
}, {
|
|
680
466
|
key: "getProductByIds",
|
|
681
467
|
value: (function () {
|
|
682
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
683
|
-
return _regeneratorRuntime().wrap(function
|
|
684
|
-
while (1) switch (
|
|
468
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids) {
|
|
469
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
470
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
685
471
|
case 0:
|
|
686
|
-
return
|
|
472
|
+
return _context8.abrupt("return", this.store.products.getProductByIds(ids));
|
|
687
473
|
case 1:
|
|
688
474
|
case "end":
|
|
689
|
-
return
|
|
475
|
+
return _context8.stop();
|
|
690
476
|
}
|
|
691
|
-
},
|
|
477
|
+
}, _callee8, this);
|
|
692
478
|
}));
|
|
693
|
-
function getProductByIds(
|
|
479
|
+
function getProductByIds(_x6) {
|
|
694
480
|
return _getProductByIds.apply(this, arguments);
|
|
695
481
|
}
|
|
696
482
|
return getProductByIds;
|
|
@@ -704,27 +490,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
704
490
|
}, {
|
|
705
491
|
key: "getScheduleTimePoints",
|
|
706
492
|
value: (function () {
|
|
707
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
493
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
708
494
|
var result;
|
|
709
|
-
return _regeneratorRuntime().wrap(function
|
|
710
|
-
while (1) switch (
|
|
495
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
496
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
711
497
|
case 0:
|
|
712
|
-
|
|
498
|
+
_context9.next = 2;
|
|
713
499
|
return this.request.post('/menu/schedule-time-points', {
|
|
714
500
|
menu_list_ids: params.menu_list_ids
|
|
715
501
|
}, {
|
|
716
502
|
osServer: true
|
|
717
503
|
});
|
|
718
504
|
case 2:
|
|
719
|
-
result =
|
|
720
|
-
return
|
|
505
|
+
result = _context9.sent;
|
|
506
|
+
return _context9.abrupt("return", result.data || []);
|
|
721
507
|
case 4:
|
|
722
508
|
case "end":
|
|
723
|
-
return
|
|
509
|
+
return _context9.stop();
|
|
724
510
|
}
|
|
725
|
-
},
|
|
511
|
+
}, _callee9, this);
|
|
726
512
|
}));
|
|
727
|
-
function getScheduleTimePoints(
|
|
513
|
+
function getScheduleTimePoints(_x7) {
|
|
728
514
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
729
515
|
}
|
|
730
516
|
return getScheduleTimePoints;
|
|
@@ -738,30 +524,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
738
524
|
}, {
|
|
739
525
|
key: "getCustomerList",
|
|
740
526
|
value: (function () {
|
|
741
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
527
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
742
528
|
var params,
|
|
743
529
|
_result2,
|
|
744
|
-
|
|
745
|
-
return _regeneratorRuntime().wrap(function
|
|
746
|
-
while (1) switch (
|
|
530
|
+
_args10 = arguments;
|
|
531
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
532
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
747
533
|
case 0:
|
|
748
|
-
params =
|
|
749
|
-
|
|
750
|
-
|
|
534
|
+
params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
535
|
+
_context10.prev = 1;
|
|
536
|
+
_context10.next = 4;
|
|
751
537
|
return this.store.customer.getCustomerList(params);
|
|
752
538
|
case 4:
|
|
753
|
-
_result2 =
|
|
754
|
-
return
|
|
539
|
+
_result2 = _context10.sent;
|
|
540
|
+
return _context10.abrupt("return", _result2);
|
|
755
541
|
case 8:
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
console.error('Failed to get customer list:',
|
|
759
|
-
throw
|
|
542
|
+
_context10.prev = 8;
|
|
543
|
+
_context10.t0 = _context10["catch"](1);
|
|
544
|
+
console.error('Failed to get customer list:', _context10.t0);
|
|
545
|
+
throw _context10.t0;
|
|
760
546
|
case 12:
|
|
761
547
|
case "end":
|
|
762
|
-
return
|
|
548
|
+
return _context10.stop();
|
|
763
549
|
}
|
|
764
|
-
},
|
|
550
|
+
}, _callee10, this, [[1, 8]]);
|
|
765
551
|
}));
|
|
766
552
|
function getCustomerList() {
|
|
767
553
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -868,25 +654,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
868
654
|
}, {
|
|
869
655
|
key: "setOrderCustomer",
|
|
870
656
|
value: function setOrderCustomer(customer) {
|
|
871
|
-
var _this$store$order$get3;
|
|
872
657
|
if (!customer) {
|
|
873
658
|
this.clearOrderCustomer();
|
|
874
659
|
return;
|
|
875
660
|
}
|
|
876
|
-
var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
|
|
877
661
|
var patch = formatOrderCustomerPatch(customer);
|
|
878
|
-
if (Number(previousCustomerId || 0) !== Number(patch.customer_id || 0)) {
|
|
879
|
-
this.discountConfigCacheKey = null;
|
|
880
|
-
this.hasManualDiscountSelection = false;
|
|
881
|
-
}
|
|
882
662
|
this.store.order.setOrderCustomer(patch, customer);
|
|
883
663
|
var next = this.buildOrderCustomerPayload();
|
|
884
664
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
885
|
-
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
886
|
-
// 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
|
|
887
|
-
void this.store.order.applyPromotion().catch(function (error) {
|
|
888
|
-
console.error('[BookingTicket] applyPromotion after customer change failed', error);
|
|
889
|
-
});
|
|
890
665
|
}
|
|
891
666
|
|
|
892
667
|
/**
|
|
@@ -913,63 +688,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
913
688
|
}, {
|
|
914
689
|
key: "clearOrderCustomer",
|
|
915
690
|
value: function clearOrderCustomer() {
|
|
916
|
-
var _discountModule$setOr,
|
|
917
|
-
_discountModule$setDi,
|
|
918
|
-
_this3 = this;
|
|
919
691
|
this.store.order.clearOrderCustomer();
|
|
920
|
-
this.discountConfigCacheKey = null;
|
|
921
|
-
this.hasManualDiscountSelection = false;
|
|
922
|
-
var orderStore = this.store.order.store || {};
|
|
923
|
-
var discountModule = orderStore.discount;
|
|
924
|
-
void (discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, []));
|
|
925
|
-
void (discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []));
|
|
926
|
-
this.store.order.applyDiscount();
|
|
927
|
-
void this.store.order.recalculateSummary({
|
|
928
|
-
createIfMissing: true
|
|
929
|
-
}).then(function () {
|
|
930
|
-
return _this3.store.order.persistTempOrder();
|
|
931
|
-
}).catch(function (error) {
|
|
932
|
-
console.error('Failed to recalculate summary after clearing customer:', error);
|
|
933
|
-
});
|
|
934
692
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
|
|
935
693
|
}
|
|
936
694
|
|
|
937
|
-
/**
|
|
938
|
-
* 重置 tempOrder,并同步清空下单客户运行态。
|
|
939
|
-
*
|
|
940
|
-
* OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
|
|
941
|
-
* - emit BookingTicket `onOrderCustomerChange`
|
|
942
|
-
* - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
|
|
943
|
-
*
|
|
944
|
-
* 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
|
|
945
|
-
*/
|
|
946
|
-
}, {
|
|
947
|
-
key: "restoreOrder",
|
|
948
|
-
value: (function () {
|
|
949
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
950
|
-
var _this$store$customer;
|
|
951
|
-
var tempOrder;
|
|
952
|
-
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
953
|
-
while (1) switch (_context14.prev = _context14.next) {
|
|
954
|
-
case 0:
|
|
955
|
-
_context14.next = 2;
|
|
956
|
-
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
957
|
-
case 2:
|
|
958
|
-
tempOrder = _context14.sent;
|
|
959
|
-
this.clearOrderCustomer();
|
|
960
|
-
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
961
|
-
return _context14.abrupt("return", tempOrder);
|
|
962
|
-
case 6:
|
|
963
|
-
case "end":
|
|
964
|
-
return _context14.stop();
|
|
965
|
-
}
|
|
966
|
-
}, _callee14, this);
|
|
967
|
-
}));
|
|
968
|
-
function restoreOrder() {
|
|
969
|
-
return _restoreOrder.apply(this, arguments);
|
|
970
|
-
}
|
|
971
|
-
return restoreOrder;
|
|
972
|
-
}() /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */)
|
|
695
|
+
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
973
696
|
}, {
|
|
974
697
|
key: "buildOrderCustomerPayload",
|
|
975
698
|
value: function buildOrderCustomerPayload() {
|
|
@@ -980,56 +703,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
980
703
|
snapshot: this.store.order.getOrderCustomerSnapshot()
|
|
981
704
|
};
|
|
982
705
|
}
|
|
983
|
-
}, {
|
|
984
|
-
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
985
|
-
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
986
|
-
var _this4 = this;
|
|
987
|
-
if (!customerId || customerId === 1) return;
|
|
988
|
-
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
992
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
993
|
-
var currentCustomer;
|
|
994
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
995
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
996
|
-
case 0:
|
|
997
|
-
if (!previousRefresh) {
|
|
998
|
-
_context15.next = 3;
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
_context15.next = 3;
|
|
1002
|
-
return previousRefresh.catch(function () {
|
|
1003
|
-
return undefined;
|
|
1004
|
-
});
|
|
1005
|
-
case 3:
|
|
1006
|
-
currentCustomer = _this4.store.order.getOrderCustomer();
|
|
1007
|
-
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1008
|
-
_context15.next = 6;
|
|
1009
|
-
break;
|
|
1010
|
-
}
|
|
1011
|
-
return _context15.abrupt("return");
|
|
1012
|
-
case 6:
|
|
1013
|
-
_context15.next = 8;
|
|
1014
|
-
return _this4.loadDiscountConfig({
|
|
1015
|
-
customerId: customerId
|
|
1016
|
-
});
|
|
1017
|
-
case 8:
|
|
1018
|
-
case "end":
|
|
1019
|
-
return _context15.stop();
|
|
1020
|
-
}
|
|
1021
|
-
}, _callee15);
|
|
1022
|
-
}))();
|
|
1023
|
-
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1024
|
-
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
1025
|
-
refreshTask.catch(function (error) {
|
|
1026
|
-
console.error('Failed to load discount config after customer change:', error);
|
|
1027
|
-
}).finally(function () {
|
|
1028
|
-
if (_this4.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
1029
|
-
_this4.orderCustomerDiscountRefreshInFlight = null;
|
|
1030
|
-
_this4.orderCustomerDiscountRefreshCustomerId = null;
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
706
|
|
|
1034
707
|
/**
|
|
1035
708
|
* 获取客户分页信息
|
|
@@ -1071,29 +744,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1071
744
|
}, {
|
|
1072
745
|
key: "changeCustomerPage",
|
|
1073
746
|
value: (function () {
|
|
1074
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
747
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(page, pageSize) {
|
|
1075
748
|
var _result3;
|
|
1076
|
-
return _regeneratorRuntime().wrap(function
|
|
1077
|
-
while (1) switch (
|
|
749
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
750
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1078
751
|
case 0:
|
|
1079
|
-
|
|
1080
|
-
|
|
752
|
+
_context11.prev = 0;
|
|
753
|
+
_context11.next = 3;
|
|
1081
754
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
1082
755
|
case 3:
|
|
1083
|
-
_result3 =
|
|
1084
|
-
return
|
|
756
|
+
_result3 = _context11.sent;
|
|
757
|
+
return _context11.abrupt("return", _result3);
|
|
1085
758
|
case 7:
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
console.error('Failed to change customer page:',
|
|
1089
|
-
throw
|
|
759
|
+
_context11.prev = 7;
|
|
760
|
+
_context11.t0 = _context11["catch"](0);
|
|
761
|
+
console.error('Failed to change customer page:', _context11.t0);
|
|
762
|
+
throw _context11.t0;
|
|
1090
763
|
case 11:
|
|
1091
764
|
case "end":
|
|
1092
|
-
return
|
|
765
|
+
return _context11.stop();
|
|
1093
766
|
}
|
|
1094
|
-
},
|
|
767
|
+
}, _callee11, this, [[0, 7]]);
|
|
1095
768
|
}));
|
|
1096
|
-
function changeCustomerPage(
|
|
769
|
+
function changeCustomerPage(_x8, _x9) {
|
|
1097
770
|
return _changeCustomerPage.apply(this, arguments);
|
|
1098
771
|
}
|
|
1099
772
|
return changeCustomerPage;
|
|
@@ -1106,28 +779,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1106
779
|
}, {
|
|
1107
780
|
key: "loadMoreCustomers",
|
|
1108
781
|
value: (function () {
|
|
1109
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
782
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1110
783
|
var _result4;
|
|
1111
|
-
return _regeneratorRuntime().wrap(function
|
|
1112
|
-
while (1) switch (
|
|
784
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
785
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1113
786
|
case 0:
|
|
1114
|
-
|
|
1115
|
-
|
|
787
|
+
_context12.prev = 0;
|
|
788
|
+
_context12.next = 3;
|
|
1116
789
|
return this.store.customer.loadMoreCustomers();
|
|
1117
790
|
case 3:
|
|
1118
|
-
_result4 =
|
|
791
|
+
_result4 = _context12.sent;
|
|
1119
792
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
|
|
1120
|
-
return
|
|
793
|
+
return _context12.abrupt("return", _result4);
|
|
1121
794
|
case 8:
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
console.error('Failed to load more customers:',
|
|
1125
|
-
throw
|
|
795
|
+
_context12.prev = 8;
|
|
796
|
+
_context12.t0 = _context12["catch"](0);
|
|
797
|
+
console.error('Failed to load more customers:', _context12.t0);
|
|
798
|
+
throw _context12.t0;
|
|
1126
799
|
case 12:
|
|
1127
800
|
case "end":
|
|
1128
|
-
return
|
|
801
|
+
return _context12.stop();
|
|
1129
802
|
}
|
|
1130
|
-
},
|
|
803
|
+
}, _callee12, this, [[0, 8]]);
|
|
1131
804
|
}));
|
|
1132
805
|
function loadMoreCustomers() {
|
|
1133
806
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -1143,31 +816,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1143
816
|
}, {
|
|
1144
817
|
key: "resetAndLoadCustomers",
|
|
1145
818
|
value: (function () {
|
|
1146
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
819
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1147
820
|
var params,
|
|
1148
821
|
_result5,
|
|
1149
|
-
|
|
1150
|
-
return _regeneratorRuntime().wrap(function
|
|
1151
|
-
while (1) switch (
|
|
822
|
+
_args13 = arguments;
|
|
823
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
824
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1152
825
|
case 0:
|
|
1153
|
-
params =
|
|
1154
|
-
|
|
1155
|
-
|
|
826
|
+
params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
827
|
+
_context13.prev = 1;
|
|
828
|
+
_context13.next = 4;
|
|
1156
829
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
1157
830
|
case 4:
|
|
1158
|
-
_result5 =
|
|
831
|
+
_result5 = _context13.sent;
|
|
1159
832
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
|
|
1160
|
-
return
|
|
833
|
+
return _context13.abrupt("return", _result5);
|
|
1161
834
|
case 9:
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
console.error('Failed to reset and load customers:',
|
|
1165
|
-
throw
|
|
835
|
+
_context13.prev = 9;
|
|
836
|
+
_context13.t0 = _context13["catch"](1);
|
|
837
|
+
console.error('Failed to reset and load customers:', _context13.t0);
|
|
838
|
+
throw _context13.t0;
|
|
1166
839
|
case 13:
|
|
1167
840
|
case "end":
|
|
1168
|
-
return
|
|
841
|
+
return _context13.stop();
|
|
1169
842
|
}
|
|
1170
|
-
},
|
|
843
|
+
}, _callee13, this, [[1, 9]]);
|
|
1171
844
|
}));
|
|
1172
845
|
function resetAndLoadCustomers() {
|
|
1173
846
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -1212,9 +885,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1212
885
|
}, {
|
|
1213
886
|
key: "scanGlobalListener",
|
|
1214
887
|
value: function scanGlobalListener(callback) {
|
|
1215
|
-
var
|
|
888
|
+
var _this2 = this;
|
|
1216
889
|
var localSearch = function localSearch(v) {
|
|
1217
|
-
return
|
|
890
|
+
return _this2.store.products.findProductsByCodeOrBarcode(v);
|
|
1218
891
|
};
|
|
1219
892
|
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
1220
893
|
var safeCallback = function safeCallback(d) {
|
|
@@ -1329,15 +1002,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1329
1002
|
}, {
|
|
1330
1003
|
key: "setOtherParams",
|
|
1331
1004
|
value: (function () {
|
|
1332
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1005
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1006
|
+
var _ref2,
|
|
1007
|
+
_ref2$cover,
|
|
1335
1008
|
cover,
|
|
1336
|
-
|
|
1337
|
-
return _regeneratorRuntime().wrap(function
|
|
1338
|
-
while (1) switch (
|
|
1009
|
+
_args14 = arguments;
|
|
1010
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1011
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1339
1012
|
case 0:
|
|
1340
|
-
|
|
1013
|
+
_ref2 = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {}, _ref2$cover = _ref2.cover, cover = _ref2$cover === void 0 ? false : _ref2$cover;
|
|
1341
1014
|
if (cover) {
|
|
1342
1015
|
this.otherParams = params;
|
|
1343
1016
|
} else {
|
|
@@ -1345,11 +1018,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1345
1018
|
}
|
|
1346
1019
|
case 2:
|
|
1347
1020
|
case "end":
|
|
1348
|
-
return
|
|
1021
|
+
return _context14.stop();
|
|
1349
1022
|
}
|
|
1350
|
-
},
|
|
1023
|
+
}, _callee14, this);
|
|
1351
1024
|
}));
|
|
1352
|
-
function setOtherParams(
|
|
1025
|
+
function setOtherParams(_x10) {
|
|
1353
1026
|
return _setOtherParams.apply(this, arguments);
|
|
1354
1027
|
}
|
|
1355
1028
|
return setOtherParams;
|
|
@@ -1362,299 +1035,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1362
1035
|
}, {
|
|
1363
1036
|
key: "getOtherParams",
|
|
1364
1037
|
value: (function () {
|
|
1365
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1366
|
-
return _regeneratorRuntime().wrap(function
|
|
1367
|
-
while (1) switch (
|
|
1038
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1039
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1040
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1368
1041
|
case 0:
|
|
1369
|
-
return
|
|
1042
|
+
return _context15.abrupt("return", this.otherParams);
|
|
1370
1043
|
case 1:
|
|
1371
1044
|
case "end":
|
|
1372
|
-
return
|
|
1045
|
+
return _context15.stop();
|
|
1373
1046
|
}
|
|
1374
|
-
},
|
|
1047
|
+
}, _callee15, this);
|
|
1375
1048
|
}));
|
|
1376
1049
|
function getOtherParams() {
|
|
1377
1050
|
return _getOtherParams.apply(this, arguments);
|
|
1378
1051
|
}
|
|
1379
1052
|
return getOtherParams;
|
|
1380
|
-
}() // ─── BookingContext API(透传给 BookingContextModule) ──────────────────────
|
|
1381
|
-
// SalesSdkProvider 挂载时默认调 initBookingContext;也可由 UI 显式 set* 灌入已有数据。
|
|
1382
|
-
/** 拉取 board config 并写入 BookingContext。 */
|
|
1383
|
-
)
|
|
1384
|
-
}, {
|
|
1385
|
-
key: "loadBookingConfig",
|
|
1386
|
-
value: function loadBookingConfig(params) {
|
|
1387
|
-
return this.store.bookingContext.loadBookingConfig(params);
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
/** 拉取资源全集并写入 BookingContext。 */
|
|
1391
|
-
}, {
|
|
1392
|
-
key: "loadBookingResources",
|
|
1393
|
-
value: function loadBookingResources(params) {
|
|
1394
|
-
return this.store.bookingContext.loadResources(params);
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
/** 初始化 BookingContext(date + config + resources)。 */
|
|
1398
|
-
}, {
|
|
1399
|
-
key: "initBookingContext",
|
|
1400
|
-
value: function initBookingContext(params) {
|
|
1401
|
-
return this.store.bookingContext.initBookingContext(params);
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
/** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
|
|
1405
|
-
}, {
|
|
1406
|
-
key: "isBookingContextReady",
|
|
1407
|
-
value: function isBookingContextReady(params) {
|
|
1408
|
-
return this.store.bookingContext.isBookingContextReady(params);
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
/** 写入 booking config(来源:`/core/board/management/config`)。 */
|
|
1412
|
-
}, {
|
|
1413
|
-
key: "setBookingConfig",
|
|
1414
|
-
value: function setBookingConfig(config) {
|
|
1415
|
-
this.store.bookingContext.setBookingConfig(config);
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
/** 读取当前 booking config。 */
|
|
1419
|
-
}, {
|
|
1420
|
-
key: "getBookingConfig",
|
|
1421
|
-
value: function getBookingConfig() {
|
|
1422
|
-
return this.store.bookingContext.getBookingConfig();
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
1426
|
-
}, {
|
|
1427
|
-
key: "setResources",
|
|
1428
|
-
value: function setResources(resources) {
|
|
1429
|
-
this.store.bookingContext.setResources(resources);
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/** 读取资源全集(浅克隆)。 */
|
|
1433
|
-
}, {
|
|
1434
|
-
key: "getResourcesOrigin",
|
|
1435
|
-
value: function getResourcesOrigin() {
|
|
1436
|
-
return this.store.bookingContext.getResourcesOrigin();
|
|
1437
|
-
}
|
|
1438
|
-
|
|
1439
|
-
/** 读取资源全集 map(id → resource)。 */
|
|
1440
|
-
}, {
|
|
1441
|
-
key: "getResourcesOriginMap",
|
|
1442
|
-
value: function getResourcesOriginMap() {
|
|
1443
|
-
return this.store.bookingContext.getResourcesOriginMap();
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
/** 写入当前选择的日期;支持 dayjs / Date / string。 */
|
|
1447
|
-
}, {
|
|
1448
|
-
key: "setBookingDate",
|
|
1449
|
-
value: function setBookingDate(date) {
|
|
1450
|
-
this.store.bookingContext.setDate(date);
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
/** 读取当前选择的日期(统一 string)。 */
|
|
1454
|
-
}, {
|
|
1455
|
-
key: "getBookingDate",
|
|
1456
|
-
value: function getBookingDate() {
|
|
1457
|
-
return this.store.bookingContext.getDate();
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
/** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
|
|
1461
|
-
}, {
|
|
1462
|
-
key: "getBookingContextState",
|
|
1463
|
-
value: function getBookingContextState() {
|
|
1464
|
-
return this.store.bookingContext.getState();
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
/** 清空 BookingContext(切租户 / destroy 场景)。 */
|
|
1468
|
-
}, {
|
|
1469
|
-
key: "clearBookingContext",
|
|
1470
|
-
value: function clearBookingContext() {
|
|
1471
|
-
this.store.bookingContext.clear();
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
|
|
1476
|
-
*/
|
|
1477
|
-
}, {
|
|
1478
|
-
key: "buildBookingCalcContext",
|
|
1479
|
-
value: function buildBookingCalcContext(extra) {
|
|
1480
|
-
var _extra$date, _extra$presetStartTim;
|
|
1481
|
-
var state = this.store.bookingContext.getState();
|
|
1482
|
-
var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
|
|
1483
|
-
return _objectSpread({
|
|
1484
|
-
bookingConfig: state.bookingConfig,
|
|
1485
|
-
resourcesOrigin: state.resourcesOrigin,
|
|
1486
|
-
resourcesOriginMap: state.resourcesOriginMap,
|
|
1487
|
-
date: date,
|
|
1488
|
-
presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
|
|
1489
|
-
}, extra || {});
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
/**
|
|
1493
|
-
* 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
|
|
1494
|
-
* `extraResources` 用于把拖入未绑定的资源也展示出来。
|
|
1495
|
-
*/
|
|
1496
|
-
}, {
|
|
1497
|
-
key: "getResourcesForProduct",
|
|
1498
|
-
value: function getResourcesForProduct(product, options) {
|
|
1499
|
-
var _ctx$bookingConfig;
|
|
1500
|
-
var ctx = this.buildBookingCalcContext();
|
|
1501
|
-
return getResourceByIdsUtil(ctx.resourcesOriginMap || {}, product, {
|
|
1502
|
-
resourceTab: (_ctx$bookingConfig = ctx.bookingConfig) === null || _ctx$bookingConfig === void 0 || (_ctx$bookingConfig = _ctx$bookingConfig.config) === null || _ctx$bookingConfig === void 0 ? void 0 : _ctx$bookingConfig.resource_tab,
|
|
1503
|
-
resourcesOrigin: ctx.resourcesOrigin,
|
|
1504
|
-
extraResources: (options === null || options === void 0 ? void 0 : options.extraResources) || []
|
|
1505
|
-
});
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
/**
|
|
1509
|
-
* 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
|
|
1510
|
-
*/
|
|
1511
|
-
}, {
|
|
1512
|
-
key: "getProductExtend",
|
|
1513
|
-
value: function getProductExtend(cacheItem, extra) {
|
|
1514
|
-
return getProductExtendUtil({
|
|
1515
|
-
cacheItem: cacheItem,
|
|
1516
|
-
ctx: this.buildBookingCalcContext(extra)
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
|
|
1522
|
-
*/
|
|
1523
|
-
}, {
|
|
1524
|
-
key: "getResourceErrors",
|
|
1525
|
-
value: function getResourceErrors(resource, cacheItem) {
|
|
1526
|
-
return getResourceErrorsUtil(resource, cacheItem);
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
// ─── addProduct 决策 / 转换 API(SDK 加车下沉所需) ─────────────────────────
|
|
1530
|
-
// 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
|
|
1531
|
-
// 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
|
|
1532
|
-
// 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
|
|
1533
|
-
|
|
1534
|
-
/**
|
|
1535
|
-
* 拼装 addProductDecision 通用上下文(从 store 自取)。
|
|
1536
|
-
*/
|
|
1537
|
-
}, {
|
|
1538
|
-
key: "buildAddProductCtx",
|
|
1539
|
-
value: function buildAddProductCtx(extra) {
|
|
1540
|
-
var _extra$date2, _ref11, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
|
|
1541
|
-
var bookingContextState = this.store.bookingContext.getState();
|
|
1542
|
-
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
1543
|
-
var orderCustomerId = (_ref11 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref11 !== void 0 ? _ref11 : undefined;
|
|
1544
|
-
return _objectSpread({
|
|
1545
|
-
bookingConfig: bookingContextState.bookingConfig,
|
|
1546
|
-
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
1547
|
-
resourcesOriginMap: bookingContextState.resourcesOriginMap,
|
|
1548
|
-
date: date,
|
|
1549
|
-
presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
|
|
1550
|
-
customerId: orderCustomerId
|
|
1551
|
-
}, extra || {});
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
/**
|
|
1555
|
-
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
1556
|
-
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
1557
|
-
*/
|
|
1558
|
-
}, {
|
|
1559
|
-
key: "decideAddProduct",
|
|
1560
|
-
value: function decideAddProduct(item, options) {
|
|
1561
|
-
return decideAddProductUtil(item, this.buildAddProductCtx(options));
|
|
1562
|
-
}
|
|
1563
|
-
|
|
1564
|
-
/** 规格弹窗 callback 后的第二段决策。 */
|
|
1565
|
-
}, {
|
|
1566
|
-
key: "decideAfterDetail",
|
|
1567
|
-
value: function decideAfterDetail(cacheItem, options) {
|
|
1568
|
-
return decideAfterDetailUtil(cacheItem, this.buildAddProductCtx(options));
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
/**
|
|
1572
|
-
* @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
|
|
1573
|
-
*/
|
|
1574
|
-
}, {
|
|
1575
|
-
key: "decideAutoClose",
|
|
1576
|
-
value: function decideAutoClose(item, options) {
|
|
1577
|
-
return decideAutoCloseUtil(item, this.buildAddProductCtx(options));
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
/** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
|
|
1581
|
-
}, {
|
|
1582
|
-
key: "getIsEject",
|
|
1583
|
-
value: function getIsEject(item) {
|
|
1584
|
-
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
|
|
1585
|
-
return getIsEjectUtil(item, type);
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
/** 仅 session 商品(无 variant/option/package)→ true。 */
|
|
1589
|
-
}, {
|
|
1590
|
-
key: "getIsOnlySession",
|
|
1591
|
-
value: function getIsOnlySession(item) {
|
|
1592
|
-
return getIsOnlySessionUtil(item);
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
/**
|
|
1596
|
-
* 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
|
|
1597
|
-
*/
|
|
1598
|
-
}, {
|
|
1599
|
-
key: "buildRequiresDetailPayload",
|
|
1600
|
-
value: function buildRequiresDetailPayload(item, options) {
|
|
1601
|
-
return _buildRequiresDetailPayload(item, this.buildAddProductCtx(options));
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
/**
|
|
1605
|
-
* 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
|
|
1606
|
-
* 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
|
|
1607
|
-
*/
|
|
1608
|
-
}, {
|
|
1609
|
-
key: "transformDetailToProductAndBooking",
|
|
1610
|
-
value: function transformDetailToProductAndBooking(input) {
|
|
1611
|
-
var item = input.item,
|
|
1612
|
-
preparedCacheItem = input.cacheItem,
|
|
1613
|
-
detailResult = input.detailResult,
|
|
1614
|
-
options = input.options;
|
|
1615
|
-
var ctx = this.buildAddProductCtx(options);
|
|
1616
|
-
var cacheItem = preparedCacheItem || (detailResult ? buildCacheItemFromDetail(item, detailResult, ctx) : buildCacheItemFromCartDetail(item, ctx));
|
|
1617
|
-
return transformDetailToProductAndBookingUtil(cacheItem, ctx);
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
/**
|
|
1621
|
-
* 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
|
|
1622
|
-
* 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
|
|
1623
|
-
*/
|
|
1624
|
-
}, {
|
|
1625
|
-
key: "buildCacheItemFromOrderLine",
|
|
1626
|
-
value: function buildCacheItemFromOrderLine(input) {
|
|
1627
|
-
return buildCacheItemFromOrderLineUtil(input);
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
/**
|
|
1631
|
-
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
1632
|
-
*/
|
|
1633
|
-
}, {
|
|
1634
|
-
key: "buildNormalProductCacheItemFromOrderLine",
|
|
1635
|
-
value: function buildNormalProductCacheItemFromOrderLine(input) {
|
|
1636
|
-
return buildNormalProductCacheItemFromOrderLineUtil(input);
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
/** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
|
|
1640
|
-
}, {
|
|
1641
|
-
key: "updateProductInOrder",
|
|
1642
|
-
value: (function () {
|
|
1643
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1644
|
-
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1645
|
-
while (1) switch (_context21.prev = _context21.next) {
|
|
1646
|
-
case 0:
|
|
1647
|
-
return _context21.abrupt("return", this.updateOrderProduct(params));
|
|
1648
|
-
case 1:
|
|
1649
|
-
case "end":
|
|
1650
|
-
return _context21.stop();
|
|
1651
|
-
}
|
|
1652
|
-
}, _callee21, this);
|
|
1653
|
-
}));
|
|
1654
|
-
function updateProductInOrder(_x15) {
|
|
1655
|
-
return _updateProductInOrder.apply(this, arguments);
|
|
1656
|
-
}
|
|
1657
|
-
return updateProductInOrder;
|
|
1658
1053
|
}()
|
|
1659
1054
|
/**
|
|
1660
1055
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
@@ -1664,12 +1059,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1664
1059
|
}, {
|
|
1665
1060
|
key: "destroy",
|
|
1666
1061
|
value: (function () {
|
|
1667
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1062
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1668
1063
|
var _this$scan;
|
|
1669
|
-
return _regeneratorRuntime().wrap(function
|
|
1670
|
-
while (1) switch (
|
|
1064
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1065
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1671
1066
|
case 0:
|
|
1672
|
-
|
|
1067
|
+
_context16.next = 2;
|
|
1673
1068
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
1674
1069
|
case 2:
|
|
1675
1070
|
try {
|
|
@@ -1680,9 +1075,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1680
1075
|
scanCache.clear();
|
|
1681
1076
|
case 4:
|
|
1682
1077
|
case "end":
|
|
1683
|
-
return
|
|
1078
|
+
return _context16.stop();
|
|
1684
1079
|
}
|
|
1685
|
-
},
|
|
1080
|
+
}, _callee16, this);
|
|
1686
1081
|
}));
|
|
1687
1082
|
function destroy() {
|
|
1688
1083
|
return _destroy.apply(this, arguments);
|