index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <view>
  3. <u-picker mode="selector" v-model="isswitchshow" :range="columns" range-key="label" :default-selector="columnsindex" @confirm="switchBtn" ></u-picker>
  4. <view class="userHead" :style="isswitch?'padding-top:40px':''" >
  5. <view class="userHead-img">
  6. <u-avatar src="../../assets/img/head.png" size="140"></u-avatar>
  7. </view>
  8. <view class="userHead-text">
  9. <h3>{{info.merchantAccountName}}</h3>
  10. <view class="userHead-text-position">
  11. <u-icon name="account-pin-box-fill" custom-prefix="custom-icon" color="#fff" size="32"></u-icon>
  12. <p>{{getPhone(info.phone)}}</p>
  13. <p
  14. v-if="isswitch" @click="isswitchshow=true"
  15. style="border: 1px solid rgba(255, 255, 255, 1);
  16. border-radius: 10px;
  17. padding: 0 10px;">
  18. <img src="../../assets/img/userswitch.svg" style="height: 32rpx;width: 32rpx;" alt="">
  19. 切换账号</p>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="userInfo" v-if="home">
  24. <template v-if="accountType">
  25. <view class="userInfo-head"><p>可提现金额<span v-if="info.accountType==3">(T+4)</span></p></view>
  26. <view class="userInfo-main">
  27. <h2>{{showNumJP(home.accountBalance)}}元
  28. <view class="withdraw" v-if="info.status&&(info.accountType!=3&&info.accountType!=1)" @click="gotoUrl('pagesFinance/user/withdrawal/withdrawRecord')" >
  29. 账户提现
  30. </view>
  31. <view class="withdraw" v-if="info.accountType==3" @click="gotoUrl('pagesFinance/user/withdrawal/cashoutList')" >
  32. 账户提现
  33. </view>
  34. </h2>
  35. <!-- <view class="userInfo-btn" >帐户提现</view> -->
  36. </view>
  37. <view class="userInfo-foot">
  38. <!-- <view class="userInfo-item">
  39. <p>今日收益</p>
  40. <h4>{{home.todayAmount}}</h4>
  41. </view> -->
  42. <view class="userInfo-item">
  43. <p>冻结金额(提现中)</p>
  44. <h4>{{showNumJP(home.waitingAmount)}}元</h4>
  45. </view>
  46. <view class="userInfo-item">
  47. <p>已提现</p>
  48. <h4>{{showNumJP(home.withdrawnAmount)}}元</h4>
  49. </view>
  50. </view>
  51. </template>
  52. <template v-for="(item,i ) in vipPlatformList" v-if="item.entAccountId">
  53. <view class="userInfo-head" style="margin-top: 20rpx;" :key="i+'a'" ><p>企业可充电金额
  54. <span v-if="vipPlatformList1.length>1">[{{item.name}}]</span>
  55. </p></view>
  56. <view class="userInfo-main" :key="i+'b'">
  57. <h2 :style="accountType?'font-size: 32rpx;':''">{{showNumJP(item.entAccountBalance)}}元</h2>
  58. <!-- <view class="userInfo-btn" >帐户提现</view> -->
  59. </view>
  60. </template>
  61. </view>
  62. <!-- 功能菜单 -->
  63. <view class="function-menu" >
  64. <template v-if="accountType">
  65. <view class="item" @click="gotoUrl('pagesFinance/user/stationsList')" >
  66. <view class="item-icon">
  67. <img src="../../assets/img/riLine-user-settings-line.svg" alt="">
  68. </view>
  69. <view class="item-name">
  70. 我的充电桩
  71. </view>
  72. <view class="position" v-if="home&&home.deviceNumbers" >
  73. <view id="talkbubble" :style="home.deviceNumbers>=100?'padding: 2px 16rpx;':''" >{{home.deviceNumbers}}桩{{home.gunNumbers?home.gunNumbers+'枪':''}}</view>
  74. </view>
  75. </view>
  76. <view class="item" v-if="info.accountType==2" @click="gotoUrl('pagesFinance/user/withdrawal/businessList')">
  77. <view class="item-icon">
  78. <img src="../../assets/img/riLine-file-list-3-line.svg" alt="">
  79. </view>
  80. <view class="item-name">
  81. 收益核算
  82. </view>
  83. </view>
  84. <view class="item" v-if="info.accountType==3" @click="gotoUrl('pagesFinance/user/withdrawal/cashoutList')">
  85. <view class="item-icon"> <!--个人 -->
  86. <i data-v-7e5aa06e="" class="ri-todo-line"></i>
  87. </view>
  88. <view class="item-name">
  89. 提现记录
  90. </view>
  91. </view>
  92. <view class="item" v-else @click="gotoUrl('pagesFinance/user/withdrawal/withdrawRecord')">
  93. <view class="item-icon">
  94. <i data-v-7e5aa06e="" class="ri-todo-line"></i>
  95. </view>
  96. <view class="item-name">
  97. 提现记录
  98. </view>
  99. </view>
  100. <view class="item" @click="gotoUrl('pagesFinance/preengaged/preengaged')">
  101. <view class="item-icon">
  102. <i data-v-137d5072="" class="ri-map-pin-time-line"></i>
  103. </view>
  104. <view class="item-name">
  105. 我被预约
  106. </view>
  107. </view>
  108. <view class="item" @click="gotoUrl('pagesFinance/recordOfInvoice/recordOfInvoice')">
  109. <view class="item-icon">
  110. <i data-v-137d5072="" class="ri-ticket-line"></i>
  111. </view>
  112. <view class="item-name">
  113. 开票记录
  114. </view>
  115. </view>
  116. <view class="item" @click="gotoUrl('pagesFinance/user/stationsListLine')">
  117. <view class="item-icon">
  118. <i class="ri-webcam-line"></i>
  119. </view>
  120. <view class="item-name">
  121. 摄像头
  122. </view>
  123. </view>
  124. </template>
  125. <view class="item"
  126. v-for="(item,i) in vipPlatformList" :key="i" v-if="!item.entAccountId"
  127. @click="gotoUrl('pagesFinance/user/ownManagement?id='+item.id)" >
  128. <view class="item-icon">
  129. <i class="ri-folder-user-line"></i>
  130. </view>
  131. <view class="item-name">
  132. {{vipPlatformList.length==1?'车主管理':item.name}}
  133. </view>
  134. </view>
  135. <view class="item" @click="gotoUrl('pagesFinance/user/help')" v-if="false" >
  136. <view class="item-icon">
  137. <i data-v-137d5072="" class="ri-compass-3-line"></i>
  138. </view>
  139. <view class="item-name">
  140. 帮助中心
  141. </view>
  142. </view>
  143. <view class="item" @click="phone()" >
  144. <view class="item-icon">
  145. <i data-v-137d5072="" class="ri-customer-service-2-line"></i>
  146. </view>
  147. <view class="item-name">
  148. 联系客服
  149. </view>
  150. </view>
  151. <view class="item" @click="gotoUrl('pagesFinance/user/about')" v-if="false" >
  152. <view class="item-icon">
  153. <i data-v-137d5072="" class="ri-account-pin-box-line"></i>
  154. </view>
  155. <view class="item-name">
  156. 关于我们
  157. </view>
  158. </view>
  159. </view>
  160. <view class="function-menu2" >
  161. <template v-for="(item,i ) in vipPlatformList" v-if="item.entAccountId" >
  162. <view style="padding-top: 6px;font-size: 15px;" :key="'d'+i" >{{item.name}}</view>
  163. <view class="function-menu3" :key="'c'+i" >
  164. <view class="item" :key="'b'+i"
  165. @click="gotoUrl('pagesFinance/accountType8/personmanage/index?id='+item.id+'&pid='+item.entAccountId)" >
  166. <view class="item-icon">
  167. <i class="ri-folder-user-line"></i>
  168. </view>
  169. <view class="item-name">
  170. 企业员工
  171. </view>
  172. </view>
  173. <view class="item" :key="'ac'+i"
  174. @click="gotoUrl('pagesFinance/accountType8/carmanage/index?id='+item.entAccountId)" >
  175. <view class="item-icon">
  176. <img src="../../assets/img/riLine-bus-line.svg" alt="">
  177. </view>
  178. <view class="item-name">
  179. 企业车辆
  180. </view>
  181. </view>
  182. <view class="item" v-if="item.entAccountId&&info.accountTopics!=2" :key="'a'+i"
  183. @click="gotoUrl('pagesFinance/accountType8/chagingrecord/index?id='+item.entAccountId)" >
  184. <view class="item-icon">
  185. <u-icon name="coupon" style=" margin-bottom: 4px;" size="24px"></u-icon>
  186. </view>
  187. <view class="item-name">
  188. 企业充电记录
  189. </view>
  190. </view>
  191. </view>
  192. </template>
  193. </view>
  194. <button class="logout-btn" @click="logout">退出账号</button>
  195. <Tabbar :current="3" ref="tabbarMain" ></Tabbar>
  196. </view>
  197. </template>
  198. <script>
  199. import Tabbar from '@/components/TabbarFinance.vue'
  200. import * as API from '@/apis/finance.js'
  201. import {
  202. substrMb
  203. } from '@/utils'
  204. export default {
  205. data() {
  206. return {
  207. columns:[],
  208. isWithdrawal:false,
  209. isswitchshow:false,
  210. isswitch:false,
  211. tel:'400-8899-619',
  212. role:{},
  213. info:{},
  214. home:null,
  215. current: 0,
  216. vipPlatformList:[],
  217. vipPlatformList1:[],
  218. vipPlatformList2:[],
  219. columnsindex:[0],
  220. background:{
  221. background: 'none'
  222. },
  223. }
  224. },
  225. components: {
  226. Tabbar
  227. },
  228. computed:{
  229. accountType(){
  230. if(this.accountType8){
  231. return false
  232. }
  233. return true
  234. },
  235. accountType8(){
  236. if(this.info&&(this.info.accountTopics==2||this.info.accountTopics==3)){
  237. return true
  238. }else
  239. return false
  240. }
  241. },
  242. onLoad() {
  243. this.info=this.carhelp.getPersonInfo()
  244. if(process.env.NODE_ENV === "development"){
  245. this.isWithdrawal=true
  246. }
  247. },
  248. onReady() {
  249. //this.getHomePage()
  250. },
  251. onShow() {
  252. if(this.$refs.tabbarMain){
  253. this.$refs.tabbarMain.setcount();
  254. }
  255. this.query()
  256. this.getHomePage()
  257. },
  258. methods: {
  259. switchBtn(e){
  260. var obj=this.columns[e[0]]
  261. uni.showLoading({
  262. title: "加载中",
  263. mask: true,
  264. })
  265. API.switchUser({
  266. newUserId:obj.value
  267. }).then((response) => {
  268. uni.hideLoading();
  269. this.query(true)
  270. }).catch(error => {
  271. uni.hideLoading();
  272. })
  273. //
  274. },
  275. query(bl){
  276. uni.showLoading({
  277. title: "加载中",
  278. mask: true,
  279. })
  280. API.findByOpenId({
  281. openId: this.carhelp.getOpenId(),
  282. }).then((response) => {
  283. //this.loginset(response)
  284. var token = response ? response.data.token : '';
  285. this.carhelp.setToken(token);
  286. this.carhelp.setPersonInfo(response.data.user);
  287. this.carhelp.setPersonInfoPlus(response.data)
  288. this.info=response.data.user
  289. this.isswitch=response.data.haveOtherUser;
  290. if(this.isswitch){
  291. this.allUserList()
  292. }
  293. if(bl){
  294. this.getHomePage()
  295. }
  296. if(this.$refs.tabbarMain){
  297. this.$refs.tabbarMain.relist();
  298. }
  299. uni.hideLoading();
  300. }).catch(error => {
  301. uni.hideLoading();
  302. })
  303. },
  304. allUserList(){
  305. API.allUserList({
  306. }).then((response) => {
  307. var list=response.data.allUserList;
  308. this.columns=[]
  309. for(var i in list){
  310. var obj=list[i]
  311. if(obj.isCurrentUser){
  312. this.columnsindex=[i]
  313. }
  314. this.columns.push({
  315. value:obj.id,
  316. label:obj.merchantAccountName
  317. })
  318. }
  319. }).catch(error => {
  320. uni.hideLoading();
  321. })
  322. },
  323. getPhone(phone){
  324. var backphone="";
  325. if(phone){
  326. backphone=substrMb(phone,0,3)+"****"+substrMb(phone,7,4)
  327. }
  328. return backphone;
  329. },
  330. showModel(){
  331. var bankCard="";
  332. var sss=""
  333. if(this.home.bankCard){
  334. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,this.home.bankCard.length-4,4)
  335. }
  336. var code=this.home.bank+":"+bankCard;
  337. if(this.home.bank==null&&this.home.bankCard==null){
  338. code="未绑定"
  339. }
  340. uni.showModal({
  341. showCancel:false,
  342. content:code,
  343. })
  344. },
  345. logoutApi(){
  346. uni.showLoading({
  347. title: "加载中",
  348. mask: true,
  349. })
  350. var data = {
  351. };
  352. API.logout(data).then((res) => {
  353. this.carhelp.setToken("");
  354. this.carhelp.set("merchantUser_token_tdate","")
  355. this.carhelp.setPersonInfo("");
  356. this.carhelp.setPersonInfoPlus("" )
  357. uni.reLaunch({
  358. url:"/pagesFinance/login/index?phone="+this.info.phone
  359. })
  360. }).catch(error => {
  361. uni.showToast({
  362. title: error
  363. })
  364. })
  365. },
  366. logout(){
  367. uni.showModal({
  368. title: '提示',
  369. content: '确认是否退出?',
  370. success: res=> {
  371. if (res.confirm) {
  372. //付钱 改为组件
  373. this.logoutApi();
  374. } else if (res.cancel) {
  375. console.log('用户点击取消');
  376. }
  377. }
  378. });
  379. },
  380. phone(){
  381. uni.makePhoneCall({
  382. phoneNumber:this.tel //仅为示例
  383. });
  384. },
  385. getHomePage(){
  386. uni.showLoading({
  387. title: "加载中",
  388. mask: true,
  389. })
  390. API.homePage().then((res) => {
  391. this.home = res.data
  392. if(res.data.vipPlatformList){
  393. this.vipPlatformList=res.data.vipPlatformList
  394. //this.vipPlatformList1
  395. this.vipPlatformList.forEach(item=>{
  396. if(item.entAccountId){
  397. this.vipPlatformList1.push(item)
  398. }else{
  399. this.vipPlatformList2.push(item)
  400. }
  401. })
  402. }
  403. uni.hideLoading()
  404. }).catch(error => {
  405. uni.showToast({
  406. title: error
  407. })
  408. })
  409. }
  410. }
  411. }
  412. </script>
  413. <style>
  414. page{
  415. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  416. background-size: 100%;
  417. }
  418. </style>
  419. <style lang="scss" scoped>
  420. .navbar-tit {
  421. color: #fff;
  422. font-size: 18px;
  423. text-align: right;
  424. width: 100%;
  425. padding-top: 3px;
  426. padding-right: 3px;
  427. }
  428. .userCell{
  429. background-color: #fff;
  430. border-radius: 8px;
  431. margin: 16px;
  432. .userCell-item{
  433. display: flex;
  434. justify-content: space-between;
  435. align-items: center;
  436. padding: 16px;
  437. .userCell-title{
  438. display: flex;
  439. align-items: center;
  440. p{
  441. margin-left: 8px;
  442. }
  443. }
  444. span{
  445. color:#999;
  446. }
  447. }
  448. }
  449. .userInfo{
  450. // background-color: #fff;
  451. background: linear-gradient(#fff2eb,#ffffff);
  452. margin: 16px;
  453. padding: 16px;
  454. border-radius: 8px;
  455. p{
  456. color:#637AA2;
  457. }
  458. .userInfo-main2{
  459. width: 100%;
  460. margin-top: 4px;
  461. align-items: center;
  462. h2{
  463. flex: 1;
  464. font-size: 44rpx;
  465. }
  466. }
  467. .userInfo-main{
  468. display: flex;
  469. justify-content: space-between;
  470. margin-top: 4px;
  471. align-items: center;
  472. h2{
  473. flex: 1;
  474. font-size: 64rpx;
  475. display: flex;
  476. justify-content: space-between;
  477. .withdraw{
  478. margin: auto 0;
  479. width: 80px;
  480. height:30px;
  481. line-height: 28px;
  482. border-radius: 20px;
  483. background-color: rgba(255, 133, 1, 100);
  484. color: rgba(255, 255, 255, 100);
  485. font-size: 14px;
  486. text-align: center;
  487. }
  488. }
  489. }
  490. .userInfo-btn{
  491. padding: 6px 10px;
  492. background-color: #FF8501;
  493. color:#fff;
  494. border-radius: 15px;
  495. }
  496. .userInfo-foot{
  497. display: flex;
  498. justify-content: space-between;
  499. margin-top: 12px;
  500. .userInfo-item{
  501. flex: 1;
  502. h4{
  503. font-size: 16px;
  504. margin-top: 4px;
  505. }
  506. }
  507. }
  508. }
  509. .userHead{
  510. display: flex;
  511. align-items: center;
  512. padding:40px 20px 0;
  513. .userHead-img{
  514. }
  515. .userHead-text{
  516. margin-left: 12px;
  517. h3{
  518. font-size: 24px;
  519. color:#fff;
  520. font-weight: normal;
  521. }
  522. .userHead-text-position{
  523. display: flex;
  524. align-items: center;
  525. margin-top: 5px;
  526. p{
  527. color:#fff;
  528. margin-left: 4px;
  529. }
  530. }
  531. }
  532. }
  533. .userData{
  534. background-color: #fff;
  535. margin: 16px;
  536. padding: 16px;
  537. border-radius: 8px;
  538. display: flex;
  539. }
  540. .userData-item{
  541. flex: 1;
  542. display: flex;
  543. flex-direction: column;
  544. align-items: center;
  545. justify-content:space-between;
  546. .userData-data{
  547. font-size: 24px;
  548. font-weight: bold;
  549. }
  550. .userData-name{
  551. font-size: 16px;
  552. }
  553. .userData-foot{
  554. margin-top: 4px;
  555. color:#637AA2;
  556. }
  557. }
  558. //功能菜单
  559. .function-menu{
  560. margin: 12px 16px;
  561. background-color: #fff;
  562. border-radius: 8px;
  563. padding: 0 13px;
  564. display: flex;
  565. flex-wrap: wrap;
  566. }
  567. //功能菜单
  568. .function-menu2{
  569. background-color: #fff;
  570. margin: 12px 16px;
  571. border-radius: 8px;
  572. padding: 0 13px;
  573. }
  574. .function-menu3{
  575. display: flex;
  576. flex-wrap: wrap;
  577. }
  578. @media screen and (max-width: 375px) {
  579. .item {
  580. width: 33% !important;
  581. }
  582. }
  583. .item{
  584. min-width: 25%;
  585. margin-top: 20px;
  586. margin-bottom: 11px;
  587. display: flex;
  588. flex-direction: column;
  589. align-items: center;
  590. color: rgba(119, 119, 119, 100);
  591. i{
  592. font-size: 24px
  593. }
  594. .item-name{
  595. font-size: 14px;
  596. margin-top: 8px;
  597. }
  598. }
  599. .logout-btn{
  600. background-color: #fff;
  601. margin: 12px 16px;
  602. border: 8px;
  603. color: rgba(238, 49, 56, 100);
  604. font-size: 16px;
  605. line-height: 40px;
  606. }
  607. .position {
  608. position: relative;
  609. top: -75px;
  610. //left: 24%;
  611. height: 0px;
  612. z-index: 999;
  613. }
  614. #talkbubble {
  615. position: absolute;
  616. top: 0;
  617. left: 0;
  618. padding: 1px 20rpx;
  619. line-height: 40rpx;
  620. font-size: 24rpx;
  621. color: #fff;
  622. background: red;
  623. position: relative;
  624. border-radius: 10px;
  625. text-align: center;
  626. }
  627. #talkbubble:before {
  628. content: "";
  629. position: absolute;
  630. top: 100%;
  631. right: 20%;
  632. border-top: 5px solid red;
  633. border-right: 5px solid transparent;
  634. border-left: 5px solid transparent;
  635. }
  636. </style>