sadjv3_user/pages/my/index.vue

709 lines
19 KiB
Vue

<template>
<view class="content">
<view class="my-head">
<view class="my-head-top back-width">
<view class="u-m-r-10" style="position: relative;">
<image :src="avatar" style="width: 100rpx;height: 100rpx;border-radius: 50%;"
@click="goNav('/pages/my/userinfo')"></image>
</view>
<view class="my-head-top-view" v-if="!isLogin">
<view class="my-head-top-text">
<span>{{userName}}</span>
<span>{{phone}}</span>
</view>
<view class="my-head-top-id">ID:{{invitationCode}}</view>
</view>
<view v-else class="text-xl u-p-l-20 text-bold" @click="goLogin('/pages/public/login')">
登录
</view>
</view>
<view class="my-head-mian back-width">
<view class="my-head-mian-top">
<view class="my-head-mian-top-view">
<view class="my-head-mian-top-view-qian">我的钱包</view>
<view class="my-head-mian-top-view-chong" @click="chonghi('充值')">充值</view>
<view class="my-head-mian-top-view-ming" @click="chonghi('明细')">明细</view>
</view>
<view class="my-head-mian-top-yuE">{{money}}</view>
</view>
<view class="my-head-mian-bottom">
<view class="my-head-mian-bottom-list" @click="youhui('/my/hongbao/youhuijuan')">
<image src="../../static/my-yuehui.png" mode=""></image>
<span class="my-head-mian-bottom-list-text">优惠券</span>
</view>
<view class="my-head-mian-bottom-list">
<image src="../../static/my-juanma.png" mode=""></image>
<span class="my-head-mian-bottom-list-text">券码兑换</span>
</view>
<view class="my-head-mian-bottom-list">
<image src="../../static/my-jifen.png" mode=""></image>
<span class="my-head-mian-bottom-list-text">积分兑换</span>
</view>
</view>
</view>
<!-- <view class="my-head-bottom back-width" @click="kaitong">
<image src="../../static/my-kaitonghuiyuan.png" mode="widthFix"></image>
</view> -->
<view class="padding-lr margin-lr" style="background-color: #35C495;border-radius: 18rpx;margin-top: 30rpx;"
v-if="XCXIsSelect != '否' && hyCheck != '否'">
<view class="flex justify-between align-center" style="height: 140rpx;">
<view class="flex justify-between align-center" style="">
<view class="">
<image src="../../static/images/my/lihe.png" style="width: 70upx;height: 70upx;" mode="">
</image>
</view>
<view class="" style="margin-left: 24rpx;">
<view v-if="!isVip" class="vipttl" style="color: #fff;">开通会员</view>
<view v-if="isVip" class="vipttl" style="color: #fff;">会员中心</view>
<view class="flex-sub text-26" style="color: #e6c485;margin-top: 6rpx;">会员可享贵族福利</view>
</view>
</view>
<view v-if="!isVip" class="btn-bg" @click="goNav('/my/vip/index')"
style="justify-content: space-between;color: #fff;">立即开通
</view>
<view v-if="isVip" class="btn-bg" @click="goNav('/my/vip/index')"
style="justify-content: space-between;color: #fff;">会员特权
</view>
</view>
</view>
</view>
<view class="my-serve width">
<view class="my-serve-title">我的服务</view>
<view class="my-serve-view">
<view class="my-serve-list" @click="meServe('服务套餐')">
<image src="../../static/my-fuwu.png" mode=""></image>
<span class="my-serve-list-text">服务套餐</span>
</view>
<view class="my-serve-list" @click="meServe('项目次卡')">
<image src="../../static/my-cika.png" mode=""></image>
<span class="my-serve-list-text">项目次卡</span>
</view>
<view class="my-serve-list" @click="meServe('服务疗程')">
<image src="../../static/my-liaocheng.png" mode=""></image>
<span class="my-serve-list-text">服务疗程</span>
</view>
</view>
</view>
<view class="my-use width">
<view class="my-use-title">常用功能</view>
<view class="my-use-view">
<view class="my-use-list" v-for="(item,index) in useList" :key="index" @click="useToUrl(item)">
<image :src="item.urlImg" mode=""></image>
<span class="my-use-list-text">{{item.text}}</span>
</view>
</view>
</view>
</view>
</template>
<script>
export default{
data(){
return {
isShop: 0,
hyCheck: '否',
tgCheck: '否',
isAgency: 0,
avatar: '../../static/logo.png',
isLogin: true,
userName: '匿名',
phone:'18684369159',
browse: 0, //浏览数
fans: 0, //粉丝数
follow: 0, //关注数
visitor: 0, //访客数
userId: '',
isVip: false,
invitationCode: '', //邀请码
money: '0',
couponnum: '0',
renzheng: 0,
XCXIsSelect: '否',
useList:[
{urlImg:'../../static/my-gong-1.png',text:'我的收藏',link:'/my/gird/shoucang'},
{urlImg:'../../static/my-gong-2.png',text:'成为理疗师',link:'/pages/my/hehuo'},
{urlImg:'../../static/my-gong-3.png',text:'分享好友',link:'/pages/my/invitationUser'},
{urlImg:'../../static/my-gong-4.png',text:'成为代理商',link:'/pages/my/cooperation'},
{urlImg:'../../static/my-gong-5.png',text:'地址管理',link:'/my/address/address'},
{urlImg:'../../static/my-gong-6.png',text:'帮助中心',link:'/my/help/feedbackIndex'},
{urlImg:'../../static/my-gong-7.png',text:'设置中心',link:'/my/setting/index'},
{urlImg:'../../static/my-gong-8.png',text:'浏览历史',link:'/my/gird/browse'},
{urlImg:'../../static/my-gong-9.png',text:'我的团队',link:'/pages/my/myteam'},
]
}
},
onLoad(e) {
this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
if (e.money && e.couponnum) {
this.money = e.money;
this.couponnum = e.couponnum;
}
},
onShow() {
this.hyCheck = this.$queue.getData('hyCheck');
this.tgCheck = this.$queue.getData('tgCheck');
this.userId = uni.getStorageSync('userId')
if (this.userId) {
this.isLogin = false
this.getUserInfo()
this.getAmount()
this.getIsVip()
} else {
this.isShop = 0;
this.isAgency = 0;
this.isLogin = true
this.userName = '匿名'
this.browse = 0
this.fans = 0
this.follow = 0
this.visitor = 0
this.avatar = '../../static/logo.png'
this.isVip = false
}
},
methods:{
goChat() {
let kefu = this.$queue.getData('kefu'); // 用户端联系方式 1 手机号 2企业微信
let kefuPhone = this.$queue.getData('kefuPhone');
if (kefu == 1) {
uni.makePhoneCall({
phoneNumber: kefuPhone //仅为示例
});
} else if (kefu == 3) {
uni.navigateTo({
url: '/my/setting/customer'
});
} else {
// #ifdef MP-WEIXIN
let that = this
try {
wx.openCustomerServiceChat({
extInfo: {
url: that.$queue.getData('kefuUrl')
},
corpId: that.$queue.getData('kefuAppId'),
success(res) {},
fail(res) {
console.error(res)
}
})
} catch (error) {
console.error("catchcatch" + error)
uni.showToast({
title: '请更新至微信最新版本'
});
}
// #endif
// #ifndef MP-WEIXIN
let url = this.$queue.getData('kefuUrl');
if (url.indexOf('/pages/') !== -1 || url.indexOf('/my/') !== -1) {
uni.navigateTo({
url
});
} else {
//#ifndef H5
uni.navigateTo({
url: '/pages/index/webView?url=' + url
});
//#endif
//#ifdef H5
window.location.href = url;
//#endif
}
// #endif
}
},
//退出登录
TuiLogin() {
let that = this
if (that.userId) {
uni.showModal({
title: '提示',
content: '确定退出登录吗?',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.removeStorageSync('userName')
uni.removeStorageSync('avatar')
uni.removeStorageSync('userId')
uni.removeStorageSync('token')
uni.removeStorageSync('phone')
uni.removeStorageSync('zhiFuBaoName')
uni.removeStorageSync('zhiFuBao')
uni.removeStorageSync('invitationCode')
uni.removeStorageSync('unionId')
uni.removeStorageSync('openId')
uni.removeStorageSync('isVIP')
uni.showToast({
title: '退出成功!',
icon: 'none'
})
that.isLogin = true
that.userName = '匿名'
that.browse = 0
that.fans = 0
that.follow = 0
that.visitor = 0
that.isVip = false
that.avatar = '../../static/logo.png'
that.userId = uni.getStorageSync('userId')
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
//成为按摩师 跳转商户端
bindFb() {
if (this.userId) {
uni.navigateTo({
url: '/pages/my/hehuo'
});
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
goNavOrder(index) {
let token = this.$queue.getData('token');
if (token) {
this.$queue.setData('SelectIndex', index);
uni.switchTab({
url: '/pages/order/index'
})
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
goNav(e, name) {
console.log(e)
if (this.userId) {
uni.navigateTo({
url: e
})
} else {
uni.showModal({
title: '提示',
content: '您还未登录,请先登录',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateTo({
url: '/pages/public/login'
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
},
goLogin(e) {
uni.navigateTo({
url: e
})
},
getAmount() {
this.$Request.get("/app/userBrowse/selectAmount").then(res => {
if (res.code == 0) {
this.browse = res.data.browse
this.fans = res.data.fans
this.follow = res.data.follow
this.visitor = res.data.visitor
}
});
},
getUserInfo() {
this.$Request.get("/app/user/selectUserById").then(res => {
console.log("res.data--->", res.data);
if (res.code == 0) {
this.userName = res.data.userName
this.phone=res.data.phone;
this.invitationCode = res.data.invitationCode
this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
this.isAuthentication = res.data.isAuthentication
this.isAgency = res.data.isAgency ? res.data.isAgency : 0; //是否是推广员 1是 2否
this.money = res.data.money
this.couponnum = res.data.member
// uni.setStorageSync('isAuthentication', res.data.isAuthentication)
this.isShop = res.data.isShop ? res.data.isShop : 0;
uni.setStorageSync('avatar', res.data.avatar)
uni.setStorageSync('userName', res.data.userName)
uni.setStorageSync('invitationCode', res.data.invitationCode)
uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
if (res.data.isAuthentication == 0 || res.data.isAuthentication == null) {
this.renzheng = 0
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 1) {
this.renzheng = 1
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 2) {
this.renzheng = 2
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 3) {
this.renzheng = 3
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 4) {
this.renzheng = 4
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 5) {
this.renzheng = 5
uni.setStorageSync("renzheng", this.renzheng)
} else if (res.data.isAuthentication == 6) {
this.renzheng = 6
uni.setStorageSync("renzheng", this.renzheng)
}
}
});
// #ifdef APP-PLUS
let clientid = plus.push.getClientInfo().clientid;
let sysPhone = 1;
if (plus.os.name.toLowerCase() === 'android') {
sysPhone = 1;
} else {
sysPhone = 2;
}
let userId = this.$queue.getData('userId');
if (userId) {
this.$Request.postT('/app/user/updateClientId?clientId=' + clientid + '&userId=' + userId +
'&sysPhone=' + sysPhone).then(
res => {});
}
//#endif
},
getIsVip() {
this.$Request.get("/app/UserVip/isUserVip").then(res => {
if (res.code == 0) {
this.isVip = res.data
this.$queue.setData('isVIP',this.isVip)
}
});
},
chonghi(link){//我的钱包
if(link=='充值'){
uni.navigateTo({
url:'/my/wallet/index'
})
}else{
uni.navigateTo({
url:'/my/wallet/mymoneydetail'
})
}
},
youhui(link){//优惠劵,券码兑换,积分兑换 跳页
uni.navigateTo({
url:link
})
},
useToUrl(item){//常用功能跳转页面
var link=item.link
uni.navigateTo({
url:link
})
},
meServe(item){
uni.navigateTo({
url:'/pages/my/servicePackage?name='+item
})
// if(item=="服务套餐"){
// }else if(item=="项目次卡"){
// uni.navigateTo({
// url:'/pages/my/onceCardPackage?name='+'项目次卡'
// })
// }else if(item=="服务疗程"){
// uni.navigateTo({
// url:'/pages/my/curePackage?name='+'服务疗程'
// })
// }
},
}
}
</script>
<style scoped>
.my-use-list-text{
font-weight: bold;
font-size: 30rpx;
color: #6C6C6C;
margin-top: 6px;
}
.my-use-list image{
width: 64.58rpx;
height: 72.22rpx;
}
.my-use{
height: 597rpx;
background: #FFFFFF;
border-radius: 21rpx;
padding: 10px;
display: flex;
flex-direction: column;
margin: 0px auto 20px auto;
}
.my-use-view{
width: 90%;
margin: 5px auto;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
}
.my-serve-view{
width: 90%;
margin: 0 auto;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.my-use-list{
width: 25%;
margin-top: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
.my-serve-list{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.my-serve-list image{
width: 119.44rpx;
height: 130.56rpx;
}
.my-serve-list-text{
font-weight: bold;
font-size: 32rpx;
color: #6C6C6C;
margin-top: 5px;
}
.my-serve-title,.my-use-title{
width: 100%;
font-weight: bold;
font-size: 35rpx;
color: #333333;
}
.width{
width: 95%;
}
.my-serve{
height: 597rpx;
background: #FFFFFF;
border-radius: 21rpx;
padding: 10px;
display: flex;
flex-direction: column;
margin: 0px auto 20px auto;
}
.my-serve,.my-serve{
height: 297rpx;
background: #FFFFFF;
border-radius: 21rpx;
padding: 10px;
display: flex;
flex-direction: column;
margin: 20px auto;
}
.my-head-bottom{
width: 95%;
height: 121.53rpx;
}
.my-head-bottom image{
width: 100%;
height: 100%;
}
.my-head-mian-bottom-list image{
width: 88.13rpx;
height: 65.28rpx;
}
.my-head-mian-bottom-list-text{
font-weight: bold;
font-size: 33rpx;
color: #6C6C6C;
margin-top: 10px;
}
.my-head-mian-bottom-list{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.my-head-mian-bottom{
width: 95%;
margin: 0 auto;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.my-head-mian-top-yuE{
font-weight: bold;
font-size: 43rpx;
color: #333333;
}
.my-head-mian-top-view-chong,.my-head-mian-top-view-ming{
width: 92rpx;
height: 42rpx;
line-height: 42rpx;
text-align: center;
border-radius: 21rpx;
font-weight: bold;
font-size: 26rpx;
}
.my-head-mian-top-view-chong{
background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
color: #fff;
margin: 0px 5px;
}
.my-head-mian-top-view-ming{
background: #F5F7FB;
color: #333;
}
.my-head-mian-top-view-qian{
font-weight: bold;
font-size: 35rpx;
color: #333333;
}
.my-head-mian-top-view{
display: flex;
flex-direction: row;
align-items: center;
}
.my-head-mian-top{
width: 95%;
margin: 0 auto;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.my-head-mian{
width: 100%;
height: 298rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
background: #FFFFFF;
border-radius: 21rpx;
padding: 10px;
}
.my-head-top-id{
margin-top: 10px;
font-weight: bold;
font-size: 19rpx;
color: #0E050A;
}
.my-head-top-text{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
font-weight: bold;
font-size: 33rpx;
color: #000000;
}
.my-head-top-view{
display: flex;
flex-direction: column;
width: 80%;
}
.my-head-top image{
width: 106rpx;
height: 106rpx;
}
.my-head-top{
width: 100%;
margin: 20px 0px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.my-head{
width: 100%;
/* background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #f7f7f7), url('../../static/background-img.png');
background-position: center center;
background-repeat: no-repeat;
background-size: cover; */
}
.content {
width: 100%;
height: 100vh;
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #f7f7f7), url('../../static/background-img.png');
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
/* background: #f7f7f7; */
overflow: auto;
}
.div-with-background {
width: 300px; /* 你的容器宽度 */
height: 200px; /* 你的容器高度 */
}
.back-width{
width: 95%;
display: flex;
margin: 0px auto;
padding: 10px 0px;
}
</style>