restaurantPortrait.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <script>
  2. import api from '@/api/dashboard/apiDashboard'
  3. import CoreData from "@/components/common/coreData.vue";
  4. import RestaurantTrendChart from "@/components/dashboard/portrait/restaurant/restaurantTrendChart.vue";
  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. showStar: true,
  44. title: '值得关注',
  45. content: ''
  46. },
  47. ]
  48. }
  49. },
  50. props: {
  51. chartHeight: Number
  52. },
  53. components: {
  54. CoreData,
  55. RestaurantTrendChart,
  56. },
  57. mounted() {
  58. this.init();
  59. },
  60. methods: {
  61. init() {
  62. this.getCoreData()
  63. //this.getTrendData()
  64. },
  65. getCoreData() {
  66. api.getRestCoreData(this.queryData).then(res=>{
  67. this.coreData[0].num = res.list[0].value
  68. this.coreData[0].historyNum = res.list[0].compare
  69. this.coreData[1].num = res.list[1].value
  70. this.coreData[1].historyNum = res.list[1].compare
  71. this.coreData[2].num = res.list[2].value
  72. this.coreData[2].historyNum = res.list[2].compare
  73. this.coreData[3].content = res.list[3].value
  74. this.coreData[4].content = res.worthAttention
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <template>
  81. <div class="restaurantPortrait">
  82. <div class="portrait-coreData">
  83. <CoreData :data-list="coreData"></CoreData>
  84. </div>
  85. <div style="padding: 15px">
  86. <RestaurantTrendChart :query-data="queryData" :height="chartHeight"></RestaurantTrendChart>
  87. </div>
  88. </div>
  89. </template>
  90. <style lang="less" scoped>
  91. .restaurantPortrait {
  92. }
  93. </style>