提交优惠券

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

@@ -1,267 +1,388 @@
<template> <template>
<view> <view>
<!-- 优惠券弹出 --> <!-- 优惠券弹出 -->
<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 ${
<text></text> youhuiIndex === index ? ' youItem_style' : ''
<b style="font-size: 45rpx;">{{item.couponEntity.couponAmount}}</b> } ${item.canUse === 0 ? 'disableSelect' : ''}`"
<text @click="choseYouhui(index)"
style="display: block;color: #666;font-size: 25rpx;margin-top: 10rpx;">{{item.couponEntity.useLevel}}元可用</text> ><text
</view> class="border_radius_10"
<view style="width: 68%;padding-left: 5%;"> style="
<view> position: absolute;
<text style="display: inline-block; margin-right: 6rpx;">{{item.couponEntity.couponName}}</text> top: 10rpx;
<text class="border_radius_10" style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text> right: 10rpx;
</view> font-size: 25rpx;
<text background-color: #ffe3e9;
style="display: block;font-size: 20rpx;color: #999;margin-top: 10rpx;">到期时间{{item.effectType == 0 ? '永久有效' : item.endTime}}</text> color: #c81346;
<template v-if="item.canUse == 0" > padding: 6rpx;
<view class="" style="font-size:20rpx; display: inline-block; padding:0 10rpx ; background-color: #d9d9d9; border-radius: 10rpx;"> "
<text >{{ item.couponEntity.couponRange | couponType }}</text
style="color: #999; " >
>不可用</text> <view
<text style="width: 25%; color: #ff0043; text-align: center"
style="color: #999; " class="couponPrice"
>{{item.canUseReason}}</text> >
</view> <text></text>
</template> <b style="font-size: 45rpx">{{
<text v-else item.couponEntity.couponAmount
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明{{item.couponEntity.remark}}</text> }}</b>
<text
</view> class="useLevel"
<view style="width: 7%;"> style="
<!-- <view class="" style="background-color: #d9d9d9; border-radius: 10rpx; 0 0 10rpx; text-align: center;" v-if="item.canUse == 0"> 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 <text
style="color: #999; " style="color: #999; "
>不可用</text> >不可用</text>
</view> --> </view> -->
<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;
<u-icon name="checkmark-circle-fill" color="#fd6004" size="20" v-if="youhuiIndex === index"> height: 35rpx;
</u-icon> display: inline-block;
</template> border-radius: 30rpx;
</view> "
<br clear="both"> v-if="youhuiIndex !== index"
</view> ></text>
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view> <u-icon
<view class="btnBox flex_box flex_between"> name="checkmark-circle-fill"
<view class="" style="width: 48%;"> color="#fd6004"
<button type="default" @click="confirmCoupon('none')">不使用优惠券</button> size="20"
</view> v-if="youhuiIndex === index"
<view class="" style="width: 48%;"> >
<button type="primary" @click="confirmCoupon()">选好了</button> </u-icon>
</view> </template>
</view> </view>
</template> <br clear="both" />
<view class="" v-else> </view>
<u-divider text="暂无可用优惠券哦"></u-divider> <u-collapse
</view> v-if="source != 'goodsDetail' && item.couponEntity.remark"
</view> style="
</u-popup> margin-top: 0rpx;
</view> 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> </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:{ }
couponType(type){ },
// 0无限制 1课程卷 2课程品类卷 filters: {
var str = '' couponType(type) {
switch (type){ // 0无限制 1课程卷 2课程品类卷
case 0: var str = "";
str = '全场通用' switch (type) {
break; case 0:
case 1: str = "全场通用";
str = '指定课程可用' break;
break; case 1:
case 2: str = "指定课程可用";
str = '指定课程品类可用' break;
break; case 2:
} str = "指定课程品类可用";
return str break;
} }
}, 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;
// overflow-y: scroll; // overflow-y: scroll;
.dp_title { .dp_title {
font-size: 32rpx; font-size: 32rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
color: #555; color: #555;
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
} }
.dp_add { .dp_add {
position: absolute; position: absolute;
top: 40rpx; top: 40rpx;
right: 30rpx; right: 30rpx;
font-size: 22rpx; font-size: 22rpx;
background-color: #fd6004; background-color: #fd6004;
color: #fff; color: #fff;
border-radius: 10rpx; border-radius: 10rpx;
padding: 5rpx 10rpx; padding: 5rpx 10rpx;
.u-icon { .u-icon {
display: inline-block; display: inline-block;
margin-right: 5rpx; margin-right: 5rpx;
} }
} }
.addressItem { .addressItem {
border: 2px dashed #d9d9d9; border: 2px dashed #d9d9d9;
border-radius: 10rpx; border-radius: 10rpx;
width: 100%; width: 100%;
display: flex; display: flex;
padding: 20rpx 10rpx; padding: 20rpx 10rpx;
margin: 25rpx 0 0 0; margin: 25rpx 0 0 0;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
.addrContent { .addrContent {
margin-left: 40rpx; margin-left: 40rpx;
flex: 1; flex: 1;
.addrContentTop { .addrContentTop {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
margin: 0 0 15rpx 0; margin: 0 0 15rpx 0;
position: relative; position: relative;
.userName { .userName {
font-size: 35rpx; font-size: 35rpx;
font-weight: bold; font-weight: bold;
margin-right: 30rpx; margin-right: 30rpx;
} }
.userTel { .userTel {
font-size: 25rpx; font-size: 25rpx;
color: #888; color: #888;
} }
.userMoren { .userMoren {
border: 1px solid #fd6004; border: 1px solid #fd6004;
color: #fd6004; color: #fd6004;
padding: 3rpx 10rpx; padding: 3rpx 10rpx;
font-size: 22rpx; font-size: 22rpx;
border-radius: 10rpx; border-radius: 10rpx;
margin: 0 0 0 20rpx; margin: 0 0 0 20rpx;
} }
.chooseCheck {
position: absolute;
top: 3rpx;
right: 6rpx;
}
}
.chooseCheck { .addrContentBottom {
position: absolute; font-size: 32rpx;
top: 3rpx; }
right: 6rpx; }
} }
}
.addrContentBottom { .addressItem.addItem_style {
font-size: 32rpx; border-color: #fd6004;
} }
}
}
.youhuiItem {
position: relative;
background: linear-gradient(to top right, #fff, #fef2f4);
.addressItem.addItem_style { border: 1px solid #d9d9d9;
border-color: #fd6004; border-radius: 10rpx;
} width: 100%;
.youhuiItem { padding: 50rpx 20rpx 20rpx;
border: 1px solid #d9d9d9; margin: 25rpx 0 0 0;
border-radius: 10rpx; align-items: center;
width: 100%; background-color: #fff;
display: flex; font-size: 30rpx;
padding: 20rpx 10rpx; }
margin: 25rpx 0 0 0;
align-items: center;
background-color: #fff;
font-size: 30rpx;
}
.youhuiItem>view { .disableSelect {
float: left; background: linear-gradient(to top right, #fafafa, #fafafa) !important;
}
.youhuiItem.youItem_style { color: #979797 !important;
border-color: #fd6004; .couponPrice {
} color: #979797 !important;
} }
</style> .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>

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,297 +1,290 @@
<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']"
</view> @click="tabClick"
<!-- --> :current="curTagIndex"
<view class="tanchu"> :activeStyle="activeStyle"
<view class="listBox" v-if="list.length > 0"> :scrollable="false"
<view style="max-height: 40vh;overflow-y: scroll;" :class="'youhuiItem'" :list="tabList"
v-for="(item,index) in list" :key="index" > itemStyle="padding-left:10rpx; background-color:#fff; padding-right: 10rpx; height: 50px; font-size:26rpx"
<view style="width: 25%;color:#fd6004;text-align: center;"> ></u-tabs>
<text></text> </view>
<b style="font-size: 45rpx;">{{item.couponEntity.couponAmount}}</b> <!-- -->
<text <view class="tanchu" style="position: relative">
style="display: block;color: #666;font-size: 25rpx;margin-top: 10rpx;">{{item.couponEntity.useLevel}}元可用</text>
</view> <view
<view style="width: 68%;padding-left: 5%;"> v-if="status!=0"
<view> style="
<text style="display: inline-block; margin-right: 6rpx;">{{item.couponEntity.couponName}}</text> min-height: 80vh;
<text class="border_radius_10" style="font-size: 24rpx; background-color: #fad4bd; color: #666;">{{item.couponEntity.couponRange | couponType}}</text> z-index: 100;
</view> background-color: #f0f0f0;
<text opacity: 0.55;
style="display: block;font-size: 20rpx;color: #999;margin-top: 10rpx;">到期时间{{item.effectType == 0 ? '永久有效' : item.endTime}}</text> position: absolute;
<text top: 0;
style="display: block;font-size: 20rpx;color: #999;margin-top: 4rpx;">说明{{item.couponEntity.remark}}</text> left: 0;
right: 0;
</view> bottom: 0;
</view> "
<!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> --> ></view>
</view> <view class="listBox" v-if="list.length > 0">
<view class="" v-else> <view style="min-height: 40vh; overflow-y: scroll">
<u-divider v-show="listStatus == 2" text="已加载全部"></u-divider> <common-coupon :List="list" :source="'mine'"> </common-coupon>
<u-divider v-show="listStatus == 3" text="暂无数据"></u-divider>
<u-divider v-show="listStatus == 1" text="加载中..."></u-divider> </view>
</view>
</view> <!-- <view style="font-size: 20rpx;color: #aaa;margin-top: 30rpx;">* 每笔订单只能使用一张优惠价</view> -->
</view> </view>
<z-navigation></z-navigation> <view class="" v-else>
</view> <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> </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"; data() {
export default { return {
data() { list: [], // 优惠券列表
return { listStatus: 88,
list:[], // 优惠券列表 curTagIndex: 0, // 当前索引
listStatus:88, tabList: [
curTagIndex:0, // 当前索引 {
tabList: [{ name: "未使用",
name: '未使用', id: "0",
id: '0' },
}, {
{ name: "已使用",
name: '已使用', id: "1",
id: '1' },
}, {
{ name: "已过期",
name: '已过期', id: "2",
id: '2' },
} ],
activeStyle: {
], background: "#fff",
activeStyle:{ color: "#666",
background:'#fff', padding: "10rpx",
color:'#666', borderRadius: "10rpx",
padding:"10rpx", },
borderRadius:"10rpx" page: 0,
}, limit: 15,
page:0, status: 0,
limit:15, flag: false, // 请求标记
status:0, };
flag:false, // 请求标记 },
} onLoad() {
}, this.page = 1;
onLoad() { this.getUserCouponList();
this.page = 1 },
this.getUserCouponList() async onReachBottom() {
}, console.log("触底", this.listStatus, this.flag);
async onReachBottom() {
console.log('触底',this.listStatus,this.flag); if (this.listStatus != 1 && this.listStatus != 2) {
if (!this.flag) {
if(this.listStatus != 1 && this.listStatus != 2){ this.page++;
if(!this.flag){ await this.getUserCouponList();
this.page++ }
await this.getUserCouponList() }
} },
} filters: {
couponType(type) {
}, // 0无限制 1课程卷 2课程品类卷
filters:{ var str = "";
couponType(type){ switch (type) {
// 0无限制 1课程卷 2课程品类卷 case 0:
var str = '' str = "全场通用";
switch (type){ break;
case 0: case 1:
str = '全场通用' str = "指定课程可用";
break; break;
case 1: case 2:
str = '指定课程可用' str = "指定课程品类可用";
break; break;
case 2: }
str = '指定课程品类可用' return str;
break; },
} },
return str computed: {
} ...mapState(["userInfo"]),
}, },
computed: { methods: {
...mapState(["userInfo"]), async tabClick(e) {
}, console.log("e", e);
methods: { this.status = e.id;
async tabClick(e) { // this.curTagIndex = e.index
console.log('e', e); this.page = 0;
this.status = e.id this.page += 1;
// this.curTagIndex = e.index this.list = [];
this.page = 0 await this.getUserCouponList();
this.page += 1 },
this.list = [] async getUserCouponList() {
await this.getUserCouponList() console.log("进入函数了妈");
this.listStatus = 1;
}, this.flag = true;
async getUserCouponList(){ uni.showLoading({
console.log('进入函数了妈'); title: "加载中",
this.listStatus = 1 });
this.flag = true console.log(
uni.showLoading({ {
title:'加载中' page: this.page,
}) limit: this.limit,
await this.$http getType: "", //获取类型 0 后台赠送 1 主动获取
.request({ status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
url: "common/coupon/getCouponHistoryList", userInfo: "", //用户信息
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 userId: this.userInfo.id,
data: { },
"page": this.page, 111111111111111111111111111
"limit": this.limit, );
"getType":"",//获取类型 0 后台赠送 1 主动获取 await this.$http
"status": this.status,//使用状态 0 未使用 1 已使用 2 已过期 .request({
"userInfo":"",//用户信息 url: "common/coupon/getCouponHistoryList",
"userId":this.userInfo.id method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
}, data: {
header: { page: this.page,
//默认 无 说明:请求头 limit: this.limit,
"Content-Type": "application/json", getType: "", //获取类型 0 后台赠送 1 主动获取
}, status: this.status, //使用状态 0 未使用 1 已使用 2 已过期
}) userInfo: "", //用户信息
.then(async (res) => { userId: this.userInfo.id,
uni.hideLoading() },
if(res.code != 0) return this.$commonJS.showToast(res.errMsg); header: {
if(res.couponList.records.length > 0){ //默认 无 说明:请求头
this.list = this.list.concat(res.couponList.records) "Content-Type": "application/json",
if (res.couponList.pages > this.page) { },
this.listStatus = 0 })
} else { .then(async (res) => {
this.listStatus = 2 console.log(res, "1111111111111");
} uni.hideLoading();
} else { if (res.code != 0) return this.$commonJS.showToast(res.errMsg);
this.listStatus = 3 // 暂无数据 if (res.couponList.records.length > 0) {
} this.list = this.list.concat(res.couponList.records);
this.flag = false if (res.couponList.pages > this.page) {
this.listStatus = 0;
} else {
}).catch(e => { this.listStatus = 2;
uni.hideLoading() }
console.log(e); } else {
this.flag = false this.listStatus = 3; // 暂无数据
this.listStatus = 3 }
console.log(e, '数据报错') this.flag = false;
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;
// max-height: 60vh; // max-height: 60vh;
// overflow-y: scroll; // overflow-y: scroll;
.dp_title { .dp_title {
font-size: 32rpx; font-size: 32rpx;
margin-bottom: 50rpx; margin-bottom: 50rpx;
color: #555; color: #555;
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
} }
.dp_add { .dp_add {
position: absolute; position: absolute;
top: 40rpx; top: 40rpx;
right: 30rpx; right: 30rpx;
font-size: 22rpx; font-size: 22rpx;
background-color: #fd6004; background-color: #fd6004;
color: #fff; color: #fff;
border-radius: 10rpx; border-radius: 10rpx;
padding: 5rpx 10rpx; padding: 5rpx 10rpx;
.u-icon { .u-icon {
display: inline-block; display: inline-block;
margin-right: 5rpx; margin-right: 5rpx;
} }
} }
.addressItem { .addressItem {
border: 2px dashed #d9d9d9; border: 2px dashed #d9d9d9;
border-radius: 10rpx; border-radius: 10rpx;
width: 100%; width: 100%;
display: flex; display: flex;
padding: 20rpx 10rpx; padding: 20rpx 10rpx;
margin: 25rpx 0 0 0; margin: 25rpx 0 0 0;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
.addrContent { .addrContent {
margin-left: 40rpx; margin-left: 40rpx;
flex: 1; flex: 1;
.addrContentTop { .addrContentTop {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
margin: 0 0 15rpx 0; margin: 0 0 15rpx 0;
position: relative; position: relative;
.userName { .userName {
font-size: 35rpx; font-size: 35rpx;
font-weight: bold; font-weight: bold;
margin-right: 30rpx; margin-right: 30rpx;
} }
.userTel { .userTel {
font-size: 25rpx; font-size: 25rpx;
color: #888; color: #888;
} }
.userMoren { .userMoren {
border: 1px solid #fd6004; border: 1px solid #fd6004;
color: #fd6004; color: #fd6004;
padding: 3rpx 10rpx; padding: 3rpx 10rpx;
font-size: 22rpx; font-size: 22rpx;
border-radius: 10rpx; border-radius: 10rpx;
margin: 0 0 0 20rpx; margin: 0 0 0 20rpx;
} }
.chooseCheck {
position: absolute;
top: 3rpx;
right: 6rpx;
}
}
.chooseCheck { .addrContentBottom {
position: absolute; font-size: 32rpx;
top: 3rpx; }
right: 6rpx; }
} }
}
.addrContentBottom { .addressItem.addItem_style {
font-size: 32rpx; border-color: #fd6004;
} }
} }
}
.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> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.