Authored by 郝肖肖

店铺优惠券接口数据

... ... @@ -145,4 +145,26 @@ class ListData
}
/**
* 获取单品店店铺券
http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/%E5%95%86%E5%93%81%E5%88%97%E8%A1%A8/brandShops.md#%E8%8E%B7%E5%8F%96%E5%8D%95%E5%93%81%E5%BA%97%E5%BA%97%E9%93%BA%E5%88%B8
* @param int $shopId 店铺id
* @param int $uid 用户uid
* @return array
*/
public static function shopCouponsList($shopId, $uid = '')
{
$param = Yohobuy::param();
$param['method'] = 'shop.coupons.list';
$param['shop_id'] = intval($shopId);
if (!empty($uid)) {
$param['uid'] = intval($uid);
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get('http://192.168.102.205:8080/gateway/', $param);
// return Yohobuy::get(API_URL, $param);
}
}
... ...
... ... @@ -626,12 +626,13 @@
font-size: 22px;
line-height: 35px;
display: inline-block;
width: 210px;
}
.coupon-right {
width: 20px;
font-size: 22px;
right: 55px;
right: 58px;
position: absolute;
height: inherit;
line-height: 25px;
... ... @@ -650,7 +651,7 @@
.coupon-left {
position: absolute;
width: 190px;
width: 165px;
overflow: hidden;
margin: 0 30px;
}
... ...
... ... @@ -55,98 +55,41 @@
<div id="nav-main" class="nav-main">
<!-- 优惠卷 -->
<div class="coupon-content">
<div class="coupon-scroll">
<div class="coupon-small">
{{#if shopCouponsOne}}
{{#each shopCoupons}}
<div class="coupon-big">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
</div>
<div class='coupon-right'>
立即领取
</div>
</div><!--/coupon-small-->
<div class="coupon-small">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
</div>
<div class='coupon-right'>
立即领取
</div>
</div><!--/coupon-small-->
<div class="coupon-small">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
</div>
<div class='coupon-right'>
立即领取
</div>
</div><!--/coupon-small-->
<div class="coupon-small">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
</div>
<div class='coupon-right'>
立即领取
</div>
</div><!--/coupon-small-->
<div class="coupon-small">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
</div>
<div class='coupon-right'>
立即领取
</div>
</div><!--/coupon-small-->
<div class="coupon-small">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">10</span>
</span>
<span class="coupon-left-name">
阿迪达斯品牌<br />
560300
</span>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">{{money}}</span>
</span>
<span class="coupon-left-name">
{{name}}
</span>
</div>
<div class='coupon-right'>
立即领取
{{#if status}} 立即领取 {{^}} 已领取 {{/if}}
</div>
</div><!--/coupon-small-->
</div>
</div><!--/coupon-big-->
{{/each}}
{{^}}
{{#each shopCoupons}}
<div class="coupon-small" data-id = "{{id}}">
<div class='coupon-left'>
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">{{money}}</span>
</span>
<span class="coupon-left-name">
{{name}}
</span>
</div>
<div class='coupon-right'>
{{#if status}} 立即领取 {{^}} 已领取 {{/if}}
</div>
</div><!--/coupon-small-->
{{/each}}
{{/if}}
</div>
<!-- 大导航 -->
... ...
... ... @@ -494,4 +494,32 @@ class ListModel
}
}
}
public static function getShopCouponsList($shopId, $uid)
{
$shopCoupons = array();
$result = ListData::shopCouponsList(15, $uid);
if ($result['code'] !== 200) {
return $shopCoupons;
}
foreach ($result['data'] as $key => $value) {
$value['status'] = $value['status'] * 1;
if ($value['status'] === 1 || $value['status'] === 3) {
$shopCoupons[] = array(
'validity' => $value['couponValidity'],
'id' => $value['coupon_id'],
'name' => $value['coupon_name'],
'pic' => $value['coupon_pic'],
'money' => $value['money'],
// 'status' => $key === 1,
'status' => $value['status'] === 1,
);
}
}
return $shopCoupons;
}
}
... ...
... ... @@ -506,6 +506,9 @@ class IndexController extends AbstractAction
));
$data['goods'] = isset($goods['new']) ? $goods['new'] : array();
$data['shopCoupons'] = ListModel::getShopCouponsList($shopId, $uid);
$data['shopCouponsOne'] = count($data['shopCoupons']) === 1;
$this->_view->display('shop', array(
'shopIndex' => $data,
'shopPage' => array(
... ...