Authored by 郝肖肖

店铺优惠券滑动效果

... ... @@ -163,8 +163,7 @@ class ListData
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get('http://192.168.102.205:8080/gateway/', $param);
// return Yohobuy::get(API_URL, $param);
return Yohobuy::get(API_URL, $param);
}
}
... ...
var $ = require('jquery'),
IScroll = require('iscroll/iscroll-probe'),
Swiper = require('yoho.iswiper'),
tip = require('../plugin/tip');
var isCouponClick = true,
... ... @@ -7,7 +8,7 @@ var isCouponClick = true,
$(".coupon-content .receive-btn").on('touchstart', function(e) {
var that = this,
code = $(this).closest('.coupon-small').data('id') || '';
code = $(this).closest('.swiper-slide').data('id') || '';
if (isCouponClick === false) {
return false;
... ... @@ -48,12 +49,10 @@ $(".coupon-content .receive-btn").on('touchstart', function(e) {
});
});
$(window).ready(function() {
new IScroll('.coupon-content', {
probeType: 1,
vScroll: false,
hScroll: true,
mouseWheel: false,
click: true
});
});
\ No newline at end of file
$(function() {
new Swiper('.coupon-content', {
slideElement: '.coupon-small',
slidesPerView: 'auto',
watchSlidesVisibility: true
})
})
... ...
... ... @@ -2,11 +2,6 @@
color: #fff;
height: 180px;
overflow: hidden;
overflow-x: scroll;
.coupon-scroll {
height: inherit;
}
.padding-20 {
padding: 20px 0 !important;
... ... @@ -18,6 +13,7 @@
background: resolve('product/coupon-big.png') no-repeat;
background-size: 580px 120px;
margin: 30px;
position: relative;
.coupon-left {
position: absolute;
... ... @@ -47,7 +43,7 @@
.coupon-right {
width: 20px;
font-size: 22px;
right: 58px;
right: 28px;
position: absolute;
height: inherit;
line-height: 25px;
... ...
<div class="coupon-content">
<div class="swiper-wrapper">
{{#if shopCouponsOne}}
{{#each shopCoupons}}
<div class="coupon-big">
<div class="swiper-slide coupon-big" data-id = "{{id}}">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
... ... @@ -24,7 +25,7 @@
{{/each}}
{{^}}
{{#each shopCoupons}}
<div class="coupon-small" data-id = "{{id}}">
<div class="swiper-slide coupon-small" data-id = "{{id}}">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
... ... @@ -46,4 +47,5 @@
</div><!--/coupon-small-->
{{/each}}
{{/if}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -498,13 +498,12 @@ class ListModel
public static function getShopCouponsList($shopId, $uid)
{
$shopCoupons = array();
$result = ListData::shopCouponsList(15, $uid);
$result = ListData::shopCouponsList($shopId, $uid);
if ($result['code'] !== 200) {
return $shopCoupons;
}
for($i = 0; $i < 5; $i++)
foreach ($result['data'] as $key => $value) {
$value['status'] = $value['status'] * 1;
... ... @@ -515,8 +514,7 @@ class ListModel
'name' => $value['coupon_name'],
'pic' => $value['coupon_pic'],
'money' => $value['money'],
'status' => $key === 1,
// 'status' => $value['status'] === 1,
'status' => $value['status'] === 1
);
}
}
... ...