index.vue 15 KB

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