This commit is contained in:
2025-02-27 10:06:26 +08:00
parent 8135b187a9
commit a2bf3311f9
9 changed files with 2110 additions and 1207 deletions

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>

View File

@@ -0,0 +1,290 @@
<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" 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 style="min-height: 40vh; overflow-y: scroll">
<common-coupon :List="list" :source="'mine'"> </common-coupon>
</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, // 请求标记
};
},
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: "加载中",
});
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
.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) => {
console.log(res, "1111111111111");
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 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;
}
}
</style>

View File

@@ -55,9 +55,14 @@
</view>
<view class="chong_list">
<view >
<b>{{ userMes.peanutCoin }}</b>
<b style="color: #11a669!important;">{{ userMes.peanutCoin }}</b>
天医币
</view>
<view @click="onPageJump('/pages/mine/wallet/couponList')">
<b style="color: #fd6004 !important;">{{ userCouponNum }}</b>
优惠券
</view>
<!-- <view v-if="iosHide">
<b>{{ userMes.conponsCount }}</b>
优惠券
@@ -153,6 +158,7 @@ export default {
return {
showEbook: false, // 显示电子书相关
userMes: {},
userCouponNum: 0,
signShow: false,
signContent: "是否要退出登录?",
playData: {},
@@ -178,6 +184,7 @@ export default {
// 隐藏原生的tabbar
uni.hideTabBar();
this.getData();
},
components: {
musicPlay,
@@ -185,6 +192,33 @@ export default {
//方法
methods: {
...mapMutations(["setUserInfo"]),
async getUserCouponList(){
await this.$http
.request({
url: "common/coupon/getCouponHistoryList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"page":1,
"limit":10,
"getType":"",//获取类型 0 后台赠送 1 主动获取
"status":"0",//使用状态 0 未使用 1 已使用 2 已过期
"userInfo":"",//用户信息
"userId":this.userMes.id
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
if(res.code != 0) return;
this.userCouponNum = res.couponList.total
}).catch(e => {
console.log(e);
this.$commonJS.showToast(e.errMsg);
})
},
// 获得操作系统
getOS() {
let oprateOs = "";
@@ -244,6 +278,7 @@ export default {
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getUserCouponList();
if (this.userMes.vip == 1) {
this.userMes.vipValidtime = this.userMes.vipValidtime.substring(
0,

View File

@@ -121,12 +121,18 @@
platform: null,
tab_list: [{
name: '天医币',
}, {
name: '优惠券',
}],
tab_list_ios: [{
name: '优惠券',
}],
},
// {
// name: '优惠券',
// }
],
tab_list_ios: [
// {
// name: '优惠券',
// }
],
couponTabs: [{
name: '未使用'
}, {