Commit 7e45bc48 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复0元抵扣券商品还是多选的问题

parent 5d4ef078
......@@ -134,6 +134,7 @@ const ApplicableGoodsFormItem = (props) => {
<GoodsDrawer
visible={visibleGoodsDrawer}
shopIds={XComponentProps.shopIds}
multiple={XComponentProps.multiple}
onClose={handleVisibleGoodsDrawer}
checkeds={value}
onSubmit={handleGoodsDrawerSubmit}
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-30 17:48:32
* @LastEditTime: 2021-09-08 19:26:41
* @Description:
*/
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
......@@ -105,6 +105,13 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
linkage.hide('*(APPLICABLE_GOODS,APPLICABLE_CATEGORIES)');
linkage.show('APPLICABLE_BRANDS');
}
// 0元抵扣券只能选择一个商品
setFieldState('goodsList', fieldState => {
FormPath.setIn(fieldState, 'props.x-component-props', Object.assign({}, fieldState.props['x-component-props'], {
multiple: value !== MERCHANT_COUPON_TYPE_VOUCHER,
}));
});
});
// 券面额
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 16:11:55
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-30 10:10:15
* @LastEditTime: 2021-09-08 19:29:00
* @Description: 商品选择抽屉
*/
import React, { useEffect } from 'react';
......@@ -81,6 +81,10 @@ interface IProps {
* 商城id
*/
shopIds: number[],
/**
* 是否支持多选,默认为 true
*/
multiple?: boolean,
}
type ExtraFetchType = FetchParamsType & {
......@@ -105,8 +109,9 @@ const GoodsDrawer: React.FC<IProps> = (props) => {
onSubmit,
onClose,
shopIds,
multiple = true,
} = props;
const [rowSelection, rowCtl] = useRowSelectionTable({ type: 'checkbox', customKey: 'id' });
const [rowSelection, rowCtl] = useRowSelectionTable({ type: multiple ? 'checkbox' : 'radio', customKey: 'id' });
useEffect(() => {
if (checkeds) {
......
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