billingRules.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view>
  3. <u-navbar title="计费规则" title-color="#101010"></u-navbar>
  4. <view class="background">
  5. <!-- 单位 -->
  6. <view class="unit">
  7. <view class="title">
  8. 所属收款单位
  9. </view>
  10. <view class="value">
  11. {{name}}
  12. </view>
  13. </view>
  14. <!-- 规则 -->
  15. <view class="rules">
  16. <view class="content">
  17. <view class="title">
  18. <view class="title-item">
  19. 用电分类
  20. </view>
  21. <view class="title-item">
  22. 用电时段
  23. </view>
  24. <view class="title-item">
  25. 电度电价
  26. </view>
  27. </view>
  28. <view class="classify" v-for="(item,index) in electricPeriodPriceList" :key="index"
  29. :class="item.timeList.length>1 ? 'classify2' : ''" v-if="item.timeList.length!=0">
  30. <view class="classify-title">
  31. {{item.name}}
  32. </view>
  33. <view class="classify-value">
  34. <p v-for="t in item.timeList">{{t.startTime}}-{{t.endTime}}</p>
  35. </view>
  36. <view class="classify-value">
  37. {{item.price}}元/度
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 备注 -->
  43. <view class="remark" v-if="tenantContract!=null">
  44. <view class="title">
  45. 备注说明:
  46. </view>
  47. <view class="value">
  48. <view class="item">1.计费规则仅展示租赁合同中的计算方式,最终扣费金额以账单中的实际扣费金额为准。
  49. </view>
  50. <view class="item" v-if="startTime!=null && endTime!=null">
  51. 2.本次租约有效期:{{startTime}}-{{endTime}}
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import * as API_electricityMeter from '@/apis/pagejs/electricityMeter.js'
  61. import {
  62. parseUnixTime,
  63. beforeTimeStamp,
  64. getWeek
  65. } from '@/apis/utils'
  66. export default {
  67. data() {
  68. return {
  69. electricPeriodPriceList: [],
  70. queryDate: '',
  71. meterId: '',
  72. name: '',
  73. tenantContract: null,
  74. startTime: null,
  75. endTime: null
  76. }
  77. },
  78. onLoad(op) {
  79. if (op.id) {
  80. this.meterId = op.id;
  81. this.queryDate = op.queryDate;
  82. this.getBillingRules();
  83. }
  84. },
  85. methods: {
  86. getBillingRules() {
  87. uni.showLoading({
  88. title: "加载中",
  89. mask: true,
  90. })
  91. API_electricityMeter.billingRules({
  92. meterId: this.meterId,
  93. queryDate: this.queryDate + '-01'
  94. }).then((res) => {
  95. uni.hideLoading();
  96. this.name = res.data.name;
  97. this.tenantContract = res.data.tenantContract;
  98. if (res.data.tenantContract != null) {
  99. var startTime = res.data.tenantContract.startTime;
  100. var endTime = res.data.tenantContract.endTime;
  101. if (startTime != null) {
  102. this.startTime = startTime.slice(0, 4) + '年' + parseInt(startTime.slice(5, 7)) + '月'
  103. + parseInt(startTime.slice(8)) + '日';
  104. }
  105. if (endTime != null) {
  106. this.endTime = endTime.slice(0, 4) + '年' + parseInt(endTime.slice(5, 7)) + '月'
  107. + parseInt(endTime.slice(8)) + '日';
  108. }
  109. }
  110. var list = res.data.groupPriceList;
  111. var list2 = [];
  112. var list3 = [
  113. {period: '1',name: '尖峰用电',price: 0,timeList:[]},
  114. {period: '2',name: '高峰用电',price: 0,timeList:[]},
  115. {period: '3',name: '平段用电',price: 0,timeList:[]},
  116. {period: '4',name: '谷段用电',price: 0,timeList:[]}
  117. ];
  118. for (var i = 0; i < list.length; i++) {
  119. list2 = [...list2, ...list[i].electricPeriodPriceList];
  120. }
  121. for (var m = 0; m < list2.length; m++) {
  122. for (var n = 0; n < list3.length; n++) {
  123. if(list2[m].period == list3[n].period) {
  124. list3[n].price = list2[m].price;
  125. list3[n].timeList.push({
  126. startTime: list2[m].startTime,
  127. endTime: list2[m].endTime
  128. });
  129. }
  130. }
  131. }
  132. this.electricPeriodPriceList = list3;
  133. // console.log(this.electricPeriodPriceList)
  134. }).catch(error => {
  135. uni.showToast({
  136. title: error,
  137. icon: "none"
  138. })
  139. })
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .background {
  146. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(22, 119, 255, 0) 100%);
  147. height: 720rpx;
  148. padding-top: 24rpx;
  149. .unit {
  150. background-color: #fff;
  151. border-radius: 8px;
  152. padding: 32rpx;
  153. margin: 0 32rpx;
  154. .title {
  155. color: rgba(153, 153, 153, 1);
  156. }
  157. .value {
  158. color: rgba(51, 51, 51, 1);
  159. font-size: 40rpx;
  160. margin-top: 16rpx;
  161. font-weight: bold;
  162. }
  163. }
  164. }
  165. // 规则
  166. .rules {
  167. margin: 24rpx 32rpx 40rpx;
  168. background-color: #fff;
  169. padding-bottom: 24rpx;
  170. border-radius: 8px;
  171. .content {
  172. padding: 24rpx;
  173. .title {
  174. display: flex;
  175. justify-content: space-between;
  176. align-items: center;
  177. line-height: 96rpx;
  178. color: rgba(51, 51, 51, 1);
  179. font-size: 32rpx;
  180. font-weight: bold;
  181. .title-item {
  182. width: 33.3%;
  183. }
  184. }
  185. .classify {
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. height: 96rpx;
  190. .classify-title,
  191. .classify-value {
  192. width: 33.3%;
  193. color: #666666;
  194. }
  195. .classify-title {
  196. color: #333333;
  197. }
  198. }
  199. .classify2 {
  200. height: 200rpx;
  201. }
  202. }
  203. // 备注
  204. .remark {
  205. padding: 40rpx 32rpx;
  206. margin: 0 24rpx;
  207. border-radius: 8px;
  208. background-color: rgba(242, 244, 246, 1);
  209. color: rgba(16, 16, 16, 1);
  210. font-size: 24rpx;
  211. line-height: 34rpx;
  212. .value {
  213. margin-top: 16rpx;
  214. }
  215. .item {
  216. margin-bottom: 8rpx;
  217. }
  218. }
  219. }
  220. </style>