增加培训班管理,增加购物车功能
This commit is contained in:
@@ -65,24 +65,27 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="not_purchased" v-if="slotProps.data.type != 0">
|
||||
<view class="not_purchased" v-if="slotProps.data.type != 0&&!showNewPayBtn[0].status">
|
||||
<view class="spot"></view>
|
||||
<view>
|
||||
<text v-if="userVip==null&&slotProps.data.isBuy!=1">未购买</text>
|
||||
<view v-if="userVip==null&&slotProps.data.isBuy==1">
|
||||
<text v-if="slotProps.data.endTime">课程有效期截止到:<br/>{{slotProps.data.endTime}} </text>
|
||||
<text v-if="slotProps.data.endTime" style=" width: 280rpx; margin: 0;">课程有效期截止到:<br/>{{slotProps.data.endTime}} </text>
|
||||
<text v-else>已购买</text>
|
||||
</view>
|
||||
<text v-if="userVip!=null">有效期至{{ userVip.endTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<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="28"></u-icon>
|
||||
|
||||
<text v-if="slotProps.data.type == 0&&userVip==null&&slotProps.data.isBuy!=1" style="color: #fff; font-size: 12px" class="fdButtonBox aui-text-success"
|
||||
@click="handleClickGetGoodsList(slotProps.data)">领取课程</text>
|
||||
|
||||
<text v-else-if="showNewPayBtn[0]&&showNewPayBtn[0].status" style=" background: #f42c32; border: 0; padding: 15rpx 30rpx; color: #fff; font-size: 12px" class="fdButtonBox aui-text-success"
|
||||
@click="goNewPay(slotProps.data)">复读</text>
|
||||
|
||||
<u-icon v-else-if="userVip==null&&slotProps.data.type != 0&&slotProps.data.isBuy!=1"
|
||||
@click="handleClickGetGoodsList(slotProps.data)" class="editIcon" name="shopping-cart-fill"
|
||||
color="#FF2B57" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -96,20 +99,51 @@
|
||||
<view class="chapter_content">
|
||||
<courseDescription :isCondition="true" :dataList="slotProps.dataList"
|
||||
@hancleClick="(data, index) => gotoDetail(data, index, slotProps)" label="title">
|
||||
<template slot="labelSlot" slot-scope="slotProps">
|
||||
<view :style="`${
|
||||
slotProps.row.isAudition==1
|
||||
<template slot="labelSlot" slot-scope="slotProps1">
|
||||
<view :style="`${ slotProps1.row.isAudition==1|| slotProps1.row.isLearned==1||slotProps1.row.isLearned==0
|
||||
? 'width:calc(100% - 100rpx);float:left;'
|
||||
: 'width:100%;'}`">
|
||||
<text :class="`${slotProps.row.viewFlg == 1 ? 'aui-text-success' : ''}`">{{ slotProps.row.title }}</text>
|
||||
<text :class="`${slotProps1.row.viewFlg == 1 ? 'aui-text-success' : ''}`">{{ slotProps1.row.title }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<template slot="leftSlot" slot-scope="slotProps">
|
||||
<template slot="leftSlot" slot-scope="slotProps1">
|
||||
</template>
|
||||
<template slot="rightSlot" slot-scope="slotProps">
|
||||
<template slot="rightSlot" slot-scope="slotProps1">
|
||||
<text class="fdButtonBox aui-text-success" style="background: none"
|
||||
v-if="slotProps.row.isAudition == 1">试听</text>
|
||||
v-if="slotProps.data.isBuy == 0&&slotProps1.row.isAudition == 1&&userVip==null">试听</text>
|
||||
|
||||
<template v-if="slotProps.data.isBuy == 1 || userVip!=null">
|
||||
<uni-tag v-if="slotProps1.row.isLearned == 0" style="position: absolute; right: 10rpx; top: 5rpx;"
|
||||
:inverted="true" text="未学" size="mini" type="primary" />
|
||||
<uni-tag v-if="slotProps1.row.isLearned == 1" style="position: absolute; right: 10rpx; top: 5rpx;"
|
||||
:inverted="true" text="已学" size="mini" type="success" />
|
||||
</template>
|
||||
|
||||
<view class="shitingTag" v-if="slotProps.data.type != 0" style="position: absolute; right: 0; top: 0;">
|
||||
<u-icon
|
||||
v-if="
|
||||
slotProps.data.isBuy == 0 &&
|
||||
userVip == null &&
|
||||
slotProps1.row.isAudition == 0
|
||||
"
|
||||
name="lock"
|
||||
color="#7dc1f0 "
|
||||
size="22"
|
||||
></u-icon>
|
||||
</view>
|
||||
<view class="shitingTag" v-if="slotProps.data.type == 0" style="position: absolute; right: 0; top: 0;">
|
||||
<u-icon
|
||||
v-if="
|
||||
userVip == null &&
|
||||
slotProps1.row.isAudition == 0 &&
|
||||
slotProps.data.isBuy == 0
|
||||
"
|
||||
name="lock"
|
||||
color="#7dc1f0 "
|
||||
size="24"
|
||||
></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</courseDescription>
|
||||
</view>
|
||||
@@ -141,12 +175,12 @@
|
||||
</view>
|
||||
</template>
|
||||
</common-anchor-link>
|
||||
<common-select-goods ref="commonSelectGoods" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
|
||||
<common-select-goods :isFudu="isFudu" ref="commonSelectGoods" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
|
||||
:buyOptions="buyOptions" :customButtonGroup1="customButtonGroup1" @selectGoods="handleClickSelectGoods"
|
||||
@onHandleClickBuy="
|
||||
$refs.commonSelectGoods.close();
|
||||
protocolShow = true;
|
||||
"></common-select-goods>
|
||||
$refs.commonSelectGoods.close();
|
||||
protocolShow = true;
|
||||
"></common-select-goods>
|
||||
|
||||
<u-popup :show="protocolShow" mode="center" round="6">
|
||||
<view class="popup_box">
|
||||
@@ -257,7 +291,12 @@
|
||||
textList: [], //转化文字集合
|
||||
//存储解析后的内容
|
||||
parsedContent: '',
|
||||
images: []
|
||||
images: [],
|
||||
|
||||
isFudu: false,
|
||||
fuduId: null,
|
||||
showNewPayBtn: [], //复读状态
|
||||
newPaymentProList: [], //复读列表数据
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -380,7 +419,7 @@
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
.then(res => {
|
||||
if (res.code == 0) {
|
||||
this.courseVipModule = res.list;
|
||||
let text = '';
|
||||
@@ -406,21 +445,48 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
//查询目录续费情况
|
||||
async checkRenewPayment(id) {
|
||||
var ss = false;
|
||||
await this.$http
|
||||
.request({
|
||||
url: 'common/courseRelearn/courseCatalogueCanRelearn',
|
||||
method: "POST",
|
||||
data: {
|
||||
courseCatalogueId: id,
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
ss = res.canRelearn;
|
||||
}
|
||||
this.$forceUpdate();
|
||||
})
|
||||
.catch((e) => {
|
||||
ss = false;
|
||||
this.$commonJS.showToast(e.errMsg);
|
||||
});
|
||||
return ss;
|
||||
},
|
||||
handleClickSelectGoods(data) {
|
||||
this.selectGoodsData = data;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
onHandleClickBuy(e) {
|
||||
var mynavData = {
|
||||
var mynavData = JSON.stringify({
|
||||
goods: [this.selectGoodsData],
|
||||
typeId: 0,
|
||||
navTitle: this.options.navTitle,
|
||||
title: this.options.title,
|
||||
sourceType: "curriculum",
|
||||
};
|
||||
uni.setStorageSync('mynavData', mynavData);
|
||||
isFudu: this.isFudu,
|
||||
fuduId: this.fuduId
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: '/pages/goods/order',
|
||||
url: `/pages/goods/order?data=${mynavData}`,
|
||||
});
|
||||
},
|
||||
handleClickClose() {
|
||||
@@ -460,8 +526,54 @@
|
||||
this.getProductListForCourse(v);
|
||||
}
|
||||
},
|
||||
//点击复读
|
||||
async goNewPay(item){
|
||||
await this.getNewPaymentList(item.id)
|
||||
if(this.newPaymentProList.length > 0){
|
||||
this.goodsList = this.newPaymentProList;
|
||||
this.selectGoodsData = this.goodsList[0];
|
||||
console.log('this.goodsList', this.goodsList)
|
||||
this.$refs.commonSelectGoods.open();
|
||||
this.show = true;
|
||||
this.isFudu = true;
|
||||
//存复读需要的id
|
||||
this.fuduId = item.id;
|
||||
}else{
|
||||
this.show = false;
|
||||
this.isFudu = false;
|
||||
this.$commonJS.showToast('暂无复读方案');
|
||||
}
|
||||
},
|
||||
async getNewPaymentList(id){
|
||||
uni.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
await this.$http
|
||||
.request({
|
||||
url: 'common/courseRelearn/relearnShopProductList',
|
||||
method: "POST",
|
||||
data: {
|
||||
catalogueId: id,
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log("复读列表", res);
|
||||
uni.hideLoading()
|
||||
if(res.code != 0){return this.$commonJS.showToast(res.errMsg);}
|
||||
this.newPaymentProList = res.productList;
|
||||
this.$forceUpdate();
|
||||
}).catch(e => {
|
||||
uni.hideLoading()
|
||||
this.newPaymentProList = []
|
||||
this.$commonJS.showToast(e.errMsg);
|
||||
});
|
||||
|
||||
},
|
||||
getProductListForCourse(v){
|
||||
this.isFudu = false
|
||||
this.isFudu = false;
|
||||
this.$http.request({
|
||||
url: this.urlList.goodsList,
|
||||
method: "POST",
|
||||
@@ -489,10 +601,10 @@
|
||||
if(this.userVip){
|
||||
this.goVideo(data);
|
||||
}else{
|
||||
if(data.isAudition == 1||this.cateList[this.currentCateIndex].isBuy == 1){
|
||||
if(data.isAudition == 1||this.cateList[slotProps.index].isBuy == 1){
|
||||
this.goVideo(data);
|
||||
}else{
|
||||
if(this.cateList[this.currentCateIndex].type != 0){
|
||||
if(this.cateList[slotProps.index].type != 0){
|
||||
this.$commonJS.showToast("请先购买课程");
|
||||
}else{
|
||||
this.$commonJS.showToast("请先领取课程");
|
||||
@@ -537,11 +649,11 @@
|
||||
getCourseDescriptionData() {
|
||||
var data = {};
|
||||
var that = this;
|
||||
this.$http.request({
|
||||
url: this.urlList.list,
|
||||
that.$http.request({
|
||||
url: that.urlList.list,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.options.id,
|
||||
id: that.options.id,
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -550,21 +662,28 @@
|
||||
.then(async (res) => {
|
||||
that.curriculumData = res.data.course;
|
||||
that.cateList = [...res.data.catalogues];
|
||||
|
||||
for (let i = 0; i < that.cateList.length; i++) {
|
||||
var list = await that.getChapterList(that.cateList[i]);
|
||||
|
||||
that.allDataList[i] = {
|
||||
...that.cateList[i],
|
||||
courseList: [...list],
|
||||
};
|
||||
that.showNewPayBtn[i] = {status:false};
|
||||
var list = await that.getChapterList(that.cateList[i]);
|
||||
if (that.cateList[i].isBuy == 0 && that.userVip == null) {
|
||||
that.showNewPayBtn[i].status = await that.checkRenewPayment(that.cateList[i].id);
|
||||
console.log("可以复读吗?", that.showNewPayBtn);
|
||||
}
|
||||
|
||||
that.allDataList[i] = {
|
||||
...that.cateList[i],
|
||||
courseList: [...list],
|
||||
};
|
||||
}
|
||||
|
||||
//获取的数据解析
|
||||
this.removeImagesFromHTML();
|
||||
that.removeImagesFromHTML();
|
||||
|
||||
setTimeout(() => {
|
||||
that.$refs.commonAnchorLink.getDistanceArr();
|
||||
}, 200);
|
||||
this.$forceUpdate();
|
||||
that.$forceUpdate();
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -783,11 +902,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/deep/.titleItem {
|
||||
// width: calc(100% - 120rpx) !important;
|
||||
}
|
||||
|
||||
/deep/.scroll-view-item:nth-child(2n-1) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
@@ -1216,6 +1330,7 @@
|
||||
|
||||
.not_purchased {
|
||||
position: relative;
|
||||
margin-left: 20rpx;
|
||||
|
||||
.spot {
|
||||
width: 8rpx;
|
||||
@@ -1228,7 +1343,6 @@
|
||||
}
|
||||
|
||||
color: #33435d;
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
border-bottom: 2rpx dotted #33435d;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user