Authored by 毕凯

添加优惠券搜索

... ... @@ -13,6 +13,24 @@ var conponTmpl = Handlebars.compile($('#tmpl-coupon').html()),
ellipsis.init();
$('#search-coupon').on('submit', function() {
$.ajax({
method: 'POST',
url: '',
data: $(this).serialize()
}).then(function(res) {
if (res.avaliable) {
$('#coupon-list').html(conponTmpl({
coupons: res.coupons
}));
$('#coupon-list-not').html('');
} else {
tip.show(res.msg);
}
});
return false;
});
function getCouponDate() {
if (!canGetCoupon) {
return;
... ...
... ... @@ -2,6 +2,32 @@
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
#new-coupon {
margin-bottom: pxToRem(30px);
padding-left: pxToRem(30px);
padding-right: pxToRem(30px);
input {
padding: 0 pxToRem(12px);
width: pxToRem(384px);
height: pxToRem(80px);
border: 1px solid #b0b0b0;
border-radius: .1rem;
outline: 0;
}
.submit {
margin-left: pxToRem(30px);
width: pxToRem(130px);
height: pxToRem(80px);
color: #fff;
background: #b0b0b0;
border-radius: .1rem;
border: none;
outline: 0;
}
}
.coupon-list {
.employ-main:first-child {
margin-top: 0;
... ...
{{> layout/header}}
<div class="yoho-page select-coupon-page my-coupon-page">
<form id="new-coupon" method="POST" action="">
<input type="text" name="coupon-code" value="" placeholder="输入优惠券码">
<button type="submit" class="submit">确定</button>
</form>
<div id="coupon-list" class="coupon-list"></div>
<div class="not-avaliable-coupon-line hide">不可使用的优惠券</div>
<div id="coupon-list-not" class="coupon-list"></div>
... ...