show.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="container">
  3. <view class="show-item">
  4. <view class="show-elec-label">
  5. <view class="show-item-logol">
  6. <image class="show-item-logo-left" src="/static/image/show.png"></image>
  7. </view>
  8. <view class="show-item-label">能耗走势图</view>
  9. </view>
  10. <view class="charts-box">
  11. <qiun-data-charts type="demotype" :chartData="chartData" />
  12. </view>
  13. <view class="select-show">
  14. <button class="first-button">月</button>
  15. </view>
  16. </view>
  17. <view class="show-item-date">
  18. <view class="show-elec-label">
  19. <view class="show-item-logol">
  20. <image class="show-item-logo-left" src="/static/image/record.png"></image>
  21. </view>
  22. <view class="show-item-label show-label">缴费记录</view>
  23. </view>
  24. <view class="select-date">
  25. <picker mode="date" fields="month" :start="startDate" :end="endDate" @change="bindDateChange">
  26. <view class="uni-input">
  27. <text class="uni-input-label">{{date}}</text>
  28. <text class="iconfont icon-arrow-down"></text>
  29. </view>
  30. </picker>
  31. <view class="uni-list">
  32. <view class="item-list" v-for="(item, i) in list" :key="i">
  33. <view class="item-list-left">
  34. <text class="item-list-txt">{{item.name}}</text>
  35. <text class="item-list-txt">{{item.tdate}} {{item.time}}</text>
  36. </view>
  37. <text class="item-list-txt show-money">{{item.money}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. // import data from '../../static/test_xiaofei.js'
  46. export default {
  47. data() {
  48. return {
  49. chartData: {
  50. categories: [],
  51. series: [{
  52. data: [],
  53. }],
  54. },
  55. date: this.$getDate({
  56. format: true
  57. }),
  58. startDate: this.$getDate('start_date'),
  59. endDate: this.$getDate('end_date'),
  60. all_data: '', //所有数据
  61. list: [], //消费列表
  62. card_number: 0, //用户卡号
  63. }
  64. },
  65. onLoad(options) {
  66. // console.log(this.chartData.series[0].data)
  67. // this.list = this.all_data.data[0].xiaofei;
  68. // this.name = this.all_data.data[0].xiaofei.name;
  69. // console.log(this.date)
  70. this.card_number = options.card_number
  71. // console.log(this.card_number)
  72. this.get_data()
  73. },
  74. methods: {
  75. bindDateChange: function(e) {
  76. this.date = e.detail.value
  77. },
  78. async get_data() {
  79. //http://ecu9ys.natappfree.cc/HotWaters/buildgetMonthBill.action
  80. const res = await this.$myRequest({
  81. host: 'ceshi',
  82. url: 'http://ecu9ys.natappfree.cc/HotWaters/buildgetMonthBill.action',
  83. method: 'POST',
  84. header: {
  85. 'content-type': 'application/x-www-form-urlencoded'
  86. },
  87. data: {
  88. 'roomSelect': this.$store.state.building.roomSelect
  89. // 'roomSelect': '墨轩湖校区1101'
  90. }
  91. })
  92. // console.log(res.data);
  93. let tmparr_date_time = []
  94. let tmparr_use_elec = []
  95. for (var i = 0; i < res.data.date_time.length; i++) {
  96. tmparr_date_time.push(res.data.date_time[i])
  97. }
  98. for (var i = 0; i < res.data.use_elc.length; i++) {
  99. tmparr_use_elec.push(res.data.use_elc[i])
  100. }
  101. setTimeout(() => {
  102. this.chartData.categories = tmparr_date_time;
  103. this.chartData.series[0].data = tmparr_use_elec;
  104. }, 300)
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. @import url("show.css");
  111. </style>