|
@@ -1,11 +1,21 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
+ <!-- 顶部导航栏 -->
|
|
|
+ <view class="top-tab">
|
|
|
+ <u-tabs class="tab" :list="list" @click="handlerChangeTab1"
|
|
|
+ :activeStyle="{
|
|
|
+ color: '#fff',
|
|
|
+ fontWeight: 'bold',
|
|
|
+ transform: 'scale(1.05)'
|
|
|
+ }"
|
|
|
+ :inactiveStyle="{
|
|
|
+ color: '#fff',
|
|
|
+ transform: 'scale(1)'
|
|
|
+ }"
|
|
|
+ itemStyle="height: 34px; width:20%;" lineColor="#D89A4C"></u-tabs>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 优惠券的可用和失效 -->
|
|
|
- <!-- <view class="top-tab">
|
|
|
- <u-tabs class="tab" :list="list" @click="click"></u-tabs>
|
|
|
- </view> -->
|
|
|
-
|
|
|
-
|
|
|
<view class="use">
|
|
|
<u-tabs :list="list2" lineWidth="100" lineColor="#347caf" :scrollable="false" :activeStyle="{
|
|
|
color: '#347caf',
|
|
@@ -20,19 +30,21 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 优惠券可用 -->
|
|
|
- <view class="couponUse" v-show="lable_type == 0">
|
|
|
+ <view class="couponUse" v-show="lable_type == 0" v-for="(item,index) of init_list">
|
|
|
<view class="useLeft">
|
|
|
- <view>满500减100元</view>
|
|
|
- <text>2320-07-02 ~ 202-08-03</text>
|
|
|
+ <view>{{ item.name }}</view>
|
|
|
+ <text>2320-07-02 ~ {{ item.expiration }}</text>
|
|
|
</view>
|
|
|
<view class="useRight">
|
|
|
- <view class="text">2<text>折</text></view>
|
|
|
+ <view class="text">{{ item.discount * 10 }}<text>折</text></view>
|
|
|
<view>折扣</view>
|
|
|
<view class="gouUse">去使用</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <u-empty v-if="total == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
|
|
|
<!-- 优惠券失效 -->
|
|
|
- <view class="couponDisUse couponUse" v-show="lable_type == 1" v-for="item of 3">
|
|
|
+ <!-- <view class="couponDisUse couponUse" v-show="lable_type == 1" v-for="item of 3">
|
|
|
<view class="useLeft">
|
|
|
<view>满500减100元</view>
|
|
|
<text>2320-07-02 ~ 202-08-03</text>
|
|
@@ -42,50 +54,82 @@
|
|
|
<view>折扣</view>
|
|
|
<view class="gouUse">去使用</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import { maintainCouponPaging } from "@/api/mine.js"
|
|
|
+ import { mapState } from "vuex"
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
list: [{
|
|
|
id: 0,
|
|
|
name: '通用',
|
|
|
+ type:''
|
|
|
},
|
|
|
{
|
|
|
id: 1,
|
|
|
name: '满减',
|
|
|
+ type:'REDUCE'
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
name: '折扣',
|
|
|
+ type:'DISCOUNT'
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
name: '赠送',
|
|
|
+ type:'GIVE'
|
|
|
},
|
|
|
],
|
|
|
list2: [{
|
|
|
name: '可用',
|
|
|
+ type:'ONLINE'
|
|
|
},
|
|
|
{
|
|
|
name: '失效',
|
|
|
+ type:'OFFLINE'
|
|
|
},
|
|
|
],
|
|
|
lable_type: 0, // 是否可用
|
|
|
+ queryParams:{
|
|
|
+ paging:"1,10",//分页信息 取值范围: 页码,分页大小
|
|
|
+ keyword:'',//关键字
|
|
|
+ couponType:'',//优惠券类型 允许值: GIVE(赠送), REDUCE(满减), DISCOUNT(折扣)
|
|
|
+ couponStatus:'ONLINE',// 优惠券状态 允许值: ONLINE(已上线), OFFLINE(已下线)
|
|
|
+ couponClaimType:'',//优惠券领取方式 允许值: FREE(免费领取), ACTIVITY(活动领取)
|
|
|
+ merchantId:'',//商家ID
|
|
|
+ },
|
|
|
+
|
|
|
+ init_list:[],//初始化列表
|
|
|
+ total:0
|
|
|
};
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.handlerInitCouponList()
|
|
|
+ // console.log('merchantId',this.$store.state.merchantId);
|
|
|
+ },
|
|
|
methods: {
|
|
|
- sectionChange() {},
|
|
|
- click() {
|
|
|
-
|
|
|
+ // 初始化优惠卷列表
|
|
|
+ handlerInitCouponList(){
|
|
|
+ maintainCouponPaging(this.queryParams).then(res=>{
|
|
|
+ this.init_list = res.data.records
|
|
|
+ this.total = res.data.total
|
|
|
+ })
|
|
|
},
|
|
|
- // 点击选择tab栏
|
|
|
+ // 选择顶部导航栏
|
|
|
+ handlerChangeTab1(e){
|
|
|
+ this.queryParams.couponType = e.type
|
|
|
+ this.handlerInitCouponList()
|
|
|
+ },
|
|
|
+ // 点击选择下层tab栏 选择是否可用
|
|
|
handlerSelectTab(e){
|
|
|
- console.log('e',e);
|
|
|
this.lable_type = e.index
|
|
|
+ this.queryParams.couponStatus = e.type
|
|
|
+ this.handlerInitCouponList()
|
|
|
}
|
|
|
},
|
|
|
};
|
|
@@ -97,10 +141,9 @@
|
|
|
background-color: #efefef;
|
|
|
|
|
|
.top-tab {
|
|
|
- .tab {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- }
|
|
|
+ width: 100%;
|
|
|
+ background-color: #347CAF;
|
|
|
+ padding: 20rpx 0;
|
|
|
}
|
|
|
|
|
|
.use {
|
|
@@ -170,4 +213,5 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
</style>
|