123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <template>
- <view>
- <view class="userHead" v-if="userId != ''" @click="toData">
- <view class="userHead-img">
- <u-avatar :src="headImg" size="96"></u-avatar>
- </view>
- <view class="userHead-text">
- <h3>{{userPhone}}</h3>
- </view>
- </view>
- <view class="userHead" v-else>
- <view class="userHead-img">
- <u-avatar src="../../assets/img/head.png" size="96"></u-avatar>
- </view>
- <view class="userHead-text">
- <h3>点击登录/注册</h3>
- </view>
- </view>
- <view class="userData">
- <view class="userData-num" @click="toBalance">
- <view class="userData-data">¥ 0.00</view>
- <view class="userData-foot">可用余额</view>
- </view>
- <view class="userInfo-btn" @click="toRecharge">充值</view>
- </view>
-
- <view class="userCell">
- <view class="userCell-item" @click="carManage">
- <view class="userCell-title">
- <u-icon name="menu_cwcl" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>车辆管理</p>
- </view>
- <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- <view class="userCell-item" @click="gotoUrl('pages/user/help')">
- <view class="userCell-title">
- <u-icon name="compass-3-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>操作指南</p>
- </view>
- <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- <view class="userCell-item" @click="feedback">
- <view class="userCell-title">
- <u-icon name="feedback-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>意见反馈</p>
- </view>
- <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- <view class="userCell-item" @click="gotoUrl('pages/user/about')">
- <view class="userCell-title">
- <u-icon name="information-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>关于我们</p>
- </view>
- <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- <view class="userCell-item" @click="openModal">
- <view class="userCell-title">
- <u-icon name="customer-service-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>联系客服</p>
- </view>
- <span>0716-8123456</span>
- </view>
- <view>
- <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
- :asyncClose="true" :title="title" :content="content"></u-modal>
- </view>
- <view class="userCell-item" @click="setUp">
- <view class="userCell-title">
- <u-icon name="settings-4-fill" custom-prefix="custom-icon" color="#6BC6A7" size="36"></u-icon>
- <p>设置</p>
- </view>
- <u-icon name="arrow-right-s-line" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
- </view>
- </view>
-
- <Tabbar :current="2"></Tabbar>
- </view>
- </template>
- <script>
- import * as userApi from '@/apis/user.js'
- import * as loginApi from '@/apis/login.js'
- import Tabbar from '@/components/Tabbar.vue'
-
- export default {
- components: {
- Tabbar
- },
- data() {
- return {
- userId: '',
- headImg: '',
- userPhone: '',
- show: false,
- title: '联系客服',
- content: '0716-8123456',
- confirmText: '拨打电话',
- background:{
- background: 'none'
- },
- }
- },
- onReady() {
- if(this.carhelp.getPersonInfo() != null) {
- this.userId = this.carhelp.getPersonInfo().id;
- }
-
- this.getUserInfo();
- },
- methods: {
- getUserInfo() {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- loginApi.findByOpenId({
- openId: this.carhelp.getOpenId(),
- }).then((res) => {
- uni.hideLoading();
-
- this.headImg = res.data.regUser.headImg;
-
- var phone = res.data.regUser.phone;
- var phone1 = phone.slice(0,3);
- var phone2 = phone.slice(-4);
- this.userPhone = phone1 + '****' + phone2;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- toData() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/data'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- toBalance() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/finance/balance'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- toRecharge() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/finance/recharge'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- carManage() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/car/index'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- feedback() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/message'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- setUp() {
- if(this.userId != '') {
- uni.navigateTo({
- url: '/pages/user/setting'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- },
- openModal() {
- this.show = true;
- },
- confirmPhone(){
- this.show = false;
- uni.makePhoneCall({
- phoneNumber:'0716-8123456' //仅为示例
- });
- },
- }
- }
- </script>
- <style>
- page{
- background:url(../../assets/img/index_header_bg.png) no-repeat top center #f7f7f7;
- background-size: 100%;
- }
- </style>
- <style lang="scss" scoped>
- .userCell{
- background-color: #fff;
- border-radius: 8px;
- margin: 16px;
- .userCell-item{
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16px;
- .userCell-title{
- display: flex;
- align-items: center;
- p{
- margin-left: 8px;
- }
- }
- span{
- color:#999;
- }
- }
- }
-
- .userHead{
- display: flex;
- align-items: center;
- align-items: center;
- padding:40px 20px 0;
- .userHead-img{
- }
- .userHead-text{
- margin-left: 12px;
- h3{
- font-size: 20px;
- color:#fff;
- font-weight: normal;
- }
-
- }
- }
- .userData{
- background-color: #fff;
- margin: 16px;
- padding: 16px 24px;
- border-radius: 8px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .userData-num{
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content:space-between;
- padding-left: 30px;
- .userData-data{
- font-size: 24px;
- }
- .userData-name{
- font-size: 16px;
- }
- .userData-foot{
- margin-top: 4px;
- color:#999;
- font-size: 12px;
- }
- }
- .userInfo-btn{
- padding: 6px 30px;
- background-color: #00B962;
- color:#fff;
- border-radius: 15px;
- }
- </style>
|