IndexChart.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="page-header-index-wide">
  3. <a-row :gutter="24">
  4. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  5. <chart-card :loading="loading" title="总销售额" total="¥126,560">
  6. <a-tooltip title="指标说明" slot="action">
  7. <a-icon type="info-circle-o" />
  8. </a-tooltip>
  9. <div>
  10. <trend flag="up" style="margin-right: 16px;">
  11. <span slot="term">周同比</span>
  12. 12%
  13. </trend>
  14. <trend flag="down">
  15. <span slot="term">日同比</span>
  16. 11%
  17. </trend>
  18. </div>
  19. <template slot="footer">日均销售额<span>¥ 234.56</span></template>
  20. </chart-card>
  21. </a-col>
  22. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  23. <chart-card :loading="loading" title="订单量" :total="8846 | NumberFormat">
  24. <a-tooltip title="指标说明" slot="action">
  25. <a-icon type="info-circle-o" />
  26. </a-tooltip>
  27. <div>
  28. <mini-area />
  29. </div>
  30. <template slot="footer">日订单量<span> {{ '1234' | NumberFormat }}</span></template>
  31. </chart-card>
  32. </a-col>
  33. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  34. <chart-card :loading="loading" title="支付笔数" :total="6560 | NumberFormat">
  35. <a-tooltip title="指标说明" slot="action">
  36. <a-icon type="info-circle-o" />
  37. </a-tooltip>
  38. <div>
  39. <mini-bar :height="40" />
  40. </div>
  41. <template slot="footer">转化率 <span>60%</span></template>
  42. </chart-card>
  43. </a-col>
  44. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
  45. <chart-card :loading="loading" title="运营活动效果" total="78%">
  46. <a-tooltip title="指标说明" slot="action">
  47. <a-icon type="info-circle-o" />
  48. </a-tooltip>
  49. <div>
  50. <mini-progress color="rgb(19, 194, 194)" :target="80" :percentage="78" :height="8" />
  51. </div>
  52. <template slot="footer">
  53. <trend flag="down" style="margin-right: 16px;">
  54. <span slot="term">同周比</span>
  55. 12%
  56. </trend>
  57. <trend flag="up">
  58. <span slot="term">日环比</span>
  59. 80%
  60. </trend>
  61. </template>
  62. </chart-card>
  63. </a-col>
  64. </a-row>
  65. <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}">
  66. <div class="salesCard">
  67. <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
  68. <div class="extra-wrapper" slot="tabBarExtraContent">
  69. <div class="extra-item">
  70. <a>今日</a>
  71. <a>本周</a>
  72. <a>本月</a>
  73. <a>本年</a>
  74. </div>
  75. <a-range-picker :style="{width: '256px'}" />
  76. </div>
  77. <a-tab-pane loading="true" tab="销售额" key="1">
  78. <a-row>
  79. <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
  80. <bar title="销售额排行" :dataSource="barData"/>
  81. </a-col>
  82. <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
  83. <rank-list title="门店销售排行榜" :list="rankList"/>
  84. </a-col>
  85. </a-row>
  86. </a-tab-pane>
  87. <a-tab-pane tab="销售趋势" key="2">
  88. <a-row>
  89. <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
  90. <bar title="销售额趋势" :dataSource="barData"/>
  91. </a-col>
  92. <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
  93. <rank-list title="门店销售排行榜" :list="rankList"/>
  94. </a-col>
  95. </a-row>
  96. </a-tab-pane>
  97. </a-tabs>
  98. </div>
  99. </a-card>
  100. <a-row>
  101. <a-col :span="24">
  102. <a-card :loading="loading" :bordered="false" title="最近一周访问量统计" :style="{ marginTop: '24px' }">
  103. <!-- 图标提示文字 -->
  104. <a-row>
  105. <a-col :span="6">
  106. <head-info title="今日IP" :content="loginfo.todayIp"></head-info>
  107. </a-col>
  108. <a-col :span="2">
  109. <a-spin class='circle-cust'>
  110. <a-icon slot="indicator" type="environment" style="font-size: 24px" />
  111. </a-spin>
  112. </a-col>
  113. <a-col :span="6">
  114. <head-info title="今日访问" :content="loginfo.todayVisitCount"></head-info>
  115. </a-col>
  116. <a-col :span="2">
  117. <a-spin class='circle-cust'>
  118. <a-icon slot="indicator" type="team" style="font-size: 24px" />
  119. </a-spin>
  120. </a-col>
  121. <a-col :span="6">
  122. <head-info title="总访问量" :content="loginfo.totalVisitCount"></head-info>
  123. </a-col>
  124. <a-col :span="2">
  125. <a-spin class='circle-cust'>
  126. <a-icon slot="indicator" type="rise" style="font-size: 24px" />
  127. </a-spin>
  128. </a-col>
  129. </a-row>
  130. <!-- 折线图 -->
  131. <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
  132. </a-card>
  133. </a-col>
  134. </a-row>
  135. </div>
  136. </template>
  137. <script>
  138. import ChartCard from '@/components/ChartCard'
  139. import ACol from "ant-design-vue/es/grid/Col"
  140. import ATooltip from "ant-design-vue/es/tooltip/Tooltip"
  141. import MiniArea from '@/components/chart/MiniArea'
  142. import MiniBar from '@/components/chart/MiniBar'
  143. import MiniProgress from '@/components/chart/MiniProgress'
  144. import RankList from '@/components/chart/RankList'
  145. import Bar from '@/components/chart/Bar'
  146. import LineChartMultid from '@/components/chart/LineChartMultid'
  147. import HeadInfo from '@/components/tools/HeadInfo.vue'
  148. import Trend from '@/components/Trend'
  149. import { getLoginfo,getVisitInfo } from '@/api/api'
  150. const rankList = []
  151. for (let i = 0; i < 7; i++) {
  152. rankList.push({
  153. name: '白鹭岛 ' + (i+1) + ' 号店',
  154. total: 1234.56 - i * 100
  155. })
  156. }
  157. const barData = []
  158. for (let i = 0; i < 12; i += 1) {
  159. barData.push({
  160. x: `${i + 1}月`,
  161. y: Math.floor(Math.random() * 1000) + 200
  162. })
  163. }
  164. export default {
  165. name: "IndexChart",
  166. components: {
  167. ATooltip,
  168. ACol,
  169. ChartCard,
  170. MiniArea,
  171. MiniBar,
  172. MiniProgress,
  173. RankList,
  174. Bar,
  175. Trend,
  176. LineChartMultid,
  177. HeadInfo
  178. },
  179. data() {
  180. return {
  181. loading: true,
  182. center: null,
  183. rankList,
  184. barData,
  185. loginfo:{},
  186. visitFields:['ip','visit'],
  187. visitInfo:[],
  188. indicator: <a-icon type="loading" style="font-size: 24px" spin />
  189. }
  190. },
  191. created() {
  192. setTimeout(() => {
  193. this.loading = !this.loading
  194. }, 1000)
  195. this.initLogInfo();
  196. },
  197. methods: {
  198. initLogInfo () {
  199. getLoginfo(null).then((res)=>{
  200. if(res.success){
  201. Object.keys(res.result).forEach(key=>{
  202. res.result[key] =res.result[key]+""
  203. })
  204. this.loginfo = res.result;
  205. }
  206. })
  207. getVisitInfo().then(res=>{
  208. if(res.success){
  209. this.visitInfo = res.result;
  210. }
  211. })
  212. },
  213. }
  214. }
  215. </script>
  216. <style lang="less" scoped>
  217. .circle-cust{
  218. position: relative;
  219. top: 28px;
  220. left: -100%;
  221. }
  222. .extra-wrapper {
  223. line-height: 55px;
  224. padding-right: 24px;
  225. .extra-item {
  226. display: inline-block;
  227. margin-right: 24px;
  228. a {
  229. margin-left: 24px;
  230. }
  231. }
  232. }
  233. /* 首页访问量统计 */
  234. .head-info {
  235. position: relative;
  236. text-align: left;
  237. padding: 0 32px 0 0;
  238. min-width: 125px;
  239. &.center {
  240. text-align: center;
  241. padding: 0 32px;
  242. }
  243. span {
  244. color: rgba(0, 0, 0, .45);
  245. display: inline-block;
  246. font-size: .95rem;
  247. line-height: 42px;
  248. margin-bottom: 4px;
  249. }
  250. p {
  251. line-height: 42px;
  252. margin: 0;
  253. a {
  254. font-weight: 600;
  255. font-size: 1rem;
  256. }
  257. }
  258. }
  259. </style>