Commit 307bc0ab authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

feat(支付参数配置): 修改提交参数

parent 5b7edf3f
......@@ -16,7 +16,7 @@
// import demandQuoteOrderRoute from './demandQuoteOrderRoute' //需求报价单管理
// import logisticsRoutes from './logisticsRoutes'
// import memberAbility from './memberAbility'
import ruleSettingRoutes from './ruleSettingRoutes'
// import ruleSettingRoutes from './ruleSettingRoutes'
// import authConfig from './authConfig'
// import rfqRoute from './rfqRoute' // 询价单路由
// import rfqOfferRoute from './rfqOfferRoute' // 询价单路由
......@@ -108,7 +108,6 @@ const router = [
// },
// ...routeList,
// merchantMarketingRoute,
ruleSettingRoutes,
marketingRoutes,
// platformCouponManageRoute,
...asyncRoutes,
......
......@@ -39,8 +39,9 @@ const router = {
{
path: '/ruleSettingManager/paySetting',
name: 'paySetting',
component: '@/pages/ruleSettingManage/paySetting/settingIndex',
hidePageHeader: true
component: '@/pages/ruleSettingManage/paySetting',
hidePageHeader: true,
noMargin: true,
},
{
path: '/ruleSettingManager/transactionRules',
......
import React, { useCallback, useEffect, useState } from 'react';
import { Modal, Form, Select, Input } from 'antd';
import { PublicApi } from '@/services/api';
import { isEmpty } from '@/components/NiceForm/components/AntUpload/shared';
const { Option } = Select;
const { TextArea } = Input;
......@@ -25,7 +26,7 @@ interface ModalProps {
value?: string,
/** 描述 */
remark?: String
}[],
},
/** 确定 */
onConfirm: (e) => void,
/** 取消 */
......@@ -79,6 +80,15 @@ const ModalLayout: React.FC<ModalProps> = ({
})
}
useEffect(() => {
if (!isEmpty(value)) {
console.log(value)
form.setFieldsValue({
...value
})
}
}, [value])
return (
<Modal
width={576}
......
import React, { useEffect, useState, Fragment } from 'react';
import PeripheralLayout from '@/components/DetailLayout';
import { ColumnType } from 'antd/lib/table/interface';
import { Tabs, Form, Button, Radio, Table, Space, Image } from 'antd';
import { Tabs, Form, Button, Radio, Table, Space, Image, Popconfirm } from 'antd';
import { PublicApi } from '@/services/api';
import Card from '@/components/Card';
import style from './index.less';
......@@ -42,6 +42,8 @@ type parameters = {
value?: string,
/** remark */
remark?: string
/** key */
key?: string
}
type channels = {
......@@ -62,9 +64,12 @@ const PaySettingLayout = () => {
const [visible, setVisible] = useState<boolean>(false);
const [tabLink, setTabLink] = useState<TabLink>([])
const [parameterFind, setParameterFind] = useState<any[]>([]);
const [payChannel, setPayChannel] = useState<string>('');
const [payChannel, setPayChannel] = useState<string>('1');
const [parameters, setParameters] = useState<FindProps[]>([]); // 提交的数据
const [channel, setChannel] = useState<number[]>([]); // 已勾选配置的支付渠道枚举值
const [value, setValue] = useState<parameters>({});
const [isEdit, setIsEdit] = useState<boolean>(false);
const [editIndex, setEditIndex] = useState<number>(0);
const columns: ColumnType<any>[] = [
{
......@@ -86,9 +91,17 @@ const PaySettingLayout = () => {
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any, index: number) => <>
<Button type='link'>编辑</Button>
<Button type='link'>删除</Button>
render: (_: any, record: any, index: number) => <>
<Button type='link' onClick={() => handleEdit(record, index)}>编辑</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handleDelete(index)}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
]
......@@ -106,7 +119,7 @@ const PaySettingLayout = () => {
}))
/** 组合数据 */
const params: FindProps[] = []
const _channel: number[] =[]
const _channel: number[] = []
data.forEach(item => {
const _obj: FindProps = {}
_obj.payType = item.payType;
......@@ -189,16 +202,39 @@ const PaySettingLayout = () => {
const _channels = [...item.channels]
_channels.forEach(_item => {
if (_item.payChannel === Number(payChannel)) {
_item.parameters.push(format)
if (isEdit) {
_item.parameters[editIndex] = format;
} else {
_item.parameters.push(format)
}
}
})
})
setIsEdit(false);
setParameters(_parameters);
setVisible(false);
}
/** 删除支付参数 */
const handleDelete = (index) => {
const _parameters = [...parameters];
_parameters.forEach((item: any) => {
const _channels = [...item.channels]
_channels.forEach(_item => {
if (_item.payChannel === Number(payChannel)) {
_item.parameters.splice(index, 1)
}
})
})
setParameters(_parameters);
}
/** 编辑支付参数 */
const handleEdit = () => { }
const handleEdit = (record, index) => {
setValue(record);
setEditIndex(index);
setIsEdit(true)
setVisible(true);
}
const dataSource = (payType, _payChannel) => {
let _parameters: any = [];
......@@ -210,6 +246,9 @@ const PaySettingLayout = () => {
return [..._parameters]
}
const handleTabsChange = (activeKey) => {
setPayChannel(activeKey)
}
return (
<PeripheralLayout
......@@ -237,7 +276,7 @@ const PaySettingLayout = () => {
>
<div className={style.tabsLayout}>
{item.payType === 1 && (
<Tabs>
<Tabs onChange={handleTabsChange}>
{item.channels.map((_item, _index) => (
<TabPane tab={<Space><Image preview={false} width={16} height={16} src={PIC_MAP[_item.payChannel]} />{_item.payChannelName}</Space>} key={_item.payChannel} forceRender>
<Form.Item
......@@ -318,6 +357,7 @@ const PaySettingLayout = () => {
))}
</Form>
<ModalLayout
value={value}
visible={visible}
payChannel={payChannel}
onConfirm={handleConfirm}
......
......@@ -88,7 +88,7 @@ const List: React.FC<{}> = () => {
<Card>
<StandardTable
currentRef={ref}
tableProps={{ rowKey: 'id' }}
tableProps={{ rowKey: 'paymentId' }}
columns={columns}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
......
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