index.jsx 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. import React, { useState, useEffect } from 'react'
  2. import { Select, Spin, Table, Button, Form, Input, Divider, Icon } from 'antd'
  3. import NavLink from 'umi/navlink'
  4. import { fetchList, apis, fetch } from '@/utils/request'
  5. import Search from '../../components/Search'
  6. import List from '../../components/List'
  7. const exportStatementExcel = fetch(apis.bill.exportStatementExcel)
  8. const getBillStatementAll = fetch(apis.bill.getBillStatementAll)
  9. const StatusDict = {
  10. '0': '未支付',
  11. '1': '已支付',
  12. '2': '支付中',
  13. '3': '已关闭',
  14. }
  15. const PayTypeDict = {
  16. '0': '微信缴费',
  17. '1': '线下缴费',
  18. '2': '支付宝缴费',
  19. }
  20. const Condition = props => {
  21. return (
  22. <Search
  23. onSearch={props.onSearch}
  24. onReset={props.onReset}
  25. render={form => {
  26. const { getFieldDecorator, setFieldsValue } = form
  27. return (
  28. <>
  29. <Form.Item label="订单号">
  30. {
  31. getFieldDecorator('orderBumber')(<Input placeholder="订单号" />)
  32. }
  33. </Form.Item>
  34. <Form.Item label="缴费项目编号">
  35. {
  36. getFieldDecorator('billId')(<Input placeholder="缴费项目编号" />)
  37. }
  38. </Form.Item>
  39. <Form.Item label="缴费项目名">
  40. {
  41. getFieldDecorator('billName')(<Input placeholder="缴费项目名" />)
  42. }
  43. </Form.Item>
  44. <Form.Item label="收费单号">
  45. {
  46. getFieldDecorator('billInvoiceId')(<Input placeholder="收费单号" />)
  47. }
  48. </Form.Item>
  49. <Form.Item label="缴费人手机号">
  50. {
  51. getFieldDecorator('payPhone')(<Input placeholder="缴费人手机号" />)
  52. }
  53. </Form.Item>
  54. </>
  55. )
  56. }}
  57. />
  58. )
  59. }
  60. export default props => {
  61. const [loading, setLoading] = useState(false)
  62. const [listData, setListData] = useState([])
  63. const [pagination, setPagination] = useState({})
  64. const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
  65. const handleSearch = vals => {
  66. setQueryParams({
  67. ...queryParams,
  68. ...vals,
  69. pageNum: 1,
  70. })
  71. }
  72. const handlePageChange = (pageNum, pageSize) => {
  73. setQueryParams({
  74. ...queryParams,
  75. pageNum,
  76. pageSize,
  77. })
  78. }
  79. const exportExcel = () => {
  80. exportStatementExcel().then(res => {
  81. const link = document.createElement('a')
  82. link.href = window.URL.createObjectURL(new Blob([res]))
  83. link.setAttribute('download', '流水信息.xls')
  84. link.click()
  85. })
  86. }
  87. useEffect(() => {
  88. setLoading(true)
  89. getBillStatementAll({ data: queryParams }).then(res => {
  90. const {list, ...pagi} = res || {}
  91. setListData(list)
  92. setPagination(pagi)
  93. setLoading(false)
  94. }).catch(err => setLoading(false))
  95. }, [queryParams])
  96. return (
  97. <div>
  98. <Condition onSearch={handleSearch} onReset={handleSearch} />
  99. <div style={{ margin: '24px 0' }}>
  100. <Button type="link" onClick={exportExcel}><Icon type="download"/>导出数据</Button>
  101. </div>
  102. <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="id">
  103. <Table.Column
  104. title="订单号"
  105. dataIndex="id"
  106. key="id"
  107. render={(_, row) => {
  108. return (
  109. <NavLink to={`/property/bill/order/info?id=${row.orderBumber}`}>
  110. <Button type="link">{row.orderBumber}</Button>
  111. </NavLink>
  112. )
  113. }}
  114. />
  115. <Table.Column
  116. title="收费组编号"
  117. dataIndex="billId"
  118. key="billId"
  119. render={(_, row) => {
  120. return (row.billIdList || []).map(item => (
  121. <NavLink key={item} to={`/property/bill/management/info?id=${item}`}>
  122. <Button type="link">{item}</Button>
  123. </NavLink>
  124. ))
  125. }}
  126. />
  127. <Table.Column
  128. title="收费单号"
  129. dataIndex="billInvoiceId"
  130. key="billInvoiceId"
  131. render={(_, row) => {
  132. return (row.billInvoiceIdList || []).map(item => (
  133. <span key={item}>{item}</span>
  134. ))
  135. }}
  136. />
  137. <Table.Column title="总费用金额" dataIndex="sumPrice" key="sumPrice" render={sumPrice => (sumPrice === null || sumPrice === undefined ? '' : sumPrice/100)} />
  138. <Table.Column
  139. title="订单状态"
  140. dataIndex="orderStatus"
  141. key="orderStatus"
  142. render={(_, row) => StatusDict[row.orderStatus]}
  143. />
  144. <Table.Column title="缴费人手机号" dataIndex="payPhone" key="payPhone" />
  145. <Table.Column title="缴费备注" dataIndex="payRemark" key="payRemark" />
  146. <Table.Column title="缴费方式" dataIndex="payType" key="payType" render={payType => PayTypeDict[payType]}/>
  147. <Table.Column title="订单生成时间" dataIndex="createTime" key="createTime" />
  148. <Table.Column title="缴费完成时间" dataIndex="updateDate" key="updateDate" />
  149. </List>
  150. </div>
  151. )
  152. }