@pisell/private-materials 6.12.162 → 6.12.164
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +1 -1
- package/build/lowcode/render/default/view.js +18 -18
- package/build/lowcode/view.js +18 -18
- package/es/components/bigSale/components/ProductList/index.js +1 -1
- package/es/components/bigSale/dialog.js +5 -4
- package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +67 -24
- package/es/components/bigSale/templates/Standard/index.js +5 -3
- package/es/components/bigSale/utils/floorResourceSelection.js +106 -0
- package/es/components/bigSale/utils/orderIdentity.js +16 -0
- package/es/components/checkout/plugin.js +1 -1
- package/es/components/kioskSale/index.js +7 -2
- package/es/components/pay/toB/components/EFTPOS/index.js +1 -1
- package/es/components/ticketBooking/dialog.js +1 -1
- package/es/components/ticketBooking/hooks/pisellos/useProducts.js +1 -1
- package/es/plus/pisellReservation/utils/reservationTicketBookingHostParams.js +26 -1
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardCom/index.js +23 -2
- package/es/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +18 -1
- package/es/plus/saleDetail/tmpl/B/components/Pay/index.js +34 -24
- package/es/plus/salesSdk/context/SalesSdkCartContext.js +1 -1
- package/es/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +2 -2
- package/es/plus/salesSdk/services/refundPayments.js +1 -0
- package/es/plus/salesSdk/types.d.ts +9 -1
- package/es/pro/skuDetailModal/flow/presets.js +1 -1
- package/es/pro/skuDetailModal/index.js +11 -4
- package/es/pro/skuDetailModal/types.d.ts +5 -0
- package/es/pro/skuDetailModal/utils.js +2 -1
- package/lib/components/bigSale/components/ProductList/index.js +1 -1
- package/lib/components/bigSale/dialog.js +5 -4
- package/lib/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +67 -24
- package/lib/components/bigSale/templates/Standard/index.js +5 -3
- package/lib/components/bigSale/utils/floorResourceSelection.js +110 -0
- package/lib/components/bigSale/utils/orderIdentity.js +16 -0
- package/lib/components/checkout/plugin.js +1 -1
- package/lib/components/kioskSale/index.js +7 -2
- package/lib/components/pay/toB/components/EFTPOS/index.js +1 -1
- package/lib/components/ticketBooking/dialog.js +1 -1
- package/lib/components/ticketBooking/hooks/pisellos/useProducts.js +1 -1
- package/lib/plus/pisellReservation/utils/reservationTicketBookingHostParams.js +26 -0
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardCom/index.js +23 -2
- package/lib/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.js +18 -1
- package/lib/plus/saleDetail/tmpl/B/components/Pay/index.js +33 -23
- package/lib/plus/salesSdk/context/SalesSdkCartContext.js +1 -1
- package/lib/plus/salesSdk/normalProductDetail/NormalProductDetailHostRenderer.js +2 -2
- package/lib/plus/salesSdk/services/refundPayments.js +1 -0
- package/lib/plus/salesSdk/types.d.ts +9 -1
- package/lib/pro/skuDetailModal/flow/presets.js +1 -0
- package/lib/pro/skuDetailModal/index.js +10 -3
- package/lib/pro/skuDetailModal/types.d.ts +5 -0
- package/lib/pro/skuDetailModal/utils.js +2 -0
- package/package.json +3 -3
|
@@ -2,11 +2,11 @@ import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
2
2
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { isNormalProductByDurationSchedule } from "../../../booking/info/service2/utils.js";
|
|
4
4
|
import useScrollActivity from "../../../../hooks/useScrollActivity.js";
|
|
5
|
+
import useLogger from "../../../../hooks/useLogger.js";
|
|
5
6
|
import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
|
|
6
7
|
import ProductCard$1 from "../../../../plus/productSelect/ProductCard/index.js";
|
|
7
8
|
import ProductCardV2 from "../../../../plus/productSelect/ProductCard/ProductCardV2.js";
|
|
8
9
|
import useLocale from "../../../../hooks/useLocale.js";
|
|
9
|
-
import useLogger from "../../../../hooks/useLogger.js";
|
|
10
10
|
import List_default from "../../../list/List.js";
|
|
11
11
|
import { generateProductTabs } from "../../../ticketBooking/components/ProductDisplayAdapter/utils.js";
|
|
12
12
|
import { showAddToCartToast } from "../../../../plus/salesSdk/components/showAddToCartToast.js";
|
|
@@ -6,6 +6,7 @@ import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
|
|
|
6
6
|
import { useSalesSdkCart } from "../../plus/salesSdk/hooks/useSalesSdkCart.js";
|
|
7
7
|
import { SalesSdkPrepareOrderSwitchContext, SalesSdkRootRefreshContext } from "../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
8
8
|
import { seedDineInReservationToCart } from "../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
|
|
9
|
+
import { isPersistedBigSaleOrderId } from "./utils/orderIdentity.js";
|
|
9
10
|
import BigSale from "./index.js";
|
|
10
11
|
import dayjs from "dayjs";
|
|
11
12
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -22,9 +23,7 @@ const MemoizedBigSale = React.memo(BigSale);
|
|
|
22
23
|
* isTempOrderBoundToRemoteOrder({ order_id: 'local_order_xxx' }); // false
|
|
23
24
|
*/
|
|
24
25
|
function isTempOrderBoundToRemoteOrder(tempOrder) {
|
|
25
|
-
|
|
26
|
-
if (orderId === void 0 || orderId === null) return false;
|
|
27
|
-
return !String(orderId).startsWith("local_order");
|
|
26
|
+
return isPersistedBigSaleOrderId(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id);
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* 快照必须是与当前订单匹配的完整原始记录;展示层规范化对象不能直接交给 OS hydrate。
|
|
@@ -324,6 +323,8 @@ function BigSaleDialog(props) {
|
|
|
324
323
|
contentActiveRef.current = contentActive;
|
|
325
324
|
const onVisualStateSettledRef = useRef(onVisualStateSettled);
|
|
326
325
|
onVisualStateSettledRef.current = onVisualStateSettled;
|
|
326
|
+
const resolvedBusinessCode = String(businessCode !== null && businessCode !== void 0 ? businessCode : "").trim() || (mode === "retail" ? "dine_in" : mode);
|
|
327
|
+
const hideSelectFloorMapResourceAction = !(isPersistedBigSaleOrderId(orderId) && resolvedBusinessCode === "dine_in");
|
|
327
328
|
const resolvedFallbackTitle = title || (orderId ? `#${orderId}` : "New Order");
|
|
328
329
|
/** preloaded 实例保持稳定 mount,避免每次 open 销毁 SalesSdkProvider。 */
|
|
329
330
|
const bigSaleInstanceKey = useMemo(() => `${osKey}-${mode}`, [osKey, mode]);
|
|
@@ -514,7 +515,7 @@ function BigSaleDialog(props) {
|
|
|
514
515
|
productLoadParams,
|
|
515
516
|
productCatalogSessionKey,
|
|
516
517
|
productCatalogReady,
|
|
517
|
-
hideSelectFloorMapResourceAction
|
|
518
|
+
hideSelectFloorMapResourceAction,
|
|
518
519
|
rulesHooks,
|
|
519
520
|
otherParams,
|
|
520
521
|
enableTempOrderPersist: false,
|
|
@@ -5,7 +5,10 @@ import { useSalesSdkUIHosts } from "../../../plus/salesSdk/context/SalesSdkUIHos
|
|
|
5
5
|
import { SalesSdkRootRefreshContext } from "../../../plus/salesSdk/context/SalesSdkProvider.js";
|
|
6
6
|
import { resolveOrderIdForHostActions } from "../../../plus/pisellReservation/components/bookingDetailModal/bookingDetailHostActions.js";
|
|
7
7
|
import { usePicoCodingOpenData } from "../../../plus/pisellReservation/hooks/usePicoCodingOpenData.js";
|
|
8
|
+
import { buildReplacementBookingResourcesFromReservationRow } from "../../../plus/pisellReservation/utils/reservationTicketBookingHostParams.js";
|
|
8
9
|
import { seedDineInReservationToCart } from "../../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
|
|
10
|
+
import { applyBigSaleFloorResourceSelection, resolveCurrentTableBookings, resolveSelectedFloorResourceId, resolveSelectedReservationRow, shouldCloseFloorResourceSelection } from "../utils/floorResourceSelection.js";
|
|
11
|
+
import { isPersistedBigSaleOrderId } from "../utils/orderIdentity.js";
|
|
9
12
|
import dayjs from "dayjs";
|
|
10
13
|
import { useContext, useMemo } from "react";
|
|
11
14
|
import { message } from "antd";
|
|
@@ -68,13 +71,16 @@ function resolveCurrentBookingAt(context) {
|
|
|
68
71
|
* openSelectFloorMapResource();
|
|
69
72
|
*/
|
|
70
73
|
function useSelectFloorMapResourceForBigSale(options) {
|
|
71
|
-
|
|
74
|
+
var _context$sales$bookin5, _context$sales$bookin6, _context$sales$bookin7, _context$sales$tempOr;
|
|
75
|
+
const { context, mode, orderId, businessCode, bookingConfigParams, productLoadParams } = options;
|
|
72
76
|
const engineCtx = useEngineContext();
|
|
73
77
|
const refreshRoot = useContext(SalesSdkRootRefreshContext);
|
|
74
78
|
const uiHosts = useSalesSdkUIHosts();
|
|
75
79
|
const reservationBiz = resolveBigSaleReservationBiz(businessCode, mode);
|
|
76
80
|
const { reservationRuleProduct, reservationAssociatedMenuListIds } = usePicoCodingOpenData(engineCtx, reservationBiz);
|
|
77
81
|
const hasReservationRuleProduct = Boolean(reservationRuleProduct);
|
|
82
|
+
const hasPersistedCurrentOrder = isPersistedBigSaleOrderId((_context$sales$bookin5 = (_context$sales$bookin6 = context.sales.bookingTicket) === null || _context$sales$bookin6 === void 0 || (_context$sales$bookin7 = _context$sales$bookin6.getTempOrder) === null || _context$sales$bookin7 === void 0 || (_context$sales$bookin7 = _context$sales$bookin7.call(_context$sales$bookin6)) === null || _context$sales$bookin7 === void 0 ? void 0 : _context$sales$bookin7.order_id) !== null && _context$sales$bookin5 !== void 0 ? _context$sales$bookin5 : (_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr.order_id);
|
|
83
|
+
const canSelectFloorMapResource = hasReservationRuleProduct || hasPersistedCurrentOrder;
|
|
78
84
|
const associatedMenuListIds = useMemo(() => {
|
|
79
85
|
const fromProductLoad = normalizeMenuListIdsFromLoadParams(productLoadParams);
|
|
80
86
|
return fromProductLoad.length > 0 ? fromProductLoad : reservationAssociatedMenuListIds;
|
|
@@ -87,10 +93,10 @@ function useSelectFloorMapResourceForBigSale(options) {
|
|
|
87
93
|
*/
|
|
88
94
|
const refreshBigSaleAfterResourceMerge = useMemoizedFn(function() {
|
|
89
95
|
var _ref2 = _asyncToGenerator(function* (loadResources) {
|
|
90
|
-
var _context$sales$
|
|
91
|
-
const liveTempOrder = (_context$sales$
|
|
96
|
+
var _context$sales$bookin8, _context$sales$bookin9, _context$sales$bookin10, _context$sales$bookin11, _context$sales$bookin12;
|
|
97
|
+
const liveTempOrder = (_context$sales$bookin8 = (_context$sales$bookin9 = context.sales.bookingTicket) === null || _context$sales$bookin9 === void 0 || (_context$sales$bookin10 = _context$sales$bookin9.getTempOrder) === null || _context$sales$bookin10 === void 0 ? void 0 : _context$sales$bookin10.call(_context$sales$bookin9)) !== null && _context$sales$bookin8 !== void 0 ? _context$sales$bookin8 : context.sales.tempOrder;
|
|
92
98
|
const bookingIds = collectBookingIdsFromTempOrder(liveTempOrder !== null && liveTempOrder !== void 0 ? liveTempOrder : null);
|
|
93
|
-
yield (_context$sales$
|
|
99
|
+
yield (_context$sales$bookin11 = context.sales.bookingTicket) === null || _context$sales$bookin11 === void 0 || (_context$sales$bookin12 = _context$sales$bookin11.initBookingContext) === null || _context$sales$bookin12 === void 0 ? void 0 : _context$sales$bookin12.call(_context$sales$bookin11, buildInitBookingContextParams(bookingConfigParams, {
|
|
94
100
|
date: resolveCurrentBookingAt(context),
|
|
95
101
|
bookingIds: bookingIds.length ? bookingIds : void 0,
|
|
96
102
|
loadResources
|
|
@@ -110,8 +116,8 @@ function useSelectFloorMapResourceForBigSale(options) {
|
|
|
110
116
|
*/
|
|
111
117
|
const mergeExistingOrderToBigSale = useMemoizedFn(function() {
|
|
112
118
|
var _ref3 = _asyncToGenerator(function* (orderId) {
|
|
113
|
-
var _context$sales$
|
|
114
|
-
if (!((_context$sales$
|
|
119
|
+
var _context$sales$bookin13;
|
|
120
|
+
if (!((_context$sales$bookin13 = context.sales.bookingTicket) === null || _context$sales$bookin13 === void 0 ? void 0 : _context$sales$bookin13.loadSalesDetail)) throw new Error("[BigSale] loadSalesDetail 不可用");
|
|
115
121
|
yield context.sales.bookingTicket.loadSalesDetail({
|
|
116
122
|
orderId,
|
|
117
123
|
forceRemote: true,
|
|
@@ -131,18 +137,18 @@ function useSelectFloorMapResourceForBigSale(options) {
|
|
|
131
137
|
*/
|
|
132
138
|
const seedEmptyResourceToBigSale = useMemoizedFn(function() {
|
|
133
139
|
var _ref4 = _asyncToGenerator(function* (selected) {
|
|
134
|
-
var _context$sales$
|
|
140
|
+
var _context$sales$bookin14, _context$sales$bookin15, _context$sales$bookin16, _context$sales$bookin17, _context$sales$bookin18, _context$sales$bookin19, _context$sales$bookin20, _context$sales$bookin21, _context$sales$bookin22, _liveTempOrder$custom;
|
|
135
141
|
if (!context.sales.bookingTicket) throw new Error("[BigSale] bookingTicket 未初始化");
|
|
136
142
|
if (!reservationRuleProduct || typeof reservationRuleProduct !== "object") throw new Error("[BigSale] 缺少桌台关联商品配置");
|
|
137
|
-
if (!context.sales.tempOrder) yield context.sales.createNew();
|
|
143
|
+
if (!((_context$sales$bookin14 = (_context$sales$bookin15 = (_context$sales$bookin16 = context.sales.bookingTicket).getTempOrder) === null || _context$sales$bookin15 === void 0 ? void 0 : _context$sales$bookin15.call(_context$sales$bookin16)) !== null && _context$sales$bookin14 !== void 0 ? _context$sales$bookin14 : context.sales.tempOrder)) yield context.sales.createNew();
|
|
138
144
|
const currentAt = resolveCurrentBookingAt(context);
|
|
139
|
-
const liveTempOrder = (_context$sales$
|
|
145
|
+
const liveTempOrder = (_context$sales$bookin17 = (_context$sales$bookin18 = (_context$sales$bookin19 = context.sales.bookingTicket).getTempOrder) === null || _context$sales$bookin18 === void 0 ? void 0 : _context$sales$bookin18.call(_context$sales$bookin19)) !== null && _context$sales$bookin17 !== void 0 ? _context$sales$bookin17 : context.sales.tempOrder;
|
|
140
146
|
yield seedDineInReservationToCart({
|
|
141
147
|
bookingTicket: context.sales.bookingTicket,
|
|
142
148
|
reservationRuleProduct,
|
|
143
|
-
row: selected
|
|
149
|
+
row: resolveSelectedReservationRow(selected),
|
|
144
150
|
appointmentStatus: "started",
|
|
145
|
-
bookingConfig: (_context$sales$
|
|
151
|
+
bookingConfig: (_context$sales$bookin20 = (_context$sales$bookin21 = (_context$sales$bookin22 = context.sales.bookingTicket).getBookingConfig) === null || _context$sales$bookin21 === void 0 ? void 0 : _context$sales$bookin21.call(_context$sales$bookin22)) !== null && _context$sales$bookin20 !== void 0 ? _context$sales$bookin20 : null,
|
|
146
152
|
tempOrder: liveTempOrder,
|
|
147
153
|
customerId: (_liveTempOrder$custom = liveTempOrder === null || liveTempOrder === void 0 ? void 0 : liveTempOrder.customer_id) !== null && _liveTempOrder$custom !== void 0 ? _liveTempOrder$custom : void 0,
|
|
148
154
|
date: currentAt.format("YYYY-MM-DD"),
|
|
@@ -154,29 +160,65 @@ function useSelectFloorMapResourceForBigSale(options) {
|
|
|
154
160
|
return _ref4.apply(this, arguments);
|
|
155
161
|
};
|
|
156
162
|
}());
|
|
163
|
+
/** 仅替换已有桌台 booking 的 resources,保留商品行与其余 booking 字段。 */
|
|
164
|
+
const replaceExistingTableResource = useMemoizedFn(function() {
|
|
165
|
+
var _ref6 = _asyncToGenerator(function* (selected, booking) {
|
|
166
|
+
var _ref5, _booking$metadata$uni, _booking$metadata;
|
|
167
|
+
const bookingTicket = context.sales.bookingTicket;
|
|
168
|
+
if (!bookingTicket || typeof bookingTicket.updateOrderBooking !== "function") throw new Error("[BigSale] updateOrderBooking 不可用");
|
|
169
|
+
const bookingUid = String((_ref5 = (_booking$metadata$uni = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.unique_identification_number) !== null && _booking$metadata$uni !== void 0 ? _booking$metadata$uni : booking.unique_identification_number) !== null && _ref5 !== void 0 ? _ref5 : "").trim();
|
|
170
|
+
if (!bookingUid) throw new Error("[BigSale] 桌台 booking 缺少 UID,无法换桌");
|
|
171
|
+
if (!resolveSelectedFloorResourceId(selected)) throw new Error("[BigSale] 所选桌台缺少有效资源 ID");
|
|
172
|
+
const resources = buildReplacementBookingResourcesFromReservationRow(resolveSelectedReservationRow(selected), booking);
|
|
173
|
+
yield bookingTicket.updateOrderBooking({
|
|
174
|
+
unique_identification_number: bookingUid,
|
|
175
|
+
updates: { resources }
|
|
176
|
+
});
|
|
177
|
+
yield refreshBigSaleAfterResourceMerge(true);
|
|
178
|
+
});
|
|
179
|
+
return function(_x4, _x5) {
|
|
180
|
+
return _ref6.apply(this, arguments);
|
|
181
|
+
};
|
|
182
|
+
}());
|
|
157
183
|
/**
|
|
158
|
-
*
|
|
184
|
+
* 处理选择资源弹窗点击结果:已落库订单只新增/替换桌台;新建订单命中已有订单
|
|
185
|
+
* 时 merge,选择空桌时按当前草稿执行新增、同桌不变或异桌替换。
|
|
159
186
|
*
|
|
160
187
|
* @example
|
|
161
188
|
* await handleSelectedFloorMapResource(selected);
|
|
162
189
|
*/
|
|
163
190
|
const handleSelectedFloorMapResource = useMemoizedFn(function() {
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (!
|
|
172
|
-
|
|
191
|
+
var _ref7 = _asyncToGenerator(function* (selected) {
|
|
192
|
+
var _context$sales$bookin23, _context$sales$bookin24, _context$sales$bookin25, _context$sales$salesD, _context$sales$salesD2, _context$sales$salesD3;
|
|
193
|
+
const liveTempOrder = (_context$sales$bookin23 = (_context$sales$bookin24 = context.sales.bookingTicket) === null || _context$sales$bookin24 === void 0 || (_context$sales$bookin25 = _context$sales$bookin24.getTempOrder) === null || _context$sales$bookin25 === void 0 ? void 0 : _context$sales$bookin25.call(_context$sales$bookin24)) !== null && _context$sales$bookin23 !== void 0 ? _context$sales$bookin23 : context.sales.tempOrder;
|
|
194
|
+
const currentOrderId = liveTempOrder === null || liveTempOrder === void 0 ? void 0 : liveTempOrder.order_id;
|
|
195
|
+
const isPersistedOrder = isPersistedBigSaleOrderId(currentOrderId);
|
|
196
|
+
if (isPersistedBigSaleOrderId(orderId) && String(currentOrderId !== null && currentOrderId !== void 0 ? currentOrderId : "").trim() !== String(orderId).trim()) throw new Error("[BigSale] 当前订单尚未加载完成,请稍后重试");
|
|
197
|
+
const salesDetailOrderId = (_context$sales$salesD = (_context$sales$salesD2 = context.sales.salesDetail) === null || _context$sales$salesD2 === void 0 || (_context$sales$salesD2 = _context$sales$salesD2.header) === null || _context$sales$salesD2 === void 0 ? void 0 : _context$sales$salesD2.order_id) !== null && _context$sales$salesD !== void 0 ? _context$sales$salesD : (_context$sales$salesD3 = context.sales.salesDetail) === null || _context$sales$salesD3 === void 0 ? void 0 : _context$sales$salesD3.order_id;
|
|
198
|
+
if (!liveTempOrder && isPersistedBigSaleOrderId(salesDetailOrderId)) throw new Error("[BigSale] 当前订单尚未加载完成,请稍后重试");
|
|
199
|
+
const selectedOrderId = resolveSelectedResourceOrderId(selected);
|
|
200
|
+
const currentTableBookings = resolveCurrentTableBookings(liveTempOrder, reservationRuleProduct);
|
|
201
|
+
const bookingCount = typeof selected.row.bookingCount === "number" && Number.isFinite(selected.row.bookingCount) ? selected.row.bookingCount : 0;
|
|
202
|
+
if (!isPersistedOrder && selectedOrderId == null && bookingCount > 0) console.warn("[BigSale] 当前桌台有订单记录,但未命中可合并订单");
|
|
203
|
+
const result = yield applyBigSaleFloorResourceSelection({
|
|
204
|
+
isPersistedOrder,
|
|
205
|
+
selectedOrderId,
|
|
206
|
+
selectedResourceId: resolveSelectedFloorResourceId(selected),
|
|
207
|
+
currentTableBookings,
|
|
208
|
+
add: () => seedEmptyResourceToBigSale(selected),
|
|
209
|
+
replace: (booking) => replaceExistingTableResource(selected, booking),
|
|
210
|
+
merge: (orderId) => mergeExistingOrderToBigSale(orderId)
|
|
211
|
+
});
|
|
212
|
+
if (result === "unchanged") message.info("This table is already assigned");
|
|
213
|
+
return result;
|
|
173
214
|
});
|
|
174
|
-
return function(
|
|
175
|
-
return
|
|
215
|
+
return function(_x6) {
|
|
216
|
+
return _ref7.apply(this, arguments);
|
|
176
217
|
};
|
|
177
218
|
}());
|
|
178
219
|
return {
|
|
179
220
|
hasReservationRuleProduct,
|
|
221
|
+
canSelectFloorMapResource,
|
|
180
222
|
openSelectFloorMapResource: useMemoizedFn(() => {
|
|
181
223
|
var _engineCtx$appHelper;
|
|
182
224
|
const action = engineCtx === null || engineCtx === void 0 || (_engineCtx$appHelper = engineCtx.appHelper) === null || _engineCtx$appHelper === void 0 || (_engineCtx$appHelper = _engineCtx$appHelper.utils) === null || _engineCtx$appHelper === void 0 ? void 0 : _engineCtx$appHelper.action;
|
|
@@ -200,7 +242,8 @@ function useSelectFloorMapResourceForBigSale(options) {
|
|
|
200
242
|
at: currentAt
|
|
201
243
|
},
|
|
202
244
|
onClick: (selected) => {
|
|
203
|
-
handleSelectedFloorMapResource(selected).then(() => {
|
|
245
|
+
handleSelectedFloorMapResource(selected).then((result) => {
|
|
246
|
+
if (!shouldCloseFloorResourceSelection(result)) return;
|
|
204
247
|
action({
|
|
205
248
|
type: "pisell1.closeSelectFloorMapResource",
|
|
206
249
|
data: {},
|
|
@@ -219,9 +219,10 @@ function StandardBigSaleTemplate({ isActive = true, osKey, productListPreference
|
|
|
219
219
|
]);
|
|
220
220
|
const [productListPreferences, setProductListPreferences] = useState(() => readBigSaleProductListPreferences(productListPreferencesKey, defaultProductListPreferences));
|
|
221
221
|
const [hasProductListPreferencesOverride, setHasProductListPreferencesOverride] = useState(() => Boolean(readStoredBigSaleProductListPreferences(productListPreferencesKey, defaultProductListPreferences)));
|
|
222
|
-
const { openSelectFloorMapResource } = useSelectFloorMapResourceForBigSale({
|
|
222
|
+
const { canSelectFloorMapResource, openSelectFloorMapResource } = useSelectFloorMapResourceForBigSale({
|
|
223
223
|
context,
|
|
224
224
|
mode,
|
|
225
|
+
orderId,
|
|
225
226
|
businessCode,
|
|
226
227
|
bookingConfigParams,
|
|
227
228
|
productLoadParams
|
|
@@ -232,7 +233,7 @@ function StandardBigSaleTemplate({ isActive = true, osKey, productListPreference
|
|
|
232
233
|
setProductListPreferences(storedPreferences || defaultProductListPreferences);
|
|
233
234
|
setHasProductListPreferencesOverride(Boolean(storedPreferences));
|
|
234
235
|
}, [defaultProductListPreferences, productListPreferencesKey]);
|
|
235
|
-
const shouldInjectFloorResourceAction = !hideSelectFloorMapResourceAction;
|
|
236
|
+
const shouldInjectFloorResourceAction = canSelectFloorMapResource && !hideSelectFloorMapResourceAction;
|
|
236
237
|
const dineInOrderActions = useMemo(() => {
|
|
237
238
|
if (!shouldInjectFloorResourceAction) return void 0;
|
|
238
239
|
return [
|
|
@@ -361,7 +362,8 @@ function StandardBigSaleTemplate({ isActive = true, osKey, productListPreference
|
|
|
361
362
|
defaultProductListPreferences,
|
|
362
363
|
onProductListPreferencesChange: handleProductListPreferencesChange,
|
|
363
364
|
onProductListPreferencesReset: handleProductListPreferencesReset,
|
|
364
|
-
variant
|
|
365
|
+
variant,
|
|
366
|
+
productSelectionTrigger: "click"
|
|
365
367
|
}), /* @__PURE__ */ React.createElement(BigSaleFloatingActions, {
|
|
366
368
|
variant,
|
|
367
369
|
floatingPanelRef,
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
+
//#region src/components/bigSale/utils/floorResourceSelection.ts
|
|
4
|
+
function normalizeIdentity(value) {
|
|
5
|
+
if (value === void 0 || value === null) return null;
|
|
6
|
+
const normalized = String(value).trim();
|
|
7
|
+
return normalized && normalized !== "0" ? normalized : null;
|
|
8
|
+
}
|
|
9
|
+
function resolveBookingResources(booking) {
|
|
10
|
+
return (Array.isArray(booking.resources) ? booking.resources : Array.isArray(booking.event_resources) ? booking.event_resources : []).filter((resource) => Boolean(resource) && typeof resource === "object");
|
|
11
|
+
}
|
|
12
|
+
function resolveProductUid(product) {
|
|
13
|
+
var _product$metadata$uni, _product$metadata;
|
|
14
|
+
return normalizeIdentity((_product$metadata$uni = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) !== null && _product$metadata$uni !== void 0 ? _product$metadata$uni : product.unique_identification_number);
|
|
15
|
+
}
|
|
16
|
+
function resolveBookingUid(booking) {
|
|
17
|
+
var _booking$metadata$uni, _booking$metadata;
|
|
18
|
+
return normalizeIdentity((_booking$metadata$uni = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.unique_identification_number) !== null && _booking$metadata$uni !== void 0 ? _booking$metadata$uni : booking.unique_identification_number);
|
|
19
|
+
}
|
|
20
|
+
/** 将选择 payload 归一为 seed / 换桌共同消费的桌台行。 */
|
|
21
|
+
function resolveSelectedReservationRow(selected) {
|
|
22
|
+
var _selected$resource$ra, _ref, _selected$resource$re, _selected$resource$fo, _ref2, _selected$resource$co, _ref3, _selected$resource$ma;
|
|
23
|
+
const raw = (_selected$resource$ra = selected.resource.raw) !== null && _selected$resource$ra !== void 0 ? _selected$resource$ra : selected.row;
|
|
24
|
+
const relationId = (_ref = (_selected$resource$re = selected.resource.relation_id) !== null && _selected$resource$re !== void 0 ? _selected$resource$re : selected.resource.id) !== null && _ref !== void 0 ? _ref : raw.id;
|
|
25
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, selected.row), raw), {}, {
|
|
26
|
+
id: String(relationId),
|
|
27
|
+
form_id: (_selected$resource$fo = selected.resource.form_id) !== null && _selected$resource$fo !== void 0 ? _selected$resource$fo : raw.form_id,
|
|
28
|
+
code: (_ref2 = (_selected$resource$co = selected.resource.code) !== null && _selected$resource$co !== void 0 ? _selected$resource$co : raw.code) !== null && _ref2 !== void 0 ? _ref2 : String(relationId),
|
|
29
|
+
main_field: (_ref3 = (_selected$resource$ma = selected.resource.main_field) !== null && _selected$resource$ma !== void 0 ? _selected$resource$ma : raw.main_field) !== null && _ref3 !== void 0 ? _ref3 : selected.row.main_field
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** 选择 payload 中的资源主键,与 booking.resources[].relation_id 对齐。 */
|
|
33
|
+
function resolveSelectedFloorResourceId(selected) {
|
|
34
|
+
var _ref4, _selected$resource$re2;
|
|
35
|
+
return normalizeIdentity((_ref4 = (_selected$resource$re2 = selected.resource.relation_id) !== null && _selected$resource$re2 !== void 0 ? _selected$resource$re2 : selected.resource.id) !== null && _ref4 !== void 0 ? _ref4 : selected.row.id);
|
|
36
|
+
}
|
|
37
|
+
/** 当前 booking 是否已经绑定了本次选中的桌台。 */
|
|
38
|
+
function bookingUsesFloorResource(booking, resourceId) {
|
|
39
|
+
if (!resourceId) return false;
|
|
40
|
+
return resolveBookingResources(booking).some((resource) => normalizeIdentity(resource.relation_id) === resourceId);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 从 tempOrder 找出桌台 booking。
|
|
44
|
+
*
|
|
45
|
+
* 优先使用当前配置的桌台规则商品关联关系;历史数据无法关联时,再退回到带资源的
|
|
46
|
+
* 非 root booking。这样既兼容配置变更后的旧单,也不会把 root booking 当成桌台商品。
|
|
47
|
+
*/
|
|
48
|
+
function resolveCurrentTableBookings(tempOrder, reservationRuleProduct) {
|
|
49
|
+
var _tempOrder$bookings, _reservationRuleProdu, _tempOrder$products;
|
|
50
|
+
if (!tempOrder) return [];
|
|
51
|
+
const nonRootBookings = ((_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 ? _tempOrder$bookings : []).filter((booking) => {
|
|
52
|
+
if (!booking || typeof booking !== "object") return false;
|
|
53
|
+
return Number(booking.parent_id) !== 0;
|
|
54
|
+
});
|
|
55
|
+
const resourceBookings = nonRootBookings.filter((booking) => resolveBookingResources(booking).some((resource) => Boolean(normalizeIdentity(resource.relation_id))));
|
|
56
|
+
const ruleProductId = normalizeIdentity((_reservationRuleProdu = reservationRuleProduct === null || reservationRuleProduct === void 0 ? void 0 : reservationRuleProduct.id) !== null && _reservationRuleProdu !== void 0 ? _reservationRuleProdu : reservationRuleProduct === null || reservationRuleProduct === void 0 ? void 0 : reservationRuleProduct.product_id);
|
|
57
|
+
if (!ruleProductId) return resourceBookings;
|
|
58
|
+
const linkedProductUids = /* @__PURE__ */ new Set();
|
|
59
|
+
const linkedBookingUids = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const product of (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 ? _tempOrder$products : []) {
|
|
61
|
+
var _booking_uid, _product$metadata2;
|
|
62
|
+
if (normalizeIdentity(product.product_id) !== ruleProductId) continue;
|
|
63
|
+
const productUid = resolveProductUid(product);
|
|
64
|
+
if (productUid) linkedProductUids.add(productUid);
|
|
65
|
+
const bookingUid = normalizeIdentity((_booking_uid = product.booking_uid) !== null && _booking_uid !== void 0 ? _booking_uid : (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.booking_uid);
|
|
66
|
+
if (bookingUid) linkedBookingUids.add(bookingUid);
|
|
67
|
+
}
|
|
68
|
+
const linkedBookings = nonRootBookings.filter((booking) => {
|
|
69
|
+
const productUid = normalizeIdentity(booking.product_uid);
|
|
70
|
+
const bookingUid = resolveBookingUid(booking);
|
|
71
|
+
return Boolean(productUid && linkedProductUids.has(productUid) || bookingUid && linkedBookingUids.has(bookingUid));
|
|
72
|
+
});
|
|
73
|
+
return Array.from(new Set([...linkedBookings, ...resourceBookings]));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 执行桌台选择分流。已落库订单永远不会进入 merge 回调;新订单命中已有
|
|
77
|
+
* 订单时仍优先 merge,否则对当前草稿已有桌台执行同桌不变或异桌替换。
|
|
78
|
+
*/
|
|
79
|
+
function applyBigSaleFloorResourceSelection(_x) {
|
|
80
|
+
return _applyBigSaleFloorResourceSelection.apply(this, arguments);
|
|
81
|
+
}
|
|
82
|
+
function _applyBigSaleFloorResourceSelection() {
|
|
83
|
+
_applyBigSaleFloorResourceSelection = _asyncToGenerator(function* (options) {
|
|
84
|
+
const { isPersistedOrder, selectedOrderId, selectedResourceId, currentTableBookings, add, replace, merge } = options;
|
|
85
|
+
if (!isPersistedOrder && selectedOrderId != null) {
|
|
86
|
+
yield merge(selectedOrderId);
|
|
87
|
+
return "merged";
|
|
88
|
+
}
|
|
89
|
+
if (currentTableBookings.length > 1) throw new Error("[BigSale] 当前订单存在多条桌台 booking,无法自动换桌");
|
|
90
|
+
const currentTableBooking = currentTableBookings[0];
|
|
91
|
+
if (!currentTableBooking) {
|
|
92
|
+
yield add();
|
|
93
|
+
return "added";
|
|
94
|
+
}
|
|
95
|
+
if (bookingUsesFloorResource(currentTableBooking, selectedResourceId)) return "unchanged";
|
|
96
|
+
yield replace(currentTableBooking);
|
|
97
|
+
return "replaced";
|
|
98
|
+
});
|
|
99
|
+
return _applyBigSaleFloorResourceSelection.apply(this, arguments);
|
|
100
|
+
}
|
|
101
|
+
/** 只有发生实际写入或合单时才关闭桌台选择弹窗。 */
|
|
102
|
+
function shouldCloseFloorResourceSelection(result) {
|
|
103
|
+
return result !== "unchanged";
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { applyBigSaleFloorResourceSelection, resolveCurrentTableBookings, resolveSelectedFloorResourceId, resolveSelectedReservationRow, shouldCloseFloorResourceSelection };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/components/bigSale/utils/orderIdentity.ts
|
|
2
|
+
/**
|
|
3
|
+
* 判断订单 ID 是否指向后端已落库订单。
|
|
4
|
+
*
|
|
5
|
+
* `local_order*` / `LOCAL_*` 等本地草稿标识仍属于新建订单流程。
|
|
6
|
+
*/
|
|
7
|
+
function isPersistedBigSaleOrderId(orderId) {
|
|
8
|
+
if (orderId === void 0 || orderId === null) return false;
|
|
9
|
+
if (typeof orderId === "number") return Number.isFinite(orderId) && orderId > 0;
|
|
10
|
+
const normalized = String(orderId).trim();
|
|
11
|
+
if (!normalized || normalized === "0") return false;
|
|
12
|
+
const lower = normalized.toLowerCase();
|
|
13
|
+
return !(lower === "local" || lower.startsWith("local_") || lower.startsWith("local-"));
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isPersistedBigSaleOrderId };
|
|
@@ -2,8 +2,8 @@ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/hel
|
|
|
2
2
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import { Provider } from "../booking/info/model.js";
|
|
4
4
|
import useEngineContext from "../../hooks/useEngineContext.js";
|
|
5
|
-
import { request } from "../../utils/index.js";
|
|
6
5
|
import useLogger from "../../hooks/useLogger.js";
|
|
6
|
+
import { request } from "../../utils/index.js";
|
|
7
7
|
import { createPaymentModalCallbackEvent, normalizePaymentModalCallbackEvent } from "./payment-modal-utils.js";
|
|
8
8
|
import PaymentModal_default from "./PaymentModal.js";
|
|
9
9
|
import React, { useEffect, useMemo, useState } from "react";
|
|
@@ -61,12 +61,17 @@ function KioskSale(props) {
|
|
|
61
61
|
return _objectWithoutProperties(productLoadParams, _excluded2);
|
|
62
62
|
}, [productLoadParams]);
|
|
63
63
|
const resolvedOtherParams = useMemo(() => _objectSpread2(_objectSpread2({}, otherParams || {}), channel ? { channel } : {}), [channel, otherParams]);
|
|
64
|
-
const
|
|
64
|
+
const isH5 = [otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform, channel].some((value) => String(value || "").trim().toLowerCase() === "h5");
|
|
65
|
+
const productDetailPresentationPlatform = isH5 ? "default" : "kiosk";
|
|
65
66
|
const isPosChannel = String(channel || "").trim().toLowerCase() === "pos";
|
|
66
67
|
const resolvedNormalProductDetailConfig = useMemo(() => _objectSpread2(_objectSpread2(_objectSpread2({}, normalProductDetailConfig), isPosChannel ? {
|
|
67
68
|
allowUnavailableBookingSelection: true,
|
|
68
69
|
allowNoResourceBookingSelection: true
|
|
69
|
-
} : {}), {}, {
|
|
70
|
+
} : {}), {}, {
|
|
71
|
+
presentationPlatform: productDetailPresentationPlatform,
|
|
72
|
+
hideQuantityForBookingProducts: isH5 || (normalProductDetailConfig === null || normalProductDetailConfig === void 0 ? void 0 : normalProductDetailConfig.hideQuantityForBookingProducts)
|
|
73
|
+
}), [
|
|
74
|
+
isH5,
|
|
70
75
|
isPosChannel,
|
|
71
76
|
normalProductDetailConfig,
|
|
72
77
|
productDetailPresentationPlatform
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _asyncToGenerator } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
2
|
import useEngineContext from "../../../../../hooks/useEngineContext.js";
|
|
3
|
-
import { request } from "../../../../../utils/index.js";
|
|
4
3
|
import useLogger from "../../../../../hooks/useLogger.js";
|
|
4
|
+
import { request } from "../../../../../utils/index.js";
|
|
5
5
|
import EFTPos_default from "../../../../eftposPay/EFTPos.js";
|
|
6
6
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
7
7
|
import { Modal } from "antd";
|
|
@@ -3,8 +3,8 @@ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/
|
|
|
3
3
|
import useEngineContext from "../../hooks/useEngineContext.js";
|
|
4
4
|
import CompensatedPisellContainer from "../../pro/compensatedPisellContainer/index.js";
|
|
5
5
|
import withResponsive from "../../responsive/withResponsive.js";
|
|
6
|
-
import { request } from "../../utils/index.js";
|
|
7
6
|
import useLogger from "../../hooks/useLogger.js";
|
|
7
|
+
import { request } from "../../utils/index.js";
|
|
8
8
|
import { getBookingDetail } from "./serve.js";
|
|
9
9
|
import locales_default from "./locales.js";
|
|
10
10
|
import { getPicoCodingOpenData } from "../../plus/pisellReservation/serve/formResourcePage.js";
|
|
@@ -2,8 +2,8 @@ import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
2
2
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
3
|
import useEngineContext, { usePlatform } from "../../../../hooks/useEngineContext.js";
|
|
4
4
|
import { useBookingTicket } from "./bookingTicket.js";
|
|
5
|
-
import usePromotion from "../../../booking/hooks/usePromotion.js";
|
|
6
5
|
import useLogger from "../../../../hooks/useLogger.js";
|
|
6
|
+
import usePromotion from "../../../booking/hooks/usePromotion.js";
|
|
7
7
|
import dayjs from "dayjs";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { getUniqueId } from "@pisell/utils";
|
|
@@ -47,6 +47,31 @@ function buildResourcePayloadFromReservationRow(row) {
|
|
|
47
47
|
deleted_at: null
|
|
48
48
|
}] };
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* 换桌时生成 booking.resources 协议数组。
|
|
52
|
+
*
|
|
53
|
+
* 只替换资源身份;资源占用人数沿用原 booking,避免换桌时改变人数或其它预约字段。
|
|
54
|
+
*/
|
|
55
|
+
function buildReplacementBookingResourcesFromReservationRow(row, currentBooking) {
|
|
56
|
+
var _capacityCandidates$m;
|
|
57
|
+
const resourceMap = buildResourcePayloadFromReservationRow(row);
|
|
58
|
+
const sourceResource = Object.values(resourceMap).flat()[0];
|
|
59
|
+
if (!sourceResource || Number(sourceResource.relation_id) <= 0) throw new Error("[BigSale] 所选桌台缺少有效资源 ID");
|
|
60
|
+
const currentResource = Array.isArray(currentBooking.resources) ? currentBooking.resources[0] : void 0;
|
|
61
|
+
const capacity = (_capacityCandidates$m = [
|
|
62
|
+
currentResource === null || currentResource === void 0 ? void 0 : currentResource.capacity,
|
|
63
|
+
currentBooking.number,
|
|
64
|
+
sourceResource.capacity
|
|
65
|
+
].map((value) => Number(value)).find((value) => Number.isFinite(value) && value >= 0)) !== null && _capacityCandidates$m !== void 0 ? _capacityCandidates$m : 0;
|
|
66
|
+
return [{
|
|
67
|
+
form_id: sourceResource.form_id,
|
|
68
|
+
relation_type: sourceResource.relation_type || "form",
|
|
69
|
+
relation_id: sourceResource.relation_id,
|
|
70
|
+
capacity,
|
|
71
|
+
like_status: sourceResource.like_status || "common",
|
|
72
|
+
metadata: sourceResource.metadata
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
50
75
|
function buildInitialExtendCapacityFromRuleProduct(product) {
|
|
51
76
|
const capacitys = product === null || product === void 0 ? void 0 : product.capacity;
|
|
52
77
|
if ((capacitys === null || capacitys === void 0 ? void 0 : capacitys.type) !== "custom" || !Array.isArray(capacitys.custom)) return [{
|
|
@@ -138,4 +163,4 @@ function openNewReservationBookingFromHost(input) {
|
|
|
138
163
|
return true;
|
|
139
164
|
}
|
|
140
165
|
//#endregion
|
|
141
|
-
export { buildResourcePayloadFromReservationRow, buildServiceItemFromReservationRuleProduct, openNewReservationBookingFromHost };
|
|
166
|
+
export { buildReplacementBookingResourcesFromReservationRow, buildResourcePayloadFromReservationRow, buildServiceItemFromReservationRuleProduct, openNewReservationBookingFromHost };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { PREFIX, productCardDefault } from "../../status.js";
|
|
3
3
|
import Action from "../Action/index.js";
|
|
4
|
+
import useLogger from "../../../../../../hooks/useLogger.js";
|
|
4
5
|
import CardWrapper from "../CardWrapper/index.js";
|
|
5
6
|
import Cover from "../Cover/index.js";
|
|
6
7
|
import { useDynamicComponents } from "../../hooks/useDynamicComponents.js";
|
|
@@ -15,6 +16,7 @@ const CardCom = ({ props, className }) => {
|
|
|
15
16
|
var _productCardDefault$s, _dataSource$sortKeys3;
|
|
16
17
|
const [isFold, setIsFold] = useState(false);
|
|
17
18
|
useInitLocalesOnce(locales_default);
|
|
19
|
+
const logger = useLogger();
|
|
18
20
|
const { skuCardConfig, skuImageConfig, dataSource, skuActionConfig, skuTextConfig, style, rightStyle, onSelectCover, onSelectInfo, selectionTrigger = "pointerUp" } = props;
|
|
19
21
|
const { renderComponent } = useDynamicComponents();
|
|
20
22
|
const { layoutDirection, displayMode, isFoldable } = skuCardConfig || (productCardDefault === null || productCardDefault === void 0 ? void 0 : productCardDefault.skuCardConfig) || {};
|
|
@@ -23,12 +25,31 @@ const CardCom = ({ props, className }) => {
|
|
|
23
25
|
const { paddingY, justifyContent, alignItems, slot } = (skuTextConfig === null || skuTextConfig === void 0 ? void 0 : skuTextConfig.infoConfig) || (productCardDefault === null || productCardDefault === void 0 || (_productCardDefault$s = productCardDefault.skuTextConfig) === null || _productCardDefault$s === void 0 ? void 0 : _productCardDefault$s.infoConfig) || {};
|
|
24
26
|
const handleSelect = useCallback((event, callback) => {
|
|
25
27
|
event.stopPropagation();
|
|
28
|
+
const reportProductSelection = () => {
|
|
29
|
+
var _logger$addLog, _dataSource$id, _dataSource$title;
|
|
30
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
31
|
+
type: "info",
|
|
32
|
+
title: `BigSale商品卡-${selectionTrigger}触发商品选择`,
|
|
33
|
+
metadata: {
|
|
34
|
+
productId: (_dataSource$id = dataSource === null || dataSource === void 0 ? void 0 : dataSource.id) !== null && _dataSource$id !== void 0 ? _dataSource$id : dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_id,
|
|
35
|
+
productTitle: (_dataSource$title = dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) !== null && _dataSource$title !== void 0 ? _dataSource$title : dataSource === null || dataSource === void 0 ? void 0 : dataSource.name
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
26
39
|
if (selectionTrigger === "click") {
|
|
40
|
+
reportProductSelection();
|
|
27
41
|
callback === null || callback === void 0 || callback(dataSource);
|
|
28
42
|
return;
|
|
29
43
|
}
|
|
30
|
-
requestAnimationFrame(() => requestAnimationFrame(() =>
|
|
31
|
-
|
|
44
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
45
|
+
reportProductSelection();
|
|
46
|
+
callback === null || callback === void 0 || callback(dataSource);
|
|
47
|
+
}));
|
|
48
|
+
}, [
|
|
49
|
+
dataSource,
|
|
50
|
+
logger === null || logger === void 0 ? void 0 : logger.addLog,
|
|
51
|
+
selectionTrigger
|
|
52
|
+
]);
|
|
32
53
|
/**
|
|
33
54
|
* @title: 文本区域样式
|
|
34
55
|
* @description:
|
|
@@ -3,12 +3,14 @@ import { PREFIX, productCardDefault } from "../../status.js";
|
|
|
3
3
|
import Action from "../Action/index.js";
|
|
4
4
|
import TooltipTags from "../TooltipTags/index.js";
|
|
5
5
|
import CardMask from "../CardMask/index.js";
|
|
6
|
+
import useLogger from "../../../../../../hooks/useLogger.js";
|
|
6
7
|
import React, { useMemo } from "react";
|
|
7
8
|
import { CardPro } from "@pisell/materials";
|
|
8
9
|
import classNames from "classnames";
|
|
9
10
|
import "./index.less";
|
|
10
11
|
//#region src/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.tsx
|
|
11
12
|
const CardWrapper = (props) => {
|
|
13
|
+
const logger = useLogger();
|
|
12
14
|
const { children, className, style, skuCardConfig, skuActionConfig, skuStatusOverlayConfig, dataSource, onCardClick, isSelected, selectionTrigger = "pointerUp" } = props;
|
|
13
15
|
const { paddingX, paddingY, background, marginY, marginX, radius, borderWidth, borderColor, isBorderVisible, layoutDirection } = skuCardConfig || (productCardDefault === null || productCardDefault === void 0 ? void 0 : productCardDefault.skuCardConfig) || {};
|
|
14
16
|
const { method } = skuActionConfig || (productCardDefault === null || productCardDefault === void 0 ? void 0 : productCardDefault.skuActionConfig) || {};
|
|
@@ -33,11 +35,26 @@ const CardWrapper = (props) => {
|
|
|
33
35
|
marginY
|
|
34
36
|
]);
|
|
35
37
|
const handleCardSelect = () => {
|
|
38
|
+
const reportProductSelection = () => {
|
|
39
|
+
var _logger$addLog, _dataSource$id, _dataSource$title;
|
|
40
|
+
logger === null || logger === void 0 || (_logger$addLog = logger.addLog) === null || _logger$addLog === void 0 || _logger$addLog.call(logger, {
|
|
41
|
+
type: "info",
|
|
42
|
+
title: `BigSale商品卡外层-${selectionTrigger}触发商品选择`,
|
|
43
|
+
metadata: {
|
|
44
|
+
productId: (_dataSource$id = dataSource === null || dataSource === void 0 ? void 0 : dataSource.id) !== null && _dataSource$id !== void 0 ? _dataSource$id : dataSource === null || dataSource === void 0 ? void 0 : dataSource.product_id,
|
|
45
|
+
productTitle: (_dataSource$title = dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) !== null && _dataSource$title !== void 0 ? _dataSource$title : dataSource === null || dataSource === void 0 ? void 0 : dataSource.name
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
36
49
|
if (selectionTrigger === "click") {
|
|
50
|
+
reportProductSelection();
|
|
37
51
|
onCardClick === null || onCardClick === void 0 || onCardClick(dataSource);
|
|
38
52
|
return;
|
|
39
53
|
}
|
|
40
|
-
requestAnimationFrame(() => requestAnimationFrame(() =>
|
|
54
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
55
|
+
reportProductSelection();
|
|
56
|
+
onCardClick === null || onCardClick === void 0 || onCardClick(dataSource);
|
|
57
|
+
}));
|
|
41
58
|
};
|
|
42
59
|
return /* @__PURE__ */ React.createElement("div", {
|
|
43
60
|
className: classNames(`${PREFIX}__card-wrapper`, (skuStatusOverlayConfig === null || skuStatusOverlayConfig === void 0 ? void 0 : skuStatusOverlayConfig.isOpen) && `pisell-product-sku__card-wrapper-overlay`, className),
|