index.vue 14 KB

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