知与行后台管理端

verifyList.jsx 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import React, { useState, useEffect } from 'react';
  2. import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
  3. import { FormattedMessage } from 'umi-plugin-react/locale';
  4. import styles from '../style/GoodsList.less';
  5. import router from 'umi/router';
  6. import moment from 'moment';
  7. import request from '../../utils/request'
  8. const { Option } = Select;
  9. const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
  10. const header = (props) => {
  11. const [ data, setData ] = useState({})
  12. useEffect(() => {
  13. getVerifyList({pageNum: 1,pageSize: 10, phone: props.location.query.telValue });
  14. },[])
  15. // 查询列表
  16. const getVerifyList = (params) => {
  17. request({
  18. url: '/api/admin/taPointsExchange',
  19. method: 'GET',
  20. params: { ...params },
  21. }).then((data) => {
  22. setData(data)
  23. })
  24. }
  25. const changePageNum = (pageNumber) => {
  26. getVerifyList({ pageNum: 1, pageSize: 10, phone: props.location.query.telValue })
  27. }
  28. const toBack = () => {
  29. router.push({
  30. pathname: '/integralMall/writeOff',
  31. });
  32. }
  33. const changeStatus = (row) => () => {
  34. request({
  35. url: '/api/admin/taPointsExchange/change',
  36. method: 'PUT',
  37. data: row
  38. }).then((data) => {
  39. message.info("操作成功")
  40. getVerifyList({ pageNum: pageNumber, pageSize: 10, phone: props.location.query.telValue })
  41. })
  42. }
  43. const columns = [
  44. {
  45. title: '用户姓名',
  46. dataIndex: 'personName',
  47. key: 'personName',
  48. align: 'center',
  49. },
  50. {
  51. title: '用户类型',
  52. dataIndex: 'personType',
  53. key: 'personType',
  54. align: 'center',
  55. render: (personType)=> <><span>{personType === 'Realty Consultant' ? '置业顾问' : personType === 'Sales Executive' ? '销售主管' : personType === 'estate agent' ? '经纪人' : ''}</span></>
  56. },
  57. {
  58. title: '手机号',
  59. dataIndex: 'phone',
  60. key: 'phone',
  61. align: 'center',
  62. },
  63. {
  64. title: '商品图片',
  65. dataIndex: 'image',
  66. key: 'image',
  67. align: 'center',
  68. render: (text, record) => <img src={record.image} className={styles.touxiang} />,
  69. },
  70. {
  71. title: '商品名称',
  72. dataIndex: 'targetName',
  73. key: 'targetName',
  74. align: 'center',
  75. },
  76. {
  77. title: '兑换时间',
  78. dataIndex: 'createDate',
  79. key: 'createDate',
  80. align: 'center',
  81. render: (createDate) => <><span>{moment(createDate).format('YYYY-MM-DD HH:mm')}</span></>
  82. },
  83. {
  84. title: '领取时间',
  85. dataIndex: 'verifyDate',
  86. key: 'verifyDate',
  87. align: 'center',
  88. render: (verifyDate) => <><span>{verifyDate != null ? moment(verifyDate).format('YYYY-MM-DD HH:mm') : ''}</span></>
  89. },
  90. {
  91. title: '状态',
  92. dataIndex: 'status',
  93. key: 'status',
  94. align: 'center',
  95. render: (status)=> <><span>{status == 1 ? '已领取' : '未领取'}</span></>
  96. },
  97. {
  98. title: '操作',
  99. dataIndex: 'handle',
  100. key: 'handle',
  101. align: 'center',
  102. render: (x,row) => <span style={{ color: '#1990FF' }} onClick={changeStatus(row)}>{ row.status == 1?'':'核销' }</span>
  103. },
  104. ];
  105. return (
  106. <>
  107. <Button type="primary" className={styles.addBtn} onClick={toBack}>返回</Button>
  108. <Table dataSource={data.records} columns={columns} pagination={false} />
  109. <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
  110. <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
  111. </div>
  112. </>
  113. )
  114. }
  115. const WrappedHeader = Form.create({ name: 'header' })(header);
  116. export default WrappedHeader