Commit 9e3fd333 authored by LeeJiancong's avatar LeeJiancong

新增支付策略列表

parent eef1b6e2
......@@ -8,6 +8,7 @@ const router = {
path: '/logisticsManager',
name: 'logisticsManager',
key: 'logisticsManager',
icon: 'SmileOutlined',
routes:[
{
path: '/logisticsManager/logisticsList',
......
......@@ -2,17 +2,31 @@
* @Author: LeeJiancong
* @Date: 2020-08-04 16:21:48
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-06 11:22:01
* @LastEditTime: 2020-08-07 14:03:12
*/
const router = {
path: '/ruleSettingManager',
name: 'ruleSettingManager',
key: 'ruleSettingManager',
icon: 'SmileOutlined',
routes:[
{
path: '/ruleSettingManager/payStrategyList',
name: 'payStrategyList',
component: '@/pages/ruleSettingManage/payStrategy/index'
},
{
path: '/ruleSettingManager/payStrategyDetail',
name: 'payStrategyDetail',
component: '@/pages/ruleSettingManage/payStrategy/detail',
hidePageHeader: true,
hideInMenu: true
},
{
path: '/ruleSettingManager/paySetting',
name: 'paySetting',
component: '@/pages/ruleSettingManage/paySetting',
hidePageHeader: true
}
]
}
......
import React from 'react'
import { Link } from 'umi'
import { EyeOutlined } from '@ant-design/icons'
import { Button } from 'antd'
export interface EyePreviewProps {
url?: string,
type?: 'button' | 'link',
handleClick?()
}
const EyePreview:React.FC<EyePreviewProps> = (props) => {
return (
props.type === 'link' ?
<Link to={props.url || ''}>
{props.children} <EyeOutlined />
</Link>
:
<Button onClick={props.handleClick} type='link'>
{props.children} <EyeOutlined />
</Button>
)
}
EyePreview.defaultProps = {
type: 'link'
}
export default EyePreview
\ No newline at end of file
......@@ -2,7 +2,7 @@
* @Author: LeeJiancong
* @Date: 2020-08-04 15:05:52
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-06 11:26:47
* @LastEditTime: 2020-08-07 14:01:50
*/
import utils from '@/utils'
import menu from '../en-US/menu'
......@@ -73,5 +73,7 @@ export default {
//规则
'menu.ruleSettingManager': '平台规则配置',
'menu.ruleSettingManager.paySetting': '平台支付参数配置',
'menu.ruleSettingManager.payStrategyList': '会员支付策略配置',
'menu.ruleSettingManager.payStrategyDetail': '会员支付策略配置',
}
// export default utils.transformDataPre(data, 'menu')
......@@ -2,11 +2,12 @@ import React, { Component } from 'react';
import { Radio } from 'antd'
import "./index.less"
const RadioGroud = (props:any) => {
const options = props.options || ['是','否']
const options = props.options || [{label:'是',value:1},{label:'否',value:0}]
return (
<Radio.Group
className='radio-group-box'
className='radio-group-box'
size="small"
defaultValue={1}
buttonStyle="solid"
options={options}
optionType="button"
......
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
export interface Params {
id?: number | string;
type?: number|string,
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
dontReceive?: boolean; //默认展示
tabOption: any
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
if(props.id){
value.id = props.id
}
value.type = props.tabOption.type
PublicApi.postPayCollectionParametersAdd(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
}
return (
<>
<Modal
title={ props.type == 0 ?'新增参数配置':'编辑参数配置'}
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
status: 3
}}
>
<Field
name='code'
title='参数代码'
required
x-component-props={{
placeholder: '',
}}
x-component="Input"
/>
<>
<Field
title='参数值'
name="freightPrice"
x-component="Input"
required
x-component-props={{
placeholder: '',
// addonBefore: ' '
}}
x-rules={{
message: ''
}}
/>
{/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */}
<Field
title='参数描述'
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '最长128个字符'
}}
x-rules={{
max: 128,
// maximum:10,//最大数值
message: '参数描述最多128个汉字'
}}
/>
</>
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true,
tabOption:{
tabOption:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
}
}
export default comfirmDialog
\ No newline at end of file
import React, { Component } from 'react'
import {Card} from 'antd'
import React, { useEffect , useState,useRef } from 'react'
import {Card,Button} from 'antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper} from '@ant-design/pro-layout'
import EyePreview from '@/components/EyePreview'
import {createFormActions} from '@formily/antd'
import PayForm from '../components/PayForm'
import { payTabSetting} from '../schema'
import {TabSetting} from '../schema'
import SettingModal from '../components/PayForm/components/settingModal'
import { PublicApi } from '@/services/api'
const payActions = createFormActions()
const PaySetting: React.FC<{}> = () => {
const ref = useRef<any>({})
const [visible, setvisible] = useState<boolean>(false)
const [optionType, setoptionType] = useState(0)
const [infoData, setinfoData] = useState<any>([])
const [id, setid] = useState<any>('')
let [tabOption, settabOption] = useState({
tab: 1,
type: 1
})
const handleAddMemberBtn = (type:number) => {
setid('')
setvisible(true)
}
const handleDeleteTable = (id:number) => {
}
const handleModalOK = () => {
setvisible(false)
ref.current.reload()
}
const tableAddButton1 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(1)} type='dashed'>新增参数配置</Button>
const tableAddButton2 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(2)} type='dashed'>新增参数配置</Button>
const tableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' },
{ dataIndex: 'value', align: 'center', title: '参数值', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`}>{_}</EyePreview> },
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) =>
<>
<Button type='link' onClick={() =>{
setvisible(true),
setoptionType(1)
}}>编辑</Button>
<Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button>
</>
}
]
const cardTableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' },
{ dataIndex: 'value', align: 'center', title: '参数值', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`}>{_}</EyePreview> },
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) => <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> }
]
useEffect(() => {
PublicApi.getPayQueryPlatformDetails().then(res => {
let list = res.data
setinfoData(list)
})
return () => {
}
}, [])
return (
<Card>
<PayForm
schema={payTabSetting}
/>
</Card>
<PageHeaderWrapper
extra={
<Button type="primary" onClick={() => payActions.submit()} icon={<SaveOutlined/>}>
保存
</Button>
}
>
<Card>
<PayForm
expressionScope={{
tableColumns,
tableAddButton1,
tableAddButton2,
cardTableColumns
}}
schema={TabSetting(infoData)}
/>
<SettingModal
id={id}
type={optionType}
tabOption={tabOption}
dialogVisible={visible}
onCancel={() => setvisible(false)}
onOK = {() =>handleModalOK}
/>
</Card>
</PageHeaderWrapper>
)
}
export default PaySetting
\ No newline at end of file
import React, { useEffect,useState, useRef } from 'react';
import {Card,Row,Col,Space,Button} from 'antd'
import {StandardTable} from 'god'
import { ColumnType} from 'antd/lib/table/interface'
import EyePreview from '@/components/EyePreview'
import NiceForm from '@/components/NiceForm'
import {createFormActions} from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import {FORM_FILTER_PATH} from '@/formSchema/const'
import {SaveOutlined,PlusOutlined} from '@ant-design/icons'
import { strategySearch} from '../schema'
import { PublicApi} from '@/services/api'
const formActions = createFormActions()
interface searchType {
name: string
}
const List: React.FC<{}> = () => {
const ref = useRef<any>({})
const [searchParams, setsearchParams] = useState<searchType>({
name:''
})
const columns: ColumnType<any>[] = [
{
title:'ID',
dataIndex:'id',
key:'id',
align:'center'
},
{
title:'策略名称',
dataIndex:'strategyName',
key:'strategyName',
align:'center',
render:(text:any,record: any) => (
<EyePreview url={`/ruleSettingManager/payStrategyDetail?id=${record.id}&preview=1`}>
{text}
</EyePreview>
)
},
{
title:'操作时间',
dataIndex:'operationTime',
key:'operationTime',
align:'center'
},
{
title:'状态',
dataIndex:'state',
key:'state',
align:'center'
},
{
title:'操作',
dataIndex:'options',
key:'options',
align:'center',
}
]
const handleToAdd = () => {
}
const fetchData = (params:any) => {
return new Promise((resolve,reject)=> {
PublicApi.getPayPaymentPolicyList({...searchParams,...params}).then(res => {
resolve(res.data)
})
})
}
return (
<Card>
<StandardTable
currentRef={ref}
tableProps={{rowKey:'id'}}
columns={columns}
fetchTableData={(params:any) => fetchData(params)}
controlRender ={
<Row>
<Col>
<Button
type="primary"
onClick={handleToAdd}
icon={<PlusOutlined/>}
>
新建
</Button>
</Col>
<Col>
<NiceForm
actions = {formActions}
onSubmit={values => ref.current.reload(values)}
effects={($,actions) => {
useStateFilterSearchLinkageEffect($,actions,'search',FORM_FILTER_PATH)
}}
schema={strategySearch}
>
</NiceForm>
</Col>
</Row>
}
/>
</Card>
)
}
export default List
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-08-06 11:12:18
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-07 15:43:28
*/
import React, { Component } from 'react'
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
export const paySetting: ISchema = {
type:'object',
export const strategySearch: ISchema = {
type:'onbject',
properties:{
megaLayout:{
type:'object',
'x-component':'mega-layout',
properties:{
}
}
export const paySetting: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
}
}
}
}
export const payTabSetting: ISchema = {
type:'object',
properties:{
PAY_TABS:{
type:'object',
"x-component":'tab',
"x-component-props":{
type:'card'
export const TabSetting = (props: any[]) => {
let tabItem = {}
props.forEach((v, i) => {
tabItem[`tab-${i + 1}`] = {
"type": 'object',
"x-component": 'tabpane',
"x-component-props": {
tab: v.way
},
properties:{
"tab-1":{
"type":'object',
"x-component":'tabpane',
"x-component-props":{
tab:'支付宝支付'
},
"properties":{
MEGA_LAYOUT1: {
type:'object',
"x-component":"mega-layout",
"x-component-props":{
labeCol: 4,
labelAlign: 'left'
},
properties:{
"isPay":{
type:'RadioGroud',
title:'是否开启支付宝支付',
required: true
},
"des":{
type:'Text',
title:'支付宝参数配置',
},
"alipay ":{
type:'Text',
title:<div style={{borderLeft:'2px solid #00B37A',padding: '1px 5px' }}>支付宝支付参数配置</div>,
},
}
}
properties: {
"isPitchOn": {
type: 'RadioGroud',
title: `是否开启${v.way}`,
// required: true
},
"alipayTitle": {
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}参数配置</div>,
},
"payParametersList": {
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'id',
columns: "{{tableColumns}}",
suffix: "{{tableAddButton1}}"
}
},
"cardTitle": {
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div>,
},
"payParametersListResponses": {
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'id',
columns: "{{cardTableColumns}}",
suffix: "{{tableAddButton2}}"
}
}
}
}
})
tabItem[`tab-${props.length + 1}`] = {
"type": 'object',
"x-component": 'tabpane',
"x-component-props": {
tab: '线下支付'
},
properties: {
"isPitchOn": {
type: 'RadioGroud',
title: `是否开线下支付`,
// required: true
}
}
}
let payTabSetting: ISchema = {
type: 'object',
properties: {
PAY_TABS: {
type: 'object',
"x-component": 'tab',
"x-component-props": {
type: 'card'
},
properties: { ...tabItem }
}
}
}
return payTabSetting
}
......@@ -84,4 +120,3 @@ export const payTabSetting: ISchema = {
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* @Author: LeeJiancong
* @Date: 2020-08-04 16:22:03
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-07 14:38:56
*/
import { Config } from 'god-yapi2ts'
......@@ -7,6 +13,7 @@ const tokens = [
'8d14d945507d1f8cd89afe139ca6d111bbad25f702fafe0aec59d3c9cd2e0ffe', // 物流服务
'3a46198c5b97ac7147e5b07ad2dff5ac5c93c1afed47e1911961db87149e6ebf', // 商户会员管理服务
'efe99e20ed1375dc0db3e809e4fc7692f42ecebaf60cd77e65c50ed65d6ba6c4', // 商品服务
'11966e602e6ab7dd26b7495cad2a0f231b7c0253ce4b959a21612cf5a323150c', // 支付服务
]
const genMap = (tokens) => {
return tokens.map(v => {
......
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