Browse Source

쿠폰다운로드관련 수정

eskim 5 years ago
parent
commit
5d10754338

+ 7 - 10
src/main/webapp/WEB-INF/views/mob/goods/GoodsCouponFormMob.html

@@ -41,16 +41,12 @@
 							</div>
 							<div class="btn_group_flex">
 								<div>
-									<button type="button" class="btn btn_dark btn_coupon_down" 
+									<button type="button" class="btn btn_dark" 
 											th:disabled="${goodsCoupon.custPubLimitQty > 0 and goodsCoupon.custPubLimitQty <= goodsCoupon.custCouponCnt}"
 											th:attr="cpnId=${goodsCoupon.cpnId}" th:id="${'coupon_'+goodsCoupon.cpnId}" onclick="fnGoodsCouponDown(this);">
 										<span>쿠폰받기</span>
 										<span>받기완료</span>
 									</button>
-									<button type="button" class="btn btn_dark" disabled="disabled" id="btn_result_coupon2">
-									    <span>쿠폰받기</span>
-										<span>받기완료</span>
-									</button>
 								</div>
 							</div>
 							<!-- <th:block th:if="${goodsCoupon.custPubLimitQty > 0 and goodsCoupon.custPubLimitQty <= goodsCoupon.custCouponCnt}">
@@ -114,6 +110,7 @@
 						if (Number(coupon.TotPubLimitQty) <= Number(coupon.CustCouponCnt)){
 							//$('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
 							$('#coupon_'+ coupon.cpnId).attr('disabled', true);
+							$('#coupon_'+ coupon.cpnId).find('span::after').attr('content','');
 						}
 					}
 				}
@@ -124,11 +121,11 @@
 	
 	
 	// 쿠폰 전체 다운로드
-	var fnGoodsCouponDownAll = function(){debugger;
+	var fnGoodsCouponDownAll = function(){
 		//00개 쿠폰이 발급되었습니다.
 		let couponDownAbleYn = "N";
 		let arrCpnId = [];
-		$('.btn_coupon_down').each(function(){debugger;
+		$('.btn_group_flex .btn_dark').each(function(){
 			if (!$(this).attr('disabled')){
 				couponDownAbleYn = "Y";
 				arrCpnId.push($(this).attr('cpnId'));
@@ -151,7 +148,7 @@
 			let list = result.goodsCouponList;
 
 			list.forEach(function(coupon){
-				$('.btn_coupon_down').each(function(){
+				$('.btn_group_flex .btn_dark').each(function(){
 					if (!$(this).attr('disabled')){
 						let cpnId = $(this).attr('cpnId');
 						if (coupon.cpnId == cpnId){
@@ -178,14 +175,14 @@
 	
 	var jfCouponCheck = function(){
 		let couponDownAbleYn = "N";
-		$('.btn_coupon_down').each(function(){
+		$('.btn_group_flex .btn_dark').each(function(){
 			if (!$(this).attr('disabled')){
 				couponDownAbleYn = "Y";
 			}
 		});	
 		
 		if(couponDownAbleYn == "N"){
-			$('.btn_all_cpdown').attr('disabled', true);
+			$('#btn_all_coupon').attr('disabled', true);
 		}
 	}	
 	

+ 11 - 7
src/main/webapp/WEB-INF/views/web/goods/GoodsCouponFormWeb.html

@@ -40,7 +40,7 @@
 								</p>
 							</div>
 							<th:block th:if="${goodsCoupon.custPubLimitQty > 0 and goodsCoupon.custPubLimitQty <= goodsCoupon.custCouponCnt}">
-							<button type="button" class="btn btn_dark btn_block btn_coupon_down"   disabled="disabled"><span>받기완료</span></button>
+							<button type="button" class="btn btn_dark btn_block btn_coupon_down"  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>
@@ -50,9 +50,9 @@
 				</ul>
 			</div>
 		</form>	
-		</div>
+		</div> 
 		<div class="modal-footer">
-			<button type="button" class="btn btn_primary btn_all_cpdown" onclick="fnGoodsCouponDownAll();"><span>쿠폰 모두 받기</span></button>
+			<button type="button"  id="btn_all_coupon" class="btn btn_primary btn_all_cpdown" onclick="fnGoodsCouponDownAll();"><span>쿠폰 모두 받기</span></button>
 		</div>
 	</div>
 </div>
@@ -143,12 +143,14 @@
 								if (Number(coupon.custPubLimitQty) <= Number(coupon.custCouponCnt)){
 									$('#coupon_'+ coupon.cpnId).html('<span>받기완료</span>');
 									$('#coupon_'+ coupon.cpnId).attr('disabled', true);
+									$('#coupon_'+ coupon.cpnId).find('span::after').attr('content','');
 								}
 							}
 							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).find('span::after').attr('content','');
 								}
 							}
 						}
@@ -162,16 +164,18 @@
 	
 	var jfCouponCheck = function(){
 		let couponDownAbleYn = "N";
-		$('.btn_coupon_down').each(function(){
+		$('#goodsCouponForm').find('.btn_coupon_down').each(function(){
 			if (!$(this).attr('disabled')){
 				couponDownAbleYn = "Y";
 			}
 		});	
 		
 		if(couponDownAbleYn == "N"){
-			$('.btn_all_cpdown').addClass('btn_coupon_done');
-			$('.btn_all_cpdown').attr('disabled', true);
-			$('.btn_all_cpdown').find('span').text('쿠폰 모두 받기 완료');
+			
+			$('#btn_all_coupon').removeClass('btn_primary');
+			$('#btn_all_coupon').addClass('btn_coupon_done');
+			$('#btn_all_coupon').attr('disabled', true);
+			$('#btn_all_coupon').find('span').text('쿠폰 모두 받기 완료');
 		}
 	}