index.vue 14 KB

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