Commit 3c4579a3 authored by XieZhiXiong's avatar XieZhiXiong

chore: 完善展示

parent 8709a0e6
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-25 09:40:03
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 18:40:16
* @LastEditTime: 2021-08-03 11:07:44
* @Description: formily 豆腐多选框
*/
import React from 'react';
......@@ -16,7 +16,7 @@ const FormilyTofuCheckboxGroup = connect()((props) => {
onChange,
...rest
} = props;
return <TofuCheckboxGroup options={dataSource} value={value} onChange={onChange} {...rest} />
return <TofuCheckboxGroup options={dataSource} value={value} onChange={onChange} {...rest} editable={rest.ediabled} />
});
export default FormilyTofuCheckboxGroup;
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-23 10:14:05
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 18:39:18
* @LastEditTime: 2021-08-03 11:01:39
* @Description: 豆腐方块复选框
*/
import React, { useState, useEffect } from 'react';
......@@ -48,6 +48,10 @@ export type TofuCheckboxGroupProps = {
* 是否禁用
*/
disabled?: boolean,
/**
* 是否可编辑的
*/
editable?: boolean,
};
const TofuCheckboxGroup: React.FC<TofuCheckboxGroupProps> = (props) => {
......@@ -56,7 +60,8 @@ const TofuCheckboxGroup: React.FC<TofuCheckboxGroupProps> = (props) => {
value: outerValue,
defaultValue = [],
onChange,
disabled,
disabled = false,
editable = true,
} = props;
const initValue = 'value' in props ? outerValue : defaultValue;
const [value, setValue] = useState<ValueType>(initValue);
......@@ -87,7 +92,7 @@ const TofuCheckboxGroup: React.FC<TofuCheckboxGroupProps> = (props) => {
{options.map((item) => {
const itemCls = classNames(styles['tofuCheckbox-list-item'], {
[styles['tofuCheckbox-list-item-checked']]: Array.isArray(value) && value.includes(item.value),
[styles['tofuCheckbox-list-item-disabled']]: item.disabled || disabled,
[styles['tofuCheckbox-list-item-disabled']]: (item.disabled || disabled) && editable,
});
return (
<div key={item.value} className={itemCls}>
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-02 16:56:32
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 18:35:22
* @LastEditTime: 2021-08-03 09:48:34
* @Description: 适用用户
*/
import React, { useMemo } from 'react';
......@@ -65,6 +65,7 @@ const ApplicableMember: React.FC<IProps> = (props) => {
wrapperCol={21}
fields={useFields()}
editable={false}
colon={false}
>
<Field
type="string"
......@@ -72,6 +73,9 @@ const ApplicableMember: React.FC<IProps> = (props) => {
title="适用用户"
name="suitableMemberTypes"
x-component="TofuCheckGroup"
x-component-props={{
ediabled: false,
}}
/>
{showApplicationMemberLevel && (
<>
......@@ -81,6 +85,9 @@ const ApplicableMember: React.FC<IProps> = (props) => {
title="适用用户角色"
name="applicationUserRole"
x-component="TofuCheckGroup"
x-component-props={{
ediabled: false,
}}
/>
<Field
type="string"
......
......@@ -95,7 +95,7 @@ const CouponBacisInfo: React.FC<PropsType> = (props: PropsType) => {
},
{
title: '券面额',
value: ${dataSource.denomination}`,
value: ${dataSource.denomination || ''}`,
},
{
title: '领(发)券结束时间',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-22 16:45:58
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 10:55:51
* @LastEditTime: 2021-08-03 09:55:37
* @Description: 优惠券规则
*/
import React from 'react';
......@@ -76,7 +76,7 @@ const CouponRules: React.FC<PropsType> = (props: PropsType) => {
},
{
title: '使用条件',
value: `订单满 ¥ ${dataSource.useConditionMoney} 使用`,
value: `订单满 ¥ ${dataSource.useConditionMoney || ''} 使用`,
},
{
title: '领取条件',
......@@ -84,7 +84,7 @@ const CouponRules: React.FC<PropsType> = (props: PropsType) => {
},
{
title: '有效期结束时间',
value: dataSource.effectiveTimeEnd ? moment(dataSource.effectiveTimeEnd).format('YYYY-MM-DD HH:mm:ss') : `领取${dataSource.invalidDay}天后失效`,
value: dataSource.effectiveTimeEnd ? moment(dataSource.effectiveTimeEnd).format('YYYY-MM-DD HH:mm:ss') : `领取${dataSource.invalidDay || ''}天后失效`,
},
{
title: '使用说明',
......
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