index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view>
  3. <view class="userHead" v-if="userId != ''" @click="toData">
  4. <view class="userHead-img">
  5. <u-avatar :src="headImg" size="96"></u-avatar>
  6. </view>
  7. <view class="userHead-text">
  8. <h3>{{userPhone}}</h3>
  9. </view>
  10. </view>
  11. <view class="userHead" v-else>
  12. <view class="userHead-img">
  13. <u-avatar src="../../assets/img/head.png" size="96"></u-avatar>
  14. </view>
  15. <view class="userHead-text">
  16. <h3>点击登录/注册</h3>
  17. </view>
  18. </view>
  19. <view class="userData">
  20. <view class="userData-num" @click="toBalance">
  21. <view class="userData-data">¥ 0.00</view>
  22. <view class="userData-foot">可用余额</view>
  23. </view>
  24. <view class="userInfo-btn" @click="toRecharge">充值</view>
  25. </view>
  26. <view class="userCell">
  27. <view class="userCell-item" @click="carManage">
  28. <view class="userCell-title">
  29. <u-icon name="menu_cwcl" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  30. <p>车辆管理</p>
  31. </view>
  32. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  33. </view>
  34. <view class="userCell-item" @click="gotoUrl('pages/user/help')">
  35. <view class="userCell-title">
  36. <u-icon name="compass-3-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  37. <p>操作指南</p>
  38. </view>
  39. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  40. </view>
  41. <view class="userCell-item" @click="feedback">
  42. <view class="userCell-title">
  43. <u-icon name="feedback-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  44. <p>意见反馈</p>
  45. </view>
  46. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  47. </view>
  48. <view class="userCell-item" @click="gotoUrl('pages/user/about')">
  49. <view class="userCell-title">
  50. <u-icon name="information-fill" custom-prefix="custom-icon" color="#6BC6A7" 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="openModal">
  56. <view class="userCell-title">
  57. <u-icon name="customer-service-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  58. <p>联系客服</p>
  59. </view>
  60. <span>0716-8123456</span>
  61. </view>
  62. <view>
  63. <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
  64. :asyncClose="true" :title="title" :content="content"></u-modal>
  65. </view>
  66. <view class="userCell-item" @click="setUp">
  67. <view class="userCell-title">
  68. <u-icon name="settings-4-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
  69. <p>设置</p>
  70. </view>
  71. <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
  72. </view>
  73. </view>
  74. <Tabbar :current="2"></Tabbar>
  75. </view>
  76. </template>
  77. <script>
  78. import Tabbar from '@/components/Tabbar.vue'
  79. export default {
  80. components: {
  81. Tabbar
  82. },
  83. data() {
  84. return {
  85. userId: '',
  86. headImg: '',
  87. userPhone: '',
  88. show: false,
  89. title: '联系客服',
  90. content: '0716-8123456',
  91. confirmText: '拨打电话',
  92. background:{
  93. background: 'none'
  94. },
  95. }
  96. },
  97. onReady() {
  98. if(this.carhelp.getPersonInfo() != null) {
  99. this.userId = this.carhelp.getPersonInfo().id;
  100. this.headImg = this.carhelp.getPersonInfo().headImg;
  101. var phone = this.carhelp.getPersonInfo().phone;
  102. var phone1 = phone.slice(0,3);
  103. var phone2 = phone.slice(-4);
  104. this.userPhone = phone1 + '****' + phone2;
  105. }
  106. },
  107. methods: {
  108. toData() {
  109. if(this.userId != '') {
  110. uni.navigateTo({
  111. url: '/pages/user/data'
  112. })
  113. } else {
  114. uni.redirectTo({
  115. url: '/pages/login/login'
  116. })
  117. }
  118. },
  119. toBalance() {
  120. if(this.userId != '') {
  121. uni.navigateTo({
  122. url: '/pages/user/finance/balance'
  123. })
  124. } else {
  125. uni.redirectTo({
  126. url: '/pages/login/login'
  127. })
  128. }
  129. },
  130. toRecharge() {
  131. if(this.userId != '') {
  132. uni.navigateTo({
  133. url: '/pages/user/finance/recharge'
  134. })
  135. } else {
  136. uni.redirectTo({
  137. url: '/pages/login/login'
  138. })
  139. }
  140. },
  141. carManage() {
  142. if(this.userId != '') {
  143. uni.navigateTo({
  144. url: '/pages/user/car/index'
  145. })
  146. } else {
  147. uni.redirectTo({
  148. url: '/pages/login/login'
  149. })
  150. }
  151. },
  152. feedback() {
  153. if(this.userId != '') {
  154. uni.navigateTo({
  155. url: '/pages/user/message'
  156. })
  157. } else {
  158. uni.redirectTo({
  159. url: '/pages/login/login'
  160. })
  161. }
  162. },
  163. setUp() {
  164. if(this.userId != '') {
  165. uni.navigateTo({
  166. url: '/pages/user/setting'
  167. })
  168. } else {
  169. uni.redirectTo({
  170. url: '/pages/login/login'
  171. })
  172. }
  173. },
  174. openModal() {
  175. this.show = true;
  176. },
  177. confirmPhone(){
  178. this.show = false;
  179. uni.makePhoneCall({
  180. phoneNumber:'0716-8123456' //仅为示例
  181. });
  182. },
  183. }
  184. }
  185. </script>
  186. <style>
  187. page{
  188. background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
  189. background-size: 100%;
  190. }
  191. </style>
  192. <style lang="scss" scoped>
  193. .userCell{
  194. background-color: #fff;
  195. border-radius: 8px;
  196. margin: 16px;
  197. .userCell-item{
  198. display: flex;
  199. justify-content: space-between;
  200. align-items: center;
  201. padding: 16px;
  202. .userCell-title{
  203. display: flex;
  204. align-items: center;
  205. p{
  206. margin-left: 8px;
  207. }
  208. }
  209. span{
  210. color:#999;
  211. }
  212. }
  213. }
  214. .userHead{
  215. display: flex;
  216. align-items: center;
  217. align-items: center;
  218. padding:40px 20px 0;
  219. .userHead-img{
  220. }
  221. .userHead-text{
  222. margin-left: 12px;
  223. h3{
  224. font-size: 20px;
  225. color:#fff;
  226. font-weight: normal;
  227. }
  228. }
  229. }
  230. .userData{
  231. background-color: #fff;
  232. margin: 16px;
  233. padding: 16px 24px;
  234. border-radius: 8px;
  235. display: flex;
  236. align-items: center;
  237. justify-content: space-between;
  238. }
  239. .userData-num{
  240. display: flex;
  241. flex-direction: column;
  242. align-items: center;
  243. justify-content:space-between;
  244. padding-left: 30px;
  245. .userData-data{
  246. font-size: 24px;
  247. }
  248. .userData-name{
  249. font-size: 16px;
  250. }
  251. .userData-foot{
  252. margin-top: 4px;
  253. color:#999;
  254. font-size: 12px;
  255. }
  256. }
  257. .userInfo-btn{
  258. padding: 6px 30px;
  259. background-color: #00B962;
  260. color:#fff;
  261. border-radius: 15px;
  262. }
  263. </style>