Authored by 毕凯

新优惠券 提交按钮变色

@@ -16,11 +16,12 @@ var page = 1, @@ -16,11 +16,12 @@ var page = 1,
16 isGetData; 16 isGetData;
17 17
18 var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()), 18 var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
19 - conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()); 19 + conponNotAvaliableTmpl = Handlebars.compile($('#tmpl-coupon-not-avaliable').html()),
  20 + $newCoupon = $('#new-coupon');
20 21
21 ellipsis.init(); 22 ellipsis.init();
22 23
23 -$('#search-coupon').on('submit', function() { 24 +$newCoupon.on('submit', function() {
24 $.ajax({ 25 $.ajax({
25 method: 'POST', 26 method: 'POST',
26 url: '/shoppingCart/coupon', 27 url: '/shoppingCart/coupon',
@@ -43,6 +44,14 @@ $('#coupon-list').on('touchend', 'employ-main', function() { @@ -43,6 +44,14 @@ $('#coupon-list').on('touchend', 'employ-main', function() {
43 orderInfo('couponCode', $(this).data('coupon-code')); 44 orderInfo('couponCode', $(this).data('coupon-code'));
44 }); 45 });
45 46
  47 +$newCoupon.find('input').on('input', function() {
  48 + if ($(this).val() !== '') {
  49 + $newCoupon.find('.submit').css('background', '#444');
  50 + } else {
  51 + $newCoupon.find('.submit').css('background', '#b0b0b0');
  52 + }
  53 +});
  54 +
46 function getCouponHandle(coupons) { 55 function getCouponHandle(coupons) {
47 var notAvailableCoupons = []; 56 var notAvailableCoupons = [];
48 57
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 margin-top: pxToRem(30px); 2 margin-top: pxToRem(30px);
3 margin-bottom: pxToRem(30px); 3 margin-bottom: pxToRem(30px);
4 4
5 - #search-coupon { 5 + #new-coupon {
6 margin-bottom: pxToRem(30px); 6 margin-bottom: pxToRem(30px);
7 padding-left: pxToRem(30px); 7 padding-left: pxToRem(30px);
8 padding-right: pxToRem(30px); 8 padding-right: pxToRem(30px);
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="yoho-page select-coupon-page my-coupon-page"> 2 <div class="yoho-page select-coupon-page my-coupon-page">
3 - <form id="search-coupon" method="POST" action=""> 3 + <form id="new-coupon" method="POST" action="">
4 <input type="text" name="couponCode" value="" placeholder="输入优惠券码"> 4 <input type="text" name="couponCode" value="" placeholder="输入优惠券码">
5 <button type="submit" class="submit">确定</button> 5 <button type="submit" class="submit">确定</button>
6 </form> 6 </form>