Commit 75bd82e0 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改微信支付参水

parent 92391f11
......@@ -50,7 +50,7 @@ export interface ShopInfo {
type: number;
environment: number;
logoUrl: string;
describe?: any;
describe: string;
state: number;
url: string;
}
......
......@@ -5,7 +5,7 @@ import {
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, FormMegaLayout } from '@formily/antd-components'
import { Input, FormMegaLayout, Select } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
export interface Params {
id?: any,
......@@ -20,24 +20,28 @@ export interface Params {
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
const handleCancel = () => {
}
const [payWayCode, setPayWayCode] = useState<any>([]);
const handletOk = (values: any) => {
let value = { ...values }
if(props.type){
value.type = props.type
}
console.log('列表',value)
props.onOK(value)
}
useEffect(() => {
return () => {
}
PublicApi.getPayGetPayWayCodeTypeEnum().then(res => {
if(res.code === 1000) {
const { data } = res;
const arr: any = [];
data.forEach(item => {
arr.push({
label: item.type,
value: item.name
})
})
setPayWayCode(arr)
}
})
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
......@@ -56,10 +60,9 @@ const comfirmDialog: React.FC<Params> = (props) => {
cancelText='取消'
>
<SchemaForm
labelCol={3}
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
Input, Radio: Radio.Group, TextArea: Input.TextArea, Select
}}
actions={actions}
effects={() => useFormEffects()}
......@@ -72,11 +75,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='code'
title='参数代码'
required
enum={payWayCode}
x-component-props={{
placeholder: '',
placeholder: ''
}}
x-component="Input"
x-component="Select"
/>
<>
<Field
......
......@@ -4,8 +4,8 @@
* @LastEditors: LeeJiancong
* @LastEditTime: 2020-08-21 15:05:26
*/
import React, { useEffect, useState, useRef } from 'react'
import { Card, Button, Tabs, Radio, Space, Row, Col, Table,Popconfirm } from 'antd'
import React, { useEffect, useState, useRef, Fragment } 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'
......@@ -22,8 +22,8 @@ import '../components/PayForm/components/index.less'
const payActions = createFormActions()
const { TabPane } = Tabs
const { onFieldValueChange$ } = FormEffectHooks
const TabList:any = GlobalConfig.payConfig.payPlatformPayConfig || []
console.log('初始化payConfig',GlobalConfig.payConfig.payPlatformPayConfig)
const TabList: any = GlobalConfig.payConfig.payPlatformPayConfig || []
console.log('初始化payConfig', GlobalConfig.payConfig.payPlatformPayConfig)
const PaySetting: React.FC<{}> = () => {
const ref = useRef<any>({})
const [mode, setmode] = useState<number>(0)
......@@ -54,13 +54,13 @@ const PaySetting: React.FC<{}> = () => {
}
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)
console.log('类型', type, '下标', index, 'record', record, 'listID:', listID)
}
//删除
const handleDeleteTable = (type: number, id: number, index) => {
......@@ -88,11 +88,11 @@ const PaySetting: React.FC<{}> = () => {
setvisible(false)
// console.log('选项卡:', tabid, '数据', obj,'mode:',mode)
if(mode === 0){
if (type == 1 || type == 3 ) {
if (mode === 0) {
if (type == 1 || type == 3) {
let list: any = []
obj.id = `obj-${payParametersListResponses.length}`
obj.payWayCodeTypeEnum = obj.code
list.push(obj)
setpayParametersListResponses([...payParametersListResponses, ...list])
sethasEdit(true)
......@@ -104,13 +104,13 @@ const PaySetting: React.FC<{}> = () => {
setpayParametersList([...payParametersList, ...list])
sethasEdit(true)
}
}else{
if (type == 1 || type == 3 ) {
} else {
if (type == 1 || type == 3) {
let list = [...payParametersListResponses]
if(listID){
list.forEach((v,i)=> {
if(listID == v.id){
if (listID) {
list.forEach((v, i) => {
if (listID == v.id) {
list[i] = obj
}
})
......@@ -118,11 +118,11 @@ const PaySetting: React.FC<{}> = () => {
setpayParametersListResponses([...list])
sethasEdit(true)
}else if(type == 2){//支付宝银行卡
} else if (type == 2) {//支付宝银行卡
let list = [...payParametersList]
if(listID){
list.forEach((v,i)=> {
if(listID == v.id){
if (listID) {
list.forEach((v, i) => {
if (listID == v.id) {
list[i] = obj
}
})
......@@ -214,16 +214,16 @@ const PaySetting: React.FC<{}> = () => {
<PageHeaderWrapper
extra={
hasEdit ?
<Popconfirm title="配置已修改,是否保存?" okText="是" cancelText="否" onConfirm={() =>
handleSubmit()
}>
<Button type="primary" icon={<SaveOutlined />} >
保存
<Popconfirm title="配置已修改,是否保存?" okText="是" cancelText="否" onConfirm={() =>
handleSubmit()
}>
<Button type="primary" icon={<SaveOutlined />} >
保存
</Button>
</Popconfirm>
:
<Button type="primary" onClick={() => handleSubmit()} icon={<SaveOutlined />} >
保存
</Popconfirm>
:
<Button type="primary" onClick={() => handleSubmit()} icon={<SaveOutlined />} >
保存
</Button>
}
>
......@@ -232,52 +232,54 @@ const PaySetting: React.FC<{}> = () => {
<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>
{
return (
<Fragment key={`tab-${i}`}>
<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>
(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 ?
<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>
<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>
</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>
</>
}
{
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>
</Fragment>
)
})
}
</Tabs>
......
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