Commit ed47b483 authored by XieZhiXiong's avatar XieZhiXiong

chore: 展示适用会员等级

parent 2837281e
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-25 09:40:03
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-25 11:28:05
* @LastEditTime: 2021-08-02 18:40:16
* @Description: formily 豆腐多选框
*/
import React from 'react';
......@@ -14,8 +14,9 @@ const FormilyTofuCheckboxGroup = connect()((props) => {
dataSource,
value,
onChange,
...rest
} = props;
return <TofuCheckboxGroup options={dataSource} value={value} onChange={onChange} />
return <TofuCheckboxGroup options={dataSource} value={value} onChange={onChange} {...rest} />
});
export default FormilyTofuCheckboxGroup;
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-23 10:14:05
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 17:42:33
* @LastEditTime: 2021-08-02 18:39:18
* @Description: 豆腐方块复选框
*/
import React, { useState, useEffect } from 'react';
......@@ -87,7 +87,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,
[styles['tofuCheckbox-list-item-disabled']]: item.disabled || disabled,
});
return (
<div key={item.value} className={itemCls}>
......@@ -95,7 +95,7 @@ const TofuCheckboxGroup: React.FC<TofuCheckboxGroupProps> = (props) => {
<Checkbox
value={item.value}
className={styles['tofuCheckbox-list-item-checkbox']}
disabled={item.disabled}
disabled={item.disabled || disabled}
/>
</div>
)
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-02 16:56:32
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 17:48:07
* @LastEditTime: 2021-08-02 18:35:22
* @Description: 适用用户
*/
import React, { useMemo } from 'react';
......@@ -28,10 +28,6 @@ interface IProps extends MellowCardProps {
*/
suitableMemberTypes: {}[],
/**
* 适用用户角色
*/
applicationUserRole: {}[],
/**
* 适用用户列表
*/
applicationMemberLevel: ApplicationMemberLevelType[],
......@@ -51,6 +47,10 @@ const ApplicableMember: React.FC<IProps> = (props) => {
const showApplicationMemberLevel = true;
let applicationUserRoleOptions = applicableMember?.applicationMemberLevel?.map((item) => ({ label: item.roleName, value: item.id }));
// 去重
applicationUserRoleOptions = applicationUserRoleOptions?.filter((item, index) => applicationUserRoleOptions.findIndex(item2 => item2.label === item.label) === index);
return (
<MellowCard
title="适用用户"
......@@ -77,8 +77,7 @@ const ApplicableMember: React.FC<IProps> = (props) => {
<>
<Field
type="string"
enum={[]}
default={[0]}
enum={applicationUserRoleOptions}
title="适用用户角色"
name="applicationUserRole"
x-component="TofuCheckGroup"
......
......@@ -330,7 +330,6 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
<ApplicableMember
applicableMember={{
suitableMemberTypes: [],
applicationUserRole: [],
applicationMemberLevel: dataSource?.suitableMemberLevelTypes,
}}
id="applicableMember"
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 13:47:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-30 18:12:09
* @LastEditTime: 2021-08-02 17:58:54
* @Description: 新增/修改 优惠券表单
*/
import React, { useState, useMemo, useEffect } from 'react';
......@@ -123,11 +123,15 @@ export type SubmitValueType = {
brand: number,
}[],
/**
* 适用会员
*/
suitableMemberTypes: number[],
/**
* 适用用户角色
*/
applicationUserRole: any[],
/**
* 适用会员
* 适用会员等级
*/
applicationMemberLevel: number[],
/**
......@@ -198,7 +202,7 @@ const CouponForm: React.FC<IProps> = (props) => {
applicableCategories: (suitableCategoryList as any)?.map((item) => ({ category: item.map((category) => `${category.id}`)})),
applicableBrands: suitableBrandList?.map((item) => ({ brand: item.id })),
applicationUserRole: [],
applicationMemberLevel: suitableMemberLevelTypes,
applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id),
suitableMallTypes: suitableMallTypes?.map((item) => item.id),
denomination: `${denomination}`,
quantity: `${quantity}`,
......@@ -282,7 +286,6 @@ const CouponForm: React.FC<IProps> = (props) => {
);
const handleSubmit = (values: SubmitValueType) => {
console.log('values', values)
const {
receiveCondition,
useConditionMoney,
......
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