123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- import React, { useState, useEffect } from 'react';
- import { PageHeaderWrapper } from '@ant-design/pro-layout';
- import { Form, Pagination, Button, Icon, message, Modal, Table, Select, Input, DatePicker } from 'antd';
- import router from 'umi/router';
- import moment from 'moment';
- import className from 'classnames';
- import Cell from '../../components/Cell';
- import styles from './style.less';
- import { fetch, apis } from '../../utils/request';
- import request from '../../utils/request';
- import AuthButton from '@/components/AuthButton';
- import { regFenToYuan } from '@/utils/money';
- import Swiper from './components/Swiper';
-
- const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
-
- function header(props) {
- // 获取初始化数据
- const [data, setData] = useState({})
- const [demandIdList, setDemandIdList] = useState([])
- const [swiperList, setSwiperList] = useState([])
- const orgId = props.orgId || ''
- useEffect(() => {
- getList({ pageNum: 1, pageSize: 10, orderType: 'recharge' });
- }, [])
-
- // 查询列表
- const getList = (params) => {
- request({ ...apis.fund.taOrgOrder, params: { ...params, orgId } }).then((data) => {
- console.log(data)
- setData(data)
- })
- }
-
-
- // 提交事件
- const handleSubmit = (e, props) => {
- e.preventDefault();
- props.form.validateFields((err, values) => {
- if (!err) {
- let { LocalDate, ...submitValue } = values
- if (null != LocalDate && LocalDate.length > 0) {
- const [startDate, endDate] = LocalDate
- submitValue.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00')}Z`;
- submitValue.endDate = `${moment(endDate).format('YYYY-MM-DDT23:59:59')}Z`;
- } else {
- submitValue.startDate = null
- submitValue.endDate = null
- }
- getList({ pageNum: 1, pageSize: 10, orderType: 'recharge', ...submitValue })
- }
- });
- }
-
- const changePageNum = pageNumber => {
- const { LocalDate, ...submitValue } = props.form.getFieldsValue()
- if (LocalDate != null && LocalDate.length > 0) {
- const [startDate, endDate] = LocalDate
- submitValue.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00')}Z`;
- submitValue.endDate = `${moment(endDate).format('YYYY-MM-DDT23:59:59')}Z`;
- } else {
- submitValue.startDate = null
- submitValue.endDate = null
- }
- getList({ pageNum: pageNumber, pageSize: 10, orderType: 'recharge', ...submitValue })
- }
- const look = (list) => {
- // setSwiperList([
- // 'https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1591688474&di=85bb9a6a9736e51c63a7bac09601f1e7&src=http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg',
- // 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1591698586868&di=f528c96c3004268843a070c342b905fa&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F36%2F48%2F19300001357258133412489354717.jpg',
- // 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1591698586867&di=7865b3f07e4b6b050642a042fa30f07e&imgtype=0&src=http%3A%2F%2Fa0.att.hudong.com%2F64%2F76%2F20300001349415131407760417677.jpg'
- // ])
- setSwiperList(list)
- }
- /**
- *
- *
- * @param {*} props
- * @returns
- */
- const columns = [
- {
- title: '订单编号',
- dataIndex: 'tradeNo',
- key: 'tradeNo',
- align: 'center',
- },
- {
- title: '充值组织',
- dataIndex: 'miniAppName',
- key: 'miniAppName',
- align: 'center',
- },
- {
- title: '充值金额',
- dataIndex: 'amount',
- key: 'amount',
- align: 'center',
- render: (x, row) => <span>{regFenToYuan(x)}</span>
-
- },
- {
- title: '充值方式',
- dataIndex: 'isOffline',
- key: 'isOffline',
- align: 'center',
- render: (x, row) => <><span>{row.isOffline ? '运营手工充值' : '业务线上充值'}</span></>
- },
- {
- title: '下单时间',
- dataIndex: 'createDate',
- key: 'createDate',
- align: 'center',
- render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
- },
- {
- title: '充值凭证',
- dataIndex: 'certificateUrlList',
- key: 'certificateUrlList',
- align: 'center',
- render: (x, row) => (
- <>
- {
- (x || []).length > 0 &&
- <>
-
- <span className={styles.blue} onClick={() => look(row.certificateUrlList)}>
- 查看
- </span></>
- }
- </>
- ),
- },
- {
- title: '充值状态',
- dataIndex: 'tradingStatus',
- key: 'tradingStatus',
- align: 'center',
- render: (x, row) => <><span>{row.tradingStatus == 'processing' ? '待支付' : row.tradingStatus == 'success' ? '已支付' : '失败'}</span></>
- },
- {
- title: '支付时间',
- dataIndex: 'payDate',
- key: 'payDate',
- align: 'center',
- render: (x, row) => <><span>{row.payDate ? `${moment(row.payDate).format('YYYY-MM-DD HH:mm:ss')}` : ''}</span></>,
- },
-
- ];
- function handleReset() {
- props.form.resetFields();
- getList({ pageNum: 1, pageSize: 10, orderType: 'recharge' })
- }
- // 导出
- const exportList = () => {
- let { LocalDate, ...submitValue } = props.form.getFieldsValue()
- if (null != LocalDate && LocalDate.length > 0) {
- const [startDate, endDate] = LocalDate
- submitValue.startDate = `${moment(startDate).format('YYYY-MM-DDT00:00:00')}Z`;
- submitValue.endDate = `${moment(endDate).format('YYYY-MM-DDT23:59:59')}Z`;
- } else {
- submitValue.startDate = null
- submitValue.endDate = null
- }
- request({ ...apis.fund.rechargeOrderExport, params: { orderType: 'recharge', orgId, ...submitValue } }).then(data => {
- if (!data) {
- return
- }
- const url = window.URL.createObjectURL(new Blob([data]))
- const link = document.createElement('a')
- link.style.display = 'none'
- link.href = url
- link.setAttribute('download', '充值订单表.xlsx')
- document.body.append(link)
- link.click()
- }).catch()
- }
- const { getFieldDecorator } = props.form
- return (
-
- <>
- < Swiper list={swiperList} onClose={() => setSwiperList([])} />
- <Form layout="inline" onSubmit={e => handleSubmit(e, props)} style={{ marginBottom: '16px' }}>
- <Form.Item>
- {getFieldDecorator('tradeNo')(
- <Input
- prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
- placeholder="订单编号"
- />,
- )}
- </Form.Item>
- <Form.Item>
- {getFieldDecorator('miniAppName')(
- <Input
- prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
- placeholder="充值组织"
- />,
- )}
- </Form.Item>
- <Form.Item>
- <span style={{ marginRight: '10px' }}>支付时间段:</span>
- {getFieldDecorator('LocalDate')(
- <RangePicker placeholder={['开始时间', '结束时间']} />
- )}
- </Form.Item>
- <Form.Item>
- {getFieldDecorator('isOffline')(
- <Select style={{ width: '180px' }} placeholder="充值方式">
- <Select.Option value="">全部</Select.Option>
- <Select.Option value="0">业务线上充值</Select.Option>
- <Select.Option value="1">运营手工充值</Select.Option>
- </Select>,
- )}
- </Form.Item>
- <Form.Item>
- {getFieldDecorator('tradingStatus')(
- <Select style={{ width: '180px' }} placeholder="充值状态">
- <Select.Option value="">全部</Select.Option>
- <Select.Option value="processing">待支付</Select.Option>
- <Select.Option value="success">已支付</Select.Option>
- <Select.Option value="fail">失败</Select.Option>
- </Select>,
- )}
- </Form.Item>
- <Form.Item>
- <Button type="primary" htmlType="submit" className={styles.searchBtn}>
- 搜索
- </Button>
- <Button style={{ marginLeft: 8 }} onClick={handleReset}>
- 重置
- </Button>
- </Form.Item>
- </Form>
- <div>
- <Button type="danger" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={() => exportList()} >导出</Button>
- </div>
- <Table rowKey={r => r.tradeNo} dataSource={data.records} columns={columns} pagination={false} />
- <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
- <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
- </div>
- </>
- )
- }
- const WrappedHeader = Form.create({ name: 'header' })(header);
-
- export default WrappedHeader
|