708 lines
16 KiB
Vue
708 lines
16 KiB
Vue
<template>
|
|
<view class="page">
|
|
<u-navbar :is-back="false" title="我的" :border-bottom="false" back-icon-color="000" :background="bgc"
|
|
title-color='#fff' title-size='36' height='36' id="navbar">
|
|
</u-navbar>
|
|
<image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/uLeHF2hmWdyk8KT1ESFj" mode="aspectFill">
|
|
</image>
|
|
<view class="box">
|
|
<view class="top">
|
|
<button type="primary reverse" open-type="chooseAvatar" @chooseavatar="getimage">
|
|
<image :src="info.avatar" mode=""></image>
|
|
</button>
|
|
<!-- <view class="pic">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uhygDEgTWnL6P1uXlzVt" mode=""></image>
|
|
</view> -->
|
|
<!-- <view class="bianji" @click="btnbj">
|
|
编辑资料
|
|
</view> -->
|
|
<view class="bianji" style="background-color: transparent;">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="name" @click="btnxingbie">
|
|
{{info.phonenumber == null ? '--' : info.phonenumber}}
|
|
<view class="nan" v-if="info.sex == 0">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg" mode=""></image>
|
|
</view>
|
|
<view class="nan" v-else>
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="qianm">
|
|
欢迎来到PICK ME UP
|
|
</view>
|
|
<view class="zhanghu">
|
|
<view class="tops">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uncKPCkvEQRhz12UbhOR" mode=""></image>我的账户
|
|
</view>
|
|
<view class="bd">
|
|
<view class="lt">
|
|
<view class="shen" v-if="shengyuobj.giftedAmount || shengyuobj.amount">
|
|
¥{{(Number(shengyuobj.giftedAmount) + Number(shengyuobj.amount)).toFixed(2)}}
|
|
</view>
|
|
<view class="shen" v-else>
|
|
¥0
|
|
</view>
|
|
<view class="qian">
|
|
账户余额
|
|
</view>
|
|
</view>
|
|
<view class="rt" @click="btnzj">
|
|
<view class="shen">
|
|
近30天
|
|
</view>
|
|
<view class="qian">
|
|
账户明细
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="zhanghu">
|
|
<view class="tops">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uncKPCkvEQRhz12UbhOR" mode=""></image>我的订单
|
|
</view>
|
|
<view class="bd" style="padding: 0 52rpx;">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uhCD1iAVDnwMYCyFoilD" mode=""></image>
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uLplvjTxFFFXMmzQ4Kjn" mode=""></image>
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uagkHjkHOpMRYnMvrUk1" mode=""></image>
|
|
</view>
|
|
</view> -->
|
|
<view class="zhanghu">
|
|
<view class="tops">
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uncKPCkvEQRhz12UbhOR" mode=""></image>我的服务
|
|
</view>
|
|
<view class="bds" style="padding: 0 40rpx;flex-wrap: wrap;">
|
|
<image @click="btnkajuan" src="https://api.ccttiot.com/smartmeter/img/static/uajU1WwNe4bOOrtlfWL3" mode=""></image><!-- 礼物兑换 -->
|
|
<image @click="btncz" src="https://api.ccttiot.com/smartmeter/img/static/unKW3MEyeURW6ngfBiUG" mode=""></image><!-- 会员充值 -->
|
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/ucqMPd9KB8B9kaQfJ2zO" mode=""> 取酒 -->
|
|
<image @click="btncunqu" style="width: 120rpx;" src="https://api.ccttiot.com/smartmeter/img/static/u7jrZNoJZljMssUrdipN" mode=""></image><!-- 存取酒记录 -->
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uN28ZtVt5EY1ZZxpiczs" @click="btnqu" mode=""></image> <!-- 取号记录 -->
|
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uLplvjTxFFFXMmzQ4Kjn" mode=""></image> 充值订单 -->
|
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uX8SkuXsRT6GMXszd1U2" mode=""></image>我的黑名单 -->
|
|
<image @click="btnpage(1)" src="https://api.ccttiot.com/smartmeter/img/static/uZUV1zvcXDa4wuXbUFGN" mode=""></image><!-- 用户协议 -->
|
|
<image @click="btnpage(2)" src="https://api.ccttiot.com/smartmeter/img/static/u0XuutigOAsidp0fkH3Z" mode=""></image><!-- 隐私政策 -->
|
|
<image @click="btnpage(3)" src="https://api.ccttiot.com/smartmeter/img/static/uOA2rMaxNNYkGkQODFhQ" mode=""></image><!-- 关于我们 -->
|
|
</view>
|
|
</view>
|
|
<view class="gongzuotai" v-if="roles.length > 0" @click="btnshanghu">
|
|
工作台
|
|
</view>
|
|
<!-- 性别选择弹窗 -->
|
|
<uni-popup v-if="showGenderPicker" ref="genderPopup" type="bottom" :mask-click="true"
|
|
@maskClick="showGenderPicker = false">
|
|
<view class="gender-picker">
|
|
<view class="picker-header">
|
|
<text class="picker-title">选择性别</text>
|
|
<uni-icons type="close" size="22" color="#999" @click="showGenderPicker = false"></uni-icons>
|
|
</view>
|
|
<view class="gender-options">
|
|
<view class="gender-option" :class="{ active: tempGender === '男' }" @click="selectGender('男')">
|
|
<image
|
|
:src="tempGender === '男' ? 'https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg' : 'https://api.ccttiot.com/smartmeter/img/static/uGhxU4Yh34qZzY7s9ntg'"
|
|
class="gender-icon" />
|
|
<text>男</text>
|
|
</view>
|
|
<view class="gender-option" :class="{ active: tempGender === '女' }" @click="selectGender('女')">
|
|
<image
|
|
:src="tempGender === '女' ? 'https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK' : 'https://api.ccttiot.com/smartmeter/img/static/uF7rnOO2DtSm8fF6jmKK'"
|
|
class="gender-icon" />
|
|
<text>女</text>
|
|
</view>
|
|
</view>
|
|
<view class="anniu" style="display: flex;align-items: center;justify-content: space-between;">
|
|
<button class="confirm-btn" style="background-color: #ccc;color: #000;"
|
|
@click="showGenderPicker = false">取消</button>
|
|
<button class="confirm-btn" @click="confirmGender">确定</button>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
bgc: {
|
|
backgroundColor: "",
|
|
},
|
|
flag: false,
|
|
roles: [],
|
|
info: {},
|
|
token: '',
|
|
userImgs: '',
|
|
|
|
showGenderPicker: false,
|
|
currentGender: '',
|
|
tempGender: '',
|
|
shengyuobj:{}
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getinfo()
|
|
this.gettoken()
|
|
},
|
|
methods: {
|
|
// 点击跳转到取号记录
|
|
btnqu(){
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/paidui/paiduilist'
|
|
})
|
|
},
|
|
// 查询余额
|
|
getye(){
|
|
this.$u.get(`/app/storeUser/getDetail?storeId=${this.$store.state.storeId}`).then(res => {
|
|
if (res.code == 200) {
|
|
this.shengyuobj = res.data //赋值
|
|
}
|
|
})
|
|
},
|
|
// 点击跳转到近30天记录
|
|
btnzj(){
|
|
uni.navigateTo({
|
|
url:'/page_shanghu/order/zhangbian'
|
|
})
|
|
},
|
|
// 点击跳转到充值
|
|
btncz(){
|
|
uni.navigateTo({
|
|
url:'/page_user/chongzhi/index'
|
|
})
|
|
},
|
|
// 点击跳转到卡劵兑换
|
|
btnkajuan() {
|
|
uni.navigateTo({
|
|
url: '/page_user/chongzhi/kajuanindex'
|
|
})
|
|
},
|
|
// 点击跳转到点单记录
|
|
btndiandan() {
|
|
uni.navigateTo({
|
|
url: '/page_user/diandanjilu'
|
|
})
|
|
},
|
|
// 更改性别
|
|
btnxingbie() {
|
|
if (this.info.sex == 0) {
|
|
this.tempGender = '男'
|
|
} else {
|
|
this.tempGender = '女'
|
|
}
|
|
this.showGenderPicker = true
|
|
},
|
|
selectGender(gender) {
|
|
this.tempGender = gender;
|
|
},
|
|
// 确认选择
|
|
confirmGender() {
|
|
if (this.tempGender) {
|
|
this.currentGender = this.tempGender;
|
|
this.showGenderPicker = false;
|
|
console.log('选择的性别:', this.currentGender);
|
|
let data = {
|
|
sex: this.currentGender == '男' ? 0 : 1
|
|
}
|
|
this.$u.put(`/app/user/editInfo`, data).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '修改成功',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
this.getinfo()
|
|
} else if (res.code == 401) {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您当前暂未登录,需前去登录吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: '请选择性别',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
},
|
|
// 更换头像
|
|
getimage(e) {
|
|
let that = this
|
|
let math = 'static/' + that.$u.guid(20)
|
|
wx.uploadFile({
|
|
url: 'https://up-z2.qiniup.com',
|
|
name: 'file',
|
|
filePath: e.detail.avatarUrl,
|
|
formData: {
|
|
token: that.token, //后端返回的token
|
|
key: 'smartmeter/img/' + math
|
|
},
|
|
success: function(res) {
|
|
let str = JSON.parse(res.data)
|
|
console.log(str);
|
|
that.userImgs = 'https://api.ccttiot.com/' + str.key
|
|
console.log(that.userImgs)
|
|
that.getxiugai()
|
|
}
|
|
})
|
|
},
|
|
// 修改个人信息
|
|
getxiugai() {
|
|
let data = {
|
|
avatar: this.userImgs
|
|
}
|
|
this.$u.put(`/app/user/editInfo`, data).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '修改成功',
|
|
icon: 'success',
|
|
duration: 2000
|
|
})
|
|
this.getinfo()
|
|
} else if (res.code == 401) {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您当前暂未登录,需前去登录吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
// 如果报错500或者其他说明 则提示系统报错
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 获取七牛云token
|
|
gettoken() {
|
|
this.$u.get(`/common/qiniuToken`).then(res => {
|
|
if (res.code == 200) {
|
|
this.token = res.data
|
|
}
|
|
})
|
|
},
|
|
// 点击跳转到存取酒页面
|
|
btncunqu() {
|
|
uni.navigateTo({
|
|
url: '/page_shanghu/cunqu/cunqujl'
|
|
})
|
|
},
|
|
// 获取用户信息
|
|
getinfo() {
|
|
this.$u.get(`/getInfo`).then(res => {
|
|
if (res.code == 200) {
|
|
this.getye()
|
|
this.roles = res.roles
|
|
this.info = res.user
|
|
this.flag = true
|
|
} else if (res.code == 401) {
|
|
this.flag = false
|
|
}
|
|
})
|
|
},
|
|
// 点击跳转各类协议
|
|
btnpage(num) {
|
|
if (num == 1) { //用户协议
|
|
uni.navigateTo({
|
|
url: '/page_shanghu/about?tit=' + '用户协议' + '&type=1'
|
|
})
|
|
} else if (num == 2) { //隐私政策
|
|
uni.navigateTo({
|
|
url: '/page_shanghu/about?tit=' + '隐私政策' + '&type=2'
|
|
})
|
|
} else { //关于我们
|
|
uni.navigateTo({
|
|
url: '/page_shanghu/about?tit=' + '关于我们' + '&type=3'
|
|
})
|
|
}
|
|
},
|
|
// 点击跳转到设备录入
|
|
btnluru() {
|
|
uni.navigateTo({
|
|
url: '/page_user/luru/index'
|
|
})
|
|
},
|
|
// 点击跳转到商户端
|
|
btnshanghu() {
|
|
uni.navigateTo({
|
|
url: '/page_shanghu/index'
|
|
})
|
|
},
|
|
// 点击跳转到编辑信息
|
|
btnbj() {
|
|
uni.navigateTo({
|
|
url: '/page_user/editxx'
|
|
})
|
|
},
|
|
// 点击退出登录
|
|
btntc() {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '您确定要退出登录吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #010000;
|
|
}
|
|
|
|
.container {
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.gender-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
width: 200rpx;
|
|
height: 70rpx;
|
|
background-color: #f8f8f8;
|
|
border-radius: 35rpx;
|
|
padding: 0 30rpx;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
border: none;
|
|
|
|
&::after {
|
|
border: none;
|
|
}
|
|
}
|
|
|
|
.gender-picker {
|
|
background-color: #fff;
|
|
border-radius: 24rpx;
|
|
padding: 40rpx 30rpx;
|
|
width: 680rpx;
|
|
position: fixed;
|
|
top: 40%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
z-index: 99;
|
|
}
|
|
|
|
.picker-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 40rpx;
|
|
|
|
.picker-title {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
color: #333;
|
|
}
|
|
}
|
|
|
|
.gender-options {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
margin-bottom: 50rpx;
|
|
|
|
.gender-option {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 200rpx;
|
|
padding: 30rpx 0;
|
|
border-radius: 16rpx;
|
|
border: 1rpx solid #eee;
|
|
|
|
&.active {
|
|
border-color: #FF8998;
|
|
background-color: #ffebed;
|
|
}
|
|
|
|
.gender-icon {
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
text {
|
|
font-size: 28rpx;
|
|
color: #666;
|
|
}
|
|
}
|
|
}
|
|
|
|
.confirm-btn {
|
|
background-color: #FF8998;
|
|
color: white;
|
|
border-radius: 50rpx;
|
|
width: 48%;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
font-size: 32rpx;
|
|
|
|
&:active {
|
|
background-color: #FF8998;
|
|
}
|
|
}
|
|
|
|
.gongzuotai {
|
|
width: 160rpx;
|
|
height: 80rpx;
|
|
position: fixed;
|
|
top: 200rpx;
|
|
right: 20rpx;
|
|
background-color: #010000;
|
|
color: #fff;
|
|
border-radius: 30rpx;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.bj {
|
|
width: 750rpx;
|
|
height: 574rpx;
|
|
position: fixed;
|
|
z-index: -1;
|
|
top: 0;
|
|
left: 0;
|
|
filter: blur(2px);
|
|
}
|
|
|
|
.box {
|
|
width: 750rpx;
|
|
height: 1082rpx;
|
|
background: #010000;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
border-radius: 30rpx 30rpx 0 0;
|
|
padding: 0 50rpx;
|
|
box-sizing: border-box;
|
|
|
|
.gongneng {
|
|
width: 644rpx;
|
|
max-height: 694rpx;
|
|
background: #0E0C0C;
|
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
|
margin-top: 24rpx;
|
|
padding: 40rpx 46rpx;
|
|
padding-bottom: 10rpx !important;
|
|
box-sizing: border-box;
|
|
|
|
.li {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 36rpx;
|
|
|
|
.one {
|
|
image {
|
|
width: 42rpx;
|
|
height: 42rpx;
|
|
margin-right: 28rpx;
|
|
}
|
|
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
color: #FFFFFF;
|
|
}
|
|
|
|
.jt {
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.qianm {
|
|
font-size: 28rpx;
|
|
color: #9F9F9F;
|
|
margin-top: 24rpx;
|
|
}
|
|
|
|
.name {
|
|
font-size: 36rpx;
|
|
color: #FFFFFF;
|
|
display: flex;
|
|
align-items: center;
|
|
margin-top: 38rpx;
|
|
|
|
image {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-left: 8rpx;
|
|
}
|
|
|
|
.nan {
|
|
image {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.top {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
button {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
top: -75rpx;
|
|
|
|
image {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
left: 0;
|
|
}
|
|
}
|
|
|
|
.pic {
|
|
image {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 50%;
|
|
position: absolute;
|
|
top: -75rpx;
|
|
}
|
|
}
|
|
|
|
.bianji {
|
|
width: 150rpx;
|
|
height: 48rpx;
|
|
background: #FFE7EA;
|
|
border-radius: 31rpx 31rpx 31rpx 31rpx;
|
|
font-size: 26rpx;
|
|
color: #FF8998;
|
|
text-align: center;
|
|
padding-top: 6rpx;
|
|
box-sizing: border-box;
|
|
margin-top: 38rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.zhanghu {
|
|
background: #181818;
|
|
border-radius: 24rpx;
|
|
padding: 30rpx 0 30rpx 0;
|
|
margin-top: 20rpx;
|
|
margin-bottom: 30rpx;
|
|
box-shadow: 0 4rpx 24rpx 0 rgba(0, 0, 0, 0.12);
|
|
width: 100%;
|
|
max-width: 650rpx;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
.tops {
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
color: #fff;
|
|
padding: 0 30rpx;
|
|
margin-bottom: 20rpx;
|
|
box-sizing: border-box;
|
|
|
|
image {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-right: 12rpx;
|
|
}
|
|
}
|
|
.bds {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 40rpx;
|
|
image{
|
|
width: 96rpx;
|
|
height: 88rpx;
|
|
margin: 10rpx 18rpx;
|
|
}
|
|
.lt,
|
|
.rt {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
flex: 1;
|
|
}
|
|
|
|
.shen {
|
|
font-size: 40rpx;
|
|
color: #FF8998;
|
|
font-weight: bold;
|
|
margin-bottom: 8rpx;
|
|
}
|
|
|
|
.qian {
|
|
font-size: 24rpx;
|
|
color: #bdbdbd;
|
|
}
|
|
}
|
|
.bd {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 0 40rpx;
|
|
image{
|
|
width: 96rpx;
|
|
height: 88rpx;
|
|
}
|
|
.lt,
|
|
.rt {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
flex: 1;
|
|
}
|
|
|
|
.shen {
|
|
font-size: 40rpx;
|
|
color: #FF8998;
|
|
font-weight: bold;
|
|
margin-bottom: 8rpx;
|
|
}
|
|
|
|
.qian {
|
|
font-size: 24rpx;
|
|
color: #bdbdbd;
|
|
}
|
|
}
|
|
}
|
|
</style> |