优惠券

This commit is contained in:
@fawn-nine
2024-10-18 15:16:09 +08:00
parent d46f419846
commit 9b9849bf72
5 changed files with 2242 additions and 1979 deletions

View File

@@ -1001,6 +1001,7 @@ export default {
},
// 取消订单
canceOrder(item) {
console.log('item.orderSn',item);
uni.showModal({
title: "提示",
content: "确定要取消订单吗?",
@@ -1011,7 +1012,9 @@ export default {
success: (res) => {
if (res.confirm) {
this.$http
.get("book/buyOrder/cancelOrder?orderSn=" + item.orderSn)
.post(
"book/buyOrder/appDelete?orderId=" + item.orderId
)
.then((res) => {
if (res.code == 0) {
uni.showToast({

View File

@@ -799,7 +799,7 @@
.then(async (res) => {
console.log("res at line 493:", res);
if (res.code == 0) {
this.getCourseDescriptionData();
this.getCourseDescriptionData(v);
// this.$commonJS.showToast("");
}
this.$forceUpdate();
@@ -812,6 +812,10 @@
showCancel:false
})
}else {
this.getCourseDescriptionData(v);
}
},
getCourseDescriptionData(v){
this.$http
.request({
url: this.urlList.goodsList,
@@ -836,7 +840,6 @@
this.$forceUpdate();
})
}
},
getUserInfo() {
this.$http.post("common/user/getUserInfo").then((res) => {

View File

@@ -4,29 +4,13 @@
<public-module></public-module>
<z-nav-bar title="商品详情" bgColor="#258feb" fontColor="#fff"></z-nav-bar>
<view
class="contentBox commonPageContentBox"
v-if="!this.$store.state.loadingShow"
>
<view class="contentBox commonPageContentBox" v-if="!this.$store.state.loadingShow">
<!-- :indicator-dots="true" -->
<swiper
:autoplay="true"
:interval="3000"
:duration="1000"
style="width: 100%; height: 750rpx; background-color: #f5f5f5"
>
<swiper-item
v-for="(item, index) in swiperList"
:key="index"
style="width: 100%; height: 100%"
>
<swiper :autoplay="true" :interval="3000" :duration="1000"
style="width: 100%; height: 750rpx; background-color: #f5f5f5">
<swiper-item v-for="(item, index) in swiperList" :key="index" style="width: 100%; height: 100%">
<!-- <image :src="curriculumData.explainsImg" mode="widthFix" class="headImage"></image> -->
<image
:src="item"
mode="aspectFit"
style="width: 100%; height: 100%"
@click="previewImage(item)"
>
<image :src="item" mode="aspectFit" style="width: 100%; height: 100%" @click="previewImage(item)">
</image>
</swiper-item>
</swiper>
@@ -36,17 +20,14 @@
<view v-if="this.options.isMiaosha==1" class="miaosha_box">
<view class="price_box">
<view class="price_left">
<template
v-if="
<template v-if="
curriculumData.activityPrice &&
curriculumData.activityPrice > 0
"
>
">
<text class="aui-text-danger price">
¥{{ curriculumData.activityPrice }}
</text>
<text class="price original_price"
>原价:¥{{ curriculumData.price }}
<text class="price original_price">原价:¥{{ curriculumData.price }}
</text>
</template>
<template v-else>
@@ -55,8 +36,7 @@
</text>
</template>
<view class="price original_price sales_number"
>已售 {{ curriculumData.sumSales }}件
<view class="price original_price sales_number">已售 {{ curriculumData.sumSales }}件
</view>
</view>
@@ -72,23 +52,19 @@
</view>
</view>
<view class="curriulum_title"
>{{ curriculumData.productName }}
<view class="curriulum_title">{{ curriculumData.productName }}
</view>
</view>
<view v-else class="normal_box">
<view class="price_box">
<template
v-if="
<template v-if="
curriculumData.activityPrice &&
curriculumData.activityPrice > 0
"
>
">
<text class="aui-text-danger price">
¥{{ curriculumData.activityPrice }}
</text>
<text class="price original_price"
>原价:¥{{ curriculumData.price }}
<text class="price original_price">原价:¥{{ curriculumData.price }}
</text>
</template>
<template v-else>
@@ -96,15 +72,12 @@
¥{{ curriculumData.price }}
</text>
</template>
<text
class="price original_price sales_number"
style="float: right"
>已售 {{ curriculumData.sumSales }}件
<text class="price original_price sales_number" style="float: right">已售
{{ curriculumData.sumSales }}件
</text>
</view>
<view class="curriulum_title" style="margin-top: 40rpx;"
>{{ curriculumData.productName }}
<view class="curriulum_title" style="margin-top: 40rpx;">{{ curriculumData.productName }}
</view>
</view>
@@ -113,89 +86,35 @@
</view>
<template>
<common-sticky
label="title"
:itemStyle="`width:${
<common-sticky label="title" :itemStyle="`width:${
cateList.length == 2 ? '50' : '33'
}%;padding-left: 15px; padding-right: 15px; height: 68rpx;`"
:list="cateList"
:currentCateIndex="currentCateIndex"
@handleselectCate="handleselectCate"
>
}%;padding-left: 15px; padding-right: 15px; height: 68rpx;`" :list="cateList"
:currentCateIndex="currentCateIndex" @handleselectCate="handleselectCate">
</common-sticky>
</template>
<!-- <view :class="`priceDetail`" v-if="this.statusList[this.currentStatusIndex].type == 'price'">
<scroll-view scroll-y="true" class="scroll-Y">
<price ref="priceDetail" type="price" :oid="this.statusList[this.currentStatusIndex].oid"></price>
</scroll-view>
</view>
<view :class="`priceDetail`" v-else-if="this.statusList[this.currentStatusIndex].type == 'purchaseNotice'">
<scroll-view scroll-y="true" class="scroll-Y">
<price ref="purchaseNotice" :oid="this.statusList[this.currentStatusIndex].oid"></price>
</scroll-view>
</view>
-->
<view :class="`dataList `">
<view
class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font"
style="background-color: #C7E9FB"
>
<view class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font"
style="background-color: #C7E9FB">
<view class="left" style="color: #258feb;">
<u-icon
name="grid"
color="#258feb"
size="23"
style="display: inline-block; margin-right: 10rpx"
></u-icon>
商品规格</view
>
<text class="right" @click="openPopup"
>共{{ goodsList.length }}种商品可选择</text
>
<u-icon name="grid" color="#258feb" size="23"
style="display: inline-block; margin-right: 10rpx"></u-icon>
商品规格
</view>
<common-goods-list
imgUrl="url"
isNoIcon
imgMode="aspectFit"
class="color_shandow"
defaultUrl=""
:isCondition="true"
:dataList="goodsList"
@hancleClick="selectGoods"
label="title"
>
<text class="right" @click="openPopup">共{{ goodsList.length }}种商品可选择</text>
</view>
<common-goods-list imgUrl="url" isNoIcon imgMode="aspectFit" class="color_shandow" defaultUrl=""
:isCondition="true" :dataList="goodsList" @hancleClick="selectGoods" label="title">
<template slot="labelSlot" slot-scope="slotProps">
<!-- isSelectGoods -->
<view
class="related_courses_name goodsList"
:class="`goods_item ${
<view class="related_courses_name goodsList" :class="`goods_item ${
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId
? ''
: ''
}`"
>
}`">
<view class="image_box">
<image
:src="slotProps.row.productImages"
mode="aspectFit"
class="goods_image"
></image>
<image :src="slotProps.row.productImages" mode="aspectFit" class="goods_image"></image>
</view>
</view>
@@ -233,39 +152,21 @@
</common-goods-list>
</view>
<view :class="`dataList parameterList`" v-if="booksList.length > 0">
<view
class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font"
>
<view class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font">
<view class="left" style="color:#3C77BE !important">
<u-icon
name="list"
color="#3C77BE"
size="23"
style="display: inline-block; margin-right: 10rpx"
></u-icon>
书籍信息</view
>
<u-icon name="list" color="#3C77BE" size="23"
style="display: inline-block; margin-right: 10rpx"></u-icon>
书籍信息
</view>
</view>
<common-list
imgUrl="url"
isNoIcon
imgMode="aspectFit"
class="color_shandow parameter_box book_box"
defaultUrl=""
:isCondition="true"
:dataList="booksList"
label="title"
>
<common-list imgUrl="url" isNoIcon imgMode="aspectFit" class="color_shandow parameter_box book_box"
defaultUrl="" :isCondition="true" :dataList="booksList" label="title">
<template slot="labelSlot" slot-scope="slotProps">
<!-- isSelectGoods -->
<view class="related_courses_name" :class="`goods_item `">
<view class="image_box" style="margin-right: 10rpx">
<image
:src="slotProps.row.images"
mode="aspectFit"
class="goods_image"
></image>
<image :src="slotProps.row.images" mode="aspectFit" class="goods_image"></image>
</view>
<view :class="`goods_info `">
<view class="name">
@@ -279,39 +180,21 @@
</common-list>
</view>
<view :class="`dataList parameterList`" v-if="coursesList.length > 0">
<view
class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font"
>
<view class="goods_detail_list_title bg_box_shandow color_shandow bg_color PM_font">
<view class="left" style="color: #018f89 !important">
<u-icon
name="list"
color="#018F89"
size="23"
style="display: inline-block; margin-right: 10rpx"
></u-icon>
课程信息</view
>
<u-icon name="list" color="#018F89" size="23"
style="display: inline-block; margin-right: 10rpx"></u-icon>
课程信息
</view>
</view>
<common-list
imgUrl="url"
isNoIcon
imgMode="aspectFit"
class="color_shandow parameter_box"
defaultUrl=""
:isCondition="true"
:dataList="coursesList"
label="title"
>
<common-list imgUrl="url" isNoIcon imgMode="aspectFit" class="color_shandow parameter_box" defaultUrl=""
:isCondition="true" :dataList="coursesList" label="title">
<template slot="labelSlot" slot-scope="slotProps">
<!-- isSelectGoods -->
<view class="related_courses_name" :class="`goods_item `">
<view class="image_box" style="margin-right: 10rpx">
<image
:src="slotProps.row.images"
mode="aspectFit"
class="goods_image"
></image>
<image :src="slotProps.row.images" mode="aspectFit" class="goods_image"></image>
</view>
<view :class="`goods_info `">
<view class="name">
@@ -324,42 +207,49 @@
</template>
</common-list>
</view>
<template v-if="canGetCouponList.length > 0">
<u-divider text="购买本商品赠送如下优惠券" :hairline="true" textColor="#333" lineColor="#b0b0b0"></u-divider>
<view class="tanchu">
<view class="listBox" >
<view style="max-height: 40vh;overflow-y: scroll;" :class="'youhuiItem'"
v-for="(item,index) in canGetCouponList" :key="index">
<view style="width: 25%;color:#fd6004;text-align: center;">
<text>¥</text>
<b style="font-size: 60rpx;">{{item.couponEntity.couponAmount}}</b>
</view>
<view style="width: 68%;padding-left: 5%;">
<view>
<text
style="display: inline-block; font-size: 30rpx; margin-right: 6rpx; color:rgb(253, 96, 4);">{{item.couponEntity.couponName}}</text>
<!-- <text class="border_radius_10"
style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text> -->
</view>
<text
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明:{{item.couponEntity.remark}}</text>
<u-divider
text="商品参数"
:hairline="true"
textColor="#333"
lineColor="#b0b0b0"
></u-divider>
</view>
</view>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view>
</view>
</template>
<u-divider text="商品参数" :hairline="true" textColor="#333" lineColor="#b0b0b0"></u-divider>
<view class="parameter_info_box">
<common-list
imgUrl="url"
isNoIcon
imgMode="aspectFit"
class="parameter_box parameter_info"
defaultUrl=""
:isCondition="true"
:dataList="parameterList"
@hancleClick="selectGoods"
label="name"
>
<common-list imgUrl="url" isNoIcon imgMode="aspectFit" class="parameter_box parameter_info"
defaultUrl="" :isCondition="true" :dataList="parameterList" @hancleClick="selectGoods" label="name">
<template slot="labelSlot" slot-scope="slotProps">
<!-- isSelectGoods -->
<view
class="related_courses_name"
:class="`goods_item ${
<view class="related_courses_name" :class="`goods_item ${
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId
? ''
: ''
}`"
>
}`">
<view :class="`goods_info `">
<view class="name">
<text style="color: #333"> {{ slotProps.row.name }}</text>
<text v-if="slotProps.row.isTime">
{{ slotProps.row.value | formatDate }}</text
>
{{ slotProps.row.value | formatDate }}</text>
<text v-else> {{ slotProps.row.value }}</text>
</view>
</view>
@@ -399,12 +289,7 @@
</common-list>
</view>
<u-divider
text="商品详情"
:hairline="true"
textColor="#333"
lineColor="#b0b0b0"
></u-divider>
<u-divider text="商品详情" :hairline="true" textColor="#333" lineColor="#b0b0b0"></u-divider>
<view class="small_class_teaching_box" style="background-color: #B7E0E2">
<view class="common_divider divider_box"> </view>
@@ -454,28 +339,16 @@
</view>
</view>
<view
class="small_class_teaching_box related_courses_box"
v-if="relatedCoursesList.length > 0"
>
<view class="small_class_teaching_box related_courses_box" v-if="relatedCoursesList.length > 0">
<view class="small_class_teaching_top">
<view class="small_class_teaching_top_left">
<image
src="@/static/icon/course_ic.png"
mode="aspectFil"
class="icon1"
></image>
<image src="@/static/icon/course_ic.png" mode="aspectFil" class="icon1"></image>
<text>相关课程</text>
</view>
</view>
<view class="small_class_teaching_content">
<common-curriculum-list
imgUrl="url"
:isCondition="true"
:dataList="relatedCoursesList"
@hancleClick="goCourseDescription"
label="title"
>
<common-curriculum-list imgUrl="url" :isCondition="true" :dataList="relatedCoursesList"
@hancleClick="goCourseDescription" label="title">
<template slot="labelSlot" slot-scope="slotProps">
<view class="related_courses_name hidden1">{{
slotProps.row.title
@@ -488,8 +361,7 @@
<!-- {{ slotProps.row.bxType }} -->
<text class="aui-text-danger">
¥{{ slotProps.row.courseFee }}</text
>
¥{{ slotProps.row.courseFee }}</text>
<view> </view>
</template>
@@ -498,13 +370,8 @@
</view>
</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"
/>
<uni-goods-nav :fill="true" :options="buyOptions" :button-group="customButtonGroup1"
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy1" />
</view>
<!--
<u-modal
@@ -515,82 +382,43 @@
@confirm="hancleModalConfirm"
@cancel="hancleModalCancel"
></u-modal> -->
<common-select-goods
ref="commonSelectGoods"
:selectGoodsData="selectGoodsData"
:goodsList="goodsList"
:buyOptions="buyOptions"
:customButtonGroup1="customButtonGroup1"
@selectGoods="selectGoods"
@onHandleClickBuy="onHandleClickBuy"
></common-select-goods>
<u-popup
:show="showInfo"
mode="bottom"
@close="closeShowInfo"
class="popup_box"
>
<common-select-goods ref="commonSelectGoods" :selectGoodsData="selectGoodsData" :goodsList="goodsList"
:buyOptions="buyOptions" :customButtonGroup1="customButtonGroup1" @selectGoods="selectGoods"
@onHandleClickBuy="onHandleClickBuy"></common-select-goods>
<u-popup :show="showInfo" mode="bottom" @close="closeShowInfo" class="popup_box">
<view class="popup_top">
<view class="product_image">
<image
:src="selectGoodsData.productImages"
mode="aspectFit"
class="goods_image"
></image>
<image :src="selectGoodsData.productImages" mode="aspectFit" class="goods_image"></image>
</view>
<view class="title">已选:{{ selectGoodsData.productName }}</view>
</view>
<view :class="`common_radius_box goods_box popup_content`">
<view class="title title_box"
><text class="title_price">¥{{ selectGoodsData.price }}</text
><u-icon
name="close"
color="#333"
size="18"
@click="close"
style="display: inline-block"
></u-icon
></view>
<view class="title title_list"
><text>商品列表({{ goodsList.length }}</text></view
>
<view class="title title_box"><text class="title_price">¥{{ selectGoodsData.price }}</text><u-icon
name="close" color="#333" size="18" @click="close" style="display: inline-block"></u-icon>
</view>
<view class="title title_list"><text>商品列表({{ goodsList.length }}</text></view>
<common-list
imgUrl="url"
isNoIcon
imgMode="aspectFit"
defaultUrl=""
:isCondition="true"
:dataList="goodsList"
@hancleClick="selectGoods"
label="title"
>
<common-list imgUrl="url" isNoIcon imgMode="aspectFit" defaultUrl="" :isCondition="true"
:dataList="goodsList" @hancleClick="selectGoods" label="title">
<template slot="labelSlot" slot-scope="slotProps">
<!-- isSelectGoods -->
<view
class="related_courses_name"
:class="`goods_item ${
<view class="related_courses_name" :class="`goods_item ${
selectGoodsData &&
selectGoodsData.productId == slotProps.row.productId
? 'isSelectGoods color_shandow'
: ''
}`"
>
}`">
<view class="image_box" style="margin-right: 10rpx">
<image
:src="slotProps.row.productImages"
mode="aspectFit"
class="goods_image"
></image>
<image :src="slotProps.row.productImages" mode="aspectFit" class="goods_image"></image>
</view>
<view :class="`goods_info `">
<view class="name">{{ slotProps.row.productName }}</view>
<view class="price" style="color: #258feb">{{
slotProps.row.price
}}</view></view
>
}}</view>
</view>
</view>
<!-- <text v-if="slotProps.row.conditions!='03'">【试听】</text> -->
@@ -598,13 +426,8 @@
</common-list>
<view class="goods_nav_box">
<uni-goods-nav
:fill="true"
:options="buyOptions"
:button-group="customButtonGroup1"
@click="onHandleClickBuy"
@buttonClick="onHandleClickBuy"
/>
<uni-goods-nav :fill="true" :options="buyOptions" :button-group="customButtonGroup1"
@click="onHandleClickBuy" @buttonClick="onHandleClickBuy" />
</view>
<!-- <view>
<text @click="handleClickClose">取消</text>
@@ -620,7 +443,9 @@
import courseDescription from "@/pages/component/commonComponents/list";
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
import {
mapState
} from "vuex";
export default {
components: {
courseDescription, //课程说明
@@ -673,8 +498,7 @@ export default {
playData: {},
taiHuClassInfo: {},
searchValue: "",
teachingList: [
{
teachingList: [{
title: "临床实践",
type: "02",
@@ -712,6 +536,7 @@ export default {
limitTitle: "提示",
limitContent: "",
scrollViewHeight: 0,
canGetCouponList: [], // 可获得优惠券列表
urlList: {
list: "app/phone.do?getCourseDetail_new",
curriculumInfo: "app/phone.do?getCourseInfo",
@@ -719,14 +544,12 @@ export default {
goodsList: "book/shopproduct/getGlProductList",
visitorDetailInfo: "visitor/getProductDetail", // 游客状态下的商品详情
},
customButtonGroup1: [
{
customButtonGroup1: [{
with: 200,
text: "立即购买",
backgroundColor: "linear-gradient(90deg, #FE6035, #EF1224)",
color: "#fff",
},
],
}, ],
requestType: '', // 数据请求类型是否为游客登陆状态
};
},
@@ -810,6 +633,32 @@ export default {
...mapState(["userInfo"]),
},
methods: {
// 获取购买后可获得优惠券列表
async getCanGetCouponList() {
await this.$http
.request({
url: "common/coupon/couponToProductList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page": 1,
"limit": 100,
"productId": this.curriculumData.productId
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
if (res.code != 0) return this.$commonJS.showToast(res.errMsg);
console.log('res优惠券', res);
this.canGetCouponList = res.couponToShopproductPage.records
}).catch(e => {
console.log(e);
this.$commonJS.showToast(e.errMsg);
})
},
closeShowInfo() {
this.showInfo = false;
},
@@ -872,16 +721,14 @@ export default {
"this.selectGoodsDatathis.selectGoodsDatathis.selectGoodsData"
);
var mynavData = JSON.stringify({
goods: [
{
goods: [{
productImages: this.selectGoodsData.productImages,
productId: this.selectGoodsData.productId,
productName: this.selectGoodsData.productName,
activityPrice: this.selectGoodsData.activityPrice,
price: this.selectGoodsData.price,
goodsType: this.selectGoodsData.goodsType,
},
],
}, ],
navTitle: this.options.navTitle,
title: this.options.title,
@@ -938,8 +785,7 @@ export default {
}
this.modalInfo = {
title: "提示信息",
content:
"用户您好,该课程已到期,通过支付" +
content: "用户您好,该课程已到期,通过支付" +
fee +
"元,本门课程可获得" +
days +
@@ -1009,6 +855,7 @@ export default {
.then(async (res) => {
that.selectGoodsData = res.data.GLProducts[0];
that.curriculumData = res.data.detail;
await this.getCanGetCouponList()
that.booksList = res.data.books ? res.data.books : [];
that.coursesList = res.data.courses ? res.data.courses : [];
that.goodsList = res.data.GLProducts;
@@ -1328,7 +1175,9 @@ export default {
transformData(inputData) {
const result = {};
inputData.forEach((item) => {
const { letter } = item;
const {
letter
} = item;
if (!result[letter]) {
result[letter] = [];
}
@@ -1498,6 +1347,117 @@ export default {
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.tanchu {
padding: 0 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 {
border: 1px solid #d9d9d9;
border-radius: 10rpx;
width: 100%;
display: flex;
padding: 20rpx 10rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.youhuiItem>view {
float: left;
}
.youhuiItem.youItem_style {
border-color: #fd6004;
}
}
.u-grid-list {
// height: 40rpx;
}
@@ -2040,12 +2000,14 @@ export default {
border: 2rpx solid #fff;
border-radius: 10rpx;
}
.title {
box-sizing: border-box;
// font-weight: bold;
margin-bottom: 40rpx;
padding-left: 20rpx;
}
.image_box {
width: 70rpx;
height: 70rpx;
@@ -2057,6 +2019,7 @@ export default {
width: 100%;
height: 100%;
}
.goods_info {
width: calc(100%);
// padding: 10rpx 20rpx;
@@ -2066,27 +2029,34 @@ export default {
align-items: center;
justify-content: space-between;
float: left;
.name {
font-size: 26rpx;
// font-weight: 600;
color: #333;
}
.price {
font-size: 26rpx;
color: #aaa;
}
}
.isSelectGoods {
color: $themeColor !important;
.name {
color: $themeColor !important;
}
.price {
color: $themeColor !important;
}
border: 2rpx solid $themeColor;
border-radius: 10rpx;
}
/deep/.list_item {
// border-bottom: none;
padding: 10rpx 0 !important;
@@ -2101,17 +2071,21 @@ export default {
border: none !important;
box-shadow: none !important;
}
.parameter_box {
padding: 20rpx 0;
}
.goods_item {
padding-top: 5rpx !important;
padding-bottom: 5rpx !important;
}
}
.parameter_info_box {
padding: 0 20rpx;
}
.parameter_info {
/deep/.list_item {
// border-bottom: none;
@@ -2119,10 +2093,12 @@ export default {
border: none !important;
box-shadow: none !important;
}
.goods_item {
border: none !important;
}
}
.goodsList {
.image_box {
width: 80rpx;
@@ -2131,23 +2107,28 @@ export default {
background-color: #f5f5f5;
}
}
/deep/.u-popup__content {
background-color: transparent !important;
}
/deep/.u-popup__content__close {
color: #fff !important;
}
.title_box {
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 0;
.title_price {
color: #ef1224;
font-size: 40rpx;
font-weight: 700;
}
}
.title_list {
margin-bottom: 20rpx;
}
@@ -2157,6 +2138,7 @@ export default {
width: 160rpx;
height: 160rpx;
}
.goods_info {
display: block;
}

View File

@@ -149,7 +149,7 @@
<template v-if="v.type == 3">
<template v-if="!curCoupon.id">
<template v-if="couponHistoryList.length > 0">
<text style="color: #999" @click="showCouponPup = true">可用({{couponHistoryList.length}})</text>
<text style="color: #999" @click="showCouponPup = true">({{couponHistoryList.length}})</text>
<text @click="showCouponPup = true" style="display: inline-block; margin-left: 20rpx; background-color: #fe6035; color: #fff; border-radius: 30rpx;font-size: 26rpx; border: 4rpx #fe6035 solid; ">选择优惠券</text>
</template>
<template v-else>

View File

@@ -1,22 +1,297 @@
<template>
<view >
优惠券列表
<public-module></public-module>
<z-nav-bar title="我的优惠券"></z-nav-bar>
<view class="">
<view class="">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="tabClick" :current="curTagIndex"
:activeStyle="activeStyle" :scrollable="false" :list="tabList"
itemStyle="padding-left:10rpx; background-color:#fff; padding-right: 10rpx; height: 50px; font-size:26rpx"></u-tabs>
</view>
<!-- -->
<view class="tanchu">
<view class="listBox" v-if="list.length > 0">
<view style="max-height: 40vh;overflow-y: scroll;" :class="'youhuiItem'"
v-for="(item,index) in list" :key="index" >
<view style="width: 25%;color:#fd6004;text-align: center;">
<text></text>
<b style="font-size: 45rpx;">{{item.couponEntity.couponAmount}}</b>
<text
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;">{{item.couponEntity.couponName}}</text>
<text class="border_radius_10" style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text>
</view>
<text
style="display: block;font-size: 20rpx;color: #999;margin-top: 10rpx;">到期时间{{item.effectType == 0 ? '永久有效' : item.endTime}}</text>
<text
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明{{item.couponEntity.remark}}</text>
</view>
</view>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view>
<view class="" v-else>
<u-divider v-show="listStatus == 2" text="已加载全部"></u-divider>
<u-divider v-show="listStatus == 3" text="暂无数据"></u-divider>
<u-divider v-show="listStatus == 1" text="加载中..."></u-divider>
</view>
</view>
</view>
<z-navigation></z-navigation>
</view>
</template>
<script>
import $http from '@/config/requestConfig.js';
import {
mapState
} from "vuex";
export default {
data() {
return {
list:[], // 优惠券列表
listStatus:88,
curTagIndex:0, // 当前索引
tabList: [{
name: '未使用',
id: '0'
},
{
name: '已使用',
id: '1'
},
{
name: '已过期',
id: '2'
}
],
activeStyle:{
background:'#fff',
color:'#666',
padding:"10rpx",
borderRadius:"10rpx"
},
page:0,
limit:15,
status:0,
flag:false, // 请求标记
}
},
methods: {
onLoad() {
this.page = 1
this.getUserCouponList()
},
async onReachBottom() {
console.log('触底',this.listStatus,this.flag);
if(this.listStatus != 1 && this.listStatus != 2){
if(!this.flag){
this.page++
await this.getUserCouponList()
}
}
},
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: {
...mapState(["userInfo"]),
},
methods: {
async tabClick(e) {
console.log('e', e);
this.status = e.id
// this.curTagIndex = e.index
this.page = 0
this.page += 1
this.list = []
await this.getUserCouponList()
},
async getUserCouponList(){
console.log('进入函数了妈');
this.listStatus = 1
this.flag = true
uni.showLoading({
title:'加载中'
})
await this.$http
.request({
url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page": this.page,
"limit": this.limit,
"getType":"",//获取类型 0 后台赠送 1 主动获取
"status": this.status,//使用状态 0 未使用 1 已使用 2 已过期
"userInfo":"",//用户信息
"userId":this.userInfo.id
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
uni.hideLoading()
if(res.code != 0) return this.$commonJS.showToast(res.errMsg);
if(res.couponList.records.length > 0){
this.list = this.list.concat(res.couponList.records)
if (res.couponList.pages > this.page) {
this.listStatus = 0
} else {
this.listStatus = 2
}
} else {
this.listStatus = 3 // 暂无数据
}
this.flag = false
}).catch(e => {
uni.hideLoading()
console.log(e);
this.flag = false
this.listStatus = 3
console.log(e, '数据报错')
this.$commonJS.showToast(e.errMsg);
})
},
}
}
</script>
<style>
<style lang="scss" scoped>
.btnBox {
margin-top: 20rpx;
}
.tanchu {
padding: 0 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 {
border: 1px solid #d9d9d9;
border-radius: 10rpx;
width: 100%;
display: flex;
padding: 20rpx 10rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.youhuiItem>view {
float: left;
}
.youhuiItem.youItem_style {
border-color: #fd6004;
}
}
</style>