Commit c44e3c3d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 98a07448 214ce818
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-08-04 16:21:48 * @Date: 2020-08-04 16:21:48
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-07 14:03:12 * @LastEditTime: 2020-08-13 09:52:00
*/ */
const router = { const router = {
path: '/ruleSettingManager', path: '/ruleSettingManager',
...@@ -25,7 +25,7 @@ const router = { ...@@ -25,7 +25,7 @@ const router = {
{ {
path: '/ruleSettingManager/paySetting', path: '/ruleSettingManager/paySetting',
name: 'paySetting', name: 'paySetting',
component: '@/pages/ruleSettingManage/paySetting', component: '@/pages/ruleSettingManage/paySetting/settingIndex',
hidePageHeader: true hidePageHeader: true
} }
] ]
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
"scripts": { "scripts": {
"api": "god-ytt", "api": "god-ytt",
"start:analyze": "ANALYZE=1 umi dev", "start:analyze": "ANALYZE=1 umi dev",
"start:dev": "umi dev",
"scripts:build": "node scripts/run", "scripts:build": "node scripts/run",
"start": "yarn api && yarn scripts:build && umi dev", "start": "yarn scripts:build && umi dev",
"build": "yarn api && yarn scripts:build && umi build", "start:dev": "umi dev",
"build": "umi build",
"build:analyze": "ANALYZE=1 umi build", "build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp", "postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
......
{
"name": "god-template",
"scripts": {
"api": "god-ytt",
"start:analyze": "ANALYZE=1 umi dev",
"start:dev": "umi dev",
"scripts:build": "node scripts/run",
"start": "yarn api && yarn scripts:build && umi dev",
"build": "yarn api && yarn scripts:build && umi build",
"build:analyze": "ANALYZE=1 umi build",
"postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"license": "MIT",
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-layout": "^5.0.12",
"@formily/antd": "^1.2.11",
"@formily/antd-components": "^1.2.11",
"@umijs/hooks": "^1.9.3",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.2.0",
"braft-editor": "^2.3.9",
"classnames": "^2.2.6",
"core-js": "^3.6.5",
"god": "0.1.17",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"umi": "^3.2.0",
"yorkie": "^2.0.0"
},
"devDependencies": {
"axios": "^0.19.2",
"god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2",
"json2ts": "^0.0.7",
"ora": "^4.0.4"
}
}
...@@ -8,6 +8,7 @@ const RadioGroud = (props:any) => { ...@@ -8,6 +8,7 @@ const RadioGroud = (props:any) => {
className='radio-group-box' className='radio-group-box'
size="small" size="small"
defaultValue={0} defaultValue={0}
value={props.value}
buttonStyle="solid" buttonStyle="solid"
options={options} options={options}
optionType="button" optionType="button"
......
import React, { Component, useState, useEffect } from 'react'; import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd' import { Modal, Button, Form,Radio } from 'antd'
import { import {
SchemaForm, SchemaMarkupField as Field, SchemaForm, SchemaMarkupField as Field,
createFormActions, createFormActions,
FormEffectHooks FormEffectHooks
} from '@formily/antd' } from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components' import { Input, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
export interface Params { export interface Params {
id?: number | string; id?: any,
mode:number,
type?: number|string, type?: number|string,
dialogVisible: boolean; dialogVisible: boolean;
onCancel: Function; onCancel: Function;
onOK?: Function; onOK?: Function;
initialValues?: any;
dontReceive?: boolean; //默认展示 dontReceive?: boolean; //默认展示
} }
const actions = createFormActions() const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => { const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => { const handleCancel = () => {
} }
const handletOk = (values: any) => { const handletOk = (values: any) => {
let value = { ...values } let value = { ...values }
if(props.id){ if(props.type){
value.type = props.id value.type = props.type
} }
PublicApi.postPayCollectionParametersAdd(value).then(res => {
if (res.code === 1000) {
props.onOK()
}
})
console.log('列表',value)
props.onOK(value)
} }
useEffect(() => { useEffect(() => {
...@@ -46,17 +45,18 @@ const comfirmDialog: React.FC<Params> = (props) => { ...@@ -46,17 +45,18 @@ const comfirmDialog: React.FC<Params> = (props) => {
return ( return (
<> <>
<Modal <Modal
title={ props.type == 0 ?'新增参数配置':'编辑参数配置'} title={ props.mode === 0 ?'新增参数配置':'编辑参数配置'}
width={800} width={800}
visible={props.dialogVisible} visible={props.dialogVisible}
onOk={() => actions.submit()} onOk={() => actions.submit()}
onCancel={() => props.onCancel()} onCancel={() => props.onCancel()}
destroyOnClose destroyOnClose
afterClose={() => actions.reset()} afterClose={() => actions.reset()}
okText='确定' okText={`确定`}
cancelText='取消' cancelText='取消'
> >
<SchemaForm <SchemaForm
labelCol={3} labelCol={3}
components={{ components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea Input, Radio: Radio.Group, TextArea: Input.TextArea
...@@ -64,8 +64,9 @@ const comfirmDialog: React.FC<Params> = (props) => { ...@@ -64,8 +64,9 @@ const comfirmDialog: React.FC<Params> = (props) => {
actions={actions} actions={actions}
effects={() => useFormEffects()} effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)} onSubmit={(values) => handletOk(values)}
initialValues={{ initialValues={
}} props.initialValues
}
> >
<Field <Field
name='code' name='code'
...@@ -117,7 +118,7 @@ const comfirmDialog: React.FC<Params> = (props) => { ...@@ -117,7 +118,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
} }
comfirmDialog.defaultProps = { comfirmDialog.defaultProps = {
dontReceive: true, dontReceive: true,
id:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信 type:1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
} }
export default comfirmDialog export default comfirmDialog
\ No newline at end of file
import React, { useEffect , useState,useRef } from 'react' import React, { useEffect, useState, useRef } from 'react'
import {Card,Button} from 'antd' import { Card, Button } from 'antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons' import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper} from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import {createFormActions, FormEffectHooks,useFormEffects} from '@formily/antd' import { createFormActions, FormEffectHooks,useFormEffects } from '@formily/antd'
import PayForm from '../components/PayForm' import PayForm from '../components/PayForm'
import {TabSetting} from '../schema' import Setting, { TabSetting, exportId } from '../schema'
import SettingModal from '../components/PayForm/components/settingModal' import SettingModal from '../components/PayForm/components/settingModal'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import {history} from 'umi'
import { action } from 'mobx' import { action } from 'mobx'
const payActions = createFormActions() const payActions = createFormActions()
const { onFieldValueChange$} = FormEffectHooks const { onFieldValueChange$ } = FormEffectHooks
const PaySetting: React.FC<{}> = () => { const PaySetting: React.FC<{}> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const [mode, setmord] = useState<number>(0)
const [visible, setvisible] = useState<boolean>(false) const [visible, setvisible] = useState<boolean>(false)
const [optionType, setoptionType] = useState(0) const [optionType, setoptionType] = useState(0)
const [infoData, setinfoData] = useState<any>([]) const [infoData, setinfoData] = useState<any>([])
const [id, setid] = useState<any>('') const [type, settype] = useState<any>(null)
const [tabid, settabid] = useState<any>(1)
let currentTab = exportId()
let [tabOption, settabOption] = useState({ let [tabOption, settabOption] = useState({
tab: 1, tab: 1,
type: 1 type: 1
}) })
const handleAddMemberBtn = (type:number) => { // useEffect(() => {
setid(type) // setCurrentTab(exportId())
// }, [exportId()])
const handleAddMemberBtn = (type: number) => {
settype(type)
setvisible(true) setvisible(true)
} }
const handleDeleteTable = (id:number) => { const handleDeleteTable = (id: number) => {
} }
const handleModalOK = () => { const handleModalOK = (obj:any) => {
console.log('选项卡:',exportId(),'弹窗id:',type)
setvisible(false) setvisible(false)
ref.current.reload() currentTab = !exportId() ? 1: exportId()
console.log('选项卡:',exportId(),'数据',obj)
console.log(payActions.getFieldValue("payParametersListResponses1"))
if(type == 1){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue("payParametersListResponses1")
// list.map(v=> v['key']= v.code)
payActions.setFieldValue("payParametersListResponses1", [...old,...list])
}
if(type == 2){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue(`payParametersList${currentTab}`)
// list.map(v=> v['key']= v.code)
payActions.setFieldValue(`payParametersList${currentTab}`, [...old,...list])
}
//微信
if(type == 3){
let list:any = []
list.push(obj)
let old = payActions.getFieldValue("payParametersListResponses2")
// list.map(v=> v['key']= v.code)
payActions.setFieldValue("payParametersListResponses2", [...old,...list])
payActions.setFieldValue("payParametersListResponses2", [...old,...list])
}
// ref.current.reload()
} }
const tableAddButton = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button> const tableAddButton = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
const tableAddButton2 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button> const tableAddButton2 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
const tableAddButton3 = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={() =>handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button> const tableAddButton3 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const tableColumns = [ const tableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' }, { 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: 'value', align: 'center', title: '参数值', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`}>{_}</EyePreview> },
{ dataIndex: 'describe', title: '参数描述', align: 'center' }, { dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) => {
<> dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) =>
<Button type='link' onClick={() =>{ <>
setvisible(true), <Button type='link' onClick={() => {
setoptionType(1) setvisible(true),
}}>编辑</Button> setoptionType(1)
<Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> }}>编辑</Button>
</> <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button>
</>
} }
] ]
const cardTableColumns = [ const cardTableColumns = [
{ dataIndex: 'code', title: '参数代码', align: 'center' }, { dataIndex: 'code', title: '参数代码', align: 'center' },
...@@ -57,48 +100,84 @@ const PaySetting: React.FC<{}> = () => { ...@@ -57,48 +100,84 @@ const PaySetting: React.FC<{}> = () => {
{ dataIndex: 'describe', title: '参数描述', align: 'center' }, { dataIndex: 'describe', title: '参数描述', align: 'center' },
{ dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) => <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> } { dataIndex: 'ctl', title: '操作', align: 'center', render: (_, record) => <Button type='link' onClick={() => handleDeleteTable(record.id)}>删除</Button> }
] ]
useEffect(() => { useEffect(() => {
PublicApi.getPayQueryPlatformDetails().then(res => { console.log('当前',currentTab)
let list = res.data PublicApi.getPayQueryPlatformDetails({id:exportId()}).then(res => {
// setinfoData(list) if(res.code === 1000){
let {id,isPitchOn,payParametersList,payParametersListResponses} = res.data
payActions.setFieldValue(`isPitchOn${id}`,isPitchOn)
payActions.setFieldValue(`payParametersList${id}`,payParametersList)
payActions.setFieldValue(`payParametersListResponses${id}`,payParametersListResponses)
}
}) })
return () => { return () => {
} }
}, []) }, [])
const useTabEffects = () => { const useTabEffects = () => {
// useFormEffects(($, { setFieldState }) => { // useFormEffects(($, { setFieldState }) => {
// onFieldValueChange$('PAY_TABS').subscribe(fieldState => { // onFieldValueChange$('PAY_TABS').subscribe(fieldState => {
// console.log(fieldState) // console.log(fieldState)
// }) // })
// }) // })
} }
const handleSubmit = (values) => {
console.log('当前id',currentTab)
console.log(values)
let list:any = []
let parametersList:any = [],payParametersListResponses:any = []
parametersList = payActions.getFieldValue(`payParametersList${currentTab}`)
payParametersListResponses = payActions.getFieldValue(`payParametersListResponses${currentTab}`)
if(exportId() == 1){
list = [...parametersList,...payParametersListResponses]
}else{
list = [...payParametersListResponses]
}
console.log(list)
// return
PublicApi.postPayCollectionParametersAdd({
payWayId: currentTab,
isPitchOn: values.isPitchOn,
payParameters: list
}).then(res=>{
if(res.code === 1000){
history.push('/home')
}
})
}
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
extra={ extra={
<Button type="primary" onClick={() => payActions.submit()} icon={<SaveOutlined/>}> <Button type="primary" onClick={() => payActions.submit()} icon={<SaveOutlined />} >
保存 保存
</Button> </Button>
} }
> >
<Card> <Card>
<PayForm <PayForm
expressionScope={{ expressionScope={{
tableColumns, tableColumns,
tableAddButton, tableAddButton,
tableAddButton2,
tableAddButton3,
cardTableColumns, cardTableColumns,
}} }}
schema={TabSetting(infoData)} actions={payActions}
schema={TabSetting()}
effects={() => useTabEffects()} effects={() => useTabEffects()}
onSubmit={(values) => handleSubmit(values)}
/> />
<SettingModal <SettingModal
id={id} mode={mode}
type={optionType} id={exportId()}
type={type}
dialogVisible={visible} dialogVisible={visible}
onCancel={() => setvisible(false)} onCancel={() => setvisible(false)}
onOK = {() =>handleModalOK} onOK={(list) => handleModalOK(list)}
/> />
</Card> </Card>
</PageHeaderWrapper> </PageHeaderWrapper>
......
/*
* @Author: LeeJiancong
* @Date: 2020-08-13 09:50:41
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-13 17:26:35
*/
import React, { useEffect, useState, useRef } from 'react'
import { Card, Button, Tabs, Radio, Space, Row, Col, Table,Popconfirm } from 'antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import EyePreview from '@/components/EyePreview'
import { createFormActions, FormEffectHooks, useFormEffects } from '@formily/antd'
import { GlobalConfig } from '@/global/config'
import { ColumnType } from 'antd/lib/table/interface'
import PayForm from '../components/PayForm'
import Setting, { TabSetting, exportId } from '../schema'
import SettingModal from '../components/PayForm/components/settingModal'
import { PublicApi } from '@/services/api'
import { history } from 'umi'
import '../components/PayForm/components/index.less'
const payActions = createFormActions()
const { TabPane } = Tabs
const { onFieldValueChange$ } = FormEffectHooks
const TabList = GlobalConfig.payConfig.payPlatformPayConfig
const PaySetting: React.FC<{}> = () => {
const ref = useRef<any>({})
const [mode, setmode] = useState<number>(0)
const [dataInfo, setdataInfo] = useState<any>({})
const [visible, setvisible] = useState<boolean>(false)
const [optionType, setoptionType] = useState(0)
const [isPitchOn, setisPitchOn] = useState<number>(0)
const [payParametersList, setpayParametersList] = useState<any>([])
const [payParametersListResponses, setpayParametersListResponses] = useState<any>([])
const [initialValues, setinitialValues] = useState({})
const [type, settype] = useState<any>(null)
const [hasEdit, sethasEdit] = useState<boolean>(false)
let [tabid, settabid] = useState<any>(null)//选项卡id
const [listID, setlistID] = useState(null)//表格id
let currentTab = exportId()
let [tabOption, settabOption] = useState({
tab: 1,
type: 1
})
const handleAddMemberBtn = (id: string | number, type: number) => {
console.log('id', id, 'type', type)
setmode(0)
settype(type)
setvisible(true)
setinitialValues({})
}
const handleEdit = (record: any, type: number | string, index: number) => {
setvisible(true)
setmode(1)//编辑还是新增
settype(type)
setlistID(record.id)
setinitialValues(record)
console.log('类型', type, '下标', index, 'record', record,'listID:',listID)
}
//删除
const handleDeleteTable = (type: number, id: number, index) => {
let list: any = []
if (type === 1 || type === 3) {
list = [...payParametersListResponses]
list.splice(index, 1)
setpayParametersListResponses(list)
} else if (type === 2) {
list = [...payParametersList]
list.splice(index, 1)
setpayParametersList(list)
}
sethasEdit(true)
}
/**
* @description: 保存 编辑的时候遍历id是否一样 一样就替换
* @param {type} type: 1支付宝 2支付宝银行卡 3微信
* @return {type}
*/
const handleModalOK = (obj: any) => {
// console.log('选项卡:', tabid, '弹窗id:', type)
setvisible(false)
// console.log('选项卡:', tabid, '数据', obj,'mode:',mode)
if(mode === 0){
if (type == 1 || type == 3 ) {
let list: any = []
obj.id = `obj-${payParametersListResponses.length}`
list.push(obj)
setpayParametersListResponses([...payParametersListResponses, ...list])
sethasEdit(true)
}
if (type == 2) {
let list: any = []
obj.id = `obj-${payParametersList.length}`
list.push(obj)
setpayParametersList([...payParametersList, ...list])
sethasEdit(true)
}
}else{
if (type == 1 || type == 3 ) {
let list = [...payParametersListResponses]
if(listID){
list.forEach((v,i)=> {
if(listID == v.id){
list[i] = obj
}
})
}
setpayParametersListResponses([...list])
sethasEdit(true)
}else if(type == 2){//支付宝银行卡
let list = [...payParametersList]
if(listID){
list.forEach((v,i)=> {
if(listID == v.id){
list[i] = obj
}
})
}
setpayParametersList([...list])
sethasEdit(true)
}
}
}
// const tableAddButton = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
// const tableAddButton2 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
// const tableAddButton3 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const tableColumns: ColumnType<any>[] = [
{ 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, index) =>
<>
<Button type='link' onClick={() => handleEdit(record, record.type, index)}>编辑</Button>
<Button type='link' onClick={() => handleDeleteTable(record.type, record.id, index)}>删除</Button>
</>
}
]
//初始化
const initBase = (id) => {
PublicApi.getPayQueryPlatformDetails({ id: id }).then(res => {
if (res.code === 1000) {
let { id, isPitchOn, payParametersList, payParametersListResponses } = res.data
payParametersList = payParametersList ? payParametersList : []
payParametersListResponses = payParametersListResponses ? payParametersListResponses : []
setisPitchOn(isPitchOn)
setpayParametersList(payParametersList)
setpayParametersListResponses(payParametersListResponses)
}
})
}
useEffect(() => {
let ids = TabList.map((v, i) => v.id)
settabid(ids[0])
const init = setTimeout(() => {
tabid = tabid ? tabid : ids[0]
initBase(tabid)
}, 1000)
return () => {
clearTimeout(init)
}
}, [])
const useTabEffects = () => {
}
//提交表单
const handleSubmit = () => {
let list: any = []
if (tabid == 1) {
list = [...payParametersList, ...payParametersListResponses]
} else if (tabid == 2) {
list = [...payParametersListResponses]
} else {
list = []
}
PublicApi.postPayCollectionParametersAdd({
payWayId: tabid,
isPitchOn: isPitchOn,
payParameters: list
}).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.push('/home')
}, 1500)
}
})
}
const changeTab = (tab) => {
settabid(tab)
initBase(tab)
}
const changeRadio = (e) => {
setisPitchOn(e.target.value)
}
const options = [{ label: '是', value: 1 }, { label: '否', value: 0 }]
return (
<PageHeaderWrapper
extra={
hasEdit ?
<Popconfirm title="配置已修改,是否保存?" okText="是" cancelText="否" onConfirm={() =>
handleSubmit()
}>
<Button type="primary" icon={<SaveOutlined />} >
保存
</Button>
</Popconfirm>
:
<Button type="primary" onClick={() => handleSubmit()} icon={<SaveOutlined />} >
保存
</Button>
}
>
<Card>
<Tabs onTabClick={(e) => changeTab(e)} type="card">
{
TabList.map((v, i) => {
return <>
<TabPane tab={`${v.way}`} key={v.id}>
<Space size={49}>
<span>是否开启{v.way}</span>
<Radio.Group
className='radio-group-box'
size="small"
value={isPitchOn}
// defaultValue={0}
buttonStyle="solid"
options={options}
optionType="button"
onChange={value => changeRadio(value)} />
</Space>
{
(v.id === 1 || v.id === 2) &&
<Row>
<Col ><div style={{ borderLeft: '2px solid #00B37A', margin: '41px 0 8px', padding: '1px 5px' }}>{v.way}参数配置</div></Col>
<Col span={24}>
<Table dataSource={payParametersListResponses} columns={tableColumns} pagination={false} />
{
v.id == 1 ?
<Button style={{ marginBottom: 16,marginTop:24 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(`${v.id}`, 1)} type='dashed'>新增参数配置</Button>
:
<Button style={{ marginBottom: 16,marginTop:24 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(`${v.id}`, 3)} type='dashed'>新增参数配置</Button>
}
</Col>
</Row>
}
{
v.id === 1 &&
<Row>
<Col ><div style={{ borderLeft: '2px solid #00B37A', margin: '41px 0 8px', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div></Col>
<Col span={24}>
<Table dataSource={payParametersList} columns={tableColumns} pagination={false} />
<Button style={{ marginBottom: 16,marginTop:24 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(`${v.id}`, 2)} type='dashed'>新增参数配置</Button>
</Col>
</Row>
}
</TabPane>
</>
})
}
</Tabs>
<SettingModal
mode={mode}
id={listID}
type={type}
dialogVisible={visible}
initialValues={initialValues}
onCancel={() => setvisible(false)}
onOK={(list) => handleModalOK(list)}
/>
</Card>
</PageHeaderWrapper>
)
}
export default PaySetting
\ No newline at end of file
...@@ -2,14 +2,16 @@ ...@@ -2,14 +2,16 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-08-06 11:12:18 * @Date: 2020-08-06 11:12:18
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-11 20:48:22 * @LastEditTime: 2020-08-12 20:32:03
*/ */
import React, { Component } from 'react' import React, { useState, useEffect } from 'react'
import { ISchema } from '@formily/antd' import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import { GlobalConfig } from '@/global/config' import { GlobalConfig } from '@/global/config'
import { AreaChartOutlined } from '@ant-design/icons' import { AreaChartOutlined } from '@ant-design/icons'
let payType = ['', '线上支付', '线下支付', '授信额度支付', '货到付款支付'] let payType = ['', '线上支付', '线下支付', '授信额度支付', '货到付款支付']
let currentTab;
//会员支付策略 //会员支付策略
export const strategyDetailTab = (props: any, usePageStatus: any) => { export const strategyDetailTab = (props: any, usePageStatus: any) => {
...@@ -17,7 +19,7 @@ export const strategyDetailTab = (props: any, usePageStatus: any) => { ...@@ -17,7 +19,7 @@ export const strategyDetailTab = (props: any, usePageStatus: any) => {
let baseList: any = GlobalConfig.payConfig.payInitializeConfig let baseList: any = GlobalConfig.payConfig.payInitializeConfig
console.log('baseList', baseList) console.log('baseList', baseList)
let tabItem = {}, Tab1 = {},arr=[] let tabItem = {}, Tab1 = {}, arr = []
baseList.map((item, index) => { baseList.map((item, index) => {
Tab1[`MEGA_LAYOUT_LINE${index}`] = { Tab1[`MEGA_LAYOUT_LINE${index}`] = {
type: 'Text', type: 'Text',
...@@ -209,90 +211,106 @@ export const paySetting: ISchema = { ...@@ -209,90 +211,106 @@ export const paySetting: ISchema = {
} }
} }
} }
let TabID: any = 1
function getID(val?) {
TabID = val
console.log('id', TabID)
}
//会员支付参数配置 //会员支付参数配置
export const TabSetting = (props: any[]) => { export const TabSetting = (props?: any[]) => {
let list =// GlobalConfig.payConfig.payPlatformPayConfig
[{ let list = GlobalConfig.payConfig.payPlatformPayConfig
id: 1, // [{
isPitchOn: 1, // id: 1,
payType: 1, // isPitchOn: 1,
way: "支付宝支付", // payType: 1,
}, // way: "支付宝支付",
{ // },
id: 2, // {
isPitchOn: 1, // id: 2,
payType: 1, // isPitchOn: 1,
way: "微信", // payType: 1,
}, // way: "微信",
{ // },
id: 3, // {
isPitchOn: 1, // id: 3,
payType: 2, // isPitchOn: 1,
way: "线上线下", // payType: 2,
} // way: "线上线下",
// }
]
console.log('初始哈',list) // ]
console.log('初始哈', list)
let tabItem = {} let tabItem = {}
list.forEach((v, i) => { list.forEach((v, i) => {
tabItem[`${v.id}`] = { if (i == 0) {
currentTab = v.id
}
tabItem[`tab-${v.id}`] = {
"type": 'object', "type": 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: v.way tab: v.way
}, },
properties: { properties: {
"isPitchOn": { [`MeGALOYOUT`]: {
type: 'RadioGroud',
title: `是否开启${v.way}`,
required: true,
"x-linkages": [
{
type: 'value:visible',
target: 'megaLayout',
"condition": "{{!!$value}}"
}
]
},
megaLayout: {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
"x-component-props": { "x-component-props": {
}, },
properties: { properties: {
"alipayTitle": { [`isPitchOn${v.id}`]: {
visible: v.payType != 2, type: 'RadioGroud',
type: 'Text', title: `是否开启${v.way}`,
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}参数配置</div>, required: false,
}, "x-linkages": [
"payParametersList": { {
visible: v.payType != 2, type: 'value:visible',
type: 'array:number', target: `megaLayout${v.id}`,
"x-component": 'PayTable', "condition": "{{!!$value}}"
"x-component-props": { }
rowKey: 'id', ]
columns: "{{tableColumns}}",
suffix: "{{tableAddButton}}"
}
},
"cardTitle": {
visible: v.payType != 2 && v.id != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div>,
}, },
"payParametersListResponses": { [`megaLayout${v.id}`]: {
visible: v.payType != 2 && v.id != 2, type: 'object',
type: 'array:number', "x-component": 'mega-layout',
"x-component": 'PayTable',
"x-component-props": { "x-component-props": {
rowKey: 'id', },
columns: "{{cardTableColumns}}", properties: {
suffix: "{{tableAddButton}}"
"alipayTitle": {
visible: v.payType != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}参数配置</div>,
},
[`payParametersListResponses${v.id}`]: {
visible: v.payType != 2 ,
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'code',
columns: "{{tableColumns}}",
suffix: v.id === 1 ? "{{tableAddButton}}" : "{{tableAddButton3}}"
}
},
"cardTitle": {
visible: v.payType != 2 && v.id != 2,
type: 'Text',
title: <div style={{ borderLeft: '2px solid #00B37A', padding: '1px 5px' }}>{v.way}转账到银行卡参数配置</div>,
},
[`payParametersList${v.id}`]: {
visible: v.payType != 2 && v.id != 2,
type: 'array:number',
"x-component": 'PayTable',
"x-component-props": {
rowKey: 'code',
columns: "{{cardTableColumns}}",
suffix: "{{tableAddButton2}}",
}
}
} }
} }
} }
...@@ -322,20 +340,25 @@ export const TabSetting = (props: any[]) => { ...@@ -322,20 +340,25 @@ export const TabSetting = (props: any[]) => {
"x-component": 'tab', "x-component": 'tab',
"x-component-props": { "x-component-props": {
type: 'card', type: 'card',
onChange: file => console.log(file), onTabClick: (tab) => {
onTabClick: file => console.log(file) currentTab = tab.split('-')[1]
}
}, },
properties: { ...tabItem } properties: { ...tabItem }
} }
} }
} }
console.log('结构',tabItem)
return payTabSetting return payTabSetting
} }
export const exportId = () => {
return currentTab
}
export default {
getTabId: () => getID()
}
......
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