index.vue 12 KB

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