diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index f3afebf..fbc354f 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -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 ? '人' : '')); diff --git a/src/views/products/Detail/ProductInfoQuotation.jsx b/src/views/products/Detail/ProductInfoQuotation.jsx index 3a1017f..6c81cee 100644 --- a/src/views/products/Detail/ProductInfoQuotation.jsx +++ b/src/views/products/Detail/ProductInfoQuotation.jsx @@ -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), }, { diff --git a/src/views/products/Print/AgencyPreview.jsx b/src/views/products/Print/AgencyPreview.jsx index 7fb6c72..127c7d0 100644 --- a/src/views/products/Print/AgencyPreview.jsx +++ b/src/views/products/Print/AgencyPreview.jsx @@ -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: [