Showing
7 changed files
with
79 additions
and
51 deletions
@@ -638,3 +638,6 @@ $listNav.on('touchstart', 'li', function() { | @@ -638,3 +638,6 @@ $listNav.on('touchstart', 'li', function() { | ||
638 | }).on('touchend touchcancel', 'li', function() { | 638 | }).on('touchend touchcancel', 'li', function() { |
639 | $listNav.find('li').removeClass('bytouch'); | 639 | $listNav.find('li').removeClass('bytouch'); |
640 | }); | 640 | }); |
641 | + | ||
642 | +//店铺优惠券 | ||
643 | +require('./shop_coupon'); |
@@ -54,55 +54,9 @@ | @@ -54,55 +54,9 @@ | ||
54 | <div id="home-page" class="main"> | 54 | <div id="home-page" class="main"> |
55 | <div id="nav-main" class="nav-main"> | 55 | <div id="nav-main" class="nav-main"> |
56 | <!-- 优惠卷 --> | 56 | <!-- 优惠卷 --> |
57 | - <div class="coupon-content"> | ||
58 | - {{#if shopCouponsOne}} | ||
59 | - {{#each shopCoupons}} | ||
60 | - <div class="coupon-big"> | ||
61 | - <div class='coupon-left'> | ||
62 | - <span class="coupon-left-price"> | ||
63 | - <span class="coupon-sign">¥</span> | ||
64 | - <span class="coupon-price">{{money}}</span> | ||
65 | - </span> | ||
66 | - <span class="coupon-left-name"> | ||
67 | - {{name}} | ||
68 | - </span> | ||
69 | - </div> | ||
70 | - {{#if status}} | ||
71 | - <div class='coupon-right receive-btn'> | ||
72 | - 立即领取 | ||
73 | - </div> | ||
74 | - {{^}} | ||
75 | - <div class='coupon-right padding-20'> | ||
76 | - 已领取 | ||
77 | - </div> | ||
78 | - {{/if}} | ||
79 | - </div><!--/coupon-big--> | ||
80 | - {{/each}} | ||
81 | - {{^}} | ||
82 | - {{#each shopCoupons}} | ||
83 | - <div class="coupon-small" data-id = "{{id}}"> | ||
84 | - <div class='coupon-left'> | ||
85 | - <span class="coupon-left-price"> | ||
86 | - <span class="coupon-sign">¥</span> | ||
87 | - <span class="coupon-price">{{money}}</span> | ||
88 | - </span> | ||
89 | - <span class="coupon-left-name"> | ||
90 | - {{name}} | ||
91 | - </span> | ||
92 | - </div> | ||
93 | - {{#if status}} | ||
94 | - <div class='coupon-right receive-btn'> | ||
95 | - 立即领取 | ||
96 | - </div> | ||
97 | - {{^}} | ||
98 | - <div class='coupon-right padding-20'> | ||
99 | - 已领取 | ||
100 | - </div> | ||
101 | - {{/if}} | ||
102 | - </div><!--/coupon-small--> | ||
103 | - {{/each}} | ||
104 | - {{/if}} | ||
105 | - </div> | 57 | + {{#if shopCoupons}} |
58 | + {{> product/shop-coupon}} | ||
59 | + {{/if}} | ||
106 | 60 | ||
107 | <!-- 大导航 --> | 61 | <!-- 大导航 --> |
108 | {{#if brandList}} | 62 | {{#if brandList}} |
@@ -84,6 +84,11 @@ | @@ -84,6 +84,11 @@ | ||
84 | </div> | 84 | </div> |
85 | </div> | 85 | </div> |
86 | <input type="hidden" name="app_version" value="{{appVersion}}"> | 86 | <input type="hidden" name="app_version" value="{{appVersion}}"> |
87 | + <!-- 店铺优惠卷 --> | ||
88 | + {{#if shopCoupons}} | ||
89 | + {{> product/shop-coupon}} | ||
90 | + {{/if}} | ||
91 | + | ||
87 | {{/ baseShopHome}} | 92 | {{/ baseShopHome}} |
88 | <!-- /基础店铺页面 --> | 93 | <!-- /基础店铺页面 --> |
89 | <ul id="list-nav" class="list-nav clearfix"> | 94 | <ul id="list-nav" class="list-nav clearfix"> |
1 | +<div class="coupon-content"> | ||
2 | + {{#if shopCouponsOne}} | ||
3 | + {{#each shopCoupons}} | ||
4 | + <div class="coupon-big"> | ||
5 | + <div class='coupon-left'> | ||
6 | + <span class="coupon-left-price"> | ||
7 | + <span class="coupon-sign">¥</span> | ||
8 | + <span class="coupon-price">{{money}}</span> | ||
9 | + </span> | ||
10 | + <span class="coupon-left-name"> | ||
11 | + {{name}} | ||
12 | + </span> | ||
13 | + </div> | ||
14 | + {{#if status}} | ||
15 | + <div class='coupon-right receive-btn'> | ||
16 | + 立即领取 | ||
17 | + </div> | ||
18 | + {{^}} | ||
19 | + <div class='coupon-right padding-20'> | ||
20 | + 已领取 | ||
21 | + </div> | ||
22 | + {{/if}} | ||
23 | + </div><!--/coupon-big--> | ||
24 | + {{/each}} | ||
25 | + {{^}} | ||
26 | + {{#each shopCoupons}} | ||
27 | + <div class="coupon-small" data-id = "{{id}}"> | ||
28 | + <div class='coupon-left'> | ||
29 | + <span class="coupon-left-price"> | ||
30 | + <span class="coupon-sign">¥</span> | ||
31 | + <span class="coupon-price">{{money}}</span> | ||
32 | + </span> | ||
33 | + <span class="coupon-left-name"> | ||
34 | + {{name}} | ||
35 | + </span> | ||
36 | + </div> | ||
37 | + {{#if status}} | ||
38 | + <div class='coupon-right receive-btn'> | ||
39 | + 立即领取 | ||
40 | + </div> | ||
41 | + {{^}} | ||
42 | + <div class='coupon-right padding-20'> | ||
43 | + 已领取 | ||
44 | + </div> | ||
45 | + {{/if}} | ||
46 | + </div><!--/coupon-small--> | ||
47 | + {{/each}} | ||
48 | + {{/if}} | ||
49 | +</div> |
@@ -514,7 +514,8 @@ class ListModel | @@ -514,7 +514,8 @@ class ListModel | ||
514 | 'name' => $value['coupon_name'], | 514 | 'name' => $value['coupon_name'], |
515 | 'pic' => $value['coupon_pic'], | 515 | 'pic' => $value['coupon_pic'], |
516 | 'money' => $value['money'], | 516 | 'money' => $value['money'], |
517 | - 'status' => $value['status'] === 1, | 517 | + 'status' => $key === 1, |
518 | + // 'status' => $value['status'] === 1, | ||
518 | ); | 519 | ); |
519 | } | 520 | } |
520 | } | 521 | } |
@@ -531,6 +531,18 @@ class IndexController extends AbstractAction | @@ -531,6 +531,18 @@ class IndexController extends AbstractAction | ||
531 | */ | 531 | */ |
532 | private function baseShop($shop) | 532 | private function baseShop($shop) |
533 | { | 533 | { |
534 | + $appVersion = $this->get('app_version'); | ||
535 | + $uid = ''; | ||
536 | + if (empty($appVersion)) { | ||
537 | + $uid = $this->getUid(true); | ||
538 | + } | ||
539 | + //app环境 | ||
540 | + else { | ||
541 | + $uid = $this->get('uid'); | ||
542 | + $this->setSession('appUid', $uid); | ||
543 | + $this->setCookie('appUid', $uid); | ||
544 | + } | ||
545 | + | ||
534 | /* 过滤请求参数 */ | 546 | /* 过滤请求参数 */ |
535 | $condition = filter_input_array(INPUT_GET, array( | 547 | $condition = filter_input_array(INPUT_GET, array( |
536 | 'sort' => FILTER_DEFAULT, | 548 | 'sort' => FILTER_DEFAULT, |
@@ -609,11 +621,14 @@ class IndexController extends AbstractAction | @@ -609,11 +621,14 @@ class IndexController extends AbstractAction | ||
609 | $data['goodList'] += $condition; | 621 | $data['goodList'] += $condition; |
610 | $data['pageFooter'] = true; | 622 | $data['pageFooter'] = true; |
611 | 623 | ||
624 | + $data['shopCoupons'] = ListModel::getShopCouponsList($shop['shops_id'], $uid); | ||
625 | + $data['shopCouponsOne'] = count($data['shopCoupons']) === 1; | ||
626 | + | ||
612 | $this->setTitle($title); | 627 | $this->setTitle($title); |
613 | $this->setNavHeader($title, true, SITE_MAIN); | 628 | $this->setNavHeader($title, true, SITE_MAIN); |
614 | 629 | ||
615 | // 店铺使用基础模板 | 630 | // 店铺使用基础模板 |
616 | - $baseShopInfo = ListModel::getShopInfoById($shop['shops_id'], $this->getUid()); | 631 | + $baseShopInfo = ListModel::getShopInfoById($shop['shops_id'], $uid); |
617 | 632 | ||
618 | if ($baseShopInfo['code'] === 200) { | 633 | if ($baseShopInfo['code'] === 200) { |
619 | $data['baseShopHome'] = array( | 634 | $data['baseShopHome'] = array( |
-
Please register or login to post a comment