vip功能测试

This commit is contained in:
liuyuan
2025-02-19 16:29:37 +08:00
parent fe907b792f
commit 346da3ec4e
27 changed files with 255 additions and 251 deletions

View File

@@ -10,7 +10,6 @@
v-for="(item, index) in dataList"
:key="item.id"
:index="index"
style="align-items: flex-start"
>
<view
:class="['titleItem', '']"
@@ -80,11 +79,9 @@ export default {
float: left !important;
padding: 20rpx 30rpx;
box-sizing: border-box;
// border-bottom: 1rpx solid #e0e0e0;
display: flex;
align-items: center;
align-items: center !important;
justify-content: space-between;
// position: relative;
}
.list_item :last-child(1) {
border-bottom: none;

View File

@@ -9,8 +9,8 @@
style="height: 100%">
<view @click="gotoDetail(item, index)" class="scroll-view-item list_item"
v-for="(item, index) in dataList" :key="indexKey ? item[indexKey] : item.id"
:index="indexKey ? item[indexKey] : index" style="align-items: flex-start">
<view :class="['titleItem', '']" :style="`width:${isNoIcon ? '100%' : 'calc(100% - 30rpx)'}`">
:index="indexKey ? item[indexKey] : index">
<view :class="['titleItem', '']">
<slot name="leftSlot" :row="item" :item="item" :index="index"> </slot>
<template v-if="isCondition">
@@ -143,6 +143,7 @@
.titleItem {
width: calc(100% - 30rpx);
justify-content: space-between;
}
/deep/.scroll-view-item:nth-child(2n-1) {

View File

@@ -11,46 +11,22 @@
titleKey="title" dataListKey="courseList" :titleStyle="{}" :tabStyle="{
background: '#fff',
}">
<template slot="tabs" slot-scope="slotProps"> </template>
<template slot="labelSlot" slot-scope="slotProps">
<u-icon v-if="slotProps.data.isBuy != 1 && (vip.type == 0 || vip.type == 2)" class="editIcon"
name="lock-fill" color="#aaa" size="26" style="display: inline-block; margin-left: 5rpx"></u-icon>
</template>
<template slot="otherContent" slot-scope="slotProps">
<u-alert v-if="goBuyTitle" style="
background: linear-gradient(90deg, #5f8f7f 0%, #f3faf3 100%);
/* position: fixed;
left: 0;
width: 100%;
z-index: 10; */
" type="warning" @click="$platform == 'android'?handleClickGetVip:''" :title="goBuyTitle" :show-icon="true">
<template slot="rightSlot" slot-scope="slotProps" v-if="$platform == 'android'">
<text class="saveBtn vipBtn flexbox buyBtn" v-if="goBuyType == 0">
立即购买
</text>
<text class="flexbox" style="color: #5f8f7f" v-if="goBuyType == 1">
立即续费
</text>
<text class="saveBtn vipBtn flexbox" style="
font-weight: bold;
padding-top: 6rpx;
padding-bottom: 6rpx;
background: #00d8df !important;
color: #fff;
" v-if="goBuyType == 2 || goBuyType == 3">
立即升级
</text>
<view> </view>
</template>
</u-alert>
<view v-if="curriculumData.image" :style="`height: auto !important;${goBuyTitle ? '' : ''}`">
<view v-if="goBuyTitle && isAndorid" class="describe_block">
<view style=" display: flex;">
<uni-icons type="info" size="20" color="#fff"></uni-icons>
<text>{{goBuyTitle}}</text>
</view>
<button class="saveBtn flexbox buyBtn" v-if="goBuyType == 0" @click="handleClickGetVip">
立即购买
</button>
</view>
<view v-if="curriculumData.image" :style="isAndorid?'padding-top:80rpx;':''">
<image style="width: 100%" :src="curriculumData.image" mode="widthFix"
@click="previewImage(curriculumData.image)">
</image>
</view>
<view v-else class="headImage" style="height: 400rpx; background-color: #f5f5f5">
</view>
@@ -96,43 +72,21 @@
slotProps.data.title
}}</text>
</view>
<view class="not_purchased" v-if="
(slotProps.data.isBuy == 0 &&
(vip.type == 0 || vip.type == 2)) ||
(slotProps.data.isBuy == 1 &&
(vip.type == 0 || vip.type == 2) &&
slotProps.data.endTime)
">
<view class="not_purchased">
<view class="spot"></view>
<text v-if="userVip==null&&slotProps.data.isBuy!=1">未购买</text>
<text v-if="
slotProps.data.isBuy == 0 &&
(vip.type == 0 || vip.type == 2)
">未购买
</text>
<text v-if="
slotProps.data.isBuy == 1 &&
(vip.type == 0 || vip.type == 2) &&
slotProps.data.endTime
">有效期至{{ slotProps.data.endTime }}
<text v-if="userVip!=null">有效期至{{ userVip.endTime }}
</text>
</view>
<view class="right">
<!-- slotProps.data.type---------- 0 是免费 1 普通 2 svip -->
<u-icon v-if="
(slotProps.data.type != 0 && goBuyType != 1) ||
(slotProps.data.type == 2 && goBuyType != 1)
" @click="handleClickGetGoodsList(slotProps.data)" class="editIcon" name="shopping-cart-fill"
<u-icon v-if="userVip==null&&slotProps.data.type != 0&&slotProps.data.isBuy!=1"
@click="handleClickGetGoodsList(slotProps.data)" class="editIcon" name="shopping-cart-fill"
color="#FF2B57" size="30"
style="display: inline-block; margin-left: 10rpx"></u-icon>
<text v-if="
(goBuyType == 0 || goBuyType == 2) &&
slotProps.data.type == 0 &&
!slotProps.data.endTime
" style="color: #fff; font-size: 12px" class="fdButtonBox aui-text-success"
<text v-if="slotProps.data.type == 0&&userVip==null" style="color: #fff; font-size: 12px" class="fdButtonBox aui-text-success"
@click="handleClickGetGoodsList(slotProps.data)">开始学习</text>
</view>
</view>
@@ -165,7 +119,11 @@
<text class="fdButtonBox aui-text-success" style="background: none"
v-if="slotProps.row.isAudition == 1">试听</text>
<view> </view>
<view class="shitingTag">
<u-icon
v-if="cateList[0].isBuy == 0 && userVip==null && slotProps.row.isAudition == 0"
name="lock" color="#258feb" size="26"></u-icon>
</view>
</template>
</courseDescription>
</view>
@@ -334,10 +292,17 @@
goodsList: "sociology/product/getProductListForCourse",
startStudyForMF: "sociology/course/startStudyForMF",
},
isAndorid: true,
userVip: null, //是否有vip
textList: [], //转化文字集合
};
},
onLoad(options) {
this.options = options;
this.getUserInfo();
//是否是vip
this.getCourseByVip();
this.getOS();
},
onHide() {
this.selectGoodsData = {};
@@ -355,13 +320,24 @@
},
onShow() {
this.protocolShow = false;
this.getUserInfo();
this.$nextTick(() => {
this.getCourseDescriptionData();
});
},
methods: {
//获得操作系统
getOS() {
let oprateOs = "";
oprateOs = uni.getSystemInfoSync().platform;
this.oprateOsName = uni.getSystemInfoSync().platform;
console.log('oprateOs', oprateOs)
if (oprateOs == "android") {
this.isAndorid = true;
} else {
this.isAndorid = false;
}
},
//点击顶部按钮
handleClickGetVip() {
uni.navigateTo({
url: "/pages/mine/vip/index",
@@ -370,59 +346,97 @@
//获取vip信息数据
getUserInfo() {
this.$http.post("common/user/getUserInfo").then((res) => {
if (res.result.userVip) {
this.vip = res.result.userVip;
} else {
this.vip = {
type: 0,
};
}
switch (this.vip.type) {
case 0:
this.goBuyTitle = "购买VIP,即可免费观看众妙之门所有课程";
this.goBuyType = 0;
break;
case 1:
var vipName = "";
if (this.vip.type == 1) {
vipName = "超级VIP";
}
//超级VIP
this.goBuyTitle = `尊贵的${vipName},您的有效期到 ${
this.vip.endTime && this.vip.endTime.split(" ")[0]
}`;
this.goBuyType = 1;
break;
case 2:
var vipName = "";
if (this.vip.type == 2) {
vipName = "吴门医述VIP";
}
//超级VIP
this.goBuyTitle = `尊贵的${vipName},您的有效期到 ${
this.vip.endTime && this.vip.endTime.split(" ")[0]
}`;
this.goBuyType = 2;
break;
case 3:
//众妙之门
this.goBuyTitle =
"尊贵的众妙之门VIP,升级至超级VIP,即可免费观看吴门医述所有课程";
this.goBuyType = 3;
break;
}
this.userMsg = res.result
});
},
//获取是否是vip
getCourseByVip(){
this.$http
.request({
url: 'common/userVip/ownCourseCatalogueByVip',
method: "POST",
data: {
courseId: this.options.id
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
//如果有userVip说明是符合课程的vip身份
if(res.userVip){
this.userVip = res.userVip;
let type = res.userVip.type;
let role = '';
if(type==4){
role = '中医学';
}else if(type==5){
role = '针灸学';
}else if(type==6){
role = '肿瘤学';
}else if(type==7){
role = '国学';
}else if(type==8){
role = '心理学';
}
this.goBuyTitle = '尊贵的'+role+'VIP您的有效期到'+res.userVip.endTime;
this.goBuyType = 1;
}else{ //否则没有开通vip
this.goBuyTitle = '';
this.goBuyType = 0;
this.getCourseVipModule();
}
}
})
},
//判断需要什么类型的vip
getCourseVipModule(){
this.$http.request({
url: 'common/userVip/getCourseVipModule',
method: "POST",
data: {
courseId: this.options.id
},
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
this.courseVipModule = res.list;
let text = '';
this.courseVipModule.forEach((item, index) => {
if(item=='4'){
text = '中医学';
}else if(item=='5'){
text = '针灸学';
}else if(item=='6'){
text = '肿瘤学';
}else if(item=='7'){
text = '国学';
}else if(item=='8'){
text = '心理学';
}
this.textList.push(text);
});
const joinedText = this.textList.join('/');
this.goBuyTitle = '购买'+joinedText+'VIP即可畅享更多专属权益';
}
})
},
// 评论
showSayModule(data) {
this.fatherSay = data.item;
this.fatherIndex = data.index;
console.log(this.fatherSay, this.fatherIndex, "父级收到值了");
this.sayVisible = true;
},
close() {
this.show = false;
},
getPercentage() {
console.log(this.cateList[this.currentCateIndex]);
if (this.cateList) {
return this.cateList[this.currentCateIndex] ?
this.cateList[this.currentCateIndex].completion :
@@ -453,7 +467,7 @@
this.goodsList = [];
this.selectGoodsData = {};
},
//获取相关关联课程商品
//获取相关关联课程商品
handleClickGetGoodsList(v) {
if (v.type == 0) {
@@ -471,51 +485,49 @@
})
.then(async (res) => {
if (res.code == 0) {
this.getCourseDescriptionData();
this.getProductListForCourse();
}
this.$forceUpdate();
});
} else if (v.type == 2 && this.userVip==null) {
uni.showModal({
title: '提示',
content: '当前课程目录是VIP专享开通VIP可观看',
confirmText: '好的',
showCancel: false
})
} else {
if (v.type == 2) {
// 超v
if (this.goBuyType != 1) {
uni.showModal({
title: "提示",
content: "当前课程目录是超V专享,开通超V可观看",
confirmText: "好的",
showCancel: false,
});
return;
}
}
if (this.goBuyType == 0 || this.goBuyType == 2) {
this.$http
.request({
url: this.urlList.goodsList,
method: "POST",
data: {
id: v.id,
},
header: {
"Content-Type": "application/json",
},
})
.then(async (res) => {
if (res.productList.length > 0) {
this.goodsList = res.productList;
this.selectGoodsData = this.goodsList[0];
this.$refs.commonSelectGoods.open();
this.show = true;
} else {
this.$commonJS.showToast("此课程暂无购买方式");
}
this.$forceUpdate();
});
}
this.getProductListForCourse(v);
}
},
getProductListForCourse(v){
this.isFudu = false
this.$http
.request({
url: this.urlList.goodsList,
method: "POST",
data: {
id: v.id,
},
header: {
"Content-Type": "application/json",
},
})
.then(async (res) => {
if (res.productList.length > 0) {
this.goodsList = res.productList;
this.selectGoodsData = this.goodsList[0];
this.$refs.commonSelectGoods.open();
this.show = true;
} else {
this.$commonJS.showToast("此课程暂无购买方式");
}
this.$forceUpdate();
})
},
hancleModalConfirm() {
var data = {
values: {
@@ -566,8 +578,7 @@
if (
this.cateList[this.currentCateIndex].isBuy == 1 ||
v.isAudition == 1 ||
this.vip.type == "1" ||
this.vip.type == "3"
this.userVip!=null
) {
uni.navigateTo({
url: `/pages/curriculum/order/curriculum/detail?navTitle=${this.options.navTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&detailOid=${v.detailOid}&curriculumImgUrl=${this.curriculumData.image}`,
@@ -653,21 +664,6 @@
checkDisable() {
console.log("点击了");
},
async setOneCateIndex(item, index) {
this.allDataList = [];
var that = this;
this.currentStatusIndex = index;
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
this.$nextTick(async () => {
await that.getCourseDescriptionData();
this.$forceUpdate();
});
},
transformData(inputData) {
const result = {};
@@ -901,7 +897,8 @@
}
/deep/.titleItem {
// width: calc(100% - 120rpx) !important;
display: flex;
align-items: center;
}
/deep/.scroll-view-item:nth-child(2n-1) {
@@ -1045,6 +1042,9 @@
}
}
.shitingTag {
display: flex;
}
// .common_curriculum_list{
// }
@@ -1510,4 +1510,32 @@
/deep/.section_box {
padding-top: 0 !important;
}
.describe_block{
padding: 15rpx 20rpx;
background: linear-gradient(90deg, #258feb 0%, #00e1ec 100%);
position: fixed;
left: 0;
width: 100%;
z-index: 10;
color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.describe_block text{
display: block;
font-size: 26rpx;
padding-right: 10rpx;
}
.describe_block button{
display: inline-block;
text-align: center;
width: 125rpx;
font-size: 24rpx;
color: #fff;
border-radius: 10rpx;
line-height: 50rpx;
height: 50rpx;
}
</style>

View File

@@ -605,8 +605,7 @@ export default {
.wrapper {
background: white;
position: absolute;
min-height: 60vh;
height: 100vh;
.header {
height: 100rpx;
background: orange;

View File

@@ -466,7 +466,6 @@
urlList: {
list: "app/phone.do?getCourseDetail_new",
initPrepareOrder: "/common/buyOrder/initPrepareOrder",
// buyOrder: "book/buyOrder/placeOrder",
buyOrder: "book/buyOrder/placeOrder",
curriculumInfo: "app/phone.do?getCourseInfo",
detailInfo: "app/phoneDoctor.do?getTaiHuClassInfo_new",
@@ -665,12 +664,10 @@ this.payList= [{
this.$http
.request({
// url: "book/buyOrder/buySave",
url: `${this.urlList.initPrepareOrder}`,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
method: "POST",
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
@@ -710,12 +707,10 @@ this.payList= [{
this.$http
.request({
// url: "book/buyOrder/buySave",
url: `${this.urlList.addressList}?userId=${this.userInfo.id}`,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
method: "POST",
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
@@ -784,12 +779,10 @@ this.payList= [{
this.$http
.request({
// url: "book/buyOrder/buySave",
url: `${this.urlList.freightNum}`,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
method: "POST",
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
@@ -947,17 +940,12 @@ this.payList= [{
appName: "zmzm",
come: "1",
};
console.log("data at line 477:", data);
await $http
.request({
// url: "book/buyOrder/buySave",
url: that.urlList.buyOrder,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
method: "POST",
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})

View File

@@ -59,7 +59,7 @@
<view style="display: flex; align-items: center;">
<view class="zhanghu PM_font" style="text-align: left; margin-left: 15rpx;">
<image class="vip_image" src="@/static/icon/mine_p.png" mode="aspectFit"></image>
<text style="color: #fff; font-size: 60rpx;" v-if="vipList.length==0">VIP</text>
<text style="color: #fff; font-size: 56rpx; padding: 0 20rpx;" v-if="vipList.length==0">VIP</text>
</view>
<view class="vip_infor" v-if="vipList&&vipList.length>0">
<view class="vip_infor_item" v-for="(item, index) in vipList" :key="index" :class="{expired: isExpired(item.endTime.split(' ')[0])}">