Commit c6eed103 authored by GuanHua's avatar GuanHua
parents 67ea3df0 919e9ffa
......@@ -35,6 +35,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
/* 执行请款的选中 */
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [value, setvalue] = useState('');
/* 搜素 */
const onSearch = (values) => {
const data = {
......@@ -216,6 +217,7 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
current: page,
pageSize: size,
}
setvalue('')
getContracInfoList(data)
}
useEffect(() => {
......@@ -241,6 +243,8 @@ const situationList: React.FC<Iprops> = ({ contractId }) => {
placeholder="搜素"
allowClear
onSearch={onSearch}
value={value}
onChange={(e) => setvalue(e.target.value)}
/>
<Button style={{ paddingLeft: 10, paddingRight: 10, marginLeft: 10, marginRight: 10 }} onClick={Reset}> 重置 </Button>
</div>
......
......@@ -7,8 +7,8 @@ import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import AddInfo from './components/Info'
import InfoTable from './components/Table'
import AddInfo from './components/info'
import InfoTable from './components/table'
import { PublicApi } from '@/services/api';
const formActions = createFormActions();
......
......@@ -313,6 +313,7 @@ const table = (props: any) => {
PlanList.map((item) => {
item.applyNo = item.orderNO;
item.outerStatusName = item.orderStatusName;
item.orderTime = item.orderTime ? moment().format('YYYY-MM-DD') : '';
// item.isHasTax = item.isHasTax == '是' ? 1 : 0;
})
setPlanList(PlanList)
......
......@@ -7,7 +7,7 @@ import { history } from 'umi';
import { PublicApi } from '@/services/api';
import Examine from '../../components/examine'
import Materials from './components/Materials'
import ColumnsList from './components/ColumnsList'
import ColumnsList from './components/columnsList'
import Basic from '../../components/detailCard/basic'
const { Link } = Anchor;
const { Step } = Steps;
......
......@@ -10,39 +10,22 @@ import { goodcolumns } from '../Table'
import { PublicApi } from '@/services/api';
const { Option } = Select;
const { Text } = Typography;
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
const FormList = (props: any) => {
const { currentRef, Row, sourceType } = props;
const refs = useRef({});
/* 显示模态框 */
const [isModalVisible, setIsModalVisible] = useState(false);// 显示模态框
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]) // 选中的
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const [dataList, setData] = useState<Array<any>>([]) // 列表数据
/* 选中 */
const rowSelectionGood: any = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectedRowKeys(selectedRowKeys)
setSelectRow(selectedRows)
console.log(setSelectedRowKeys)
}
};
const [columnsTab, setcolumnsTab] = useState<any>([]);
/* 确定 */
const handleOk = () => {
console.log(dataList)
let dataArr = dataList.length != 0 ? dataList.concat(selectRow) : selectRow;
const hash = {}
let templateList = dataArr.reduceRight((item, next) => {
if (!hash[next.id]) hash[next.id] = true && item.push(next)
return item
}, [])
templateList.map((item: any, index: number) => {
let list = RowCtl.selectRow;
list.map((item: any, index: number) => {
item.rowId = index + 1
dataArr.push(item);
})
setData(templateList)
setData(list)
setIsModalVisible(false);
};
/* 获取商品 */
......@@ -59,11 +42,9 @@ const FormList = (props: any) => {
/* 删除 */
const handleDelete = (id) => {
const dataSource = [...dataList];
const RowKeys = [...selectedRowKeys]
let List = dataSource.filter((item) => item.id !== id);
const RowKeysList = RowKeys.filter(item => item !== id);
setData(List)
setSelectedRowKeys(RowKeysList)
// setSelectedRowKeys(RowKeysList)
};
/* 获取物料信息 */
const getList = () => {
......@@ -439,7 +420,7 @@ const FormList = (props: any) => {
}}
columns={goodcolumns}
currentRef={refs}
rowSelection={rowSelectionGood}
rowSelection={rowSelection}
fetchTableData={(params: any) => getGoodsList(params)}
/>
</Modal>
......
......@@ -3,7 +3,7 @@ import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Information from './components/Information'
import FormList from './components/FormList'
import Fromtable from './components/fromtable'
import Fromtable from './components/Fromtable'
import ContractText from './components/ContractText'
import { PublicApi } from '@/services/api';
import { history } from 'umi'
......
......@@ -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: '使用说明',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-28 14:58:01
* @LastEditTime: 2021-08-03 11:26:22
* @Description:
*/
import { FormPath, FormEffectHooks } from '@formily/antd';
......@@ -49,7 +49,7 @@ const fetchCouponGetWay = async () => {
// 初始化 适用用户角色
const fetchApplicationUserRole = async () => {
const res = await PublicApi.getMemberAbilityLevelRoleList();
const res = await PublicApi.getMemberManageMarketingSuitableLevelConfigPageItems();
const allItem = {
label: '全部',
......@@ -89,8 +89,8 @@ const fetchSuitableUser = async () => {
};
// 获取 实用会员选项
const fetchMemberOtions: (params: { current: string, pageSize: string, levelConfigIds: string, roleIds: string }) => Promise<ResponseType> = async (params) => {
const res = await PublicApi.getMemberAbilityLevelTagPage(params);
const fetchMemberOptions: (params: { current: string, pageSize: string, levelConfigIds: string, roleIds: string }) => Promise<ResponseType> = async (params) => {
const res = await PublicApi.getMemberManageMarketingSuitableLevelConfigPage(params);
if (res.code === 1000) {
const options = res.data.data.map(item => ({
label: item.roleName,
......@@ -165,7 +165,7 @@ export const createEffects = (context, actions) => {
setFieldState('applicationMemberLevel', state => {
FormPath.setIn(state, 'props.x-component-props', {
showMoreAction: true,
fetchOptions: fetchMemberOtions,
fetchOptions: fetchMemberOptions,
});
});
});
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 13:47:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 17:58:54
* @LastEditTime: 2021-08-03 11:42:36
* @Description: 新增/修改 优惠券表单
*/
import React, { useState, useMemo, useEffect } from 'react';
......@@ -182,6 +182,7 @@ const CouponForm: React.FC<IProps> = (props) => {
suitableBrandList,
suitableMallTypes,
suitableMemberLevelTypes,
suitableMemberTypes,
denomination,
quantity,
releaseTimeStart,
......@@ -197,12 +198,17 @@ const CouponForm: React.FC<IProps> = (props) => {
history,
...rest
} = res.data;
let applicationUserRole = suitableMemberLevelTypes?.map((item) => item.roleId) || [];
// 去重
applicationUserRole = applicationUserRole?.filter((item, index) => applicationUserRole.findIndex(item2 => item2 === item) === index);
setCouponInfo({
goodsList: suitableCommoditySkuList as any,
applicableCategories: (suitableCategoryList as any)?.map((item) => ({ category: item.map((category) => `${category.id}`)})),
applicableBrands: suitableBrandList?.map((item) => ({ brand: item.id })),
applicationUserRole: [],
applicationUserRole,
applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id),
suitableMemberTypes: suitableMemberTypes?.map((item) => item.value),
suitableMallTypes: suitableMallTypes?.map((item) => item.id),
denomination: `${denomination}`,
quantity: `${quantity}`,
......@@ -213,8 +219,8 @@ const CouponForm: React.FC<IProps> = (props) => {
invalidDay: invalidDay !== null ? `${invalidDay}` : undefined,
useConditionMoney: `${useConditionMoney}`,
receiveCondition: {
conditionGetTotal: `${conditionGetTotal}`,
conditionGetDay: `${conditionGetDay}`,
conditionGetTotal: conditionGetTotal ? `${conditionGetTotal}` : undefined,
conditionGetDay: conditionGetDay ? `${conditionGetDay}` : undefined,
},
...rest,
});
......
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