index.vue 6.8 KB

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