|
|
@@ -39,11 +39,11 @@
|
|
|
<span>1인 최대 <th:block th:text="${(goodsCoupon.custPubLimitQty > 0) ? #numbers.formatInteger(goodsCoupon.custPubLimitQty, 0,'COMMA') +'장' : '무제한'}"></span>
|
|
|
</p>
|
|
|
</div>
|
|
|
- <th:block th:if="${goodsCoupon.custPubLimitQty > 0 and goodsCoupon.custPubLimitQty <= goodsCoupon.custCouponCnt}">
|
|
|
+ <th:block th:if="${goodsCoupon.custPubLimitQty > 0 and (goodsCoupon.custPubLimitQty* goodsCoupon.onePubQty) <= goodsCoupon.custCouponCnt}">
|
|
|
<button type="button" class="btn btn_dark btn_block btn_coupon_done" disabled="disabled"><span>받기완료</span></button>
|
|
|
</th:block>
|
|
|
- <th:block th:unless="${goodsCoupon.custPubLimitQty > 0 and goodsCoupon.custPubLimitQty <= goodsCoupon.custCouponCnt}">
|
|
|
- <button type="button" class="btn btn_dark btn_block btn_coupon_down" th:attr="cpnId=${goodsCoupon.cpnId}" th:id="${'coupon_'+goodsCoupon.cpnId}" onclick="fnGoodsCouponDown(this);"><span>쿠폰받기</span></button>
|
|
|
+ <th:block th:unless="${goodsCoupon.custPubLimitQty > 0 and (goodsCoupon.custPubLimitQty* goodsCoupon.onePubQty) <= goodsCoupon.custCouponCnt}">
|
|
|
+ <button type="button" class="btn btn_dark btn_block btn_coupon_down" th:attr="cpnId=${goodsCoupon.cpnId},goodsCd=${goodsCoupon.goodsCd}" th:id="${'coupon_'+goodsCoupon.cpnId}" onclick="fnGoodsCouponDown(this);"><span>쿠폰받기</span></button>
|
|
|
</th:block>
|
|
|
</div>
|
|
|
</li>
|
|
|
@@ -70,7 +70,7 @@
|
|
|
|
|
|
let $obj = $(obj);
|
|
|
let cpnId = $obj.attr('cpnId');
|
|
|
- let goodsCd = $('#goodsCouponForm input[name=goodsCd]').val();
|
|
|
+ let goodsCd = $obj.attr('goodsCd');
|
|
|
|
|
|
gagajf.ajaxJsonSubmit(_PAGE_GOODS_CPN_DOWNLOAD, JSON.stringify({goodsCd: goodsCd, cpnId: cpnId}), fnGoodsCouponCallBack);
|
|
|
|
|
|
@@ -87,19 +87,20 @@
|
|
|
let list = result.goodsCouponList;
|
|
|
|
|
|
list.forEach(function(coupon){
|
|
|
- if (coupon.cpnId == cpnId){debugger;
|
|
|
+ if (coupon.cpnId == cpnId){
|
|
|
if (Number(coupon.custPubLimitQty) > 0){
|
|
|
- if (Number(coupon.custPubLimitQty) <= Number(coupon.custCouponCnt)){
|
|
|
- $('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
|
|
|
- $('#coupon_'+ coupon.cpnId).attr('disabled', true);
|
|
|
- $('#coupon_'+ coupon.cpnId).removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ if ((Number(coupon.custPubLimitQty) *Number(coupon.onePubQty)) <= Number(coupon.custCouponCnt)){
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').text('받기완료');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().attr('disabled', true);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (Number(coupon.TotPubLimitQty) > 0){
|
|
|
if (Number(coupon.TotPubLimitQty) <= Number(coupon.CustCouponCnt)){
|
|
|
- $('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
|
|
|
- $('#coupon_'+ coupon.cpnId).attr('disabled', true);
|
|
|
- $('#coupon_'+ coupon.cpnId).removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').text('받기완료');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().attr('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -113,10 +114,13 @@
|
|
|
var fnGoodsCouponDownAll = function(){
|
|
|
//00개 쿠폰이 발급되었습니다.
|
|
|
let couponDownAbleYn = "N";
|
|
|
+ let cpnAllDownYn = "Y";
|
|
|
+ let arrGoodsCd = [];
|
|
|
let arrCpnId = [];
|
|
|
$('#goodsCouponForm').find('.btn_coupon_down').each(function(){
|
|
|
if (!$(this).attr('disabled')){
|
|
|
couponDownAbleYn = "Y";
|
|
|
+ arrGoodsCd.push($(this).attr('goodscd'));
|
|
|
arrCpnId.push($(this).attr('cpnId'));
|
|
|
}
|
|
|
});
|
|
|
@@ -125,8 +129,7 @@
|
|
|
mcxDialog.alert("다운 받을 쿠폰이 없습니다.");
|
|
|
return false;
|
|
|
}
|
|
|
- let goodsCd = $('#goodsCouponForm input[name=goodsCd]').val();
|
|
|
- gagajf.ajaxJsonSubmit(_PAGE_GOODS_CPN_DOWNLOAD, JSON.stringify({goodsCd: goodsCd, arrCpnId: arrCpnId}), fnGoodsCouponDownAllBack);
|
|
|
+ gagajf.ajaxJsonSubmit(_PAGE_GOODS_CPN_DOWNLOAD, JSON.stringify({arrGoodsCd: arrGoodsCd, arrCpnId: arrCpnId, cpnAllDownYn: cpnAllDownYn}), fnGoodsCouponDownAllBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -143,16 +146,16 @@
|
|
|
if (coupon.cpnId == cpnId){
|
|
|
if (Number(coupon.custPubLimitQty) > 0){
|
|
|
if (Number(coupon.custPubLimitQty) <= Number(coupon.custCouponCnt)){
|
|
|
- $('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
|
|
|
- $('#coupon_'+ coupon.cpnId).attr('disabled', true);
|
|
|
- $('#coupon_'+ coupon.cpnId).removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').text('받기완료');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().attr('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
if (Number(coupon.TotPubLimitQty) > 0){
|
|
|
if (Number(coupon.TotPubLimitQty) <= Number(coupon.CustCouponCnt)){
|
|
|
- $('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
|
|
|
- $('#coupon_'+ coupon.cpnId).attr('disabled', true);
|
|
|
- $('#coupon_'+ coupon.cpnId).removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').text('받기완료');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().removeClass('btn_coupon_down').addClass('btn_coupon_done');
|
|
|
+ $('#coupon_'+ coupon.cpnId + ' span').parent().attr('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
}
|