Commit 9e88c187 authored by XieZhiXiong's avatar XieZhiXiong
parents 31b7c6b4 62012bc7
......@@ -48,6 +48,28 @@ const router = {
component: '@/pages/systemManage/ruleSettingManage/paySetting',
hidePageHeader: true,
},
// 商户支付参数配置
{
path: '/system/ruleSettingManager/merchantPayType',
name: '商户支付参数配置',
component: '@/pages/systemManage/ruleSettingManage/merchantPayType',
// hidePageHeader: true,
},
// 参数配置
{
path: '/system/ruleSettingManager/merchantPayType/add',
name: '参数配置',
component: '@/pages/systemManage/ruleSettingManage/merchantPayType/add',
hideInMenu: true
// hidePageHeader: true,
},
// 查看参数配置
{
path: '/system/ruleSettingManager/merchantPayType/detail',
name: '查看参数配置',
component: '@/pages/systemManage/ruleSettingManage/merchantPayType/add',
hideInMenu: true
},
{
path: '/system/ruleSettingManager/transactionRules',
name: '平台交易规则',
......@@ -183,7 +205,7 @@ const router = {
component: '@/pages/systemManage/ruleSettingManage/mallRules/detail',
hidePageHeader: true,
hideInMenu: true
}
},
]
},
{
......
......@@ -14,7 +14,8 @@ const { onFormMount$ } = FormEffectHooks
interface Iprops {
/** 列表接口 */
fetch?: () => Promise<unknown>,
// fetch?: () => Promise<unknown>,
fetch?: any,
/** 多选返回 */
fetchRowkeys?(e: any),
/** 操作按钮 */
......@@ -29,6 +30,8 @@ interface Iprops {
selectedRow?: boolean,
/** 刷新 */
reload?: any,
/** rowKey */
rowKey?: string,
/** 外部状态数据 */
externalStatusFetch?: () => Promise<unknown>,
/** 内部状态数据 */
......@@ -46,6 +49,7 @@ const Table: React.FC<Iprops> = (props: any) => {
controllerBtns,
selectedRow,
reload,
rowKey,
fetchRowkeys,
externalStatusFetch,
interiorStatusFetch,
......@@ -57,9 +61,19 @@ const Table: React.FC<Iprops> = (props: any) => {
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
fetch({ ...params }).then(res => {
resolve(res.data)
if (!Array.isArray(fetch)) {
fetch({ ...params }).then(res => {
resolve(res.data)
}).catch(error => {
console.warn(error)
})
return
}
resolve({
code: 1000,
data: fetch
})
console.log(fetch, 962039)
})
}
......@@ -106,7 +120,7 @@ const Table: React.FC<Iprops> = (props: any) => {
<StandardTable
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
tableProps={{ rowKey: rowKey ? rowKey : 'id' }}
rowSelection={selectedRow && selectRow}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
......
......@@ -902,7 +902,7 @@ const mobileClientEdit: React.FC<ShopPreviewPropsType> = (props) => {
childNodes: [],
};
!_suggestProductConfig['10'].childNodes.includes(_newKey) && _suggestProductConfig['10'].childNodes.push(_newKey);
if (item?.customize) {
if (item?.customize && item.type === 3) {
const _ids = item.customize.map((item) => item.id).join(',');
const _parmas: any = { shopId, idInList: _ids, current: '1', pageSize: '100' };
const _detailsData = await getMarketingAdornGoodsListAdorn(_parmas);
......
......@@ -900,7 +900,7 @@ const mobileClientEdit: React.FC<ShopPreviewPropsType> = (props) => {
childNodes: [],
};
!_suggestProductConfig['10'].childNodes.includes(_newKey) && _suggestProductConfig['10'].childNodes.push(_newKey);
if (item?.customize) {
if (item?.customize && item.type === 3) {
const _ids = item.customize.map((item) => item.id).join(',');
const _parmas: any = { shopId, idInList: _ids, current: '1', pageSize: '100' };
const _detailsData = await getMarketingAdornGoodsListAdorn(_parmas);
......
......@@ -224,7 +224,7 @@ const SuggestProductCommodity: React.FC<SuggestProductCommodityProps> = (props:
onPressEnter={_handleInputConfirm}
/>
)}
{!inputVisible && (
{!inputVisible && (!tags || tags.length <= 2 ) && (
<Tag className={styles['site-tag-plus']} onClick={_showInput}>
<PlusOutlined /> 新增标签
</Tag>
......
import React, { useState, useEffect } from 'react';
import { Table, Typography, Button, Popconfirm, Space, Form, Row, Col, Input, Select, Modal, message } from 'antd';
import { history } from 'umi'
import { ColumnType } from 'antd/lib/table/interface';
import { LinkOutlined, PlusOutlined } from '@ant-design/icons';
import PeripheralLayout from '@/components/DetailLayout';
import TableModal from '@/components/TableModal';
import { getMemberManagePlatformProviderPage } from '@/services/MemberV2Api';
import LevelBrand from '@/components/LevelBrand';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import Card from '@/components/Card';
import { getOrderPlatformPaymentMemberParameterFind, postOrderPlatformPaymentMemberParameterCreate } from '@/services/OrderNewV2Api';
import { isEmpty } from '@antv/util';
const { Option } = Select;
const { TextArea } = Input;
type channel = {
/** 参数枚举值 */
code?: number,
/** 参数Key名称 */
key: string,
}[]
const layout: any = {
colon: false,
labelCol: { style: { width: "144px" } },
labelAlign: "left"
};
const TAB_LINK = [
{ id: 'basicInfo', title: '基本信息' },
{ id: 'typeLayout', title: '参数配置' },
]
const MerchantPayTypeAdded = (props) => {
const { state, pathname } = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [visible, setVisible] = useState<boolean>(false);
const [typeVisible, setTypeVisible] = useState<boolean>(false);
const [menberInfo, setMenberInfo] = useState<any>({});
const [dataSource, setDataSource] = useState<any[]>([]);
const [form] = Form.useForm();
const [form1] = Form.useForm();
const [channel, setChannel] = useState<channel>([]);
const [_edit, setEdit] = useState<number>(0)
const [eidtflag, setEditFlag] = useState<boolean>(false);
/** 删除支付参数 */
const handleDelete = (index) => {
const _parameters = [...dataSource];
_parameters.splice(index, 1)
setDataSource(_parameters);
}
/** 编辑支付参数 */
const handleEdit = (record, index) => {
form1.setFieldsValue({ ...record })
setEdit(index);
setEditFlag(true)
setTypeVisible(true);
}
const columns: ColumnType<any>[] = [
{
title: '参数代码',
key: 'key',
dataIndex: 'key'
},
{
title: '参数值',
key: 'value',
dataIndex: 'value',
width: '50%',
ellipsis: true,
render: (text, record) => <>
{record.code === 14 && <Typography.Link href={text} target="_blank">{text}</Typography.Link>}
{record.code !== 14 && <>{text}</>}
</>
},
{
title: '参数描述',
key: 'remark',
dataIndex: 'remark',
ellipsis: true,
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (_: any, record: any, index: number) => <>
{path !== 'detail' &&
<>
<Button type='link' onClick={() => handleEdit(record, index)}>编辑</Button>
<Popconfirm
onConfirm={() => handleDelete(index)}
title="确定要执行这个操作?"
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
</>
}
]
const fetchMembersList = (params) => {
return new Promise((resolve, reject) => {
getMemberManagePlatformProviderPage({ ...params }).then(res => {
console.log(res.data, 100000)
resolve(res.data)
})
})
}
const toggle = (flag: boolean) => {
setVisible(flag)
}
const handleSubmit = (_: string[] | number[], selectRowRecord: any) => {
form.setFieldsValue({ 'name': selectRowRecord[0].name })
setMenberInfo(selectRowRecord[0])
toggle(false)
}
useEffect(() => {
getOrderPlatformPaymentMemberParameterFind({}).then(res => {
if (res.code !== 1000) {
return
}
setChannel(res.data);
})
}, [])
const handleConfirm = () => {
form1.validateFields().then(res => {
let data: any[] = [...dataSource];
if (eidtflag) {
data[_edit] = { ...res, key: channel.filter(item => item.code === res.code)[0].key }
} else {
data.push({ ...res, key: channel.filter(item => item.code === res.code)[0].key })
}
setEditFlag(false);
setDataSource(data)
setTypeVisible(false);
form1.resetFields()
})
}
const handleCancel = () => {
setTypeVisible(false);
form1.resetFields()
}
const submit = () => {
form.validateFields().then(res => {
const param = {
memberId: menberInfo.memberId,
roleId: menberInfo.roleId,
code: dataSource[0].code,
value: dataSource[0].value,
remark: dataSource[0].remark,
}
postOrderPlatformPaymentMemberParameterCreate(param).then(res => {
if (res.code !== 1000) {
message.error(res.message);
return
}
history.goBack()
})
})
}
useEffect(() => {
if (!isEmpty(state?.record) && !isEmpty(channel)) {
setMenberInfo(state?.record)
setDataSource([
{
code: state?.record.code,
value: state?.record.value,
remark: state?.record.remark,
key: channel.filter(item => item.code === state?.record.code)[0].key
}
])
}
}, [state?.record, channel])
return (
<>
<PeripheralLayout
hideBreak
detail={props.route.name}
tabLink={TAB_LINK}
effect={path !== 'detail' && <Button icon={<PlusOutlined />} type='primary' onClick={submit}>保存</Button>}
components={
<Form {...layout} form={form}>
<Card
id="basicInfoLayout"
title="基本信息"
>
<Row gutter={[48, 24]}>
<Col span={12}>
{path !== 'detail' &&
<Form.Item label='会员名称' name='name' rules={[{ required: true, message: '请选择会员' }]}>
<Input.Search onSearch={() => toggle(true)} readOnly enterButton={<Button style={{ height: '32.19px' }} icon={<LinkOutlined />}>选择</Button>} />
</Form.Item>}
{path === 'detail' &&
<Form.Item label='会员名称' name='name' rules={[{ required: true, message: '请选择会员' }]}>
<Typography.Text>{menberInfo.name}</Typography.Text>
</Form.Item>}
<Form.Item label='会员类型'>
<Typography.Text>{menberInfo.memberTypeName}</Typography.Text>
</Form.Item>
<Form.Item label='会员角色'>
<Typography.Text>{menberInfo.roleName}</Typography.Text>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label='会员等级'>
{path !== 'detail' && <LevelBrand level={menberInfo.level} />}
{path === 'detail' && <Typography.Text>{menberInfo.levelTag}</Typography.Text>}
</Form.Item>
<Form.Item label='资金归集模式'>
<Typography.Text>{menberInfo.fundModeName}</Typography.Text>
</Form.Item>
<Form.Item label='支付方式'>
<Typography.Text>{menberInfo.payTypeName}</Typography.Text>
</Form.Item>
<Form.Item label='支付渠道'>
<Typography.Text>{menberInfo.payChannelName}</Typography.Text>
</Form.Item>
</Col>
</Row>
</Card>
<Card
id="typeLayout"
title="参数配置"
>
<Space direction='vertical' style={{ width: '100%' }}>
<Table
rowKey={(_record: any, index: any) => `table${index + 1}`}
dataSource={dataSource}
columns={columns}
pagination={false}
/>
{path !== 'detail' && <Button
disabled={dataSource.length > 1}
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => setTypeVisible(true)}
>
新增参数配置
</Button>
}
</Space>
</Card>
</Form>
}
/>
{/* 选择会员 */}
<TableModal
modalType="Drawer"
visible={visible}
title="选择会员"
fetchData={fetchMembersList}
columns={[
{
title: "会员ID",
key: "id",
dataIndex: "memberId",
},
{
title: "会员名称",
key: "name",
dataIndex: "name",
},
{
title: "会员类型",
key: "memberTypeName",
dataIndex: "memberTypeName",
},
{
title: "会员角色",
key: "roleName",
dataIndex: "roleName",
},
{
title: "会员等级",
key: "levelName",
dataIndex: "levelName",
render: (_text, record: any) => <LevelBrand level={record.level} />
},
]}
mode="radio"
tableProps={{
rowKey: 'id',
}}
customKey="id"
onClose={() => toggle(false)}
onOk={handleSubmit}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, "name", FORM_FILTER_PATH)
}}
schema={{
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
properties: {
name: {
type: "string",
"x-component": "Search",
"x-mega-props": {},
"x-component-props": {
placeholder: "会员名称",
advanced: false,
align: "flex-left",
}
}
}
},
}
}}
value={[]}
/>
{/* 参数配置 */}
<Modal
width={576}
title='新增参数配置'
visible={typeVisible}
onOk={handleConfirm}
onCancel={handleCancel}
>
<Form
form={form1}
{...layout}
>
<Form.Item name='code' label='参数代码' rules={[{ required: true, message: '请选择参数代码' }]}>
<Select>
{
channel.map((item: any) => (
<Option key={item.code} value={item.code}>{item.key}</Option>
))
}
</Select>
</Form.Item>
<Form.Item name='value' label='参数值' rules={[{ required: true, message: '请输入参数值' }]}>
<Input />
</Form.Item>
<Form.Item name='remark' label='参数描述'>
<TextArea maxLength={200} rows={4} />
</Form.Item>
</Form>
</Modal>
</>
)
}
export default MerchantPayTypeAdded;
import React, { useRef } from 'react';
import { history, Link } from 'umi';
import { Button, Row, Col, Space, message, Popconfirm, Typography } from 'antd';
import TableLayout from '@/components/TableLayout';
import StatusSwitch from '@/components/StatusSwitch';
import { PlusOutlined } from '@ant-design/icons';
import { getOrderPlatformPaymentMemberParameterPage, postOrderPlatformPaymentMemberParameterDelete, postOrderPlatformPaymentMemberParameterStatus } from '@/services/OrderNewV2Api';
import LevelBrand from '@/components/LevelBrand';
const MerchantPayTypeLayout = () => {
const ref = useRef<any>({});
const handleChangeStatus = (record) => {
const param = {
status: record.status === 1 ? 0 : 1,
paymentId: record.paymentId,
}
postOrderPlatformPaymentMemberParameterStatus(param).then(res => {
if (res.code !== 1000) {
message.error(res.message);
return
}
ref.current.reload()
})
}
const handleDelete = (record) => {
const param = {
paymentId: record.paymentId
}
postOrderPlatformPaymentMemberParameterDelete(param).then(res => {
if (res.code !== 1000) {
message.error(res.message)
return
}
ref.current.reload()
})
}
const columns = [
{
title: 'ID',
key: 'paymentId',
dataIndex: 'paymentId',
},
{
title: '会员名称',
key: 'name',
dataIndex: 'name',
render: (text, record) => <Link
to={{
pathname: '/system/ruleSettingManager/merchantPayType/detail',
state: { record },
}}
>
{text}
</Link>
},
{
title: '会员类型',
key: 'memberTypeName',
dataIndex: 'memberTypeName',
},
{
title: '会员角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag',
// render: (_text, record: any) => <LevelBrand level={record.level} />
},
{
title: '支付方式',
key: 'payTypeName',
dataIndex: 'payTypeName',
},
{
title: '支付渠道',
key: 'payChannelName',
dataIndex: 'payChannelName',
},
{
title: '状态',
key: 'status',
dataIndex: 'status',
render: (text: any, record: any) => (
<StatusSwitch
fieldNames="status"
handleConfirm={() => handleChangeStatus(record)}
record={record}
/>
)
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (text: any, record: any) => <>
{
record.status !== 1 && (
<>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete(record)}>
<Button type='link'>
删除
</Button>
</Popconfirm>
</>
)
}
</>
},
]
return (
<>
<TableLayout
reload={ref}
rowKey='paymentId'
fetch={getOrderPlatformPaymentMemberParameterPage}
columns={columns}
schema={{
type: "object",
properties: {
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: "object",
"x-component": "controllerBtns",
},
search: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
advanced: false,
},
},
}
}
}
}}
controllerBtns={
<Row>
<Col span={24}>
<Space direction="horizontal" size={16}>
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => history.push('/system/ruleSettingManager/merchantPayType/add')}
>
新增
</Button>
</Space>
</Col>
</Row>
}
/>
</>
)
}
export default MerchantPayTypeLayout;
import React, { useCallback, useEffect, useState } from 'react';
import { Modal, Form, Select, Input, Typography, Upload, Button, message } from 'antd';
import { isEmpty } from '@/components/NiceForm/components/AntUpload/shared';
import style from '../index.less';
import { DeleteOutlined, UploadOutlined } from '@ant-design/icons';
import { UPLOAD_TYPE } from '@/constants'
import { getOrderPlatformPaymentMemberCommonParameterFind } from '@/services/OrderNewV2Api';
const { Option } = Select;
const { TextArea } = Input;
const layout: any = {
colon: false,
labelCol: { style: { width: '100px' } },
labelAlign: "left"
};
interface ModalProps {
/** 支付渠道 */
payChannel: string,
/** 显示隐藏 */
visible?: boolean,
/** 编辑回显数据 */
value?: {
/** 支付参数枚举值 */
code?: number,
/** 支付参数Key名称 */
key?: string,
/** 支付参数内容 */
value?: string,
/** 描述 */
remark?: String
},
/** 确定 */
onConfirm: (e) => void,
/** 取消 */
onCancel: () => void,
}
type channel = {
/** 参数枚举值 */
code?: number,
/** 参数Key名称 */
key: string,
}[]
const ParameterLayout: React.FC<ModalProps> = ({
payChannel,
visible,
value,
onConfirm,
onCancel,
}) => {
const [form] = Form.useForm();
const [channel, setChannel] = useState<channel>([]);
const [files, setFiles] = useState<any>({});
const [loading, setloading] = useState(false);
const handleChannelFind = useCallback(async () => {
await getOrderPlatformPaymentMemberCommonParameterFind({ payChannel }).then(res => {
if (res.code !== 1000) {
return
}
setChannel(res.data);
})
}, [payChannel])
useEffect(() => {
if (payChannel) {
handleChannelFind();
}
}, [payChannel])
const handleCancel = () => {
onCancel()
form.resetFields()
}
const handleConfirm = () => {
form.validateFields().then(res => {
onConfirm({
...res,
key: channel.filter(item => item.code === res.code)[0].key,
})
form.resetFields();
})
}
useEffect(() => {
if (!isEmpty(value)) {
form.setFieldsValue({
...value
})
if (value?.code === 14) {
setFiles({
name: value.remark,
url: value.value
})
}
}
}, [visible, value])
/**判断文件类型和大小 */
const beforeDocUpload = (file: any) => {
const isLt20M = file.size / 1024 / 1024 < 20;
if (!isLt20M) {
message.error('上传文件大小不超过 20M!');
}
return isLt20M;
}
// 上传回调
const handleChange = ({ file }) => {
setloading(true);
if (file.response) {
if (file.response.code === 1000) {
setFiles({
name: file.name,
url: file.response.data
})
form.setFieldsValue({ value: file.response.data })
setloading(false);
}
}
}
const handleDelete = () => {
setFiles({});
form.setFieldsValue({ value: undefined })
}
return (
<Modal
width={576}
title='新增参数配置'
visible={visible}
onOk={handleConfirm}
onCancel={handleCancel}
>
<Form
form={form}
{...layout}
>
<Form.Item name='code' label='参数代码' rules={[{ required: true, message: '请选择参数代码' }]}>
<Select>
{
channel.map((item: any) => (
<Option key={item.code} value={item.code}>{item.key}</Option>
))
}
</Select>
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, curValues) => prevValues.code !== curValues.code}
>
{({ getFieldValue }) =>
getFieldValue('code') === 14 ? (
<Form.Item name='value' label='退款证书' rules={[{ required: true, message: '请上传退款证书' }]}>
{!isEmpty(files) && (
<div className={style.upload_fileList}>
<Typography.Link>{files.url}</Typography.Link>
<DeleteOutlined className={style.delect_icon} style={{ color: '#00B37A' }} onClick={() => handleDelete()} />
</div>
)}
{isEmpty(files) && (
<Upload
action="/api/file/file/upload"
data={{ fileType: UPLOAD_TYPE }}
showUploadList={false}
beforeUpload={beforeDocUpload}
onChange={handleChange}
>
<Button loading={loading} icon={<UploadOutlined />}>上传文件</Button>
</Upload>
)}
</Form.Item>
) : <Form.Item name='value' label='参数值' rules={[{ required: true, message: '请输入参数值' }]}>
<Input />
</Form.Item>
}
</Form.Item>
<Form.Item name='remark' label='参数描述'>
<TextArea maxLength={200} rows={4} />
</Form.Item>
</Form>
</Modal>
)
}
export default ParameterLayout;
......@@ -51,6 +51,14 @@
transition: transform .15s cubic-bezier(.645,.045,.355,1),opacity .15s cubic-bezier(.645,.045,.355,1);
}
}
.tag {
margin-left: 14px;
padding: 4px;
font-size: 12px;
color: #5C626A;
background-color: #F4F5F7;
border-radius: 2px;
}
}
.upload_fileList {
......
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, Popconfirm, Typography } from 'antd';
import { Tabs, Form, Button, Radio, Table, Space, Image, Popconfirm, Typography, Tag, message } from 'antd';
import Card from '@/components/Card';
import style from './index.less';
import { PlusOutlined, SaveOutlined } from '@ant-design/icons';
......@@ -12,7 +12,10 @@ import alipay from '@/asserts/icons/alipay_icon.png';
import wechat from '@/asserts/icons/wechat_icon.png';
import unionpay from '@/asserts/icons/unionpay_icon.png';
import balance from '@/asserts/icons/balance_icon.png';
import { getOrderPlatformPaymentParameterFind, postOrderPlatformPaymentParameterCreate } from '@/services/OrderNewV2Api';
import { getOrderPlatformPaymentParameterFind, postOrderPlatformPaymentParameterCreate, getOrderPlatformPaymentMemberCommonParameterList, postOrderPlatformPaymentMemberCommonParameterCreate } from '@/services/OrderNewV2Api';
import ParameterLayout from './components/parameter';
import { await } from 'signale';
import { number } from 'yargs';
const PIC_MAP = {
1: alipay,
......@@ -62,6 +65,7 @@ type FindProps = {
const PaySettingLayout = () => {
const [form] = Form.useForm();
const [visible, setVisible] = useState<boolean>(false);
const [parameterVisible, setParameterVisible] = useState<boolean>(false);
const [tabLink, setTabLink] = useState<TabLink>([])
const [parameterFind, setParameterFind] = useState<any[]>([]);
const [payChannel, setPayChannel] = useState<string>('1');
......@@ -71,6 +75,8 @@ const PaySettingLayout = () => {
const [isEdit, setIsEdit] = useState<boolean>(false);
const [editIndex, setEditIndex] = useState<number>(0);
const [parameterList, setParameterList] = useState<parameters[]>([]) // 商户支付参数列表
const columns: ColumnType<any>[] = [
{
title: '参数代码',
......@@ -112,6 +118,49 @@ const PaySettingLayout = () => {
</>
}
]
const columns1: ColumnType<any>[] = [
{
title: '参数代码',
key: 'key',
dataIndex: 'key'
},
{
title: '参数值',
key: 'value',
dataIndex: 'value',
width: '50%',
ellipsis: true,
render: (text, record) => <>
{record.code === 14 && <Typography.Link href={text} target="_blank">{text}</Typography.Link>}
{record.code !== 14 && <>{text}</>}
</>
},
{
title: '参数描述',
key: 'remark',
dataIndex: 'remark',
ellipsis: true,
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (_: any, record: any, index: number) => <>
<Button type='link' onClick={() => handleParameterEdit(record, index)}>编辑</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handleParameterDelete(index)}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
]
useEffect(() => {
getOrderPlatformPaymentParameterFind().then(res => {
if (res.code !== 1000) {
......@@ -257,6 +306,71 @@ const PaySettingLayout = () => {
setPayChannel(activeKey)
}
/** 商户参数配置 - 查询会员通用支付参数配置列表 */
const handleCommonParameterList = () => {
getOrderPlatformPaymentMemberCommonParameterList({ payChannel }).then(res => {
if (res.code !== 1000) {
message.error(res.message);
return
}
setParameterList(res.data);
})
}
useEffect(() => {
if (isEmpty(parameterList)) {
handleCommonParameterList()
}
}, [payChannel])
const CommonParameterCreate = (_data) => {
postOrderPlatformPaymentMemberCommonParameterCreate({
payChannel: Number(payChannel),
parameters: _data.map(item => {
return {
code: item.code,
value: item.value,
remark: item.remark,
}
})
}, { ctlType: 'none' }).then(res => {
if (res.code !== 1000) {
message.error(res.message)
return
}
setParameterVisible(false)
})
}
const handleParameterConfirm = (format) => {
const _data: any = [...parameterList];
if (isEdit) {
_data[editIndex] = format
} else {
_data.push(format)
}
CommonParameterCreate(_data)
setParameterList(_data)
}
const handleParameterCancel = () => {
setParameterVisible(false)
}
const handleParameterDelete = (_index) => {
const _parameterList = [...parameterList];
_parameterList.splice(_index, 1);
setParameterList(_parameterList);
CommonParameterCreate(_parameterList)
}
const handleParameterEdit = (record, index) => {
setValue(record);
setEditIndex(index);
setIsEdit(true)
setParameterVisible(true)
}
return (
<PeripheralLayout
onBack
......@@ -284,57 +398,94 @@ const PaySettingLayout = () => {
<div className={style.tabsLayout}>
{item.payType === 1 && (
<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
label={`是否开启${_item.payChannelName}`}
name={`payChannel_${_item.payChannel}`}
initialValue={`_${_item.payChannel}`}
>
<Radio.Group
size="small"
buttonStyle="solid"
onChange={(e) => handleRadioChang(e, item.payType)}
{item.channels.map((_item, _index) => {
// setPayChannel(item.channels[0].payChannel);
return (
<TabPane tab={<Space><Image preview={false} width={16} height={16} src={PIC_MAP[_item.payChannel]} />{_item.payChannelName}</Space>} key={_item.payChannel} forceRender>
<Form.Item
label={`是否开启${_item.payChannelName}`}
name={`payChannel_${_item.payChannel}`}
initialValue={`_${_item.payChannel}`}
>
<Radio.Button value={_item.payChannel}></Radio.Button>
<Radio.Button value={`_${_item.payChannel}`}></Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues[`payChannel_${_item.payChannel}`] !== currentValues[`payChannel_${_item.payChannel}`]}
>
{({ getFieldValue }) => (
getFieldValue(`payChannel_${_item.payChannel}`) === 1 ||
getFieldValue(`payChannel_${_item.payChannel}`) === 2
) && (
<Fragment>
<div className={style.anchor}>{`${_item.payChannelName}支付参数配置`}</div>
<Form.Item
wrapperCol={{ span: 24 }}
name={`payChannel_${_item.payChannel}`}
>
<Table
rowKey={(_record: any, index: any) => `table${index + 1}`}
columns={columns}
dataSource={dataSource(item.payType, _item.payChannel)}
pagination={false}
/>
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => toggle(_item.payChannel)}
<Radio.Group
size="small"
buttonStyle="solid"
onChange={(e) => handleRadioChang(e, item.payType)}
>
<Radio.Button value={_item.payChannel}></Radio.Button>
<Radio.Button value={`_${_item.payChannel}`}></Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues[`payChannel_${_item.payChannel}`] !== currentValues[`payChannel_${_item.payChannel}`]}
>
{({ getFieldValue }) => (
getFieldValue(`payChannel_${_item.payChannel}`) === 1 ||
getFieldValue(`payChannel_${_item.payChannel}`) === 2
) && (
<Fragment>
<div className={style.anchor}>{`${_item.payChannelName}支付参数配置`}{getFieldValue(`payChannel_${_item.payChannel}`) === 1 ? <span className={style.tag}>平台代收模式</span> : null}</div>
<Form.Item
wrapperCol={{ span: 24 }}
name={`payChannel_${_item.payChannel}`}
>
新增参数配置
</Button>
</Form.Item>
</Fragment>
)}
</Form.Item>
</TabPane>
))}
<Table
rowKey={(_record: any, index: any) => `table${index + 1}`}
columns={columns}
dataSource={dataSource(item.payType, _item.payChannel)}
pagination={false}
/>
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => toggle(_item.payChannel)}
>
新增参数配置
</Button>
</Form.Item>
</Fragment>
)}
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues[`payChannel_${_item.payChannel}`] !== currentValues[`payChannel_${_item.payChannel}`]}
>
{({ getFieldValue }) => (
getFieldValue(`payChannel_${_item.payChannel}`) === 1
) && (
<Fragment>
<div className={style.anchor}>{`${_item.payChannelName}支付参数配置`}{getFieldValue(`payChannel_${_item.payChannel}`) === 1 ? <span className={style.tag}>会员直接到账模式</span> : null}</div>
<Button style={{ marginBottom: '24px' }} onClick={() => window.open('/system/ruleSettingManager/merchantPayType')}>商户参数配置</Button>
<Form.Item
wrapperCol={{ span: 24 }}
name={`payChannel_${_item.payChannel}`}
>
<Table
rowKey={(_record: any, index: any) => `table${index + 1}`}
columns={columns1}
dataSource={parameterList}
pagination={false}
/>
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => setParameterVisible(true)}
>
新增参数配置
</Button>
</Form.Item>
</Fragment>
)}
</Form.Item>
</TabPane>
)
})}
</Tabs>
)}
{item.payType !== 1 && (
......@@ -370,9 +521,20 @@ const PaySettingLayout = () => {
onConfirm={handleConfirm}
onCancel={handleCancel}
/>
{/* 商家支付参数 */}
<ParameterLayout
value={value}
visible={parameterVisible}
payChannel={payChannel}
onConfirm={handleParameterConfirm}
onCancel={handleParameterCancel}
/>
</Fragment>
}
/>
)
}
export default PaySettingLayout;
......@@ -70,12 +70,13 @@ const BasicInfo = () => {
{!isEmpty(item) && (
<>
<div className={style.anchor}>{item.payTypeName}</div>
<Form.Item className={style.spaceBox} label='资金集模式' required>
<Form.Item className={style.spaceBox} label='资金集模式' required>
<Space direction='vertical'>
<Form.Item
{...restField}
name={[name, 'fundMode']}
rules={[{ required: true, message: '请选择' }]}
initialValue={item.fundModes[0].fundMode}
>
<Select style={{ width: '100%' }}>
{item.fundModes.map((v: any) => (
......
......@@ -285,7 +285,11 @@ const MemberSettleAdd: React.FC = () => {
// 获取单据类型
useAsyncSelect(
"settlementOrderType",
fetchOptions(getSettleAccountsCommonGetPlatformStrategySettlementOrderType )
fetchOptions(getSettleAccountsCommonGetPlatformStrategySettlementOrderType ),
)
useAsyncSelect(
"_",
fetchOptions(getSettleAccountsCommonGetPlatformStrategySettlementOrderType ),
)
}}
/>
......
......@@ -68,6 +68,14 @@ export const addSchema: ISchema = {
'x-rules': [
{required: true, message: '请填写策略名称'},
]
},
_: {
type: 'string',
enum: [],
title: '结算支付方式',
'x-rules': [
{required: true, message: '请填写策略名称'},
]
}
},
}
......
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