monthlyPush.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view>
  3. <u-navbar title="电费月度账单" :isBack="isBack" title-color="#101010"></u-navbar>
  4. <view class="background">
  5. <view class="recharge-details1">
  6. <view class="headline">
  7. {{thisparseUnixTime(queryYearMonth)}}电费月度账单
  8. </view>
  9. <view class="sum">
  10. {{detail.kwhMap.fee}}元
  11. </view>
  12. <view class="details">
  13. <view class="item">
  14. <view class="item-title">
  15. 业主方
  16. </view>
  17. <view class="item-value">
  18. {{detail.tenantInfo.name}}
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="item-title">
  23. 地址
  24. </view>
  25. <view class="item-value">
  26. {{detail.tenantContract.address}}
  27. </view>
  28. </view>
  29. <!-- <view class="item">
  30. <view class="item-title">
  31. 收费标准
  32. </view>
  33. <view class="item-value">
  34. {{detail.kwhMap.kwh}}元/度
  35. </view>
  36. </view> -->
  37. <view class="item">
  38. <view class="item-title">
  39. 度数
  40. </view>
  41. <view class="item-value">
  42. {{detail.kwhMap.kwh}}度
  43. </view>
  44. </view>
  45. <view class="item">
  46. <view class="item-title">
  47. 起止码
  48. </view>
  49. <view class="item-value">
  50. {{detail.kwhMap.startMeter}}-{{detail.kwhMap.endMeter}}
  51. </view>
  52. </view>
  53. <view class="item">
  54. <view class="item-title">
  55. 可用余额
  56. </view>
  57. <view class="item-value">
  58. {{detail.balance}}元
  59. </view>
  60. </view>
  61. <view class="item">
  62. <view class="item-title">
  63. 统计截止日期
  64. </view>
  65. <view class="item-value">
  66. {{detail.endTime}}
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 返回 -->
  72. <!-- <button class="back">返回</button> -->
  73. <view class="recharge-details2">
  74. <view class="details">
  75. <view class="title">
  76. {{thisparseUnixTime(queryYearMonth)}}用电量趋势
  77. </view>
  78. <view id="pieEcharts">
  79. </view>
  80. </view>
  81. </view>
  82. <u-divider nonetext="没有找到相关内容" style="margin-top: 20rpx;"
  83. border-color="#CFD2D5">已经到底了</u-divider>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import * as API from '@/apis/pagejs/deduction.js'
  89. import {
  90. parseUnixTime
  91. } from '@/apis/utils'
  92. import * as echarts from "echarts";
  93. export default {
  94. data() {
  95. return {
  96. isBack: false,
  97. id: "",
  98. queryYearMonth: "",
  99. detail: {
  100. tenantInfo: {},
  101. tenantContract: {},
  102. kwhMap: {},
  103. endTime: {},
  104. balance: {},
  105. },
  106. myChart: null,
  107. }
  108. },
  109. onLoad(op) {
  110. if (op.site) {
  111. this.isBack = true
  112. }
  113. if (op.id) {
  114. this.id = op.id
  115. this.queryYearMonth = op.m
  116. this.getDetail()
  117. }
  118. },
  119. methods: {
  120. thisparseUnixTime(time) {
  121. if (!time) {
  122. return ''
  123. }
  124. return parseUnixTime(new Date(time), '{y}年{m}月')
  125. },
  126. getDetail() {
  127. uni.showLoading({
  128. mask: true,
  129. title: '加载中...'
  130. })
  131. API.monthlyElectricity({
  132. contractId: this.id,
  133. queryYearMonth: this.queryYearMonth
  134. }).then((response) => {
  135. uni.hideLoading();
  136. this.detail = response.data;
  137. this.getPle(this.detail.graphMap)
  138. //this.transferAccountsInfo=this.detail.accountInfo;
  139. }).catch(error => {
  140. uni.hideLoading();
  141. uni.showToast({
  142. title: error
  143. })
  144. })
  145. },
  146. getPle(list) {
  147. if (!this.myChart) {
  148. this.myChart = echarts.init(document.getElementById('pieEcharts'), null, {
  149. width: uni.upx2px(650),
  150. height: uni.upx2px(420)
  151. });
  152. }
  153. var data1 = [];
  154. var data2 = [];
  155. this.myChart.clear();
  156. for (var i in list) {
  157. data1.push(i)
  158. data2.push(list[i].kwh)
  159. }
  160. var headitemby = ""
  161. var showkey = "";
  162. var option = {
  163. tooltip: {
  164. trigger: 'axis',
  165. formatter: (value) => {
  166. var time=this.thisparseUnixTime(this.queryYearMonth);
  167. var name = value[0].name;
  168. var obj = list[name]
  169. var text = `<p>${time}${name}日</p>`
  170. if (obj.kwh != undefined) {
  171. text += `<p>电量:${obj.kwh}度</p>`
  172. }
  173. if (obj.fee != undefined) {
  174. text += ` <p>电费:${obj.fee}元</p>`
  175. }
  176. return text
  177. }
  178. },
  179. grid: {
  180. top: 20,
  181. left: 5,
  182. right: 5,
  183. bottom: 20,
  184. containLabel: true
  185. },
  186. xAxis: {
  187. type: 'category',
  188. data: data1,
  189. axisLabel: {
  190. textStyle: {
  191. color: "#333"
  192. }
  193. },
  194. },
  195. yAxis: {
  196. type: 'value'
  197. },
  198. series: [{
  199. name: '电量',
  200. data: data2,
  201. type: 'line'
  202. }]
  203. }
  204. console.log(option)
  205. this.myChart.setOption(option);
  206. },
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. .background {
  212. padding: 24rpx 24rpx;
  213. height: 400rpx;
  214. background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(203, 234, 255, 0) 100%);
  215. .recharge-details1 {
  216. padding: 40rpx 32rpx;
  217. border-radius: 8px 8px 0 0;
  218. }
  219. .recharge-details2 {
  220. border-radius: 0 0 8px 8px;
  221. padding: 5rpx 20rpx 40rpx 20rpx;
  222. .details {
  223. border-radius: 8px ;
  224. background: linear-gradient(180deg, rgba(208,236,255,1) 0%,rgba(208,236,236,0) 100%);
  225. }
  226. #pieEcharts{
  227. text-align: start;
  228. }
  229. }
  230. .recharge-details1,
  231. .recharge-details2 {
  232. background-color: #fff;
  233. text-align: center;
  234. .headline {
  235. color: rgb(16, 16, 16);
  236. font-size: 36rpx;
  237. }
  238. .sum {
  239. color: rgb(16, 16, 16);
  240. font-size: 48rpx;
  241. margin-top: 32rpx;
  242. }
  243. .details {
  244. margin-top: 40rpx;
  245. padding-top: 40rpx;
  246. border-top: 1px solid rgba(241, 241, 241, 1);
  247. .item {
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-between;
  251. margin-bottom: 16rpx;
  252. .item-title {
  253. color: rgb(119, 119, 119);
  254. white-space: pre;
  255. }
  256. .item-value {
  257. color: rgb(48, 48, 48);
  258. }
  259. }
  260. .chart-box {
  261. background-color: rgba(208, 236, 255, 1);
  262. border-radius: 8px;
  263. .title {
  264. text-align: left;
  265. padding: 24rpx 28rpx;
  266. color: rgba(16, 16, 16, 1);
  267. }
  268. }
  269. .img {
  270. width: 622rpx;
  271. height: 304rpx;
  272. }
  273. }
  274. }
  275. }
  276. // 返回
  277. .back {
  278. border: 1px solid rgba(205, 205, 205, 1);
  279. line-height: 88rpx;
  280. border-radius: 8px;
  281. background-color: rgba(255, 255, 255, 1);
  282. color: rgba(119, 119, 119, 1);
  283. font-size: 32rpx;
  284. margin-top: 24rpx;
  285. }
  286. </style>