Showing
1 changed file
with
24 additions
and
29 deletions
@@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | - Hammer = require('yoho-hammer'), | ||
9 | ellipsis = require('yoho-mlellipsis'), | 8 | ellipsis = require('yoho-mlellipsis'), |
10 | loading = require('../plugin/loading'), | 9 | loading = require('../plugin/loading'), |
11 | tip = require('../plugin/tip'), | 10 | tip = require('../plugin/tip'), |
@@ -125,34 +124,30 @@ function getCouponHandle(allCoupons) { | @@ -125,34 +124,30 @@ function getCouponHandle(allCoupons) { | ||
125 | // 渲染可用的优惠券 | 124 | // 渲染可用的优惠券 |
126 | $couponList.append(conponTmpl({ | 125 | $couponList.append(conponTmpl({ |
127 | coupons: coupons | 126 | coupons: coupons |
128 | - })).find('.employ-main').each(function(i, elem) { | ||
129 | - var employHammer = new Hammer(elem); | ||
130 | - | ||
131 | - employHammer.on('tap', function() { | ||
132 | - var couponCode = $(elem).data('coupon-code'); | ||
133 | - | ||
134 | - $.ajax({ | ||
135 | - method: 'POST', | ||
136 | - url: '/cart/index/new/couponSearch', | ||
137 | - data: { | ||
138 | - couponCode: couponCode | ||
139 | - } | ||
140 | - }).then(function(res) { | ||
141 | - if (res.code === 200) { | ||
142 | - | ||
143 | - // tip.show('优惠券可用'); | ||
144 | - orderInfo('couponCode', res.data.coupon_code); | ||
145 | - orderInfo('couponName', res.data.coupon_title); | ||
146 | - | ||
147 | - // 实付金额发生变化,使用有货币为0 | ||
148 | - orderInfo('yohoCoin', 0); | ||
149 | - window.location.href = '/cart/index/new/orderEnsure'; | ||
150 | - } else if (res.message) { | ||
151 | - tip.show(res.message); | ||
152 | - } | ||
153 | - }).fail(function() { | ||
154 | - tip.show('网络错误'); | ||
155 | - }); | 127 | + })).find('.employ-main').on('touchstart', function() { |
128 | + var couponCode = $(this).data('coupon-code'); | ||
129 | + | ||
130 | + $.ajax({ | ||
131 | + method: 'POST', | ||
132 | + url: '/cart/index/new/couponSearch', | ||
133 | + data: { | ||
134 | + couponCode: couponCode | ||
135 | + } | ||
136 | + }).then(function(res) { | ||
137 | + if (res.code === 200) { | ||
138 | + | ||
139 | + // tip.show('优惠券可用'); | ||
140 | + orderInfo('couponCode', res.data.coupon_code); | ||
141 | + orderInfo('couponName', res.data.coupon_title); | ||
142 | + | ||
143 | + // 实付金额发生变化,使用有货币为0 | ||
144 | + orderInfo('yohoCoin', 0); | ||
145 | + window.location.href = '/cart/index/new/orderEnsure'; | ||
146 | + } else if (res.message) { | ||
147 | + tip.show(res.message); | ||
148 | + } | ||
149 | + }).fail(function() { | ||
150 | + tip.show('网络错误'); | ||
156 | }); | 151 | }); |
157 | }); | 152 | }); |
158 | 153 |
-
Please register or login to post a comment