monthlyPush.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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}}<span>元</span>
  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. <template v-if="detail.childKwhMap">
  38. <table class="table1" >
  39. <tr class="tr1">
  40. <td></td>
  41. <td>起止码</td>
  42. <td>度数</td>
  43. </tr>
  44. <tr>
  45. <td class="td1">{{detail.meter.name}}</td>
  46. <td>
  47. {{detail.kwhMap.startMeter}}-{{detail.kwhMap.endMeter}}
  48. </td>
  49. <td class="td3" >{{detail.kwhMap.totalKwh}}度</td>
  50. </tr>
  51. <tr v-for="(item,i) in detail.childKwhMap" :key="i">
  52. <td class="td1">{{i}}</td>
  53. <td>{{item.startMeter}}-{{item.endMeter}}</td>
  54. <td class="td3">{{item.kwh}}度</td>
  55. </tr>
  56. <tr style="font-weight: bold;color:#fff;background-color:#307af6 ;height: 80rpx;" >
  57. <td class="td1" colspan="2">扣除后用电量</td>
  58. <td>{{detail.kwhMap.kwh}}度</td>
  59. </tr>
  60. </table>
  61. </template>
  62. <template v-else>
  63. <view class="item">
  64. <view class="item-title">
  65. 用电量
  66. </view>
  67. <view class="item-value">
  68. {{detail.kwhMap.kwh}}度
  69. </view>
  70. </view>
  71. <view class="item" v-if="detail.tenantSharedKwh">
  72. <view class="item-title">
  73. 分摊用电
  74. </view>
  75. <view class="item-value">
  76. {{detail.tenantSharedKwh}}度
  77. </view>
  78. </view>
  79. <view class="item">
  80. <view class="item-title">
  81. 起止码
  82. </view>
  83. <view class="item-value">
  84. {{detail.kwhMap.startMeter}}-{{detail.kwhMap.endMeter}}
  85. </view>
  86. </view>
  87. </template>
  88. <view class="item">
  89. <view class="item-title">
  90. 可用余额
  91. </view>
  92. <view class="item-value">
  93. {{detail.balance}}元
  94. </view>
  95. </view>
  96. <view class="item">
  97. <view class="item-title">
  98. 统计截止日期
  99. </view>
  100. <view class="item-value">
  101. {{detail.endTime}}
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <!-- 返回 -->
  107. <!-- <button class="back">返回</button> -->
  108. <view class="recharge-details2">
  109. <view class="details">
  110. <view class="title">
  111. {{thisparseUnixTime(queryYearMonth)}}用电量趋势
  112. </view>
  113. <view id="pieEcharts">
  114. </view>
  115. </view>
  116. </view>
  117. <u-divider nonetext="没有找到相关内容" style="margin-top: 20rpx;"
  118. border-color="#CFD2D5">已经到底了</u-divider>
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. import * as API from '@/apis/pagejs/deduction.js'
  124. import {
  125. parseUnixTime,newDate
  126. } from '@/apis/utils'
  127. import * as echarts from "echarts";
  128. export default {
  129. data() {
  130. return {
  131. isBack: false,
  132. id: "",
  133. queryYearMonth: "",
  134. detail: {
  135. tenantInfo: {},
  136. tenantContract: {},
  137. kwhMap: {},
  138. endTime: {},
  139. balance: {},
  140. childKwhMap:null,
  141. meter:{},
  142. },
  143. myChart: null,
  144. }
  145. },
  146. onLoad(op) {
  147. if (op.site) {
  148. this.isBack = true
  149. }
  150. if (op.id) {
  151. this.id = op.id
  152. this.queryYearMonth = op.m
  153. this.getDetail()
  154. }
  155. },
  156. methods: {
  157. thisparseUnixTime(time) {
  158. if (!time) {
  159. return ''
  160. }
  161. return parseUnixTime(newDate(time), '{y}年{m}月')
  162. },
  163. getDetail() {
  164. uni.showLoading({
  165. mask: true,
  166. title: '加载中...'
  167. })
  168. API.monthlyElectricity({
  169. contractId: this.id,
  170. queryYearMonth: this.queryYearMonth
  171. }).then((response) => {
  172. uni.hideLoading();
  173. this.detail = response.data;
  174. if(JSON.stringify(this.detail.childKwhMap)=="{}"){
  175. this.detail.childKwhMap=null
  176. }
  177. this.getPle(this.detail.graphMap)
  178. //this.transferAccountsInfo=this.detail.accountInfo;
  179. }).catch(error => {
  180. uni.hideLoading();
  181. uni.showToast({
  182. title: error
  183. })
  184. })
  185. },
  186. getPle(list) {
  187. if (!this.myChart) {
  188. this.myChart = echarts.init(document.getElementById('pieEcharts'), null, {
  189. width: uni.upx2px(650),
  190. height: uni.upx2px(420)
  191. });
  192. }
  193. var data1 = [];
  194. var data2 = [];
  195. this.myChart.clear();
  196. for (var i in list) {
  197. data1.push(i)
  198. data2.push(list[i].kwh)
  199. }
  200. var headitemby = ""
  201. var showkey = "";
  202. var option = {
  203. tooltip: {
  204. trigger: 'axis',
  205. formatter: (value) => {
  206. var time=this.thisparseUnixTime(this.queryYearMonth);
  207. var name = value[0].name;
  208. var obj = list[name]
  209. var text = `<p>${time}${name}日</p>`
  210. if (obj.kwh != undefined) {
  211. text += `<p>电量:${obj.kwh}度</p>`
  212. }
  213. if (obj.fee != undefined) {
  214. text += ` <p>电费:${obj.fee}元</p>`
  215. }
  216. return text
  217. }
  218. },
  219. grid: {
  220. top: 40,
  221. left: 5,
  222. right: 5,
  223. bottom: 20,
  224. containLabel: true
  225. },
  226. xAxis: {
  227. type: 'category',
  228. data: data1,
  229. axisLabel: {
  230. textStyle: {
  231. color: "#333"
  232. }
  233. },
  234. },
  235. yAxis: {
  236. type: 'value',
  237. name: '电量',
  238. },
  239. series: [{
  240. name: '电量',
  241. data: data2,
  242. type: 'line'
  243. }]
  244. }
  245. console.log(option)
  246. this.myChart.setOption(option);
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="scss" scoped>
  252. .table1{
  253. padding-bottom: 20rpx;
  254. width: 100%;
  255. border-collapse: collapse;
  256. td{
  257. border: 1px solid #e7e7e7;
  258. text-align: end;
  259. padding: 16rpx 16rpx;
  260. }
  261. .td1{
  262. text-align: start;
  263. min-width: 20%;
  264. max-width: 30%;
  265. }
  266. .td3{
  267. white-space: pre;
  268. }
  269. tr{
  270. background-color:#f5f5f6
  271. }
  272. .tr1{
  273. text-align: end;
  274. font-weight: bold;
  275. }
  276. tr:nth-child(even) {
  277. background-color: #fff;
  278. }
  279. }
  280. .background {
  281. padding: 24rpx 24rpx;
  282. height: 400rpx;
  283. background: linear-gradient(180deg, rgba(203, 234, 255, 1) 0%, rgba(203, 234, 255, 0) 100%);
  284. .recharge-details1 {
  285. padding: 40rpx 32rpx;
  286. border-radius: 8px 8px 0 0;
  287. }
  288. .recharge-details2 {
  289. border-radius: 0 0 8px 8px;
  290. padding: 5rpx 20rpx 40rpx 20rpx;
  291. .details {
  292. border-radius: 8px ;
  293. background: linear-gradient(180deg, rgba(208,236,255,1) 0%,rgba(208,236,236,0) 100%);
  294. }
  295. #pieEcharts{
  296. text-align: start;
  297. }
  298. }
  299. .recharge-details1,
  300. .recharge-details2 {
  301. background-color: #fff;
  302. text-align: center;
  303. .headline {
  304. color: rgb(16, 16, 16);
  305. font-size: 36rpx;
  306. }
  307. .sum {
  308. color: rgb(16, 16, 16);
  309. font-size: 48rpx;
  310. margin-top: 32rpx;
  311. span{
  312. font-size: 28rpx;
  313. }
  314. }
  315. .details {
  316. margin-top: 40rpx;
  317. padding-top: 40rpx;
  318. border-top: 1px solid rgba(241, 241, 241, 1);
  319. .item {
  320. display: flex;
  321. align-items: center;
  322. justify-content: space-between;
  323. margin-bottom: 16rpx;
  324. .item-title {
  325. color: rgb(119, 119, 119);
  326. white-space: pre;
  327. }
  328. .item-value {
  329. color: rgb(48, 48, 48);
  330. }
  331. }
  332. .chart-box {
  333. background-color: rgba(208, 236, 255, 1);
  334. border-radius: 8px;
  335. .title {
  336. text-align: left;
  337. padding: 24rpx 28rpx;
  338. color: rgba(16, 16, 16, 1);
  339. }
  340. }
  341. .img {
  342. width: 622rpx;
  343. height: 304rpx;
  344. }
  345. }
  346. }
  347. }
  348. // 返回
  349. .back {
  350. border: 1px solid rgba(205, 205, 205, 1);
  351. line-height: 88rpx;
  352. border-radius: 8px;
  353. background-color: rgba(255, 255, 255, 1);
  354. color: rgba(119, 119, 119, 1);
  355. font-size: 32rpx;
  356. margin-top: 24rpx;
  357. }
  358. </style>