index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. import React, { Component } from 'react';
  2. import { Table, Card, Form, Row, Col, Input, Select, DatePicker } from 'antd';
  3. import moment from 'moment';
  4. import { productType } from '../../utils/config';
  5. import styles from './index.less';
  6. @Form.create()
  7. export default class SoldProductList extends Component {
  8. render() {
  9. // 模拟数据
  10. const mockData = [];
  11. for (let i = 1; i < 2000; i++) {
  12. mockData.push({
  13. id: i,
  14. productCode: 'C-001',
  15. productName: '小学语文二年级上册',
  16. productType: 'COURSE',
  17. userCode: '1500024398001',
  18. userName: '教室六',
  19. campusCode: '1500024398',
  20. campusName: '湖南省-长沙市天水区-育新小学',
  21. merchantName: '贝尔安亲',
  22. cpPrice: 1000.85,
  23. merchantPrice: 20000.890,
  24. terminalPrice: 21000,
  25. chargeUnit: '年',
  26. quantity: 1,
  27. gmtCreated: 1590000134,
  28. });
  29. }
  30. // 表格-列对象
  31. const columns = [{
  32. title: '产品编号',
  33. dataIndex: 'productCode',
  34. key: 1, // 设置了dataIndex可忽略这个属性
  35. }, {
  36. title: '产品名称',
  37. dataIndex: 'productName',
  38. key: 2,
  39. }, {
  40. title: '产品类型',
  41. dataIndex: 'productType',
  42. key: 3,
  43. render: (text, record) => productType[text],
  44. }, {
  45. title: '终端编号',
  46. dataIndex: 'userCode',
  47. key: 4,
  48. }, {
  49. title: '终端名称',
  50. dataIndex: 'userName',
  51. key: 5,
  52. }, {
  53. title: '校区编号',
  54. dataIndex: 'campusCode',
  55. key: 6,
  56. }, {
  57. title: '校区名称',
  58. dataIndex: 'campusName',
  59. key: 7,
  60. }, {
  61. title: '渠道名称',
  62. dataIndex: 'merchantName',
  63. key: 8,
  64. }, {
  65. title: '供应商价格(¥)',
  66. dataIndex: 'cpPrice',
  67. key: 9,
  68. }, {
  69. title: '渠道价格(¥)',
  70. dataIndex: 'merchantPrice',
  71. key: 10,
  72. }, {
  73. title: '终端价格(¥)',
  74. dataIndex: 'terminalPrice',
  75. key: 11,
  76. }, {
  77. title: '数量',
  78. dataIndex: 'quantity',
  79. key: 12,
  80. }, {
  81. title: '计价单位',
  82. dataIndex: 'chargeUnit',
  83. key: 13,
  84. }, {
  85. title: '创建时间',
  86. dataIndex: 'gmtCreated',
  87. key: 14,
  88. render: (text, record) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
  89. }];
  90. const { getFieldDecorator } = this.props.form;
  91. return (
  92. <Card>
  93. <div className={styles.tableList}>
  94. <div className={styles.tableListForm}>
  95. <Form layout="inline">
  96. <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
  97. <Col md={8} sm={24}>
  98. <Form.Item label="渠道">
  99. {getFieldDecorator('merchantId')(
  100. <Input placeholder="请选择" />
  101. )}
  102. </Form.Item>
  103. </Col>
  104. <Col md={8} sm={24}>
  105. <Form.Item label="校区">
  106. {getFieldDecorator('campusId')(
  107. <Input placeholder="请选择" />
  108. )}
  109. </Form.Item>
  110. </Col>
  111. <Col md={8} sm={24}>
  112. <Form.Item label="终端">
  113. {getFieldDecorator('uid')(
  114. <Input placeholder="请选择" />
  115. )}
  116. </Form.Item>
  117. </Col>
  118. </Row>
  119. <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
  120. <Col md={8} sm={24}>
  121. <Form.Item label="产品类型">
  122. {getFieldDecorator('productType')(
  123. <Input placeholder="请选择" />
  124. )}
  125. </Form.Item>
  126. </Col>
  127. <Col md={8} sm={24}>
  128. <Form.Item label="产品名称">
  129. {getFieldDecorator('productName')(
  130. <Input placeholder="请输入" />
  131. )}
  132. </Form.Item>
  133. </Col>
  134. <Col md={8} sm={24}>
  135. <Form.Item label="产品编号">
  136. {getFieldDecorator('productCode')(
  137. <Input placeholder="请输入" />
  138. )}
  139. </Form.Item>
  140. </Col>
  141. </Row>
  142. <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
  143. <Col md={8} sm={24}>
  144. <Form.Item label="时间范围">
  145. {getFieldDecorator('time')(
  146. <DatePicker />
  147. )}
  148. </Form.Item>
  149. </Col>
  150. <Col md={8} sm={24}>
  151. <Form.Item label="至">
  152. {getFieldDecorator('time')(
  153. <DatePicker />
  154. )}
  155. </Form.Item>
  156. </Col>
  157. </Row>
  158. </Form>
  159. </div>
  160. <div>
  161. <Table
  162. bordered
  163. rowKey={record => record.id}
  164. columns={columns}
  165. dataSource={mockData}
  166. scroll={{ x: 1800 }}
  167. />
  168. </div>
  169. </div>
  170. </Card>
  171. );
  172. }
  173. }