mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <view>
  3. <view class="background">
  4. <!-- 个人信息 @click="gotoUrl('/pages/mine/personInfos')" -->
  5. <view class="person-infos">
  6. <view class="photo">
  7. <image class="img" src="@/assets/img/默认头像.png" mode=""></image>
  8. </view>
  9. <view class="else">
  10. <view class="name">
  11. {{regUser.name}}
  12. </view>
  13. <view class="company">
  14. {{personInfo.name}}
  15. </view>
  16. </view>
  17. <u-picker v-model="changeUserShow" mode="selector" :range="userList"
  18. :default-selector="[defaultIndex]" range-key="tenantName" @confirm="selector1confirm" ></u-picker>
  19. <view class="change" @click="changeUserShowBtn" v-if="userList&&userList.length>1">
  20. 切换
  21. </view>
  22. <!-- <view class="change">
  23. 切换
  24. </view> -->
  25. </view>
  26. <!-- 账户余额 -->
  27. <view class="content">
  28. <view class="balance">
  29. <view class="title">
  30. <view class="icon">
  31. <image class="img" src="@/assets/img/wallet@3x.png" mode=""></image>
  32. </view>
  33. <view class="text">
  34. 账户余额
  35. <span class="state" v-if="personInfo.balance<0">已欠费</span>
  36. </view>
  37. </view>
  38. <view class="balance-number">
  39. <view class="number" :class="{
  40. number2:personInfo.balance<0
  41. }" >
  42. {{personInfo.balance}}元
  43. </view>
  44. <view class="recharge" @click="gotoUrl('/pages/recharge/accountRecharge')" >
  45. 充值
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 期限 -->
  50. <view class="deadline" v-for="(obj,i) in contractList" :key="i">
  51. <view class="deadline-item" v-for="(item,i) in obj.contractItemList" :key="i" v-if="item.paymentMethod==1" >
  52. <view class="item-icon">
  53. <image class="img" v-if="item.name.indexOf('水')>-1" src="@/assets/img/deadline2.png" mode=""></image>
  54. <image class="img" v-else-if="item.name.indexOf('房')>-1||item.name.indexOf('租')>-1" src="@/assets/img/deadline1.png" mode=""></image>
  55. <image class="img" v-else-if="item.name.indexOf('保洁')>-1" src="@/assets/img/deadline4.png" mode=""></image>
  56. <image class="img" v-else-if="item.name.indexOf('物业')>-1" src="@/assets/img/deadline3.png" mode=""></image>
  57. <image class="img" v-else src="@/assets/img/deadline3.png" mode=""></image>
  58. </view>
  59. <view class="date-box" :class="{
  60. stateBl:stateBl(item.prepaidEndTime)
  61. }">
  62. <view class="classify">
  63. {{item.name}}
  64. </view>
  65. <view class="classify">
  66. <span class="state" v-if="item.prepaidEndTime&&stateBl(item.prepaidEndTime)">已到期</span>
  67. <span class="state" v-if="!item.prepaidEndTime">未交费</span>
  68. </view>
  69. <view class="date" v-if="item.prepaidEndTime">
  70. 已缴费至 <text class="state">{{item.prepaidEndTime}}</text>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 功能 -->
  77. <view class="function-group">
  78. <view class="function-item" v-if="false" @click="gotoUrl('/pages/mine/tenantInformation')">
  79. <view class="icon">
  80. <image class="img" src="@/assets/img/riLine-contacts-book-line.svg" mode=""></image>
  81. </view>
  82. <view class="name">
  83. 用户信息
  84. </view>
  85. <view class="arrow">
  86. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  87. </view>
  88. </view>
  89. <view class="function-item" v-if="false">
  90. <view class="icon">
  91. <image class="img" src="@/assets/img/riLine-pie-chart-line.svg" mode=""></image>
  92. </view>
  93. <view class="name">
  94. 用电监控
  95. </view>
  96. <view class="arrow">
  97. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  98. </view>
  99. </view>
  100. <view class="function-item" v-if="false">
  101. <view class="icon">
  102. <image class="img" src="@/assets/img/riLine-book-2-line.svg" mode=""></image>
  103. </view>
  104. <view class="name">
  105. 用电常识
  106. </view>
  107. <view class="arrow">
  108. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  109. </view>
  110. </view>
  111. <view class="function-item" v-if="personInfo.allowInvoice"
  112. @click="gotoUrl('/pages/invoiceManagement/invoiceManagement')">
  113. <view class="icon">
  114. <image class="img" src="@/assets/img/iconPark-order2.svg" mode=""></image>
  115. </view>
  116. <view class="name">
  117. 发票管理
  118. </view>
  119. <view class="arrow">
  120. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  121. </view>
  122. </view>
  123. <view class="function-item" @click="gotoUrl('/pages/mine/contactService')">
  124. <view class="icon">
  125. <image class="img" src="@/assets/img/riLine-customer-service-2-line.svg" mode=""></image>
  126. </view>
  127. <view class="name">
  128. 客服热线
  129. </view>
  130. <view class="arrow">
  131. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  132. </view>
  133. </view>
  134. </view>
  135. <view class="function-group" v-if="false">
  136. <view class="function-item">
  137. <view class="icon">
  138. <image class="img" src="@/assets/img/riLine-user-settings-line.svg" mode=""></image>
  139. </view>
  140. <view class="name">
  141. 个人信息
  142. </view>
  143. <view class="arrow">
  144. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  145. </view>
  146. </view>
  147. </view>
  148. <view class="function-group">
  149. <view class="function-item" @click="gotoUrl('/pages/mine/setting')">
  150. <view class="icon">
  151. <image class="img" src="@/assets/img/riLine-settings-2-line.svg" mode=""></image>
  152. </view>
  153. <view class="name">
  154. 设置
  155. </view>
  156. <view class="arrow">
  157. <u-icon name="arrow-right" color="#b2b2b2"></u-icon>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <Tabbar :current="2" ref="tabbarMain" :prefetchNum="prefetchNum" ></Tabbar>
  163. </view>
  164. </template>
  165. <script>
  166. import * as API from '@/apis/pagejs/index.js'
  167. import * as API_user from '@/apis/pagejs/user.js'
  168. import * as API_deduction from '@/apis/pagejs/deduction.js'
  169. import * as API_message from '@/apis/pagejs/message.js'
  170. import Tabbar from '@/components/Tabbar.vue'
  171. import {
  172. newDate
  173. } from '@/apis/utils'
  174. export default {
  175. components: {
  176. Tabbar
  177. },
  178. data() {
  179. return {
  180. companyInfo:{},
  181. regUser:{},
  182. userList:[],
  183. changeUserShow:false,
  184. defaultIndex:0,
  185. prefetchNum:0,
  186. personInfo:{
  187. },
  188. contractList:[]
  189. }
  190. },
  191. onLoad() {
  192. this.personInfo=this.carhelp.getPersonInfo()
  193. //this.homePage()
  194. this.userList=this.carhelp.getPersonInfoPlus().userList
  195. //this.prefetch()
  196. //this.personalCenter()
  197. },
  198. onShow() {
  199. this.query()
  200. },
  201. methods: {
  202. stateBl(time){
  203. var get=newDate(time)
  204. var time=new Date()
  205. return get<time;
  206. },
  207. getContractList() {
  208. API_deduction.contractList({
  209. pageIndex: 1,
  210. pageSize: 9999
  211. }).then((response) => {
  212. uni.hideLoading();
  213. this.contractList = response.data.data;
  214. }).catch(error => {
  215. uni.hideLoading();
  216. uni.showToast({
  217. icon: "none",
  218. title: error
  219. })
  220. })
  221. },
  222. prefetch(){
  223. API_message.prefetch({
  224. }).then((response) => {
  225. this.prefetchNum=response.data
  226. this.getBillList()
  227. }).catch(error => {
  228. //uni.hideLoading();
  229. uni.hideLoading();
  230. uni.showToast({
  231. icon: "none",
  232. title: error
  233. })
  234. })
  235. },
  236. getBillList(){
  237. API_message.headlineBill().then((response) => {
  238. this.headlineBill=response.data;
  239. var num=response.data.unReadtNum;
  240. if (this.$refs.tabbarMain) {
  241. this.$refs.tabbarMain.setprefetchNum(this.prefetchNum+num);
  242. }
  243. }).catch(error => {
  244. uni.hideLoading();
  245. uni.showToast({
  246. icon: "none",
  247. title: error
  248. })
  249. })
  250. },
  251. query() {
  252. uni.showLoading({
  253. title: "加载中",
  254. mask: true,
  255. })
  256. API_user.findByOpenId({
  257. noerror: true,
  258. openId: this.carhelp.getOpenId(),
  259. }).then((response) => {
  260. //this.loginset(response)
  261. uni.hideLoading();
  262. var token = response ? response.data.token : '';
  263. this.carhelp.setToken(token);
  264. this.carhelp.setPersonInfo(response.data.tenantInfo);
  265. this.carhelp.setPersonInfoPlus(response.data)
  266. this.companyInfo = response.data.companyInfo;
  267. this.regUser = response.data.regUser;
  268. this.personInfo = response.data.tenantInfo;
  269. this.userList=response.data.userList
  270. this.prefetch();
  271. this.getContractList()
  272. //this.homePage()
  273. }).catch(error => {
  274. uni.hideLoading();
  275. uni.showToast({
  276. icon: "none",
  277. title: error
  278. })
  279. })
  280. },
  281. changeUserShowBtn() {
  282. this.defaultIndex = this.userList.findIndex(item => {
  283. return item.id == this.regUser.id
  284. })
  285. this.changeUserShow = true
  286. },
  287. selector1confirm(e) {
  288. var obj = this.userList[e[0]]
  289. uni.showLoading({
  290. title: "加载中",
  291. mask: true,
  292. })
  293. API_user.changeUser({
  294. id: obj.id,
  295. openId: this.carhelp.getOpenId()
  296. }).then((response) => {
  297. this.query()
  298. //this.companyInfo=response.data.companyInfo;
  299. }).catch(error => {
  300. uni.hideLoading();
  301. uni.showToast({
  302. icon: "none",
  303. title: error
  304. })
  305. })
  306. },
  307. personalCenter() {
  308. uni.showLoading({
  309. title: "加载中",
  310. mask: true,
  311. })
  312. API_user.personalCenter({
  313. }).then((response) => {
  314. uni.hideLoading();
  315. //this.companyInfo=response.data.companyInfo;
  316. }).catch(error => {
  317. uni.hideLoading();
  318. uni.showToast({
  319. icon: "none",
  320. title: error
  321. })
  322. })
  323. },
  324. homePage() {
  325. uni.showLoading({
  326. title: "加载中",
  327. mask: true,
  328. })
  329. API.homePage({
  330. }).then((response) => {
  331. uni.hideLoading();
  332. this.companyInfo = response.data.companyInfo;
  333. this.regUser = response.data.regUser;
  334. this.personInfo = response.data.tenantInfo;
  335. }).catch(error => {
  336. uni.hideLoading();
  337. uni.showToast({
  338. icon: "none",
  339. title: error
  340. })
  341. })
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="scss" scoped>
  347. .background {
  348. background: linear-gradient(180deg, rgba(194, 219, 255, 1) 53%, rgba(180, 211, 255, 0) 100%);
  349. padding: 72rpx 32rpx;
  350. height: 516rpx;
  351. // 个人信息
  352. .person-infos {
  353. display: flex;
  354. align-items: center;
  355. .photo {
  356. width: 112rpx;
  357. height: 112rpx;
  358. border-radius: 50px;
  359. .img {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. }
  364. .else {
  365. margin-left: 24rpx;
  366. width: 400rpx;
  367. .name {
  368. color: rgb(16, 16, 16);
  369. font-size: 36rpx;
  370. font-weight: bold;
  371. }
  372. .company {
  373. color: rgba(16, 16, 16, 1);
  374. }
  375. }
  376. // 切换
  377. .change {
  378. border: 1px solid rgba(22, 119, 255, 1);
  379. width: 128rpx;
  380. height: 64rpx;
  381. line-height: 64rpx;
  382. border-radius: 50px;
  383. margin-left: auto;
  384. color: rgba(22, 119, 255, 1);
  385. text-align: center;
  386. }
  387. }
  388. // 账户余额
  389. .content {
  390. margin: 48rpx 0rpx;
  391. border-radius: 8px;
  392. background: linear-gradient(180deg, rgba(220, 235, 255, 1) 0%, rgba(255, 255, 255, 1) 39%);
  393. border: 1px solid rgba(255, 255, 255, 1);
  394. .balance{
  395. padding: 32rpx 24rpx;
  396. border-bottom: 1px solid #F4F4F4;
  397. }
  398. .title {
  399. display: flex;
  400. .icon {
  401. width: 40rpx;
  402. height: 40rpx;
  403. .img {
  404. width: 100%;
  405. height: 100%;
  406. }
  407. }
  408. .text {
  409. margin-left: 16rpx;
  410. color: rgba(51, 51, 51, 1);
  411. font-size: 32rpx;
  412. font-weight: bold;
  413. .state {
  414. white-space: pre;
  415. margin-left: 16rpx;
  416. color: rgba(238, 49, 56, 1);
  417. }
  418. }
  419. }
  420. .balance-number {
  421. display: flex;
  422. align-items: center;
  423. justify-content: space-between;
  424. margin-top: 16rpx;
  425. margin-left: 56rpx;
  426. .number2 {
  427. color: rgba(238, 49, 56, 1);
  428. }
  429. .number {
  430. font-size: 56rpx;
  431. font-weight: bold;
  432. }
  433. .recharge {
  434. width: 144rpx;
  435. height: 56rpx;
  436. line-height: 56rpx;
  437. border-radius: 50px;
  438. background: linear-gradient(85.19deg, rgba(255, 61, 0, 1) 4.89%, rgba(255, 123, 0, 1) 95.37%);
  439. color: rgba(255, 255, 255, 1);
  440. text-align: center;
  441. }
  442. }
  443. // 期限
  444. .deadline {
  445. display: flex;
  446. flex-wrap: wrap;
  447. .deadline-item:first-of-type{
  448. //border-top: 1px solid #F4F4F4;
  449. }
  450. .deadline-item:last-of-type{
  451. // border-left: 1px solid #F4F4F4;
  452. }
  453. .deadline-item {
  454. border-bottom: 1px solid #F4F4F4;
  455. border-right: 1px solid #F4F4F4;
  456. width: 50%;
  457. display: flex;
  458. padding: 24rpx ;
  459. .item-icon {
  460. width: 40rpx;
  461. height: 40rpx;
  462. margin-right: 12rpx;
  463. .img {
  464. width: 100%;
  465. height: 100%;
  466. vertical-align: middle;
  467. }
  468. }
  469. .stateBl{
  470. .state {
  471. // white-space: pre;
  472. color: rgba(238, 49, 56, 1);
  473. }
  474. }
  475. .date-box {
  476. .state {
  477. white-space: pre;
  478. //color: rgba(238, 49, 56, 1);
  479. }
  480. text{
  481. margin-left: 8rpx;
  482. }
  483. .classify {
  484. color: rgba(51, 51, 51, 1);
  485. font-size: 32rpx;
  486. font-weight: bold;
  487. }
  488. .date{
  489. color: rgba(51,51,51,1);
  490. font-size: 24rpx;
  491. margin-top: 4rpx;
  492. }
  493. }
  494. }
  495. }
  496. }
  497. // 地址
  498. .address-box {
  499. border-radius: 8px;
  500. background: linear-gradient(90deg, rgba(49, 110, 207, 1) 2%, rgba(20, 73, 159, 1) 100%);
  501. color: #fff;
  502. padding: 40rpx 32rpx;
  503. margin-top: 40rpx;
  504. display: flex;
  505. align-items: center;
  506. position: relative;
  507. .address {
  508. .address-title {
  509. font-size: 40rpx;
  510. }
  511. .address-value {
  512. font-size: 24rpx;
  513. margin-top: 8rpx;
  514. }
  515. }
  516. // 切换
  517. .change {
  518. border: 1px solid rgba(255, 255, 255, 1);
  519. width: 128rpx;
  520. height: 64rpx;
  521. line-height: 64rpx;
  522. border-radius: 50px;
  523. color: rgba(255, 255, 255, 1);
  524. text-align: center;
  525. margin-left: auto;
  526. z-index: 99;
  527. }
  528. .image {
  529. width: 174rpx;
  530. height: 174rpx;
  531. position: absolute;
  532. right: 0;
  533. top: 20rpx;
  534. .img {
  535. width: 100%;
  536. height: 100%;
  537. }
  538. }
  539. }
  540. }
  541. // 功能
  542. .function-group {
  543. border-radius: 8px;
  544. background-color: #fff;
  545. margin-bottom: 24rpx;
  546. .function-item {
  547. display: flex;
  548. align-items: center;
  549. padding: 26rpx 26rpx 26rpx 0;
  550. margin-left: 26rpx;
  551. border-bottom: 1px solid rgba(221, 221, 221, 1);
  552. .icon {
  553. width: 40rpx;
  554. height: 40rpx;
  555. .img {
  556. width: 100%;
  557. height: 100%;
  558. }
  559. }
  560. .name {
  561. color: rgba(51, 51, 51, 1);
  562. font-size: 30rpx;
  563. margin-left: 26rpx;
  564. }
  565. .arrow {
  566. margin-left: auto;
  567. }
  568. }
  569. }
  570. </style>