mine.vue 14 KB

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