mine.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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. uni.showToast({
  234. icon: "none",
  235. title: error
  236. })
  237. })
  238. },
  239. prefetch(){
  240. API_message.prefetch({
  241. }).then((response) => {
  242. this.prefetchNum=response.data
  243. this.getBillList()
  244. }).catch(error => {
  245. //uni.hideLoading();
  246. uni.hideLoading();
  247. uni.showToast({
  248. icon: "none",
  249. title: error
  250. })
  251. })
  252. },
  253. getBillList(){
  254. API_message.headlineBill().then((response) => {
  255. this.headlineBill=response.data;
  256. var num=response.data.unReadtNum;
  257. if (this.$refs.tabbarMain) {
  258. this.$refs.tabbarMain.setprefetchNum(this.prefetchNum+num);
  259. }
  260. }).catch(error => {
  261. uni.hideLoading();
  262. uni.showToast({
  263. icon: "none",
  264. title: error
  265. })
  266. })
  267. },
  268. query() {
  269. uni.showLoading({
  270. title: "加载中",
  271. mask: true,
  272. })
  273. API_user.findByOpenId({
  274. noerror: true,
  275. openId: this.carhelp.getOpenId(),
  276. }).then((response) => {
  277. //this.loginset(response)
  278. uni.hideLoading();
  279. var token = response ? response.data.token : '';
  280. this.carhelp.setToken(token);
  281. this.carhelp.setPersonInfo(response.data.tenantInfo);
  282. this.carhelp.setPersonInfoPlus(response.data)
  283. this.companyInfo = response.data.companyInfo;
  284. this.regUser = response.data.regUser;
  285. this.personInfo = response.data.tenantInfo;
  286. this.prefetch();
  287. this.getContractList()
  288. //this.homePage()
  289. }).catch(error => {
  290. uni.hideLoading();
  291. uni.showToast({
  292. icon: "none",
  293. title: error
  294. })
  295. })
  296. },
  297. changeUserShowBtn() {
  298. this.defaultIndex = this.userList.findIndex(item => {
  299. return item.id == this.regUser.id
  300. })
  301. this.changeUserShow = true
  302. },
  303. selector1confirm(e) {
  304. var obj = this.userList[e[0]]
  305. uni.showLoading({
  306. title: "加载中",
  307. mask: true,
  308. })
  309. API_user.changeUser({
  310. id: obj.id,
  311. openId: this.carhelp.getOpenId()
  312. }).then((response) => {
  313. this.query()
  314. //this.companyInfo=response.data.companyInfo;
  315. }).catch(error => {
  316. uni.hideLoading();
  317. uni.showToast({
  318. icon: "none",
  319. title: error
  320. })
  321. })
  322. },
  323. personalCenter() {
  324. uni.showLoading({
  325. title: "加载中",
  326. mask: true,
  327. })
  328. API_user.personalCenter({
  329. }).then((response) => {
  330. uni.hideLoading();
  331. //this.companyInfo=response.data.companyInfo;
  332. }).catch(error => {
  333. uni.hideLoading();
  334. uni.showToast({
  335. icon: "none",
  336. title: error
  337. })
  338. })
  339. },
  340. homePage() {
  341. uni.showLoading({
  342. title: "加载中",
  343. mask: true,
  344. })
  345. API.homePage({
  346. }).then((response) => {
  347. uni.hideLoading();
  348. this.companyInfo = response.data.companyInfo;
  349. this.regUser = response.data.regUser;
  350. this.personInfo = response.data.tenantInfo;
  351. }).catch(error => {
  352. uni.hideLoading();
  353. uni.showToast({
  354. icon: "none",
  355. title: error
  356. })
  357. })
  358. }
  359. }
  360. }
  361. </script>
  362. <style lang="scss" scoped>
  363. .background {
  364. background: linear-gradient(180deg, rgba(194, 219, 255, 1) 53%, rgba(180, 211, 255, 0) 100%);
  365. padding: 72rpx 32rpx;
  366. height: 516rpx;
  367. // 个人信息
  368. .person-infos {
  369. display: flex;
  370. align-items: center;
  371. .photo {
  372. width: 112rpx;
  373. height: 112rpx;
  374. border-radius: 50px;
  375. .img {
  376. width: 100%;
  377. height: 100%;
  378. }
  379. }
  380. .else {
  381. margin-left: 24rpx;
  382. width: 400rpx;
  383. .name {
  384. color: rgb(16, 16, 16);
  385. font-size: 36rpx;
  386. font-weight: bold;
  387. }
  388. .company {
  389. color: rgba(16, 16, 16, 1);
  390. }
  391. }
  392. // 切换
  393. .change {
  394. border: 1px solid rgba(22, 119, 255, 1);
  395. width: 128rpx;
  396. height: 64rpx;
  397. line-height: 64rpx;
  398. border-radius: 50px;
  399. margin-left: auto;
  400. color: rgba(22, 119, 255, 1);
  401. text-align: center;
  402. }
  403. }
  404. // 账户余额
  405. .content {
  406. margin: 48rpx 0rpx;
  407. border-radius: 8px;
  408. background: linear-gradient(180deg, rgba(220, 235, 255, 1) 0%, rgba(255, 255, 255, 1) 39%);
  409. border: 1px solid rgba(255, 255, 255, 1);
  410. .balance{
  411. padding: 32rpx 24rpx;
  412. border-bottom: 1px solid #F4F4F4;
  413. }
  414. .title {
  415. display: flex;
  416. .icon {
  417. width: 40rpx;
  418. height: 40rpx;
  419. .img {
  420. width: 100%;
  421. height: 100%;
  422. }
  423. }
  424. .text {
  425. margin-left: 16rpx;
  426. color: rgba(51, 51, 51, 1);
  427. font-size: 32rpx;
  428. font-weight: bold;
  429. .state {
  430. white-space: pre;
  431. margin-left: 16rpx;
  432. color: rgba(238, 49, 56, 1);
  433. }
  434. }
  435. }
  436. .balance-number {
  437. display: flex;
  438. align-items: center;
  439. justify-content: space-between;
  440. margin-top: 16rpx;
  441. margin-left: 56rpx;
  442. .number2 {
  443. color: rgba(238, 49, 56, 1);
  444. }
  445. .number {
  446. font-size: 56rpx;
  447. font-weight: bold;
  448. }
  449. .recharge {
  450. width: 144rpx;
  451. height: 56rpx;
  452. line-height: 56rpx;
  453. border-radius: 50px;
  454. background: linear-gradient(85.19deg, rgba(255, 61, 0, 1) 4.89%, rgba(255, 123, 0, 1) 95.37%);
  455. color: rgba(255, 255, 255, 1);
  456. text-align: center;
  457. }
  458. }
  459. // 期限
  460. .deadline {
  461. display: flex;
  462. flex-wrap: wrap;
  463. .deadline-item:first-of-type{
  464. //border-top: 1px solid #F4F4F4;
  465. }
  466. .deadline-item:last-of-type{
  467. // border-left: 1px solid #F4F4F4;
  468. }
  469. .deadline-item {
  470. border-bottom: 1px solid #F4F4F4;
  471. border-right: 1px solid #F4F4F4;
  472. width: 50%;
  473. display: flex;
  474. padding: 24rpx ;
  475. .item-icon {
  476. width: 40rpx;
  477. height: 40rpx;
  478. margin-right: 12rpx;
  479. .img {
  480. width: 100%;
  481. height: 100%;
  482. vertical-align: middle;
  483. }
  484. }
  485. .stateBl{
  486. .state {
  487. // white-space: pre;
  488. color: rgba(238, 49, 56, 1);
  489. }
  490. }
  491. .date-box {
  492. .state {
  493. white-space: pre;
  494. //color: rgba(238, 49, 56, 1);
  495. }
  496. text{
  497. margin-left: 8rpx;
  498. }
  499. .classify {
  500. color: rgba(51, 51, 51, 1);
  501. font-size: 32rpx;
  502. font-weight: bold;
  503. }
  504. .date{
  505. color: rgba(51,51,51,1);
  506. font-size: 24rpx;
  507. margin-top: 4rpx;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. // 地址
  514. .address-box {
  515. border-radius: 8px;
  516. background: linear-gradient(90deg, rgba(49, 110, 207, 1) 2%, rgba(20, 73, 159, 1) 100%);
  517. color: #fff;
  518. padding: 40rpx 32rpx;
  519. margin-top: 40rpx;
  520. display: flex;
  521. align-items: center;
  522. position: relative;
  523. .address {
  524. .address-title {
  525. font-size: 40rpx;
  526. }
  527. .address-value {
  528. font-size: 24rpx;
  529. margin-top: 8rpx;
  530. }
  531. }
  532. // 切换
  533. .change {
  534. border: 1px solid rgba(255, 255, 255, 1);
  535. width: 128rpx;
  536. height: 64rpx;
  537. line-height: 64rpx;
  538. border-radius: 50px;
  539. color: rgba(255, 255, 255, 1);
  540. text-align: center;
  541. margin-left: auto;
  542. z-index: 99;
  543. }
  544. .image {
  545. width: 174rpx;
  546. height: 174rpx;
  547. position: absolute;
  548. right: 0;
  549. top: 20rpx;
  550. .img {
  551. width: 100%;
  552. height: 100%;
  553. }
  554. }
  555. }
  556. }
  557. // 功能
  558. .function-group {
  559. border-radius: 8px;
  560. background-color: #fff;
  561. margin-bottom: 24rpx;
  562. .function-item {
  563. display: flex;
  564. align-items: center;
  565. padding: 26rpx 26rpx 26rpx 0;
  566. margin-left: 26rpx;
  567. border-bottom: 1px solid rgba(221, 221, 221, 1);
  568. .icon {
  569. width: 40rpx;
  570. height: 40rpx;
  571. .img {
  572. width: 100%;
  573. height: 100%;
  574. }
  575. }
  576. .name {
  577. color: rgba(51, 51, 51, 1);
  578. font-size: 30rpx;
  579. margin-left: 26rpx;
  580. }
  581. .arrow {
  582. margin-left: auto;
  583. }
  584. }
  585. }
  586. </style>