提交优惠券

This commit is contained in:
2024-11-04 09:37:19 +08:00
parent 09fd7e80c2
commit f64fd29de2
11 changed files with 6993 additions and 6185 deletions

View File

@@ -4,38 +4,81 @@
<u-popup :show="youhuiShow" :round="10" @close="closePup"> <u-popup :show="youhuiShow" :round="10" @close="closePup">
<view class="tanchu"> <view class="tanchu">
<view class="dp_title">请选择优惠券</view> <view class="dp_title">请选择优惠券</view>
<template v-if="list.length > 0" > <template v-if="list.length > 0">
<view style="max-height:40vh;overflow-y: scroll;"> <view style="max-height: 40vh; overflow-y: scroll">
<view :class="youhuiIndex === index ? 'youhuiItem youItem_style' : 'youhuiItem'" <view v-for="(item, index) in list" :key="index">
v-for="(item,index) in list" :key="index" @click="choseYouhui(index)"> <view
<view style="width: 25%;color:#fd6004;text-align: center;"> :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> <text></text>
<b style="font-size: 45rpx;">{{item.couponEntity.couponAmount}}</b> <b style="font-size: 45rpx">{{
item.couponEntity.couponAmount
}}</b>
<text <text
style="display: block;color: #666;font-size: 25rpx;margin-top: 10rpx;">{{item.couponEntity.useLevel}}元可用</text> class="useLevel"
style="
display: block;
color: #666;
font-size: 25rpx;
margin-top: 10rpx;
"
>{{ item.couponEntity.useLevel }}元可用</text
>
</view> </view>
<view style="width: 68%;padding-left: 5%;"> <view style="width: 68%; padding-left: 5%">
<view> <view>
<text style="display: inline-block; margin-right: 6rpx;">{{item.couponEntity.couponName}}</text> <text
<text class="border_radius_10" style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text> style="
display: inline-block;
margin-right: 6rpx;
line-height: 36rpx;
"
>{{ item.couponEntity.couponName }}</text
>
</view> </view>
<text <text
style="display: block;font-size: 20rpx;color: #999;margin-top: 10rpx;">到期时间{{item.effectType == 0 ? '永久有效' : item.endTime}}</text> style="
<template v-if="item.canUse == 0" > display: block;
<view class="" style="font-size:20rpx; display: inline-block; padding:0 10rpx ; background-color: #d9d9d9; border-radius: 10rpx;"> font-size: 22rpx;
<text color: #999;
style="color: #999; " margin-top: 10rpx;
>不可用</text> "
<text >有效期至{{
style="color: #999; " item.effectType == 0 ? "永久有效" : item.endTime
>{{item.canUseReason}}</text> }}</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> </view>
</template> </template>
<text v-else
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明{{item.couponEntity.remark}}</text>
</view> </view>
<view style="width: 7%;"> <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"> <!-- <view class="" style="background-color: #d9d9d9; border-radius: 10rpx; 0 0 10rpx; text-align: center;" v-if="item.canUse == 0">
<text <text
style="color: #999; " style="color: #999; "
@@ -44,25 +87,72 @@
<template v-if="item.canUse == 1"> <template v-if="item.canUse == 1">
<text <text
style="border: 1px solid #d9d9d9;width: 35rpx;height:35rpx;display:inline-block;border-radius: 30rpx;" style="
v-if="youhuiIndex !== index"></text> 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
name="checkmark-circle-fill"
color="#fd6004"
size="20"
v-if="youhuiIndex === index"
>
</u-icon> </u-icon>
</template> </template>
</view> </view>
<br clear="both"> <br clear="both" />
</view> </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 style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view> </view>
<view class="btnBox flex_box flex_between"> <view class="btnBox flex_box flex_between" v-if="selectcouponList.length>0">
<view class="" style="width: 48%;"> <view class="" style="width: 48%">
<button type="default" @click="confirmCoupon('none')">不使用优惠券</button> <button type="default" @click="confirmCoupon('none')">
不使用优惠券
</button>
</view> </view>
<view class="" style="width: 48%;"> <view class="" style="width: 48%">
<button type="primary" @click="confirmCoupon()">选好了</button> <button type="primary" @click="confirmCoupon()">选好了</button>
</view> </view>
</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> </template>
<view class="" v-else> <view class="" v-else>
<u-divider text="暂无可用优惠券哦"></u-divider> <u-divider text="暂无可用优惠券哦"></u-divider>
@@ -73,89 +163,89 @@
</template> </template>
<script> <script>
export default { export default {
name: "orderCoupon", name: "orderCoupon",
props: ['list', 'curCouponId','sumMeony'], props: ["list", "curCouponId", "sumMeony", "addressId",'selectcouponList'],
data() { data() {
return { return {
youhuiShow: true, youhuiShow: true,
youhuiIndex: undefined youhuiIndex: undefined,
}; };
}, },
mounted() { mounted() {
console.log('进入了', this.curCouponId, this.sumMeony); console.log("进入了", this.curCouponId, this.sumMeony);
if (this.curCouponId) { if (this.curCouponId) {
this.youhuiIndex = this.list.findIndex(item => item.couponEntity.id === this.curCouponId); this.youhuiIndex = this.list.findIndex(
console.log('查找后的结果', this.youhuiIndex); (item) => item.couponEntity.id === this.curCouponId
);
console.log("查找后的结果", this.youhuiIndex);
} }
}, },
filters:{ filters: {
couponType(type){ couponType(type) {
// 0无限制 1课程卷 2课程品类卷 // 0无限制 1课程卷 2课程品类卷
var str = '' var str = "";
switch (type){ switch (type) {
case 0: case 0:
str = '全场通用' str = "全场通用";
break; break;
case 1: case 1:
str = '指定课程可用' str = "指定课程可用";
break; break;
case 2: case 2:
str = '指定课程品类可用' str = "指定课程品类可用";
break; break;
} }
return str return str;
}
}, },
computed: {
}, },
computed: {},
methods: { methods: {
closePup() { closePup() {
this.youhuiIndex = undefined this.youhuiIndex = undefined;
this.$emit('close') this.$emit("close");
}, },
// 确定选中优惠券 // 确定选中优惠券
confirmCoupon(str) { confirmCoupon(str) {
console.log(str, '6666'); console.log(str, "6666");
if (str && str == 'none') { if (str && str == "none") {
// 清空优惠券操作 // 清空优惠券操作
this.$emit('confirmCoupon') this.$emit("confirmCoupon");
setTimeout(() => { setTimeout(() => {
this.closePup() this.closePup();
}, 300) }, 300);
return return;
} }
if (this.youhuiIndex == 0 || this.youhuiIndex) { if (this.youhuiIndex == 0 || this.youhuiIndex) {
this.$emit('confirmCoupon', this.list[this.youhuiIndex]) this.$emit("confirmCoupon", this.list[this.youhuiIndex]);
setTimeout(() => { setTimeout(() => {
this.closePup() this.closePup();
}, 300) }, 300);
} else { } else {
uni.showToast({ uni.showToast({
title: '请选择您要使用的优惠券', title: "请选择您要使用的优惠券",
icon: "none" icon: "none",
}) });
} }
}, },
// 选择优惠券 // 选择优惠券
choseYouhui(e) { choseYouhui(e) {
if(this.list[e].canUse == 0 ){ if (this.list[e].canUse == 0) {
return return;
} }
console.log('选中优惠券e', e); console.log("选中优惠券e", e);
this.youhuiIndex = e this.youhuiIndex = e;
}, },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.btnBox { .btnBox {
margin-top: 20rpx; margin-top: 20rpx;
} }
.tanchu { .tanchu {
padding: 40rpx 30rpx 40rpx 30rpx; padding: 40rpx 30rpx 40rpx 30rpx;
position: relative; position: relative;
// max-height: 60vh; // max-height: 60vh;
@@ -225,7 +315,6 @@
margin: 0 0 0 20rpx; margin: 0 0 0 20rpx;
} }
.chooseCheck { .chooseCheck {
position: absolute; position: absolute;
top: 3rpx; top: 3rpx;
@@ -239,29 +328,61 @@
} }
} }
.addressItem.addItem_style { .addressItem.addItem_style {
border-color: #fd6004; border-color: #fd6004;
} }
.youhuiItem { .youhuiItem {
position: relative;
background: linear-gradient(to top right, #fff, #fef2f4);
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
border-radius: 10rpx; border-radius: 10rpx;
width: 100%; width: 100%;
display: flex;
padding: 20rpx 10rpx; padding: 50rpx 20rpx 20rpx;
margin: 25rpx 0 0 0; margin: 25rpx 0 0 0;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
font-size: 30rpx; font-size: 30rpx;
} }
.youhuiItem>view { .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; float: left;
} }
.youhuiItem.youItem_style { .youhuiItem.youItem_style {
border-color: #fd6004; 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> </style>

View File

@@ -6,9 +6,9 @@ if (process.env.NODE_ENV === 'development') {
// socketUrl = "ws://localhost:6001/"; // socketUrl = "ws://localhost:6001/";
// baseUrl = "https://twin-ui.com/demo/"; // baseUrl = "https://twin-ui.com/demo/";
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境 // baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
baseUrl = "https://api.nuttyreading.com/"; // 线上正式 // baseUrl = "https://api.nuttyreading.com/"; // 线上正式
// baseUrl = "http://192.168.110.110:9200/pb/"; // 磊哥 // baseUrl = "http://192.168.110.110:9200/pb/"; // 磊哥
// baseUrl = "http://192.168.110.100:9200/pb/"; // 开发用电脑 baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
// baseUrl = "http://59.110.212.44:9200/pb/"; // baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑 // baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
// baseUrl = "http://192.168.110.110:9200/pb/"; // baseUrl = "http://192.168.110.110:9200/pb/";
@@ -16,11 +16,12 @@ if (process.env.NODE_ENV === 'development') {
// socketUrl = "ws://8.129.186.35:6001/"; // socketUrl = "ws://8.129.186.35:6001/";
} else if (process.env.NODE_ENV === 'production') { } else if (process.env.NODE_ENV === 'production') {
// 生产环境11 // 生产环境11
// baseUrl = "http://59.110.212.44:9100/pb/"; // baseUrl = "http://59.110.212.44:9100/pb/";
// baseUrl = "https://testapi.nuttyreading.com/"; // baseUrl = "https://testapi.nuttyreading.com/";
// baseUrl = "http://192.168.110.110:9200/pb/";//磊哥 // baseUrl = "http://192.168.110.110:9200/pb/";//磊哥
baseUrl = "https://api.nuttyreading.com/"; //1 // baseUrl = "https://api.nuttyreading.com/"; //1
// baseUrl = "http://192.168.110.100:9200/pb/"; // 开发用电脑 baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
// baseUrl = "ws://twin-ui.com:6001/"; // baseUrl = "ws://twin-ui.com:6001/";
// socketUrl = "ws://twin-ui.com:6001/"; // socketUrl = "ws://twin-ui.com:6001/";
} }

View File

@@ -88,6 +88,8 @@ import commonList from '@/pages/component/commonComponents/list.vue'
Vue.component('common-list', commonList); Vue.component('common-list', commonList);
import commonVideo from '@/pages/component/commonComponents/video/index.vue' import commonVideo from '@/pages/component/commonComponents/video/index.vue'
Vue.component('common-video', commonVideo); Vue.component('common-video', commonVideo);
import commonCoupon from '@/pages/component/commonComponents/coupon/index.vue'
Vue.component('common-coupon', commonCoupon);
import commonGoodsList from '@/pages/component/commonComponents/goodsList.vue' import commonGoodsList from '@/pages/component/commonComponents/goodsList.vue'
Vue.component('common-goods-list', commonGoodsList); Vue.component('common-goods-list', commonGoodsList);
import commonCurriculumList from '@/pages/component/commonComponents/curriculum.vue' import commonCurriculumList from '@/pages/component/commonComponents/curriculum.vue'

View File

@@ -12,8 +12,8 @@
"src" : "图片路径" "src" : "图片路径"
} }
], ],
"versionName" : "1.0.28", "versionName" : "1.0.31",
"versionCode" : 1028, "versionCode" : 1031,
"app-plus" : { "app-plus" : {
"nvueCompiler" : "weex", "nvueCompiler" : "weex",
"compatible" : { "compatible" : {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,287 @@
<template>
<view>
<view v-for="(item, index) in List" :key="index">
<view :class="`youhuiItem ${itemClass}`">
<view class="centerbg">
<view class="centerView" style="position: relative"
><text
v-if="source == 'mine'"
class="border_radius_10"
style="
position: absolute;
right: 10rpx;
top: 10rpx;
font-size: 25rpx;
/* background-color: #fad4bd; */
color: #ed2a2e;
"
>{{ item.couponEntity.couponRange | couponType }}</text
>
<view style="color: #fd4347; width: 200rpx">
<view
style="position: relative; border-right: 1px dashed #fa8277"
>
<text
style="
font-weight: 700;
font-size: 40rpx;
position: absolute;
top: 20rpx;
left: 0rpx;
"
></text
>
<text
style="
font-size: 64rpx;
letter-spacing: 0.1px;
font-weight: 700;
margin-left: 40rpx;
"
>{{ item.couponEntity.couponAmount }}</text
>
<text
v-if="source == 'mine'"
style="
display: block;
color: #333;
font-size: 25rpx;
margin-left: 0rpx;
margin-top: 0rpx;
"
>{{ item.couponEntity.useLevel }}元可用</text
>
</view>
</view>
<view style="width: calc(100% - 220rpx)">
<view>
<view
style="color: #fd4347; font-size: 44rpx; font-weight: bold;"
>{{
item.couponEntity.couponType == 0 ? "现金" : "折扣"
}}优惠券
<!-- <text v-if="source == 'mine'" style="box-sizing: border-box;padding:4rpx 20rpx;margin-left: 10rpx;font-size: 24rpx;background-color: #fff;border-radius: 24rpx;float: right;">去使用</text> -->
</view
>
<text
v-if="source != 'goodsDetail'"
style="
display: block;
font-size: 24rpx;
color: #333;
margin-top: 10rpx;
"
>有效期至{{
item.effectType == 0 ? "永久有效" : item.endTime
}}</text
>
</view>
</view>
</view>
</view>
<view class="bottombg">
<view
style="
width: 100%;
padding: 16rpx 20rpx;
box-sizing: border-box;
margin-right: 6rpx;
position: absolute;
bottom: 0rpx;
text-align: center;
"
>
<view
class="title"
style="
line-height: 34rpx;
margin-bottom: 10rpx;
color: #fff;
font-size: 34rpx;
font-weight: bold;
"
>
{{ item.couponEntity.couponName }}
</view>
<view
v-if="item.couponEntity.remark"
style="
position: absolute;
right: 10rpx;
bottom: 10rpx;
display: flex;
align-items: center;
font-size: 22rpx;
color: #fafafa;
"
>
<!-- 详细信息
<u-icon
size="20rpx"
color="#fafafa"
style="color: #fafafa; float: right;margin-left: 4rpx;"
name="arrow-down-fill"
></u-icon> -->
</view>
</view>
</view>
</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
style="
font-size: 22rpx;
width: 100%;
margin-right: 20rpx !important;
"
>使用说明{{ item.couponEntity.remark }}</view
>
</u-collapse-item>
</u-collapse>
</view>
</view>
</template>
<script>
import $http from "@/config/requestConfig.js";
import { mapState } from "vuex";
export default {
props: ["List", "source", "itemClass"],
data() {
return {};
},
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: {},
};
</script>
<style scoped lang="scss">
.youhuiItem {
min-height: 320rpx;
position: relative;
background: linear-gradient(to top right, #fd4c50, #fe393d);
border: 1px solid #d9d9d9;
border-radius: 10rpx;
width: 100%;
padding: 26rpx;
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.centerbg {
width: 100%;
background-image: linear-gradient(60deg, #ffefd3 0%, #f8be85 100%);
height: calc(100%);
border-radius: 10rpx;
padding-bottom: 86rpx;
box-sizing: border-box;
}
.centerView {
width: 100%;
height: 100%;
overflow: hidden;
padding: 30rpx 20rpx 0 40rpx;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.bottombg {
position: absolute;
bottom: 0;
width: 100%;
height: 100%;
left: 0;
right: 0;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
background-image: url("@/static/icon/coupon/bottom.png") !important;
}
.youhuiItem > view {
}
.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;
}
}
::v-deep .u-collapse-item__content__text {
padding: 10rpx 20rpx !important;
box-sizing: border-box;
}
::v-deep.itemCouponClass {
min-height: 180rpx !important;
.bottombg {
.title {
font-size: 26rpx !important;
}
}
.centerbg {
padding-bottom: 60rpx !important;
}
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,43 @@
<template> <template>
<view > <view>
<public-module></public-module> <public-module></public-module>
<z-nav-bar title="我的优惠券"></z-nav-bar> <z-nav-bar title="我的优惠券"></z-nav-bar>
<view class=""> <view class="">
<view class=""> <view class="">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="tabClick" :current="curTagIndex" <u-tabs
:activeStyle="activeStyle" :scrollable="false" :list="tabList" v-if="tabList.length > 0"
itemStyle="padding-left:10rpx; background-color:#fff; padding-right: 10rpx; height: 50px; font-size:26rpx"></u-tabs> :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>
<!-- --> <!-- -->
<view class="tanchu"> <view class="tanchu" style="position: relative">
<view
v-if="status!=0"
style="
min-height: 80vh;
z-index: 100;
background-color: #f0f0f0;
opacity: 0.55;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
"
></view>
<view class="listBox" v-if="list.length > 0"> <view class="listBox" v-if="list.length > 0">
<view style="max-height: 40vh;overflow-y: scroll;" :class="'youhuiItem'" <view style="min-height: 40vh; overflow-y: scroll">
v-for="(item,index) in list" :key="index" > <common-coupon :List="list" :source="'mine'"> </common-coupon>
<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>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> --> <!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view> </view>
<view class="" v-else> <view class="" v-else>
@@ -45,107 +52,114 @@
</template> </template>
<script> <script>
import $http from '@/config/requestConfig.js'; import $http from "@/config/requestConfig.js";
import { import { mapState } from "vuex";
mapState export default {
} from "vuex";
export default {
data() { data() {
return { return {
list:[], // 优惠券列表 list: [], // 优惠券列表
listStatus:88, listStatus: 88,
curTagIndex:0, // 当前索引 curTagIndex: 0, // 当前索引
tabList: [{ tabList: [
name: '未使用', {
id: '0' name: "未使用",
id: "0",
}, },
{ {
name: '已使用', name: "已使用",
id: '1' id: "1",
}, },
{ {
name: '已过期', name: "已过期",
id: '2' id: "2",
} },
], ],
activeStyle:{ activeStyle: {
background:'#fff', background: "#fff",
color:'#666', color: "#666",
padding:"10rpx", padding: "10rpx",
borderRadius:"10rpx" borderRadius: "10rpx",
}, },
page:0, page: 0,
limit:15, limit: 15,
status:0, status: 0,
flag:false, // 请求标记 flag: false, // 请求标记
} };
}, },
onLoad() { onLoad() {
this.page = 1 this.page = 1;
this.getUserCouponList() this.getUserCouponList();
}, },
async onReachBottom() { async onReachBottom() {
console.log('触底',this.listStatus,this.flag); console.log("触底", this.listStatus, this.flag);
if(this.listStatus != 1 && this.listStatus != 2){ if (this.listStatus != 1 && this.listStatus != 2) {
if(!this.flag){ if (!this.flag) {
this.page++ this.page++;
await this.getUserCouponList() await this.getUserCouponList();
} }
} }
}, },
filters:{ filters: {
couponType(type){ couponType(type) {
// 0无限制 1课程卷 2课程品类卷 // 0无限制 1课程卷 2课程品类卷
var str = '' var str = "";
switch (type){ switch (type) {
case 0: case 0:
str = '全场通用' str = "全场通用";
break; break;
case 1: case 1:
str = '指定课程可用' str = "指定课程可用";
break; break;
case 2: case 2:
str = '指定课程品类可用' str = "指定课程品类可用";
break; break;
} }
return str return str;
} },
}, },
computed: { computed: {
...mapState(["userInfo"]), ...mapState(["userInfo"]),
}, },
methods: { methods: {
async tabClick(e) { async tabClick(e) {
console.log('e', e); console.log("e", e);
this.status = e.id this.status = e.id;
// this.curTagIndex = e.index // this.curTagIndex = e.index
this.page = 0 this.page = 0;
this.page += 1 this.page += 1;
this.list = [] this.list = [];
await this.getUserCouponList() await this.getUserCouponList();
}, },
async getUserCouponList(){ async getUserCouponList() {
console.log('进入函数了妈'); console.log("进入函数了妈");
this.listStatus = 1 this.listStatus = 1;
this.flag = true this.flag = true;
uni.showLoading({ uni.showLoading({
title:'加载中' title: "加载中",
}) });
console.log(
{
page: this.page,
limit: this.limit,
getType: "", //获取类型 0 后台赠送 1 主动获取
status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
userInfo: "", //用户信息
userId: this.userInfo.id,
},
111111111111111111111111111
);
await this.$http await this.$http
.request({ .request({
url: "common/coupon/getCouponHistoryList", url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
"page": this.page, page: this.page,
"limit": this.limit, limit: this.limit,
"getType":"",//获取类型 0 后台赠送 1 主动获取 getType: "", //获取类型 0 后台赠送 1 主动获取
"status": this.status,//使用状态 0 未使用 1 已使用 2 已过期 status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
"userInfo":"",//用户信息 userInfo: "", //用户信息
"userId":this.userInfo.id userId: this.userInfo.id,
}, },
header: { header: {
//默认 无 说明:请求头 //默认 无 说明:请求头
@@ -153,38 +167,39 @@
}, },
}) })
.then(async (res) => { .then(async (res) => {
uni.hideLoading() console.log(res, "1111111111111");
if(res.code != 0) return this.$commonJS.showToast(res.errMsg); uni.hideLoading();
if(res.couponList.records.length > 0){ if (res.code != 0) return this.$commonJS.showToast(res.errMsg);
this.list = this.list.concat(res.couponList.records) if (res.couponList.records.length > 0) {
this.list = this.list.concat(res.couponList.records);
if (res.couponList.pages > this.page) { if (res.couponList.pages > this.page) {
this.listStatus = 0 this.listStatus = 0;
} else { } else {
this.listStatus = 2 this.listStatus = 2;
} }
} else { } else {
this.listStatus = 3 // 暂无数据 this.listStatus = 3; // 暂无数据
} }
this.flag = false this.flag = false;
}).catch(e => {
uni.hideLoading()
console.log(e);
this.flag = false
this.listStatus = 3
console.log(e, '数据报错')
this.$commonJS.showToast(e.errMsg);
}) })
.catch((e) => {
uni.hideLoading();
console.log(e);
this.flag = false;
this.listStatus = 3;
console.log(e, "数据报错");
this.$commonJS.showToast(e.errMsg);
});
}, },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.btnBox { .btnBox {
margin-top: 20rpx; margin-top: 20rpx;
} }
.tanchu { .tanchu {
padding: 0 30rpx 40rpx 30rpx; padding: 0 30rpx 40rpx 30rpx;
position: relative; position: relative;
@@ -255,7 +270,6 @@
margin: 0 0 0 20rpx; margin: 0 0 0 20rpx;
} }
.chooseCheck { .chooseCheck {
position: absolute; position: absolute;
top: 3rpx; top: 3rpx;
@@ -269,29 +283,8 @@
} }
} }
.addressItem.addItem_style { .addressItem.addItem_style {
border-color: #fd6004; 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> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.