Commit 7e45bc48 authored by XieZhiXiong's avatar XieZhiXiong

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

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