Commit 6df65374 authored by GuanHua's avatar GuanHua

fix: 移动端C端商城装修优惠券重复选择问题修复

parent f46164ed
......@@ -30,11 +30,12 @@ interface CouponsDrawerProps {
onConfirm?: (record) => void,
selectId?: number,
// 1平台,2商家
belongType?: 1 | 2
belongType?: 1 | 2,
disabledKeys?: number[],
}
const CouponsDrawer: React.FC<CouponsDrawerProps> = (props: CouponsDrawerProps) => {
const { visible, onClose, onConfirm, selectId, belongType } = props;
const { visible, onClose, onConfirm, selectId, belongType, disabledKeys } = props;
const { query: { shopId } }: any = history.location;
const [type, setType] = useState(belongType || 1);
const [selectedRowKeys, setSelectedRowKeys] = useState<any>(selectId ? [selectId] : []);
......@@ -145,7 +146,10 @@ const CouponsDrawer: React.FC<CouponsDrawerProps> = (props: CouponsDrawerProps)
setSelectedRows(selectedRows);
setSelectedRowKeys(selectedRowKeys)
},
type: 'radio'
type: 'radio',
getCheckboxProps: (record: any) => ({
disabled: disabledKeys?.includes(record.id), // Column configuration not to be checked
}),
};
const drawerStyle = { background: '#FAFBFC' };
......
......@@ -10,6 +10,7 @@ import { priceFormat } from '@/utils/numberFomat';
import { postMarketingCouponPlatformActivityPageSelectDetail } from '@/services/MarketingV2Api';
import CouponsDrawer from '@/pages/pageCustomized/components/drawers/couponsDrawer';
import useSamLevelProps from '../../../common/hooks/useSameLevelProps';
interface MarketingCardCouponProps {
......@@ -23,6 +24,8 @@ const MarketingCardCoupon: React.FC<MarketingCardCouponProps> = (props: Marketin
const { id, belongType, selectedKey } = props;
const [drawerVisible, setDrawerVisible] = useState(false);
const [record, setRecord] = useState<any>();
const sameLevelPropsList = useSamLevelProps({ key: selectedKey })
const _onClose = () => {
setDrawerVisible(false);
};
......@@ -110,6 +113,7 @@ const MarketingCardCoupon: React.FC<MarketingCardCouponProps> = (props: Marketin
belongType={belongType}
onClose={_onClose}
onConfirm={_onChooseConfirm}
disabledKeys={sameLevelPropsList ? sameLevelPropsList.map((item) => item.id) : []}
selectId={id}
/>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment