perf: 人等的显示

main
Lei OT 2 weeks ago
parent 15d30b0154
commit 0ab72e43eb

@ -210,6 +210,13 @@ export const PackageTypes = [
];
export const formatGroupSize = (min, max, suffix = false) => {
const minSize = min === 0 ? 1 : min;
// const rangeStr = max === min ? `${minSize}` : `${minSize}-${max}`;
const rangeStr = `${minSize}-${max}`;
return max === 1000 ? minSize <= 1 ? '不分人等' : `${minSize}人以上` : (`${rangeStr}`+(suffix ? '人' : ''));
};
export const formatGroupSizeRender = (min, max, suffix = false) => {
const minSize = min === 0 ? 1 : min;
const rangeStr = max === min ? `${minSize}` : `${minSize}-${max}`;
return max === 1000 ? minSize <= 1 ? '不分人等' : `${minSize}人以上` : (`${rangeStr}`+(suffix ? '人' : ''));

@ -30,7 +30,7 @@ import dayjs from "dayjs";
import useProductsStore from "@/stores/Products/Index";
import useAuthStore from '@/stores/Auth'
import PriceCompactInput from "@/views/products/Detail/PriceCompactInput";
import { formatGroupSize } from "@/hooks/useProductsSets";
import { formatGroupSize, formatGroupSizeRender } from "@/hooks/useProductsSets";
const { RangePicker } = DatePicker;
@ -259,7 +259,7 @@ const ProductInfoQuotation = ({ editable, ...props }) => {
dataIndex: "group_size",
width: "6rem",
render: (_, record) =>
formatGroupSize(record.group_size_min, record.group_size_max),
formatGroupSizeRender(record.group_size_min, record.group_size_max),
},
{

@ -3,7 +3,7 @@ import { useParams, Link } from 'react-router-dom';
import { Button, Drawer, Card, Table } from 'antd';
import { useTranslation } from 'react-i18next';
import useProductsStore, { getAgencyAllExtrasAction } from '@/stores/Products/Index';
import { useProductsTypes, formatGroupSize, useProductsTypesMapVal } from '@/hooks/useProductsSets';
import { useProductsTypes, formatGroupSize, useProductsTypesMapVal, formatGroupSizeRender } from '@/hooks/useProductsSets';
import { chunkBy, splitTable_6, splitTable_7, splitTable_8, splitTable_B, splitTable_D, splitTable_J, splitTable_Q, splitTable_R } from '@/hooks/useProductsQuotationFormat';
import { groupBy, isNotEmpty } from '@haina/utils-commons';
import useAuthStore from '@/stores/Auth';
@ -259,7 +259,7 @@ const AgencyPreview = ({ params, ...props }) => {
),
},
...cols.map((col) => ({
title: formatGroupSize(...col),
title: formatGroupSizeRender(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
@ -378,7 +378,7 @@ const AgencyPreview = ({ params, ...props }) => {
),
},
...cols.map((col) => ({
title: formatGroupSize(...col),
title: formatGroupSizeRender(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
@ -502,7 +502,7 @@ const AgencyPreview = ({ params, ...props }) => {
),
},
...cols.map((col) => ({
title: formatGroupSize(...col),
title: formatGroupSizeRender(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
// children1: [
@ -965,7 +965,7 @@ const AgencyPreview = ({ params, ...props }) => {
),
},
...cols.map((col) => ({
title: formatGroupSize(...col),
title: formatGroupSizeRender(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [
@ -1100,7 +1100,7 @@ const AgencyPreview = ({ params, ...props }) => {
),
},
...cols.map((col) => ({
title: formatGroupSize(...col),
title: formatGroupSizeRender(...col),
// dataIndex: [formatGroupSize(...col), 'adult_cost'],
key: col[0],
children: [

Loading…
Cancel
Save