You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
19 KiB

4 years ago
<template>
<view class="user">
3 years ago
<view v-if="$store.getters.token || userInfo.uid" class="content">
<view class="header acea-row row-between-wrapper">
<image src="../../../static/user-index-bg.png" mode="" class="header-bg"></image>
4 years ago
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<image :src="userInfo.avatar" />
</view>
<view class="text">
<view class="acea-row row-middle">
<view class="name line1">{{ userInfo.nickname }}</view>
3 years ago
<view class="member acea-row row-middle">
<!-- <image :src="userInfo.vipIcon" /> -->
4 years ago
<text>{{ userInfo.vipName }}</text>
</view>
</view>
<view @click="goPersonalData()" class="id" v-if="userInfo.phone">
<text>ID{{ userInfo.uid || 0 }}</text>
<text class="iconfont icon-bianji1"></text>
</view>
<!-- #ifdef MP-WEIXIN -->
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="binding" @click="goBindPhone()" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
</view>
</view>
3 years ago
<view class="jifen-box">积分2000</view>
<!-- <text class="iconfont icon-shezhi" @click="goPersonalData()"></text> -->
4 years ago
</view>
3 years ago
<view class="teacher-box acea-row-nowrap row-between row-middle">
<view class=" teacher-box-l acea-row-nowrap row-between row-middle">
<image src="../../../static/call-icon.png" class="call-icon"></image>
<text>服务老师</text>
<view class="vertical-line"></view>
</view>
<view class="teacher-box-r acea-row row-between row-middle">
<text>王老师</text>
<image src="../../../static/img1.png"></image>
</view>
</view>
<view class="myjoin-box">
<view class="t-word">我参与的</view>
<view class="course-box">
<view class="course-info">
<view class="course-name line1">阴阳五行一个人的阴阳五行</view>
<view class="time">2021 5 31-6.3 8:30-18:30</view>
</view>
<view class="address-box acea-row row-between row-middle">
<view class="address">地点中国·武汉</view>
<view class="btn">去签到</view>
</view>
</view>
<view class="bangdan-box">
<view class="bangdan-list">
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="bangdan-item" v-for="(item,index) in 6" :key="index">
<view class="bangdan-name">连续11天打卡站桩</view>
<!-- <view class="time">2021.5.28-2021.6.18</view> -->
<view class="acea-row row-between-wrapper">
<view class="signin-day">已连续12天</view>
<view class="signin-btn">立即打榜</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
<view class="wrapper">
<!-- <view class="nav acea-row row-middle">
4 years ago
<view @click="goUserAccount()" class="item">
<text>我的余额</text>
<text class="num">{{ userInfo.nowMoney || 0 }}</text>
</view>
<view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2">
<text>当前佣金</text>
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text>
</view>
<view @click="goIntegral()" class="item" v-else>
<text>当前积分</text>
<text class="num">{{ userInfo.integral || 0 }}</text>
</view>
<view @click="goUserCoupon()" class="item">
<text>优惠券</text>
<text class="num">{{ userInfo.couponCount || 0 }}</text>
</view>
3 years ago
</view> -->
4 years ago
<view class="myOrder">
<view class="title acea-row row-between-wrapper">
<text>我的订单</text>
<text @click="goMyOrder()" class="allOrder">
<text>全部订单</text>
<text class="iconfont icon-jiantou"></text>
</text>
</view>
<view class="orderState acea-row row-middle">
<view @click="goMyOrder(0)" class="item">
<view class="pictrue">
3 years ago
<!-- <image :src="`${$VUE_APP_RESOURCES_URL}/images/dfk.png`" /> -->
<image src="../../../static/myorder-icon1.png" />
4 years ago
<text class="order-status-num" v-if="userInfo.orderStatusNum.unpaidCount > 0">{{ userInfo.orderStatusNum.unpaidCount }}</text>
</view>
<view>待付款</view>
</view>
<view @click="goMyOrder(1)" class="item">
<view class="pictrue">
3 years ago
<image src="../../../static/myorder-icon2.png" />
4 years ago
<text class="order-status-num" v-if="userInfo.orderStatusNum.unshippedCount > 0">{{ userInfo.orderStatusNum.unshippedCount }}</text>
</view>
<view>待发货</view>
</view>
<view @click="goMyOrder(2)" class="item">
<view class="pictrue">
3 years ago
<image src="../../../static/myorder-icon3.png" />
4 years ago
<text class="order-status-num" v-if="userInfo.orderStatusNum.receivedCount > 0">{{ userInfo.orderStatusNum.receivedCount }}</text>
</view>
<text>待收货</text>
</view>
<view @click="goMyOrder(3)" class="item">
<view class="pictrue">
3 years ago
<image src="../../../static/myorder-icon4.png" />
4 years ago
<text class="order-status-num" v-if="userInfo.orderStatusNum.evaluatedCount > 0">{{ userInfo.orderStatusNum.evaluatedCount }}</text>
</view>
<text>待评价</text>
</view>
<view @click="goReturnList()" class="item">
<view class="pictrue">
3 years ago
<image src="../../../static/myorder-icon5.png" />
4 years ago
<text class="order-status-num" v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text>
</view>
<text>售后/退款</text>
</view>
</view>
</view>
<view class="myService">
<view class="serviceList acea-row row-middle">
3 years ago
<view class="item" @click="goUserCourse()">
<view class="pictrue">
<image src="../../../static/user-menu1.png" />
</view>
<view class="cell">我的课程</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item" @click="goUserBangdan()">
<view class="pictrue">
<image src="../../../static/user-menu2.png" />
</view>
<view class="cell">学习帮打卡</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item" @click="goUserFeedBack()">
<view class="pictrue">
<image src="../../../static/user-menu3.png" />
</view>
<view class="cell">建议反馈</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item" @click="goUserJoinUs()">
<view class="pictrue">
<image src="../../../static/user-menu4.png" />
</view>
<view class="cell">企业招聘</view>
<text class="iconfont icon-jiantou"></text>
</view>
<view class="item" @click="goAddressManagement()">
<view class="pictrue">
<image src="../../../static/user-menu5.png" />
</view>
<view class="cell">收货地址</view>
<text class="iconfont icon-jiantou"></text>
</view>
<!-- <template v-for="(item, MyMenusIndex) in MyMenus">
4 years ago
<view class="item" :key="MyMenusIndex" @click="goPages(MyMenusIndex)">
<view class="pictrue">
<image :src="item.pic" />
</view>
<view class="cell">{{ item.name }}</view>
<text class="iconfont icon-jiantou"></text>
</view>
3 years ago
</template> -->
4 years ago
</view>
</view>
</view>
<!-- <SwitchWindow
v-on:changeswitch="changeswitch"
:switchActive="switchActive"
:login_type="userInfo.login_type"
></SwitchWindow>-->
</view>
<Authorization v-else />
</view>
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user'
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils'
import cookie from '@/utils/store/cookie'
import SwitchWindow from '@/components/SwitchWindow'
import Authorization from '@/pages/authorization/index'
const NAME = 'User'
export default {
name: NAME,
components: {
SwitchWindow,
Authorization,
},
props: {},
data: function() {
return {
MyMenus: [],
switchActive: false,
isWeixin: false,
}
},
computed: mapGetters(['userInfo']),
methods: {
...mapMutations(['updateAuthorizationPage']),
3 years ago
goUserCourse() {
this.$yrouter.push('/pages/user/myCourses/index')
},
goUserBangdan() {
this.$yrouter.push('/pages/user/myBangdan/index')
},
goUserFeedBack() {
this.$yrouter.push('/pages/user/feedBack/index')
},
goUserJoinUs() {
this.$yrouter.push('/pages/user/joinUs/index')
},
4 years ago
goReturnList() {
this.$yrouter.push('/pages/order/ReturnList/index')
},
3 years ago
goAddressManagement(){
this.$yrouter.push('/pages/user/address/AddressManagement/index')
},
4 years ago
goMyOrder(type) {
this.$yrouter.push({
path: '/pages/order/MyOrder/index',
query: {
type,
},
})
},
goBindPhone() {
this.$yrouter.push({
path: '/pages/user/BindingPhone/index',
})
},
goUserCoupon() {
this.$yrouter.push('/pages/user/coupon/UserCoupon/index')
},
goIntegral() {
this.$yrouter.push('/pages/user/signIn/Integral/index')
},
goUserPromotion() {
this.$yrouter.push('/pages/user/promotion/UserPromotion/index')
},
goUserAccount() {
this.$yrouter.push({
path: '/pages/user/UserAccount/index',
})
},
goPersonalData() {
this.$yrouter.push('/pages/user/PersonalData/index')
},
getPhoneNumber: function(e) {
let thit = this
console.log(e)
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
uni.showLoading({
title: '绑定中',
})
wxappBindingPhone({
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv,
})
.then(res => {
// this.User();
thit.$store.dispatch('userInfo', true)
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'success',
duration: 2000,
})
})
.catch(error => {
uni.hideLoading()
thit.$store.dispatch('userInfo', true)
console.log(error)
uni.showToast({
title: error.msg || error.response.data.msg || error.response.data.message,
icon: 'none',
duration: 2000,
})
})
// // 获取当前环境的服务商
// uni.getProvider({
// service: "oauth",
// success: function (res) {
// // 此处可以排除h5
// if (res.provider) {
// uni.login({
// success: loginRes => {
// bindingPhone({
// code: loginRes.code,
// encryptedData: e.mp.detail.encryptedData,
// iv: e.mp.detail.iv
// })
// .then(res => {
// // this.User();
// thit.$store.dispatch("userInfo", true);
// uni.hideLoading();
// uni.showToast({
// title: res.msg,
// icon: "success",
// duration: 2000
// });
// })
// .catch(error => {
// uni.hideLoading();
// thit.$store.dispatch("userInfo", true);
// console.log(error);
// uni.showToast({
// title: error.msg ||
// error.response.data.msg ||
// error.response.data.message,
// icon: "none",
// duration: 2000
// });
// });
// },
// fail() {
// reject("绑定失败");
// }
// });
// }
// },
// fail() {
// reject("获取环境服务商失败");
// }
// });
} else {
uni.showToast({
title: '已拒绝授权',
icon: 'none',
duration: 2000,
})
}
},
changeswitch: function(data) {
this.switchActive = data
},
MenuUser: function() {
let that = this
getMenuUser()
.then(res => {
uni.hideLoading()
that.MyMenus = res.data.routine_my_menus
})
.catch(error => {
uni.hideLoading()
console.log(error)
})
},
goPages: function(index) {
let url = this.MyMenus[index].uniapp_url
if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) {
if (!this.userInfo.isPromoter) {
uni.showToast({
title: '您还没有推广权限!!',
icon: 'none',
duration: 2000,
})
return
}
}
if (url === '/pages/orderAdmin/OrderIndex/index' && !this.userInfo.adminid) {
uni.showToast({
title: '您还不是管理员!!',
icon: 'none',
duration: 2000,
})
return
}
console.log(this.userInfo)
if (url === '/pages/orderAdmin/OrderCancellation/index' && !this.userInfo.checkStatus) {
uni.showToast({
title: '您没有核销权限,请后台店员设置!!',
icon: 'none',
duration: 2000,
})
return
}
this.$yrouter.push({
path: this.MyMenus[index].uniapp_url,
})
},
goPages2: function() {
this.$yrouter.push({
path: '/pages/shop/GoodsList/index',
query: {
// id: 0,
title: '积分商城',
isIntegral: true,
},
})
},
},
watch: {
userInfo() {
this.MenuUser()
},
},
onShow() {
if (this.$store.getters.token) {
//
uni.showLoading({
title: '加载中',
})
this.$store.dispatch('getUser', true)
this.MenuUser()
this.isWeixin = isWeixin()
}
},
onHide() {
console.log('离开用户中心')
this.updateAuthorizationPage(false)
},
}
</script>
<style lang="less">
3 years ago
.header{
width: 100%;
height: 336rpx !important;
padding: 0 !important;
position: relative !important;
.header-bg{
width: 100%;
height: 100%;
position: absolute;
top: 0;
z-index: 2;
}
.picTxt{
position: absolute !important;
left: 32rpx;
z-index: 3;
.text {
.name {
font-size: 36rpx;
max-width: 260rpx;
color: #A8873D;
}
}
.binding{
background: #BF922B !important;
border-color: #BF922B !important;
}
}
.jifen-box{
width: 200rpx;
height: 62rpx;
background: #BF922B;
border-radius: 31rpx;
text-align: center;
line-height: 62rpx;
position: absolute;
right: 50rpx;
z-index: 4;
color: #fff;
font-size: 28rpx;
}
}
.teacher-box{
width: 690rpx;
height: 112rpx;
padding-left: 28rpx;
padding-right: 40rpx;
background: linear-gradient(180deg, #332810 0%, #4E4229 100%);
border-radius: 10rpx;
position: relative;
left: 50%;
top: -56rpx;
margin-left: -345rpx;
z-index: 7;
.teacher-box-l {
color: #FFFADD;
font-size: 28rpx;
.call-icon{
width: 56rpx;
height: 56rpx;
}
text{
display: inline-block;
margin-left:20rpx;
margin-right:14rpx;
}
.vertical-line{
width: 2rpx;
height: 34rpx;
background: #FFFADD;
}
}
.teacher-box-r{
color: #F9EDCC;
font-size: 24rpx;
image{
width: 88rpx;
height: 88rpx;
border: 1px solid #fff;
border-radius: 25px;
margin-left: 30rpx;
}
}
}
.myjoin-box{
width: 690rpx;
height: 506rpx;
background: #FFFFFF;
border-radius: 10rpx;
padding: 30rpx;
margin: -26rpx auto 0;
.t-word{
font-size: 32rpx;
color: #222;
margin-bottom: 30rpx;
}
.course-box{
width: 100%;
height: 190rpx;
background: #FFF5DE;
border-radius: 10rpx;
padding: 26rpx 20rpx 20rpx 42rpx;
color: #C89560;
font-size: 24rpx;
.course-info{
margin-bottom: 10rpx;
.course-name{
color: #C89560;
font-size: 28rpx;
line-height: 40rpx;
margin-bottom: 4rpx;
font-weight: 500;
}
}
.address-box{
.btn{
width: 172rpx;
height: 56rpx;
background: linear-gradient(180deg, #FFCC5D 0%, #FCA535 100%);
border-radius: 28rpx;
text-align: center;
line-height: 56rpx;
font-size: 32rpx;
color: #fff;
}
}
}
.bangdan-box{
width: 100%;
box-sizing: border-box;
margin-top: 30rpx;
.scroll-view_H{
white-space: nowrap;
width: 100%;
}
.bangdan-item{
width: 310rpx;
height: 152rpx;
box-sizing: border-box;
padding: 20rpx;
color: #fff;
display: inline-block;
background: linear-gradient(143deg, #FDAF97 0%, #ED5E48 100%);
border-radius: 10rpx;
font-size: 28rpx;
margin-right: 20rpx;
.bangdan-name{
margin-bottom: 28rpx;
}
.signin-day{
font-size: 24rpx;
}
.signin-btn{
width: 122rpx;
height: 48rpx;
background: linear-gradient(180deg, #FEECCB 0%, #FCAB3B 100%);
border-radius: 8px;
border-radius: 8rpx;
text-align: center;
line-height: 48rpx;
color: #C71A00;
font-size: 24rpx;
}
}
}
}
.content{
padding-bottom: 100rpx;
}
.user .wrapper {
background:#F5F6F7;
padding: 0 30rpx;
}
4 years ago
.footer-line-height {
height: 1 * 100rpx;
}
.order-status-num {
min-width: 0.33 * 100rpx;
background-color: #fff;
color: #eb3729;
border-radius: 15px;
position: absolute;
right: -0.14 * 100rpx;
top: -0.15 * 100rpx;
font-size: 0.2 * 100rpx;
padding: 0 0.08 * 100rpx;
border: 1px solid #eb3729;
}
.pictrue {
position: relative;
}
.switch-h5 {
margin-left: 0.2 * 100rpx;
}
.binding {
margin-top: 0.1 * 100rpx;
display: inline-block;
padding: 0.05 * 100rpx 0.2 * 100rpx;
background-color: #ca1f10;
border-radius: 50px;
font-size: 0.22 * 100rpx;
line-height: 1.5;
border: 1px solid #e8695e;
color: #ffffff;
}
.by {
text-align: center;
padding: 30rpx 0;
}
.by-text {
text-align: center;
font-size: 24rpx;
}
</style>