|
@@ -1,54 +1,44 @@
|
|
|
<template>
|
|
|
<view >
|
|
|
<u-navbar title="我的优惠券"><view class="exchange" @click="toConversion">兑换</view></u-navbar>
|
|
|
- <view class="list-item">
|
|
|
- <view class="voucher">优惠券</view>
|
|
|
+
|
|
|
+ <u-alert-tips size="12" :show-icon="true" type="warning"
|
|
|
+ description="同类型优惠券只显示一张"></u-alert-tips>
|
|
|
+
|
|
|
+
|
|
|
+ <view class="list-item" v-for="(item,index) in myCouponList" :key="item.id">
|
|
|
+
|
|
|
+ <view class="voucher" v-if="item.classify == '1'">优惠券</view>
|
|
|
+ <view class="voucher" v-if="item.classify == '2'">折扣卷</view>
|
|
|
<view class="checked">
|
|
|
<img src="../../../static/img/选中.png" alt="">
|
|
|
</view>
|
|
|
<view class="item-left">
|
|
|
<view class="title">
|
|
|
- 新客首充专享
|
|
|
+ {{item.couponName}}
|
|
|
</view>
|
|
|
<view class="useful-life">
|
|
|
- 有效期至2022.05.22
|
|
|
+ 有效期至{{item.endDate&&item.endDate.slice(0,10)}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-right">
|
|
|
- <view class="price">
|
|
|
- <text style="font-size: 14px;">¥</text> 15
|
|
|
- </view>
|
|
|
+
|
|
|
+ <view class="price" v-if="item.classify == '1'">¥{{item.value}}</view>
|
|
|
+ <view class="price" v-if="item.classify == '2'">{{item.value*10}}折</view>
|
|
|
+
|
|
|
<view class="contidion">
|
|
|
- 满100可用
|
|
|
+ {{item.threshold == 0 ? '无门槛' : '满'+item.threshold+'可用'}}
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
+ <u-divider v-if="myCouponList.length > 0" style="padding-bottom: 80px;margin-top: 10px;">已经到底了</u-divider>
|
|
|
|
|
|
- <view class="list-item">
|
|
|
- <view class="voucher">优惠券</view>
|
|
|
- <view class="checked">
|
|
|
- <img src="../../../static/img/选中.png" alt="">
|
|
|
- </view>
|
|
|
- <view class="item-left">
|
|
|
- <view class="title">
|
|
|
- 逢周五充电服务费折扣券
|
|
|
- </view>
|
|
|
- <view class="useful-life">
|
|
|
- 每周五可使用
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="item-right">
|
|
|
- <view class="price">
|
|
|
- 5<text style="font-size: 14px;">折</text>
|
|
|
- </view>
|
|
|
- <view class="contidion">
|
|
|
- 满66可用
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
+ <view class="carNone" v-if="myCouponList.length == 0">
|
|
|
+ <img src="static/img/暂无数据-缺省页.png" alt="">
|
|
|
+ <p>暂无优惠券</p>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<view class="bottom">
|
|
|
<view class="text">
|
|
|
已选1张,预计可减
|
|
@@ -67,9 +57,85 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ //import * as userApi from '@/apis/user.js'
|
|
|
+ import * as userApi from '@/apis/chargeProcess.js'
|
|
|
+
|
|
|
+ export default{
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ amount:0,
|
|
|
+ uuid:0,
|
|
|
+ myCouponList: [],
|
|
|
+ pageIndex: 1,
|
|
|
+ recordsTotal: 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ if (this.myCouponList.length < this.recordsTotal) {
|
|
|
+ this.myLoadmore();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(op) {
|
|
|
+ if(op.uuid){
|
|
|
+ this.amount=op.amount
|
|
|
+ this.uuid=op.uuid
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ this.getCouponList();
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ toConversion() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/user/coupon/conversion'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getCouponList(bl) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ mask: true,
|
|
|
+ })
|
|
|
+ if (bl) {
|
|
|
+ this.myCouponList = [];
|
|
|
+ this.pageIndex = 1;
|
|
|
+ }
|
|
|
+ userApi.useCoupon({
|
|
|
+ amount:this.amount
|
|
|
+ }).then((res) => {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ this.myCouponList =res.data.userCouponList
|
|
|
+ this.recordsTotal = res.data.recordsTotal;
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title: error,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ myLoadmore() {
|
|
|
+ this.pageIndex += 1;
|
|
|
+ this.getCouponList()
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+ .carNone{
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ img{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ p{
|
|
|
+ margin-top: -60px;
|
|
|
+ }
|
|
|
+ }
|
|
|
.exchange{
|
|
|
margin-left: 85.3%;
|
|
|
color: rgba(119, 119, 119, 100);
|
|
@@ -118,7 +184,7 @@
|
|
|
.useful-life{
|
|
|
line-height: 22px;
|
|
|
color: rgba(51, 51, 51, 100);
|
|
|
- font-size: 16px;
|
|
|
+ font-size: 14px;
|
|
|
margin-top: 1px;
|
|
|
}
|
|
|
}
|