Showing
3 changed files
with
16 additions
and
15 deletions
@@ -42,9 +42,10 @@ class CouponNew { | @@ -42,9 +42,10 @@ class CouponNew { | ||
42 | let page = req.body.page; | 42 | let page = req.body.page; |
43 | 43 | ||
44 | co(function* () { | 44 | co(function* () { |
45 | - let coupons = yield req.ctx(CouponNewModel).couponData({ | 45 | + let couponApi = yield req.ctx(CouponNewModel).couponGet({ |
46 | uid, type, filter, page | 46 | uid, type, filter, page |
47 | }); | 47 | }); |
48 | + let coupons = _.get(couponApi, 'data.couponList', []); | ||
48 | 49 | ||
49 | res.json(coupons); | 50 | res.json(coupons); |
50 | })().catch(next); | 51 | })().catch(next); |
1 | {{#each .}} | 1 | {{#each .}} |
2 | -<section class="coupon-section"> | 2 | +<section class="coupon-section" data-code="{{coupon_code}}" data-id="{{coupon_id}}"> |
3 | <div class="coupon"> | 3 | <div class="coupon"> |
4 | <div class="coupon-left"> | 4 | <div class="coupon-left"> |
5 | <p class="value">¥ | 5 | <p class="value">¥ |
6 | - <span>{{couponValue}}</span> | 6 | + <span>{{coupon_value_str}}</span> |
7 | </p> | 7 | </p> |
8 | - <p class="threshold">满{{shopLimit}}可用</p> | 8 | + {{#if use_rule}} |
9 | + <p class="threshold">{{use_rule}}</p> | ||
10 | + {{/if}} | ||
9 | </div> | 11 | </div> |
10 | <div class="coupon-right"> | 12 | <div class="coupon-right"> |
11 | <p class="title"> | 13 | <p class="title"> |
12 | - <span class="type-shop">[店铺券]</span> {{couponDetailInfomation}}</p> | ||
13 | - <p class="time">{{couponValidity}}</p> | 14 | + <span class="type-shop">[{{catalog_name}}]</span> {{coupon_name}}</p> |
15 | + <p class="time">{{coupon_validity}}</p> | ||
14 | <p> | 16 | <p> |
15 | <span class="show-intro-btn">使用说明</span> | 17 | <span class="show-intro-btn">使用说明</span> |
16 | <span class="iconfont icon-down show-intro-btn show-intro-arrow"></span> | 18 | <span class="iconfont icon-down show-intro-btn show-intro-arrow"></span> |
@@ -18,11 +18,9 @@ class ConponController extends Page { | @@ -18,11 +18,9 @@ class ConponController extends Page { | ||
18 | couponList: $('#couponList') | 18 | couponList: $('#couponList') |
19 | }; | 19 | }; |
20 | 20 | ||
21 | - this.view.filterBtn.on('click', this.tapChange.bind(this)); | 21 | + this.view.filterBtn.on('click', this.tabChange.bind(this)); |
22 | this.view.showFilterBtn.on('click', this.showFilter.bind(this)); | 22 | this.view.showFilterBtn.on('click', this.showFilter.bind(this)); |
23 | this.view.filterItem.on('click', 'button', this.filterCoupons.bind(this)); | 23 | this.view.filterItem.on('click', 'button', this.filterCoupons.bind(this)); |
24 | - | ||
25 | - // this.renderCoupons(); | ||
26 | } | 24 | } |
27 | 25 | ||
28 | /** | 26 | /** |
@@ -78,25 +76,25 @@ class ConponController extends Page { | @@ -78,25 +76,25 @@ class ConponController extends Page { | ||
78 | /** | 76 | /** |
79 | * tab 切换 | 77 | * tab 切换 |
80 | */ | 78 | */ |
81 | - tapChange(event) { | 79 | + tabChange(event) { |
82 | let itemClicked = $(event.currentTarget); | 80 | let itemClicked = $(event.currentTarget); |
83 | 81 | ||
84 | if (itemClicked.hasClass('no-used')) { | 82 | if (itemClicked.hasClass('no-used')) { |
85 | - this.status = 0; | 83 | + this.couponType = 'notuse'; |
86 | } else if (itemClicked.hasClass('used')) { | 84 | } else if (itemClicked.hasClass('used')) { |
87 | - this.status = 1; | 85 | + this.couponType = 'use'; |
88 | } else if (itemClicked.hasClass('invalid')) { | 86 | } else if (itemClicked.hasClass('invalid')) { |
89 | - this.status = 2; | 87 | + this.couponType = 'overtime'; |
90 | } | 88 | } |
91 | 89 | ||
92 | - this.renderCoupons(); | ||
93 | - | ||
94 | if (itemClicked.hasClass('active')) { | 90 | if (itemClicked.hasClass('active')) { |
95 | itemClicked.removeClass('active'); | 91 | itemClicked.removeClass('active'); |
96 | } else { | 92 | } else { |
97 | this.view.filterBtn.removeClass('active'); | 93 | this.view.filterBtn.removeClass('active'); |
98 | itemClicked.addClass('active'); | 94 | itemClicked.addClass('active'); |
99 | } | 95 | } |
96 | + | ||
97 | + this.renderCoupons(); | ||
100 | } | 98 | } |
101 | 99 | ||
102 | /** | 100 | /** |
-
Please register or login to post a comment