Index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <div class="main-container" v-loading="isLoading">
  3. <Header :title="title"></Header>
  4. <div class="container">
  5. <div class="content">
  6. <div class="top">
  7. <div class="left">
  8. <div class="left-top">
  9. <div class="item">
  10. <img :src="staticImg + 'index-01.png'" alt="" />
  11. <div class="num">
  12. <span>{{ sumData.yesterdayEarnings }}</span>
  13. 昨日收入
  14. </div>
  15. </div>
  16. <div class="item">
  17. <img :src="staticImg + 'index-02.png'" alt="" />
  18. <div class="num">
  19. <span>{{ sumData.yesterdayOrdersNum }}</span>
  20. 昨日新增订单
  21. </div>
  22. </div>
  23. <div class="item">
  24. <img :src="staticImg + 'index-03.png'" alt="" />
  25. <div class="num">
  26. <span>{{ sumData.waitDeliveryOrdersNum }}</span>
  27. 待发货订单数
  28. </div>
  29. </div>
  30. <div class="item">
  31. <img :src="staticImg + 'index-04.png'" alt="" />
  32. <div class="num">
  33. <span>{{ sumData.integral }}</span>
  34. 商城已释放积分
  35. </div>
  36. </div>
  37. <div class="item">
  38. <img :src="staticImg + 'index-05.png'" alt="" />
  39. <div class="num">
  40. <span>{{ sumData.freezeIntegral }}</span>
  41. 冻结中积分总量
  42. </div>
  43. </div>
  44. <div class="item">
  45. <img :src="staticImg + 'index-06.png'" alt="" />
  46. <div class="num">
  47. <span>{{ sumData.green }}</span>
  48. 全网绿色积分总量池
  49. </div>
  50. </div>
  51. </div>
  52. <div class="left-bottom">
  53. <div class="item" style="color: #F75D59;">
  54. 商品主推区利润
  55. <span>{{ sumData.part1 }}</span>
  56. </div>
  57. <div class="item" style="color: #1CB9FA;">
  58. 优选区利润
  59. <span>{{ sumData.part2 }}</span>
  60. </div>
  61. <div class="item" style="color: #49AE4F;">
  62. 福利区利润
  63. <span>{{ sumData.part3 }}</span>
  64. </div>
  65. <div class="item" style="margin-right: 0;color: #2587FB;">
  66. 直播区利润
  67. <span>{{ sumData.part5 }}</span>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="right">
  72. <div class="title">
  73. 公司总营业额/元
  74. <span>{{ sumData.turnover }}</span>
  75. </div>
  76. <div class="list">
  77. <div class="item" v-for="item in monthData" :key="item.id">
  78. <span>{{ item.day }}</span>
  79. {{ item.amount }}
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="bottom">
  85. <div class="echart" id="echart"></div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </template>
  91. <script type="text/ecmascript-6">
  92. import Header from '../components/common/header';
  93. import { staticImg } from '@/config'; // oss 图片地址
  94. export default {
  95. components: {
  96. Header
  97. },
  98. name: 'Index',
  99. data() {
  100. return {
  101. isLoading: 0,
  102. title: {
  103. // 页面标题
  104. firstTitile: '首页'
  105. },
  106. staticImg: staticImg,
  107. sumData: {},
  108. sumData2: {},
  109. monthData: {},
  110. option: {
  111. // echarts配置
  112. title: {
  113. text: '商城微信收入动态',
  114. textStyle: {
  115. fontSize: 18,
  116. fontWeight: '600'
  117. }
  118. },
  119. tooltip: {
  120. trigger: 'item',
  121. backgroundColor: '#FF8703',
  122. fontSize: 14,
  123. formatter: (params) => {
  124. console.log(params.data);
  125. return `<span style="padding: 6px 8px;display: flex;align-items:center">当日微信收入 <span style="font-size: 22px;margin-left: 3px">${params.data}</span></span>`;
  126. }
  127. },
  128. grid: {
  129. left: 60,
  130. right: 35,
  131. bottom: 30
  132. },
  133. xAxis: {
  134. type: 'category',
  135. data: [],
  136. // boundaryGap: false, // 坐标轴两边留白
  137. axisLine: {
  138. lineStyle: {
  139. color: '#916096',
  140. width: 3
  141. }
  142. },
  143. axisTick: {
  144. show: false
  145. },
  146. splitLine: {
  147. show: true,
  148. lineStyle: {
  149. color: 'rgba(0, 0, 0, 0.06)'
  150. },
  151. interval: (index, value) => {
  152. return index !== 0;
  153. }
  154. },
  155. axisLabel: {
  156. // 坐标轴刻度标签的相关设置
  157. fontSize: 15,
  158. color: '#333333',
  159. margin: 15 // 刻度标签与轴线之间的距离
  160. }
  161. },
  162. yAxis: {
  163. type: 'value',
  164. axisLine: {
  165. show: false
  166. },
  167. axisTick: {
  168. show: false
  169. },
  170. splitLine: {
  171. show: true,
  172. lineStyle: {
  173. color: 'rgba(0, 0, 0, 0.06)'
  174. }
  175. },
  176. axisLabel: {
  177. color: '#B494C5',
  178. fontWeight: 600,
  179. fontSize: 14,
  180. // 坐标轴刻度标签的相关设置
  181. margin: 15 // 刻度标签与轴线之间的距离
  182. }
  183. },
  184. series: [
  185. {
  186. data: [],
  187. type: 'line',
  188. symbolSize: 10,
  189. itemStyle: {
  190. normal: {
  191. color: '#704C99',
  192. lineStyle: {
  193. color: '#B494C5'
  194. }
  195. }
  196. }
  197. }
  198. ]
  199. }
  200. };
  201. },
  202. mounted() {
  203. this.getDataSum();
  204. this.getFundPayDaySum();
  205. this.getFundPayMonthSum();
  206. // this.getDataSum2();
  207. this.$nextTick(() => {
  208. this.initEcharts();
  209. });
  210. },
  211. methods: {
  212. initEcharts() {
  213. this.myChart = this.$echarts.init(document.getElementById('echart'));
  214. this.myChart.setOption(this.option);
  215. },
  216. getDataSum() {
  217. this.loading++;
  218. this.httpGet(this.$root.getFundTotalSum, {}).then(
  219. (res) => {
  220. this.loading--;
  221. this.sumData = res;
  222. },
  223. () => {
  224. this.loading--;
  225. }
  226. );
  227. },
  228. getFundPayDaySum(){
  229. this.loading++;
  230. this.httpGet(this.$root.getFundPayDaySum, {
  231. page: 1,
  232. size: 9999
  233. }).then(
  234. (res) => {
  235. this.loading--;
  236. this.option.series[0].data = res.list.map(item => {
  237. return item.amount
  238. });
  239. this.option.xAxis.data = res.list.map(item => {
  240. return item.day
  241. });
  242. this.myChart.setOption(this.option);
  243. },
  244. () => {
  245. this.loading--;
  246. }
  247. );
  248. },
  249. getFundPayMonthSum() {
  250. this.loading++;
  251. this.httpGet(this.$root.getFundPayMonthSum, {
  252. page: 1,
  253. size: 9999
  254. }).then(
  255. (res) => {
  256. this.loading--;
  257. this.monthData = res.list;
  258. },
  259. () => {
  260. this.loading--;
  261. }
  262. );
  263. }
  264. }
  265. };
  266. </script>
  267. <style lang="stylus" rel="stylesheet/stylus" scoped>
  268. @import '~assets/main.styl';
  269. @import '~assets/public.styl';
  270. .container {
  271. padding: 0 !important;
  272. }
  273. .content {
  274. background: #F6F6F6 !important;
  275. padding: 24px !important;
  276. flex-y();
  277. }
  278. .top {
  279. height: 500px;
  280. width: 100%;
  281. flex-x(flex-start, flex-start);
  282. .left {
  283. flex:1;
  284. height: 500px;
  285. // background: #fff;
  286. flex-y(flex-start, flex-start);
  287. box-sizing: border-box;
  288. .left-top{
  289. width: 100%;
  290. background: #fff;
  291. border-radius: 10px;
  292. flex-x(flex-start, center);
  293. flex-wrap: wrap;
  294. height: 330px;
  295. padding: 0 36px;
  296. box-sizing: border-box;
  297. .item{
  298. height: 70px;
  299. width: 320px;
  300. flex-x(flex-start);
  301. img{
  302. width: 60px;
  303. height: 60px;
  304. margin-right: 12px;
  305. }
  306. .num{
  307. flex-y();
  308. word(16px, #999);
  309. span{
  310. word(30px, #333);
  311. margin-bottom: 12px;
  312. }
  313. }
  314. }
  315. }
  316. .left-bottom{
  317. width: 100%;
  318. flex-x(flex-start);
  319. flex: 1;
  320. margin-top: 10px;
  321. .item{
  322. background: #fff;
  323. height: 100%;
  324. border-radius: 10px;
  325. flex: 1;
  326. flex-y(flex-start, flex-start);
  327. margin-right: 10px;
  328. font-size: 20px;
  329. padding-left: 30px;
  330. padding-top: 20px;
  331. box-sizing: border-box;
  332. span{
  333. word(36px, #333);
  334. margin-top: 24px;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. .right{
  341. width: 450px;
  342. height: 500px;
  343. background: #fff;
  344. margin-left: 10px;
  345. border-radius: 10px;
  346. padding: 0 30px;
  347. box-sizing: border-box;
  348. flex-y(flex-start);
  349. .title{
  350. height: 110px;
  351. width: 100%;
  352. word(20px, #FF8703);
  353. flex-y(center, flex-start);
  354. border-bottom: 1px solid #E8E8E8;
  355. span{
  356. word(36px, #333);
  357. margin-top: 10px;
  358. }
  359. }
  360. .list{
  361. padding: 12px 0;
  362. width: 100%;
  363. flex: 1;
  364. overflow: auto;
  365. .item{
  366. height: 46px;
  367. flex-x();
  368. color: #666;
  369. padding-right: 24px;
  370. span{
  371. color: #999;
  372. }
  373. }
  374. }
  375. }
  376. .bottom {
  377. flex: 1;
  378. width: 100%;
  379. margin-top: 10px;
  380. background: #fff;
  381. border-radius: 10px;
  382. padding: 30px;
  383. box-sizing: border-box;
  384. flex-shrink: 0;
  385. .echart {
  386. width: 100%;
  387. height: 100%;
  388. }
  389. }
  390. </style>