zyejMAll-mobile/pages/user/user_vip/list.vue

428 lines
9.2 KiB
Vue
Raw Permalink Normal View History

2024-10-21 17:47:58 +08:00
<!-- 会员信息 -->
<template>
2024-10-24 18:04:16 +08:00
<s-layout navbar="inner" title="SVIP会员专享" :statusBar="true" :bgStyle="{ color: '#FE832A', backgroundColor:'white' }"
navbarbackgroundColor="rgba(57,55,54)">
2024-10-21 17:47:58 +08:00
<view class='vip-main'>
<view class="vip-top">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/07cee74ec47ed41b33e277dffe9291a6cab8423d8f8539c34662a793842e6d27.png"
class="img"></image>
<view class="userInfo">
<view class="l">
<image :src="sheep.$url.cdn(userInfo.avatar)" mode="aspectFill" class="img"></image>
<view class="text">
<view class="t">{{ userInfo.nickname }}
<image src="" class="img"></image>
</view>
2024-10-24 18:04:16 +08:00
<view class="c" v-if="!userInfo.activate">您与众悦e家商场的第101天</view>
2024-10-24 10:55:27 +08:00
<view class="b" v-if="!userInfo.activate">开通即享会员权益</view>
2024-11-07 14:11:09 +08:00
<view class="b" v-if="userInfo.activate">
<text v-if="userInfo.cardName != '永久'">
SVIP会员
{{ sheep.$helper.timeFormat(userInfo.cardExpirationTime, 'yyyy-mm-dd') }} 到期</text>
<text class="b" v-if="userInfo.cardName == '永久'">永久SVIP会员</text>
</view>
2024-10-21 17:47:58 +08:00
</view>
</view>
2024-11-07 14:11:09 +08:00
<view class="r" v-if="!userInfo.activate && userInfo.cardName != '永久'">
2024-10-24 10:55:27 +08:00
<text>立即开通</text>
2024-10-21 17:47:58 +08:00
</view>
2024-11-07 14:11:09 +08:00
<view class="r" v-if="userInfo.activate && userInfo.cardName != '永久'">
2024-10-24 18:04:16 +08:00
<text>续费会员</text>
</view>
2024-10-21 17:47:58 +08:00
</view>
2024-10-24 18:04:16 +08:00
<!-- <view class="vipLv" v-if="userInfo.activate">当前卡片{{userInfo.cardName}}</view> -->
2024-10-21 17:47:58 +08:00
</view>
<view class="vip-zxq">
<image
src="https://zysc.fjptzykj.com:3000/shangcheng/d865a7766bf5ccbfb76e97f3fd65bcfdc37a612fe94878b7a899adab869360f8.png"
class="img"></image>
<view class="list">
<view class="item" v-for="(item, index) in vipList2" :key="index">
<view class="new-nei">
<view class="l">
2024-10-24 18:04:16 +08:00
<image :src="item.iconUrl" class="l-img"></image>
2024-10-21 17:47:58 +08:00
</view>
<view class="r">
<view class="t">
{{item.benName}}
</view>
<view class="b">
{{item.intro}}
</view>
</view>
</view>
</view>
</view>
<view class="" style="clear: both;">
</view>
</view>
2024-11-07 14:11:09 +08:00
<view class="vip-kt" v-if="userInfo.cardName != '永久'">
2024-10-21 17:47:58 +08:00
<view class="top">
2024-10-24 10:55:27 +08:00
<!-- <text class="t1" v-if="userInfo.activate == 1">试用会员</text> -->
<text class="t1" v-if="!userInfo.activate">开通会员</text>
2024-11-07 14:11:09 +08:00
<text class="t2">有效期至</text>
<text class="t3" v-if="timeAute">{{ timeAute }}</text>
<text class="t3" v-else>{{ sheep.$helper.timeFormat(userInfo.cardExpirationTime, 'yyyy-mm-dd') }}</text>
2024-10-21 17:47:58 +08:00
</view>
<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">
2024-10-24 18:04:16 +08:00
<view id="demo1" @click="vipFun(index,item.name)" class="scroll-view-item_H uni-bg-red"
:class="valVip == index ? 'on' : ''" v-for="(item,index) in vipList" :key="index">
2024-10-21 17:47:58 +08:00
<view class="t">{{item.name}}</view>
<view class="c"><text class="tx">{{item.specialPrice}}</text></view>
<view class="b" v-if="item.name=='试用'">试用1天</view>
2024-10-21 17:47:58 +08:00
<view class="b sc" v-else>{{item.originalPrice}}</view>
</view>
</scroll-view>
</view>
2024-11-07 14:11:09 +08:00
<view class="vip-text" v-if="userInfo.cardName != '永久'">
购买即视为同意<text class="ts"
@click="sheep.$router.redirect('/pages/user/user_vip/agreement')">会员用户协议</text>
2024-10-21 17:47:58 +08:00
</view>
2024-10-24 18:04:16 +08:00
<!-- <view class="vip-btn" @click="beclick()" v-if="!userInfo.activate">
2024-10-21 17:47:58 +08:00
立即试用
2024-10-24 10:55:27 +08:00
</view> -->
2024-11-07 14:11:09 +08:00
<view class="vip-btn" @click="beclick()" v-if="userInfo.cardName != '永久'">
2024-10-24 18:04:16 +08:00
立即开通
</view>
2024-10-21 17:47:58 +08:00
</view>
</s-layout>
</template>
<script setup>
import {
computed,
reactive,
onBeforeMount,
onMounted,
ref
} from 'vue';
import request from '@/sheep/request';
import {
baseUrl,
apiPath
} from '@/sheep/config';
import sheep from '@/sheep';
2024-10-24 18:04:16 +08:00
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
2024-10-21 17:47:58 +08:00
const userInfo = computed(() => sheep.$store('user').userInfo);
2024-11-07 14:11:09 +08:00
2024-10-21 17:47:58 +08:00
const vipList = ref([]);
const vipList2 = ref([]);
2024-10-24 10:55:27 +08:00
const valVip = ref(88888);
2024-10-21 19:28:07 +08:00
const nameVip = ref([]);
2024-11-07 14:11:09 +08:00
const timeAute = ref();
2024-10-21 17:47:58 +08:00
// 定义方法
function getList() {
request({
url: `${baseUrl}${apiPath}/member/card/type/list`,
method: 'GET',
2024-10-24 18:04:16 +08:00
params: {},
2024-10-21 17:47:58 +08:00
custom: {
showLoading: false,
},
}).then((res) => {
vipList.value = res.data;
});
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
// vipFun
2024-10-21 19:28:07 +08:00
let data = {
2024-10-24 18:04:16 +08:00
cardName: nameVip.value
2024-10-21 19:28:07 +08:00
}
2024-10-24 18:04:16 +08:00
function vipFun(index, name) {
2024-10-21 17:47:58 +08:00
valVip.value = index
2024-10-21 19:28:07 +08:00
data.cardName = name
2024-11-07 14:11:09 +08:00
if (name == '永久') {
timeAute.value = '永久会员';
} else {
timeAute.value = sheep.$helper.timeFormat(vipList.value[index].cardExpirationTime, 'yyyy-mm-dd');
}
console.log(userInfo.cardExpirationTime, "userInfo.cardExpirationTime")
2024-10-21 17:47:58 +08:00
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
// beclick
function beclick() {
2024-11-07 14:11:09 +08:00
if (data.cardName == '') {
sheep.$helper.toast('请选择')
return;
};
2024-10-21 17:47:58 +08:00
request({
url: `${baseUrl}${apiPath}/pay/member/create`,
method: 'post',
2024-10-21 19:28:07 +08:00
data,
2024-10-21 17:47:58 +08:00
custom: {
showLoading: false,
},
}).then((res) => {
2024-10-24 18:04:16 +08:00
if (res.code == 0) {
if (data.cardName == "试用") {
2024-10-24 10:55:27 +08:00
sheep.$helper.toast('试用开通成功');
// sheep.$router.go('/pages/index/user')
2024-10-24 18:04:16 +08:00
} else {
sheep.$router.go('/pages/pay/index', {
id: res.data.payOrderId,
type: 'vip',
vipid: res.data.id,
cardName: data.cardName
})
2024-10-24 10:55:27 +08:00
}
2024-10-24 18:04:16 +08:00
} else {
sheep.$helper.toast(res.msg);
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
});
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
// 定义方法2
function getList2() {
request({
url: `${baseUrl}${apiPath}/member/benefit/list`,
method: 'GET',
2024-10-24 18:04:16 +08:00
params: {},
2024-10-21 17:47:58 +08:00
custom: {
showLoading: false,
},
}).then((res) => {
vipList2.value = res.data;
});
}
// 使用 onMounted 生命周期钩子
onMounted(() => {
getList();
getList2();
});
</script>
<style lang="scss" scoped>
.vip-main {
margin-top: -3.75rem;
.vip-top {
width: 100%;
height: 200px;
// background: rgba(57, 55, 54);
position: relative;
2024-10-24 18:04:16 +08:00
.vipLv {
position: absolute;
2024-10-24 10:55:27 +08:00
bottom: 93px;
right: 10%;
color: #8a745c;
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
.img {
width: 100%;
height: 100%;
}
.userInfo {
position: absolute;
bottom: 38px;
padding: 0 20px;
display: flex;
justify-content: space-between;
left: 50%;
transform: translateX(-50%);
width: 85%;
align-items: center;
.l {
display: flex;
justify-content: space-between;
align-items: center;
.img {
width: 50px;
height: 50px;
border-radius: 23px;
margin-right: 10px;
}
.text {
.t {
2024-10-24 18:04:16 +08:00
font-size: 16px;
2024-10-21 17:47:58 +08:00
font-weight: 700;
.img {
width: 20px;
height: 20px;
}
}
.c {
color: rgba(208, 185, 156);
font-size: 13px;
}
.b {
color: rgba(201, 141, 99);
2024-10-24 18:04:16 +08:00
font-size: 12px;
2024-10-21 17:47:58 +08:00
margin-top: 7px;
}
}
}
.r {
color: #8a745c;
2024-10-24 18:04:16 +08:00
font-size: 12px;
padding: 5px 10px;
2024-10-21 17:47:58 +08:00
background: white;
2024-10-24 18:04:16 +08:00
border-radius: 0 11px 0 11px;
position: absolute;
right: 7px;
bottom: 64px;
2024-10-21 17:47:58 +08:00
}
}
}
.vip-zxq {
.img {
2024-10-24 18:04:16 +08:00
width: 63%;
height: 68px;
2024-10-21 17:47:58 +08:00
margin: 0 auto;
display: block;
margin-top: 20px;
}
.list {
padding: 0 10px;
.item {
width: 47%;
float: left;
padding: 5px;
.new-nei {
background: rgba(247, 247, 247);
padding: 15px 10px;
display: flex;
align-items: center;
.l {
display: flex;
align-items: center;
.l-img {
2024-10-24 18:04:16 +08:00
width: 40px;
height: 40px;
2024-10-21 17:47:58 +08:00
margin-right: 10px;
}
}
.r {
.t {}
.b {
font-size: 13px;
color: rgba(191, 147, 109);
}
}
}
}
}
}
.vip-kt {
padding: 10px 10px;
.top {
.t1 {
font-size: 17px;
font-weight: 700;
margin-right: 10px;
}
.t2 {
font-size: 15px;
margin-right: 10px;
color: rgba(121, 121, 121);
}
.t3 {
font-size: 13px;
color: rgba(174, 90, 42);
}
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
.scroll-view_H {
white-space: nowrap;
width: 100%;
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
.scroll-view-item_H {
display: inline-block;
background-color: white;
2024-10-24 18:04:16 +08:00
border: 1px solid rgba(214, 214, 214);
margin-right: 15px;
2024-10-21 17:47:58 +08:00
border-radius: 10px;
2024-10-24 18:04:16 +08:00
margin-top: 15px;
padding: 10px 3px;
width: 100px;
&.on {
background-color: rgba(254, 247, 236);
border: 1px solid rgba(252, 194, 130);
2024-10-21 17:47:58 +08:00
}
2024-10-24 18:04:16 +08:00
.t {
color: rgba(117, 78, 25);
2024-10-21 17:47:58 +08:00
font-weight: 700;
2024-10-24 18:04:16 +08:00
font-size: 15px;
2024-10-21 17:47:58 +08:00
text-align: center;
}
2024-10-24 18:04:16 +08:00
.c {
color: rgba(117, 78, 25);
// color: rgba(117, 78, 25);
2024-10-21 17:47:58 +08:00
font-weight: 700;
2024-10-24 18:04:16 +08:00
font-size: 15px;
2024-10-21 17:47:58 +08:00
text-align: center;
2024-10-24 18:04:16 +08:00
padding: 10px 0;
.tx {
font-size: 20px;
2024-10-21 17:47:58 +08:00
}
}
2024-10-24 18:04:16 +08:00
.b {
color: rgba(173, 173, 173);
font-size: 14px;
2024-10-21 17:47:58 +08:00
text-align: center;
2024-10-24 18:04:16 +08:00
&.sc {
2024-10-21 17:47:58 +08:00
text-decoration: line-through;
}
}
}
}
}
.vip-text {
text-align: center;
color: rgba(157, 157, 157);
margin: 15px 0;
2024-10-24 18:04:16 +08:00
font-size: 13px;
2024-10-21 17:47:58 +08:00
.ts {
color: rgba(174, 90, 42);
}
}
.vip-btn {
padding: 10px 0;
background: rgba(254, 220, 137);
text-align: center;
margin: 0 15px;
2024-10-24 18:04:16 +08:00
border-radius: 9px;
2024-10-21 17:47:58 +08:00
color: rgba(95, 53, 38);
}
2024-10-24 18:04:16 +08:00
2024-10-21 17:47:58 +08:00
}
</style>