Authored by 毕凯

增加发票选择

... ... @@ -39,4 +39,15 @@ $('.checkbox').on('touchstart', function() {
if ($this.hasClass('icon-checkbox')) {
$this.removeClass('icon-checkbox').addClass('icon-cb-checked');
}
});
\ No newline at end of file
});
$('.invoice').on('touchend', '.checkbox', function() {
var $this = $(this);
if ($this.hasClass('icon-cb-checked')) {
$('.invoice').addClass('focus');
}
if ($this.hasClass('icon-checkbox')) {
$('.invoice').removeClass('focus');
}
});
... ...
... ... @@ -31,6 +31,65 @@ $('#search-coupon').on('submit', function() {
return false;
});
function getCouponHandle(coupons) {
var notAvailableCoupons = [];
// 后端需要返回一个 coupons 列表,如下
// notAvailable 表示不可用的优惠券
coupons = [{
money: '99',
coupon_name: '满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '22222'
}, {
money: '99',
coupon_name: '满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '2222233'
}, {
money: '99',
coupon_name: 'NONO满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '2222233',
notAvailable: 1
}];
// coupons 是个列表,如果不是列表,可能是服务器错误,这次翻页加载不算
if (!$.isArray(coupons)) {
page--;
return;
}
// 每页10张,当不足10张时,说明已经加载完
if (coupons.length < 10) {
canGetCoupon = false;
}
// 第一页张数为 0 ,显示优惠券为空
if (!coupons.length && page === 2) {
$('.select-coupon-page').html($('#tmpl-no-coupon').html());
return;
}
// 把不可用的优惠券分离出来
$.each(coupons, function(i, coupon) {
if (coupon.notAvailable) {
notAvailableCoupons.push(coupon);
}
});
if (notAvailableCoupons.length) {
$('.not-avaliable-coupon-line').show();
}
$('#coupon-list').append(conponTmpl({
coupons: coupons
}));
$('#coupon-list-not').append(conponNotAvaliableTmpl({
notAvailableCoupons: notAvailableCoupons
}));
window.rePosFooter();
}
function getCouponDate() {
if (!canGetCoupon) {
return;
... ... @@ -52,64 +111,7 @@ function getCouponDate() {
statuss: status,
page: page
}
}).then(function(coupons) {
var notAvailableCoupons = [];
// 后端需要返回一个 coupons 列表,如下
// notAvailable 表示不可用的优惠券
coupons = [{
money: '99',
coupon_name: '满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '22222'
}, {
money: '99',
coupon_name: '满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '2222233'
}, {
money: '99',
coupon_name: 'NONO满XX-减去吴悠右腿有益于有2222',
couponValidity: '20150129-20150430',
coupon_id: '2222233',
notAvailable: 1
}];
// coupons 是个列表,如果不是列表,可能是服务器错误,这次翻页加载不算
if (!$.isArray(coupons)) {
page--;
return;
}
// 每页10张,当不足10张时,说明已经加载完
if (coupons.length < 10) {
canGetCoupon = false;
}
// 第一页张数为 0 ,显示优惠券为空
if (!coupons.length && page === 2) {
$('.select-coupon-page').html($('#tmpl-no-coupon').html());
return;
}
// 把不可用的优惠券分离出来
$.each(coupons, function(i, coupon) {
if (coupon.notAvailable) {
notAvailableCoupons.push(coupon);
}
});
if (notAvailableCoupons.length) {
$('.not-avaliable-coupon-line').show();
}
$('#coupon-list').append(conponTmpl({
coupons: coupons
}));
$('#coupon-list-not').append(conponNotAvaliableTmpl({
notAvailableCoupons: notAvailableCoupons
}));
window.rePosFooter();
}).fail(function() {
}).then(getCouponHandle).fail(function() {
page -= 1;
tip.show('加载优惠券失败');
}).always(function() {
... ...
... ... @@ -85,6 +85,7 @@
height: 90rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
border-bottom: 1px solid #f7f7f7;
overflow: hidden;
a {
display: block;
... ... @@ -120,8 +121,14 @@
color: #ccc;
}
.invoice .checkbox {
float: right;
.invoice {
.checkbox {
float: right;
}
&.focus {
height: auto;
}
}
.desc {
... ... @@ -129,6 +136,33 @@
}
}
#invoice {
input {
width: 100%;
height: pxToRem(90px);
outline: 0;
border: 0;
border-top: 1px solid #f7f7f7;
border-bottom: 1px solid #f7f7f7;
}
label {
position: relative;
width: 100%;
height: pxToRem(90px);
border-bottom: 1px solid #f7f7f7;
}
select {
position: relative;
float: right;
width: 40%;
height: pxToRem(50px);
top: pxToRem(20px);
border: 1px solid #f7f7f7;
}
}
.total {
font-size: 22rem / $pxConvertRem;
margin-top: 20rem / $pxConvertRem;
... ...
... ... @@ -2,7 +2,7 @@
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
#new-coupon {
#search-coupon {
margin-bottom: pxToRem(30px);
padding-left: pxToRem(30px);
padding-right: pxToRem(30px);
... ...
... ... @@ -82,6 +82,16 @@
<li class="invoice">
<span class="title">发票</span>
<span class="iconfont checkbox icon-checkbox"></span>
<form id="invoice">
<input type="text" name="invoice-title" value="" placeholder="发票抬头">
<label>
发票类型
<select class="invoice-type" name="invoice-type">
<option value ="A">服装</option>
<option value ="B">图书</option>
</select>
</label>
</form>
</li>
{{/ invoice}}
</ul>
... ...
{{> layout/header}}
<div class="yoho-page select-coupon-page my-coupon-page">
<form id="new-coupon" method="POST" action="">
<form id="search-coupon" method="POST" action="">
<input type="text" name="coupon-code" value="" placeholder="输入优惠券码">
<button type="submit" class="submit">确定</button>
</form>
... ...