index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view>
  3. <u-navbar title-color="#fff" :custom-back="customBack" :border-bottom="false" back-icon-color="#CCE8FF" :background="{background: '#008CFF' }" title="我的"></u-navbar>
  4. <view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
  5. <view class="u-m-r-24" @click="clickHead">
  6. <u-avatar :src="userInfo.headImgUrl || userInfo.avatar||pic" size="140"></u-avatar>
  7. </view>
  8. <view class="u-flex-1" @click="login($store.state.vuex_hasLogin)">
  9. <view class="u-font-18 u-p-b-20">{{ userInfo.nickname || userInfo.userName || '请登录' }}</view>
  10. <view class="u-font-14">手机号:{{ userInfo.mobile || '暂无' }}</view>
  11. </view>
  12. <!-- <view class="u-m-l-10 u-p-10">
  13. <u-icon name="arrow-right" color="#fff" size="28"></u-icon>
  14. </view> -->
  15. </view>
  16. <view class="u-m-t-20">
  17. <u-cell-group>
  18. <!-- <u-cell-item title="贵州银行支付" @click="guizhouPay()">
  19. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
  20. </u-cell-item> -->
  21. <u-cell-item title="我的车辆" @click="openPage('pages/myCars/myCars')">
  22. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
  23. </u-cell-item>
  24. <u-cell-item title="停车记录" @click="openPage('pages/center/order/order')">
  25. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="tingchejilu"></u-icon>
  26. </u-cell-item>
  27. </u-cell-group>
  28. </view>
  29. <view class="u-m-t-20">
  30. <u-cell-group>
  31. <!-- <u-cell-item title="充值" @click="openPage('pages/myCars/myCars')">
  32. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="chongzhi"></u-icon>
  33. </u-cell-item> -->
  34. <u-cell-item title="包月" @click="openPage('pages/center/monthly/monthly')">
  35. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="baoyue"></u-icon>
  36. </u-cell-item>
  37. <!-- <u-cell-item title="提现" @click="openPage('pages/center/order/order')">
  38. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="tixian"></u-icon>
  39. </u-cell-item> -->
  40. <!-- <u-cell-item title="退款" @click="openPage('pages/center/order/order')">
  41. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="tuikuan"></u-icon>
  42. </u-cell-item> -->
  43. <!-- <u-cell-item title="账单记录" @click="openPage('pages/center/order/order')">
  44. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="zhangdanjilu"></u-icon>
  45. </u-cell-item> -->
  46. </u-cell-group>
  47. </view>
  48. <!-- <view class="u-m-t-20">
  49. <u-cell-group>
  50. <u-cell-item title="我的优惠" @click="openPage('pages/myCars/myCars')">
  51. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodeyouhui"></u-icon>
  52. </u-cell-item>
  53. </u-cell-group>
  54. </view> -->
  55. <!-- <view class="u-m-t-20">
  56. <u-cell-group>
  57. <u-cell-item title="发票管理" @click="openPage('pages/center/invoice/invoice')">
  58. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="fapiaoguanli"></u-icon>
  59. </u-cell-item>
  60. </u-cell-group>
  61. </view> -->
  62. <view class="u-m-t-20">
  63. <u-cell-group>
  64. <u-cell-item title="消息中心" @click="openPage('pages/message/message')">
  65. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="xiaoxi"></u-icon>
  66. </u-cell-item>
  67. </u-cell-group>
  68. </view>
  69. <view class="u-m-t-20 u-m-b-40">
  70. <u-cell-group>
  71. <u-cell-item title="拨打客服电话" @click="phoneCall(phoneNo)">
  72. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="dianhua"></u-icon>
  73. </u-cell-item>
  74. </u-cell-group>
  75. </view>
  76. <!-- <view class="u-m-t-20">
  77. <u-cell-group>
  78. <u-cell-item icon="phone" title="手机号登录" @click="openPage('/pages/center/phoneLogin/phoneLogin')"></u-cell-item>
  79. </u-cell-group>
  80. </view> -->
  81. <!-- 登出提示-->
  82. <u-modal
  83. v-model="logoutPop"
  84. :title-style="{color: '#404040'}"
  85. title="登出提示"
  86. :show-confirm-button="true"
  87. confirm-text="确认"
  88. :confirm-style="{backgroundColor: '#3397FA', color: '#fff'}"
  89. :show-cancel-button="true"
  90. cancel-text="取消"
  91. @cancel="logoutPop = false"
  92. :cancel-style="{backgroundColor: '#EBF1FF', color: '#3397FA'}"
  93. @confirm="loginOut">
  94. <view class="slot-content">
  95. <view class="pay-tips">你确认退出登录吗?</view>
  96. </view>
  97. </u-modal>
  98. <u-toast ref="uToast" />
  99. </view>
  100. </template>
  101. <script>
  102. import getUrlParams from "../../utils/getUrlParams.js";
  103. import {config} from "./../../common/config"
  104. export default {
  105. data() {
  106. return {
  107. pic:'/static/img/default-avatar.png',
  108. userInfo:[],
  109. code:null,
  110. phoneNo:'114',
  111. logoutPop: false
  112. }
  113. },
  114. onLoad() {
  115. },
  116. onShow() {
  117. if(this.$store.state.vuex_hasLogin){
  118. this.userInfo = this.$store.state.vuex_user;
  119. if(this.$store.state.vuex_wxinfo){
  120. this.userInfo = Object.assign(this.userInfo,this.$store.state.vuex_wxinfo);
  121. }
  122. }else{
  123. this.userInfo = [];
  124. };
  125. let locationLocaturl = window.location.search;
  126. this.code = getUrlParams(locationLocaturl,"code");
  127. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  128. },
  129. methods: {
  130. openPage(path) {
  131. console.log('path',path);
  132. this.$u.route({
  133. url: path
  134. })
  135. },
  136. //登录判断
  137. login(status){
  138. console.log('this.$store.state.vuex_hasLogin',this.$store.state.vuex_hasLogin);
  139. if(!status){
  140. console.log('config',this.config);
  141. this.$u.route({
  142. url: 'pages/center/phoneLogin/phoneLogin'
  143. });
  144. }
  145. },
  146. customBack(){
  147. this.$u.route({
  148. type:'switchTab',
  149. url: 'pages/index/index'
  150. });
  151. },
  152. phoneCall(phone){
  153. uni.makePhoneCall({
  154. phoneNumber: phone
  155. });
  156. },
  157. loginOut() {
  158. setTimeout(() => {
  159. this.$store.state.vuex_hasLogin = false
  160. this.$store.state.vuex_token = ''
  161. this.$store.state.vuex_user = null
  162. this.userInfo = []
  163. this.code = ''
  164. localStorage.clear()
  165. this.logoutPop = false
  166. // location.href = config.jumpLoginUrl
  167. uni.navigateTo({
  168. url: '/pages/center/phoneLogin/phoneLogin'
  169. })
  170. }, 500)
  171. },
  172. clickHead() {
  173. if (this.$store.state.vuex_hasLogin) {
  174. this.logoutPop = true
  175. }
  176. }
  177. // 贵州银行支付
  178. // guizhouPay(){
  179. // let tradeNo = new Date().getTime();
  180. // uni.setStorage({
  181. // key:'gzbankTradeNo',
  182. // data:tradeNo
  183. // });
  184. // this.$u.api.gzbank({orderId:tradeNo,openid:'111'})
  185. // .then(res=>{
  186. // let bankLink = res.msg;
  187. // location.href = bankLink;
  188. // }).catch(err=>{
  189. // console.log('gzbank err',err);
  190. // });
  191. // },// 贵州银行支付
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. page{background-color: $my-page-bg-color;}
  197. .user-box{
  198. position: relative;
  199. background-color: $my-main-color;
  200. color: #fff;
  201. &:after{
  202. position: absolute;
  203. right: 0;
  204. bottom: 0;
  205. content: '';
  206. background: url(../../static/img/center-top-bg.png) no-repeat;
  207. background-position: -90rpx 0;
  208. width: 305rpx;
  209. height: 145rpx;
  210. z-index: 999;
  211. }
  212. }
  213. .u-avatar{border: 10rpx solid #4CAEFF;}
  214. .u-cell-box /deep/ .u-cell__left-icon-wrap,
  215. .u-cell-box /deep/ .custom-icon
  216. {color: $my-main-color;margin-right: 10rpx;}
  217. .pay-tips {text-align: center;margin: 30rpx 0;}
  218. </style>