Commit 02b5daa6 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:

parent 1f43df86
import React, { useState, useEffect, useRef } from 'react'
import { Card, Space, Button, Popconfirm } from 'antd'
import { Card, Space, Button, Input, Modal, Form } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
......@@ -16,11 +16,17 @@ import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
import StatusTag from '@/components/StatusTag'
import { accountStatusMap, memberStatusMap } from '../../constant'
import LevelBrand from '@/pages/member/components/LevelBrand'
import { validatorByte } from '@/utils/regExp'
import { GetPayMemberAssetAccountGetMemberAssetAccountListResponseDetail } from '@/services/PayApi'
const formActions = createFormActions();
const { TextArea } = Input;
const AccountLists: React.FC<{}> = () => {
const ref = useRef<any>({})
const [checkForm] = Form.useForm()
const [currentRecord, setCurrentRecord] = useState<GetPayMemberAssetAccountGetMemberAssetAccountListResponseDetail>()
const [visibleModal, setVisibleModal] = useState<boolean>(false)
const columns: ColumnType<any>[] = [
{
......@@ -30,11 +36,10 @@ const AccountLists: React.FC<{}> = () => {
className: 'commonPickColor',
render: (text, record) => <>
<EyePreview
url={`/memberCenter/payandSettle/amountAccountManage/memberAccountManage/memberAccountDetail?id=${record.id}`}
url={`/memberCenter/payandSettle/amountAccountManage/memberAccountManage/detail?id=${record.id}`}
>
{text}
</EyePreview>
{/* <LevelBrand level={record.level} /> */}
</>
},
{
......@@ -49,8 +54,9 @@ const AccountLists: React.FC<{}> = () => {
},
{
title: '会员等级',
dataIndex: 'memberLevelName',
key: 'memberLevelName',
dataIndex: 'memberLevel',
key: 'memberLevel',
render: (t, r) => <LevelBrand level={r.level} />
},
{
title: '账户余额',
......@@ -68,7 +74,7 @@ const AccountLists: React.FC<{}> = () => {
title: '可用余额',
dataIndex: 'usableBalance',
key: 'usableBalance',
render: text => `¥${text}`
render: (t, r) => `¥${r.accountStatus - r.lockBalance}`
},
{
title: '会员状态',
......@@ -80,25 +86,22 @@ const AccountLists: React.FC<{}> = () => {
title: '账户状态',
dataIndex: 'accountStatus',
key: 'accountStatus',
render: (t, r) => (<span className={memberStatusMap[t]['className']}>{accountStatusMap[t]['title']}</span>)
render: (t, r) => (<><span className={accountStatusMap[t]['className']}></span>{accountStatusMap[t]['title']}</>)
},
{
title: '操作',
dataIndex: 'option',
render: (text: any, record: any) => (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => clickHandle(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>{record.accountStatus===1?'冻结':'解除'}</Button>
</Popconfirm>
render: (t: any, r: any) => (
<Button type='link' onClick={() => handleRow(r)}>{r.accountStatus===1?'冻结':'解除'}</Button>
)
}
]
const handleRow = (data: any) => {
setCurrentRecord(data)
setVisibleModal(true)
}
const fetchData = (params: any) => {
console.log(params)
return new Promise((resolve, reject) => {
......@@ -129,12 +132,18 @@ const AccountLists: React.FC<{}> = () => {
return {}
}
const cancel = () => {
console.log('cancel')
const handleCancel = () => {
setVisibleModal(false)
}
const clickHandle = (r: any) => {
console.log(r,'操作r')
const handleOK = () => {
checkForm.validateFields().then(values => {
setVisibleModal(false)
PublicApi.postPayMemberAssetAccountUpdateMemberAssetAccountEnable({ id: currentRecord.id, status: currentRecord.accountStatus === 1 ? 2 : 1, ...values }).then(res => {
if(res.code === 1000)
ref.current.reload()
})
})
}
return (
......@@ -169,6 +178,33 @@ const AccountLists: React.FC<{}> = () => {
}
/>
</Card>
<Modal
title={currentRecord?.accountStatus === 1 ? '会员冻结' : '会员解冻'}
visible={visibleModal}
onOk={handleOK}
onCancel={handleCancel}
>
<Form
layout="vertical"
form={checkForm}
>
<Form.Item
name="remark"
label={currentRecord?.accountStatus === 1 ? '会员冻结原因' : '会员解冻原因'}
rules={[
{
required: true,
message: '请填写原因'
},
{
validator: (r, v, c) => validatorByte(r, v, c, 120)
}
]}
>
<TextArea rows={6} placeholder="请填写原因" />
</Form.Item>
</Form>
</Modal>
</PageHeaderWrapper>
)
}
......
......@@ -8,9 +8,11 @@ import StatusTag from '@/components/StatusTag'
import cx from 'classnames'
import moment from 'moment'
import { ColumnType } from 'antd/lib/table/interface'
import { moveStatusMap, statusMap } from '../../constant'
import { SettingOutlined } from '@ant-design/icons'
import { memberStatusMap, moveStatusMap, statusMap } from '../../constant'
import { SettingOutlined, StopOutlined } from '@ant-design/icons'
import { validatorByte } from '@/utils/regExp'
import { PublicApi } from '@/services/api'
import { GetPayMemberAssetAccountGetMemberAssetAccountResponse } from '@/services/PayApi'
const { TextArea } = Input
......@@ -20,6 +22,25 @@ const AccountDetail: React.FC<{}> = () => {
const [moveRecord, setMoveRecord] = useState<any>()
const [isDisabled, setIsDisabled] = useState<boolean>(false)
const [visibleModal, setVisibleModal] = useState<boolean>(false)
const [ details, setDetails ] = useState<any>({ accountBalance: 0, lockBalance: 0})
useEffect(() => {
getAccountInfo()
// pay/memberAssetAccount/getMemberAssetAccount
}, [])
const getAccountInfo = async () => {
const { id } = history.location.query
let res = await PublicApi.getPayMemberAssetAccountGetMemberAssetAccount({id})
const { code, data } = res
setDetails(data)
if(code === 1000){
let tradeRecord = await PublicApi.getPayMemberAssetAccountGetAccountTradeRecord({memberAssetAccountId: data.id + ''})
let statusRecord = await PublicApi.getPayMemberAssetAccountGetAccountCheckRecord({memberAssetAccountId: data.id + ''})
setDealRecord(tradeRecord.data)
setMoveRecord(statusRecord.data)
}
}
const columns: ColumnType<any>[] = [
{
......@@ -102,18 +123,22 @@ const AccountDetail: React.FC<{}> = () => {
const handleRelieve = () => {
setVisibleModal(true)
console.log('解除')
}
const handleOK = () => {
console.log('OK')
}
const handleCancel = () => {
console.log('取消')
setVisibleModal(false)
}
const handleOK = () => {
checkForm.validateFields().then(values => {
setVisibleModal(false)
PublicApi.postPayMemberAssetAccountUpdateMemberAssetAccountEnable({ id: details.id, status: details.accountStatus === 1 ? 2 : 1, ...values }).then(res => {
if(res.code === 1000)
getAccountInfo()
})
})
}
return (
<PageHeaderWrapper
title="账户详情"
......@@ -124,10 +149,10 @@ const AccountDetail: React.FC<{}> = () => {
key="1"
onClick={handleRelieve}
type="primary"
icon={<SettingOutlined />}
icon={details?.accountStatus === 1 ? <SettingOutlined /> : <StopOutlined />}
disabled={isDisabled}
>
解冻
{details?.accountStatus === 1 ? '冻结' : '解冻'}
</Button>,
]}
>
......@@ -140,12 +165,12 @@ const AccountDetail: React.FC<{}> = () => {
<div className={styles.statistic}>
<div className={styles['statistic-title']}>可用余额(元):</div>
<div className={styles['statistic-amount']}>
{`100000`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
{`${details.accountBalance - details.lockBalance}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
</div>
</div>
<div className={styles['repayment-end']}>
<span className={styles['repayment-time']}>
温州市龙昌皮具有限公司
{details?.memberName}
</span>
</div>
</div>
......@@ -158,7 +183,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户归属:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>广州数商云网络科技有限公司</p>
<p className={styles.rightInfo}>{details?.parentMemberName}</p>
</Col>
</Row>
<Row>
......@@ -166,7 +191,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户余额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>10,000</p>
<p className={styles.rightInfo}>{details?.accountBalance}</p>
</Col>
</Row>
<Row>
......@@ -174,7 +199,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>锁定金额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>0.00</p>
<p className={styles.rightInfo}>{details?.lockBalance}</p>
</Col>
</Row>
<Row>
......@@ -182,7 +207,12 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户状态:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}><StatusTag type="success" title="正常" /></p>
<p className={styles.rightInfo}>
{
details?.accountStatus &&
<StatusTag title={memberStatusMap[details.accountStatus]['title']} type={memberStatusMap[details.accountStatus]['type']} />
}
</p>
</Col>
</Row>
</div>
......@@ -201,7 +231,7 @@ const AccountDetail: React.FC<{}> = () => {
</Card>
</Space>
<Modal
title="会员冻结"
title={details?.accountStatus === 1 ? '会员冻结' : '会员解冻'}
visible={visibleModal}
onOk={handleOK}
onCancel={handleCancel}
......@@ -211,8 +241,8 @@ const AccountDetail: React.FC<{}> = () => {
form={checkForm}
>
<Form.Item
name="checkRemark"
label={'会员冻结原因'}
name="remark"
label={details?.accountStatus === 1 ? '会员冻结原因' : '会员解冻原因'}
rules={[
{
required: true,
......
......@@ -11,14 +11,34 @@ import { ColumnType } from 'antd/lib/table/interface'
import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import { rechargeSchema } from './schema'
import { moveStatusMap, statusMap } from '../../constant'
import { memberStatusMap, moveStatusMap, statusMap } from '../../constant'
import { PublicApi } from '@/services/api'
import { GetPayAssetAccountGetAssetAccountResponse } from '@/services/PayApi'
const schemaActions = createFormActions()
const AccountDetail: React.FC<{}> = () => {
const modalRef = useRef<any>()
const [dealRecord, setDealRecord] = useState<any>()
const [moveRecord, setMoveRecord] = useState<any>()
const [ details, setDetails ] = useState<any>({ accountBalance: 0, lockBalance: 0})
const [dealRecord, setDealRecord] = useState<any>([])
const [moveRecord, setMoveRecord] = useState<any>([])
useEffect(() => {
getAccountInfo()
} ,[])
const getAccountInfo = async () => {
const { id } = history.location.query
let res = await PublicApi.getPayAssetAccountGetAssetAccount({id})
const { code, data } = res
setDetails(data)
if(code === 1000){
let tradeRecord = await PublicApi.getPayAssetAccountGetAccountTradeRecord({memberAssetAccountId: data.id + ''})
let statusRecord = await PublicApi.getPayAssetAccountGetAccountStatusRecord({memberAssetAccountId: data.id + ''})
setDealRecord(tradeRecord.data)
setMoveRecord(statusRecord.data)
}
}
const columns: ColumnType<any>[] = [
{
......@@ -134,12 +154,12 @@ const AccountDetail: React.FC<{}> = () => {
<div className={styles.statistic}>
<div className={styles['statistic-title']}>可用余额(元):</div>
<div className={styles['statistic-amount']}>
{`100000`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
{`${details.accountBalance - details.lockBalance}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
</div>
</div>
<div className={styles['repayment-end']}>
<span className={styles['repayment-time']}>
温州市龙昌皮具有限公司
{details?.memberName}
</span>
</div>
</div>
......@@ -152,7 +172,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户归属:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>广州数商云网络科技有限公司</p>
<p className={styles.rightInfo}>{details?.parentMemberName}</p>
</Col>
</Row>
<Row>
......@@ -160,7 +180,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户余额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>10,000</p>
<p className={styles.rightInfo}>{details?.accountBalance}</p>
</Col>
</Row>
<Row>
......@@ -168,7 +188,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>锁定金额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>0.00</p>
<p className={styles.rightInfo}>{details?.lockBalance}</p>
</Col>
</Row>
<Row>
......@@ -176,7 +196,12 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户状态:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}><StatusTag type="success" title="正常" /></p>
<p className={styles.rightInfo}>
{
details?.accountStatus &&
<StatusTag title={memberStatusMap[details.accountStatus]['title']} type={memberStatusMap[details.accountStatus]['type']} />
}
</p>
</Col>
</Row>
</div>
......@@ -184,7 +209,7 @@ const AccountDetail: React.FC<{}> = () => {
<Col span={6}>
<div className={styles.rightActions}>
<Button className={styles.rightAction} type="primary" onClick={handleRecharge}>充值</Button>
<Button className={styles.rightAction}>申请提现</Button>
<Button className={styles.rightAction} onClick={() => history.push(`/memberCenter/payandSettle/capitalAccounts/accountLists/applyWithdraw?id=${details?.id}`)}>申请提现</Button>
</div>
</Col>
</Row>
......
......@@ -8,14 +8,30 @@ import StatusTag from '@/components/StatusTag'
import cx from 'classnames'
import moment from 'moment'
import { ColumnType } from 'antd/lib/table/interface'
import { statusMap } from '../../constant'
import { memberStatusMap, statusMap } from '../../constant'
import { PublicApi } from '@/services/api'
const { Step } = Steps;
const AccountDetail: React.FC<{}> = () => {
const [ details, setDetails ] = useState<any>({ accountBalance: 0, lockBalance: 0})
const [dealRecord, setDealRecord] = useState<any>()
useEffect(() => {
getAccountInfo()
}, [])
const getAccountInfo = async () => {
const { id } = history.location.query
let res = await PublicApi.getPayAssetAccountGetAssetAccount({id})
const { code, data } = res
setDetails(data)
if(code === 1000){
let tradeRecord = await PublicApi.getPayAssetAccountGetAccountTradeRecord({memberAssetAccountId: data.id + ''})
setDealRecord(tradeRecord.data)
}
}
const columns: ColumnType<any>[] = [
{
title: '交易流水号',
......@@ -94,7 +110,7 @@ const AccountDetail: React.FC<{}> = () => {
</div>
<div className={styles['repayment-end']}>
<span className={styles['repayment-time']}>
最多可以提现:¥10,000.00
最多可以提现:¥ {details.accountBalance - details.lockBalance}
</span>
</div>
</div>
......@@ -110,7 +126,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户归属:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>广州数商云网络科技有限公司</p>
<p className={styles.rightInfo}>{details?.parentMemberName}</p>
</Col>
</Row>
<Row>
......@@ -143,12 +159,12 @@ const AccountDetail: React.FC<{}> = () => {
<div className={styles.statistic}>
<div className={styles['statistic-title']}>可用余额(元):</div>
<div className={styles['statistic-amount']}>
{`100000`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
{`${details.accountBalance - details.lockBalance}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
</div>
</div>
<div className={styles['repayment-end']}>
<span className={styles['repayment-time']}>
温州市龙昌皮具有限公司
{details?.memberName}
</span>
</div>
</div>
......@@ -161,7 +177,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户归属:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>广州数商云网络科技有限公司</p>
<p className={styles.rightInfo}>{details?.parentMemberName}</p>
</Col>
</Row>
<Row>
......@@ -169,7 +185,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户余额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>10,000</p>
<p className={styles.rightInfo}>{details?.accountBalance}</p>
</Col>
</Row>
<Row>
......@@ -177,7 +193,7 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>锁定金额(元):</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}>0.00</p>
<p className={styles.rightInfo}>{details?.lockBalance}</p>
</Col>
</Row>
<Row>
......@@ -185,7 +201,10 @@ const AccountDetail: React.FC<{}> = () => {
<p className={styles.rightTitle}>账户状态:</p>
</Col>
<Col span={20}>
<p className={styles.rightInfo}><StatusTag type="success" title="正常" /></p>
{
details?.accountStatus &&
<StatusTag title={memberStatusMap[details.accountStatus]['title']} type={memberStatusMap[details.accountStatus]['type']} />
}
</Col>
</Row>
</div>
......
......@@ -13,7 +13,8 @@ import { PlusOutlined } from '@ant-design/icons'
import EyePreview from '@/components/EyePreview'
import { DatePicker } from '@formily/antd-components'
import StatusTag from '@/components/StatusTag'
import { accountStatusMap, memberStatusMap } from '../../constant'
import { accountStatusMap, memberStatusMap, memberLevelTypeMap } from '../../constant'
import LevelBrand from '@/pages/member/components/LevelBrand'
const formActions = createFormActions();
......@@ -43,14 +44,16 @@ const AccountLists: React.FC<{}> = () => {
key: 'memberRoleName',
},
{
title: '会员等级',
dataIndex: 'memberLevelName',
key: 'memberLevelName',
title: '所属会员等级',
dataIndex: 'memberLevel',
key: 'memberLevel',
render: (t, r) => <LevelBrand level={r.memberLevel} />
},
{
title: '会员等级类型',
dataIndex: 'memberLevelType',
key: 'memberLevelType',
render: (t, r) => memberLevelTypeMap[t]
},
{
title: '会员状态',
......@@ -62,7 +65,7 @@ const AccountLists: React.FC<{}> = () => {
title: '账户状态',
dataIndex: 'accountStatus',
key: 'accountStatus',
render: (t, r) => (<span className={memberStatusMap[t]['className']}>{accountStatusMap[t]['title']}</span>)
render: (t, r) => (<><span className={accountStatusMap[t]['className']}></span>{accountStatusMap[t]['title']}</>)
},
{
title: '账户余额',
......@@ -80,7 +83,7 @@ const AccountLists: React.FC<{}> = () => {
title: '可用余额',
dataIndex: 'usableBalance',
key: 'usableBalance',
render: text => `¥${text}`
render: (t, r) => `¥${r.accountStatus - r.lockBalance}`
},
]
......
......@@ -84,4 +84,10 @@ export const memberStatusMap = {
export const accountStatusMap = {
'1': { title: '正常', className: 'commonStatusValid' },
'2': { title: '已冻结', className: 'commonStatusNoPass' },
}
export const memberLevelTypeMap = {
'1': '平台会员',
'2': '商户会员',
'3': '渠道会员',
}
\ No newline at end of file
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