|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="navbar">
|
|
|
- <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
|
|
|
+ <view v-for="(item,index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
|
|
|
</view>
|
|
|
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
|
|
|
<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
|
|
|
@@ -11,7 +11,7 @@
|
|
|
<view class="list-money flex">
|
|
|
<image :src="item._type == 2 ? '/static/img/img03.png' : '/static/img/img02.png'" mode="scaleToFill"></image>
|
|
|
<view class="list-money-text">
|
|
|
- <view class="tit" :class="{ action: item._type == 2 }">
|
|
|
+ <view class="tit" :class="{ action: item._type} == 2">
|
|
|
<text>{{ item.coupon_price }}</text>
|
|
|
</view>
|
|
|
<view class="price">
|
|
|
@@ -25,11 +25,10 @@
|
|
|
</view>
|
|
|
<view class="row_list_right">
|
|
|
<view class="right_top">
|
|
|
- <!-- <text class="right_name">【满减券】</text> -->
|
|
|
- <text class="right_title" :class="{ action: item._type == 2 }">{{ item.coupon_title }}</text>
|
|
|
+ <text class="right_title" :class="{ action: item._type == 2}">{{ item.coupon_title }}</text>
|
|
|
</view>
|
|
|
<view class="right_time">
|
|
|
- <text>{{ item._add_time }}-{{ item._end_time }}</text>
|
|
|
+ <text>{{ item._add_time }}-{{ item.end_time }}</text>
|
|
|
</view>
|
|
|
<view class="right_use action" v-if="item._type == 2">
|
|
|
<text>{{ item._msg }}</text>
|
|
|
@@ -49,7 +48,7 @@
|
|
|
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
|
|
|
import empty from '@/components/empty';
|
|
|
import { getCouponsList } from '@/api/order.js';
|
|
|
-export default {
|
|
|
+export default{
|
|
|
components: {
|
|
|
uniLoadMore,
|
|
|
empty
|
|
|
@@ -57,13 +56,13 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
tabCurrentIndex: 0,
|
|
|
- navList: [
|
|
|
+ navList:[
|
|
|
{
|
|
|
state: 0,
|
|
|
text: '全部',
|
|
|
loadingType: 'more',
|
|
|
orderList: [],
|
|
|
- page: 1, //当前页数
|
|
|
+ page: 1,//当前页数
|
|
|
limit: 10 //每次信息条数
|
|
|
},
|
|
|
{
|
|
|
@@ -79,7 +78,7 @@ export default {
|
|
|
text: '已使用',
|
|
|
loadingType: 'more',
|
|
|
orderList: [],
|
|
|
- page: 1, //当前页数
|
|
|
+ page: 1,//当前页数
|
|
|
limit: 10 //每次信息条数
|
|
|
}
|
|
|
]
|
|
|
@@ -89,15 +88,15 @@ export default {
|
|
|
this.loadData();
|
|
|
},
|
|
|
methods: {
|
|
|
- // 返回首页
|
|
|
- navTo() {
|
|
|
+ //返回首页
|
|
|
+ navTo(){
|
|
|
uni.switchTab({
|
|
|
url: '/pages/index/index'
|
|
|
});
|
|
|
},
|
|
|
//获取订单列表
|
|
|
loadData(source) {
|
|
|
- //这里是将订单挂载到tab列表下
|
|
|
+ //将订单挂载到tab列表下
|
|
|
let index = this.tabCurrentIndex;
|
|
|
let navItem = this.navList[index];
|
|
|
let state = navItem.state;
|
|
|
@@ -105,11 +104,11 @@ export default {
|
|
|
//tab切换只有第一次需要加载数据
|
|
|
return;
|
|
|
}
|
|
|
- if (navItem.loadingType === 'loading') {
|
|
|
+ if (navItem.loadingType === 'loading'){
|
|
|
//防止重复加载
|
|
|
return;
|
|
|
}
|
|
|
- // 修改当前对象状态为加载中
|
|
|
+ //修改当前对象状态为加载中
|
|
|
navItem.loadingType = 'loading';
|
|
|
getCouponsList(
|
|
|
{
|
|
|
@@ -122,17 +121,16 @@ export default {
|
|
|
let da = data.map(e => {
|
|
|
e.coupon_price = +e.coupon_price.replace(',', '');
|
|
|
e.use_min_price = +e.use_min_price.replace(',', '');
|
|
|
- return e;
|
|
|
+ return e
|
|
|
});
|
|
|
navItem.orderList = navItem.orderList.concat(da);
|
|
|
console.log(navItem.orderList);
|
|
|
navItem.page++;
|
|
|
if (navItem.limit == data.length) {
|
|
|
- //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ // 判断是否还有数据,有改为more,没有改为noMore
|
|
|
navItem.loadingType = 'more';
|
|
|
return;
|
|
|
- } else {
|
|
|
- //判断是否还有数据, 有改为 more, 没有改为noMore
|
|
|
+ }else {
|
|
|
navItem.loadingType = 'noMore';
|
|
|
}
|
|
|
uni.hideLoading();
|
|
|
@@ -140,9 +138,8 @@ export default {
|
|
|
})
|
|
|
.catch(e => {
|
|
|
console.log(e);
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
-
|
|
|
//swiper 切换
|
|
|
changeTab(e) {
|
|
|
this.tabCurrentIndex = e.target.current;
|
|
|
@@ -159,6 +156,44 @@ export default {
|
|
|
<style lang="scss">
|
|
|
// 卡卷可用时颜色
|
|
|
$card-color-action: #fc4141;
|
|
|
+page,
|
|
|
+.content {
|
|
|
+ background: $page-color-base;
|
|
|
+ height: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.navbar {
|
|
|
+ display: flex;
|
|
|
+ height: 40px;
|
|
|
+ padding: 0 5px;
|
|
|
+ background: #fff;
|
|
|
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
|
|
|
+ position: relative;
|
|
|
+ z-index: 10;
|
|
|
+ .nav-item {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ height: 100%;
|
|
|
+ font-size: 15px;
|
|
|
+ color: $font-color-dark;
|
|
|
+ position: relative;
|
|
|
+ &.current {
|
|
|
+ color: #bc253a;
|
|
|
+ &:after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ bottom: 0;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ width: 44px;
|
|
|
+ height: 0;
|
|
|
+ border-bottom: 2px solid #bc253a;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
.swiper-box {
|
|
|
height: calc(100% - 40px);
|
|
|
@@ -168,6 +203,7 @@ $card-color-action: #fc4141;
|
|
|
color: #1b1b1b;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
.row {
|
|
|
border-radius: 15rpx;
|
|
|
margin: 0 25rpx;
|
|
|
@@ -230,7 +266,7 @@ $card-color-action: #fc4141;
|
|
|
margin: 15rpx 0;
|
|
|
padding: 10rpx;
|
|
|
width: 140rpx;
|
|
|
- text-align: center;
|
|
|
+ text_align: center;
|
|
|
border-radius: 50rpx;
|
|
|
color: #fff;
|
|
|
font-size: $font-sm - 4rpx;
|
|
|
@@ -257,51 +293,13 @@ $card-color-action: #fc4141;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.iconlocation {
|
|
|
font-size: 36rpx;
|
|
|
color: $font-color-light;
|
|
|
}
|
|
|
}
|
|
|
-page,
|
|
|
-.content {
|
|
|
- background: $page-color-base;
|
|
|
- height: 100%;
|
|
|
-}
|
|
|
-
|
|
|
-.navbar {
|
|
|
- display: flex;
|
|
|
- height: 40px;
|
|
|
- padding: 0 5px;
|
|
|
- background: #fff;
|
|
|
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
|
|
|
- position: relative;
|
|
|
- z-index: 10;
|
|
|
- .nav-item {
|
|
|
- flex: 1;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- height: 100%;
|
|
|
- font-size: 15px;
|
|
|
- color: $font-color-dark;
|
|
|
- position: relative;
|
|
|
- &.current {
|
|
|
- color: #bc253a;
|
|
|
- &:after {
|
|
|
- content: '';
|
|
|
- position: absolute;
|
|
|
- left: 50%;
|
|
|
- bottom: 0;
|
|
|
- transform: translateX(-50%);
|
|
|
- width: 44px;
|
|
|
- height: 0;
|
|
|
- border-bottom: 2px solid #bc253a;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-/* load-more */
|
|
|
+// uni-load-more
|
|
|
.uni-load-more {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|