IntroduceRow.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. import React, { memo } from 'react';
  2. import { Row, Col, Icon, Tooltip } from 'antd';
  3. import { FormattedMessage } from 'umi/locale';
  4. import styles from './Analysis.less';
  5. import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from '@/components/Charts';
  6. import Trend from '@/components/Trend';
  7. import numeral from 'numeral';
  8. import Yuan from '@/utils/Yuan';
  9. const topColResponsiveProps = {
  10. xs: 24,
  11. sm: 12,
  12. md: 12,
  13. lg: 12,
  14. xl: 6,
  15. style: { marginBottom: 24 },
  16. };
  17. const IntroduceRow = memo(({ loading, visitData }) => (
  18. <Row gutter={24}>
  19. <Col {...topColResponsiveProps}>
  20. <ChartCard
  21. bordered={false}
  22. title={<FormattedMessage id="app.analysis.total-sales" defaultMessage="Total Sales" />}
  23. action={
  24. <Tooltip
  25. title={<FormattedMessage id="app.analysis.introduce" defaultMessage="Introduce" />}
  26. >
  27. <Icon type="info-circle-o" />
  28. </Tooltip>
  29. }
  30. loading={loading}
  31. total={() => <Yuan>126560</Yuan>}
  32. footer={
  33. <Field
  34. label={<FormattedMessage id="app.analysis.day-sales" defaultMessage="Daily Sales" />}
  35. value={`¥${numeral(12423).format('0,0')}`}
  36. />
  37. }
  38. contentHeight={46}
  39. >
  40. <Trend flag="up" style={{ marginRight: 16 }}>
  41. <FormattedMessage id="app.analysis.week" defaultMessage="Weekly Changes" />
  42. <span className={styles.trendText}>12%</span>
  43. </Trend>
  44. <Trend flag="down">
  45. <FormattedMessage id="app.analysis.day" defaultMessage="Daily Changes" />
  46. <span className={styles.trendText}>11%</span>
  47. </Trend>
  48. </ChartCard>
  49. </Col>
  50. <Col {...topColResponsiveProps}>
  51. <ChartCard
  52. bordered={false}
  53. loading={loading}
  54. title={<FormattedMessage id="app.analysis.visits" defaultMessage="Visits" />}
  55. action={
  56. <Tooltip
  57. title={<FormattedMessage id="app.analysis.introduce" defaultMessage="Introduce" />}
  58. >
  59. <Icon type="info-circle-o" />
  60. </Tooltip>
  61. }
  62. total={numeral(8846).format('0,0')}
  63. footer={
  64. <Field
  65. label={<FormattedMessage id="app.analysis.day-visits" defaultMessage="Daily Visits" />}
  66. value={numeral(1234).format('0,0')}
  67. />
  68. }
  69. contentHeight={46}
  70. >
  71. <MiniArea color="#975FE4" data={visitData} />
  72. </ChartCard>
  73. </Col>
  74. <Col {...topColResponsiveProps}>
  75. <ChartCard
  76. bordered={false}
  77. loading={loading}
  78. title={<FormattedMessage id="app.analysis.payments" defaultMessage="Payments" />}
  79. action={
  80. <Tooltip
  81. title={<FormattedMessage id="app.analysis.introduce" defaultMessage="Introduce" />}
  82. >
  83. <Icon type="info-circle-o" />
  84. </Tooltip>
  85. }
  86. total={numeral(6560).format('0,0')}
  87. footer={
  88. <Field
  89. label={
  90. <FormattedMessage
  91. id="app.analysis.conversion-rate"
  92. defaultMessage="Conversion Rate"
  93. />
  94. }
  95. value="60%"
  96. />
  97. }
  98. contentHeight={46}
  99. >
  100. <MiniBar data={visitData} />
  101. </ChartCard>
  102. </Col>
  103. <Col {...topColResponsiveProps}>
  104. <ChartCard
  105. loading={loading}
  106. bordered={false}
  107. title={
  108. <FormattedMessage
  109. id="app.analysis.operational-effect"
  110. defaultMessage="Operational Effect"
  111. />
  112. }
  113. action={
  114. <Tooltip
  115. title={<FormattedMessage id="app.analysis.introduce" defaultMessage="Introduce" />}
  116. >
  117. <Icon type="info-circle-o" />
  118. </Tooltip>
  119. }
  120. total="78%"
  121. footer={
  122. <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
  123. <Trend flag="up" style={{ marginRight: 16 }}>
  124. <FormattedMessage id="app.analysis.week" defaultMessage="Weekly Changes" />
  125. <span className={styles.trendText}>12%</span>
  126. </Trend>
  127. <Trend flag="down">
  128. <FormattedMessage id="app.analysis.day" defaultMessage="Weekly Changes" />
  129. <span className={styles.trendText}>11%</span>
  130. </Trend>
  131. </div>
  132. }
  133. contentHeight={46}
  134. >
  135. <MiniProgress percent={78} strokeWidth={8} target={80} color="#13C2C2" />
  136. </ChartCard>
  137. </Col>
  138. </Row>
  139. ));
  140. export default IntroduceRow;