优惠券
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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,32 +812,35 @@
|
||||
showCancel:false
|
||||
})
|
||||
}else {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.urlList.goodsList,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: v.id,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.productList.length > 0) {
|
||||
this.goodsList = res.productList;
|
||||
this.selectGoodsData = this.goodsList[0];
|
||||
this.$refs.commonSelectGoods.open();
|
||||
this.show = true;
|
||||
} else {
|
||||
this.$commonJS.showToast("此课程暂无购买方式");
|
||||
}
|
||||
|
||||
this.$forceUpdate();
|
||||
})
|
||||
this.getCourseDescriptionData(v);
|
||||
}
|
||||
},
|
||||
getCourseDescriptionData(v){
|
||||
this.$http
|
||||
.request({
|
||||
url: this.urlList.goodsList,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: v.id,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (res.productList.length > 0) {
|
||||
this.goodsList = res.productList;
|
||||
this.selectGoodsData = this.goodsList[0];
|
||||
this.$refs.commonSelectGoods.open();
|
||||
this.show = true;
|
||||
} else {
|
||||
this.$commonJS.showToast("此课程暂无购买方式");
|
||||
}
|
||||
|
||||
this.$forceUpdate();
|
||||
})
|
||||
},
|
||||
getUserInfo() {
|
||||
this.$http.post("common/user/getUserInfo").then((res) => {
|
||||
console.log("res at line 505:", res);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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>
|
||||
|
||||
@@ -1,22 +1,297 @@
|
||||
<template>
|
||||
<view>
|
||||
优惠券列表
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user