index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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.merchantAccountName}}</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>{{getPhone(info.phone)}}</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/stationsList')" >我的设备<span style="color: #307af6; margin-left: 5px;">查看</span></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" v-if="info.status" @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" ref="tabbarMain"></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. console.log(this.info)
  112. },
  113. onReady() {
  114. this.getHomePage()
  115. },
  116. onShow() {
  117. if(this.$refs.tabbarMain){
  118. this.$refs.tabbarMain.setcount(2);
  119. }
  120. this.getHomePage()
  121. },
  122. methods: {
  123. getPhone(phone){
  124. var backphone="";
  125. if(phone){
  126. backphone=substrMb(phone,0,3)+"****"+substrMb(phone,7,4)
  127. }
  128. return backphone;
  129. },
  130. showModel(){
  131. var bankCard="";
  132. if(this.home.bankCard){
  133. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,8,4)
  134. }
  135. var code=this.home.bank+":"+bankCard;
  136. if(this.home.bank==null&&this.home.bankCard==null){
  137. code="未绑定"
  138. }
  139. uni.showModal({
  140. showCancel:false,
  141. content:code,
  142. })
  143. },
  144. logoutApi(){
  145. uni.showLoading({
  146. title: "加载中",
  147. mask: true,
  148. })
  149. var data = {
  150. };
  151. API.logout(data).then((res) => {
  152. this.carhelp.setToken("","merchantUser");
  153. this.carhelp.set("merchantUser_token_tdate","")
  154. this.carhelp.setPersonInfo("","merchantUser");
  155. this.carhelp.setPersonInfoPlus("" ,"merchantUser" )
  156. uni.reLaunch({
  157. url:"/pagesFinance/login/index?phone="+this.info.phone
  158. })
  159. }).catch(error => {
  160. uni.showToast({
  161. title: error
  162. })
  163. })
  164. },
  165. logout(){
  166. uni.showModal({
  167. title: '提示',
  168. content: '确认是否退出?',
  169. success: res=> {
  170. if (res.confirm) {
  171. //付钱 改为组件
  172. this.logoutApi();
  173. } else if (res.cancel) {
  174. console.log('用户点击取消');
  175. }
  176. }
  177. });
  178. },
  179. phone(){
  180. uni.makePhoneCall({
  181. phoneNumber:this.tel //仅为示例
  182. });
  183. },
  184. getHomePage(){
  185. uni.showLoading({
  186. title: "加载中",
  187. mask: true,
  188. })
  189. API.homePage().then((res) => {
  190. this.home = res.data
  191. uni.hideLoading()
  192. }).catch(error => {
  193. uni.showToast({
  194. title: error
  195. })
  196. })
  197. }
  198. }
  199. }
  200. </script>
  201. <style>
  202. page{
  203. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  204. background-size: 100%;
  205. }
  206. </style>
  207. <style lang="scss" scoped>
  208. .userCell{
  209. background-color: #fff;
  210. border-radius: 8px;
  211. margin: 16px;
  212. .userCell-item{
  213. display: flex;
  214. justify-content: space-between;
  215. align-items: center;
  216. padding: 16px;
  217. .userCell-title{
  218. display: flex;
  219. align-items: center;
  220. p{
  221. margin-left: 8px;
  222. }
  223. }
  224. span{
  225. color:#999;
  226. }
  227. }
  228. }
  229. .userInfo{
  230. background-color: #fff;
  231. margin: 16px;
  232. padding: 16px;
  233. border-radius: 8px;
  234. p{
  235. color:#637AA2;
  236. }
  237. .userInfo-main{
  238. display: flex;
  239. justify-content: space-between;
  240. margin-top: 4px;
  241. align-items: center;
  242. h2{
  243. font-size: 32px;
  244. }
  245. }
  246. .userInfo-btn{
  247. padding: 6px 10px;
  248. background-color: #FF8501;
  249. color:#fff;
  250. border-radius: 15px;
  251. }
  252. .userInfo-foot{
  253. display: flex;
  254. justify-content: space-between;
  255. margin-top: 12px;
  256. .userInfo-item{
  257. flex: 1;
  258. h4{
  259. font-size: 16px;
  260. margin-top: 4px;
  261. }
  262. }
  263. }
  264. }
  265. .userHead{
  266. display: flex;
  267. align-items: center;
  268. padding:40px 20px 0;
  269. .userHead-img{
  270. }
  271. .userHead-text{
  272. margin-left: 12px;
  273. h3{
  274. font-size: 24px;
  275. color:#fff;
  276. font-weight: normal;
  277. }
  278. .userHead-text-position{
  279. display: flex;
  280. align-items: center;
  281. margin-top: 5px;
  282. p{
  283. color:#fff;
  284. margin-left: 4px;
  285. }
  286. }
  287. }
  288. }
  289. .userData{
  290. background-color: #fff;
  291. margin: 16px;
  292. padding: 16px;
  293. border-radius: 8px;
  294. display: flex;
  295. }
  296. .userData-item{
  297. flex: 1;
  298. display: flex;
  299. flex-direction: column;
  300. align-items: center;
  301. justify-content:space-between;
  302. .userData-data{
  303. font-size: 24px;
  304. font-weight: bold;
  305. }
  306. .userData-name{
  307. font-size: 16px;
  308. }
  309. .userData-foot{
  310. margin-top: 4px;
  311. color:#637AA2;
  312. }
  313. }
  314. </style>