supermarketPortrait.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <script>
  2. import CoreData from "@/components/common/coreData.vue";
  3. import SupermarketTrendChart from "@/components/dashboard/portrait/supermarket/supermarketTrendChart.vue"
  4. import api from "@/api/dashboard/apiDashboard";
  5. export default {
  6. data() {
  7. let range = this.$util.dateUtil.getNearlyMonthRange();
  8. return {
  9. queryData: {
  10. companyId: '0',
  11. deptId: '0',
  12. timeRange: range
  13. },
  14. coreData: [
  15. {
  16. type: 0,
  17. title: '商超消费金额(元)',
  18. num: 0,
  19. historyDesc: '同比',
  20. historyNum: '0'
  21. },
  22. {
  23. type: 0,
  24. title: '商超消费订单(单)',
  25. num: 0,
  26. historyDesc: '同比',
  27. historyNum: '0'
  28. },
  29. {
  30. type: 0,
  31. title: '商超平均单价(元/单)',
  32. num: 0,
  33. historyDesc: '同比',
  34. historyNum: '0'
  35. },
  36. {
  37. type: 1,
  38. title: '第三方结算方式 费用(元)',
  39. content: '0'
  40. },
  41. {
  42. type: 1,
  43. title: '值得关注',
  44. showStar: true,
  45. content: ''
  46. },
  47. ]
  48. }
  49. },
  50. props: {
  51. chartHeight: Number
  52. },
  53. components: {
  54. CoreData,
  55. SupermarketTrendChart
  56. },
  57. mounted() {
  58. this.init();
  59. },
  60. methods: {
  61. init() {
  62. this.getCoreData(this.queryData)
  63. },
  64. getCoreData() {
  65. api.getSuperMarketCoreData(this.queryData).then(res=>{
  66. this.coreData[0].num = res.list[0].value
  67. this.coreData[0].historyNum = res.list[0].compare
  68. this.coreData[1].num = res.list[1].value
  69. this.coreData[1].historyNum = res.list[1].compare
  70. this.coreData[2].num = res.list[2].value
  71. this.coreData[2].historyNum = res.list[2].compare
  72. this.coreData[3].content = res.list[3].value
  73. this.coreData[4].content = res.worthAttention
  74. })
  75. },
  76. }
  77. }
  78. </script>
  79. <template>
  80. <div class="supermarketPortrait">
  81. <div class="portrait-coreData">
  82. <CoreData :data-list="coreData"></CoreData>
  83. </div>
  84. <div style="padding: 15px">
  85. <SupermarketTrendChart :height="chartHeight" :query-data="queryData"></SupermarketTrendChart>
  86. </div>
  87. </div>
  88. </template>
  89. <style lang="less" scoped>
  90. .supermarketPortrait {
  91. }
  92. </style>