show.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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-sanjiaoxing"></text>
  29. </view>
  30. </picker>
  31. <!-- <picker mode="date" fields="month" :start="startDate" :end="endDate" @change="bindDateChange">
  32. <view class="uni-input">
  33. <text class="uni-input-label">{{date}}</text>月
  34. <text class="iconfont icon-sanjiaoxing"></text>
  35. </view>
  36. </picker> -->
  37. <view class="uni-list">
  38. <view class="item-list" v-for="(item, i) in list" :key="i">
  39. <view class="item-list-left">
  40. <text class="item-list-txt">{{item.name}}</text>
  41. <text class="item-list-txt">{{item.tdate}} {{item.time}}</text>
  42. </view>
  43. <text class="item-list-txt show-money">{{item.money}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import data from '../../static/test_xiaofei.js'
  52. export default {
  53. data() {
  54. return {
  55. date_time: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
  56. use_elec: [5, 19, 16, 24, 38, 22, 15, 16, 14, 17, 22, 20],
  57. chartData: {
  58. categories: [],
  59. series: [{
  60. data: [],
  61. }],
  62. },
  63. date: getDate({
  64. // format: true
  65. }),
  66. // startDate: getDate('start_date'),
  67. // endDate: getDate('end_date'),
  68. all_data: data, //所有数据
  69. list: [] ,//消费列表
  70. card_number: 0, //用户卡号
  71. }
  72. },
  73. onLoad(options){
  74. this.chartData.categories = this.date_time;
  75. this.chartData.series[0].data = this.use_elec;
  76. // console.log(this.chartData.series[0].data)
  77. this.list = this.all_data.data[0].xiaofei;
  78. // this.name = this.all_data.data[0].xiaofei.name;
  79. // console.log(this.date)
  80. this.card_number = options.card_number
  81. // console.log(this.card_number)
  82. },
  83. methods: {
  84. bindDateChange: function(e) {
  85. this.date = e.detail.value
  86. // console.log(this.date)
  87. },
  88. },
  89. }
  90. function getDate(type) {
  91. const date = new Date();
  92. let year = date.getFullYear();
  93. let month = date.getMonth() + 1;
  94. // let day = date.getDate();
  95. // if (type === 'start_date') {
  96. // year = year - 4;
  97. // } else if (type === 'end_date') {
  98. // year = year;
  99. // }
  100. month = month > 9 ? month : '0' + month;
  101. // day = day > 9 ? day : '0' + day;
  102. return `${year}-${month}`;
  103. }
  104. </script>
  105. <style>
  106. @import url("show.css");
  107. </style>