mrr.sj.front/pages/artisan/my.vue

457 lines
9.5 KiB
Vue

<template>
<view class="my-page">
<custom-navbar title="个人中心"
:showBack="true"
backgroundColor="transparent"></custom-navbar>
<!-- 用户信息区域 -->
<view class="user-info">
<view class="user-header">
<view class="avatar-wrap">
<image class="avatar"
v-if="userInfo.head_photo"
:src="userInfo.head_photo"
mode="aspectFill"></image>
</view>
<view class="user-detail">
<view class="name-wrap">
<text class="name">{{userInfo.name}}</text>
<view v-if="artisanType == 1">
<view class="verified" v-if="userInfo.qualifications && userInfo.qualifications.length != 0">
<image src="/static/images/sign-red.png" class="sign-icon" mode="aspectFit"></image>
<text class="verified-text">已认证</text>
</view>
<view class="verified-no" v-else>
<image src="/static/images/sign-grew.png" class="sign-icon" mode="aspectFit"></image>
<text class="verified-text no">未认证</text>
</view>
</view>
</view>
</view>
<view class="edit-profile" @click="goArtisanProfile">
<text class="edit-text">编辑资料</text>
<text class="arrow">></text>
</view>
</view>
<!-- 数据卡片区域 -->
<view class="data-cards">
<view class="my-card" @click="navigateTo('/pages/wallet/wallet')">
<view class="card-content">
<text class="amount">{{userInfo.money}}元</text>
<view class="label-wrap">
<text class="label">钱包余额</text>
<text class="arrow">></text>
</view>
</view>
<image class="card-bg" src="/static/images/accout_bg.png" mode="aspectFill"></image>
</view>
<view class="my-card" @click="navigateTo('/pages/order/all-orders')">
<view class="card-content">
<text class="order">{{orderCount}}单</text>
<view class="label-wrap">
<text class="label">全部订单</text>
<text class="arrow">></text>
</view>
</view>
<image class="card-bg" src="/static/images/order_bg.png" mode="aspectFill"></image>
</view>
</view>
<!-- 购买服务 -->
<view class="" @click="navigateTo('/pages/shop/buy-service')">
购买服务
</view>
<view class="" @click="navigateTo('/pages/shop/buy-order')">
服务订单
</view>
<!-- 服务管理区域 -->
<view class="service-manage">
<view class="manage-header">
<view class="manage-info">
<text class="manage-title">服务管理</text>
<text class="manage-count">{{servicesCount}}</text>
<text class="manage-subtitle">已上架服务数量</text>
</view>
<view class="manage-btn" @click="navigateTo('/pages/artisan/service-list')">
<text class="btn-text">点击进入</text>
</view>
</view>
</view>
<!-- 功能列表 -->
<view class="function-list">
<!-- <view class="function-item" @click="navigateTo('/pages/ranking/index')">
<text class="function-text">排行榜</text>
<text class="arrow">></text>
</view> -->
<view class="function-item" @click="navigateTo('/pages/contact/contact')">
<text class="function-text">客服</text>
<text class="arrow">></text>
</view>
<!-- <view class="function-item" @click="navigateTo('/pages/share/syrandsjshare')">
<text class="function-text">分享</text>
<text class="arrow">></text>
</view> -->
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
artisanType: getApp().globalData.artisanType,
userInfo: {},
state: [3,4,5,6,7],
orderCount: 0,
servicesCount: 0
}
},
async onLoad() {
await this.getUserInfo();
await this.getAllOrders();
this.getServicesList();
},
onShow() {
this.getUserInfo();
this.getAllOrders();
this.getServicesList();
},
methods: {
goArtisanProfile() {
// uni.showToast({
// title: '该功能正在开发中,敬请期待',
// icon: 'none'
// })
uni.navigateTo({
url: '/pages/artisan/profile'
})
},
getUserInfo() {
const type = this.artisanType == 1 ? 2 : this.artisanType == 2 ? 3 : 1;
request.post('/user/getuser',{type}).then(result=>{
this.userInfo = result.data;
})
},
getAllOrders() {
request.post('/user/syrandsjorders',{state: this.state,type: this.artisanType}).then(res=>{
this.orderCount = res.count;
})
},
// 已上架服务数量
getServicesList() {
let url = null;
if(getApp().globalData.artisanType == 1) {
url = '/user/syrserverlist'
}else if(getApp().globalData.artisanType == 2) {
url = '/user/sjserverlist'
}
request.post(url,{state: 2}).then(res=>{
if(res.state == 1 ) {
this.servicesCount = res.data.length;
}else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
// 页面跳转
navigateTo(url) {
uni.navigateTo({
url
})
}
}
}
</script>
<style>
page {
background-color: #fff;
}
.my-page {
position: relative;
}
.my-page::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
height: 1200rpx !important;
background-image: url('/static/images/bg.png');
background-size: cover;
background-position: center top;
background-repeat: no-repeat;
z-index: 1;
}
.user-info {
padding: 0 24rpx;
position: relative;
z-index: 99;
margin-top: 32rpx;
}
.user-header {
display: flex;
align-items: center;
margin-bottom: 48rpx;
}
.avatar-wrap {
width: 128rpx;
height: 128rpx;
border-radius: 64rpx;
overflow: hidden;
margin-right: 24rpx;
background-color: #fff;
}
.avatar {
width: 100%;
height: 100%;
}
.user-detail {
flex: 1;
}
.name-wrap {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: flex-start;
}
.name {
font-size: 40rpx;
color: #000000;
font-weight: 500;
margin-bottom: 18rpx;
}
.verified {
width: 130rpx;
height: 44rpx;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
border: 1rpx solid #FF4767;
background-color: #FFF1F1;
border-radius: 22rpx;
box-sizing: border-box;
}
.verified-no {
width: 130rpx;
height: 44rpx;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
border: 1rpx solid #666666;
border-radius: 22rpx;
box-sizing: border-box;
}
.verified-text {
font-size: 24rpx;
color: #FF4767;
}
.verified-text.no {
color: #666666;
}
.sign-icon {
width: 24rpx;
height: 24rpx;
margin-right: 6rpx;
}
.edit-profile {
display: flex;
align-items: center;
}
.edit-text {
font-size: 28rpx;
color: #666666;
margin-right: 16rpx;
}
.arrow {
font-size: 28rpx;
color: #666666;
}
.data-cards {
width: 702rpx;
height: 128rpx;
display: flex;
justify-content: space-between;
margin-bottom: 24rpx;
}
.my-card {
width: 332rpx;
height: 128rpx;
border-radius: 20rpx;
position: relative;
padding: 24rpx;
box-sizing: border-box;
background-color: #0066FF;
box-shadow: 0 0 12rpx 0 rgba(252, 67, 124, 0.10);
}
.card-content {
position: relative;
z-index: 99;
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: flex-start;
}
.card-bg {
position: absolute;
top: 0;
left: 0;
width: 332rpx;
height: 128rpx;
z-index: 1;
}
.amount {
font-size: 32rpx;
color: #FF1A6C;
font-weight: 400;
/* margin-bottom: 10rpx; */
display: block;
}
.order {
font-size: 32rpx;
color: #2A82E4;
font-weight: 400;
/* margin-bottom: 10rpx; */
display: block;
}
.label-wrap {
display: flex;
align-items: center;
justify-content: flex-start;
}
.label {
font-size: 24rpx;
color: #333333;
margin-right: 12rpx;
}
.service-manage {
background: #FFFFFF;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 32rpx;
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.05);
}
.manage-header {
background-color: #F6F8FA;
border: 16rpx;
padding: 16rpx 24rpx;
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.manage-info {
flex: 1;
}
.manage-title {
font-size: 24rpx;
color: #1D2129;
font-weight: 500;
display: block;
}
.manage-subtitle {
font-size: 24rpx;
color: #86909C;
display: block;
}
.manage-count {
font-size: 28rpx;
color: #1D2129;
font-weight: 500;
margin-top: 8rpx;
margin-bottom: 4rpx;
}
.manage-btn {
width: 192rpx;
height: 64rpx;
background: #0256FF;
border-radius: 32rpx;
display: flex;
align-items: center;
justify-content: center;
margin-top: 48rpx;
}
.btn-text {
font-size: 28rpx;
color: #FFFFFF;
}
.function-list {
background: #FFFFFF;
border-radius: 20rpx;
padding: 0 24rpx;
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.05);
}
.function-item {
display: flex;
justify-content: space-between;
align-items: center;
height: 92rpx;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
}
.function-item:last-child {
border-bottom: none;
}
.function-text {
font-size: 28rpx;
color: #232220;
font-weight: 500;
}
/* 平台适配 */
/* #ifdef H5 */
/* .nav-bar {
padding-top: 0 !important;
} */
/* #endif */
/* #ifdef MP-WEIXIN */
/* .nav-bar {
padding-top: calc(var(--status-bar-height) + constant(safe-area-inset-top)) !important;
padding-top: calc(var(--status-bar-height) + env(safe-area-inset-top)) !important;
} */
/* #endif */
</style>