mine.vue 14 KB

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