Authored by 毕凯

增加发票

@@ -40,3 +40,14 @@ $('.checkbox').on('touchstart', function() { @@ -40,3 +40,14 @@ $('.checkbox').on('touchstart', function() {
40 $this.removeClass('icon-checkbox').addClass('icon-cb-checked'); 40 $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
41 } 41 }
42 }); 42 });
  43 +
  44 +$('.invoice').on('touchend', '.checkbox', function() {
  45 + var $this = $(this);
  46 +
  47 + if ($this.hasClass('icon-cb-checked')) {
  48 + $('.invoice').addClass('focus');
  49 + }
  50 + if ($this.hasClass('icon-checkbox')) {
  51 + $('.invoice').removeClass('focus');
  52 + }
  53 +});
@@ -31,28 +31,7 @@ $('#search-coupon').on('submit', function() { @@ -31,28 +31,7 @@ $('#search-coupon').on('submit', function() {
31 return false; 31 return false;
32 }); 32 });
33 33
34 -function getCouponDate() {  
35 - if (!canGetCoupon) {  
36 - return;  
37 - }  
38 -  
39 - if (isGetData) {  
40 - return;  
41 - }  
42 -  
43 - loading.showLoadingMask();  
44 - page += 1;  
45 - isGetData = true;  
46 -  
47 - $.ajax({  
48 - type: 'POST',  
49 - url: '/home/couponData',  
50 - dataType: 'html',  
51 - data: {  
52 - statuss: status,  
53 - page: page  
54 - }  
55 - }).then(function(coupons) { 34 +function getCouponHandle(coupons) {
56 var notAvailableCoupons = []; 35 var notAvailableCoupons = [];
57 36
58 // 后端需要返回一个 coupons 列表,如下 37 // 后端需要返回一个 coupons 列表,如下
@@ -109,7 +88,30 @@ function getCouponDate() { @@ -109,7 +88,30 @@ function getCouponDate() {
109 notAvailableCoupons: notAvailableCoupons 88 notAvailableCoupons: notAvailableCoupons
110 })); 89 }));
111 window.rePosFooter(); 90 window.rePosFooter();
112 - }).fail(function() { 91 +}
  92 +
  93 +function getCouponDate() {
  94 + if (!canGetCoupon) {
  95 + return;
  96 + }
  97 +
  98 + if (isGetData) {
  99 + return;
  100 + }
  101 +
  102 + loading.showLoadingMask();
  103 + page += 1;
  104 + isGetData = true;
  105 +
  106 + $.ajax({
  107 + type: 'POST',
  108 + url: '/home/couponData',
  109 + dataType: 'html',
  110 + data: {
  111 + statuss: status,
  112 + page: page
  113 + }
  114 + }).then(getCouponHandle).fail(function() {
113 page -= 1; 115 page -= 1;
114 tip.show('加载优惠券失败'); 116 tip.show('加载优惠券失败');
115 }).always(function() { 117 }).always(function() {
@@ -85,6 +85,7 @@ @@ -85,6 +85,7 @@
85 height: 90rem / $pxConvertRem; 85 height: 90rem / $pxConvertRem;
86 line-height: 90rem / $pxConvertRem; 86 line-height: 90rem / $pxConvertRem;
87 border-bottom: 1px solid #f7f7f7; 87 border-bottom: 1px solid #f7f7f7;
  88 + overflow: hidden;
88 89
89 a { 90 a {
90 display: block; 91 display: block;
@@ -120,15 +121,48 @@ @@ -120,15 +121,48 @@
120 color: #ccc; 121 color: #ccc;
121 } 122 }
122 123
123 - .invoice .checkbox { 124 + .invoice {
  125 + .checkbox {
124 float: right; 126 float: right;
125 } 127 }
126 128
  129 + &.focus {
  130 + height: auto;
  131 + }
  132 + }
  133 +
127 .desc { 134 .desc {
128 color: #999; 135 color: #999;
129 } 136 }
130 } 137 }
131 138
  139 + #invoice {
  140 + input {
  141 + width: 100%;
  142 + height: pxToRem(90px);
  143 + outline: 0;
  144 + border: 0;
  145 + border-top: 1px solid #f7f7f7;
  146 + border-bottom: 1px solid #f7f7f7;
  147 + }
  148 +
  149 + label {
  150 + position: relative;
  151 + width: 100%;
  152 + height: pxToRem(90px);
  153 + border-bottom: 1px solid #f7f7f7;
  154 + }
  155 +
  156 + select {
  157 + position: relative;
  158 + float: right;
  159 + width: 40%;
  160 + height: pxToRem(50px);
  161 + top: pxToRem(20px);
  162 + border: 1px solid #f7f7f7;
  163 + }
  164 + }
  165 +
132 .total { 166 .total {
133 font-size: 22rem / $pxConvertRem; 167 font-size: 22rem / $pxConvertRem;
134 margin-top: 20rem / $pxConvertRem; 168 margin-top: 20rem / $pxConvertRem;
@@ -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 - #new-coupon { 5 + #search-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);
@@ -82,6 +82,16 @@ @@ -82,6 +82,16 @@
82 <li class="invoice"> 82 <li class="invoice">
83 <span class="title">发票</span> 83 <span class="title">发票</span>
84 <span class="iconfont checkbox icon-checkbox"></span> 84 <span class="iconfont checkbox icon-checkbox"></span>
  85 + <form id="invoice">
  86 + <input type="text" name="invoice-title" value="" placeholder="发票抬头">
  87 + <label>
  88 + 发票类型
  89 + <select class="invoice-type" name="invoice-type">
  90 + <option value ="A">服装</option>
  91 + <option value ="B">图书</option>
  92 + </select>
  93 + </label>
  94 + </form>
85 </li> 95 </li>
86 {{/ invoice}} 96 {{/ invoice}}
87 </ul> 97 </ul>
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="new-coupon" method="POST" action=""> 3 + <form id="search-coupon" method="POST" action="">
4 <input type="text" name="coupon-code" value="" placeholder="输入优惠券码"> 4 <input type="text" name="coupon-code" value="" placeholder="输入优惠券码">
5 <button type="submit" class="submit">确定</button> 5 <button type="submit" class="submit">确定</button>
6 </form> 6 </form>