Bläddra i källkod

[首页优惠券列表优化][修改]:首页优惠券列表优化

tags/2.2.4
meo 6 år sedan
förälder
incheckning
486f0c49d8
7 ändrade filer med 105 tillägg och 44 borttagningar
  1. +1
    -1
      components/coupons/index.js
  2. +1
    -0
      components/coupons/index.wxml
  3. +29
    -21
      pages/index/coupons/index.js
  4. +7
    -1
      pages/index/coupons/index.wxml
  5. +43
    -14
      pages/index/coupons/index.wxss
  6. +1
    -1
      pages/user/index.wxml
  7. +23
    -6
      pages/user/index.wxss

+ 1
- 1
components/coupons/index.js Visa fil

@@ -8,7 +8,7 @@ Component({
data: { data: {
value: {}, value: {},
type: Object type: Object
}
},
}, },


/** /**


+ 1
- 0
components/coupons/index.wxml Visa fil

@@ -1,3 +1,4 @@

<navigator url="/pages/coupon/detail/index?couponChannelId={{data.id}}&couponId={{data.couponId}}"> <navigator url="/pages/coupon/detail/index?couponChannelId={{data.id}}&couponId={{data.couponId}}">
<!-- 首页优惠券列表页面 --> <!-- 首页优惠券列表页面 -->
<view class="coupons"> <view class="coupons">


+ 29
- 21
pages/index/coupons/index.js Visa fil

@@ -65,7 +65,6 @@ Component({
var that = this; var that = this;
app.couponListCallback = token => { app.couponListCallback = token => {
Http.setToken(token); Http.setToken(token);

// 券list获取 // 券list获取
if (that.data.allow_load) { if (that.data.allow_load) {
that.setData({ that.setData({
@@ -96,35 +95,44 @@ Component({
/** /**
* 加载完成 * 加载完成
*/ */
if (pageNum >= res.data.pages) { if (pageNum >= res.data.pages) {
if(res.data.pages == 0||res.data.pages == 1){
that.setData({
allow_load: true,
loading: false,
content: ""
});
}else{
that.setData({
allow_load: false,
loading: true,
content: "——— 再拉裤子就掉了啦 ———"
});
}
}
console.log(pageNum);
if (pageNum == 1) {
that.setData({ that.setData({
allow_load: false,
loading: true,
content: "——— 再拉裤子就掉了啦 ———"
});
console.log("我已经加载完毕")
list: [],
})
} }
console.log(pageNum);
if(pageNum ==1){
that.setData({
list: []
})
}
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr,res.data.list);
that.setData({
list: tmpArr
})
console.log(tmpArr);
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list);
that.setData({
list: tmpArr
})

console.log(tmpArr);
}); });
setTimeout(function () { setTimeout(function () {
that.setData({ that.setData({
loading: false, loading: false,
}) })
}, 1400); }, 1400);
} else {
}
else {
that.setData({ that.setData({
loading: true, loading: true,
content: "——— 再拉裤子就掉了啦 ———" content: "——— 再拉裤子就掉了啦 ———"
@@ -164,7 +172,7 @@ Component({
app.businessListCallback(app.globalData.token); app.businessListCallback(app.globalData.token);
} }
that.setData({ that.setData({
list:[]
list: []
}) })
that.getList(0, 1); that.getList(0, 1);
} }

+ 7
- 1
pages/index/coupons/index.wxml Visa fil

@@ -2,6 +2,12 @@
<i-tabs current="{{current_scroll}}" scroll bindchange="handleChangeScroll"> <i-tabs current="{{current_scroll}}" scroll bindchange="handleChangeScroll">
<i-tab wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab> <i-tab wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab>
</i-tabs> </i-tabs>
<c-coupons wx:for="{{list}}" paramAtoB="{{loading}}" wx:key="unique" data="{{item}}" />
<c-coupons wx:if="{{list.length!=0}}" wx:for="{{list}}" paramAtoB="{{loading}}" wx:key="unique" data="{{item}}" list="{{list}}" />
<view class='dingdan' wx:if="{{list.length==0}}">
<image src="../../../assets/img/act.png" mode="widthFix"></image>
<text>请您敬请期待</text>
<text>我们正在筹备一大波优惠活动</text>
</view>
<view class="loading" wx:if="{{loading}}"><image src="./../../../assets/img/loading.gif" mode="widthFix"></image>{{content}}</view> <view class="loading" wx:if="{{loading}}"><image src="./../../../assets/img/loading.gif" mode="widthFix"></image>{{content}}</view>
</view> </view>

+ 43
- 14
pages/index/coupons/index.wxss Visa fil

@@ -1,16 +1,45 @@
.index-coupons{
height:820rpx;
.index-coupons {
height: 820rpx;
} }
.loading{
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
color: #999;

.loading {
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
color: #999;
}

.loading image {
width: 40rpx;
height: 40rpx;
vertical-align: middle;
margin-right: 10rpx;
}

.dingdan {
margin-top: 33rpx;
}

.dingdan text:nth-of-type(1) {
display: block;
font-size: 34rpx;
color: #333;
letter-spacing: 0;
text-align: center;
}

.dingdan text:nth-of-type(2) {
display: block;
font-size: 28rpx;
color: #999;
letter-spacing: 0;
text-align: center;
}

.dingdan image {
display: block;
width: 300rpx;
height: 300rpx;
margin: 0 auto 16rpx;
} }
.loading image{
width: 40rpx;
height: 40rpx;
vertical-align: middle;
margin-right: 10rpx;
}

+ 1
- 1
pages/user/index.wxml Visa fil

@@ -17,7 +17,7 @@
<navigator url="/pages/order/index/index?id=all"> <navigator url="/pages/order/index/index?id=all">
<view class="user-btn app-border-bottom"> <view class="user-btn app-border-bottom">
<view>我的订单</view> <view>我的订单</view>
<view>查看全部<text class="iconfont icon-right"></text></view>
<view><text class='look'>查看全部</text><text class="iconfont icon-right"></text></view>
</view> </view>
</navigator> </navigator>
<navigator url="/pages/order/index/index?id=0"> <navigator url="/pages/order/index/index?id=0">


+ 23
- 6
pages/user/index.wxss Visa fil

@@ -34,9 +34,9 @@
.couponnum { .couponnum {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
top: 20rpx;
top: 39rpx;
bottom: 0; bottom: 0;
left: 96rpx;
right: 26px;
width: 16rpx; width: 16rpx;
height: 16rpx; height: 16rpx;
border-radius: 50%; border-radius: 50%;
@@ -127,6 +127,7 @@
.user-btns { .user-btns {
background: #fff; background: #fff;
margin-top: 65rpx; margin-top: 65rpx;
padding: 0 30rpx;
} }


.user-btns .user-btn { .user-btns .user-btn {
@@ -136,12 +137,15 @@
color: #333; color: #333;
letter-spacing: 1.16rpx; letter-spacing: 1.16rpx;
line-height: 88rpx; line-height: 88rpx;
border-bottom: 1rpx solid #eee;
border-bottom: 1rpx solid #efefef;
} }


.user-btns .user-btn > view { .user-btns .user-btn > view {
flex: 1; flex: 1;
padding: 0 10px 0 32rpx;
padding: 0 10px 0 0;
font-size: 30rpx;
color: #333;
letter-spacing: 1.16rpx;
} }


.user-btns .user-btn > view:last-child { .user-btns .user-btn > view:last-child {
@@ -151,9 +155,22 @@
text-align: right; text-align: right;
} }


.user-btns .user-btn > view:last-child .iconfont {
color: #a8a8a8;
.iconfont {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 44rpx;
height: 44rpx;
line-height: 44rpx;
color: #c7c7cc;
font-size: 44rpx; font-size: 44rpx;
margin: auto;
}

.look {
display: inline-block;
padding-right: 25rpx;
} }


.user-out-btn { .user-out-btn {


Laddar…
Avbryt
Spara