index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <view>
  3. <ujp-picker mode="selector" v-model="isswitchshow" :range="columns" range-key="label" :default-selector="columnsindex" @confirm="switchBtn" ></ujp-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/coupon/index?c=0')" v-if="info.accountType==1" >
  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 class="item" @click="gotoUrl('pagesFinance/MyInvoice/settlement?id='+item.entAccountId)">
  192. <view class="item-icon">
  193. <img src="../../assets/img/riLine-checkbox-multiple-line.svg" alt="">
  194. </view>
  195. <view class="item-name">
  196. 财务结算
  197. </view>
  198. </view>
  199. <view class="item" @click="gotoUrl('pagesFinance/MyInvoice/invoiceManagement?id='+item.entAccountId)">
  200. <view class="item-icon">
  201. <img src="../../assets/img/riLine-ticket-2-line.svg" alt="">
  202. </view>
  203. <view class="item-name">
  204. 企业开票
  205. </view>
  206. </view>
  207. </view>
  208. </template>
  209. </view>
  210. <button class="logout-btn" @click="logout">退出账号</button>
  211. <Tabbar :current="3" ref="tabbarMain" ></Tabbar>
  212. </view>
  213. </template>
  214. <script>
  215. import Tabbar from '@/components/TabbarFinance.vue'
  216. import * as API from '@/apis/finance.js'
  217. import {
  218. substrMb
  219. } from '@/utils'
  220. export default {
  221. data() {
  222. return {
  223. columns:[],
  224. isWithdrawal:false,
  225. isswitchshow:false,
  226. isswitch:false,
  227. tel:'400-8899-619',
  228. role:{},
  229. info:{},
  230. home:null,
  231. current: 0,
  232. vipPlatformList:[],
  233. vipPlatformList1:[],
  234. vipPlatformList2:[],
  235. columnsindex:[0],
  236. background:{
  237. background: 'none'
  238. },
  239. }
  240. },
  241. components: {
  242. Tabbar
  243. },
  244. computed:{
  245. accountType(){
  246. if(this.accountType8){
  247. return false
  248. }
  249. return true
  250. },
  251. accountType8(){
  252. if(this.info&&(this.info.accountTopics==2||this.info.accountTopics==3)){
  253. return true
  254. }else
  255. return false
  256. }
  257. },
  258. onLoad() {
  259. this.info=this.carhelp.getPersonInfo()
  260. if(process.env.NODE_ENV === "development"){
  261. this.isWithdrawal=true
  262. }
  263. },
  264. onReady() {
  265. //this.getHomePage()
  266. },
  267. onShow() {
  268. if(this.$refs.tabbarMain){
  269. this.$refs.tabbarMain.setcount();
  270. }
  271. this.query()
  272. this.getHomePage()
  273. },
  274. methods: {
  275. switchBtn(e){
  276. var obj=this.columns[e[0]]
  277. uni.showLoading({
  278. title: "加载中",
  279. mask: true,
  280. })
  281. API.switchUser({
  282. newUserId:obj.value
  283. }).then((response) => {
  284. uni.hideLoading();
  285. this.query(true)
  286. }).catch(error => {
  287. uni.hideLoading();
  288. })
  289. //
  290. },
  291. query(bl){
  292. uni.showLoading({
  293. title: "加载中",
  294. mask: true,
  295. })
  296. API.findByOpenId({
  297. openId: this.carhelp.getOpenId(),
  298. }).then((response) => {
  299. //this.loginset(response)
  300. var token = response ? response.data.token : '';
  301. this.carhelp.setToken(token);
  302. this.carhelp.setPersonInfo(response.data.user);
  303. this.carhelp.setPersonInfoPlus(response.data)
  304. this.info=response.data.user
  305. this.isswitch=response.data.haveOtherUser;
  306. if(this.isswitch){
  307. this.allUserList()
  308. }
  309. if(bl){
  310. this.getHomePage()
  311. }
  312. if(this.$refs.tabbarMain){
  313. this.$refs.tabbarMain.relist();
  314. }
  315. uni.hideLoading();
  316. }).catch(error => {
  317. uni.hideLoading();
  318. })
  319. },
  320. allUserList(){
  321. API.allUserList({
  322. }).then((response) => {
  323. var list=response.data.allUserList;
  324. this.columns=[]
  325. for(var i in list){
  326. var obj=list[i]
  327. if(obj.isCurrentUser){
  328. this.columnsindex=[i]
  329. }
  330. this.columns.push({
  331. value:obj.id,
  332. label:obj.merchantAccountName
  333. })
  334. }
  335. }).catch(error => {
  336. uni.hideLoading();
  337. })
  338. },
  339. getPhone(phone){
  340. var backphone="";
  341. if(phone){
  342. backphone=substrMb(phone,0,3)+"****"+substrMb(phone,7,4)
  343. }
  344. return backphone;
  345. },
  346. showModel(){
  347. var bankCard="";
  348. var sss=""
  349. if(this.home.bankCard){
  350. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,this.home.bankCard.length-4,4)
  351. }
  352. var code=this.home.bank+":"+bankCard;
  353. if(this.home.bank==null&&this.home.bankCard==null){
  354. code="未绑定"
  355. }
  356. uni.showModal({
  357. showCancel:false,
  358. content:code,
  359. })
  360. },
  361. logoutApi(){
  362. uni.showLoading({
  363. title: "加载中",
  364. mask: true,
  365. })
  366. var data = {
  367. };
  368. API.logout(data).then((res) => {
  369. this.carhelp.setToken("");
  370. this.carhelp.set("merchantUser_token_tdate","")
  371. this.carhelp.setPersonInfo("");
  372. this.carhelp.setPersonInfoPlus("" )
  373. uni.reLaunch({
  374. url:"/pagesFinance/login/index?phone="+this.info.phone
  375. })
  376. }).catch(error => {
  377. uni.showToast({
  378. title: error
  379. })
  380. })
  381. },
  382. logout(){
  383. uni.showModal({
  384. title: '提示',
  385. content: '确认是否退出?',
  386. success: res=> {
  387. if (res.confirm) {
  388. //付钱 改为组件
  389. this.logoutApi();
  390. } else if (res.cancel) {
  391. console.log('用户点击取消');
  392. }
  393. }
  394. });
  395. },
  396. phone(){
  397. uni.makePhoneCall({
  398. phoneNumber:this.tel //仅为示例
  399. });
  400. },
  401. getHomePage(){
  402. uni.showLoading({
  403. title: "加载中",
  404. mask: true,
  405. })
  406. API.homePage().then((res) => {
  407. this.home = res.data
  408. if(res.data.vipPlatformList){
  409. this.vipPlatformList=res.data.vipPlatformList
  410. //this.vipPlatformList1
  411. this.vipPlatformList.forEach(item=>{
  412. if(item.entAccountId){
  413. this.vipPlatformList1.push(item)
  414. }else{
  415. this.vipPlatformList2.push(item)
  416. }
  417. })
  418. }
  419. uni.hideLoading()
  420. }).catch(error => {
  421. uni.showToast({
  422. title: error
  423. })
  424. })
  425. }
  426. }
  427. }
  428. </script>
  429. <style>
  430. page{
  431. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  432. background-size: 100%;
  433. }
  434. </style>
  435. <style lang="scss" scoped>
  436. .navbar-tit {
  437. color: #fff;
  438. font-size: 18px;
  439. text-align: right;
  440. width: 100%;
  441. padding-top: 3px;
  442. padding-right: 3px;
  443. }
  444. .userCell{
  445. background-color: #fff;
  446. border-radius: 8px;
  447. margin: 16px;
  448. .userCell-item{
  449. display: flex;
  450. justify-content: space-between;
  451. align-items: center;
  452. padding: 16px;
  453. .userCell-title{
  454. display: flex;
  455. align-items: center;
  456. p{
  457. margin-left: 8px;
  458. }
  459. }
  460. span{
  461. color:#999;
  462. }
  463. }
  464. }
  465. .userInfo{
  466. // background-color: #fff;
  467. background: linear-gradient(#fff2eb,#ffffff);
  468. margin: 16px;
  469. padding: 16px;
  470. border-radius: 8px;
  471. p{
  472. color:#637AA2;
  473. }
  474. .userInfo-main2{
  475. width: 100%;
  476. margin-top: 4px;
  477. align-items: center;
  478. h2{
  479. flex: 1;
  480. font-size: 44rpx;
  481. }
  482. }
  483. .userInfo-main{
  484. display: flex;
  485. justify-content: space-between;
  486. margin-top: 4px;
  487. align-items: center;
  488. h2{
  489. flex: 1;
  490. font-size: 64rpx;
  491. display: flex;
  492. justify-content: space-between;
  493. .withdraw{
  494. margin: auto 0;
  495. width: 80px;
  496. height:30px;
  497. line-height: 28px;
  498. border-radius: 20px;
  499. background-color: rgba(255, 133, 1, 100);
  500. color: rgba(255, 255, 255, 100);
  501. font-size: 14px;
  502. text-align: center;
  503. }
  504. }
  505. }
  506. .userInfo-btn{
  507. padding: 6px 10px;
  508. background-color: #FF8501;
  509. color:#fff;
  510. border-radius: 15px;
  511. }
  512. .userInfo-foot{
  513. display: flex;
  514. justify-content: space-between;
  515. margin-top: 12px;
  516. .userInfo-item{
  517. flex: 1;
  518. h4{
  519. font-size: 16px;
  520. margin-top: 4px;
  521. }
  522. }
  523. }
  524. }
  525. .userHead{
  526. display: flex;
  527. align-items: center;
  528. padding:40px 20px 0;
  529. .userHead-img{
  530. }
  531. .userHead-text{
  532. margin-left: 12px;
  533. h3{
  534. font-size: 24px;
  535. color:#fff;
  536. font-weight: normal;
  537. }
  538. .userHead-text-position{
  539. display: flex;
  540. align-items: center;
  541. margin-top: 5px;
  542. p{
  543. color:#fff;
  544. margin-left: 4px;
  545. }
  546. }
  547. }
  548. }
  549. .userData{
  550. background-color: #fff;
  551. margin: 16px;
  552. padding: 16px;
  553. border-radius: 8px;
  554. display: flex;
  555. }
  556. .userData-item{
  557. flex: 1;
  558. display: flex;
  559. flex-direction: column;
  560. align-items: center;
  561. justify-content:space-between;
  562. .userData-data{
  563. font-size: 24px;
  564. font-weight: bold;
  565. }
  566. .userData-name{
  567. font-size: 16px;
  568. }
  569. .userData-foot{
  570. margin-top: 4px;
  571. color:#637AA2;
  572. }
  573. }
  574. //功能菜单
  575. .function-menu{
  576. margin: 12px 16px;
  577. background-color: #fff;
  578. border-radius: 8px;
  579. padding: 0 13px;
  580. display: flex;
  581. flex-wrap: wrap;
  582. }
  583. //功能菜单
  584. .function-menu2{
  585. background-color: #fff;
  586. margin: 12px 16px;
  587. border-radius: 8px;
  588. padding: 0 13px;
  589. }
  590. .function-menu3{
  591. display: flex;
  592. flex-wrap: wrap;
  593. }
  594. @media screen and (max-width: 375px) {
  595. .item {
  596. width: 33% !important;
  597. }
  598. }
  599. .item{
  600. min-width: 25%;
  601. margin-top: 20px;
  602. margin-bottom: 11px;
  603. display: flex;
  604. flex-direction: column;
  605. align-items: center;
  606. color: rgba(119, 119, 119, 100);
  607. i{
  608. font-size: 24px
  609. }
  610. .item-name{
  611. font-size: 14px;
  612. margin-top: 8px;
  613. }
  614. }
  615. .logout-btn{
  616. background-color: #fff;
  617. margin: 12px 16px;
  618. border: 8px;
  619. color: rgba(238, 49, 56, 100);
  620. font-size: 16px;
  621. line-height: 40px;
  622. }
  623. .position {
  624. position: relative;
  625. top: -75px;
  626. //left: 24%;
  627. height: 0px;
  628. z-index: 999;
  629. }
  630. #talkbubble {
  631. position: absolute;
  632. top: 0;
  633. left: 0;
  634. padding: 1px 20rpx;
  635. line-height: 40rpx;
  636. font-size: 24rpx;
  637. color: #fff;
  638. background: red;
  639. position: relative;
  640. border-radius: 10px;
  641. text-align: center;
  642. }
  643. #talkbubble:before {
  644. content: "";
  645. position: absolute;
  646. top: 100%;
  647. right: 20%;
  648. border-top: 5px solid red;
  649. border-right: 5px solid transparent;
  650. border-left: 5px solid transparent;
  651. }
  652. </style>