增加培训班管理,增加购物车功能

This commit is contained in:
liuyuan
2025-07-01 16:35:55 +08:00
parent 06340ad137
commit 249b4b93f6
25 changed files with 4428 additions and 1764 deletions

View File

@@ -161,7 +161,7 @@
validateFunction: (rule, value, data, callback) => {
// 异步需要返回 Promise 对象
return new Promise((resolve, reject) => {
if (!this.$base.phoneRegular.test(value)) {
if (!/^\d{5,15}$/.test(value)) {
reject(new Error("手机号格式不正确"));
} else {
resolve();

View File

@@ -147,6 +147,7 @@ export default {
.titleItem {
width: calc(100%) !important;
position: relative;
}
/deep/.scroll-view-item:nth-child(2n-1) {

View File

@@ -0,0 +1,388 @@
<template>
<view>
<!-- 优惠券弹出 -->
<u-popup :show="youhuiShow" :round="10" @close="closePup">
<view class="tanchu">
<view class="dp_title">请选择优惠券</view>
<template v-if="list.length > 0">
<view style="max-height: 40vh; overflow-y: scroll">
<view v-for="(item, index) in list" :key="index">
<view
:class="`youhuiItem ${
youhuiIndex === index ? ' youItem_style' : ''
} ${item.canUse === 0 ? 'disableSelect' : ''}`"
@click="choseYouhui(index)"
><text
class="border_radius_10"
style="
position: absolute;
top: 10rpx;
right: 10rpx;
font-size: 25rpx;
background-color: #ffe3e9;
color: #c81346;
padding: 6rpx;
"
>{{ item.couponEntity.couponRange | couponType }}</text
>
<view
style="width: 25%; color: #ff0043; text-align: center"
class="couponPrice"
>
<text></text>
<b style="font-size: 45rpx">{{
item.couponEntity.couponAmount
}}</b>
<text
class="useLevel"
style="
display: block;
color: #666;
font-size: 25rpx;
margin-top: 10rpx;
"
>{{ item.couponEntity.useLevel }}元可用</text
>
</view>
<view style="width: 68%; padding-left: 5%">
<view>
<text
style="
display: inline-block;
margin-right: 6rpx;
line-height: 36rpx;
"
>{{ item.couponEntity.couponName }}</text
>
</view>
<text
style="
display: block;
font-size: 22rpx;
color: #999;
margin-top: 10rpx;
"
>有效期至{{
item.effectType == 0 ? "永久有效" : item.endTime
}}</text
>
<template v-if="item.canUse == 0">
<view
class=""
style="font-size: 20rpx; display: inline-block"
>
<text style="color: #333">不可用原因</text>
<text style="color: #333">{{ item.canUseReason }}</text>
</view>
</template>
</view>
<view
style="width: 7%; position: absolute; right: 20rpx; top: 43%"
>
<!-- <view class="" style="background-color: #d9d9d9; border-radius: 10rpx; 0 0 10rpx; text-align: center;" v-if="item.canUse == 0">
<text
style="color: #999; "
>不可用</text>
</view> -->
<template v-if="item.canUse == 1">
<text
style="
border: 1px solid #d9d9d9;
width: 35rpx;
height: 35rpx;
display: inline-block;
border-radius: 30rpx;
"
v-if="youhuiIndex !== index"
></text>
<u-icon
name="checkmark-circle-fill"
color="#fd6004"
size="20"
v-if="youhuiIndex === index"
>
</u-icon>
</template>
</view>
<br clear="both" />
</view>
<u-collapse
v-if="source != 'goodsDetail' && item.couponEntity.remark"
style="
margin-top: 0rpx;
z-index: 10 !important;
background-color: #fafafa;
border-bottom-left-radius: 10rpx;
border-bottom-right-radius: 10rpx;
"
:border="false"
>
<u-collapse-item title="详细信息" name="Docs guide">
<view
v-if="item.couponEntity.remark"
style="
font-size: 22rpx;
width: 100%;
margin-right: 20rpx !important;
"
>使用说明{{ item.couponEntity.remark }}</view
>
</u-collapse-item>
</u-collapse>
</view>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view>
<view class="btnBox flex_box flex_between" v-if="selectcouponList.length>0">
<view class="" style="width: 48%">
<button type="default" @click="confirmCoupon('none')">
不使用优惠券
</button>
</view>
<view class="" style="width: 48%">
<button type="primary" @click="confirmCoupon()">选好了</button>
</view>
</view>
<view class="btnBox flex_box flex_between" v-else>
<view class="" style="width: 100%">
<button type="default" @click="confirmCoupon('none')">
取消
</button>
</view>
</view>
</template>
<view class="" v-else>
<u-divider text="暂无可用优惠券哦"></u-divider>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
name: "orderCoupon",
props: ["list", "curCouponId", "sumMeony",'selectcouponList'],
data() {
return {
youhuiShow: true,
youhuiIndex: undefined,
};
},
mounted() {
console.log("进入了", this.curCouponId, this.sumMeony);
if (this.curCouponId) {
this.youhuiIndex = this.list.findIndex(
(item) => item.couponEntity.id === this.curCouponId
);
console.log("查找后的结果", this.youhuiIndex);
}
},
filters: {
couponType(type) {
// 0无限制 1课程卷 2课程品类卷
var str = "";
switch (type) {
case 0:
str = "全场通用";
break;
case 1:
str = "指定课程可用";
break;
case 2:
str = "指定课程品类可用";
break;
}
return str;
},
},
computed: {},
methods: {
closePup() {
this.youhuiIndex = undefined;
this.$emit("close");
},
// 确定选中优惠券
confirmCoupon(str) {
console.log(str, "6666");
if (str && str == "none") {
// 清空优惠券操作
this.$emit("confirmCoupon");
setTimeout(() => {
this.closePup();
}, 300);
return;
}
if (this.youhuiIndex == 0 || this.youhuiIndex) {
this.$emit("confirmCoupon", this.list[this.youhuiIndex]);
setTimeout(() => {
this.closePup();
}, 300);
} else {
uni.showToast({
title: "请选择您要使用的优惠券",
icon: "none",
});
}
},
// 选择优惠券
choseYouhui(e) {
if (this.list[e].canUse == 0) {
return;
}
console.log("选中优惠券e", e);
this.youhuiIndex = e;
},
},
};
</script>
<style lang="scss" scoped>
.btnBox {
margin-top: 20rpx;
}
.tanchu {
padding: 40rpx 30rpx 40rpx 30rpx;
position: relative;
// max-height: 60vh;
// overflow-y: scroll;
.dp_title {
font-size: 32rpx;
margin-bottom: 50rpx;
color: #555;
text-align: center;
font-weight: bold;
}
.dp_add {
position: absolute;
top: 40rpx;
right: 30rpx;
font-size: 22rpx;
background-color: #fd6004;
color: #fff;
border-radius: 10rpx;
padding: 5rpx 10rpx;
.u-icon {
display: inline-block;
margin-right: 5rpx;
}
}
.addressItem {
border: 2px dashed #d9d9d9;
border-radius: 10rpx;
width: 100%;
display: flex;
padding: 20rpx 10rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
.addrContent {
margin-left: 40rpx;
flex: 1;
.addrContentTop {
display: flex;
align-items: flex-end;
margin: 0 0 15rpx 0;
position: relative;
.userName {
font-size: 35rpx;
font-weight: bold;
margin-right: 30rpx;
}
.userTel {
font-size: 25rpx;
color: #888;
}
.userMoren {
border: 1px solid #fd6004;
color: #fd6004;
padding: 3rpx 10rpx;
font-size: 22rpx;
border-radius: 10rpx;
margin: 0 0 0 20rpx;
}
.chooseCheck {
position: absolute;
top: 3rpx;
right: 6rpx;
}
}
.addrContentBottom {
font-size: 32rpx;
}
}
}
.addressItem.addItem_style {
border-color: #fd6004;
}
.youhuiItem {
position: relative;
background: linear-gradient(to top right, #fff, #fef2f4);
border: 1px solid #d9d9d9;
border-radius: 10rpx;
width: 100%;
padding: 50rpx 20rpx 20rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.disableSelect {
background: linear-gradient(to top right, #fafafa, #fafafa) !important;
color: #979797 !important;
.couponPrice {
color: #979797 !important;
}
.useLevel {
color: #979797 !important;
}
.border_radius_10 {
color: #98989a !important;
background-color: #fafafa !important;
}
}
.youhuiItem > view {
float: left;
}
.youhuiItem.youItem_style {
border-color: #fd6004;
}
}
::v-deep .u-cell__body {
padding-top: 0 !important ;
padding-bottom: 0 !important ;
z-index: 10 !important ;
.u-cell__title-text {
color: #333 !important;
font-size: 24rpx !important;
padding-left: 0 !important;
}
}
::v-deep .u-collapse-item__content__text {
padding: 10rpx 20rpx !important;
box-sizing: border-box;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -52,10 +52,13 @@
<view
class="related_courses_name"
:class="`goods_item ${
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId
? 'isSelectGoods color_shandow'
: ''
(!isFudu &&
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId) ||
(isFudu &&
selectGoodsData.productName == slotProps.row.productName)
? 'isSelectGoods color_shandow'
: ''
}`"
>
<view class="image_box" style="margin-right: 10rpx">
@@ -108,7 +111,7 @@ export default {
"isScroll",
"selectGoodsData",
"customButtonGroup1",
"buyOptions",
"buyOptions", "isFudu", // 是否复读
],
data() {
return {

View File

@@ -10,6 +10,7 @@
v-for="(item, index) in dataList" :key="index"
v-if="dataList&&dataList.length>0"
@click="goToDetail(item)"
:class="item.isStudying==0||item.isStudying==1?'list_item_bt':''"
>
<view class="list_item_image">
<image v-if="item.image" :src="item.image" mode="aspectFit"></image>
@@ -19,7 +20,7 @@
<view class="list_item_title">{{item.title}}</view>
<view class="list_item_content" v-html="item.content"></view>
<view class="list_item_study" v-if="item.isStudying==0" @click.stop="addStudying(item.id)">加入学习</view>
<view class="list_item_study_out" v-else @click.stop="removeStudying(item.id)">移出学习</view>
<view class="list_item_study_out" v-else-if="item.isStudying==1||currentCateIndex==1" @click.stop="removeStudying(item.id)">移出学习</view>
</view>
</view>
<text v-if="statusNull" class="text_null">暂无数据</text>
@@ -52,14 +53,14 @@ export default {
}
},
onShow(){
},
onLoad() {
//我的课程
this.getMyList();
this.$nextTick(async () => {
await this.ordersTabCLi(this.ordersTabs[0], 0);
});
},
onLoad() {
},
methods: {
//我的课程数据
@@ -170,6 +171,7 @@ export default {
},
//过期课程数据
getExpireList(){
this.dataList = [];
uni.showLoading({
title: '加载中'
})
@@ -237,11 +239,15 @@ export default {
position: relative;
background: #fff;
box-shadow: 0px 0px 10px 0px #a7bbe4;
padding: 30rpx 20rpx 70rpx;
padding: 30rpx 20rpx 30rpx;
margin-bottom: 20rpx;
display: flex;
border-radius: 10rpx;
}
.list_item_bt{
padding: 30rpx 20rpx 70rpx;
}
.list_item_image,.image_null{
width: 250rpx;
height: 220rpx;

View File

@@ -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;

View File

@@ -70,76 +70,121 @@
class="orderState orderState5"
v-if="orderContet.orderStatus == 5">已超时</text>
</view>
<view
class="orderContent"
v-for="(item, index) in goodsList"
:key="index"
@click="goDetail(item.productId, item)"
v-if="goodsList.length > 0"
style=" display: flex; align-items: center; justify-content: center;"
>
<view class="feng" style="position: relative">
<view v-if="item.delFlag == -1" class="delisted">已下架</view>
<image
style="width: 100%; height: 100%"
v-if="item.productImages"
:src="item.productImages"
mode="aspectFit"
></image>
<view
v-else style="
color: #c0c4cc;
font-size: 22rpx;
line-height: 140rpx;
text-align: center;">暂无封面图</view>
</view>
<view class="goods_info">
<view class="flexbox itemJian">
<view class="booknameleft">
<text :style="`${item.delFlag == -1 ? 'color:#c0c4cc;' : ''}`">{{ item.productName }}</text>
</view>
<view style="color: #c0c4cc; font-size: 26rpx; font-weight: 700">
×{{ item.quantity ? item.quantity : "" }}
</view>
</view>
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'vip'" style=" display: flex; align-items: center; justify-content: center;">
<image
src="/static/icon/vip.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx;"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 46rpx; margin-bottom: 0;">
{{ orderContet.vipBuyConfigEntity.title }}
<text class="vip_year" v-if="orderContet.vipBuyConfigEntity.year">({{ orderContet.vipBuyConfigEntity.year }}年)</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view
class="orderContent" v-else-if="orderContet.orderType == 'point'">
<image
src="/static/icon/pay_3.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 100rpx">
<text>充值 {{ orderContet.bookBuyConfigEntity.money }}天医币</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view class="order_block">
<view
class="orderContent"
v-for="(item, index) in goodsList"
:key="index"
@click="goDetail(item.productId, item)"
v-if="goodsList.length > 0"
style=" display: flex; align-items: center; justify-content: center;"
>
<view class="feng" style="position: relative">
<view v-if="item.delFlag == -1" class="delisted">已下架</view>
<image
style="width: 100%; height: 100%"
v-if="item.productImages"
:src="item.productImages"
mode="aspectFit"
></image>
<view
v-else style="
color: #c0c4cc;
font-size: 22rpx;
line-height: 140rpx;
text-align: center;">暂无封面图</view>
</view>
<view class="goods_info">
<view class="flexbox itemJian">
<view class="booknameleft">
<text :style="`${item.delFlag == -1 ? 'color:#c0c4cc;' : ''}`">{{ item.productName }}</text>
</view>
<view style="color: #c0c4cc; font-size: 26rpx; font-weight: 700">
×{{ item.quantity ? item.quantity : "" }}
</view>
</view>
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'trainingClass'">
<image
src="/static/icon/icon_pxb.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 100rpx">
<text>{{orderContet.remark}}</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'relearn'">
<image
src="/static/icon/fugou.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 60rpx">
<text>{{ orderContet.remark }}</text>
</view>
<view class="orderPrice">
<text style="font-weight: bold">&nbsp;</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'vip'" style=" display: flex; align-items: center; justify-content: center;">
<image
src="/static/icon/vip.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx;"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 46rpx; margin-bottom: 0;">
{{ orderContet.vipBuyConfigEntity.title }}
<text class="vip_year" v-if="orderContet.vipBuyConfigEntity.year">({{ orderContet.vipBuyConfigEntity.year }}年)</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
<view class="orderContent" v-if="orderContet.orderType == 'aiVip'||orderContet.orderType == 'upgradeAiVip'" style=" display: flex; align-items: center; justify-content: center;">
<image src="/static/icon/order_vip.png" mode="aspectFill" style="width: 100rpx; height: 100rpx; flex-shrink: 0;"></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 46rpx; margin-bottom: 0;">
{{ orderContet.aiBuyConfig.title }}<span style=" color: red;">{{ orderContet.aiBuyConfig.count }}次)<span v-if="orderContet.orderType=='upgradeAiVip'">VIP升级</span></span>
</view>
</view>
</view>
<view
class="orderContent" v-if="orderContet.orderType == 'point'">
<image
src="/static/icon/pay_3.png"
mode="aspectFill"
style="width: 100rpx; height: 100rpx"
></image>
<view class="itemJian">
<view class="orderTitle" style="line-height: 100rpx">
<text>充值 {{ orderContet.bookBuyConfigEntity.money }}天医币</text>
</view>
<br clear="both" />
</view>
<br clear="both" />
</view>
</view>
<view class="order_item" style="">
<view class="order_item">
<view class="orderallpri">
<span style="color: #666; margin-right: 10rpx; float: left">商品总价 :
</span>
@@ -271,7 +316,6 @@
<text style="font-size: 24rpx; color: #666">{{orderContet.paymentDate}}</text>
</view>
</view>
<view class=""></view>
</view>
</view>
</view>
@@ -534,7 +578,7 @@ export default {
console.log(item, "item");
uni.navigateTo({
url:
"./deliverDetail?orderSn=" +
"/pages/order/deliverDetail?orderSn=" +
this.orderContet.orderSn +
"&expressOrderSn=" +
item.expressOrderSn +
@@ -713,7 +757,7 @@ export default {
// 直接展示详情
uni.navigateTo({
url:
"./deliverDetail?orderSn=" +
"/pages/order/deliverDetail?orderSn=" +
item.orderSn +
"&expressOrderSn=" +
this.sheetList[0].expressOrderSn,
@@ -725,7 +769,7 @@ export default {
},
onPageJump(item) {
uni.navigateTo({
url: "./deliverDetail?objId=" + item,
url: "/pages/order/deliverDetail?objId=" + item,
});
},
OverOrder() {
@@ -1195,16 +1239,15 @@ view,uni-view {
.orderList {
padding: 20rpx;
padding-top: 0;
margin-bottom: 120rpx;
.orderItem {
padding: 30rpx 0rpx;
padding-top: 30rpx;
background-color: #fff;
border-radius: 10rpx;
margin-bottom: 30rpx;
.orderContent {
padding: 20rpx;
margin-bottom: 20rpx;
image {
width: 150rpx;
@@ -1287,6 +1330,9 @@ view,uni-view {
}
}
}
.order_block .orderContent:last-child{
padding-bottom: 30rpx;
}
.copyCode {
display: inline-block;
margin-left: 20rpx;

View File

@@ -234,7 +234,7 @@
</view>
<view class="goods_nav_box" v-if="!this.$store.state.loadingShow">
<uni-goods-nav :fill="true" :options="buyOptions" :button-group="customButtonGroup1"
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy1" />
@click="onHandleClick" @buttonClick="onHandleClickBuy1" />
</view>
<common-select-goods ref="commonSelectGoods" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
:buyOptions="buyOptions" :customButtonGroup1="customButtonGroup1" @selectGoods="selectGoods"
@@ -303,8 +303,11 @@
parameterList: [],
booksList: [],
coursesList: [],
buyOptions: [],
buyOptions: [{
icon: "cart",
text: "购物车",
}],
swiperList: [],
goodsList: [],
options: {},
@@ -347,12 +350,20 @@
goodsList: "book/shopproduct/getGlProductList",
},
customButtonGroup1: [{
with: 200,
customButtonGroup1: [
{
text: "加入购物车",
backgroundColor: "linear-gradient(90deg, #FFCD1E, #FF8A18)",
color: "#fff",
},
{
text: "立即购买",
backgroundColor: "linear-gradient(90deg, #FE6035, #EF1224)",
color: "#fff",
}, ],
buttonType: '', //点击的是加入购物车还是购买
cartList: [], // 购物车列表
productAmount: 1, // 商品数量
};
},
onLoad(options) {
@@ -413,8 +424,17 @@
this.$refs.commonSelectGoods.open();
this.$forceUpdate();
},
onHandleClickBuy1() {
//点击购物车
onHandleClick(){
console.log('点击购物车')
uni.navigateTo({
url: "/pages/goods/shopping",
});
},
//点击筛选商品
onHandleClickBuy1(e) {
this.buttonType = e.index;
if (this.options.type == "visitor") {
uni.showModal({
content: "登陆后可购买本商品",
@@ -433,22 +453,115 @@
}
this.$refs.commonSelectGoods.open();
},
//点击下单按钮
onHandleClickBuy() {
var mynavData = {
goods: [{
productImages: this.selectGoodsData.productImages,
productId: this.selectGoodsData.productId,
productName: this.selectGoodsData.productName,
goodsType: this.selectGoodsData.goodsType,
}],
navTitle: this.options.navTitle,
title: this.options.title,
typeId: 0
};
uni.setStorageSync('mynavData', mynavData);
uni.navigateTo({
url: '/pages/goods/order',
});
if(this.buttonType==0){ //如果是加入购物车
console.log('剩余', this.selectGoodsData.productStock)
if(this.selectGoodsData.productStock==0){
uni.showToast({
title: "商品库存不足",
icon: "none",
duration: 1000,
});
}else{
this.$http.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then((res) => {
this.cartList = res.cartList;
this.isAddLink(this.selectGoodsData);
});
}
}else{ //如果是正常下单
var mynavData = JSON.stringify({
goods: [{
productImages: this.selectGoodsData.productImages,
productId: this.selectGoodsData.productId,
productName: this.selectGoodsData.productName,
goodsType: this.selectGoodsData.goodsType,
}],
typeId: 0
});
uni.navigateTo({
url: `/pages/goods/order?data=${mynavData}`,
});
}
},
//统计商品信息
isAddLink(item) {
let data = {
userId: this.userInfo.id,
productId: item.productId,
productAmount: this.productAmount,
price: item.price,
};
// 判断列表是否为空
if (this.cartList.length > 0) {
let flag = "";
let shagnpin = {};
// 循环购物车列表
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item;
shagnpin.productAmount = item.productAmount + 1;
return true;
}
});
if (flag) {
// 已在购物车中添加
$http.request({
url: "book/ordercart/update",
method: "POST",
data: shagnpin,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
} else {
// 加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
}
} else {
// 购物车列表为空时直接加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST",
data,
header: {
"Content-Type": "application/json",
},
})
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: "加入购物车成功",
duration: 1000,
});
}
});
}
this.$refs.commonSelectGoods.close();
},
buttonClick(e) {
console.log(e);
@@ -1276,4 +1389,9 @@
align-items: center;
justify-content: space-between;
}
/deep/.uni-tab__text{
font-size: 26rpx;
line-height: 28rpx;
}
</style>

File diff suppressed because it is too large Load Diff

384
pages/goods/shopping.vue Normal file
View File

@@ -0,0 +1,384 @@
<template>
<view>
<z-nav-bar title="购物车"></z-nav-bar>
<view class="shopCarContent">
<scroll-view scroll-y="true" v-if="cartList.length>0">
<view class="cartItem" v-for="(item,index) in cartList" :key="index">
<view class="select">
<checkbox style="transform:scale(0.8)" :checked="item.checked" @click="checkboxGroupChange(index,item)" class="round checkedItem" />
</view>
<view class="cartContent" style="position: relative;">
<span v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null"
style="position: absolute;z-index: 10;top: 4px;left: 0px; text-align: center;font-size: 18rpx;background-color: #f94f04;color: #fff; border-radius:4px; padding:2px 4px;line-height: 14px;">VIP优惠</span>
<image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
<view class="itemCenter">
<view class="cartTitle" @click="goDetail(item.productId)" style="display: flex;align-items: center;">
<text>{{item.productName}}</text>
</view>
<view class="itemPrice">
<text v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null">
<text style="color: #e97512;font-size: 16px;font-weight: bold;">{{(item.vipPrice).toFixed(2)}}</text>
<text style="color: #8a8a8a;font-size: 14px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">{{(item.price).toFixed(2)}}</text>
</text>
<text
v-else-if="item.activityPrice && item.activityPrice > 0">
<text style="color: #e97512;font-size: 16px;font-weight: bold;">{{(item.activityPrice).toFixed(2)}}</text>
<text style="color: #8a8a8a;font-size: 14px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">{{(item.price).toFixed(2)}}</text>
</text>
<text v-else style="color: #e97512;font-size: 16px;font-weight: bold;">{{item.price}}</text>
<u-number-box button-size="20" v-model="item.productAmount" @change="valChange($event,item)"
:input-width="25" :input-height="10" :min="1" :max="item.productStock" integer
@overlimit='overlimit'></u-number-box>
</view>
</view>
</view>
</view>
</scroll-view>
<view v-else style=" font-size: 28rpx; text-align: center; padding-top: 100rpx; color: #999;">暂无数据</view>
</view>
<!-- 底部操作区 -->
<view class="shopCarFooter">
<view class="selectAll">
<checkbox :checked="all" style="transform:scale(0.8)" @click="isSelectAll()" class="round checkedItem" />
<text class="cartCho">全选</text>
<button class="mini-btn"
style="border-radius: 10rpx; font-size: 26rpx; line-height: 30rpx; padding: 10rpx 25rpx; margin-left: 20rpx;"
v-if="isCartDelShow" @click="delCart()" type="warn" size="mini">删除</button>
</view>
<view class="exhibition">
<view class="total">合计: <b>{{totalPrice}}</b>
</view>
<view class="settlement" @click="setTment()">
结算
</view>
</view>
</view>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
import {
mapState
} from 'vuex';
export default {
data() {
return {
playData: {},
totalPrice: 0, // 总价
all: false, // 是否全选
isCartDelShow: false, // 是否展示删除按钮
cartList: [] // 购物车列表
};
},
//第一次加载
onLoad(e) {
this.getCartList()
},
//页面显示
onShow() {
this.getCartList();
this.all = false;
this.isCartDelShow = false
this.totalPrice = 0
},
computed: {
...mapState(['userInfo']),
},
//方法
methods: {
// 获取购物车列表
getCartList() {
this.$http.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`).then(res => {
this.cartList = res.cartList
if (res.cartList.length > 0) {
res.cartList.forEach((item, index) => {
item.checked = false
})
this.cartList = res.cartList
}
})
},
// 是否全选
isSelectAll(e) {
if (this.cartList.length > 0) {
this.all = !this.all
this.cartList.forEach((item, index) => {
item.checked = this.all
})
this.isCartDelShow = this.all
this.total()
} else {
this.all = false
}
},
// 选中单独商品
checkboxGroupChange(index, item) {
// 修改当前item的checked
this.cartList[index].checked = !item.checked
// 判断是否全选
this.all = this.cartList.every((item, index) => {
return item.checked == true
})
// 判断是否展示删除按钮
this.isCartDelShow = this.cartList.some((item, index) => {
return item.checked == true
})
// 计算总价
this.total()
},
// 计算总价
total() {
let allprice = 0;
this.cartList.forEach((item, index) => {
let price = 0;
if (item.checked) {
if (item.isVipPrice == 1 && item.vipPrice != 0) {
price = (item.productAmount * item.vipPrice).toFixed(2);
} else {
if (item.activityPrice && item.activityPrice > 0) {
price = (item.productAmount * item.activityPrice).toFixed(2);
} else {
price = (item.productAmount * item.price).toFixed(2);
}
}
}
allprice += Number(price)
})
this.totalPrice = allprice.toFixed(2)
},
// 超出阈值时
overlimit() {
uni.showToast({
title: '超出商品数量',
icon: 'error',
duration: 1000
})
},
valChange(e, item) {
console.log(e)
let productItem = {}
productItem = item
productItem.productAmount = e.value
this.updateCart(productItem)
setTimeout(() => {
this.total()
}, 300)
},
// 更新购物车
updateCart(shagnpin) {
// 已在购物车中添加
$http.request({
url: "book/ordercart/update",
method: "POST",
data: shagnpin,
header: {
'Content-Type': 'application/json'
}
}).then(res => {
if (res.code == 0) {
}
})
},
// 删除购物车
delCart() {
let cartIdArr = [];
this.cartList.forEach((item, index) => {
if (item.checked) {
cartIdArr.push(item.cartId)
}
})
uni.showModal({
title: '提示',
content: '是否删除这个商品',
confirmText: '确定',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: '加载中',
mask: true
})
console.log(cartIdArr)
$http.request({
url: "book/ordercart/delete",
method: "POST",
data: cartIdArr,
header: {
'Content-Type': 'application/json'
},
}).then(res => {
this.isCartDelShow = false
this.totalPrice = 0
this.getCartList()
uni.hideLoading();
this.all = false;
})
} else {
console.log('cancel') //点击取消之后执行的代码
}
}
})
},
// 跳转结算页面
setTment() {
let goods = []
this.cartList.forEach((item, index) => {
if (item.checked) {
goods.push({
productImages: item.productImages,
productId: item.productId,
productName: item.productName,
goodsType: item.goodsType,
productAmount: item.productAmount,
})
}
})
let mynavData = JSON.stringify({
goods: goods,
typeId: 1
})
// 如果没有勾选
if (goods.length == 0) {
uni.showToast({
title: "请先勾选商品",
icon: 'error',
duration: 1000,
})
} else {
uni.navigateTo({
url: '/pages/goods/order?data='+ mynavData
});
}
},
//商品内容跳转
goDetail(id) {
uni.navigateTo({
url: '/pages/goods/index?isMiaosha=1&id='+id
});
},
},
};
</script>
<style lang="scss" scoped>
@import '@/static/mixin.scss';
.shopCarContent {
width: 100%;
height: 100%;
padding-bottom: 104rpx;
padding-top: 20rpx;
.cartItem {
padding: 10rpx 10rpx 10rpx 10rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
background-color: #fff;
.cartContent {
flex: 1;
display: flex;
image {
width: 130rpx;
height: 150rpx;
border-radius: 10rpx;
padding: 10rpx;
margin-right: 15rpx;
}
.itemCenter {
flex: 1;
flex-direction: column;
justify-content: space-around;
}
.cartTitle {
font-size: 30rpx;
margin: 35rpx 0 20rpx 0;
}
.itemPrice {
font-size: 28rpx;
display: flex;
justify-content: space-between;
}
}
}
}
.shopCarFooter {
width: 100%;
height: 100rpx;
padding: 20rpx;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
bottom: 0;
.selectAll {
display: flex;
.cartCho {
font-size: 26rpx;
color: #888;
}
.cartDel {
font-weight: bold;
color: #bf0c0c;
font-size: 14px;
margin: 12rpx 0 0 20rpx;
}
}
.exhibition {
display: flex;
align-items: center;
.total {
font-size: 15px;
padding: 0 40rpx 0 0;
color: #888;
b {
margin-left: 10rpx;
color: #ef1224;
font-size: 35rpx;
}
}
.settlement {
font-size: 28rpx;
font-weight: 700;
padding: 10rpx 50rpx;
background-image: linear-gradient(90deg, rgb(254, 96, 53), rgb(239, 18, 36));
color: #fff;
border-radius: 40rpx;
}
}
}
/deep/.uni-checkbox-input{
border-radius: 50rpx;
}
.shopCarFooter .selectAll{
display: flex;
align-items: center;
}
/deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked{
color: $themeColor !important;
}
</style>

View File

@@ -175,6 +175,16 @@ export default {
url: "/pages/order/index",
type: "switchTab",
},
{
name: "我的购物车",
url: "/pages/goods/shopping",
type: "pageJump",
},
{
name: "培训班管理",
url: "/pages/trainingCourse/index",
type: "pageJump",
},
{
name: "个人资料",
url: "/pages/my/persData",

View File

@@ -290,7 +290,7 @@
methods: {
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
var result = await permission.premissionCheck("CAMERA")
if (result != 1) {
return false
}

View File

@@ -45,6 +45,54 @@
</view>
</view>
<view v-if="slotProps.row.orderType == 'trainingClass'" class="bookinfolist">
<image
class="feng fengPoint"
src="/static/icon/icon_pxb.png"
mode="aspectFill"
>
</image>
<view class="btns flexbox">
<view class="booknameleft">{{ slotProps.row.remark }}</view>
<view style="
line-height: 58rpx;
color: #333;
font-size: 26rpx;
font-weight: 700;
">
<text style="font-size: 20rpx"></text>
</view>
</view>
<view class="btns flexbox"
style="color: #9f9f9f; font-size: 24rpx">
下单时间{{ slotProps.row.createTime }}
</view>
</view>
<view v-if="slotProps.row.orderType == 'relearn'" class="bookinfolist" style=" display: flex; align-items: center;">
<image
class="feng fengPoint"
src="/static/icon/fugou.png"
mode="aspectFill"
>
</image>
<view class="btns flexbox">
<view class="booknameleft">
{{ slotProps.row.remark }}
</view>
<view
style="
line-height: 58rpx;
color: #333;
font-size: 26rpx;
font-weight: 700;
"
>
<text style="font-size: 20rpx"></text>
</view>
</view>
</view>
<view v-if="slotProps.row.orderType == 'vip'" class="bookinfolist">
<image class="feng fengPoint" src="../../static/icon/vip.png" mode="aspectFill"></image>
<view class="btns flexbox">
@@ -63,7 +111,7 @@
</view>
</view>
<view class="btns flexbox"
style="color: #9f9f9f; margin-top: 10rpx; font-size: 24rpx">
style="color: #9f9f9f; font-size: 24rpx">
下单时间{{ slotProps.row.createTime }}
</view>
</view>
@@ -84,7 +132,7 @@
</view>
</view>
<view class="btns flexbox"
style="color: #9f9f9f; margin-top: 10rpx; font-size: 24rpx">
style="color: #9f9f9f; font-size: 24rpx">
下单时间{{ slotProps.row.createTime }}
</view>
</view>
@@ -198,16 +246,15 @@
</view>
</view>
</view>
<view class="operation_box boxShadow" v-if="slotProps.row.isShowMore == true">
<view v-if="slotProps.row.orderStatus == 0"
@click.stop="canceOrder(slotProps.row)">取消订单</view>
</view>
<view class="btns flexbox" style="margin-top: 10rpx">
<view class="left" style="color: #c0c4cc"
v-if="slotProps.row.orderStatus != 3"
<view class="left" style="color: #c0c4cc"
@click.stop="openMore(slotProps.row, slotProps.rowIndex)">更多</view>
<view class="left" v-if="slotProps.row.orderStatus == 3"></view>
<view class="right flexbox opbtns">
<view class="orderstatusbtn orderstatusbtn_success"
v-if="slotProps.row.orderStatus == 0"
@@ -220,7 +267,6 @@
<view class="orderstatusbtn" v-if="slotProps.row.orderStatus == 3">申请售后</view>
</view>
</view>
<view style="border-bottom: 2rpx solid #e9e9e9; height: 50rpx"
v-if="slotProps.rowIndex < slotProps.row.length - 1"></view>
</view>

View File

@@ -304,7 +304,7 @@ export default {
}
//如果是延期的
if(this.yanqiStatus){
if(this.yanqiStatus||this.orderType=='pxb'){
this.priceBreakdownList.push({
type: 2,
imgUrl: require("@/static/icon/jifen.png"),
@@ -327,7 +327,7 @@ export default {
if (this.userInfo.id != undefined) {
await this.$http.post("book/user/info/" + this.userInfo.id).then(async(res) => {
this.user = res.user;
if(this.yanqiStatus){
if(this.yanqiStatus||this.orderType=='pxb'){
await this.getTotalPrice(res.user);
}
@@ -447,25 +447,32 @@ export default {
//培训班的购买
async submitPxb() {
debounce(async () => {
uni.showLoading({
title: '加载中'
});
if(!this.name){
uni.showToast({
title: "培训姓名不能为空",
icon: 'none'
});
uni.hideLoading()
return
return false;
}
if(this.buyStatus){
uni.showToast({
title: "请勿重复下单",
icon: "none",
});
return false;
}
uni.showLoading({
title: '加载中'
});
//下单状态
this.buyStatus = true;
var that = this;
let data = {
paymentMethod: that.payType,
orderMoney: that.options.price,
jfDeduction: that.jfNumber,
realMoney: that.actualPayment,
come: '2',
come: '3',
remark: that.options.title,
trainingClassId: that.options.id,
trainingClassIdentity: that.options.identity +''+that.options.price,
@@ -488,6 +495,7 @@ export default {
title: "失败,请重新下单",
icon: "none"
});
that.buyStatus = false;
} else {
if (that.payType == 2) {
// 常规支付
@@ -519,6 +527,7 @@ export default {
}, 1000);
} else {
setTimeout(() => {
that.buyStatus = false;
console.log("延迟调用 失败提示");
uni.showToast({
title: "支付失败"
@@ -545,8 +554,7 @@ export default {
})
}, 1000);
} else {
if (res.data.errMsg.indexOf(
"User canceled") != -1) {
if (res.data.errMsg.indexOf("User canceled") != -1) {
uni.showToast({
title: "用户取消支付",
icon: "none"
@@ -557,6 +565,7 @@ export default {
icon: "none"
});
}
that.buyStatus = false;
}
});
} else if (that.payType == 4) {
@@ -573,12 +582,12 @@ export default {
}
}
}
uni.removeStorageSync('mynavData');
})
.catch(()=>{
uni.hideLoading()
uni.hideLoading();
that.buyStatus = false;
});
}, 400);
}, 1000);
},
//vip的购买
@@ -733,7 +742,7 @@ export default {
this.xieyi = data;
this.xieyiShow = true;
},
}
},
};
</script>

View File

@@ -0,0 +1,69 @@
<template>
<view class="page" style=" height:100vh; background: #f6f6f8;">
<z-nav-bar title="培训班管理"></z-nav-bar>
<view v-if="image&&image.length>0">
<image v-for="(item,index) in image" :key="index" :src="item" mode="aspectFit" class="image"></image>
</view>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
export default {
data() {
return {
image: [],
}
},
onLoad(e) {
this.image = e.image.split(',');
console.log(this.image)
},
onShow() {
},
methods: {
//获取数据
getData(){
uni.showLoading({
title: '加载中'
})
$http.request({
url: "common/trainingClass/trainingClassList",
method: "POST",
data: {
year: this.year
},
header: {
'Content-Type': 'application/json'
},
})
.then(res => {
uni.hideLoading();
if (res.code == 0) {
if(res.trainingClassList&&res.trainingClassList.length>0){
this.list = res.trainingClassList;
}else{
this.list = [];
this.nullStatus = true;
}
}
}).catch(e => {
});
},
},
}
</script>
<style lang="scss" scoped>
.image{
width: 100%;
height: auto;
}
/deep/.image img{
position: initial;
opacity: 1;
}
</style>

View File

@@ -0,0 +1,238 @@
<template>
<view class="page" style=" height:100vh; background: #f6f6f8;">
<z-nav-bar title="培训班管理" :backToMyPage="true">
<view slot="right">
<picker mode="date" fields="year" @change="handleYearChange">
<view class="picker">
<uni-icons type="info" size="16"></uni-icons>{{ year || '请选择年份' }}
</view>
</picker>
</view>
</z-nav-bar>
<view class="list_block" v-if="!nullStatus">
<view class="list_item" v-for="(item,index) in list" :key="index">
<view class="list_item_right">
<text class="list_item_title">{{item.title}}</text>
<text class="list_item_text">活动类型<span v-if="item.type==1">线上</span><span v-else>线下</span></text>
<text class="list_item_text">活动年份{{item.year}}</text>
<text class="list_item_text">培训日期{{item.trainingDate}}{{item.endDate}}</text>
<text class="list_item_text">培训价格
<span style="color: red; font-size: 32rpx; font-weight: bold;">{{item.finalFee}}</span>
<span style="text-decoration: line-through; padding-left: 15rpx;" v-if="Number(item.finalFee)!=item.fee">{{item.fee}}</span>
</text>
<text class="list_item_text" style=" font-size: 24rpx;" v-if="Number(item.finalFee)!=item.fee">{{item.identity}}身份报名享优惠折扣</text>
<view style=" display: flex; align-items: center;">
<uni-button class="list_item_btn" @click="goToDetail(item)">了解详情</uni-button>
<uni-button class="list_item_btn list_item_btn_bm" @click="goToBuy(item)" v-if="item.isJoin!=1&&item.singupFlag!=0">立即报名</uni-button>
<uni-button class="list_item_btn list_item_btn_ybm" @click="goToContact(item)" v-if="item.isJoin==1&&item.singupFlag!=0">已报名联系客服</uni-button>
</view>
</view>
<view class="statusBg" v-if="item.isJoin==1">已报名</view>
<view class="statusBg statusBg2" :class="item.isJoin==1?'statusBg_top':''" v-if="item.singupFlag==0">已关闭</view>
</view>
</view>
<view class="zanwu" v-if="nullStatus">暂无数据</view>
<u-popup key="1" v-if="showCodeImg" :show="showCodeImg" :round="10" @close="closePup">
<view class="box6">
<text>非常感谢您报名我们的培训班<br/>您可以添加客服微信我们会邀请您进培训群</text>
<image @click="previewImage('/static/qiyeWx.jpg')" src="/static/qiyeWx.jpg" mode="widthFix" style="width: 100px; height: 100px; margin: 0 auto;"></image>
</view>
</u-popup>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
export default {
data() {
return {
list: [],
nullStatus: false,
year: '',
showCodeImg: false,
}
},
onLoad(e) {
},
onShow() {
this.getData();
},
methods: {
//获取数据
getData(){
uni.showLoading({
title: '加载中'
})
$http.request({
url: "common/trainingClass/trainingClassList",
method: "POST",
data: {
year: this.year
},
header: {
'Content-Type': 'application/json'
},
})
.then(res => {
uni.hideLoading();
if (res.code == 0) {
if(res.trainingClassList&&res.trainingClassList.length>0){
this.list = res.trainingClassList;
}else{
this.list = [];
this.nullStatus = true;
}
}
}).catch(e => {
});
},
//选择年份
handleYearChange(event){
this.year = event.detail.value;
this.list = [];
this.nullStatus = false;
this.getData();
},
//了解详情
goToDetail(item){
uni.navigateTo({
url: `/pages/trainingCourse/detail?image=${item.icon}`,
});
},
//立即报名
goToBuy(item){
var data = {
id: item.id,
title: item.title,
price: item.finalFee,
identity: item.identity,
orderType: 'pxb',
}
uni.navigateTo({
url: '/pages/place/order?data='+JSON.stringify(data)
});
},
//联系客服
goToContact(item){
this.showCodeImg = true;
},
//关闭弹窗
closePup(){
this.showCodeImg = false;
},
//放大图片
previewImage(url) {
this.showCodeImg = false
uni.previewImage({
urls: [url],
});
},
},
onBackPress(){
uni.reLaunch({
url:'/pages/my/index'
})
return true; //阻止默认返回行为
},
}
</script>
<style>
.zanwu{
font-style: 26rpx;
line-height: 30rpx;
padding-top: 100rpx;
text-align: center;
color: #999;
}
.list_block{
padding: 20rpx;
}
.list_item{
margin-bottom: 20rpx;
background-color: #fff;
border-radius: 15rpx;
padding: 20rpx;
box-shadow: 0px 0px 6px 0px #a7bbe4;
position: relative;
}
.list_item_right{
margin-left: 20rpx;
}
.list_item_right text{
display: block;
}
.list_item_title{
font-size: 32rpx;
font-weight: bold;
color: #333;
line-height: 40rpx;
padding-bottom: 10rpx;
}
.list_item_text{
font-size: 28rpx;
color: #666;
line-height: 42rpx;
}
.list_item_btn{
margin-top: 15rpx;
width: 150rpx;
height: 50rpx;
text-align: center;
line-height: 50rpx;
border-radius: 15rpx;
background-image: linear-gradient(90deg, #258feb 0%, #00e1ec 100%);
font-size: 24rpx;
color: #fff;
}
.list_item_btn_bm{
margin-left: 10rpx;
background-image: linear-gradient(90deg, #ff1f00 0%, #fa9f93 100%);
}
.list_item_btn_ybm{
width: 200rpx;
margin-left: 10rpx;
background-image: linear-gradient(90deg, #ff8d00 0%, #f5c350 100%);
}
.statusBg{
position: absolute;
right: 0;
top: 20rpx;
width: 100rpx;
height: 44rpx;
line-height: 44rpx;
background: #ff1f00;
opacity: 0.8;
border-radius: 50rpx 0 0 50rpx;
font-size: 22rpx;
color: #fff;
padding-left: 20rpx;
}
.statusBg2{
background: #999;
}
.statusBg_top{
top: 70rpx;
}
.picker{
display: flex;
align-items: center;
font-size: 26rpx;
padding-right: 20rpx;
}
.box6{
padding: 20rpx;
}
.box6 text{
display: block;
text-align: center;
color: #999;
margin-bottom: 20rpx;
font-size: 28rpx;
line-height: 36rpx;
}
</style>

View File

@@ -197,7 +197,7 @@ export default {
this.telError = false
},
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
var result = await permission.premissionCheck("CAMERA")
if (result != 1) {
return false
}