import index from "../../../../components/pisellPriceText/index.js";
import { PREFIX, productCardDefault } from "../../status.js";
import React, { useMemo } from "react";
import { locales } from "@pisell/utils";
import { Icon, PisellTags } from "@pisell/materials";
import "./index.less";
//#region src/plus/productSelect/ProductCard/SkuCard/components/MemberPrice/index.tsx
const MemberPrice = ({ props }) => {
	var _productCardDefault$s;
	const { dataSource, skuTextConfig } = props;
	const { isOpen, isMemberPrice, isIndicator, isIndicatorBorder, indicatorBackground, indicatorPaddingY, indicatorPaddingX, indicatorMarginX, indicatorRadius, indicatorBorderWidth, indicatorBorderColor, indicatorFontSize, indicatorFontWeight, indicatorColor, fontSize, fontWeight, color, indicatorIcon, customText } = (skuTextConfig === null || skuTextConfig === void 0 ? void 0 : skuTextConfig.skuMemberPriceConfig) || (productCardDefault === null || productCardDefault === void 0 || (_productCardDefault$s = productCardDefault.skuTextConfig) === null || _productCardDefault$s === void 0 ? void 0 : _productCardDefault$s.skuMemberPriceConfig) || {};
	if (!isOpen) return null;
	if (customText) return customText;
	const memberPriceStyle = useMemo(() => {
		return {
			fontSize,
			fontWeight,
			color
		};
	}, [
		fontSize,
		fontWeight,
		color
	]);
	/**
	* @title: 标识样式
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-09-08 11:50
	*/
	const indicatorStyle = useMemo(() => {
		return {
			backgroundColor: indicatorBackground,
			padding: `${indicatorPaddingY}px ${indicatorPaddingX}px`,
			margin: `0 ${indicatorMarginX}px`,
			border: isIndicatorBorder ? `${indicatorBorderWidth}px solid ${indicatorBorderColor}` : "none",
			borderRadius: indicatorRadius,
			fontSize: indicatorFontSize,
			fontWeight: indicatorFontWeight,
			color: indicatorColor
		};
	}, [
		indicatorBackground,
		indicatorPaddingY,
		indicatorPaddingX,
		indicatorMarginX,
		indicatorRadius,
		indicatorBorderWidth,
		indicatorBorderColor,
		indicatorFontSize,
		indicatorFontWeight,
		indicatorColor,
		isIndicatorBorder
	]);
	return /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__card-member-price` }, isMemberPrice ? /* @__PURE__ */ React.createElement("div", {
		className: `${PREFIX}__card-member-price-text`,
		style: memberPriceStyle
	}, /* @__PURE__ */ React.createElement(index, { value: (dataSource === null || dataSource === void 0 ? void 0 : dataSource.member_price) || 0 })) : null, isIndicator ? /* @__PURE__ */ React.createElement(PisellTags, {
		type: "pill_color",
		style: indicatorStyle
	}, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__card-member-price-tag` }, indicatorIcon ? indicatorIcon : /* @__PURE__ */ React.createElement(Icon, {
		type: "pisell2-check-verified-02",
		size: 12,
		rotate: 0,
		spin: false,
		color: "#CA8504"
	}), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.sku-card.member-price")))) : null);
};
//#endregion
export { MemberPrice as default };
