Commit ed47b483 authored by XieZhiXiong's avatar XieZhiXiong

chore: 展示适用会员等级

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