|
|
@@ -446,7 +446,7 @@
|
|
|
</dl>
|
|
|
</div>
|
|
|
<div class="btn_box">
|
|
|
- <button class="btn btn_primary btn_block btn_md" onclick="fnSubmitNoMember('all')"><span>구매하기</span></button>
|
|
|
+ <button class="btn btn_primary btn_block btn_md" onclick="fnSubmitNoMember('all'); return false;"><span>구매하기</span></button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="area_salecoupon">
|
|
|
@@ -542,6 +542,7 @@
|
|
|
let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
|
|
|
let totDcAmt = [[${order.totDcAmt}]];
|
|
|
let loginInfo = [[${loginInfo}]];
|
|
|
+ let orderFlag = true;
|
|
|
|
|
|
function NotApplyTmtbCartList() {
|
|
|
let tmtbSq = 0;
|
|
|
@@ -570,7 +571,7 @@
|
|
|
cfnAddCart(compsList);*/
|
|
|
|
|
|
if([[${!order.shotCanYn.equals('Y')}]]) {
|
|
|
- //$(".shotDelvSelect").hide();
|
|
|
+ $(".shotDelvSelect").hide();
|
|
|
}
|
|
|
|
|
|
$("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
@@ -579,9 +580,6 @@
|
|
|
$("#cartListForm .area_salecoupon").hide();
|
|
|
}
|
|
|
|
|
|
- // 다다익선 할인 대상(미적용) 리스트
|
|
|
- // notApplyTmtbAreaList();
|
|
|
-
|
|
|
/* 세트상품 장바구니 */
|
|
|
/*let compsList = [];
|
|
|
let temp = new Object;
|
|
|
@@ -641,154 +639,6 @@
|
|
|
cfnAddCart(compsList);*/
|
|
|
});
|
|
|
|
|
|
- function notApplyTmtbAreaList() {
|
|
|
- /*let notApplyQtyTmtbList = new Array();
|
|
|
- let notApplyAmtTmtbList = new Array();
|
|
|
-
|
|
|
- // 수량 다다익선 조회
|
|
|
- $("#cartListForm input[name=qtyTmtbSq]").each(function (index) {
|
|
|
- if($(this).val() != "0" && $(this).parent().find("input[name=applyQtySectionYn]").val() == "N") {
|
|
|
- let obj = new Object();
|
|
|
- obj.tmtbSq = $(this).val();
|
|
|
- obj.tmtbNm = $(this).parent().find("input[name=qtyTmtbNm]").val();
|
|
|
- obj.currPrice = $(this).parent().find("input[name=currPrice]").val();
|
|
|
- obj.goodsNm = $(this).parent().find(".info_box").find(".name").text();
|
|
|
- obj.brandNm = $(this).parent().find(".info_box").find(".brand").text();
|
|
|
- obj.imgPath = $(this).parent().find(".info_item").find(".thumb_box img").attr("src");
|
|
|
-
|
|
|
- notApplyQtyTmtbList.push(obj);
|
|
|
- }
|
|
|
-
|
|
|
- if($(this).parent().find("input[name=applyAmtSectionYn]").val() == "N") { // 다다익선 금액은 기본상품만 가져오면됨 (N은 기본상품에 걸려있음)
|
|
|
- let obj = new Object();
|
|
|
- obj.tmtbSq = $(this).parent().find("input[name=amtTmtbSq]").val();
|
|
|
- obj.tmtbNm = $(this).parent().find("input[name=amtTmtbNm]").val();
|
|
|
-
|
|
|
- notApplyAmtTmtbList.push(obj);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 수량 다다익선 정렬
|
|
|
- var t = new Object();
|
|
|
- for (let i = 0; i < notApplyQtyTmtbList.length; i++) {
|
|
|
- for (let j = 0; j < notApplyQtyTmtbList.length - i - 1; j++) {
|
|
|
- if (notApplyQtyTmtbList[j].tmtbSq > notApplyQtyTmtbList[j + 1].tmtbSq) {
|
|
|
- t = notApplyQtyTmtbList[j];
|
|
|
- notApplyQtyTmtbList[j] = notApplyQtyTmtbList[j + 1];
|
|
|
- notApplyQtyTmtbList[j + 1] = t;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList);*/
|
|
|
- }
|
|
|
-
|
|
|
- /*function fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList) {
|
|
|
- // 정렬 후 같은 다다익선 상품은 한 배열로 묶음
|
|
|
- let tmtbQtyList = new Array();
|
|
|
-
|
|
|
- for (let i = 0; i < notApplyQtyTmtbList.length; i++) {
|
|
|
- let goods = notApplyQtyTmtbList[i];
|
|
|
- let tmtbInfo = new Object();
|
|
|
- let chk = false;
|
|
|
- for (let j = 0; j < tmtbQtyList.length; j++) {
|
|
|
- let tmtb = tmtbQtyList[j];
|
|
|
- if (goods.tmtbSq == tmtb.tmtbSq) {
|
|
|
- tmtbInfo = tmtbQtyList[j];
|
|
|
- chk = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 현재 상품 정보
|
|
|
- let goodsInfo = new Object();
|
|
|
- goodsInfo.brandNm = goods.brandNm;
|
|
|
- goodsInfo.goodsNm = goods.goodsNm;
|
|
|
- goodsInfo.imgPath = goods.imgPath;
|
|
|
- goodsInfo.currPrice = goods.currPrice;
|
|
|
-
|
|
|
- // 현재 상품 정보 다다익선 정보에 세팅
|
|
|
- if (chk) {
|
|
|
- tmtbInfo.goodsList.push(goodsInfo);
|
|
|
- } else {
|
|
|
- let obj = new Object();
|
|
|
- obj.tmtbSq = goods.tmtbSq;
|
|
|
- obj.tmtbNm = goods.tmtbNm;
|
|
|
- obj.goodsList = new Array();
|
|
|
- obj.goodsList.push(goodsInfo);
|
|
|
- tmtbQtyList.push(obj);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 수량 다다익선 HTML 작성
|
|
|
- let tmtbHtml = "";
|
|
|
- for(let i = 0 ; i < tmtbQtyList.length ; i++) {
|
|
|
- let tmtb = tmtbQtyList[i];
|
|
|
- tmtbHtml += '<div class="more_sale qtyNotApplyTmtbList">';
|
|
|
- for(let j = 0 ; j < tmtb.goodsList.length ; j++) {
|
|
|
- let goods = tmtb.goodsList[j];
|
|
|
- tmtbHtml += '<div class="item_gd">\n' +
|
|
|
- ' <figure>\n' +
|
|
|
- ' <a href="">\n' +
|
|
|
- ' <span class="thumb"><img src="';
|
|
|
- tmtbHtml += goods.imgPath;
|
|
|
- tmtbHtml += '" alt=""></span>\n' +
|
|
|
- ' </a>\n' +
|
|
|
- ' <figcaption>\n' +
|
|
|
- ' <a href="">\n' +
|
|
|
- ' <div class="brand">';
|
|
|
- tmtbHtml += goods.brandNm;
|
|
|
- tmtbHtml += '</div>\n' +
|
|
|
- ' <div class="name">';
|
|
|
- tmtbHtml += goods.goodsNm;
|
|
|
- tmtbHtml += '</div>\n' +
|
|
|
- ' <div class="price">\n' +
|
|
|
- ' <span class="selling_price">';
|
|
|
- tmtbHtml += Number(goods.currPrice).toLocaleString();
|
|
|
- tmtbHtml += '</span>\n' +
|
|
|
- ' </div>\n' +
|
|
|
- ' </a>\n' +
|
|
|
- ' </figcaption>\n' +
|
|
|
- ' </figure>\n' +
|
|
|
- ' </div>';
|
|
|
- }
|
|
|
-
|
|
|
- tmtbHtml += '<div class="txt">\n' +
|
|
|
- ' <a href="">\n' +
|
|
|
- ' <i class="ico ico_saletag"></i>\n' +
|
|
|
- ' <input type="hidden" name="tmtbSq" value="' + tmtb.tmtbSq + '" />' +
|
|
|
- ' <span>\n';
|
|
|
- tmtbHtml += tmtb.tmtbNm;
|
|
|
- tmtbHtml += '</span>\n' +
|
|
|
- ' </a>\n' +
|
|
|
- ' </div>\n' +
|
|
|
- ' </div>';
|
|
|
- }
|
|
|
-
|
|
|
- // 금액 다다익선 정보 HTML 작성
|
|
|
- for(let i = 0 ; i < notApplyAmtTmtbList.length ; i++) {
|
|
|
- if (notApplyAmtTmtbList[i].tmtbSq != 0) {
|
|
|
- let tmtb = notApplyAmtTmtbList[i];
|
|
|
- tmtbHtml += '<div class="more_sale amtNotApplyTmtbList">\n' +
|
|
|
- ' <div class="txt">\n' +
|
|
|
- ' <a href="">\n' +
|
|
|
- ' <i class="ico ico_saletag"></i>\n' +
|
|
|
- ' <input type="hidden" name="tmtbSq" value="' + tmtb.tmtbSq + '" />' +
|
|
|
- ' <span>';
|
|
|
- tmtbHtml += tmtb.tmtbNm;
|
|
|
- tmtbHtml += '</span>\n' +
|
|
|
- ' </a>\n' +
|
|
|
- ' </div>\n' +
|
|
|
- ' </div>';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(tmtbHtml != "") {
|
|
|
- tmtbHtml = "<h4>다다익선 할인 대상이 있습니다.</h4>" + tmtbHtml;
|
|
|
- }
|
|
|
-
|
|
|
- $(".area_saleitem").html(tmtbHtml);
|
|
|
- }*/
|
|
|
-
|
|
|
function cancelCartCpn() {
|
|
|
$("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
$("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
@@ -1015,25 +865,20 @@
|
|
|
$("#cartListForm .shotCartInfo input[name=cartSq]").each(function() {
|
|
|
if(shotList[i].cartSq == $(this).val()) {
|
|
|
let shot = shotList[i];
|
|
|
- // $(this).parent().find(".thumb_box img").attr("src", result.imgPath1 + "/" + wms.sysImgNm);
|
|
|
$(this).parent().find(".od_moresale .applyTmtbNm > ul").html("");
|
|
|
$(this).parent().find(".od_moresale .notApplyTmtbNm > ul").html("");
|
|
|
|
|
|
// 다다익선 적용 정보 생성성
|
|
|
if(shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + shot.qtyTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + shot.amtTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + shot.qtyTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
$(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + shot.amtTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
$(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
|
|
|
@@ -1042,7 +887,6 @@
|
|
|
$(this).parent().find(".calc_box .price_sale").text(Number(shot.tmtbDcAmt).toLocaleString() + " 원");
|
|
|
$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(shot.currPrice).toLocaleString() + "</em>원</span></p>");
|
|
|
$(this).parent().find("input[name=tmtbDcAmt]").val(shot.tmtbDcAmt);
|
|
|
- //$(this).parent().find(".calc_box .price").append("<del>" + Number(wms.currPrice).toLocaleString() + " 원</del>");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1053,25 +897,20 @@
|
|
|
$("#cartListForm .wmsCartInfo input[name=cartSq]").each(function() {
|
|
|
if(wmsList[i].cartSq == $(this).val()) {
|
|
|
let wms = wmsList[i];
|
|
|
- // $(this).parent().find(".thumb_box img").attr("src", result.imgPath1 + "/" + wms.sysImgNm);
|
|
|
$(this).parent().find(".od_moresale .applyTmtbNm > ul").html("");
|
|
|
$(this).parent().find(".od_moresale .notApplyTmtbNm > ul").html("");
|
|
|
|
|
|
// 다다익선 적용 정보 생성성
|
|
|
if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + wms.qtyTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + wms.amtTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + wms.qtyTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
$(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + wms.amtTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
$(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
|
|
|
@@ -1080,7 +919,6 @@
|
|
|
$(this).parent().find(".calc_box .price_sale").text(Number(wms.tmtbDcAmt).toLocaleString() + " 원");
|
|
|
$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(wms.currPrice).toLocaleString() + "</em>원</span></p>");
|
|
|
$(this).parent().find("input[name=tmtbDcAmt]").val(wms.tmtbDcAmt);
|
|
|
- //$(this).parent().find(".calc_box .price").append("<del>" + Number(wms.currPrice).toLocaleString() + " 원</del>");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -1092,7 +930,6 @@
|
|
|
} else {
|
|
|
let html = "<span class='dlvr_fee'>배송비 <em>" + Number(order.wmsDelvFee).toLocaleString() + "</em> 원</span><a href='#' class='btn_popup_save'>배송비 SAVE 상품 보기</a>";
|
|
|
$(".selfGoodsDelv").html(html);
|
|
|
- // $(".wmsList").find(".delv_" + wms.delvFeeCd).append("<span class='dlvr_shop'>" + wms.supplyCompNm + " 업체직배송</span>");
|
|
|
}
|
|
|
|
|
|
for(let i = 0 ; i < delvList.length ; i++) {
|
|
|
@@ -1100,26 +937,20 @@
|
|
|
$("#cartListForm .delvList .delvCartInfo input[name=cartSq]").each(function() {
|
|
|
if(delvList[i].cartSq == $(this).val()) {
|
|
|
let delv = delvList[i];
|
|
|
- // $(this).parent().find(".thumb_box img").attr("src", result.imgPath1 + "/" + wms.sysImgNm);
|
|
|
$(this).parent().find(".od_moresale .applyTmtbNm > ul").html("");
|
|
|
$(this).parent().find(".od_moresale .notApplyTmtbNm > ul").html("");
|
|
|
|
|
|
// 다다익선 적용 정보 생성성
|
|
|
if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + delv.qtyTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "Y") {
|
|
|
- //$(this).parent().find(".applyTmtb .applyTmtbNm > ul").append("<li>" + delv.amtTmtbNm + "</li>");
|
|
|
$(this).parent().find(".applyTmtb").show();
|
|
|
}
|
|
|
if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + delv.qtyTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
$(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "N") {
|
|
|
- //$(this).parent().find(".notApplyTmtb .notApplyTmtbNm > ul").append("<li>" + delv.amtTmtbNm + "<a href=''>대상 상품 보기</a></li>");
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
}
|
|
|
|
|
|
// 다다익선 할인가 적용
|
|
|
@@ -1127,7 +958,6 @@
|
|
|
$(this).parent().find(".calc_box .price_sale").text(Number(delv.tmtbDcAmt).toLocaleString() + " 원");
|
|
|
$(this).parent().find(".calc_box").prepend("<p><span class='price_org'><em>" + Number(delv.currPrice).toLocaleString() + "</em>원</span></p>");
|
|
|
$(this).parent().find("input[name=tmtbDcAmt]").val(delv.tmtbDcAmt);
|
|
|
- //$(this).parent().find(".calc_box .price").append("<del>" + Number(delv.currPrice).toLocaleString() + " 원</del>");
|
|
|
}
|
|
|
|
|
|
if(delv.delvFee == 0) {
|
|
|
@@ -1154,46 +984,6 @@
|
|
|
$("#cartListForm .sumRealPayAmt").text(Number(order.sumRealPayAmt + order.totDelvFee).toLocaleString());
|
|
|
cancelCartCpn();
|
|
|
}
|
|
|
-
|
|
|
- /*let notApplyQtyTmtbList = new Array();
|
|
|
- let notApplyAmtTmtbList = new Array();
|
|
|
- for(let i = 0 ; i < cartList.length ; i++) {
|
|
|
- let cart = cartList[i];
|
|
|
- if(cart.applyQtySectionYn == "N") {
|
|
|
- let obj = new Object();
|
|
|
- obj.tmtbSq = cart.qtyTmtbSq;
|
|
|
- obj.tmtbNm = cart.qtyTmtbNm;
|
|
|
- obj.currPrice = cart.currPrice;
|
|
|
- obj.goodsNm = cart.goodsNm;
|
|
|
- obj.brandNm = cart.brandEnm + " " + cart.brandKnm;
|
|
|
- obj.imgPath = order.imgPath1 + "/" + cart.sysImgNm;
|
|
|
-
|
|
|
- notApplyQtyTmtbList.push(obj);
|
|
|
- }
|
|
|
-
|
|
|
- if(cart.applyAmtSectionYn == "N") {
|
|
|
- let obj = new Object();
|
|
|
- obj.tmtbSq = cart.amtTmtbSq;
|
|
|
- obj.tmtbNm = cart.amtTmtbNm;
|
|
|
-
|
|
|
- notApplyAmtTmtbList.push(obj);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 수량 다다익선 정렬
|
|
|
- var t = new Object();
|
|
|
- for (let i = 0; i < notApplyQtyTmtbList.length; i++) {
|
|
|
- for (let j = 0; j < notApplyQtyTmtbList.length - i - 1; j++) {
|
|
|
- if (notApplyQtyTmtbList[j].tmtbSq > notApplyQtyTmtbList[j + 1].tmtbSq) {
|
|
|
- t = notApplyQtyTmtbList[j];
|
|
|
- notApplyQtyTmtbList[j] = notApplyQtyTmtbList[j + 1];
|
|
|
- notApplyQtyTmtbList[j + 1] = t;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 다다익선 적용 대상 상품 노출
|
|
|
- fnCreateNotApplyTmtbAreaList(notApplyQtyTmtbList, notApplyAmtTmtbList);*/
|
|
|
}
|
|
|
|
|
|
//옵션변경 팝업열기
|
|
|
@@ -1204,7 +994,6 @@
|
|
|
dataType : 'html',
|
|
|
data : {cartSq : cartSq},
|
|
|
success : function(result) {
|
|
|
- //fnChangeCartListInfo(result);
|
|
|
$("#cartOptionModal").remove();
|
|
|
$("#optModifyPop").html(result);
|
|
|
$("#optModifyPop").modal("show");
|
|
|
@@ -1212,120 +1001,176 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // 상품상세 페이지 이동 처리
|
|
|
- /*var fnGoToGoodsDetail = function(param) {
|
|
|
- let goodsCd = $(param).attr('goodsCd');
|
|
|
- cfnGoToPage(_PAGE_GOODS_DETAIL + goodsCd);
|
|
|
- }*/
|
|
|
-
|
|
|
- // 주문하기
|
|
|
- function fnSubmitNoMember(cartSq) {
|
|
|
- let cartSqArr = [];
|
|
|
-
|
|
|
- if($("#cartListForm input[name=cartSqArr]:checked").length < 1) {
|
|
|
- mcxDialog.alert("구매하실 상품을 선택해주세요.");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // 선택된 장바구니 번호
|
|
|
- $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
- cartSqArr.push($(this).val());
|
|
|
- });
|
|
|
-
|
|
|
- // 선택된 장바구니 정보 가공
|
|
|
- let data = { cartSqArr : cartSqArr
|
|
|
- , custNo : loginInfo.custNo
|
|
|
+ function fnOrderValidation(list, listIndex, cartSqArr, allYn) {
|
|
|
+ // listIndex가 -1이면 (마지막이 지난후)
|
|
|
+ if(listIndex == - 1) {
|
|
|
+ if(allYn == "Y") {
|
|
|
+ if(orderFlag) {
|
|
|
+ $("#cartListForm").submit();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(orderFlag) {
|
|
|
+ let html = "<input type='hidden' name='cartSqArr' value='" + cartSqArr + "' />";
|
|
|
+ html += "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
|
|
|
+ $("#cartInfoForm").html(html);
|
|
|
+ $("#cartInfoForm").submit();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- let jsonData = JSON.stringify(data);
|
|
|
|
|
|
- $.ajax( {
|
|
|
- type: "POST",
|
|
|
- url : '/cart/order/list/check',
|
|
|
- contentType: 'application/json',
|
|
|
- dataType : 'json',
|
|
|
- data : jsonData,
|
|
|
- success : function(result) {
|
|
|
- if(result == null || result.length == 0) {
|
|
|
- mcxDialog.alert("주문 가능한 상품이 존재하지 않습니다. 새로고침 후 다시 시도해주세요.");
|
|
|
- } else {
|
|
|
- for(let i = 0 ; i < result.length ; i++) {
|
|
|
- let removeCartSq = 0;
|
|
|
- let updateCartSq = 0;
|
|
|
- let goodsQty = 0;
|
|
|
- if(result.ordCanYn == "N") {
|
|
|
- mcxDialog.confirm(result.goodsNm + " 상품은 구매 할 수 없습니다. 제외하고 계속 주문하시겠습니까?", {
|
|
|
- cancelBtnText: "취소", //취소 또는 닫기 버튼명
|
|
|
- sureBtnText: "확인", //처리문 버튼명
|
|
|
- sureBtnClick: function(){
|
|
|
- removeCartSq = result.cartSq;
|
|
|
+ let info = list[listIndex];
|
|
|
+ let removeCartSq = 0, updateCartSq = 0, goodsQty = 0;
|
|
|
+ listIndex++;
|
|
|
+
|
|
|
+ // list[listIndex]가 null이 아니라면
|
|
|
+ if(info != null) {
|
|
|
+ if (info.ordCanYn == "N") { // 주문 불가
|
|
|
+ mcxDialog.confirmC(info.goodsNm + " 상품은 구매 할 수 없습니다. 제외하고 계속 주문하시겠습니까?", { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false;
|
|
|
+ return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ // 체크박스 해제
|
|
|
+ $("#cartListForm input[name=cartSqArr]").each(function () {
|
|
|
+ if ($(this).val() == info.cartSq) {
|
|
|
+ $(this).prop("checked", false);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ // 장바구니 선택된것 삭제 > cartSq 0으로 변경
|
|
|
+ for (let i = 0; i < cartSqArr.length; i++) {
|
|
|
+ if (cartSqArr[i] == info.cartSq) {
|
|
|
+ cartSqArr[i] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
}
|
|
|
- if(result.soldoutYn == "Y") {
|
|
|
- if(result.goodsStat == "G008_70" || result.ordCanQty < result.minOrdQty) {
|
|
|
- mcxDialog.confirm(result.goodsNm + " 상품은 품절입니다. 제외하고 계속 주문하시겠습니까?", {
|
|
|
- cancelBtnText: "취소", //취소 또는 닫기 버튼명
|
|
|
- sureBtnText: "확인", //처리문 버튼명
|
|
|
- sureBtnClick: function(){
|
|
|
- removeCartSq = result.cartSq;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (info.soldoutYn == "Y") { // 품절
|
|
|
+ if (info.goodsStat == "G008_70" || info.ordCanQty < info.minOrdQty) { // 상품 상태가 품절이거나 주문 가능 수량이 최소주문수량보다 적을경우
|
|
|
+ mcxDialog.confirmC(info.goodsNm + " 상품은 품절입니다. 제외하고 계속 주문하시겠습니까?", { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false;
|
|
|
+ return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ // 체크박스 해제
|
|
|
+ $("#cartListForm input[name=cartSqArr]").each(function () {
|
|
|
+ if ($(this).val() == info.cartSq) {
|
|
|
+ $(this).prop("checked", false);
|
|
|
}
|
|
|
});
|
|
|
- } else if (result.ordCanQty == 0) {
|
|
|
- mcxDialog.confirm(result.goodsNm + "의 " + result.colorNm + " 옵션이 품절되었습니다. 제외하고 계속 주문하시겠습니까?", {
|
|
|
- cancelBtnText: "취소", //취소 또는 닫기 버튼명
|
|
|
- sureBtnText: "확인", //처리문 버튼명
|
|
|
- sureBtnClick: function(){
|
|
|
- removeCartSq = result.cartSq;
|
|
|
+
|
|
|
+ // 장바구니 선택된것 삭제 > cartSq 0으로 변경
|
|
|
+ for (let i = 0; i < cartSqArr.length; i++) {
|
|
|
+ if (cartSqArr[i] == info.cartSq) {
|
|
|
+ cartSqArr[i] = 0;
|
|
|
}
|
|
|
- });
|
|
|
- } else if (result.ordCanQty == 0) {
|
|
|
- let message = "";
|
|
|
- if("G056_S" == result.goodsType) {
|
|
|
- message = result.goodsNm + " 의" + result.itemNm + "/" + result.colorNm + "/" + result.optCd2 + "의 수량이 부족합니다. 구매가능 수량은 " + result.minOrdQty + "개입니다. 구매가능 수량만큼 주문하시겠습니까?";
|
|
|
- } else {
|
|
|
- message = result.goodsNm + " 의" + result.colorNm + "/" + result.optCd2 + "의 수량이 부족합니다. 구매가능 수량은 " + result.minOrdQty + "개입니다. 구매가능 수량만큼 주문하시겠습니까?";
|
|
|
}
|
|
|
- mcxDialog.confirm(message, {
|
|
|
- cancelBtnText: "취소", //취소 또는 닫기 버튼명
|
|
|
- sureBtnText: "확인", //처리문 버튼명
|
|
|
- sureBtnClick: function(){
|
|
|
- updateCartSq = result.cartSq;
|
|
|
- goodsQty = result.minOrdQty;
|
|
|
- }
|
|
|
- });
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
}
|
|
|
}
|
|
|
+ });
|
|
|
+ } else if (info.ordCanQty == 0) { // 주문 가능 수량이 0일경우
|
|
|
+ mcxDialog.confirmC(info.goodsNm + "의 " + info.colorNm + " 옵션이 품절되었습니다. 제외하고 계속 주문하시겠습니까?", { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false;
|
|
|
+ return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ // 체크박스 해제
|
|
|
+ $("#cartListForm input[name=cartSqArr]").each(function () {
|
|
|
+ if ($(this).val() == info.cartSq) {
|
|
|
+ $(this).prop("checked", false);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- if(removeCartSq > 0) {
|
|
|
- // 장바구니 선택된것 삭제 > cartSq 0으로 만들면 될듯함.
|
|
|
- for(let i = 0 ; i < cartSqArr.length ; i++) {
|
|
|
- if(cartSqArr[i] == removeCartSq) {
|
|
|
- cartSqArr[i] = 0;
|
|
|
+ // 장바구니 선택된것 삭제 > cartSq 0으로 변경
|
|
|
+ for (let i = 0; i < cartSqArr.length; i++) {
|
|
|
+ if (cartSqArr[i] == info.cartSq) {
|
|
|
+ cartSqArr[i] = 0;
|
|
|
+ }
|
|
|
}
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
}
|
|
|
}
|
|
|
- if(updateCartSq > 0) {
|
|
|
- // 장바구니 goodsQty update
|
|
|
- updateGoodsQty(updateCartSq, goodsQty);
|
|
|
+ });
|
|
|
+ } else if (listIndex < list.length) {
|
|
|
+ // 혹시 else일 경우
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ }
|
|
|
+ } else if (info.minOrdQty > info.goodsQty) { // 최소 주문 수량보다 장바구니에 적게 들어왔을 경우
|
|
|
+ let message;
|
|
|
+ if ("G056_S" == info.goodsType) {
|
|
|
+ message = info.goodsNm + " 의" + info.itemNm + "/" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.minOrdQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
+ } else {
|
|
|
+ message = info.goodsNm + " 의" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.minOrdQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
+ }
|
|
|
+
|
|
|
+ mcxDialog.confirmC(message, { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false;
|
|
|
+ return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ updateGoodsQty(info.cartSq, info.minOrdQty);
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ } else if (listIndex < list.length) {
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ } else {
|
|
|
+ fnOrderValidation(list, -1, cartSqArr, allYn);
|
|
|
}
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ fnOrderValidation(list, -1, cartSqArr, allYn);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 주문하기
|
|
|
+ function fnSubmitNoMember(cartSq) {
|
|
|
+ let cartSqArr = [];
|
|
|
+ orderFlag = true;
|
|
|
|
|
|
- /*if(loginInfo == null || loginInfo.custNo == null || loginInfo.custNo == 0) {
|
|
|
+ if($("#cartListForm input[name=cartSqArr]:checked").length < 1) {
|
|
|
+ mcxDialog.alert("구매하실 상품을 선택해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(loginInfo == null || loginInfo.custNo == null || loginInfo.custNo == 0) {
|
|
|
var btn = ["비회원 구매", "로그인 후 구매"];
|
|
|
mcxDialog.confirmC("로그인 후 구매 시 다양한 혜택을 받으실 수 있습니다.", { //내용
|
|
|
btn: btn,
|
|
|
btnClick: function(index){
|
|
|
if (index == 1){ //button1 일때 처리문
|
|
|
if(cartSq == "all") {
|
|
|
- $("#cartListForm").submit();
|
|
|
+ // 선택된 장바구니 번호
|
|
|
+ $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
+ cartSqArr.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ fnOrderCheck(cartSqArr, 0, "Y");
|
|
|
+
|
|
|
+ /*if(orderFlag) {
|
|
|
+ $("#cartListForm").submit();
|
|
|
+ }*/
|
|
|
} else {
|
|
|
- let html = "<input type='hidden' name='cartSqArr' value='" + cartSq + "' />";
|
|
|
- html += "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
|
|
|
- $("#cartInfoForm").html(html);
|
|
|
- $("#cartInfoForm").submit();
|
|
|
+ fnOrderCheck(cartSq, 0, "N");
|
|
|
+
|
|
|
+ /*if(orderFlag) {
|
|
|
+ let html = "<input type='hidden' name='cartSqArr' value='" + cartSq + "' />";
|
|
|
+ html += "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
|
|
|
+ $("#cartInfoForm").html(html);
|
|
|
+ $("#cartInfoForm").submit();
|
|
|
+ }*/
|
|
|
}
|
|
|
} else { //button2 일때 처리문
|
|
|
location.href="/signin";
|
|
|
@@ -1334,31 +1179,66 @@
|
|
|
});
|
|
|
} else {
|
|
|
if(cartSq == "all") {
|
|
|
- $("#cartListForm").submit();
|
|
|
+ // 선택된 장바구니 번호
|
|
|
+ $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
+ cartSqArr.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ fnOrderCheck(cartSqArr, loginInfo.custNo, "Y");
|
|
|
+
|
|
|
+ /*if(orderFlag) {
|
|
|
+ $("#cartListForm").submit();
|
|
|
+ }*/
|
|
|
} else {
|
|
|
- let html = "<input type='hidden' name='cartSqArr' value='" + cartSq + "' />";
|
|
|
- html += "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
|
|
|
- $("#cartInfoForm").html(html);
|
|
|
- $("#cartInfoForm").submit();
|
|
|
+ fnOrderCheck(cartSq, loginInfo.custNo, "N");
|
|
|
+
|
|
|
+ /*if(orderFlag) {
|
|
|
+ let html = "<input type='hidden' name='cartSqArr' value='" + cartSq + "' />";
|
|
|
+ html += "<input type='hidden' name='shotDelvUseYn' value='" + $("input[name=shotDelvUseYn]:checked").val() + "' />";
|
|
|
+ $("#cartInfoForm").html(html);
|
|
|
+ $("#cartInfoForm").submit();
|
|
|
+ }*/
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- // 장바구니 구매 수량 변경
|
|
|
- function updateGoodsQty(cartSq, goodsQty) {
|
|
|
+ function fnOrderCheck(cartSq, custNo, allYn) {
|
|
|
+ // 선택된 장바구니 정보 가공
|
|
|
+ let data = { cartSqArr : cartSq
|
|
|
+ , custNo : custNo
|
|
|
+ }
|
|
|
+ let jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
$.ajax( {
|
|
|
type: "POST",
|
|
|
- url : '/cart/update/goodsQty',
|
|
|
+ url : '/cart/order/list/check',
|
|
|
contentType: 'application/json',
|
|
|
dataType : 'json',
|
|
|
- data : {cartSq : cartSq,
|
|
|
- goodsQty : goodsQty},
|
|
|
+ data : jsonData,
|
|
|
success : function(result) {
|
|
|
-
|
|
|
+ if(result == null || result.length == 0) {
|
|
|
+ mcxDialog.alert("주문 가능한 상품이 존재하지 않습니다. 새로고침 후 다시 시도해주세요.");
|
|
|
+ } else {
|
|
|
+ fnOrderValidation(result, 0, cartSq, allYn);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 장바구니 구매 수량 변경
|
|
|
+ function updateGoodsQty(cartSq, goodsQty) {
|
|
|
+ let url = '/cart/update/goodsQty';
|
|
|
+ // 선택된 장바구니 정보 가공
|
|
|
+ let data = { cartSq : cartSq
|
|
|
+ , goodsQty : goodsQty
|
|
|
+ }
|
|
|
+ let jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
+ gagajf.ajaxJsonSubmit(url, jsonData, function(result) {
|
|
|
+ //alert(result.changeQty);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function fnGoToGoodsDetail(goodsCd) {
|
|
|
cfnGoToPage(_PAGE_GOODS_DETAIL + goodsCd);
|
|
|
}
|