index.vue 14 KB

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