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.
 
 
 
 
high-mini/pages/tabBar/user/user.vue

828 lines
18 KiB

<template>
<view>
<!-- #ifdef H5 -->
<view v-if="showHeader" class="status" :style="{position:headerPosition,top:statusTop}"></view>
<view v-if="showHeader" class="header" :style="{position:headerPosition,top:headerTop}"></view>
<!-- 占位 -->
<view v-if="showHeader" class="place"></view>
<!-- #endif -->
<view class="user">
<!-- 头像 -->
<view class="left">
<image :src="imagewxUrl+imgadres" v-if="!user.headerImg"></image>
<image :src="user.headerImg" v-else></image>
</view>
<!-- 昵称,个性签名 -->
<view class="right">
<!-- #ifdef MP -->
<view class="username" v-if="user && user.infoCompleteStatus == 1" @click="jumplogin">点击获取信息</view>
<view class="username" v-else>{{user.name}}</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="username" >{{user.name}}</view>
<!-- #endif -->
<view class="font14 fcorfff" v-if="!user.gold">积分: 0</view>
<view class="font14 fcorfff" v-else>积分: {{user.gold}} 个</view>
<!-- <view class="signature" @tap="toSetting">{{user.signature}}</view> -->
</view>
<!-- 二维码按钮 -->
<!-- #ifdef MP -->
<button class="erweima fotct aliitem font14" v-if="user == null" open-type="getPhoneNumber"
@getphonenumber="loginByPhone">
<image src="../../../static/img/jingbi.png"></image> 充值积分
</button>
<button class="erweima fotct aliitem font14" v-else @click="toDeposit">
<image src="../../../static/img/jingbi.png"></image> 充值积分
</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<button class="erweima fotct aliitem font14" v-if="user.phone == null" @click="jumpH5Bding">
<image src="../../../static/img/jingbi.png"></image> 充值积分
</button>
<button class="erweima fotct aliitem font14" v-else @click="toDeposit">
<image src="../../../static/img/jingbi.png"></image> 充值积分
</button>
<!-- #endif -->
</view>
<!-- 订单-余额 -->
<view class="order">
<!-- 订单类型 -->
<view class="title">我的订单</view>
<view class="list">
<view class="box" v-for="(row,index) in orderList" :key="index" @tap="toOrderList(index)">
<uni-badge style="width: 20px;position: absolute; left: 15%;" v-if="row.text == '待支付' && therrNum "
:text="therrNum" type="error" size="normal"></uni-badge>
<view class="img">
<view class="icon" :class="row.icon"></view>
</view>
<view class="text">{{row.text}}</view>
</view>
</view>
</view>
<!-- 话费充值 -->
<view class="order">
<!-- 订单类型 -->
<view class="title">话费充值</view>
<view class="list">
<view class="box" v-for="(row,index) in huafeiList" :key="index" @tap="toOrdehuafeirList(index)">
<view class="img">
<view class="icon" :class="row.icon"></view>
</view>
<view class="text">{{row.text}}</view>
</view>
</view>
</view>
<!-- 工具栏 -->
<view class="toolbar">
<view class="title">卡券中心</view>
<view class="list">
<view class="box" v-for="(row,index) in mytoolbarList" :key="index" @tap="toPage(row.url,row.text)">
<!-- <view style="width: 10px;height: 10px;">
<uni-badge text="1" type="error" />
</view> -->
<uni-badge style="width: 20px;position: absolute; right: 30%;" v-if="row.text == '我的卡券' && textnum "
:text="textnum" type="error" size="normal"></uni-badge>
<uni-badge style="width: 20px;position: absolute; right: 7%;"
v-if="row.text == '我的优惠券' && textSend " :text="textSend" type="error" size="normal"></uni-badge>
<view class="img">
<image :src="imagewxUrl+row.img"></image>
</view>
<view class="text">{{row.text}}</view>
</view>
</view>
</view>
<!-- 我的推广 -->
<view class="toolbar" style="margin-top: 20px;">
<view class="title">推广中心</view>
<view class="list">
<view class="box" v-for="(row,index) in mytgbarList" :key="index" @tap="toPage(row.url,row.text)">
<!-- <view style="width: 10px;height: 10px;">
<uni-badge text="1" type="error" />
</view> -->
<uni-badge style="width: 20px;position: absolute; right: 30%;" v-if="row.text == '我的卡券' && textnum "
:text="textnum" type="error" size="normal"></uni-badge>
<uni-badge style="width: 20px;position: absolute; right: 7%;"
v-if="row.text == '我的优惠券' && textSend " :text="textSend" type="error" size="normal"></uni-badge>
<view class="img" v-if="row.text != '客服' ">
<image :src="imagewxUrl+row.img"></image>
</view>
<view class="text" v-if="row.text != '客服' ">{{row.text}}</view>
<button open-type="contact" style="background-color: transparent;" class="img" show-message-card
session-from send-message-path send-message-title v-if="row.text == '客服' ">
<image :src="imagewxUrl+row.img"></image>
</button>
<view class="text" v-if="row.text == '客服' ">{{row.text}}</view>
</view>
</view>
</view>
<view class="toolbar" style="margin-top: 20px;">
<view class="title">我的</view>
<view class="list">
<view class="box" v-for="(row,index) in czList" :key="index" @tap="toPage(row.url,row.text)">
<view class="img">
<image :src="row.img"></image>
</view>
<view class="text">{{row.text}}</view>
</view>
</view>
</view>
<!-- 占位 -->
<view class="place-bottom"></view>
<!-- <authorize></authorize> -->
</view>
</template>
<script>
import {
loginByPhone,
findUser
} from "../../../Utils/Api.js";
// import authorize from '../../../components/Authorize';
import uniBadge from "../../../components/uni-badge/components/uni-badge/uni-badge.vue";
let app = getApp()
export default {
components: {
// authorize,
uniBadge
},
data() {
return {
isfirst: true,
imagewxUrl: app.globalData.imageWxImg,
imgadres: 'head.png',
headerPosition: "fixed",
textnum: '',
textSend: '',
therrNum: '',
headerTop: null,
statusTop: null,
showHeader: true,
//个人信息,
user: "",
// 订单类型
orderList: [{
text: '待支付',
icon: "fukuan"
},
{
text: '已支付',
icon: "fahuo"
},
{
text: '已完成',
icon: "shouhuo"
}, {
text: '已退款',
icon: "tuihuo"
}, {
text: '已取消',
icon: "pingjia"
}
],
huafeiList: [{
text: '待支付',
icon: "fukuan"
},
{
text: '已支付',
icon: "fahuo"
},
{
text: '已完成',
icon: "shouhuo"
}, {
text: '已取消',
icon: "pingjia"
}, {
text: '已退款',
icon: "tuihuo"
}
],
// 工具栏列表
mytoolbarList: [{
url: '/pages/goods/recording/recording?id=1',
text: '充值记录',
img: 'user/mingxi.png'
},
{
url: '/pages/goods/recording/recording?id=2',
text: '消费记录',
img: 'user/quan.png'
},
{
url: '/pages/user/mineCoupons/mineCoupons',
text: '我的卡券',
img: 'user/choujiang.png'
},
{
url: '../../user/coupon/coupon',
text: '我的优惠券',
img: 'user/momey.png'
}
],
// 推广列表
mytgbarList: [{
url: '',
text: '客服',
img: 'user/kefu.png'
},
{
url: '../../login/login?id=1',
text: '商户入口',
img: 'user/point.png'
},
{
url: '../../login/login?id=2',
text: '代理商登录',
img: 'user/renw.png'
}
// ,
// {
// url: '/pages/user/Charge/Charge',
// text: '充话费',
// img: 'user/bank.png'
// }
],
//操作列表
czList: '',
}
},
//下拉刷新,需要自己在page.json文件中配置开启页面下拉刷新 "enablePullDownRefresh": true
onPullDownRefresh() {
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
this.headerPosition = e.scrollTop >= 0 ? "fixed" : "absolute";
this.headerTop = e.scrollTop >= 0 ? null : 0;
this.statusTop = e.scrollTop >= 0 ? null : -this.statusHeight + 'px';
},
onLoad() {
this.statusHeight = 0;
// #ifdef H5
this.showHeader = true;
// this.statusHeight = plus.navigator.getStatusbarHeight();
// #endif
if (!app.globalData.userInfo) {
this.findUser()
}
},
onReady() {
//此处,演示,每次页面初次渲染都把登录状态重置
uni.setStorage({
key: 'UserInfo',
data: false,
success: function() {},
fail: function(e) {}
});
},
onShow() {
if (app.globalData.userInfo) {
this.findUser();
}
if (!app.globalData.userInfo.isSetPayPwd) {
this.czList = [{
url: '../../user/cardDes/cardDes',
text: '工会卡',
img: '../../../static/img/ghkpay.png'
},
{
url: '../../login/updatePas/updatePas',
text: '设置密码',
img: '../../../static/img/pas.png'
},
]
return;
}
// '../../user/unionCard/unionCard'
this.czList = [{
url: '../../user/cardDes/cardDes',
text: '工会卡',
img: '../../../static/img/ghkpay.png'
},
{
url: '../../login/updatePas/resetPas',
text: '修改密码',
img: '../../../static/img/pas.png'
},
]
},
methods: {
findUser() {
let params;
findUser(params).then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data;
this.user = res.return_data;
this.textnum = res.return_data.unusedCouponNum;
this.textSend = res.return_data.unusedDiscount;
this.therrNum = res.return_data.unpaid;
uni.setStorage({
key: "user",
data: res.return_data
})
}
});
},
loginByPhone(PhoneNumber) {
if (PhoneNumber.detail.iv == undefined) {
uni.showToast({
title: "用户取消授权",
icon: "none"
});
return;
}
let params = {
openId: app.globalData.openId,
iv: PhoneNumber.detail.iv,
encryptedData: PhoneNumber.detail.encryptedData
}
loginByPhone(params).then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data
.object
.highUser;
app.globalData.token = res.return_data.uniqueCode;
uni.setStorage({
key: "token",
data: res.return_data.uniqueCode
})
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
this.toDeposit();
}
});
},
// H5获取手机号
jumpH5Bding() {
uni.navigateTo({
url: '/pages/login/register'
})
},
//跳转用户信息
jumplogin() {
uni.navigateTo({
url: '../../userLogin/userLogin'
})
},
//消息列表
toMsg() {
uni.showToast({
title: '暂未开通',
icon: 'none'
});
},
toOrderList(index) {
uni.navigateTo({
url: '../../user/order_list/order_list?tbIndex=' + index
})
},
//话费充值
toOrdehuafeirList(index) {
uni.navigateTo({
url: '../../../subPages/unionPay-orderList/unionPay-orderList?tbIndex=' + index
})
},
toLogin() {
uni.showToast({
title: '请登录',
icon: "none"
});
uni.navigateTo({
url: '../../login/login'
})
this.isfirst = false;
},
isLogin() {
//实际应用中,用户登录状态应该用token等方法去维持登录状态.
const value = uni.getStorageSync('UserInfo');
if (value) {
return true;
}
return false
},
toDeposit() {
uni.navigateTo({
url: '../../user/deposit/deposit'
})
},
toPage(url, item) {
if (item != '客服') {
uni.navigateTo({
url: url
})
}
// #ifdef H5
if (item == '客服') {
uni.showModal({
title: '客服',
content: '4006780738',
success: function(res) {
if (res.confirm) {
uni.makePhoneCall({
phoneNumber: '4006780738', //电话号码
success: function(e) {
console.log(e);
},
fail: function(e) {
console.log(e);
}
})
}
}
})
}
// #endif
}
}
}
</script>
<style lang="scss">
page {
position: relative;
background-color: #fff;
}
.status {
width: 100%;
height: 0;
position: fixed;
z-index: 10;
background-color: #0083f5;
top: 0;
/* #ifdef APP-PLUS */
height: var(--status-bar-height); //覆盖样式
/* #endif */
}
.header {
width: 92%;
padding: 0 4%;
height: 100upx;
display: flex;
justify-content: flex-end;
align-items: center;
position: fixed;
top: 0;
z-index: 10;
background-color: #0083f5;
/* #ifdef APP-PLUS */
top: var(--status-bar-height);
/* #endif */
.icon-btn {
width: 120upx;
height: 60upx;
flex-shrink: 0;
display: flex;
.icon {
color: #fff;
width: 60upx;
height: 60upx;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 42upx;
}
}
}
button::after {
border: none
}
.status {
width: 100%;
height: 0;
position: fixed;
z-index: 10;
background-color: #0083f5;
top: 0;
/* #ifdef APP-PLUS */
height: var(--status-bar-height); //覆盖样式
/* #endif */
}
.header {
width: 92%;
padding: 0 4%;
height: 100upx;
display: flex;
justify-content: flex-end;
align-items: center;
position: fixed;
top: 0;
z-index: 10;
background-color: #0083f5;
/* #ifdef APP-PLUS */
top: var(--status-bar-height);
/* #endif */
.icon-btn {
width: 120upx;
height: 60upx;
flex-shrink: 0;
display: flex;
.icon {
color: #fff;
width: 60upx;
height: 60upx;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 42upx;
}
}
}
.place {
background-color: #0083f5;
padding-left: 20px;
padding-right: 20px;
text-align: right;
height: 100upx;
/* #ifdef APP-PLUS */
margin-top: var(--status-bar-height);
/* #endif */
image {
width: 30px;
height: 30px;
}
}
.place-bottom {
height: 300upx;
}
.user {
width: 96%;
padding: 0 4%;
display: flex;
align-items: center;
// position: relative;
background-color: #0083f5;
padding-bottom: 40rpx;
.left {
width: 20vw;
height: 20vw;
flex-shrink: 0;
margin-right: 20upx;
border: solid 1upx #fff;
border-radius: 100%;
image {
width: 20vw;
height: 20vw;
border-radius: 100%;
}
}
.right {
width: 100%;
.username {
font-size: 36upx;
color: #fff;
}
.signature {
color: #eee;
font-size: 28upx;
}
}
.erweima {
flex-shrink: 0;
width: 100px;
height: 30px;
border-radius: 15px 0px 0px 15px;
padding: 0;
margin-left: 5vw;
background-color: #1391f6;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
image {
width: 30rpx;
height: 30rpx;
}
.icon {
color: #7b6335;
font-size: 42upx;
}
}
}
.order {
.title {
padding-top: 10upx;
margin: 0 0 10upx 3%;
font-size: 30upx;
height: 80upx;
display: flex;
align-items: center;
}
width: 92%;
margin: 30rpx 4% 30rpx 4%;
padding: 0rpx 0% 20rpx 0%;
background-color: #fff;
box-shadow: 0rpx 0rpx 25rpx rgba(0, 0, 0, 0.1);
border-radius: 15rpx;
.list {
display: flex;
padding-bottom: 10upx;
.box {
width: 25%;
.img {
width: 100%;
display: flex;
justify-content: center;
.icon {
font-size: 50upx;
color: #464646;
}
}
.text {
width: 100%;
display: flex;
justify-content: center;
font-size: 28upx;
color: #3d3d3d;
}
}
}
.balance-info {
display: flex;
padding: 10upx 0;
.left {
width: 75%;
display: flex;
.box {
width: 50%;
font-size: 28upx;
.num {
width: 100%;
height: 50upx;
display: flex;
justify-content: center;
align-items: flex-end;
color: #f9a453;
}
.text {
width: 100%;
display: flex;
justify-content: center;
color: #3d3d3d;
font-size: 28upx;
}
}
}
.right {
border-left: solid 1upx #17e6a1;
width: 25%;
.box {
.img {
width: 100%;
height: 50upx;
display: flex;
justify-content: center;
align-items: flex-end;
.icon {
font-size: 45upx;
color: #e78901;
}
}
.text {
width: 100%;
display: flex;
justify-content: center;
font-size: 28upx;
color: #3d3d3d;
}
}
}
}
}
.VIP {
width: 84%;
margin: -65upx auto 20upx auto;
padding: 30upx 4%;
background: linear-gradient(to left, #dea96d 0%, #f6d59b 100%);
box-shadow: 0upx 0upx 25upx rgba(0, 0, 0, 0.2);
border-radius: 15upx;
display: flex;
align-items: center;
.img {
flex-shrink: 0;
width: 60upx;
height: 60upx;
image {
width: 60upx;
height: 60upx;
}
}
.title {
width: 100%;
color: #796335;
font-size: 30upx;
}
.tis {
width: 100%;
display: flex;
justify-content: flex-end;
color: #fcf0d0;
font-size: 26upx;
}
}
.toolbar {
width: 92%;
margin: 0 4% 0 4%;
padding: 0 0 20upx 0;
background-color: #fff;
box-shadow: 0upx 0upx 25upx rgba(0, 0, 0, 0.1);
border-radius: 15upx;
.title {
padding-top: 10upx;
margin: 0 0 10upx 3%;
font-size: 30upx;
height: 80upx;
display: flex;
align-items: center;
}
.list {
display: flex;
flex-wrap: wrap;
.box {
width: 25%;
margin-bottom: 30upx;
.img {
width: 23vw;
height: 10.5vw;
display: flex;
justify-content: center;
image {
width: 9vw;
height: 9vw;
}
}
.text {
width: 100%;
display: flex;
justify-content: center;
font-size: 26upx;
color: #3d3d3d;
}
}
}
}
</style>