IndexChart.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. <a-row>
  104. <a-col :span="6">
  105. <head-info title="今日IP" :content="loginfo.todayIp"></head-info>
  106. </a-col>
  107. <a-col :span="2">
  108. <a-spin class='circle-cust'>
  109. <a-icon slot="indicator" type="environment" style="font-size: 24px" />
  110. </a-spin>
  111. </a-col>
  112. <a-col :span="6">
  113. <head-info title="今日访问" :content="loginfo.todayVisitCount"></head-info>
  114. </a-col>
  115. <a-col :span="2">
  116. <a-spin class='circle-cust'>
  117. <a-icon slot="indicator" type="team" style="font-size: 24px" />
  118. </a-spin>
  119. </a-col>
  120. <a-col :span="6">
  121. <head-info title="总访问量" :content="loginfo.totalVisitCount"></head-info>
  122. </a-col>
  123. <a-col :span="2">
  124. <a-spin class='circle-cust'>
  125. <a-icon slot="indicator" type="rise" style="font-size: 24px" />
  126. </a-spin>
  127. </a-col>
  128. </a-row>
  129. <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid>
  130. </a-card>
  131. </a-col>
  132. </a-row>
  133. </div>
  134. </template>
  135. <script>
  136. import ChartCard from '@/components/ChartCard'
  137. import ACol from "ant-design-vue/es/grid/Col"
  138. import ATooltip from "ant-design-vue/es/tooltip/Tooltip"
  139. import MiniArea from '@/components/chart/MiniArea'
  140. import MiniBar from '@/components/chart/MiniBar'
  141. import MiniProgress from '@/components/chart/MiniProgress'
  142. import RankList from '@/components/chart/RankList'
  143. import Bar from '@/components/chart/Bar'
  144. import LineChartMultid from '@/components/chart/LineChartMultid'
  145. import HeadInfo from '@/components/tools/HeadInfo.vue'
  146. import Trend from '@/components/Trend'
  147. import { getLoginfo,getVisitInfo } from '@/api/api'
  148. const rankList = []
  149. for (let i = 0; i < 7; i++) {
  150. rankList.push({
  151. name: '白鹭岛 ' + (i+1) + ' 号店',
  152. total: 1234.56 - i * 100
  153. })
  154. }
  155. const barData = []
  156. for (let i = 0; i < 12; i += 1) {
  157. barData.push({
  158. x: `${i + 1}月`,
  159. y: Math.floor(Math.random() * 1000) + 200
  160. })
  161. }
  162. export default {
  163. name: "IndexChart",
  164. components: {
  165. ATooltip,
  166. ACol,
  167. ChartCard,
  168. MiniArea,
  169. MiniBar,
  170. MiniProgress,
  171. RankList,
  172. Bar,
  173. Trend,
  174. LineChartMultid,
  175. HeadInfo
  176. },
  177. data() {
  178. return {
  179. loading: true,
  180. center: null,
  181. rankList,
  182. barData,
  183. loginfo:{},
  184. visitFields:['ip','visit'],
  185. visitInfo:[],
  186. indicator: <a-icon type="loading" style="font-size: 24px" spin />
  187. }
  188. },
  189. created() {
  190. setTimeout(() => {
  191. this.loading = !this.loading
  192. }, 1000)
  193. this.initLogInfo();
  194. },
  195. methods: {
  196. initLogInfo () {
  197. getLoginfo(null).then((res)=>{
  198. if(res.success){
  199. Object.keys(res.result).forEach(key=>{
  200. res.result[key] =res.result[key]+""
  201. })
  202. this.loginfo = res.result;
  203. }
  204. })
  205. getVisitInfo().then(res=>{
  206. if(res.success){
  207. console.log("aaaaaa",res.result)
  208. this.visitInfo = res.result;
  209. }
  210. })
  211. },
  212. }
  213. }
  214. </script>
  215. <style lang="less" scoped>
  216. .circle-cust{
  217. position: relative;
  218. top: 28px;
  219. left: -100%;
  220. }
  221. .extra-wrapper {
  222. line-height: 55px;
  223. padding-right: 24px;
  224. .extra-item {
  225. display: inline-block;
  226. margin-right: 24px;
  227. a {
  228. margin-left: 24px;
  229. }
  230. }
  231. }
  232. /* 首页访问量统计 */
  233. .head-info {
  234. position: relative;
  235. text-align: left;
  236. padding: 0 32px 0 0;
  237. min-width: 125px;
  238. &.center {
  239. text-align: center;
  240. padding: 0 32px;
  241. }
  242. span {
  243. color: rgba(0, 0, 0, .45);
  244. display: inline-block;
  245. font-size: .95rem;
  246. line-height: 42px;
  247. margin-bottom: 4px;
  248. }
  249. p {
  250. line-height: 42px;
  251. margin: 0;
  252. a {
  253. font-weight: 600;
  254. font-size: 1rem;
  255. }
  256. }
  257. }
  258. </style>