verifyList.jsx 3.8KB

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