Files
peiwan-uniapp/pages/user/vip.vue

382 lines
8.6 KiB
Vue
Raw Normal View History

2025-01-21 01:46:34 +08:00
<template>
<s-layout title="我的特权">
<view class="page" v-if="isPass">
<view class="vip-box">
<view class="vip-name">VIP尊享会员</view>
<view class="vip-tip-box">
<u-avatar size="50" :src="userInfo.avatar"></u-avatar>
<view class="vip-tip" v-if="userInfo.isVip">VIP会员({{showDayTime(userInfo.vipEndTime)}}到期)</view>
<view class="vip-tip" v-else>暂未激活VIP会员</view>
</view>
</view>
<view class="price-tab-box">
<view class="price-tab" v-for="(item, index) in dataList" :key="index">
<view @click="changeTab(index)" class="price-tab-border" :class="[currentIndex==index ? 'active' : '']">
<view class="price-texta">{{item.num}}{{item.unit}}</view>
<view class="price-textb">{{item.month}}/{{item.tip}}</view>
<view class="price-textc">{{item.pay}}</view>
<view class="tab-band" v-if="item.band">新人优惠</view>
</view>
</view>
</view>
<view class="vip-title">
VIP特权
</view>
<!-- <view class="vip-info">
<view class="vip-info-icon">
<u-icon name="star-fill" color="#ffd32f" size="36"></u-icon>
</view>
<view>
<view class="vip-info-title">拥有申请置顶推荐特权</view>
<view class="vip-info-text">每天可以免费申请置顶推荐</view>
</view>
</view> -->
<view class="vip-info">
<view class="vip-info-icon">
<u-icon name="edit-pen-fill" color="#ffd32f" size="36"></u-icon>
</view>
<view>
<view class="vip-info-title">每天3次发布动态无广告</view>
<view class="vip-info-text">每天免费发布3次无广告增加曝光</view>
</view>
</view>
<view class="vip-info">
<view class="vip-info-icon">
<u-icon name="weixin-fill" color="#ffd32f" size="36"></u-icon>
</view>
<view>
<view class="vip-info-title">每天5次交换名片</view>
<view class="vip-info-text">每天可以免费交换5次名片</view>
</view>
</view>
<view class="vip-info">
<view class="vip-info-icon">
<u-icon name="chat-fill" color="#ffd32f" size="36"></u-icon>
</view>
<view>
<view class="vip-info-title">打招呼聊天免费</view>
<view class="vip-info-text">打招呼聊天发送消息无限制</view>
</view>
</view>
<view class="vip-info">
<view class="vip-info-icon">
<u-icon name="star-fill" color="#ffd32f" size="36"></u-icon>
</view>
<view>
<view class="vip-info-title">每天3次首页置顶</view>
<view class="vip-info-text">每天可以免费置顶3次</view>
</view>
</view>
<view class="vip-info">
<view class="vip-info-icon">
<u-icon name="map-fill" color="#ffd32f" size="40"></u-icon>
</view>
<view>
<view class="vip-info-title">可查看同城的用户</view>
<view class="vip-info-text">离得近奔现的概率更高</view>
</view>
</view>
<view v-if="platform == 'android'">
<view class="btn-box" v-if="userInfo.isVip">
<view class="buy-btn">已开通</view>
</view>
<view class="btn-box" v-else>
<view class="btn-border" @click="payHandle">
<view class="buy-btn">{{pay.pay}} 立即购买</view>
<view class="btn-tip">每天不到{{pay.day}}</view>
</view>
<!-- <view class="btn-border" @click="goPay">
<view class="pay-btn">去充值趣豆</view>
</view> -->
</view>
</view>
<view v-else>
<view class="btn-box" v-if="userInfo.isVip">
<view class="buy-btn">已开通</view>
</view>
<view class="btn-box" v-else>
<view class="btn-border" @click="payHot">
<view class="buy-btn">{{pay.pay}} 购买会员</view>
<view class="btn-tip">每天不到{{pay.day}}</view>
</view>
<!-- <view class="btn-border" @click="goPay">
<view class="pay-btn">去充值趣豆</view>
</view> -->
</view>
</view>
</view>
</s-layout>
</template>
<script>
import sheep from '@/sheep';
import PayPointApi from '@/sheep/api/pay/point';
import dayjs from 'dayjs';
export default {
data() {
return {
currentIndex: 1,
dataList: [
{
band: false,
num: 1,
month: 5.7,
pay: 40,
day: 5.7,
unit: '个周',
tip: '天',
},
{
band: true,
num: 1,
month: 2.5,
pay: 80,
day: 2.5,
unit: '个月',
tip: '天',
},
{
band: false,
num: 6,
month: 40,
pay: 240,
day: 1.2,
unit: '个月',
tip: '月',
}
],
pay: {
},
my: 'false',
platform: 'android',
}
},
onLoad(option) {
this.my = option.my;
this.pay = this.dataList[this.currentIndex];
var that = this;
uni.getSystemInfo({
success: function(e) {
that.platform = e.platform;
}
});
sheep.$store('user').getInfo();
},
computed: {
userInfo: {
get() {
return sheep.$store('user').userInfo;
},
},
isPass() {
return sheep.$store('user').tradeConfig.weixinEnabled;
},
},
methods: {
changeTab(index) {
this.currentIndex = index;
this.pay = this.dataList[index];
},
payHot() {
uni.showModal({
title: '温馨提示',
content: '苹果用户请联系客服充值客服微信rbtnet',
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.setClipboardData({
data: 'rbtnet' ,
success: function (res) {
uni.showToast({
title: '复制成功',
});
}
});
}
}
});
},
goPay() {
this.$u.route({
url: 'pages/me/coin/pay',
params: {
my: 'true',
}
});
},
payHandle() {
var coinNum = 100*this.pay.pay;
PayPointApi.createPointRecharge({
payPrice: coinNum,
}).then(res => {
sheep.$router.go('/pages/pay/vip/index', {
id: res.data.payOrderId,
orderType: 'recharge',
});
});
},
showDayTime(datetime) {
if (!datetime) return "";
return dayjs(datetime).format('YYYY-MM-DD HH:mm:ss');
},
}
}
</script>
<style lang="scss" scoped>
.page {
padding: 15px;
padding-bottom: 150px;
background-color: #fff;
}
.vip-box {
padding: 15px;
background-image: linear-gradient(180deg, #ffd32f, #db854e);
align-items: center;
justify-content: center;
display: flex;
flex-direction: column;
border-radius: 10px;
margin-bottom: 15px;
}
.vip-name {
color: #fff;
font-size: 32rpx;
font-weight: bold;
margin-bottom: 50rpx;
}
.vip-tip {
color: #fff;
font-size: 24rpx;
margin-left: 5px;
}
.price-tab-box {
display: flex;
}
.price-tab {
display: flex;
flex: 1;
padding-right: 5px;
}
.price-tab .active {
border: 8rpx solid #e09049;
color: #e09049;
}
.price-tab-box .price-tab:last-child {
padding-right: 0;
}
.price-tab-border {
border: 8rpx solid #f5e8e8;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
padding: 20px 0;
border-radius: 10px;
color: #858585;
position: relative;
}
.price-texta {
font-size: 36rpx;
margin-bottom: 5px;
font-weight: bold;
}
.price-textb {
font-size: 30rpx;
margin-bottom: 5px;
}
.price-textc {
font-size: 36rpx;
}
.vip-title {
font-size: 28rpx;
color: #9e9696ed;
padding: 15px 0;
font-weight: bold;
}
.vip-info {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.vip-info-icon {
margin-right: 10px;
display: flex;
align-items: center;
justify-content: center;
border: 3px solid #f5e8e8;
padding: 15px;
border-radius: 10px;
}
.vip-info-title {
font-size: 30rpx;
margin-bottom: 5px;
font-weight: bold;
}
.vip-info-text {
font-size: 26rpx;
color: #858585;
}
.btn-box {
position: fixed;
bottom: 20px;
left: 0;
right: 0;
padding: 15px;
}
.buy-btn {
display: flex;
align-items: center;
justify-content: center;
background-color: #ffd32f;
padding: 15px;
border-radius: 10px;
font-size: 30rpx;
font-weight: bold;
color: #fff;
}
.pay-btn {
display: flex;
align-items: center;
justify-content: center;
background-color: #18b566;
padding: 15px;
border-radius: 10px;
font-size: 30rpx;
font-weight: bold;
color: #fff;
}
.btn-border {
position: relative;
margin-top: 30rpx;
}
.tab-band {
position: absolute;
background-color: #efc93c;
top: -10px;
border-radius: 5px;
padding: 5px 10px;
font-size: 22rpx;
color: #fff;
}
.vip-tip-box {
display: flex;
align-items: center;
}
.btn-tip {
position: absolute;
background-color: #efa3fa;
top: -10px;
right: -3px;
border: 3px solid #fff;
border-radius: 10px;
padding: 3px 5px;
font-size: 22rpx;
color: #fff;
}
</style>