const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_utils = require("../Packages/utils.js");
const require_index = require("../Divider/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
let _ant_design_icons = require("@ant-design/icons");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/productCard/components/AmountFooter/index.tsx
const prefix = "pisell-lowcode-";
const Footer = ({ item, hideDivider, type, isOnlyTotal }) => {
	const { total, origin_total, symbol, tip, num, discount_reason, totalDifference = 0 } = item;
	/**
	* @title: 折扣
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2024-11-22 13:50
	*/
	const isDiscount = (0, react.useMemo)(() => {
		if (!origin_total) return false;
		return Number(total) != Number(origin_total);
	}, [total, origin_total]);
	const renderDiscountReason = () => {
		if (isDiscount && discount_reason && type === "total") {
			if (Array.isArray(discount_reason)) return /* @__PURE__ */ react.default.createElement("div", { className: `${prefix}product-item-discount-reason` }, discount_reason.map((reason, index) => {
				return /* @__PURE__ */ react.default.createElement(antd.Tag, {
					key: index,
					color: "red"
				}, reason);
			}));
			return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(require_index.default, null), /* @__PURE__ */ react.default.createElement("div", { className: `${prefix}product-item-discount-reason` }, /* @__PURE__ */ react.default.createElement("span", null, `${_pisell_utils.locales.getText("pisell2.product.card.discount.reason")}: ${discount_reason}`)));
		}
		return null;
	};
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !hideDivider ? /* @__PURE__ */ react.default.createElement(require_index.default, { type: type !== "total" ? "inside" : "" }) : null, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${prefix}packages-product-footer`, hideDivider && `${prefix}packages-product-hide-divider-footer`, isOnlyTotal && `${prefix}packages-product-only-total-footer`) }, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${prefix}packages-product-footer-price-wrap`) }, !isOnlyTotal ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${prefix}packages-product-footer-price`) }, /* @__PURE__ */ react.default.createElement("span", null, require_utils._formatAmount(total, symbol)), tip ? /* @__PURE__ */ react.default.createElement(antd.Tooltip, {
		title: _pisell_utils.locales.getText(tip),
		destroyTooltipOnHide: true
	}, /* @__PURE__ */ react.default.createElement(_ant_design_icons.QuestionCircleOutlined, { style: {
		fontSize: "16px",
		color: "#1570ef"
	} })) : null), /* @__PURE__ */ react.default.createElement("span", null, `×${num}`)) : null, /* @__PURE__ */ react.default.createElement("span", { className: `${prefix}packages-product-footer-total` }, isDiscount ? /* @__PURE__ */ react.default.createElement("span", { className: `${prefix}packages-product-footer-origin-total` }, require_utils._formatAmount(origin_total * num, symbol, 2)) : null, /* @__PURE__ */ react.default.createElement("span", null, require_utils._formatAmount(total * num - (totalDifference !== null && totalDifference !== void 0 ? totalDifference : 0), symbol))))), renderDiscountReason());
};
//#endregion
exports.default = Footer;
