@pisell/private-materials 6.3.136 → 6.3.138
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/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/businessModel/SalesModel/index.d.ts +1 -0
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/TabProduct/index.d.ts +1 -0
- package/es/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/es/components/booking/deposit/index.d.ts +1 -0
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/forms/single/index.d.ts +1 -0
- package/es/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/es/components/booking/info/date/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/es/components/booking/info/index.d.ts +1 -0
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/notes/index.d.ts +1 -0
- package/es/components/booking/info/service/Lists.d.ts +1 -0
- package/es/components/booking/info/service/actions/index.d.ts +1 -0
- package/es/components/booking/info/service/addService/index.d.ts +1 -0
- package/es/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/info/service2/Lists.d.ts +1 -0
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/service/actions/index.d.ts +1 -0
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/es/components/booking/info2/service/contactInfoMode/index.d.ts +1 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/es/components/booking/materiels/duration/index.d.ts +1 -0
- package/es/components/booking/materiels/holder/index.d.ts +1 -0
- package/es/components/booking/materiels/startTime/index.d.ts +1 -0
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/eftposPay/amount.d.ts +1 -0
- package/es/components/eftposPay/app.d.ts +1 -0
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/es/components/eftposPay/device.d.ts +1 -0
- package/es/components/eftposPay/hooks.d.ts +2 -2
- package/es/components/eftposPay/index.d.ts +1 -0
- package/es/components/eftposPay/linkly/index.d.ts +1 -0
- package/es/components/eftposPay/pay.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +5 -5
- package/es/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/es/components/eventBooking/index.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/es/components/productExtension/index.d.ts +1 -0
- package/es/components/ruleSetting/index.d.ts +1 -0
- package/es/components/scanOrder/components/Content/index.js +251 -69
- package/es/components/scanOrder/context.js +6 -18
- package/es/components/scanOrder/utils/toShoppingCartProducts.d.ts +2 -1
- package/es/components/scanOrder/utils/toShoppingCartProducts.js +15 -9
- package/es/components/scanOrder/utils/transformProductDetail.d.ts +2 -1
- package/es/components/scanOrder/utils/transformProductDetail.js +7 -6
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/es/components/shoppingCart/index.d.ts +1 -0
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/es/components/venueBooking/components/Checkout/index.js +36 -5
- package/es/components/venueBooking/components/VenueSelection/components/TimeGrid.js +1 -1
- package/es/components/venueBooking/context.js +32 -6
- package/es/components/venueBooking/locales.d.ts +15 -0
- package/es/components/venueBooking/locales.js +15 -0
- package/es/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/es/plus/pisellSalesManagement/config/booking.d.ts +6 -6
- package/es/plus/pisellSalesProductCard/index.js +16 -1
- package/es/plus/pisellSalesProductCard/types.d.ts +21 -1
- package/es/plus/productSelect/ProductCard/ProductCardV2.js +6 -2
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/es/pro/NumericStepper/index.d.ts +19 -0
- package/es/pro/NumericStepper/index.js +37 -6
- package/lib/businessModel/SalesModel/index.d.ts +1 -0
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/TabProduct/index.d.ts +1 -0
- package/lib/components/booking/components/TabProduct/productItem/index.d.ts +1 -0
- package/lib/components/booking/deposit/index.d.ts +1 -0
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/forms/single/index.d.ts +1 -0
- package/lib/components/booking/info/addServiceVariant/index.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +1 -0
- package/lib/components/booking/info/date/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +1 -0
- package/lib/components/booking/info/index.d.ts +1 -0
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/notes/index.d.ts +1 -0
- package/lib/components/booking/info/service/Lists.d.ts +1 -0
- package/lib/components/booking/info/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info/service/addService/index.d.ts +1 -0
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/info/service2/Lists.d.ts +1 -0
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/actions/index.d.ts +1 -0
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +1 -0
- package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +1 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +1 -0
- package/lib/components/booking/materiels/duration/index.d.ts +1 -0
- package/lib/components/booking/materiels/holder/index.d.ts +1 -0
- package/lib/components/booking/materiels/startTime/index.d.ts +1 -0
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/eftposPay/amount.d.ts +1 -0
- package/lib/components/eftposPay/app.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/lib/components/eftposPay/device.d.ts +1 -0
- package/lib/components/eftposPay/hooks.d.ts +2 -2
- package/lib/components/eftposPay/index.d.ts +1 -0
- package/lib/components/eftposPay/linkly/index.d.ts +1 -0
- package/lib/components/eftposPay/pay.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +5 -5
- package/lib/components/eventBooking/components/Provider/Cart/Deposit/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +1 -0
- package/lib/components/eventBooking/index.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +1 -0
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +1 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +1 -0
- package/lib/components/productExtension/index.d.ts +1 -0
- package/lib/components/ruleSetting/index.d.ts +1 -0
- package/lib/components/scanOrder/components/Content/index.js +150 -41
- package/lib/components/scanOrder/context.js +0 -10
- package/lib/components/scanOrder/utils/toShoppingCartProducts.d.ts +2 -1
- package/lib/components/scanOrder/utils/toShoppingCartProducts.js +8 -5
- package/lib/components/scanOrder/utils/transformProductDetail.d.ts +2 -1
- package/lib/components/scanOrder/utils/transformProductDetail.js +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Empty/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +1 -0
- package/lib/components/shoppingCart/index.d.ts +1 -0
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +1 -0
- package/lib/components/venueBooking/components/Checkout/index.js +28 -3
- package/lib/components/venueBooking/components/VenueSelection/components/TimeGrid.js +1 -1
- package/lib/components/venueBooking/context.js +14 -6
- package/lib/components/venueBooking/locales.d.ts +15 -0
- package/lib/components/venueBooking/locales.js +15 -0
- package/lib/plus/clinetSearch/Add/PhoneField/index.d.ts +1 -0
- package/lib/plus/pisellSalesManagement/config/booking.d.ts +6 -6
- package/lib/plus/pisellSalesProductCard/index.js +10 -0
- package/lib/plus/pisellSalesProductCard/types.d.ts +21 -1
- package/lib/plus/productSelect/ProductCard/ProductCardV2.js +6 -2
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
- package/lib/pro/NumericStepper/index.d.ts +19 -0
- package/lib/pro/NumericStepper/index.js +21 -4
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ function normalizeBundleItems(bundleItems) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
export function transformProductDetailToOrderProduct(params) {
|
|
53
|
-
var _ref, _ref2, _payload$product_id, _ref3, _payload$product_vari, _payload$_origin, _ref4, _ref5, _ref6, _ref7, _payload$price, _ref8,
|
|
53
|
+
var _ref, _ref2, _payload$product_id, _ref3, _payload$product_vari, _payload$_origin, _ref4, _ref5, _ref6, _ref7, _payload$price, _ref8, _payload$tax_fee, _ref9, _payload$is_charge_ta, _payload$quantity, _payload$option, _payload$bundle;
|
|
54
54
|
var payload = params.payload,
|
|
55
55
|
_params$fallbackProdu = params.fallbackProductId,
|
|
56
56
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu,
|
|
@@ -62,10 +62,12 @@ export function transformProductDetailToOrderProduct(params) {
|
|
|
62
62
|
var productVariantId = toNumber((_ref3 = (_payload$product_vari = payload.product_variant_id) !== null && _payload$product_vari !== void 0 ? _payload$product_vari : payload.variant_id) !== null && _ref3 !== void 0 ? _ref3 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.product_variant_id, 0);
|
|
63
63
|
var callbackOrigin = (payload === null || payload === void 0 ? void 0 : payload.origin) || (payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.sourceItem) || (payload === null || payload === void 0 ? void 0 : payload._origin) || {};
|
|
64
64
|
var sellingPrice = toPriceString((_ref4 = (_ref5 = (_ref6 = (_ref7 = (_payload$price = payload === null || payload === void 0 ? void 0 : payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload === null || payload === void 0 ? void 0 : payload.selling_price) !== null && _ref7 !== void 0 ? _ref7 : callbackOrigin === null || callbackOrigin === void 0 ? void 0 : callbackOrigin.price) !== null && _ref6 !== void 0 ? _ref6 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _ref5 !== void 0 ? _ref5 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price) !== null && _ref4 !== void 0 ? _ref4 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.base_price, '0.00');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var
|
|
65
|
+
// 入口不引入后台划线价(payload/source.original_price 可能承载 UI 划线展示用的原价)。
|
|
66
|
+
// 订单域 original_price 语义为「券前店铺售价」,初次加购恒等于 selling_price;
|
|
67
|
+
// 券应用后由 SDK Rules 引擎维护差异。
|
|
68
|
+
var originalPrice = sellingPrice;
|
|
69
|
+
var taxFee = toPriceString((_ref8 = (_payload$tax_fee = payload === null || payload === void 0 ? void 0 : payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : callbackOrigin === null || callbackOrigin === void 0 ? void 0 : callbackOrigin.tax_fee) !== null && _ref8 !== void 0 ? _ref8 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.tax_fee, '0.00');
|
|
70
|
+
var isChargeTax = toNumber((_ref9 = (_payload$is_charge_ta = payload === null || payload === void 0 ? void 0 : payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : callbackOrigin === null || callbackOrigin === void 0 ? void 0 : callbackOrigin.is_charge_tax) !== null && _ref9 !== void 0 ? _ref9 : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.is_charge_tax, 0);
|
|
69
71
|
return {
|
|
70
72
|
product_id: productId,
|
|
71
73
|
product_variant_id: productVariantId,
|
|
@@ -74,7 +76,6 @@ export function transformProductDetailToOrderProduct(params) {
|
|
|
74
76
|
product_bundle: normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle),
|
|
75
77
|
selling_price: sellingPrice,
|
|
76
78
|
original_price: originalPrice,
|
|
77
|
-
payment_price: paymentPrice,
|
|
78
79
|
tax_fee: taxFee,
|
|
79
80
|
is_charge_tax: isChargeTax,
|
|
80
81
|
metadata: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
3
2
|
import dayjs from "dayjs";
|
|
4
3
|
export interface FormState {
|
|
@@ -69,11 +68,4 @@ export interface FormState {
|
|
|
69
68
|
};
|
|
70
69
|
setGlobalState: Function | null;
|
|
71
70
|
}
|
|
72
|
-
export declare const Provider:
|
|
73
|
-
state: FormState;
|
|
74
|
-
} & {
|
|
75
|
-
dispatch: (params: {
|
|
76
|
-
type: string;
|
|
77
|
-
payload: any;
|
|
78
|
-
}) => void;
|
|
79
|
-
}>;
|
|
71
|
+
export declare const Provider: any, Context: any;
|
|
@@ -251,18 +251,49 @@ function toContactsInfoPayload(formValues) {
|
|
|
251
251
|
}
|
|
252
252
|
}];
|
|
253
253
|
}
|
|
254
|
+
|
|
255
|
+
/** 将 i18n 模板中的 `{key}` 替换为对应值(与 venueBooking utils 中 hour.format 用法一致) */
|
|
256
|
+
function applyI18nPlaceholders(template, vars) {
|
|
257
|
+
var result = template;
|
|
258
|
+
for (var _i = 0, _Object$entries = Object.entries(vars); _i < _Object$entries.length; _i++) {
|
|
259
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
260
|
+
key = _Object$entries$_i[0],
|
|
261
|
+
value = _Object$entries$_i[1];
|
|
262
|
+
result = result.split("{".concat(key, "}")).join(String(value));
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** 结算页时长文案:走 locales,英文用 min,中文用 分钟 / 分鐘 等 */
|
|
268
|
+
function formatCheckoutDurationText(totalMinutes) {
|
|
269
|
+
var hours = Math.floor(totalMinutes / 60);
|
|
270
|
+
var minutes = totalMinutes % 60;
|
|
271
|
+
if (hours > 0 && minutes > 0) {
|
|
272
|
+
var _tpl = String(locales.getText('pisell2.venue.checkout.duration.hours_minutes') || '{hours}h {minutes}min');
|
|
273
|
+
return applyI18nPlaceholders(_tpl, {
|
|
274
|
+
hours: hours,
|
|
275
|
+
minutes: minutes
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
if (hours > 0) {
|
|
279
|
+
var _tpl2 = String(locales.getText('pisell2.venue.checkout.duration.hours') || '{hours}h');
|
|
280
|
+
return applyI18nPlaceholders(_tpl2, {
|
|
281
|
+
hours: hours
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
var tpl = String(locales.getText('pisell2.venue.checkout.duration.minutes') || '{minutes}min');
|
|
285
|
+
return applyI18nPlaceholders(tpl, {
|
|
286
|
+
minutes: minutes
|
|
287
|
+
});
|
|
288
|
+
}
|
|
254
289
|
function getSessionDisplayText(item) {
|
|
255
290
|
var startRaw = String((item === null || item === void 0 ? void 0 : item.start_date) || '');
|
|
256
291
|
var endRaw = String((item === null || item === void 0 ? void 0 : item.end_date) || '');
|
|
257
292
|
var start = dayjs(startRaw);
|
|
258
293
|
var end = dayjs(endRaw);
|
|
259
294
|
if (!start.isValid() || !end.isValid()) return String((item === null || item === void 0 ? void 0 : item.description) || (item === null || item === void 0 ? void 0 : item.subtitle) || '-');
|
|
260
|
-
|
|
261
|
-
// 兼容小于 1 小时(30m)、整小时(1h / 2h)、带半小时余数(1h 30m)三种情况
|
|
262
295
|
var durationMinutes = Math.max(0, end.diff(start, 'minute'));
|
|
263
|
-
var
|
|
264
|
-
var minutes = durationMinutes % 60;
|
|
265
|
-
var durationText = hours > 0 && minutes > 0 ? "".concat(hours, "h ").concat(minutes, "m") : hours > 0 ? "".concat(hours, "h") : "".concat(minutes, "m");
|
|
296
|
+
var durationText = formatCheckoutDurationText(durationMinutes);
|
|
266
297
|
return "".concat(start.format('HH:mm'), " ~ ").concat(end.format('HH:mm'), " ").concat(start.format('DD/MM/YYYY'), " (").concat(durationText, ")");
|
|
267
298
|
}
|
|
268
299
|
function getVenueResourceName(item) {
|
|
@@ -347,7 +347,7 @@ export default function TimeGrid() {
|
|
|
347
347
|
symbol: symbol,
|
|
348
348
|
precision: 2,
|
|
349
349
|
showCurrencySymbol: true,
|
|
350
|
-
hideDecimalForWholeNumbers:
|
|
350
|
+
hideDecimalForWholeNumbers: true,
|
|
351
351
|
className: "text-[13px] font-normal leading-4 ".concat(priceClass, " md:text-sm")
|
|
352
352
|
}), tag ? /*#__PURE__*/React.createElement("div", {
|
|
353
353
|
className: "inline-flex rounded-full px-1.5 py-0 text-[8px] font-semibold leading-4 ring-1 md:text-[9px] ".concat(tag.className)
|
|
@@ -243,6 +243,13 @@ export function VenueBookingProvider(_ref) {
|
|
|
243
243
|
var anchorDateRef = useRef(anchorDate);
|
|
244
244
|
anchorDateRef.current = anchorDate;
|
|
245
245
|
|
|
246
|
+
/**
|
|
247
|
+
* bootstrap 只跑一次:避免宿主 Provider 重渲染导致的依赖身份抖动
|
|
248
|
+
* (例如 utils 引用变化 → syncCustomerLoginToModule 重建 → effect 重跑 → 骨架屏闪烁)。
|
|
249
|
+
* 只在首次 venueBookingModule 就绪时执行,和步骤 hydrate 的 hydratedRef 同语义。
|
|
250
|
+
*/
|
|
251
|
+
var bootstrappedRef = useRef(false);
|
|
252
|
+
|
|
246
253
|
/** 是否有已选时段(用于判断能否进入下一步) */
|
|
247
254
|
var canNext = useMemo(function () {
|
|
248
255
|
// 优先从 OS 模块查询选中状态
|
|
@@ -730,6 +737,18 @@ export function VenueBookingProvider(_ref) {
|
|
|
730
737
|
}, _callee8, null, [[0, 9]]);
|
|
731
738
|
})), [syncCustomerLoginToModule, venueBookingModule, refreshViewModel]);
|
|
732
739
|
|
|
740
|
+
/**
|
|
741
|
+
* 以 ref 持有最新的 callback,供仅需稳定调用、不希望因 callback 身份变动而重跑的 effect 使用
|
|
742
|
+
* - bootstrap useEffect:只关心 venueBookingModule 首次就绪,不应被 utils/callback 身份抖动连带重跑
|
|
743
|
+
* - pubsub 订阅 useEffect:只订阅一次,真正回调取最新实现
|
|
744
|
+
*/
|
|
745
|
+
var syncCustomerLoginRef = useRef(syncCustomerLoginToModule);
|
|
746
|
+
syncCustomerLoginRef.current = syncCustomerLoginToModule;
|
|
747
|
+
var goToNearestAvailableDateRef = useRef(goToNearestAvailableDate);
|
|
748
|
+
goToNearestAvailableDateRef.current = goToNearestAvailableDate;
|
|
749
|
+
var handleLoginSuccessRef = useRef(handleLoginSuccess);
|
|
750
|
+
handleLoginSuccessRef.current = handleLoginSuccess;
|
|
751
|
+
|
|
733
752
|
/** 结账步骤提交订单(调用 OS venueBooking.submitOrder) */
|
|
734
753
|
var submitOrder = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
735
754
|
var _result$data, _viewModel$summary, result, orderId, totalAmount, _otherParams$openData, otherParams;
|
|
@@ -894,6 +913,8 @@ export function VenueBookingProvider(_ref) {
|
|
|
894
913
|
}, [currentStep, canNext, isAgreeDepositPolicy, viewModel.summary, stepList, proceedToCheckout, goToStep, handleSubmitOrder]);
|
|
895
914
|
|
|
896
915
|
// ── 监听全局登录成功事件(Voucher 区域内登录等场景) ──
|
|
916
|
+
// 仅依赖 pubsub 实例,回调经 ref 取最新实现,避免 handleLoginSuccess 重建
|
|
917
|
+
// 时反复 sub/unsub(宿主 utils 引用抖动也会连带触发)。
|
|
897
918
|
useEffect(function () {
|
|
898
919
|
var _pubsub$subscribe;
|
|
899
920
|
var pubsub = utils === null || utils === void 0 ? void 0 : utils.pubsub;
|
|
@@ -908,7 +929,7 @@ export function VenueBookingProvider(_ref) {
|
|
|
908
929
|
break;
|
|
909
930
|
}
|
|
910
931
|
_context12.next = 3;
|
|
911
|
-
return
|
|
932
|
+
return handleLoginSuccessRef.current();
|
|
912
933
|
case 3:
|
|
913
934
|
case "end":
|
|
914
935
|
return _context12.stop();
|
|
@@ -924,7 +945,7 @@ export function VenueBookingProvider(_ref) {
|
|
|
924
945
|
var _pubsub$unsubscribe;
|
|
925
946
|
(_pubsub$unsubscribe = pubsub.unsubscribe) === null || _pubsub$unsubscribe === void 0 || _pubsub$unsubscribe.call(pubsub, 'pisell1.login.success', onGlobalLoginSuccess);
|
|
926
947
|
};
|
|
927
|
-
}, [utils === null || utils === void 0 ? void 0 : utils.pubsub
|
|
948
|
+
}, [utils === null || utils === void 0 ? void 0 : utils.pubsub]);
|
|
928
949
|
|
|
929
950
|
// ── anchorDate 变化时刷新 timeSlotGrid + 短暂 grid 加载动画 ──
|
|
930
951
|
useEffect(function () {
|
|
@@ -998,8 +1019,13 @@ export function VenueBookingProvider(_ref) {
|
|
|
998
1019
|
}, [pisellOS, venueBookingModule]);
|
|
999
1020
|
|
|
1000
1021
|
// ── 模块初始化引导 ──
|
|
1022
|
+
// 只在首次 venueBookingModule 就绪时执行一次;内部依赖的 callback 走 ref,
|
|
1023
|
+
// 避免宿主 Provider 重渲染(如登录弹窗打开/关闭)让 utils 引用变化,导致
|
|
1024
|
+
// syncCustomerLoginToModule / goToNearestAvailableDate 身份抖动连带 effect 重跑,
|
|
1025
|
+
// 进而触发 setIsWeekLoading(true) 造成 VenueSelection 骨架屏闪烁。
|
|
1001
1026
|
useEffect(function () {
|
|
1002
|
-
if (!venueBookingModule) return;
|
|
1027
|
+
if (bootstrappedRef.current || !venueBookingModule) return;
|
|
1028
|
+
bootstrappedRef.current = true;
|
|
1003
1029
|
var unmounted = false;
|
|
1004
1030
|
var bootstrap = /*#__PURE__*/function () {
|
|
1005
1031
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
@@ -1012,14 +1038,14 @@ export function VenueBookingProvider(_ref) {
|
|
|
1012
1038
|
|
|
1013
1039
|
// 初始化阶段尝试同步 customer 到 venueBooking 模块(未登录时内部自动跳过)
|
|
1014
1040
|
_context14.next = 4;
|
|
1015
|
-
return
|
|
1041
|
+
return syncCustomerLoginRef.current();
|
|
1016
1042
|
case 4:
|
|
1017
1043
|
_context14.next = 6;
|
|
1018
1044
|
return loadVenueProducts(venueBookingModule, VENUE_PRODUCT_IDS);
|
|
1019
1045
|
case 6:
|
|
1020
1046
|
venueProducts = typeof (venueBookingModule === null || venueBookingModule === void 0 ? void 0 : venueBookingModule.getVenueProducts) === 'function' ? venueBookingModule.getVenueProducts() : []; // 2. 自动定位最近可用日期(当前周无可用则滚动到后续周)
|
|
1021
1047
|
_context14.next = 9;
|
|
1022
|
-
return
|
|
1048
|
+
return goToNearestAvailableDateRef.current(anchorDateRef.current);
|
|
1023
1049
|
case 9:
|
|
1024
1050
|
// 3. 刷新购物车数据
|
|
1025
1051
|
moduleData = createVenueBookingViewModel(venueBookingModule);
|
|
@@ -1078,7 +1104,7 @@ export function VenueBookingProvider(_ref) {
|
|
|
1078
1104
|
return function () {
|
|
1079
1105
|
unmounted = true;
|
|
1080
1106
|
};
|
|
1081
|
-
}, [venueBookingModule
|
|
1107
|
+
}, [venueBookingModule]);
|
|
1082
1108
|
|
|
1083
1109
|
// ── 聚合 Context Value ──
|
|
1084
1110
|
var value = useMemo(function () {
|
|
@@ -78,6 +78,9 @@ declare const _default: {
|
|
|
78
78
|
'pisell2.venue.checkout.hotline': string;
|
|
79
79
|
'pisell2.venue.checkout.estimated.total': string;
|
|
80
80
|
'pisell2.venue.checkout.change': string;
|
|
81
|
+
'pisell2.venue.checkout.duration.hours_minutes': string;
|
|
82
|
+
'pisell2.venue.checkout.duration.hours': string;
|
|
83
|
+
'pisell2.venue.checkout.duration.minutes': string;
|
|
81
84
|
'pisell2.venue.grid.loading': string;
|
|
82
85
|
'pisell2.venue.legend.product.fallback': string;
|
|
83
86
|
'pisell2.venue.addons.empty': string;
|
|
@@ -199,6 +202,9 @@ declare const _default: {
|
|
|
199
202
|
'pisell2.venue.checkout.hotline': string;
|
|
200
203
|
'pisell2.venue.checkout.estimated.total': string;
|
|
201
204
|
'pisell2.venue.checkout.change': string;
|
|
205
|
+
'pisell2.venue.checkout.duration.hours_minutes': string;
|
|
206
|
+
'pisell2.venue.checkout.duration.hours': string;
|
|
207
|
+
'pisell2.venue.checkout.duration.minutes': string;
|
|
202
208
|
'pisell2.venue.grid.loading': string;
|
|
203
209
|
'pisell2.venue.legend.product.fallback': string;
|
|
204
210
|
'pisell2.venue.addons.empty': string;
|
|
@@ -320,6 +326,9 @@ declare const _default: {
|
|
|
320
326
|
'pisell2.venue.checkout.hotline': string;
|
|
321
327
|
'pisell2.venue.checkout.estimated.total': string;
|
|
322
328
|
'pisell2.venue.checkout.change': string;
|
|
329
|
+
'pisell2.venue.checkout.duration.hours_minutes': string;
|
|
330
|
+
'pisell2.venue.checkout.duration.hours': string;
|
|
331
|
+
'pisell2.venue.checkout.duration.minutes': string;
|
|
323
332
|
'pisell2.venue.grid.loading': string;
|
|
324
333
|
'pisell2.venue.legend.product.fallback': string;
|
|
325
334
|
'pisell2.venue.addons.empty': string;
|
|
@@ -441,6 +450,9 @@ declare const _default: {
|
|
|
441
450
|
'pisell2.venue.checkout.hotline': string;
|
|
442
451
|
'pisell2.venue.checkout.estimated.total': string;
|
|
443
452
|
'pisell2.venue.checkout.change': string;
|
|
453
|
+
'pisell2.venue.checkout.duration.hours_minutes': string;
|
|
454
|
+
'pisell2.venue.checkout.duration.hours': string;
|
|
455
|
+
'pisell2.venue.checkout.duration.minutes': string;
|
|
444
456
|
'pisell2.venue.grid.loading': string;
|
|
445
457
|
'pisell2.venue.legend.product.fallback': string;
|
|
446
458
|
'pisell2.venue.addons.empty': string;
|
|
@@ -562,6 +574,9 @@ declare const _default: {
|
|
|
562
574
|
'pisell2.venue.checkout.hotline': string;
|
|
563
575
|
'pisell2.venue.checkout.estimated.total': string;
|
|
564
576
|
'pisell2.venue.checkout.change': string;
|
|
577
|
+
'pisell2.venue.checkout.duration.hours_minutes': string;
|
|
578
|
+
'pisell2.venue.checkout.duration.hours': string;
|
|
579
|
+
'pisell2.venue.checkout.duration.minutes': string;
|
|
565
580
|
'pisell2.venue.grid.loading': string;
|
|
566
581
|
'pisell2.venue.legend.product.fallback': string;
|
|
567
582
|
'pisell2.venue.addons.empty': string;
|
|
@@ -78,6 +78,9 @@ export default {
|
|
|
78
78
|
'pisell2.venue.checkout.hotline': 'Support hotline',
|
|
79
79
|
'pisell2.venue.checkout.estimated.total': 'Estimated total',
|
|
80
80
|
'pisell2.venue.checkout.change': 'Change',
|
|
81
|
+
'pisell2.venue.checkout.duration.hours_minutes': '{hours}h {minutes}min',
|
|
82
|
+
'pisell2.venue.checkout.duration.hours': '{hours}h',
|
|
83
|
+
'pisell2.venue.checkout.duration.minutes': '{minutes}min',
|
|
81
84
|
'pisell2.venue.grid.loading': 'Loading...',
|
|
82
85
|
'pisell2.venue.legend.product.fallback': 'Product',
|
|
83
86
|
'pisell2.venue.addons.empty': 'No add-ons available.',
|
|
@@ -199,6 +202,9 @@ export default {
|
|
|
199
202
|
'pisell2.venue.checkout.hotline': '客服热线',
|
|
200
203
|
'pisell2.venue.checkout.estimated.total': '预估总价',
|
|
201
204
|
'pisell2.venue.checkout.change': '修改',
|
|
205
|
+
'pisell2.venue.checkout.duration.hours_minutes': '{hours}小时{minutes}分钟',
|
|
206
|
+
'pisell2.venue.checkout.duration.hours': '{hours}小时',
|
|
207
|
+
'pisell2.venue.checkout.duration.minutes': '{minutes}分钟',
|
|
202
208
|
'pisell2.venue.grid.loading': '加载中...',
|
|
203
209
|
'pisell2.venue.legend.product.fallback': '商品',
|
|
204
210
|
'pisell2.venue.addons.empty': '暂无可选附加商品',
|
|
@@ -320,6 +326,9 @@ export default {
|
|
|
320
326
|
'pisell2.venue.checkout.hotline': '客服熱線',
|
|
321
327
|
'pisell2.venue.checkout.estimated.total': '預估總價',
|
|
322
328
|
'pisell2.venue.checkout.change': '修改',
|
|
329
|
+
'pisell2.venue.checkout.duration.hours_minutes': '{hours}小時{minutes}分鐘',
|
|
330
|
+
'pisell2.venue.checkout.duration.hours': '{hours}小時',
|
|
331
|
+
'pisell2.venue.checkout.duration.minutes': '{minutes}分鐘',
|
|
323
332
|
'pisell2.venue.grid.loading': '加載中...',
|
|
324
333
|
'pisell2.venue.legend.product.fallback': '商品',
|
|
325
334
|
'pisell2.venue.addons.empty': '暫無可選附加商品',
|
|
@@ -441,6 +450,9 @@ export default {
|
|
|
441
450
|
'pisell2.venue.checkout.hotline': 'サポート窓口',
|
|
442
451
|
'pisell2.venue.checkout.estimated.total': '見積合計',
|
|
443
452
|
'pisell2.venue.checkout.change': '変更',
|
|
453
|
+
'pisell2.venue.checkout.duration.hours_minutes': '{hours}時間{minutes}分',
|
|
454
|
+
'pisell2.venue.checkout.duration.hours': '{hours}時間',
|
|
455
|
+
'pisell2.venue.checkout.duration.minutes': '{minutes}分',
|
|
444
456
|
'pisell2.venue.grid.loading': '読み込み中...',
|
|
445
457
|
'pisell2.venue.legend.product.fallback': '商品',
|
|
446
458
|
'pisell2.venue.addons.empty': '追加できる商品がありません。',
|
|
@@ -562,6 +574,9 @@ export default {
|
|
|
562
574
|
'pisell2.venue.checkout.hotline': 'Central de suporte',
|
|
563
575
|
'pisell2.venue.checkout.estimated.total': 'Total estimado',
|
|
564
576
|
'pisell2.venue.checkout.change': 'Alterar',
|
|
577
|
+
'pisell2.venue.checkout.duration.hours_minutes': '{hours} h {minutes} min',
|
|
578
|
+
'pisell2.venue.checkout.duration.hours': '{hours} h',
|
|
579
|
+
'pisell2.venue.checkout.duration.minutes': '{minutes} min',
|
|
565
580
|
'pisell2.venue.grid.loading': 'Carregando...',
|
|
566
581
|
'pisell2.venue.legend.product.fallback': 'Produto',
|
|
567
582
|
'pisell2.venue.addons.empty': 'Nenhum adicional disponível.',
|
|
@@ -20,7 +20,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
20
20
|
}[];
|
|
21
21
|
minInputNumberProps?: undefined;
|
|
22
22
|
maxInputNumberProps?: undefined;
|
|
23
|
-
|
|
23
|
+
component?: undefined;
|
|
24
24
|
isSearchServer?: undefined;
|
|
25
25
|
showSearch?: undefined;
|
|
26
26
|
showTime?: undefined;
|
|
@@ -46,7 +46,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
46
46
|
mode?: undefined;
|
|
47
47
|
maxTagCount?: undefined;
|
|
48
48
|
options?: undefined;
|
|
49
|
-
|
|
49
|
+
component?: undefined;
|
|
50
50
|
isSearchServer?: undefined;
|
|
51
51
|
showSearch?: undefined;
|
|
52
52
|
showTime?: undefined;
|
|
@@ -91,7 +91,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
91
91
|
options: () => Promise<any>;
|
|
92
92
|
minInputNumberProps?: undefined;
|
|
93
93
|
maxInputNumberProps?: undefined;
|
|
94
|
-
|
|
94
|
+
component?: undefined;
|
|
95
95
|
isSearchServer?: undefined;
|
|
96
96
|
showSearch?: undefined;
|
|
97
97
|
showTime?: undefined;
|
|
@@ -111,7 +111,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
111
111
|
options?: undefined;
|
|
112
112
|
minInputNumberProps?: undefined;
|
|
113
113
|
maxInputNumberProps?: undefined;
|
|
114
|
-
|
|
114
|
+
component?: undefined;
|
|
115
115
|
isSearchServer?: undefined;
|
|
116
116
|
showSearch?: undefined;
|
|
117
117
|
showTime?: undefined;
|
|
@@ -133,7 +133,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
133
133
|
maxTagCount?: undefined;
|
|
134
134
|
minInputNumberProps?: undefined;
|
|
135
135
|
maxInputNumberProps?: undefined;
|
|
136
|
-
|
|
136
|
+
component?: undefined;
|
|
137
137
|
showTime?: undefined;
|
|
138
138
|
};
|
|
139
139
|
sort?: undefined;
|
|
@@ -152,7 +152,7 @@ export declare const getFilterButtonList: () => ({
|
|
|
152
152
|
options?: undefined;
|
|
153
153
|
minInputNumberProps?: undefined;
|
|
154
154
|
maxInputNumberProps?: undefined;
|
|
155
|
-
|
|
155
|
+
component?: undefined;
|
|
156
156
|
isSearchServer?: undefined;
|
|
157
157
|
showSearch?: undefined;
|
|
158
158
|
};
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
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); }
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
-
import { Button } from '@pisell/materials';
|
|
9
|
+
import { Button, PisellToast } from '@pisell/materials';
|
|
10
10
|
import { image as imageAli, locales } from '@pisell/utils';
|
|
11
11
|
import NumericStepper from "../../pro/NumericStepper";
|
|
12
12
|
import PisellPriceText from "../productSelect/components/pisellPriceText";
|
|
@@ -173,6 +173,21 @@ var PisellSalesProductCard = function PisellSalesProductCard(_ref2) {
|
|
|
173
173
|
max: cardMaxQuantity,
|
|
174
174
|
step: (_stepperProps$step = stepperProps === null || stepperProps === void 0 ? void 0 : stepperProps.step) !== null && _stepperProps$step !== void 0 ? _stepperProps$step : 1,
|
|
175
175
|
disabled: mergedDisabled,
|
|
176
|
+
onLimitExceeded: function onLimitExceeded(limitMeta) {
|
|
177
|
+
// 仅当 item_rule_limit 显式给出对应方向的文案时才提示。
|
|
178
|
+
// 达到库存 / 默认上限等"非 item_rule_limit 触发"的场景不弹 toast。
|
|
179
|
+
var raw = stepperProps === null || stepperProps === void 0 ? void 0 : stepperProps.limitMessage;
|
|
180
|
+
// 兼容旧 string 用法(等价于 { max: string })
|
|
181
|
+
var limitMsg = typeof raw === 'string' ? {
|
|
182
|
+
max: raw
|
|
183
|
+
} : raw || {};
|
|
184
|
+
var content = limitMeta.reason === 'max' ? limitMsg.max : limitMsg.min;
|
|
185
|
+
if (!content) return;
|
|
186
|
+
PisellToast({
|
|
187
|
+
content: content,
|
|
188
|
+
duration: 2
|
|
189
|
+
});
|
|
190
|
+
},
|
|
176
191
|
onChange: function onChange(next, stepperMeta) {
|
|
177
192
|
var _stepperProps$min4;
|
|
178
193
|
var safeNext = Math.max((_stepperProps$min4 = stepperProps === null || stepperProps === void 0 ? void 0 : stepperProps.min) !== null && _stepperProps$min4 !== void 0 ? _stepperProps$min4 : 0, Math.min(cardMaxQuantity, next));
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BundleGroupItem, BundleItem, OptionGroupItem, SkuCardConfig, VariantProductItem, VariantGroupItem } from '../skuOptionsSelection/types';
|
|
3
3
|
import type { NumericStepperProps } from '../../pro/NumericStepper/index';
|
|
4
|
+
/**
|
|
5
|
+
* 达到 min / max 限制时希望展示的提示文案。
|
|
6
|
+
* 通常来自 item_rule_limit.maxValidationMessage / minValidationMessage。
|
|
7
|
+
* 对应字段为空时该方向不 toast(仍会走 locales 里的默认兑底,详见 PisellSalesProductCard)。
|
|
8
|
+
*/
|
|
9
|
+
export interface SalesProductLimitMessage {
|
|
10
|
+
max?: string;
|
|
11
|
+
min?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 商品卡使用的 stepper 配置,在 NumericStepperProps 基础上扩展业务字段。
|
|
15
|
+
*/
|
|
16
|
+
export declare type SalesProductStepperProps = NumericStepperProps & {
|
|
17
|
+
/**
|
|
18
|
+
* 达到限制时希望展示的提示文案。支持:
|
|
19
|
+
* - string:等价于 { max: string }(兼容旧用法);
|
|
20
|
+
* - { min?, max? }:min / max 分开配置。
|
|
21
|
+
*/
|
|
22
|
+
limitMessage?: string | SalesProductLimitMessage;
|
|
23
|
+
};
|
|
4
24
|
export declare type SalesProductText = string | Record<string, string>;
|
|
5
25
|
/**
|
|
6
26
|
* 从 SKUOptionsSelection 数据结构反推的完整商品定义。
|
|
@@ -103,7 +123,7 @@ export interface PisellSalesProductCardProps {
|
|
|
103
123
|
/** PRD products[i] value,组件会基于它进行增量更新并回传 */
|
|
104
124
|
value?: Partial<SalesProductValue>;
|
|
105
125
|
disabled?: boolean;
|
|
106
|
-
stepperProps?:
|
|
126
|
+
stepperProps?: SalesProductStepperProps;
|
|
107
127
|
optionsText?: string;
|
|
108
128
|
skuCardConfig?: SkuCardConfig;
|
|
109
129
|
cartElementId?: string;
|
|
@@ -8,7 +8,7 @@ import PisellSalesProductCard from "../../pisellSalesProductCard";
|
|
|
8
8
|
* 商品项内部渲染 PisellSalesProductCard。
|
|
9
9
|
*/
|
|
10
10
|
var ProductCardV2 = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
-
var _ref2, _item$product_id2, _item$item_rule_limit, _item$item_rule_limit2;
|
|
11
|
+
var _ref2, _item$product_id2, _item$item_rule_limit, _item$item_rule_limit2, _item$item_rule_limit3, _item$item_rule_limit4, _item$item_rule_limit5, _item$item_rule_limit6;
|
|
12
12
|
var item = _ref.item,
|
|
13
13
|
index = _ref.index,
|
|
14
14
|
context = _ref.context,
|
|
@@ -42,7 +42,11 @@ var ProductCardV2 = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
42
|
product: item,
|
|
43
43
|
stepperProps: {
|
|
44
44
|
min: item === null || item === void 0 || (_item$item_rule_limit = item.item_rule_limit) === null || _item$item_rule_limit === void 0 ? void 0 : _item$item_rule_limit.min,
|
|
45
|
-
max: item === null || item === void 0 || (_item$item_rule_limit2 = item.item_rule_limit) === null || _item$item_rule_limit2 === void 0 ? void 0 : _item$item_rule_limit2.
|
|
45
|
+
max: item === null || item === void 0 || (_item$item_rule_limit2 = item.item_rule_limit) === null || _item$item_rule_limit2 === void 0 ? void 0 : _item$item_rule_limit2.remainingMax,
|
|
46
|
+
limitMessage: {
|
|
47
|
+
max: (_item$item_rule_limit3 = item === null || item === void 0 || (_item$item_rule_limit4 = item.item_rule_limit) === null || _item$item_rule_limit4 === void 0 ? void 0 : _item$item_rule_limit4.maxValidationMessage) !== null && _item$item_rule_limit3 !== void 0 ? _item$item_rule_limit3 : item === null || item === void 0 || (_item$item_rule_limit5 = item.item_rule_limit) === null || _item$item_rule_limit5 === void 0 ? void 0 : _item$item_rule_limit5.validationMessage,
|
|
48
|
+
min: item === null || item === void 0 || (_item$item_rule_limit6 = item.item_rule_limit) === null || _item$item_rule_limit6 === void 0 ? void 0 : _item$item_rule_limit6.minValidationMessage
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
51
|
value: itemValue,
|
|
48
52
|
skuCardConfig: {
|
|
@@ -3,6 +3,6 @@ export interface ImageUploadProps {
|
|
|
3
3
|
value?: string;
|
|
4
4
|
onChange?: (val: string) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare const getBaseTime: (size: number) =>
|
|
6
|
+
export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
|
|
7
7
|
declare const ImageUpload: React.FC<ImageUploadProps>;
|
|
8
8
|
export default ImageUpload;
|
|
@@ -17,6 +17,18 @@ export interface NumericStepperChangeMeta {
|
|
|
17
17
|
action: 'increase' | 'decrease' | 'input';
|
|
18
18
|
event?: React.MouseEvent<HTMLDivElement>;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 达到上/下限时触发的额外上下文。
|
|
22
|
+
* - reason='max': 已达最大值(还想继续增加)
|
|
23
|
+
* - reason='min': 已达最小值(还想继续减少)
|
|
24
|
+
*/
|
|
25
|
+
export interface NumericStepperLimitExceededMeta {
|
|
26
|
+
reason: 'max' | 'min';
|
|
27
|
+
currentValue: number;
|
|
28
|
+
min: number;
|
|
29
|
+
max: number;
|
|
30
|
+
event?: React.MouseEvent<HTMLDivElement>;
|
|
31
|
+
}
|
|
20
32
|
export interface NumericStepperProps {
|
|
21
33
|
/** 当前值 */
|
|
22
34
|
value?: number;
|
|
@@ -32,6 +44,13 @@ export interface NumericStepperProps {
|
|
|
32
44
|
disabled?: boolean;
|
|
33
45
|
/** 值变化回调 */
|
|
34
46
|
onChange?: (value: number, meta?: NumericStepperChangeMeta) => void;
|
|
47
|
+
/**
|
|
48
|
+
* 达到 min/max 限制时点击对应按钮的回调。
|
|
49
|
+
* - 仅在 currentValue 已到达上/下限时触发,不会再触发 onChange。
|
|
50
|
+
* - 组件本身未被 `disabled` 整体禁用时才会触发;整体 `disabled` 仍保持"完全屏蔽"语义。
|
|
51
|
+
* 常见用途:在加号被禁用时弹出 toast 告知用户已达限购上限。
|
|
52
|
+
*/
|
|
53
|
+
onLimitExceeded?: (meta: NumericStepperLimitExceededMeta) => void;
|
|
35
54
|
/** 自定义类名 */
|
|
36
55
|
className?: string;
|
|
37
56
|
theme?: {
|
|
@@ -24,6 +24,12 @@ import "./index.less";
|
|
|
24
24
|
* - capsule: 胶囊式,按钮和数字在一个圆角容器内
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 达到上/下限时触发的额外上下文。
|
|
29
|
+
* - reason='max': 已达最大值(还想继续增加)
|
|
30
|
+
* - reason='min': 已达最小值(还想继续减少)
|
|
31
|
+
*/
|
|
32
|
+
|
|
27
33
|
var NumericStepper = function NumericStepper(_ref) {
|
|
28
34
|
var value = _ref.value,
|
|
29
35
|
_ref$defaultValue = _ref.defaultValue,
|
|
@@ -37,6 +43,7 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
37
43
|
_ref$disabled = _ref.disabled,
|
|
38
44
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
39
45
|
onChange = _ref.onChange,
|
|
46
|
+
onLimitExceeded = _ref.onLimitExceeded,
|
|
40
47
|
className = _ref.className,
|
|
41
48
|
styles = _ref.styles,
|
|
42
49
|
_ref$size = _ref.size,
|
|
@@ -98,8 +105,16 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
98
105
|
action: 'decrease',
|
|
99
106
|
event: event
|
|
100
107
|
});
|
|
108
|
+
return;
|
|
101
109
|
}
|
|
102
|
-
|
|
110
|
+
onLimitExceeded === null || onLimitExceeded === void 0 || onLimitExceeded({
|
|
111
|
+
reason: 'min',
|
|
112
|
+
currentValue: currentValue,
|
|
113
|
+
min: min,
|
|
114
|
+
max: max,
|
|
115
|
+
event: event
|
|
116
|
+
});
|
|
117
|
+
}, [currentValue, step, min, max, disabled, handleValueChange, onLimitExceeded]);
|
|
103
118
|
|
|
104
119
|
// 增加数值
|
|
105
120
|
var handleIncrease = useCallback(function (event) {
|
|
@@ -119,8 +134,16 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
119
134
|
action: 'increase',
|
|
120
135
|
event: event
|
|
121
136
|
});
|
|
137
|
+
return;
|
|
122
138
|
}
|
|
123
|
-
|
|
139
|
+
onLimitExceeded === null || onLimitExceeded === void 0 || onLimitExceeded({
|
|
140
|
+
reason: 'max',
|
|
141
|
+
currentValue: currentValue,
|
|
142
|
+
min: min,
|
|
143
|
+
max: max,
|
|
144
|
+
event: event
|
|
145
|
+
});
|
|
146
|
+
}, [currentValue, step, min, max, disabled, handleValueChange, onLimitExceeded]);
|
|
124
147
|
var handleChange = function handleChange(e) {
|
|
125
148
|
if (!e) {
|
|
126
149
|
setTempValue(min.toString());
|
|
@@ -194,8 +217,12 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
194
217
|
type: "button",
|
|
195
218
|
className: classNames('numeric-stepper-button', 'numeric-stepper-minus', {
|
|
196
219
|
'numeric-stepper-button-disabled': isDecreaseDisabled
|
|
197
|
-
})
|
|
198
|
-
|
|
220
|
+
})
|
|
221
|
+
// 仅组件整体禁用时才真正 disable button,
|
|
222
|
+
// 避免原生 disabled 拦截 wrapper 的 onClick,
|
|
223
|
+
// 从而让 "已达下限" 的点击能被 handleDecrease 捕获并触发 onLimitExceeded。
|
|
224
|
+
,
|
|
225
|
+
disabled: disabled
|
|
199
226
|
}, minusIcon || /*#__PURE__*/React.createElement("svg", {
|
|
200
227
|
width: "16",
|
|
201
228
|
height: "16",
|
|
@@ -275,8 +302,12 @@ var NumericStepper = function NumericStepper(_ref) {
|
|
|
275
302
|
type: "button",
|
|
276
303
|
className: classNames('numeric-stepper-button', 'numeric-stepper-plus', {
|
|
277
304
|
'numeric-stepper-button-disabled': isIncreaseDisabled
|
|
278
|
-
})
|
|
279
|
-
|
|
305
|
+
})
|
|
306
|
+
// 仅组件整体禁用时才真正 disable button,
|
|
307
|
+
// 避免原生 disabled 拦截 wrapper 的 onClick,
|
|
308
|
+
// 从而让 "已达上限" 的点击能被 handleIncrease 捕获并触发 onLimitExceeded。
|
|
309
|
+
,
|
|
310
|
+
disabled: disabled
|
|
280
311
|
}, plusIcon || /*#__PURE__*/React.createElement("svg", {
|
|
281
312
|
width: "16",
|
|
282
313
|
height: "16",
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
|
|
4
|
-
state: FormState;
|
|
5
|
-
} & {
|
|
6
|
-
dispatch: (params: {
|
|
7
|
-
type: string;
|
|
8
|
-
payload: any;
|
|
9
|
-
}) => void;
|
|
10
|
-
}>;
|
|
1
|
+
export declare const Provider: any, Context: any;
|