@pisell/materials 6.2.32 → 6.2.33
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +20 -20
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.d.ts +3 -0
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.js +76 -0
- package/es/components/productCard/cartSkuCard/components/AmountFooter/index.less +75 -0
- package/es/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +3 -0
- package/es/components/productCard/cartSkuCard/components/MultiDay/index.js +82 -0
- package/es/components/productCard/cartSkuCard/components/MultiDay/index.less +31 -0
- package/es/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +14 -0
- package/es/components/productCard/cartSkuCard/components/MultiDay/utils.js +56 -0
- package/es/components/productCard/cartSkuCard/components/resources/index.d.ts +1 -2
- package/es/components/productCard/cartSkuCard/components/resources/index.js +6 -8
- package/es/components/productCard/cartSkuCard/components/specs/index.less +1 -1
- package/es/components/productCard/cartSkuCard/index.js +5 -5
- package/es/components/productCard/components/Header/index.js +1 -14
- package/es/components/productCard/components/Header/index.less +0 -20
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.d.ts +3 -0
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.js +80 -0
- package/lib/components/productCard/cartSkuCard/components/AmountFooter/index.less +75 -0
- package/lib/components/productCard/cartSkuCard/components/MultiDay/index.d.ts +3 -0
- package/lib/components/productCard/cartSkuCard/components/MultiDay/index.js +71 -0
- package/lib/components/productCard/cartSkuCard/components/MultiDay/index.less +31 -0
- package/lib/components/productCard/cartSkuCard/components/MultiDay/utils.d.ts +14 -0
- package/lib/components/productCard/cartSkuCard/components/MultiDay/utils.js +77 -0
- package/lib/components/productCard/cartSkuCard/components/resources/index.d.ts +1 -2
- package/lib/components/productCard/cartSkuCard/components/resources/index.js +4 -6
- package/lib/components/productCard/cartSkuCard/components/specs/index.less +1 -1
- package/lib/components/productCard/cartSkuCard/index.js +3 -4
- package/lib/components/productCard/components/Header/index.js +0 -4
- package/lib/components/productCard/components/Header/index.less +0 -20
- package/package.json +3 -3
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Divider } from 'antd';
|
|
4
|
+
import { Tag, Tooltip } from 'antd';
|
|
5
|
+
import { QuestionCircleOutlined } from '@ant-design/icons';
|
|
6
|
+
import { _formatAmount } from "../packages/utils";
|
|
7
|
+
import "./index.less";
|
|
8
|
+
import { locales } from '@pisell/utils';
|
|
9
|
+
import { PREFIX } from "../../index";
|
|
10
|
+
var Footer = function Footer(_ref) {
|
|
11
|
+
var item = _ref.item,
|
|
12
|
+
hideDivider = _ref.hideDivider,
|
|
13
|
+
type = _ref.type,
|
|
14
|
+
isOnlyTotal = _ref.isOnlyTotal;
|
|
15
|
+
var total = item.total,
|
|
16
|
+
origin_total = item.origin_total,
|
|
17
|
+
symbol = item.symbol,
|
|
18
|
+
tip = item.tip,
|
|
19
|
+
num = item.num,
|
|
20
|
+
discount_reason = item.discount_reason;
|
|
21
|
+
/**
|
|
22
|
+
* @title: 折扣
|
|
23
|
+
* @description:
|
|
24
|
+
* @param {*} useMemo
|
|
25
|
+
* @return {*}
|
|
26
|
+
* @Author: WangHan
|
|
27
|
+
* @Date: 2024-11-22 13:50
|
|
28
|
+
*/
|
|
29
|
+
var isDiscount = useMemo(function () {
|
|
30
|
+
// item中没有该属性则不展示
|
|
31
|
+
if (!origin_total) return false;
|
|
32
|
+
return Number(total) != Number(origin_total);
|
|
33
|
+
}, [total, origin_total]);
|
|
34
|
+
var renderDiscountReason = function renderDiscountReason() {
|
|
35
|
+
if (isDiscount && discount_reason && type === 'total') {
|
|
36
|
+
if (Array.isArray(discount_reason)) {
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "".concat(PREFIX, "_discount-reason")
|
|
39
|
+
}, discount_reason.map(function (reason, index) {
|
|
40
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
41
|
+
key: index,
|
|
42
|
+
color: "red"
|
|
43
|
+
}, reason);
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: "".concat(PREFIX, "_discount-reason")
|
|
48
|
+
}, /*#__PURE__*/React.createElement("span", null, "".concat(locales.getText('pisell2.product.card.discount.reason'), ": ").concat(discount_reason))));
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !hideDivider ? /*#__PURE__*/React.createElement(Divider, {
|
|
53
|
+
style: {
|
|
54
|
+
margin: 0
|
|
55
|
+
}
|
|
56
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: classNames("".concat(PREFIX, "__product-footer"), hideDivider && "".concat(PREFIX, "__hide-divider-footer"), isOnlyTotal && "".concat(PREFIX, "__only-total-footer"))
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: classNames("".concat(PREFIX, "__footer-price-wrap"))
|
|
60
|
+
}, !isOnlyTotal ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: classNames("".concat(PREFIX, "__footer-price"))
|
|
62
|
+
}, /*#__PURE__*/React.createElement("span", null, _formatAmount(total, symbol)), tip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
63
|
+
title: locales.getText(tip),
|
|
64
|
+
destroyTooltipOnHide: true
|
|
65
|
+
}, /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
|
|
66
|
+
style: {
|
|
67
|
+
fontSize: '16px',
|
|
68
|
+
color: '#1570ef'
|
|
69
|
+
}
|
|
70
|
+
})) : null), /*#__PURE__*/React.createElement("span", null, "\xD7".concat(num))) : null, /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: "".concat(PREFIX, "__footer-total")
|
|
72
|
+
}, isDiscount ? /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
className: "".concat(PREFIX, "__footer-origin-total")
|
|
74
|
+
}, _formatAmount(origin_total * num, symbol, 2)) : null, /*#__PURE__*/React.createElement("span", null, _formatAmount(total * num, symbol))))), renderDiscountReason());
|
|
75
|
+
};
|
|
76
|
+
export default Footer;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.pisell-cart-sku-card {
|
|
2
|
+
&__product-footer {
|
|
3
|
+
color: var(--Gray-500, #667085);
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-weight: 600;
|
|
7
|
+
line-height: 20px;
|
|
8
|
+
> div {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
&__only-total-footer {
|
|
14
|
+
> div {
|
|
15
|
+
justify-content: end !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__footer-price {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__footer-discount {
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
line-height: 18px;
|
|
29
|
+
text-decoration-line: line-through;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__footer-total {
|
|
33
|
+
color: var(--Gray-900, #101828);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__footer-origin-total {
|
|
37
|
+
color: var(--Gray-500, #667085);
|
|
38
|
+
text-align: center;
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 400;
|
|
42
|
+
line-height: 18px; /* 150% */
|
|
43
|
+
text-decoration-line: line-through;
|
|
44
|
+
margin-right: 8px;
|
|
45
|
+
display: inline-block;
|
|
46
|
+
transform: translateY(-1px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__hide-divider-footer {
|
|
50
|
+
margin-top: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&-product-item-discount-reason {
|
|
54
|
+
color: var(--gray-500, #667085);
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
line-height: 20px;
|
|
59
|
+
margin-top: 4px;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
gap: 4px;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
|
|
65
|
+
> span {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
max-width: 100%;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { Divider } from 'antd';
|
|
10
|
+
import AmountFooter from "../AmountFooter";
|
|
11
|
+
import { formatMultiDayDate } from "../../../utils";
|
|
12
|
+
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
13
|
+
import "./index.less";
|
|
14
|
+
import { formatDateRanges } from "./utils";
|
|
15
|
+
import { PREFIX } from "../../index";
|
|
16
|
+
var MultiDay = function MultiDay(_ref) {
|
|
17
|
+
var _context$appHelper;
|
|
18
|
+
var dataSource = _ref.dataSource,
|
|
19
|
+
hideDivider = _ref.hideDivider;
|
|
20
|
+
var items = dataSource.items,
|
|
21
|
+
symbol = dataSource.symbol,
|
|
22
|
+
locale = dataSource.locale;
|
|
23
|
+
var translationOriginal = function translationOriginal(text) {
|
|
24
|
+
return '';
|
|
25
|
+
};
|
|
26
|
+
var context = useEngineContext();
|
|
27
|
+
var utils = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
|
|
28
|
+
translationOriginal = (utils === null || utils === void 0 ? void 0 : utils.translationOriginal) || (utils === null || utils === void 0 ? void 0 : utils.translation);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @title: 商品单价 + 套餐价格
|
|
32
|
+
* @description:
|
|
33
|
+
* @param {*} useMemo
|
|
34
|
+
* @return {*}
|
|
35
|
+
* @Author: WangHan
|
|
36
|
+
* @Date: 2024-12-28 23:00
|
|
37
|
+
*/
|
|
38
|
+
var lists = useMemo(function () {
|
|
39
|
+
// if (!items?.length) return [];
|
|
40
|
+
|
|
41
|
+
// // 套餐明细
|
|
42
|
+
// const bundleDetails = bundle
|
|
43
|
+
// ?.map(
|
|
44
|
+
// (b: any) =>
|
|
45
|
+
// `${translationOriginal(b?.title)} (${symbol}${
|
|
46
|
+
// Number(b.price) * Number(b.num)
|
|
47
|
+
// })`
|
|
48
|
+
// )
|
|
49
|
+
// ?.join('+');
|
|
50
|
+
|
|
51
|
+
return formatDateRanges([dataSource]);
|
|
52
|
+
}, [items, dataSource]);
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classNames("".concat(PREFIX, "__multi-day-wrap"))
|
|
55
|
+
}, lists === null || lists === void 0 ? void 0 : lists.map(function (m, index) {
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
key: index
|
|
58
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
59
|
+
style: {
|
|
60
|
+
margin: '4px 0'
|
|
61
|
+
}
|
|
62
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: classNames("".concat(PREFIX, "__multi-day"))
|
|
64
|
+
}, /*#__PURE__*/React.createElement("div", null, formatMultiDayDate(_objectSpread(_objectSpread({}, m), {}, {
|
|
65
|
+
locale: locale
|
|
66
|
+
}))), /*#__PURE__*/React.createElement(AmountFooter, {
|
|
67
|
+
item: _objectSpread(_objectSpread({}, m), {}, {
|
|
68
|
+
symbol: symbol
|
|
69
|
+
}),
|
|
70
|
+
hideDivider: true
|
|
71
|
+
})));
|
|
72
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: classNames("".concat(PREFIX, "__multi-day-total-wrap"))
|
|
74
|
+
}, /*#__PURE__*/React.createElement(AmountFooter, {
|
|
75
|
+
item: _objectSpread(_objectSpread({}, dataSource), {}, {
|
|
76
|
+
num: 1
|
|
77
|
+
}),
|
|
78
|
+
type: "total",
|
|
79
|
+
isOnlyTotal: true
|
|
80
|
+
})));
|
|
81
|
+
};
|
|
82
|
+
export default MultiDay;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.pisell-cart-sku-card {
|
|
2
|
+
&__multi-day-wrap {
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
&__multi-day {
|
|
6
|
+
color: var(--Gray-500, #667085);
|
|
7
|
+
font-size: 14px;
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
line-height: 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&__multi-day-total {
|
|
15
|
+
color: var(--Gray-900, #101828);
|
|
16
|
+
text-align: right;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
line-height: 20px;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__multi-day-total-discount {
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
line-height: 18px;
|
|
28
|
+
text-decoration-line: line-through;
|
|
29
|
+
color: var(--Gray-500, #667085);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface InputItem {
|
|
2
|
+
start_date: string;
|
|
3
|
+
end_date: string;
|
|
4
|
+
total: number;
|
|
5
|
+
num: number;
|
|
6
|
+
}
|
|
7
|
+
interface OutputItem {
|
|
8
|
+
start_date: string;
|
|
9
|
+
end_date: string;
|
|
10
|
+
total: number;
|
|
11
|
+
num: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function formatDateRanges(list: InputItem[]): OutputItem[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
import dayjs from 'dayjs';
|
|
8
|
+
|
|
9
|
+
// 定义输入数据的接口
|
|
10
|
+
|
|
11
|
+
// 定义输出数据的接口
|
|
12
|
+
|
|
13
|
+
export function formatDateRanges(list) {
|
|
14
|
+
var result = [];
|
|
15
|
+
var currentGroup = null;
|
|
16
|
+
list.forEach(function (item, index) {
|
|
17
|
+
// Convert string dates using dayjs
|
|
18
|
+
var currentStartDate = dayjs(item.start_date);
|
|
19
|
+
var currentEndDate = dayjs(item.end_date);
|
|
20
|
+
var currentTotal = item.total;
|
|
21
|
+
var currentNum = item.num;
|
|
22
|
+
if (!currentGroup) {
|
|
23
|
+
// Start a new group
|
|
24
|
+
currentGroup = _objectSpread(_objectSpread({}, item), {}, {
|
|
25
|
+
start_date: currentStartDate.format('YYYY-MM-DD'),
|
|
26
|
+
end_date: currentEndDate.format('YYYY-MM-DD'),
|
|
27
|
+
total: currentTotal,
|
|
28
|
+
num: currentNum
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
var prevEndDate = dayjs(currentGroup.end_date);
|
|
32
|
+
|
|
33
|
+
// Check if current item can be merged with current group
|
|
34
|
+
if (currentTotal === currentGroup.total && prevEndDate.isSame(currentStartDate, 'day')) {
|
|
35
|
+
// Update end date and add up num
|
|
36
|
+
currentGroup.end_date = currentEndDate.format('YYYY-MM-DD');
|
|
37
|
+
currentGroup.num += currentNum;
|
|
38
|
+
} else {
|
|
39
|
+
// Push current group and start a new one
|
|
40
|
+
result.push(currentGroup);
|
|
41
|
+
currentGroup = _objectSpread(_objectSpread({}, item), {}, {
|
|
42
|
+
start_date: currentStartDate.format('YYYY-MM-DD'),
|
|
43
|
+
end_date: currentEndDate.format('YYYY-MM-DD'),
|
|
44
|
+
total: currentTotal,
|
|
45
|
+
num: currentNum
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Push the last group
|
|
51
|
+
if (index === list.length - 1 && currentGroup) {
|
|
52
|
+
result.push(currentGroup);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
@@ -29,13 +29,11 @@ var Resources = function Resources(props) {
|
|
|
29
29
|
return null;
|
|
30
30
|
}) : null;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return
|
|
38
|
-
className: "".concat(PREFIX, "__resources")
|
|
39
|
-
}, renderContent());
|
|
32
|
+
if (isMultipleResource && (multiResources === null || multiResources === void 0 ? void 0 : multiResources.length) > 0) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "".concat(PREFIX, "__resources")
|
|
35
|
+
}, multiResources.map(renderResourceItem));
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
40
38
|
};
|
|
41
39
|
export default Resources;
|
|
@@ -20,11 +20,11 @@ import Packages from "./components/packages";
|
|
|
20
20
|
import Sales from "./components/sales";
|
|
21
21
|
import { SwipeAction } from "./components/swipeAction";
|
|
22
22
|
import Note from "./components/Note";
|
|
23
|
+
import AmountFooter from "./components/AmountFooter";
|
|
24
|
+
import Items from "./components/MultiDay";
|
|
23
25
|
import "./index.less";
|
|
24
26
|
import Iconfont from "../../iconfont";
|
|
25
27
|
import useEngineContext from "../../../hooks/useEngineContext";
|
|
26
|
-
import Items from "../components/MultiDay";
|
|
27
|
-
import AmountFooter from "../components/AmountFooter";
|
|
28
28
|
import Action from "../components/Action";
|
|
29
29
|
import { defaultValue } from "../status";
|
|
30
30
|
export var PREFIX = 'pisell-cart-sku-card';
|
|
@@ -101,9 +101,9 @@ var CartSkuCard = function CartSkuCard(props) {
|
|
|
101
101
|
return actions;
|
|
102
102
|
}, [dataSource, onDelete, isShowDelete, rightActions]);
|
|
103
103
|
var hideDivider = useMemo(function () {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
104
|
+
return false;
|
|
105
|
+
// const { bundle, relation_products } = dataSource;
|
|
106
|
+
// return bundle?.length || relation_products?.length;
|
|
107
107
|
}, [dataSource]);
|
|
108
108
|
var renderA2 = function renderA2() {
|
|
109
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BasicInfo, {
|
|
@@ -68,19 +68,6 @@ var Header = function Header(props) {
|
|
|
68
68
|
var showDelete = useMemo(function () {
|
|
69
69
|
return isShowDelete && !disabledEdit && !disabled;
|
|
70
70
|
}, [isShowDelete, disabledEdit, disabled]);
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @title: 商品数量角标
|
|
74
|
-
* @returns {*}
|
|
75
|
-
* @Author: Arthur
|
|
76
|
-
* @Date: 2025-08-08 10:26
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
|
-
var renderNumTag = function renderNumTag() {
|
|
80
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
81
|
-
className: classNames("num-tag")
|
|
82
|
-
}, num < 100 ? num : '99+');
|
|
83
|
-
};
|
|
84
71
|
var renderImage = function renderImage() {
|
|
85
72
|
if (!isShowImage) return null;
|
|
86
73
|
if (image) {
|
|
@@ -100,7 +87,7 @@ var Header = function Header(props) {
|
|
|
100
87
|
className: classNames("".concat(prefix, "product-header"), headerCenterStyle && "".concat(prefix, "product-options-header"))
|
|
101
88
|
}, showDelete ? /*#__PURE__*/React.createElement(DeleteButton, {
|
|
102
89
|
onDelete: onDelete
|
|
103
|
-
}) : null,
|
|
90
|
+
}) : null, renderImage(), id ? /*#__PURE__*/React.createElement("div", {
|
|
104
91
|
className: classNames("".concat(prefix, "product-right-wrap"), _defineProperty({}, "".concat(prefix, "product-right-wrap-stretch"), isShowEditProduct))
|
|
105
92
|
}, /*#__PURE__*/React.createElement("div", {
|
|
106
93
|
className: "".concat(prefix, "product-title")
|
|
@@ -6,26 +6,6 @@
|
|
|
6
6
|
align-items: center;
|
|
7
7
|
gap: 8px;
|
|
8
8
|
padding-right: 0 !important;
|
|
9
|
-
|
|
10
|
-
.num-tag {
|
|
11
|
-
background-color: #7f56da;
|
|
12
|
-
position: absolute;
|
|
13
|
-
left: 0;
|
|
14
|
-
top: 0;
|
|
15
|
-
border-radius: 12px;
|
|
16
|
-
min-width: 24px;
|
|
17
|
-
height: 24px;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
z-index: 1;
|
|
22
|
-
|
|
23
|
-
color: var(--Base-White, #fff);
|
|
24
|
-
font-size: 16px;
|
|
25
|
-
font-style: normal;
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
line-height: 16px;
|
|
28
|
-
}
|
|
29
9
|
}
|
|
30
10
|
|
|
31
11
|
&-product-options-header {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/productCard/cartSkuCard/components/AmountFooter/index.tsx
|
|
30
|
+
var AmountFooter_exports = {};
|
|
31
|
+
__export(AmountFooter_exports, {
|
|
32
|
+
default: () => AmountFooter_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(AmountFooter_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_antd2 = require("antd");
|
|
39
|
+
var import_icons = require("@ant-design/icons");
|
|
40
|
+
var import_utils = require("../packages/utils");
|
|
41
|
+
var import_index = require("./index.less");
|
|
42
|
+
var import_utils2 = require("@pisell/utils");
|
|
43
|
+
var import__ = require("../../index");
|
|
44
|
+
var Footer = ({ item, hideDivider, type, isOnlyTotal }) => {
|
|
45
|
+
const { total, origin_total, symbol, tip, num, discount_reason } = item;
|
|
46
|
+
const isDiscount = (0, import_react.useMemo)(() => {
|
|
47
|
+
if (!origin_total) return false;
|
|
48
|
+
return Number(total) != Number(origin_total);
|
|
49
|
+
}, [total, origin_total]);
|
|
50
|
+
const renderDiscountReason = () => {
|
|
51
|
+
if (isDiscount && discount_reason && type === "total") {
|
|
52
|
+
if (Array.isArray(discount_reason)) {
|
|
53
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}_discount-reason` }, discount_reason.map((reason, index) => {
|
|
54
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd2.Tag, { key: index, color: "red" }, reason);
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, null), /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}_discount-reason` }, /* @__PURE__ */ import_react.default.createElement("span", null, `${import_utils2.locales.getText(
|
|
58
|
+
"pisell2.product.card.discount.reason"
|
|
59
|
+
)}: ${discount_reason}`)));
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, !hideDivider ? /* @__PURE__ */ import_react.default.createElement(import_antd.Divider, { style: { margin: 0 } }) : null, /* @__PURE__ */ import_react.default.createElement(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: (0, import_classnames.default)(
|
|
67
|
+
`${import__.PREFIX}__product-footer`,
|
|
68
|
+
hideDivider && `${import__.PREFIX}__hide-divider-footer`,
|
|
69
|
+
isOnlyTotal && `${import__.PREFIX}__only-total-footer`
|
|
70
|
+
)
|
|
71
|
+
},
|
|
72
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${import__.PREFIX}__footer-price-wrap`) }, !isOnlyTotal ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${import__.PREFIX}__footer-price`) }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)(total, symbol)), tip ? /* @__PURE__ */ import_react.default.createElement(import_antd2.Tooltip, { title: import_utils2.locales.getText(tip), destroyTooltipOnHide: true }, /* @__PURE__ */ import_react.default.createElement(
|
|
73
|
+
import_icons.QuestionCircleOutlined,
|
|
74
|
+
{
|
|
75
|
+
style: { fontSize: "16px", color: "#1570ef" }
|
|
76
|
+
}
|
|
77
|
+
)) : null), /* @__PURE__ */ import_react.default.createElement("span", null, `×${num}`)) : null, /* @__PURE__ */ import_react.default.createElement("span", { className: `${import__.PREFIX}__footer-total` }, isDiscount ? /* @__PURE__ */ import_react.default.createElement("span", { className: `${import__.PREFIX}__footer-origin-total` }, (0, import_utils._formatAmount)(origin_total * num, symbol, 2)) : null, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_utils._formatAmount)(total * num, symbol))))
|
|
78
|
+
), renderDiscountReason());
|
|
79
|
+
};
|
|
80
|
+
var AmountFooter_default = Footer;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.pisell-cart-sku-card {
|
|
2
|
+
&__product-footer {
|
|
3
|
+
color: var(--Gray-500, #667085);
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-weight: 600;
|
|
7
|
+
line-height: 20px;
|
|
8
|
+
> div {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
&__only-total-footer {
|
|
14
|
+
> div {
|
|
15
|
+
justify-content: end !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__footer-price {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__footer-discount {
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
line-height: 18px;
|
|
29
|
+
text-decoration-line: line-through;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__footer-total {
|
|
33
|
+
color: var(--Gray-900, #101828);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__footer-origin-total {
|
|
37
|
+
color: var(--Gray-500, #667085);
|
|
38
|
+
text-align: center;
|
|
39
|
+
font-size: 12px;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 400;
|
|
42
|
+
line-height: 18px; /* 150% */
|
|
43
|
+
text-decoration-line: line-through;
|
|
44
|
+
margin-right: 8px;
|
|
45
|
+
display: inline-block;
|
|
46
|
+
transform: translateY(-1px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__hide-divider-footer {
|
|
50
|
+
margin-top: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&-product-item-discount-reason {
|
|
54
|
+
color: var(--gray-500, #667085);
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
line-height: 20px;
|
|
59
|
+
margin-top: 4px;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
gap: 4px;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
|
|
65
|
+
> span {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
max-width: 100%;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|