|
|
@@ -993,6 +993,20 @@ var dcAmtInfoSet = function() {
|
|
|
|
|
|
// 쿠폰적용버튼
|
|
|
$("#btn_coupon_apply").on("click", function(){
|
|
|
+
|
|
|
+ // 상품쿠폰적용
|
|
|
+ $('.goodsCpn ul li.selected').each(function(index){
|
|
|
+ custCpnApply($(this));
|
|
|
+ });
|
|
|
+
|
|
|
+ // 장바구니쿠폰적용
|
|
|
+ $('.cartCpn').each(function(index){
|
|
|
+ if ($(this).find("rdi-cart-coupon").is(":checked")) {
|
|
|
+ alert("a");
|
|
|
+ custCpnApply($(this));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
$(".close-modal").trigger("click"); // 팝업닫기
|
|
|
});
|
|
|
}
|
|
|
@@ -1000,6 +1014,9 @@ var dcAmtInfoSet = function() {
|
|
|
|
|
|
// 쿠폰변경팝업호출
|
|
|
$("#btn_couponModify_pop").on("click", function(){
|
|
|
+ // 쿠폰초기화
|
|
|
+ custGoodsCpnInit();
|
|
|
+
|
|
|
$("#couponModifyPop").modal("show");
|
|
|
});
|
|
|
|
|
|
@@ -1077,6 +1094,7 @@ var dcAmtInfoSet = function() {
|
|
|
// TODO 포인트 사용금액 1000원 이상 사용
|
|
|
if (gfcdUseAmt < 1000) {
|
|
|
alert("상품권 사용금액은 최소 1,000원 이상 사용해야 합니다.");
|
|
|
+
|
|
|
// 상품권리셋기능
|
|
|
gfcdUseAmtReset();
|
|
|
return false;
|
|
|
@@ -1100,7 +1118,8 @@ var dcAmtInfoSet = function() {
|
|
|
|
|
|
// 1.9.1 상품쿠폰초기화
|
|
|
var custGoodsCpnInit = function() {
|
|
|
- // 쿠폰적용없음적용
|
|
|
+
|
|
|
+ // 쿠폰초기화
|
|
|
$(".goodsCpn").each(function(index){
|
|
|
// select box 쿠폰 적용
|
|
|
var cpnCartSq = $(this).find("input[name='cpnCartSq']").val();
|
|
|
@@ -1119,6 +1138,8 @@ var custGoodsCpnInit = function() {
|
|
|
// 적용안함 적용
|
|
|
var emptyHtml = $(this).find("ul li .item_coupon.empty").html();
|
|
|
$(this).find(".select .item_coupon").html(emptyHtml);
|
|
|
+
|
|
|
+ $(this).find("ul li").removeClass("selected");
|
|
|
});
|
|
|
|
|
|
// 최대할인율 쿠폰적용
|
|
|
@@ -1142,12 +1163,9 @@ var custGoodsCpnInit = function() {
|
|
|
$(this).on("click", function(){
|
|
|
if (custCpnDuplicationCheck($(this).attr("value"), cpnIndex)) {
|
|
|
// 쿠폰적용
|
|
|
- custCpnApply($(this));
|
|
|
+ custCpnApplyTemp($(this));
|
|
|
// 쿠폰할인적용
|
|
|
cpnApplyTemp = true;
|
|
|
-
|
|
|
- // 장바구니쿠폰초기화
|
|
|
- custCartCpnInit();
|
|
|
} else {
|
|
|
custCpnNotApply($(this));
|
|
|
}
|
|
|
@@ -1169,7 +1187,7 @@ var custCartCpnInit = function() {
|
|
|
|
|
|
// 쿠폰 select 버튼기능
|
|
|
$(this).on("click", function(){
|
|
|
- custCpnApply($(this)); // 쿠폰적용
|
|
|
+ custCpnApplyTemp($(this)); // 쿠폰적용
|
|
|
});
|
|
|
});
|
|
|
|
|
|
@@ -1224,6 +1242,96 @@ var custCpnDuplicationCheck = function(custCpnSq, index) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 1.11.0 임시로 쿠폰적용
|
|
|
+var custCpnApplyTemp = function(obj) {
|
|
|
+ // select box 쿠폰 적용
|
|
|
+ var cpnType = obj.parent().find("input[name='cpnType']").val();
|
|
|
+
|
|
|
+ // 상품쿠폰적용
|
|
|
+ if (cpnType == "goodsCpn") {
|
|
|
+ var itemHtml = obj.find(".item_coupon").html();
|
|
|
+ obj.parent().parent().find(".select .item_coupon").html(itemHtml);
|
|
|
+ obj.parent().find("input[name='cpnDcAmt']").val(obj.attr("data"));
|
|
|
+ obj.parent().find("input[name='custCpnSq']").val(obj.attr("value"));
|
|
|
+
|
|
|
+ // 장바구니쿠폰 초기화 적용
|
|
|
+ $(".cartCpn").each(function(index) {
|
|
|
+ if (index == 0) {
|
|
|
+ custCpnApplyTemp($(this)); // 쿠폰적용
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 장바구니쿠폰적용
|
|
|
+ else if (cpnType == "cartCpn") {
|
|
|
+ var dcWay = obj.find("input[name='dcWay']").val();
|
|
|
+ var dcVal = obj.find("input[name='dcVal']").val();
|
|
|
+ var cartCpnDcSumAmt = 0;
|
|
|
+ var tempSumAmt = 0;
|
|
|
+ var cartSqLen = $(".cartSq").length;
|
|
|
+ var leftAmt = 0;
|
|
|
+ var index = 1;
|
|
|
+
|
|
|
+ // 장바구니쿠폰 해당 장바구니상품들 할인가 적용
|
|
|
+ obj.find("input[name='cartCpnCartSq']").each(function(){
|
|
|
+ var cartCpnCartSq = $(this).val();
|
|
|
+ var cartCpnDcAmt = 0;
|
|
|
+
|
|
|
+ // 장바구니시퀀스 체크
|
|
|
+ $(".cartSq").each(function(){
|
|
|
+ if (cartCpnCartSq == $(this).text()) {
|
|
|
+ var orgCurrPrice = parseInt($(this).parent().find(".orgCurrPrice").text());
|
|
|
+ var cpn1DcAmt = parseInt($(this).parent().find(".cpn1DcAmt").text());
|
|
|
+ var goodsQty = parseInt($(this).parent().find(".goodsQty").text());
|
|
|
+ var tmtb1DcAmt = parseInt($(this).parent().find(".tmtb1DcAmt").text());
|
|
|
+ var tmtb2DcAmt = parseInt($(this).parent().find(".tmtb2DcAmt").text());
|
|
|
+ var goodsCpnDcAmt = 0;
|
|
|
+
|
|
|
+ $(".goodsCpn input[name=cpnCartSq]").each(function(){
|
|
|
+ if ($(this).val() == cartCpnCartSq) {
|
|
|
+ goodsCpnDcAmt = parseInt($(this).parent().find("input[name=cpnDcAmt]").val());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var tempAmt = ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
|
|
|
+ tempSumAmt = tempSumAmt + tempAmt;
|
|
|
+
|
|
|
+ // 할인율일때 할인금액
|
|
|
+ if (dcWay == "G240_11") {
|
|
|
+ cartCpnDcAmt = (tempAmt * dcVal) / 100;
|
|
|
+ cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 금액일때 할인금액 적용
|
|
|
+ if (dcWay == "G240_10") {
|
|
|
+ cartCpnDcSumAmt = dcVal;
|
|
|
+ }
|
|
|
+
|
|
|
+ obj.find("input[name=rdi-cart-coupon]").prop("checked", true);
|
|
|
+ obj.parent().find("input[name=cpnDcAmt]").val(cartCpnDcSumAmt);
|
|
|
+ obj.parent().find("input[name=custCpnSq]").val(obj.attr("value"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var cpnDcSumAmt = 0;
|
|
|
+ var cpnApplyCnt = 0;
|
|
|
+ var goodsCartCpnSumAmt = 0;
|
|
|
+ var cpnType = "";
|
|
|
+
|
|
|
+ $("input[name='cpnDcAmt']").each(function(){
|
|
|
+ cpnType = $(this).parent().find("input[name=cpnType]").val();
|
|
|
+
|
|
|
+ // 상품, 장바구니쿠폰 할인 금액만 합계 적용
|
|
|
+ if (cpnType == "goodsCpn" || cpnType == "cartCpn") {
|
|
|
+ goodsCartCpnSumAmt = goodsCartCpnSumAmt + parseInt($(this).val());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 상품, 장바구니쿠폰 할인 금액만 합계 적용
|
|
|
+ $(".modal-footer .goodsCartCpnSumAmt").text("-"+goodsCartCpnSumAmt.addComma());
|
|
|
+}
|
|
|
+
|
|
|
// 1.11 쿠폰중복체크 후 적용가능
|
|
|
var custCpnApply = function(obj) {
|
|
|
// select box 쿠폰 적용
|
|
|
@@ -1245,6 +1353,9 @@ var custCpnApply = function(obj) {
|
|
|
$(this).parent().find(".goodsCpnDcAmt").text(obj.attr("data")); // 상품쿠폰할인금액
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 선택활성화
|
|
|
+ $(obj).addClass("selected");
|
|
|
}
|
|
|
// 장바구니쿠폰적용
|
|
|
else if (cpnType == "cartCpn") {
|
|
|
@@ -1438,23 +1549,25 @@ var custCpnSumAmtCal = function() {
|
|
|
goodsCartCpnSumAmt = goodsCartCpnSumAmt + parseInt($(this).val());
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 상품, 장바구니쿠폰 할인 금액만 합계 적용
|
|
|
- $(".modal-footer .goodsCartCpnSumAmt").text("-"+goodsCartCpnSumAmt.addComma());
|
|
|
-
|
|
|
- // 쿠폰영역
|
|
|
- if (cpnDcSumAmt > 0) {
|
|
|
- $(".maxdisc_amount .cpnDcAmt").text("-"+cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
+ if (goodsCartCpnSumAmt > 0) {
|
|
|
+ $(".maxdisc_amount .goodsCartCpnDcAmt").text("-"+goodsCartCpnSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
+ $(".goodsCartCpnSumAmt").text("-"+goodsCartCpnSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
} else {
|
|
|
- $(".maxdisc_amount .cpnDcAmt").text(cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
+ $(".maxdisc_amount .goodsCartCpnDcAmt").text(goodsCartCpnSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
+ $(".goodsCartCpnSumAmt").text(goodsCartCpnSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
}
|
|
|
|
|
|
- // 상품목록영역
|
|
|
+ // 전체쿠폰 할인 금액 합계 적용
|
|
|
if (cpnDcSumAmt > 0) {
|
|
|
+ $(".maxdisc_amount .cpnDcAmt").text("-"+cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
$("#couponDcSumAmt").text("-" + cpnDcSumAmt.addComma() + " 원"); // 쿠폰할인금액합계
|
|
|
} else {
|
|
|
+ $(".maxdisc_amount .cpnDcAmt").text(cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
$("#couponDcSumAmt").text(cpnDcSumAmt.addComma() + " 원"); // 쿠폰할인금액합계
|
|
|
}
|
|
|
+
|
|
|
$(".cpnDcSumAmt").text(cpnDcSumAmt);
|
|
|
|
|
|
var delvSumAmt = orgSumDelvFee;
|
|
|
@@ -1509,7 +1622,7 @@ var custCpnSumAmtCal = function() {
|
|
|
|
|
|
// 주문금액 = ((판매가 - 즉시할인가) + 옵션추가금액) * 장바구니수량
|
|
|
orgGoodsSumAmt = orgGoodsSumAmt + (orgCurrPrice + optAddPrice) * goodsQty;
|
|
|
- cpn1DcSumAmt = cpn1DcSumAmt + cpn1DcAmt;
|
|
|
+ cpn1DcSumAmt = cpn1DcSumAmt + (cpn1DcAmt * goodsQty);
|
|
|
tmtb1DcSumAmt = tmtb1DcSumAmt + tmtb1DcAmt;
|
|
|
tmtb2DcSumAmt = tmtb2DcSumAmt + tmtb2DcAmt;
|
|
|
tmtbDcSumAmt = tmtbDcSumAmt + (tmtb1DcAmt + tmtb2DcAmt);
|