|
|
@@ -985,8 +985,16 @@ var dcAmtInfoSet = function() {
|
|
|
success : function(result) {
|
|
|
$("#couponModifyPop").html(result);
|
|
|
|
|
|
- // 1.8.2 쿠폰적용초기화(할인율최고)
|
|
|
- custCpnInit();
|
|
|
+ // 1.8.2 쿠폰적용초기화(할인율최고)(상품,장바구니)
|
|
|
+ custGoodsCpnInit();
|
|
|
+
|
|
|
+ // 1.8.3 쿠폰적용초기화(할인율최고)(배송비)
|
|
|
+ custDelvCpnInit();
|
|
|
+
|
|
|
+ // 쿠폰적용버튼
|
|
|
+ $("#btn_coupon_apply").on("click", function(){
|
|
|
+ $(".close-modal").trigger("click"); // 팝업닫기
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -994,89 +1002,6 @@ var dcAmtInfoSet = function() {
|
|
|
$("#btn_couponModify_pop").on("click", function(){
|
|
|
$("#couponModifyPop").modal("show");
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /*
|
|
|
- // 1.8.3 쿠폰 SELECT BOX 기능 설정(js적용)
|
|
|
- $('.select_custom.type1').each(function(index){
|
|
|
- var selecter01 = new sCombo($(this));
|
|
|
-
|
|
|
- // 선택박스 버튼기능 구현
|
|
|
- $(this).find("ul li").each(function(i){
|
|
|
-
|
|
|
- // SELECT BOX 버튼 기능 설정
|
|
|
- $(this).on("click", function(){
|
|
|
- // 쿠폰 선택없음
|
|
|
- if ($(this).prop("value") == 0) {
|
|
|
- // 쿠폰 선택없음
|
|
|
- cpnApplyDel($(this));
|
|
|
- }
|
|
|
- // 쿠폰선택
|
|
|
- else {
|
|
|
- // 쿠폰중복체크 후 적용
|
|
|
- if (custCpnDuplicationCheck($(this).prop("value"), index)) {
|
|
|
- // 쿠폰적용
|
|
|
- custCpnApply($(this));
|
|
|
- } else {
|
|
|
- alert("이미 적용된 쿠폰 입니다.");
|
|
|
-
|
|
|
- // 쿠폰적용불가
|
|
|
- custCpnNotApply($(this));
|
|
|
- }
|
|
|
-
|
|
|
- // 쿠폰할인금액 SUM
|
|
|
- custCpnSumAmtCal();
|
|
|
-
|
|
|
- // 최대할인혜택적용 체크해제
|
|
|
- if ($("#chk-maxdisc").is(":checked")) {
|
|
|
- $("#chk-maxdisc").attr("checked", false);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- // 1.8.4 쿠폰 최대할인금액 초기화 버튼 설정
|
|
|
- $("#chk-maxdisc").on("click", function(){
|
|
|
- if ($(this).is(":checked")) {
|
|
|
- custCpnInit();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 1.8.5 쿠폰할인적용 삭제 버튼
|
|
|
- $(".btn_del_coupon").on("click", function(){
|
|
|
- //선택없음선택
|
|
|
- $(this).parent().parent().find("ul li").each(function(i){
|
|
|
- if (i == 0) {
|
|
|
- cpnApplyDel($(this)); // 쿠폰 선택없음
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- // 1.8.6 선포인트 적용 버튼 기능
|
|
|
- $("input[name='rdi-beforpoint']").each(function(){
|
|
|
- // 선포인트 초기 설정 사용함
|
|
|
- if ($(this).val() == "Y") {
|
|
|
- $(this).attr("checked", true);
|
|
|
- }
|
|
|
-
|
|
|
- // 버튼기능 구현
|
|
|
- $(this).on("click", function(){
|
|
|
- var rmPrePntAmt = parseInt($("input[name='rmPrePntAmt']").val());
|
|
|
-
|
|
|
- // 선포인트적용
|
|
|
- if ($(this).val() == "Y") {
|
|
|
- $("#prePntDcAmt").text("-"+rmPrePntAmt.addComma()+"원");
|
|
|
- } else {
|
|
|
- $("#prePntDcAmt").text("0원");
|
|
|
- }
|
|
|
-
|
|
|
- // 쿠폰할인금액 SUM
|
|
|
- custCpnSumAmtCal();
|
|
|
- });
|
|
|
- });
|
|
|
|
|
|
// 1.8.7 포인트 적용버튼 기능
|
|
|
$("#btn_point_apply").on("click", function(){
|
|
|
@@ -1167,15 +1092,14 @@ var dcAmtInfoSet = function() {
|
|
|
|
|
|
// 금액계산초기화
|
|
|
custCpnSumAmtCal();
|
|
|
- */
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// 1.9 쿠폰 최대할인율 쿠폰적용
|
|
|
-var custCpnInit = function() {
|
|
|
-
|
|
|
+// 1.9.1 상품쿠폰초기화
|
|
|
+var custGoodsCpnInit = function() {
|
|
|
// 쿠폰적용없음적용
|
|
|
$(".goodsCpn").each(function(index){
|
|
|
// select box 쿠폰 적용
|
|
|
@@ -1196,40 +1120,89 @@ var custCpnInit = function() {
|
|
|
var emptyHtml = $(this).find("ul li .item_coupon.empty").html();
|
|
|
$(this).find(".select .item_coupon").html(emptyHtml);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 최대할인율 쿠폰적용
|
|
|
$('.goodsCpn').each(function(index){
|
|
|
+ cpnIndex = 0;
|
|
|
cpnApplyTemp = false;
|
|
|
|
|
|
// select 박스 반복문 실행
|
|
|
$(this).find("ul li").each(function(i){
|
|
|
+ cpnIndex++;
|
|
|
if (cpnApplyTemp == false) {
|
|
|
- if (custCpnDuplicationCheck($(this).prop("value"), index)) {
|
|
|
+ if (custCpnDuplicationCheck($(this).attr("value"), cpnIndex)) {
|
|
|
// 쿠폰적용
|
|
|
custCpnApply($(this));
|
|
|
// 쿠폰할인적용
|
|
|
cpnApplyTemp = true;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 쿠폰 select 버튼기능
|
|
|
+ $(this).on("click", function(){
|
|
|
+ if (custCpnDuplicationCheck($(this).attr("value"), cpnIndex)) {
|
|
|
+ // 쿠폰적용
|
|
|
+ custCpnApply($(this));
|
|
|
+ // 쿠폰할인적용
|
|
|
+ cpnApplyTemp = true;
|
|
|
+
|
|
|
+ // 장바구니쿠폰초기화
|
|
|
+ custCartCpnInit();
|
|
|
+ } else {
|
|
|
+ custCpnNotApply($(this));
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ // 장바구니쿠폰초기화
|
|
|
+ custCartCpnInit();
|
|
|
+}
|
|
|
+
|
|
|
+// 1.9.2 장바구니쿠폰초기화
|
|
|
+var custCartCpnInit = function() {
|
|
|
// 장바구니쿠폰 초기화 적용
|
|
|
$(".cartCpn").each(function(index) {
|
|
|
+ if (index == 0) {
|
|
|
+ custCpnApply($(this)); // 쿠폰적용
|
|
|
+ }
|
|
|
+
|
|
|
+ // 쿠폰 select 버튼기능
|
|
|
+ $(this).on("click", function(){
|
|
|
+ custCpnApply($(this)); // 쿠폰적용
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 포인트기능 리셋
|
|
|
+ pntDcAmtReset();
|
|
|
+}
|
|
|
+
|
|
|
+// 1.9.3 배송비쿠폰초기화
|
|
|
+var custDelvCpnInit = function() {
|
|
|
+ // 배송비쿠폰 초기화 적용
|
|
|
+ $(".delvCpn").each(function(index) {
|
|
|
if (index == 0) {
|
|
|
// 쿠폰적용
|
|
|
custCpnApply($(this));
|
|
|
}
|
|
|
+
|
|
|
+ // 쿠폰 select 버튼기능
|
|
|
+ $(this).on("click", function(){
|
|
|
+ // 쿠폰적용
|
|
|
+ custCpnApply($(this));
|
|
|
+ });
|
|
|
});
|
|
|
-
|
|
|
- // 포인트기능 리렛
|
|
|
- //pntDcAmtReset();
|
|
|
}
|
|
|
|
|
|
// 1.10 쿠폰중복사용체크
|
|
|
var custCpnDuplicationCheck = function(custCpnSq, index) {
|
|
|
var selCustSq = 0;
|
|
|
var cnt = 0;
|
|
|
+
|
|
|
+ // 쿠폰적용가능
|
|
|
+ if (custCpnSq == 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
// 쿠폰중본사용체크
|
|
|
$(".goodsCpn input[name='custCpnSq']").each(function(i){
|
|
|
@@ -1258,11 +1231,20 @@ var custCpnApply = function(obj) {
|
|
|
|
|
|
// 상품쿠폰적용
|
|
|
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"));
|
|
|
+
|
|
|
+ var cpnCartSq = obj.parent().parent().find("input[name='cpnCartSq']").val();
|
|
|
+
|
|
|
+ // 장바구니시퀀스 체크
|
|
|
+ $(".cartSq").each(function(){
|
|
|
+ if (cpnCartSq == $(this).text()) {
|
|
|
+ $(this).parent().find(".goodsCpnSq").text(obj.prop("value")); // 상품쿠폰시퀀스
|
|
|
+ $(this).parent().find(".goodsCpnDcAmt").text(obj.attr("data")); // 상품쿠폰할인금액
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
// 장바구니쿠폰적용
|
|
|
else if (cpnType == "cartCpn") {
|
|
|
@@ -1283,20 +1265,22 @@ var custCpnApply = function(obj) {
|
|
|
$(".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 = parseInt($(this).parent().find(".goodsCpnDcAmt").text());
|
|
|
|
|
|
- var tempAmt = orgCurrPrice - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
|
|
|
- tempSumAmt = tempSumAmt + tempAmt;
|
|
|
+ var tempAmt = ((orgCurrPrice - cpn1DcAmt) * goodsQty) - tmtb1DcAmt - tmtb2DcAmt - goodsCpnDcAmt;
|
|
|
+ tempSumAmt = tempSumAmt + tempAmt;
|
|
|
|
|
|
// 할인율일때 할인금액
|
|
|
if (dcWay == "G240_11") {
|
|
|
cartCpnDcAmt = (tempAmt * dcVal) / 100;
|
|
|
cartCpnDcSumAmt = cartCpnDcSumAmt + cartCpnDcAmt;
|
|
|
-
|
|
|
- $(this).parent().find(".cartCpnSq").val(obj.prop("value"));
|
|
|
- $(this).parent().find(".cartCpnDcAmt").val(cartCpnDcAmt);
|
|
|
+
|
|
|
+ $(this).parent().find(".cartCpnSq").text(obj.attr("value"));
|
|
|
+ $(this).parent().find(".cartCpnDcAmt").text(cartCpnDcAmt);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1345,127 +1329,53 @@ var custCpnApply = function(obj) {
|
|
|
obj.parent().find("input[name=cpnDcAmt]").val(cartCpnDcSumAmt);
|
|
|
obj.parent().find("input[name=custCpnSq]").val(obj.attr("value"));
|
|
|
}
|
|
|
- /*
|
|
|
// 배송비쿠폰적용
|
|
|
else if (cpnType == "delvCpn") {
|
|
|
- var delvFee = parseInt(obj.attr("delvfee"));
|
|
|
- var delvCpnDcAmt = parseInt(obj.attr("data"));
|
|
|
- var delvFeeCd = obj.attr("delvfeecd");
|
|
|
-
|
|
|
- // 배송비가 배송비쿠폰할인금액보다 클경우 배송비 - 배송비쿠폰할인금액을 적용
|
|
|
- if (delvFee > delvCpnDcAmt) {
|
|
|
- cpnDcAmt = delvFee - delvCpnDcAmt;
|
|
|
- } else {
|
|
|
- cpnDcAmt = delvFee;
|
|
|
- }
|
|
|
-
|
|
|
- // 적용된 할인금액 text 설정
|
|
|
- var dcAmtStr = "- " + cpnDcAmt.addComma() + " 원 할인적용";
|
|
|
+ // 적용안함 적용
|
|
|
+ var itemHtml = obj.find(".dlvr_coupon").html();
|
|
|
+ obj.parent().parent().find(".select .dlvr_coupon").html(itemHtml);
|
|
|
|
|
|
- obj.parent().parent().parent().parent().parent().find(".cp_amount").text(dcAmtStr);
|
|
|
+ obj.parent().find("input[name='cpnDcAmt']").val(obj.attr("data"));
|
|
|
+ obj.parent().find("input[name='custCpnSq']").val(obj.attr("value"));
|
|
|
+ obj.parent().find("input[name='delvFeeCd']").val(obj.attr("delvfeecd"));
|
|
|
|
|
|
- obj.parent().parent().find("input[name='cpnDcAmt']").val(cpnDcAmt);
|
|
|
- obj.parent().parent().find("input[name='delvFeeCd']").val(obj.attr("delvfeecd"));
|
|
|
+ var delvFeeCd = obj.attr("delvfeecd");
|
|
|
|
|
|
- $(".delvCpnDcSumAmt").text(obj.attr("data"));
|
|
|
-
|
|
|
// 배송비쿠폰 테이블 적용
|
|
|
$(".delvFeeCd").each(function(){
|
|
|
+ // 배송비쿠폰적용
|
|
|
if ($(this).text() == delvFeeCd) {
|
|
|
- $(this).parent().find(".delvCpnSq").text(obj.prop("value"));
|
|
|
+ $(this).parent().find(".delvCpnSq").text(obj.attr("value"));
|
|
|
+ $(this).parent().find(".delvCpnDcAmt").text(obj.attr("data"));
|
|
|
+ }
|
|
|
+ // 배송비쿠폰적용안함
|
|
|
+ else if (delvFeeCd == 0) {
|
|
|
+ $(this).parent().find(".delvCpnSq").text(obj.attr("value"));
|
|
|
$(this).parent().find(".delvCpnDcAmt").text(obj.attr("data"));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- */
|
|
|
-
|
|
|
- // select box 쿠폰 적용 (공통적용)
|
|
|
- obj.parent().find("input[name='custCpnSq']").val(obj.prop("value"));
|
|
|
-
|
|
|
- // 선택된 할인금액 노출
|
|
|
- //obj.parent().parent().parent().parent().parent().find(".cp_discount").css("display", "block");
|
|
|
|
|
|
// 포인트기능 리렛
|
|
|
- //pntDcAmtReset();
|
|
|
+ pntDcAmtReset();
|
|
|
|
|
|
}
|
|
|
|
|
|
// 1.12 쿠폰중복체크 후 적용불가
|
|
|
var custCpnNotApply = function(obj) {
|
|
|
- /*
|
|
|
// 이전에 등록된 쿠폰시퀀스
|
|
|
- var custCpnSq = obj.parent().parent().find("input[name='custCpnSq']").val();
|
|
|
+ var custCpnSq = obj.parent().find("input[name='custCpnSq']").val();
|
|
|
|
|
|
// 이전에 등록된 쿠폰시퀀스 비교후 데이타 원복
|
|
|
obj.parent().find("li").each(function(){
|
|
|
- if ($(this).prop("value") == custCpnSq) {
|
|
|
- $(this).parent().parent().find(".select").text($(this).text());
|
|
|
-
|
|
|
- if (custCpnSq == 0) {
|
|
|
- $(this).parent().parent().parent().parent().parent().find(".cp_discount").css("display", "none");
|
|
|
- } else {
|
|
|
- $(this).parent().parent().parent().parent().parent().find(".cp_discount").css("display", "block");
|
|
|
- }
|
|
|
+ if ($(this).attr("value") == custCpnSq) {
|
|
|
+ var itemHtml = $(this).find(".item_coupon").html();
|
|
|
+ obj.parent().parent().find(".select .item_coupon").html(itemHtml);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 포인트기능 리렛
|
|
|
pntDcAmtReset();
|
|
|
- */
|
|
|
-}
|
|
|
-
|
|
|
-// 1.13 쿠폰 선택없음 기능 구현
|
|
|
-var cpnApplyDel = function(obj) {
|
|
|
- /*
|
|
|
- // 쿠폰타입(상품쿠폰, 장바구니쿠폰, 배송비쿠폰)
|
|
|
- var cpnType = obj.parent().parent().find("input[name='cpnType']").val();
|
|
|
-
|
|
|
- // 상품쿠폰적용
|
|
|
- if (cpnType == "goodsCpn") {
|
|
|
- // select box 쿠폰 적용
|
|
|
- var cpnCartSq = obj.parent().parent().find("input[name='cpnCartSq']").val();
|
|
|
-
|
|
|
- // 장바구니시퀀스 체크
|
|
|
- $(".cartSq").each(function(){
|
|
|
- if (cpnCartSq == $(this).text()) {
|
|
|
- $(this).parent().find(".goodsCpnSq").text("0"); // 상품쿠폰시퀀스
|
|
|
- $(this).parent().find(".goodsCpnDcAmt").text("0"); // 상품쿠폰할인금액
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- // 장바구니쿠폰적용
|
|
|
- else if (cpnType == "cartCpn") {
|
|
|
- // 장바구니쿠폰 시퀀스 0, 장바구니할인금액 0
|
|
|
- $(".cartSq").each(function(){
|
|
|
- $(this).parent().find(".cartCpnSq").text("0");
|
|
|
- $(this).parent().find(".cartCpnDcAmt").text("0");
|
|
|
- });
|
|
|
- }
|
|
|
- // 배송비쿠폰적용
|
|
|
- else if (cpnType == "delvCpn") {
|
|
|
- // 장바구니쿠폰 시퀀스 0, 장바구니할인금액 0
|
|
|
- //$("input[name='custCpnSq']").each(function(){
|
|
|
- //$(this).parent().find("input[name='delvFeeCd']").val("0");
|
|
|
- //});
|
|
|
-
|
|
|
- obj.parent().parent().find("input[name='delvFeeCd']").val("0");
|
|
|
- $(".delvCpnSq").text("0");
|
|
|
- }
|
|
|
-
|
|
|
- obj.parent().parent().find("input[name='custCpnSq']").val("0");
|
|
|
- obj.parent().parent().find("input[name='cpnDcAmt']").val("0");
|
|
|
-
|
|
|
- obj.parent().parent().find(".select").text("선택없음");
|
|
|
- obj.parent().parent().parent().parent().parent().find(".cp_discount").css("display", "none");
|
|
|
-
|
|
|
- // 포인트기능 리렛
|
|
|
- pntDcAmtReset();
|
|
|
-
|
|
|
- // 최대할인혜택적용 체크해제
|
|
|
- if ($("#chk-maxdisc").is(":checked")) {
|
|
|
- $("#chk-maxdisc").attr("checked", false);
|
|
|
- }
|
|
|
- */
|
|
|
}
|
|
|
|
|
|
// 1.14 선포인트리셋기능 (사용안함)
|
|
|
@@ -1509,28 +1419,36 @@ var gfcdUseAmtReset = function() {
|
|
|
|
|
|
// 1.17 쿠폰할인금액합계설정(금액전체계산)
|
|
|
var custCpnSumAmtCal = function() {
|
|
|
- var cpnDcSumAmt = 0;
|
|
|
- var cpnApplyCnt = 0;
|
|
|
+ var cpnDcSumAmt = 0;
|
|
|
+ var cpnApplyCnt = 0;
|
|
|
+ var goodsCartCpnSumAmt = 0;
|
|
|
+ var cpnType = "";
|
|
|
|
|
|
$("input[name='cpnDcAmt']").each(function(){
|
|
|
+ cpnType = $(this).parent().find("input[name=cpnType]").val();
|
|
|
cpnDcSumAmt = cpnDcSumAmt + parseInt($(this).val());
|
|
|
|
|
|
// 적용된 쿠폰 수량
|
|
|
if (parseInt($(this).val()) > 0) {
|
|
|
cpnApplyCnt++;
|
|
|
}
|
|
|
+
|
|
|
+ // 상품, 장바구니쿠폰 할인 금액만 합계 적용
|
|
|
+ if (cpnType == "goodsCpn" || cpnType == "cartCpn") {
|
|
|
+ goodsCartCpnSumAmt = goodsCartCpnSumAmt + parseInt($(this).val());
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ // 상품, 장바구니쿠폰 할인 금액만 합계 적용
|
|
|
+ $(".modal-footer .goodsCartCpnSumAmt").text("-"+goodsCartCpnSumAmt.addComma());
|
|
|
+
|
|
|
// 쿠폰영역
|
|
|
if (cpnDcSumAmt > 0) {
|
|
|
- $(".maxdisc_amount").text("(-"+cpnDcSumAmt.addComma()+" 원)"); // 쿠폰할인금액합계
|
|
|
+ $(".maxdisc_amount .cpnDcAmt").text("-"+cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
} else {
|
|
|
- $(".maxdisc_amount").text("("+cpnDcSumAmt.addComma()+" 원)"); // 쿠폰할인금액합계
|
|
|
+ $(".maxdisc_amount .cpnDcAmt").text(cpnDcSumAmt.addComma()); // 쿠폰할인금액합계
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- $("#cpnApplyCnt").text(cpnApplyCnt + " 장");
|
|
|
-
|
|
|
// 상품목록영역
|
|
|
if (cpnDcSumAmt > 0) {
|
|
|
$("#couponDcSumAmt").text("-" + cpnDcSumAmt.addComma() + " 원"); // 쿠폰할인금액합계
|