index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view>
  3. <view class="userHead">
  4. <view class="userHead-img">
  5. <u-avatar src="../../assets/img/head.png" size="140"></u-avatar>
  6. </view>
  7. <view class="userHead-text">
  8. <h3>{{info.realName}}</h3>
  9. <view class="userHead-text-position">
  10. <u-icon name="account-pin-box-fill" custom-prefix="custom-icon" color="#fff" size="32"></u-icon>
  11. <p>{{role.name}}</p>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="userData">
  16. <view class="userData-item">
  17. <view class="userData-data">{{home.deviceNumbers}}</view>
  18. <view class="userData-foot" @click="gotoUrl('pagesFinance/user/deviceList')" >我的充电桩</view>
  19. </view>
  20. <u-line color="#d9e0ec" length="60" direction="col" margin="10px"/>
  21. <view class="userData-item">
  22. <view class="userData-name">银行账户</view>
  23. <view class="userData-foot" @click="showModel" >提现账户</view>
  24. </view>
  25. </view>
  26. <view class="userInfo">
  27. <view class="userInfo-head"><p>可提现金额</p></view>
  28. <view class="userInfo-main">
  29. <h2>{{home.accountBalance}}</h2>
  30. <view class="userInfo-btn" @click="gotoUrl('pagesFinance/user/withdraw')">帐户提现</view>
  31. </view>
  32. <view class="userInfo-foot">
  33. <!-- <view class="userInfo-item">
  34. <p>今日收益</p>
  35. <h4>{{home.todayAmount}}</h4>
  36. </view> -->
  37. <view class="userInfo-item">
  38. <p>冻结金额(提现中)</p>
  39. <h4>{{home.waitingAmount}}</h4>
  40. </view>
  41. <view class="userInfo-item">
  42. <p>已提现</p>
  43. <h4>{{home.withdrawnAmount}}</h4>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="userCell">
  48. <view class="userCell-item" @click="gotoUrl('pagesFinance/user/withdrawRecord')">
  49. <view class="userCell-title">
  50. <u-icon name="refund-fill" custom-prefix="custom-icon" color="#9EAAC6" size="36"></u-icon>
  51. <p>提现记录</p>
  52. </view>
  53. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  54. </view>
  55. <view class="userCell-item" @click="gotoUrl('pagesFinance/user/help')" >
  56. <view class="userCell-title">
  57. <u-icon name="question-fill" custom-prefix="custom-icon" color="#9EAAC6" size="36"></u-icon>
  58. <p>帮助中心</p>
  59. </view>
  60. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  61. </view>
  62. <view class="userCell-item" @click="phone()" >
  63. <view class="userCell-title">
  64. <u-icon name="customer-service-fill" custom-prefix="custom-icon" color="#9EAAC6" size="36"></u-icon>
  65. <p>联系客服</p>
  66. </view>
  67. <span>{{tel}}</span>
  68. </view>
  69. <!-- <view class="userCell-item" @click="gotoUrl('pagesFinance/user/about')">
  70. <view class="userCell-title">
  71. <u-icon name="information-fill" custom-prefix="custom-icon" color="#9EAAC6" size="36"></u-icon>
  72. <p>关于小鹏管家</p>
  73. </view>
  74. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  75. </view> -->
  76. <view class="userCell-item" @click="logout" >
  77. <view class="userCell-title">
  78. <u-icon name="logout-box-r-fill" custom-prefix="custom-icon" color="#9EAAC6" size="36"></u-icon>
  79. <p>帐号登出</p>
  80. </view>
  81. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  82. </view>
  83. </view>
  84. <Tabbar :current="2"></Tabbar>
  85. </view>
  86. </template>
  87. <script>
  88. import Tabbar from '@/components/TabbarFinance.vue'
  89. import * as API from '@/apis/finance.js'
  90. import {
  91. substrMb
  92. } from '@/utils'
  93. export default {
  94. data() {
  95. return {
  96. tel:'400-8899-619',
  97. role:{},
  98. info:{},
  99. home:{},
  100. current: 0,
  101. background:{
  102. background: 'none'
  103. },
  104. }
  105. },
  106. components: {
  107. Tabbar
  108. },
  109. onLoad() {
  110. this.info=this.carhelp.getPersonInfo("merchantUser")
  111. var obj=this.carhelp.getPersonInfoPlus("merchantUser");
  112. if(obj&&obj.role){
  113. this.role=obj.role;
  114. }
  115. console.log(this.info)
  116. },
  117. onReady() {
  118. this.getHomePage()
  119. },
  120. onShow() {
  121. this.getHomePage()
  122. },
  123. methods: {
  124. showModel(){
  125. var bankCard="";
  126. if(this.home.bankCard){
  127. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,8,4)
  128. }
  129. var code=this.home.bank+":"+bankCard;
  130. if(this.home.bank==null&&this.home.bankCard==null){
  131. code="未绑定"
  132. }
  133. uni.showModal({
  134. showCancel:false,
  135. content:code,
  136. })
  137. },
  138. logoutApi(){
  139. uni.showLoading({
  140. title: "加载中",
  141. mask: true,
  142. })
  143. var data = {
  144. };
  145. API.logout(data).then((res) => {
  146. this.carhelp.setToken("","merchantUser");
  147. this.carhelp.set("merchantUser_token_tdate","")
  148. this.carhelp.setPersonInfo("","merchantUser");
  149. this.carhelp.setPersonInfoPlus("" ,"merchantUser" )
  150. uni.reLaunch({
  151. url:"/pagesFinance/login/index?phone="+this.info.phone
  152. })
  153. }).catch(error => {
  154. uni.showToast({
  155. title: error
  156. })
  157. })
  158. },
  159. logout(){
  160. uni.showModal({
  161. title: '提示',
  162. content: '确认是否退出?',
  163. success: res=> {
  164. if (res.confirm) {
  165. //付钱 改为组件
  166. this.logoutApi();
  167. } else if (res.cancel) {
  168. console.log('用户点击取消');
  169. }
  170. }
  171. });
  172. },
  173. phone(){
  174. uni.makePhoneCall({
  175. phoneNumber:this.tel //仅为示例
  176. });
  177. },
  178. getHomePage(){
  179. uni.showLoading({
  180. title: "加载中",
  181. mask: true,
  182. })
  183. API.homePage().then((res) => {
  184. this.home = res.data
  185. uni.hideLoading()
  186. }).catch(error => {
  187. uni.showToast({
  188. title: error
  189. })
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style>
  196. page{
  197. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  198. background-size: 100%;
  199. }
  200. </style>
  201. <style lang="scss" scoped>
  202. .userCell{
  203. background-color: #fff;
  204. border-radius: 8px;
  205. margin: 16px;
  206. .userCell-item{
  207. display: flex;
  208. justify-content: space-between;
  209. align-items: center;
  210. padding: 16px;
  211. .userCell-title{
  212. display: flex;
  213. align-items: center;
  214. p{
  215. margin-left: 8px;
  216. }
  217. }
  218. span{
  219. color:#999;
  220. }
  221. }
  222. }
  223. .userInfo{
  224. background-color: #fff;
  225. margin: 16px;
  226. padding: 16px;
  227. border-radius: 8px;
  228. p{
  229. color:#637AA2;
  230. }
  231. .userInfo-main{
  232. display: flex;
  233. justify-content: space-between;
  234. margin-top: 4px;
  235. align-items: center;
  236. h2{
  237. font-size: 32px;
  238. }
  239. }
  240. .userInfo-btn{
  241. padding: 6px 10px;
  242. background-color: #FF8501;
  243. color:#fff;
  244. border-radius: 15px;
  245. }
  246. .userInfo-foot{
  247. display: flex;
  248. justify-content: space-between;
  249. margin-top: 12px;
  250. .userInfo-item{
  251. flex: 1;
  252. h4{
  253. font-size: 16px;
  254. margin-top: 4px;
  255. }
  256. }
  257. }
  258. }
  259. .userHead{
  260. display: flex;
  261. align-items: center;
  262. padding:40px 20px 0;
  263. .userHead-img{
  264. height: 74px;
  265. width: 74px;
  266. background-color: #fff;
  267. border-radius: 50%;
  268. padding: 2px;
  269. }
  270. .userHead-text{
  271. margin-left: 12px;
  272. h3{
  273. font-size: 24px;
  274. color:#fff;
  275. font-weight: normal;
  276. }
  277. .userHead-text-position{
  278. display: flex;
  279. align-items: center;
  280. margin-top: 5px;
  281. p{
  282. color:#fff;
  283. margin-left: 4px;
  284. }
  285. }
  286. }
  287. }
  288. .userData{
  289. background-color: #fff;
  290. margin: 16px;
  291. padding: 16px;
  292. border-radius: 8px;
  293. display: flex;
  294. }
  295. .userData-item{
  296. flex: 1;
  297. display: flex;
  298. flex-direction: column;
  299. align-items: center;
  300. justify-content:space-between;
  301. .userData-data{
  302. font-size: 24px;
  303. font-weight: bold;
  304. }
  305. .userData-name{
  306. font-size: 16px;
  307. }
  308. .userData-foot{
  309. margin-top: 4px;
  310. color:#637AA2;
  311. }
  312. }
  313. </style>