index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <view>
  3. <u-navbar title="微营业厅" title-color="#fff" :is-back="false" :background="background" back-icon-color="#ffffff"></u-navbar>
  4. <!-- 账户充值 扣费记录 -->
  5. <view class="function2">
  6. <view class="companyName">
  7. <image class="img"
  8. src="@/assets/img/companyName.png" mode=""></image>
  9. <span :class="electricity.id?'fullName1':'fullName2'">
  10. {{personInfo.name}} </span>
  11. </view>
  12. <view class="titleElectricity">
  13. <template v-if="electricity.id">
  14. <span class="spanradius" :class="{
  15. normal:electricity.online
  16. }" ></span>
  17. {{electricity.online?'电表在线':'电表离线'}}
  18. </template>
  19. <template v-if="electricityWater.id">
  20. <span class="spanradius" :style="electricity.id?'margin-left: 20px;':''" :class="{
  21. normal:electricityWater.online||electricityWater.transportType==2
  22. }" ></span>
  23. {{electricityWater.online||electricityWater.transportType==2?'水表在线':'水表离线'}}
  24. </template>
  25. </view>
  26. </view>
  27. <view class="function">
  28. <view class="item" @click="gotoUrl('/pages/recharge/accountRecharge')">
  29. <view class="icon">
  30. <image class="img" src="@/assets/img/iconPark-wallet.svg" mode=""></image>
  31. </view>
  32. <view class="text">
  33. <view class="title">
  34. 账户充值
  35. </view>
  36. <view class="infos">
  37. 余额 {{personInfo.balance}}元
  38. </view>
  39. </view>
  40. </view>
  41. <view class="item" @click="gotoUrl('/pages/deductionRecord/deductionRecord')">
  42. <view class="icon icon2">
  43. <image class="img" src="@/assets/img/iconPark-order.svg" mode=""></image>
  44. </view>
  45. <view class="text">
  46. <view class="title">
  47. 扣费记录
  48. </view>
  49. <view class="infos">
  50. 查看每日用电情况
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 管家服务 -->
  56. <view class="housekeeper-service">
  57. <view class="title">
  58. 管家服务
  59. </view>
  60. <view class="grid">
  61. <u-grid :col="4" :border="false">
  62. <u-grid-item @click="gotoUrl('/pages/meterManagement/meterManagement')" >
  63. <view class="icon icon10">
  64. <image class="img" src="@/assets/img/fas fa-plus-circle.svg" mode=""></image>
  65. </view>
  66. <view class="grid-text">电表管理
  67. </view>
  68. </u-grid-item>
  69. <u-grid-item @click="gotoUrl('/pages/recharge/rechargeRecord')" >
  70. <view class="icon icon1">
  71. <image class="img" src="@/assets/img/far fa-clock.svg" mode=""></image>
  72. </view>
  73. <view class="grid-text">充值记录
  74. </view>
  75. </u-grid-item>
  76. <u-grid-item @click="gotoUrl('/pages/billingRules/billingRules')" >
  77. <view class="icon icon2">
  78. <image class="img" src="@/assets/img/fas fa-file-alt.svg" mode=""></image>
  79. </view>
  80. <view class="grid-text">计费规则
  81. </view>
  82. </u-grid-item>
  83. <u-grid-item @click="gotoUrl('/pages/message/messageList?type=AA&typeName=账单提醒')">
  84. <view class="icon icon3">
  85. <image class="img" src="@/assets/img/antFill-account-book.svg" mode=""></image>
  86. <view class="dot" v-if="headlineBill.unReadtNum" >
  87. </view>
  88. </view>
  89. <view class="grid-text">账单提醒
  90. </view>
  91. </u-grid-item>
  92. <u-grid-item v-if="false" @click="gotoUrl('/pages/message/messageList?type=3&typeName=断电提醒')">
  93. <view class="icon icon9">
  94. <image class="img" src="@/assets/img/fas fa-exclamation-triangle.svg" mode=""></image>
  95. <view class="dot" v-if="unReadtNum(3)" >
  96. </view>
  97. </view>
  98. <view class="grid-text">断电提醒
  99. </view>
  100. </u-grid-item>
  101. <u-grid-item v-if="(electricity.id&&electricity.type!=6)"
  102. @click="gotoUrl('/pages/remoteControl/switchDetail?id='+electricity.id)">
  103. <view class="icon icon11">
  104. <image class="img" src="@/assets/img/antFill-control.svg" mode=""></image>
  105. </view>
  106. <view class="grid-text">智能监控
  107. </view>
  108. </u-grid-item>
  109. <u-grid-item v-else
  110. @click="gotoUrl('/pages/message/messageList?type=5&typeName=停电通知')">
  111. <view class="icon icon5">
  112. <image class="img" src="@/assets/img/antFill-notification.svg" mode=""></image>
  113. <view class="dot" v-if="unReadtNum(5)" >
  114. </view>
  115. </view>
  116. <view class="grid-text">停电通知
  117. </view>
  118. </u-grid-item>
  119. <u-grid-item @click="gotoUrl('/pages/message/messageList?type=4&typeName=故障警报')">
  120. <view class="icon icon6">
  121. <image class="img" src="@/assets/img/fas fa-exclamation-triangle.svg" mode=""></image>
  122. <view class="dot" v-if="unReadtNum(4)" >
  123. </view>
  124. </view>
  125. <view class="grid-text">故障警报
  126. </view>
  127. </u-grid-item>
  128. <u-grid-item @click="gotoUrl('/pages/mine/electronicMonitoring?id='+electricity.id+'&waterId='+electricityWater.id)">
  129. <view class="icon icon7">
  130. <image class="img" src="@/assets/img/fas fa-chart-pie.svg" mode=""></image>
  131. </view>
  132. <view class="grid-text">能源监控
  133. </view>
  134. </u-grid-item>
  135. <u-grid-item v-if="false" @click="gotoUrl('/pages/mine/contactService')" >
  136. <view class="icon icon4">
  137. <image class="img" src="@/assets/img/if-support.svg" mode=""></image>
  138. </view>
  139. <view class="grid-text">客服热线
  140. </view>
  141. </u-grid-item>
  142. <u-grid-item v-if="false" @click="gotoUrl('/pages/billingRules/billingRules')">
  143. <view class="icon icon8">
  144. <image class="img" src="@/assets/img/fas fa-book.svg" mode=""></image>
  145. </view>
  146. <view class="grid-text">用电常识
  147. </view>
  148. </u-grid-item>
  149. <u-grid-item @click="gotoUrl('/pages/message/knowledgeList')">
  150. <view class="icon icon4">
  151. <image class="img" src="@/assets/img/if-book-alt.svg" mode=""></image>
  152. </view>
  153. <view class="grid-text">用电知识
  154. </view>
  155. </u-grid-item>
  156. </u-grid>
  157. </view>
  158. </view>
  159. <view class="cover">
  160. <view class="text">
  161. 预存余额 安心用电
  162. </view>
  163. </view>
  164. <u-modal v-model="openModalBl" @confirm="confirmPhone" confirm-text="拨打电话" confirm-color="#606266"
  165. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="客服电话" content="400-8899-619"
  166. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  167. <u-divider border-color="#bbbbbb" half-width="80" style="margin-bottom: 60rpx;"
  168. @click="openModalBl=true"
  169. color="#777777">e家能源 服务热线 <text
  170. class="tel">400-8899-619</text></u-divider>
  171. <Tabbar :current="0" ref="tabbarMain" :prefetchNum="prefetchNum" ></Tabbar>
  172. </view>
  173. </template>
  174. <script>
  175. import * as API from '@/apis/pagejs/index.js'
  176. import * as API_message from '@/apis/pagejs/message.js'
  177. import * as API_Electricity from '@/apis/pagejs/tenantElectricityMeter.js'
  178. import * as API_water from '@/apis/pagejs/water.js'
  179. import Tabbar from '@/components/Tabbar.vue'
  180. export default {
  181. components: {
  182. Tabbar
  183. },
  184. data() {
  185. return {
  186. openModalBl:false,
  187. personInfo:{},
  188. background: {
  189. backgroundColor: '#3D86FF',
  190. },
  191. prefetchNum:0,
  192. headlineBill:{},
  193. messageList:[],
  194. electricity:{
  195. },
  196. electricityWater:{
  197. }
  198. }
  199. },
  200. onLoad() {
  201. },
  202. onShow(){
  203. this.homePage()
  204. this.prefetch()
  205. this.getElectricityMeterList()
  206. this.getWaterMeterList()
  207. },
  208. methods: {
  209. getElectricityMeterList(){
  210. API_Electricity.electricityMeterList().then((response) => {
  211. var electricityMeterList=response.data.meterList
  212. if(electricityMeterList.length){
  213. for(var i in electricityMeterList){
  214. var obj=electricityMeterList[i];
  215. if(i==0){
  216. this.electricity=electricityMeterList[i]
  217. }
  218. if(this.electricity.type==6){
  219. this.electricity=electricityMeterList[i]
  220. }
  221. if(!electricityMeterList[i].online){
  222. this.electricity=electricityMeterList[i]
  223. }
  224. }
  225. }
  226. }).catch(error => {
  227. uni.showToast({
  228. title: error,
  229. icon: "none"
  230. })
  231. })
  232. },
  233. getWaterMeterList(){
  234. API_water.waterMeterList().then((response) => {
  235. var electricityMeterList=response.data.meterList
  236. if(electricityMeterList.length){
  237. for(var i in electricityMeterList){
  238. var obj=electricityMeterList[i];
  239. if(i==0){
  240. this.electricityWater=electricityMeterList[i]
  241. }
  242. if(this.electricityWater.type==6){
  243. this.electricityWater=electricityMeterList[i]
  244. }
  245. if(!electricityMeterList[i].online){
  246. this.electricityWater=electricityMeterList[i]
  247. }
  248. }
  249. }
  250. }).catch(error => {
  251. uni.showToast({
  252. title: error,
  253. icon: "none"
  254. })
  255. })
  256. },
  257. unReadtNum(num){
  258. for(var i in this.messageList){
  259. var item=this.messageList[i];
  260. if(item.typeId==num){
  261. return item.unReadtNum
  262. }
  263. }
  264. return 0
  265. },
  266. prefetch(){
  267. API_message.prefetch({
  268. }).then((response) => {
  269. this.prefetchNum=response.data
  270. this.getBillList()
  271. this.getMessageTypeList()
  272. }).catch(error => {
  273. //uni.hideLoading();
  274. uni.hideLoading();
  275. uni.showToast({
  276. icon: "none",
  277. title: error
  278. })
  279. })
  280. },
  281. getMessageTypeList(){
  282. API_message.messageTypeList().then((response) => {
  283. this.messageList=response.data.typeList;
  284. }).catch(error => {
  285. uni.hideLoading();
  286. uni.showToast({
  287. icon: "none",
  288. title: error
  289. })
  290. })
  291. },
  292. getBillList(){
  293. API_message.headlineBill().then((response) => {
  294. this.headlineBill=response.data;
  295. var num=response.data.unReadtNum;
  296. if (this.$refs.tabbarMain) {
  297. this.$refs.tabbarMain.setprefetchNum(this.prefetchNum+num);
  298. }
  299. }).catch(error => {
  300. uni.hideLoading();
  301. uni.showToast({
  302. icon: "none",
  303. title: error
  304. })
  305. })
  306. },
  307. confirmPhone() {
  308. this.openModalBl = false;
  309. uni.makePhoneCall({
  310. phoneNumber:"400-8899-619" //仅为示例
  311. });
  312. },
  313. homePage(){
  314. // uni.showLoading({
  315. // title: "加载中",
  316. // mask: true,
  317. // })
  318. API.homePage({
  319. }).then((response) => {
  320. //uni.hideLoading();
  321. this.personInfo=response.data.tenantInfo;
  322. //console.log(response.data.tenantInfo)
  323. }).catch(error => {
  324. //uni.hideLoading();
  325. uni.hideLoading();
  326. uni.showToast({
  327. icon: "none",
  328. title: error
  329. })
  330. })
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. // 账户充值 扣费记录
  337. .function2 {
  338. //display: flex;
  339. // justify-content: space-between;
  340. // align-items: center;
  341. background-color: #fff;
  342. padding: 26rpx 40rpx;
  343. border-bottom: 1px solid #F4F4F4;
  344. .companyName{
  345. display: flex;
  346. align-items: center;
  347. font-size: 36rpx;
  348. font-weight: bold;
  349. .img{
  350. min-width: 40rpx;
  351. width: 40rpx;
  352. height: 40rpx;
  353. }
  354. .fullName1{
  355. width: 490rpx;
  356. // white-space: pre;
  357. overflow: hidden;
  358. white-space: nowrap;
  359. text-overflow: ellipsis;
  360. }
  361. .fullName2{
  362. width: 630rpx;
  363. // white-space: pre;
  364. overflow: hidden;
  365. white-space: nowrap;
  366. text-overflow: ellipsis;
  367. }
  368. }
  369. .titleElectricity{
  370. white-space: pre;
  371. color:#333333 ;
  372. font-size: 28rpx;
  373. width: 140rpx;
  374. .spanradius{
  375. width: 20rpx;
  376. height: 20rpx;
  377. background-color: #FF7B00 ;
  378. color: #FF7B00 ;
  379. margin-right: 4rpx;
  380. border-radius: 50%; /* 将正方形变成圆形 */
  381. display: inline-block;
  382. }
  383. .normal{
  384. background-color: #00B962 ;
  385. color: #00B962 ;
  386. }
  387. }
  388. }
  389. .function {
  390. background-color: #fff;
  391. padding: 56rpx 40rpx;
  392. display: flex;
  393. justify-content: space-between;
  394. .item {
  395. display: flex;
  396. align-items: center;
  397. .icon {
  398. width: 96rpx;
  399. height: 96rpx;
  400. border-radius: 12px;
  401. background: linear-gradient(180deg, rgba(93, 155, 255, 1) 0%, rgba(0, 97, 255, 1) 100%);
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. .img {
  406. width: 64rpx !important;
  407. height: 64rpx !important;
  408. }
  409. }
  410. .icon2 {
  411. background: linear-gradient(179.2deg, rgba(96, 213, 124, 1) -0.62%, rgba(0, 161, 39, 1) 97.92%);
  412. }
  413. .text {
  414. margin-left: 16rpx;
  415. .title {
  416. color: rgba(51, 51, 51, 1);
  417. font-size: 36rpx;
  418. font-weight: bold;
  419. }
  420. .infos {
  421. color: rgba(119, 119, 119, 1);
  422. font-size: 24rpx;
  423. margin-top: 8rpx;
  424. }
  425. }
  426. }
  427. }
  428. // 管家服务
  429. .housekeeper-service {
  430. background-color: #fff;
  431. margin-top: 24rpx;
  432. padding: 32rpx;
  433. .title {
  434. font-size: 36rpx;
  435. color: #333333;
  436. font-weight: bold;
  437. }
  438. .dot{
  439. width: 20rpx;
  440. height: 20rpx;
  441. border-radius:999px;
  442. background-color: rgba(255,0,0,1);
  443. position: absolute;
  444. top:24rpx;
  445. right:24rpx;
  446. }
  447. .grid-text {
  448. margin-top: 28rpx;
  449. color: rgba(51, 51, 51, 1);
  450. }
  451. .icon {
  452. width: 96rpx;
  453. height: 96rpx;
  454. border-radius: 24rpx;
  455. display: flex;
  456. align-items: center;
  457. justify-content: center;
  458. .img {
  459. width: 56rpx;
  460. height: 56rpx;
  461. }
  462. }
  463. .icon10 {
  464. background: linear-gradient(180.4deg, rgba(127,213,151,1) 2.1%,rgba(67,176,116,1) 101.21%);
  465. }
  466. .icon11 {
  467. background: linear-gradient(180.4deg, rgba(127,213,151,1) 2.1%,rgba(67,176,116,1) 101.21%);
  468. //background: linear-gradient(180.29deg, rgba(255,124,112,1) 0.9%,rgba(255,79,63,1) 100.4%);
  469. }
  470. .icon1 {
  471. background: linear-gradient(181.79deg, rgba(117, 213, 224, 1) -1.13%, rgba(53, 153, 203, 1) 94.2%);
  472. }
  473. .icon2 {
  474. background: linear-gradient(179.2deg, rgba(168, 178, 238, 1) 6.28%, rgba(123, 123, 240, 1) 96.94%);
  475. }
  476. .icon3 {
  477. background: linear-gradient(180deg, rgba(121, 172, 255, 1) 0%, rgba(57, 132, 255, 1) 100%);
  478. }
  479. .icon4 {
  480. background: linear-gradient(180.82deg, rgba(247, 186, 154, 1) 0.58%, rgba(255, 128, 158, 1) 97.52%);
  481. }
  482. .icon5 {
  483. background: linear-gradient(180.4deg, rgba(127, 213, 151, 1) 2.1%, rgba(67, 176, 116, 1) 101.21%);
  484. }
  485. .icon6 {
  486. background: linear-gradient(180.29deg, rgba(255, 214, 125, 1) 0.9%, rgba(255, 150, 0, 1) 100.4%);
  487. }
  488. .icon7 {
  489. background: linear-gradient(178.44deg, rgba(122, 232, 227, 1) 3.96%, rgba(57, 182, 182, 1) 100.6%);
  490. }
  491. .icon8 {
  492. background: linear-gradient(180.4deg, rgba(127, 213, 151, 1) 2.1%, rgba(67, 176, 116, 1) 101.21%);
  493. }
  494. .icon9 {
  495. background: linear-gradient(180.29deg, rgba(255,124,112,1) 0.9%,rgba(255,79,63,1) 100.4%);
  496. }
  497. }
  498. .cover {
  499. background: radial-gradient(at 100% 100%, rgba(194, 255, 216, 1) 3%, rgba(138, 182, 232, 1) 39%, rgba(82, 110, 248, 1) 100%);
  500. color: #ffffff;
  501. text-align: center;
  502. padding: 40rpx 0;
  503. margin: 24rpx 0;
  504. .text {
  505. font-size: 64rpx;
  506. // box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);
  507. text-align: center;
  508. }
  509. }
  510. .tel {
  511. color: #1677FF;
  512. margin-left: 16rpx;
  513. }
  514. </style>