|
|
@@ -449,7 +449,7 @@
|
|
|
</div>
|
|
|
<div class="coupon_box">
|
|
|
<div class="coupon">
|
|
|
- <button type="button" class="btn_delete"><span><em class="sr-only">쿠폰닫기</em></span></button>
|
|
|
+ <button type="button" class="btn_delete" onclick="cancelCartCpn()"><span><em class="sr-only">쿠폰닫기</em></span></button>
|
|
|
<div>
|
|
|
<p class="cp_name"></p>
|
|
|
<p class="cp_cont">
|
|
|
@@ -623,604 +623,611 @@
|
|
|
<button type="button" id="btn_purchase" class="btn btn_primary"><span>구매하기 (<em class="realOrderQtyText" th:text="${order.totCartCnt}"></em>개)</span></button> <!-- 210406_ID 추가 -->
|
|
|
</div>
|
|
|
</div>
|
|
|
- </form>
|
|
|
|
|
|
- <!-- 쿠폰사용안내 팝업 -->
|
|
|
- <div class="modal fade couponInfo_pop cartCpnInfoModal" id="couponInfoPop" tabindex="-1" role="dialog" aria-labelledby="couponInfoLabel" aria-hidden="true">
|
|
|
- <div class="modal-dialog" role="document">
|
|
|
- <div class="modal-content">
|
|
|
- <div class="modal-header">
|
|
|
- <h5 class="modal-title" id="couponInfoLabel"></h5>
|
|
|
- </div>
|
|
|
- <div class="modal-body">
|
|
|
- <div class="pop_cont">
|
|
|
- <dl>
|
|
|
- <div>
|
|
|
- <dt>사용조건</dt>
|
|
|
- <dd class="cpnCondition"></dd>
|
|
|
- </div>
|
|
|
- <div class="cartCpnPubLimitQty">
|
|
|
- <dt>발급수량</dt>
|
|
|
- <dd class="custPubLimitQtyTxt"></dd>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <dt>유효기간</dt>
|
|
|
- <dd class="availDt"></dd>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <dt>대상조건</dt>
|
|
|
- <dd class="refVal"></dd>
|
|
|
- </div>
|
|
|
- </dl>
|
|
|
+ <!-- 쿠폰사용안내 팝업 -->
|
|
|
+ <div class="modal fade couponInfo_pop cartCpnInfoModal" id="couponInfoPop" tabindex="-1" role="dialog" aria-labelledby="couponInfoLabel" aria-hidden="true">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title" id="couponInfoLabel"></h5>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="pop_cont">
|
|
|
+ <dl>
|
|
|
+ <div>
|
|
|
+ <dt>사용조건</dt>
|
|
|
+ <dd class="cpnCondition"></dd>
|
|
|
+ </div>
|
|
|
+ <div class="cartCpnPubLimitQty">
|
|
|
+ <dt>발급수량</dt>
|
|
|
+ <dd class="custPubLimitQtyTxt"></dd>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <dt>유효기간</dt>
|
|
|
+ <dd class="availDt"></dd>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <dt>대상조건</dt>
|
|
|
+ <dd class="refVal"></dd>
|
|
|
+ </div>
|
|
|
+ </dl>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <a href="#close-modal" rel="modal:close" id="couponInfoPop_close" class="close-modal">Close</a>
|
|
|
</div>
|
|
|
- <a href="#close-modal" rel="modal:close" id="couponInfoPop_close" class="close-modal">Close</a>
|
|
|
- </div>
|
|
|
- <!-- //쿠폰사용안내 팝업 -->
|
|
|
-
|
|
|
- <!-- 옵션변경 팝업 -->
|
|
|
- <div id="optModifyPop01" class="popup_box optModifyPop optModifyPop01"></div>
|
|
|
- <!-- //옵션변경 팝업 -->
|
|
|
-
|
|
|
- <script th:inline="javascript">
|
|
|
- let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
|
|
|
- let totDcAmt = [[${order.totDcAmt}]];
|
|
|
- let loginInfo = [[${loginInfo}]];
|
|
|
- let orderFlag = true;
|
|
|
-
|
|
|
- $(document).ready(function() {
|
|
|
- if([[${!order.shotCanYn.equals('Y')}]]) {
|
|
|
- //$(".shotDelvSelect").hide();
|
|
|
- }
|
|
|
+ <!-- //쿠폰사용안내 팝업 -->
|
|
|
|
|
|
- $("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
+ <!-- 옵션변경 팝업 -->
|
|
|
+ <div id="optModifyPop01" class="popup_box optModifyPop optModifyPop01"></div>
|
|
|
+ <!-- //옵션변경 팝업 -->
|
|
|
|
|
|
- if(!loginInfo || loginInfo.custNo == null || loginInfo.custNo == 0) {
|
|
|
- $("#cartListForm .area_salecoupon").parent().hide();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- function cancelCartCpn() {
|
|
|
- $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
- $("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
- $("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
-
|
|
|
- $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
- }
|
|
|
-
|
|
|
- function serialCpnApply() {
|
|
|
- let cartArr = [];
|
|
|
- let currPrices = [];
|
|
|
- $("#cartListForm input[name=cartSqArr]:checked").each(function(index, item) {
|
|
|
- cartArr.push($(this).val());
|
|
|
- currPrices.push($(this).parents(".cartInfo").find("input[name=tmtbDcAmt]").val());
|
|
|
- });
|
|
|
+ <script th:inline="javascript">
|
|
|
+ let sumRealPayAmt = [[${order.sumRealPayAmt + order.totDelvFee}]];
|
|
|
+ let totDcAmt = [[${order.totDcAmt}]];
|
|
|
+ let loginInfo = [[${loginInfo}]];
|
|
|
+ let orderFlag = true;
|
|
|
|
|
|
- let data = {
|
|
|
- rdCpnNm : $("#cartListForm #serialCpnNm").val(),
|
|
|
- cartSqArr : cartArr,
|
|
|
- currPrices : currPrices
|
|
|
- }
|
|
|
+ $(document).ready(function() {
|
|
|
+ if([[${!order.shotCanYn.equals('Y')}]]) {
|
|
|
+ //$(".shotDelvSelect").hide();
|
|
|
+ }
|
|
|
|
|
|
- let jsonData = JSON.stringify(data);
|
|
|
-
|
|
|
- $.ajax( {
|
|
|
- type: "POST",
|
|
|
- url : '/cart/list/serialCpnApply',
|
|
|
- contentType: 'application/json',
|
|
|
- dataType : 'json',
|
|
|
- data : jsonData,
|
|
|
- success : function(result) {
|
|
|
- if(result.serialCpnInfo.result == "SUCCESS") {
|
|
|
- let cpnInfo = result.serialCpnInfo;
|
|
|
- $("#cartListForm .area_salecoupon .coupon_box").show();
|
|
|
-
|
|
|
- // 합계 금액
|
|
|
- if(cartArr.length > 0) {
|
|
|
- $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
- $("#cartListForm #totDcAmt").text(Number(totDcAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
- $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
- }
|
|
|
+ $("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
|
|
|
- // 쿠폰 정보
|
|
|
- $("#cartListForm .area_salecoupon .cp_name").text(cpnInfo.cpnNm);
|
|
|
- $("#cartListForm .area_salecoupon .cp_condition").html(cpnInfo.cpnDesc + "<span><em class='tag'>1장 보유</em></span>");
|
|
|
- $("#cartListForm .area_salecoupon .availStdt").text(cpnInfo.availStdt);
|
|
|
- $("#cartListForm .area_salecoupon .availEddt").text(cpnInfo.availEddt);
|
|
|
- if (cpnInfo.dcWay == "G240_10") {
|
|
|
- $("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + Number(cpnInfo.dcVal).toLocaleString() + "</em> 원");
|
|
|
- } else if (cpnInfo.dcWay == "G240_11") {
|
|
|
- $("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + cpnInfo.dcVal + "%</em>");
|
|
|
- }
|
|
|
+ if(!loginInfo || loginInfo.custNo == null || loginInfo.custNo == 0) {
|
|
|
+ $("#cartListForm .area_salecoupon").parent().hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- let conditionComment = "", refValComment = "";
|
|
|
+ function cancelCartCpn() {
|
|
|
+ $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
+ $("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
+ $("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
|
|
|
- if(cpnInfo.buyLimitAmt > 0) { conditionComment += "<span>" + Number(cpnInfo.buyLimitAmt).toLocaleString() + "</span>원 이상 구매 시 "; }
|
|
|
- if(cpnInfo.maxDcAmt > 0) { conditionComment += "최대 <span>" + Number(cpnInfo.maxDcAmt).toLocaleString() + "</span>원 할인"; }
|
|
|
+ $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
+ }
|
|
|
|
|
|
- if("A" == cpnInfo.applyScope) {
|
|
|
- refValComment += "전체<br/>";
|
|
|
- } else {
|
|
|
- if(cpnInfo.refCateCnt > 0) {
|
|
|
- refValComment += cpnInfo.refCateNm + " 카테고리";
|
|
|
- if(cpnInfo.refCateCnt > 1) { refValComment += " 外"; }
|
|
|
- refValComment += "<br/>";
|
|
|
- }
|
|
|
- if(cpnInfo.refSupplyCompCnt > 0) {
|
|
|
- refValComment += cpnInfo.refSupplyCompNm + " 업체";
|
|
|
- if(cpnInfo.refSupplyCompCnt > 1) { refValComment += " 外"; }
|
|
|
- refValComment += "<br/>";
|
|
|
- }
|
|
|
- if(cpnInfo.refBrandCnt > 0) {
|
|
|
- refValComment += cpnInfo.refBrandNm;
|
|
|
- refValComment += " 브랜드";
|
|
|
- if(cpnInfo.refBrandCnt > 2) { refValComment += " 外"; }
|
|
|
- refValComment += "<br/>";
|
|
|
- }
|
|
|
- if(cpnInfo.refGoodsCnt > 0) {
|
|
|
- refValComment += cpnInfo.refGoodsNm + " 상품";
|
|
|
- if(cpnInfo.refGoodsCnt > 1) { refValComment += " 外"; }
|
|
|
- refValComment += "<br/>";
|
|
|
- }
|
|
|
- }
|
|
|
- refValComment += "일부상품, 특가상품 제외";
|
|
|
+ function serialCpnApply() {
|
|
|
+ let cartArr = [];
|
|
|
+ let currPrices = [];
|
|
|
+ $("#cartListForm input[name=cartSqArr]:checked").each(function(index, item) {
|
|
|
+ cartArr.push($(this).val());
|
|
|
+ currPrices.push($(this).parents(".cartInfo").find("input[name=tmtbDcAmt]").val());
|
|
|
+ });
|
|
|
|
|
|
- $(".cartCpnInfoModal .modal-header").html('<h5 class="modal-title" id="couponInfoLabel">' + cpnInfo.cpnNm + '</h5>');
|
|
|
+ let data = {
|
|
|
+ rdCpnNm : $("#cartListForm #serialCpnNm").val(),
|
|
|
+ cartSqArr : cartArr,
|
|
|
+ currPrices : currPrices
|
|
|
+ }
|
|
|
|
|
|
- if(conditionComment != "") { $(".cartCpnInfoModal .cpnCondition").html(conditionComment); }
|
|
|
- else { $(".cartCpnInfoModal .cartCpnCondition").hide(); }
|
|
|
+ let jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
+ $.ajax( {
|
|
|
+ type: "POST",
|
|
|
+ url : '/cart/list/serialCpnApply',
|
|
|
+ contentType: 'application/json',
|
|
|
+ dataType : 'json',
|
|
|
+ data : jsonData,
|
|
|
+ success : function(result) {
|
|
|
+ if(result.serialCpnInfo.result == "SUCCESS") {
|
|
|
+ let cpnInfo = result.serialCpnInfo;
|
|
|
+ $("#cartListForm .area_salecoupon .coupon_box").show();
|
|
|
+
|
|
|
+ // 합계 금액
|
|
|
+ if(cartArr.length > 0) {
|
|
|
+ $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
+ $("#cartListForm #totDcAmt").text(Number(totDcAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
+ $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt - cpnInfo.dcAmt).toLocaleString());
|
|
|
+ }
|
|
|
|
|
|
- if(cpnInfo.custPubLimitQty > 0) { $(".cartCpnInfoModal .custPubLimitQtyTxt").html("1인 최대 <span>" + Number(cpnInfo.custPubLimitQty).toLocaleString() + "</span>매"); }
|
|
|
- else { $(".cartCpnInfoModal .cartCpnPubLimitQty").hide(); }
|
|
|
+ // 쿠폰 정보
|
|
|
+ $("#cartListForm .area_salecoupon .cp_name").text(cpnInfo.cpnNm);
|
|
|
+ $("#cartListForm .area_salecoupon .cp_condition").html(cpnInfo.cpnDesc + "<span><em class='tag'>1장 보유</em></span>");
|
|
|
+ $("#cartListForm .area_salecoupon .availStdt").text(cpnInfo.availStdt);
|
|
|
+ $("#cartListForm .area_salecoupon .availEddt").text(cpnInfo.availEddt);
|
|
|
+ if (cpnInfo.dcWay == "G240_10") {
|
|
|
+ $("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + Number(cpnInfo.dcVal).toLocaleString() + "</em> 원");
|
|
|
+ } else if (cpnInfo.dcWay == "G240_11") {
|
|
|
+ $("#cartListForm .area_salecoupon .cp_dc_val").html("<em>" + cpnInfo.dcVal + "%</em>");
|
|
|
+ }
|
|
|
|
|
|
- $(".cartCpnInfoModal .availDt").html('<span>' + cpnInfo.availStdtTime + "</span> ~ <span>" + cpnInfo.availEddtTime + "</span>");
|
|
|
- $(".cartCpnInfoModal .refVal").html(refValComment);
|
|
|
- } else {
|
|
|
- mcxDialog.alert(result.serialCpnInfo.result);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ let conditionComment = "", refValComment = "";
|
|
|
|
|
|
- $("input[name=cartSqArr]").on("change", function(e) {
|
|
|
- changeCartSqArr();
|
|
|
- });
|
|
|
+ if(cpnInfo.buyLimitAmt > 0) { conditionComment += "<span>" + Number(cpnInfo.buyLimitAmt).toLocaleString() + "</span>원 이상 구매 시 "; }
|
|
|
+ if(cpnInfo.maxDcAmt > 0) { conditionComment += "최대 <span>" + Number(cpnInfo.maxDcAmt).toLocaleString() + "</span>원 할인"; }
|
|
|
|
|
|
- function changeCartSqArr() {
|
|
|
- let cartArr = [];
|
|
|
+ if("A" == cpnInfo.applyScope) {
|
|
|
+ refValComment += "전체<br/>";
|
|
|
+ } else {
|
|
|
+ if(cpnInfo.refCateCnt > 0) {
|
|
|
+ refValComment += cpnInfo.refCateNm + " 카테고리";
|
|
|
+ if(cpnInfo.refCateCnt > 1) { refValComment += " 外"; }
|
|
|
+ refValComment += "<br/>";
|
|
|
+ }
|
|
|
+ if(cpnInfo.refSupplyCompCnt > 0) {
|
|
|
+ refValComment += cpnInfo.refSupplyCompNm + " 업체";
|
|
|
+ if(cpnInfo.refSupplyCompCnt > 1) { refValComment += " 外"; }
|
|
|
+ refValComment += "<br/>";
|
|
|
+ }
|
|
|
+ if(cpnInfo.refBrandCnt > 0) {
|
|
|
+ refValComment += cpnInfo.refBrandNm;
|
|
|
+ refValComment += " 브랜드";
|
|
|
+ if(cpnInfo.refBrandCnt > 2) { refValComment += " 外"; }
|
|
|
+ refValComment += "<br/>";
|
|
|
+ }
|
|
|
+ if(cpnInfo.refGoodsCnt > 0) {
|
|
|
+ refValComment += cpnInfo.refGoodsNm + " 상품";
|
|
|
+ if(cpnInfo.refGoodsCnt > 1) { refValComment += " 外"; }
|
|
|
+ refValComment += "<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ refValComment += "일부상품, 특가상품 제외";
|
|
|
|
|
|
- // 선택된 장바구니 번호
|
|
|
- $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
- cartArr.push($(this).val());
|
|
|
- });
|
|
|
+ $(".cartCpnInfoModal .modal-header").html('<h5 class="modal-title" id="couponInfoLabel">' + cpnInfo.cpnNm + '</h5>');
|
|
|
|
|
|
- // 선택된 장바구니 정보 가공
|
|
|
- let data = { cartSqArr : cartArr }
|
|
|
- let jsonData = JSON.stringify(data);
|
|
|
-
|
|
|
- $.ajax( {
|
|
|
- type: "POST",
|
|
|
- url : '/cart/change/goods/list',
|
|
|
- contentType: 'application/json',
|
|
|
- dataType : 'json',
|
|
|
- data : jsonData,
|
|
|
- success : function(result) {
|
|
|
- fnChangeCartListInfo(result);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function fnChangeCartListInfo(order) {
|
|
|
- let shotList = order.shotCartList;
|
|
|
- let wmsList = order.wmsCartList;
|
|
|
- let delvList = order.delvCartList;
|
|
|
- let cartList = new Array();
|
|
|
-
|
|
|
- // 다다익선 정보 숨김
|
|
|
- $("#cartListForm .applyTmtb").hide();
|
|
|
- $("#cartListForm .notApplyTmtb").hide();
|
|
|
-
|
|
|
- // 장바구니 각 상품 가격 정보 할인 전으로 변경
|
|
|
- $("#cartListForm .cartInfo input[name=cartSq]").each(function() {
|
|
|
- if($(this).parent().find(".calc_box .price_org").text() != "") {
|
|
|
- $(this).parent().find(".calc_box .price_sale").text($(this).parent().find(".calc_box .price_org").text());
|
|
|
- $(this).parent().find(".calc_box .price_org").remove();
|
|
|
- }
|
|
|
- });
|
|
|
+ if(conditionComment != "") { $(".cartCpnInfoModal .cpnCondition").html(conditionComment); }
|
|
|
+ else { $(".cartCpnInfoModal .cartCpnCondition").hide(); }
|
|
|
|
|
|
- $("#cartListForm").find(".delvFeeArea").html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
|
|
|
- for(let i = 0 ; i < shotList.length ; i++) {
|
|
|
- cartList.push(shotList[i]);
|
|
|
- $("#cartListForm .shotCartInfo input[name=cartSq]").each(function() {
|
|
|
- if(shotList[i].cartSq == $(this).val()) {
|
|
|
- let shot = shotList[i];
|
|
|
- $(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").show();
|
|
|
- }
|
|
|
- if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "Y") {
|
|
|
- $(this).parent().find(".applyTmtb").show();
|
|
|
- }
|
|
|
- if(shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "N") {
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
- }
|
|
|
- if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "N") {
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
- }
|
|
|
+ if(cpnInfo.custPubLimitQty > 0) { $(".cartCpnInfoModal .custPubLimitQtyTxt").html("1인 최대 <span>" + Number(cpnInfo.custPubLimitQty).toLocaleString() + "</span>매"); }
|
|
|
+ else { $(".cartCpnInfoModal .cartCpnPubLimitQty").hide(); }
|
|
|
|
|
|
- // 다다익선 할인가 적용
|
|
|
- if(shot.tmtbDcAmt < shot.currPrice) {
|
|
|
- $(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);
|
|
|
+ $(".cartCpnInfoModal .availDt").html('<span>' + cpnInfo.availStdtTime + "</span> ~ <span>" + cpnInfo.availEddtTime + "</span>");
|
|
|
+ $(".cartCpnInfoModal .refVal").html(refValComment);
|
|
|
+ } else {
|
|
|
+ mcxDialog.alert(result.serialCpnInfo.result);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- for(let i = 0 ; i < wmsList.length ; i++) {
|
|
|
- cartList.push(wmsList[i]);
|
|
|
- $("#cartListForm .wmsCartInfo input[name=cartSq]").each(function() {
|
|
|
- if(wmsList[i].cartSq == $(this).val()) {
|
|
|
- let wms = wmsList[i];
|
|
|
- $(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").show();
|
|
|
- }
|
|
|
- if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "Y") {
|
|
|
- $(this).parent().find(".applyTmtb").show();
|
|
|
- }
|
|
|
- if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") {
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
- }
|
|
|
- if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N") {
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
- }
|
|
|
+ $("input[name=cartSqArr]").on("change", function(e) {
|
|
|
+ changeCartSqArr();
|
|
|
+ });
|
|
|
|
|
|
- // 다다익선 할인가 적용
|
|
|
- if(wms.tmtbDcAmt < wms.currPrice) {
|
|
|
- $(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);
|
|
|
- }
|
|
|
+ function changeCartSqArr() {
|
|
|
+ let cartArr = [];
|
|
|
+
|
|
|
+ // 선택된 장바구니 번호
|
|
|
+ $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
+ cartArr.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ // 선택된 장바구니 정보 가공
|
|
|
+ let data = { cartSqArr : cartArr }
|
|
|
+ let jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
+ $.ajax( {
|
|
|
+ type: "POST",
|
|
|
+ url : '/cart/change/goods/list',
|
|
|
+ contentType: 'application/json',
|
|
|
+ dataType : 'json',
|
|
|
+ data : jsonData,
|
|
|
+ success : function(result) {
|
|
|
+ fnChangeCartListInfo(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // 자사 상품 배송비
|
|
|
- if(order.wmsDelvFee == 0) {
|
|
|
- $(".selfGoodsDelv").html("<span class='dlvr_fee'>배송비 무료</span>");
|
|
|
- } 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);
|
|
|
- }
|
|
|
+ function fnChangeCartListInfo(order) {
|
|
|
+ let shotList = order.shotCartList;
|
|
|
+ let wmsList = order.wmsCartList;
|
|
|
+ let delvList = order.delvCartList;
|
|
|
+ let cartList = new Array();
|
|
|
+
|
|
|
+ // 다다익선 정보 숨김
|
|
|
+ $("#cartListForm .applyTmtb").hide();
|
|
|
+ $("#cartListForm .notApplyTmtb").hide();
|
|
|
+
|
|
|
+ // 장바구니 각 상품 가격 정보 할인 전으로 변경
|
|
|
+ $("#cartListForm .cartInfo input[name=cartSq]").each(function() {
|
|
|
+ if($(this).parent().find(".calc_box .price_org").text() != "") {
|
|
|
+ $(this).parent().find(".calc_box .price_sale").text($(this).parent().find(".calc_box .price_org").text());
|
|
|
+ $(this).parent().find(".calc_box .price_org").remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- for(let i = 0 ; i < delvList.length ; i++) {
|
|
|
- cartList.push(delvList[i]);
|
|
|
- $("#cartListForm .delvList .delvCartInfo input[name=cartSq]").each(function() {
|
|
|
- if(delvList[i].cartSq == $(this).val()) {
|
|
|
- let delv = delvList[i];
|
|
|
- $(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").show();
|
|
|
- }
|
|
|
- if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "Y") {
|
|
|
- $(this).parent().find(".applyTmtb").show();
|
|
|
- }
|
|
|
- if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "N") {
|
|
|
- $(this).parent().find(".notApplyTmtb").show();
|
|
|
- }
|
|
|
- if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "N") {
|
|
|
+ $("#cartListForm").find(".delvFeeArea").html("<div class='info_dlvr'><span class='dlvr_fee'>배송비 무료</span></div>");
|
|
|
+ for(let i = 0 ; i < shotList.length ; i++) {
|
|
|
+ cartList.push(shotList[i]);
|
|
|
+ $("#cartListForm .shotCartInfo input[name=cartSq]").each(function() {
|
|
|
+ if(shotList[i].cartSq == $(this).val()) {
|
|
|
+ let shot = shotList[i];
|
|
|
+ $(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").show();
|
|
|
+ }
|
|
|
+ if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "Y") {
|
|
|
+ $(this).parent().find(".applyTmtb").show();
|
|
|
+ }
|
|
|
+ if(shot.qtyTmtbSq > 0 && shot.applyQtySectionYn == "N") {
|
|
|
+ $(this).parent().find(".notApplyTmtb").show();
|
|
|
+ }
|
|
|
+ if(shot.amtTmtbSq > 0 && shot.applyAmtSectionYn == "N") {
|
|
|
+ $(this).parent().find(".notApplyTmtb").show();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 다다익선 할인가 적용
|
|
|
+ if(shot.tmtbDcAmt < shot.currPrice) {
|
|
|
+ $(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);
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 다다익선 할인가 적용
|
|
|
- if(delv.tmtbDcAmt < delv.currPrice) {
|
|
|
- $(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);
|
|
|
+ for(let i = 0 ; i < wmsList.length ; i++) {
|
|
|
+ cartList.push(wmsList[i]);
|
|
|
+ $("#cartListForm .wmsCartInfo input[name=cartSq]").each(function() {
|
|
|
+ if(wmsList[i].cartSq == $(this).val()) {
|
|
|
+ let wms = wmsList[i];
|
|
|
+ $(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").show();
|
|
|
+ }
|
|
|
+ if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "Y") {
|
|
|
+ $(this).parent().find(".applyTmtb").show();
|
|
|
+ }
|
|
|
+ if(wms.qtyTmtbSq > 0 && wms.applyQtySectionYn == "N") {
|
|
|
+ $(this).parent().find(".notApplyTmtb").show();
|
|
|
+ }
|
|
|
+ if(wms.amtTmtbSq > 0 && wms.applyAmtSectionYn == "N") {
|
|
|
+ $(this).parent().find(".notApplyTmtb").show();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 다다익선 할인가 적용
|
|
|
+ if(wms.tmtbDcAmt < wms.currPrice) {
|
|
|
+ $(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);
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- if(delv.delvFee == 0) {
|
|
|
- $(".delvList").find(".delv_" + delv.delvFeeCd).html("<span class='dlvr_fee'>배송비 무료</span><span class='dlvr_fee'><em>" + delv.supplyCompNm + "</em> 업체직배송</span>");
|
|
|
- } else {
|
|
|
- let html = "<div className='order_delivery'><span class='dlvr_fee'>배송비 <em>" + Number(delv.delvFee).toLocaleString() + "</em>원</span><span class='dlvr_shop'><em>" + delv.supplyCompNm + "</em> 업체직배송</span><a href='#' className='btn_popup_save'>배송비 SAVE 상품 보기</a></div>";
|
|
|
- $(".delvList").find(".delv_" + delv.delvFeeCd).html(html);
|
|
|
+ // 자사 상품 배송비
|
|
|
+ if(order.wmsDelvFee == 0) {
|
|
|
+ $(".selfGoodsDelv").html("<span class='dlvr_fee'>배송비 무료</span>");
|
|
|
+ } 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(let i = 0 ; i < delvList.length ; i++) {
|
|
|
+ cartList.push(delvList[i]);
|
|
|
+ $("#cartListForm .delvList .delvCartInfo input[name=cartSq]").each(function() {
|
|
|
+ if(delvList[i].cartSq == $(this).val()) {
|
|
|
+ let delv = delvList[i];
|
|
|
+ $(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").show();
|
|
|
+ }
|
|
|
+ if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "Y") {
|
|
|
+ $(this).parent().find(".applyTmtb").show();
|
|
|
+ }
|
|
|
+ if(delv.qtyTmtbSq > 0 && delv.applyQtySectionYn == "N") {
|
|
|
+ $(this).parent().find(".notApplyTmtb").show();
|
|
|
+ }
|
|
|
+ if(delv.amtTmtbSq > 0 && delv.applyAmtSectionYn == "N") {
|
|
|
+ }
|
|
|
+
|
|
|
+ // 다다익선 할인가 적용
|
|
|
+ if(delv.tmtbDcAmt < delv.currPrice) {
|
|
|
+ $(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);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(delv.delvFee == 0) {
|
|
|
+ $(".delvList").find(".delv_" + delv.delvFeeCd).html("<span class='dlvr_fee'>배송비 무료</span><span class='dlvr_fee'><em>" + delv.supplyCompNm + "</em> 업체직배송</span>");
|
|
|
+ } else {
|
|
|
+ let html = "<div className='order_delivery'><span class='dlvr_fee'>배송비 <em>" + Number(delv.delvFee).toLocaleString() + "</em>원</span><span class='dlvr_shop'><em>" + delv.supplyCompNm + "</em> 업체직배송</span><a href='#' className='btn_popup_save'>배송비 SAVE 상품 보기</a></div>";
|
|
|
+ $(".delvList").find(".delv_" + delv.delvFeeCd).html(html);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 결제 총액 영역 수정
|
|
|
- $("#cartListForm .checkSelectCartListCnt").text(Number(order.totCartCnt).toLocaleString());
|
|
|
- $("#cartListForm .sumListPrice").text(Number(order.sumListPrice).toLocaleString());
|
|
|
- $("#cartListForm .totDelvFee").text(Number(order.totDelvFee).toLocaleString());
|
|
|
- sumRealPayAmt = order.sumRealPayAmt + order.totDelvFee;
|
|
|
- totDcAmt = order.totDcAmt;
|
|
|
-
|
|
|
- // 하단 구매하기 버튼 수량 및 금액 변경
|
|
|
- $("#bottomOrderArea .realOrderQtyText").text(Number(order.totCartCnt).toLocaleString());
|
|
|
- $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
-
|
|
|
- // 할인코드 쿠폰 금액 재확인
|
|
|
- if($("#cartListForm #serialCpnNm").val()) {
|
|
|
- serialCpnApply();
|
|
|
- } else {
|
|
|
- $("#cartListForm .totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
- $("#cartListForm .sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
- cancelCartCpn();
|
|
|
- }
|
|
|
- }
|
|
|
+ // 결제 총액 영역 수정
|
|
|
+ $("#cartListForm .checkSelectCartListCnt").text(Number(order.totCartCnt).toLocaleString());
|
|
|
+ $("#cartListForm .sumListPrice").text(Number(order.sumListPrice).toLocaleString());
|
|
|
+ $("#cartListForm .totDelvFee").text(Number(order.totDelvFee).toLocaleString());
|
|
|
+ sumRealPayAmt = order.sumRealPayAmt + order.totDelvFee;
|
|
|
+ totDcAmt = order.totDcAmt;
|
|
|
+
|
|
|
+ // 하단 구매하기 버튼 수량 및 금액 변경
|
|
|
+ $("#bottomOrderArea .realOrderQtyText").text(Number(order.totCartCnt).toLocaleString());
|
|
|
+ $("#bottomOrderArea .realOrderAmtText").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
|
|
|
- function fnOrderValidation(list, listIndex, cartSqArr, allYn) {
|
|
|
- // listIndex가 -1이면 (마지막이 지난후)
|
|
|
- if(listIndex == - 1) {
|
|
|
- if(allYn == "Y" && orderFlag) {
|
|
|
- $("#cartListForm").submit();
|
|
|
+ // 할인코드 쿠폰 금액 재확인
|
|
|
+ if($("#cartListForm #serialCpnNm").val()) {
|
|
|
+ serialCpnApply();
|
|
|
} 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();
|
|
|
- }
|
|
|
+ $("#cartListForm .totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
+ $("#cartListForm .sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
+ cancelCartCpn();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let info = list[listIndex];
|
|
|
- let removeCartSq = 0, updateCartSq = 0, goodsQty = 0;
|
|
|
- listIndex++;
|
|
|
-
|
|
|
- // list[listIndex]가 null이 아니라면
|
|
|
- if(info != null) {
|
|
|
- if (info.ordCanYn == "N") { // 주문 불가
|
|
|
- let message = info.goodsNm + " 상품은 구매 할 수 없습니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
- fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn);
|
|
|
- } else if (info.soldoutYn == "Y") { // 품절
|
|
|
- if (info.goodsStat == "G008_70" || info.ordCanQty < info.minOrdQty) { // 상품 상태가 품절이거나 주문 가능 수량이 최소주문수량보다 적을경우
|
|
|
- let message = info.goodsNm + " 상품은 품절입니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
- fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
|
|
|
- } else if (info.goodsQty < info.ordCanQty) { // 주문 가능 수량이 0일경우
|
|
|
- let message = info.goodsNm + "의 " + info.colorNm + " 옵션이 품절되었습니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
- fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
|
|
|
+ function fnOrderValidation(list, listIndex, cartSqArr, allYn) {
|
|
|
+ // listIndex가 -1이면 (마지막이 지난후)
|
|
|
+ if(listIndex == - 1) {
|
|
|
+ if(allYn == "Y" && 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 info = list[listIndex];
|
|
|
+ let removeCartSq = 0, updateCartSq = 0, goodsQty = 0;
|
|
|
+ listIndex++;
|
|
|
+
|
|
|
+ // list[listIndex]가 null이 아니라면
|
|
|
+ if(info != null) {
|
|
|
+ if (info.ordCanYn == "N") { // 주문 불가
|
|
|
+ let message = info.goodsNm + " 상품은 구매 할 수 없습니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
+ fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn);
|
|
|
+ } else if (info.soldoutYn == "Y") { // 품절
|
|
|
+ if (info.goodsStat == "G008_70" || info.ordCanQty < info.minOrdQty) { // 상품 상태가 품절이거나 주문 가능 수량이 최소주문수량보다 적을경우
|
|
|
+ let message = info.goodsNm + " 상품은 품절입니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
+ fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
|
|
|
+ } else if (info.goodsQty < info.ordCanQty) { // 주문 가능 수량이 0일경우
|
|
|
+ let message = info.goodsNm + "의 " + info.colorNm + " 옵션이 품절되었습니다. 제외하고 계속 주문하시겠습니까?";
|
|
|
+ fnRemoveCartSqConfirm(message, cartSqArr, info.cartSq, list, listIndex, allYn)
|
|
|
+ } else if (listIndex < list.length) {
|
|
|
+ // 혹시 else일 경우
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ }
|
|
|
+ } else if (info.ordCanQty < info.goodsQty) { // 최소 주문 수량보다 장바구니에 적게 들어왔을 경우
|
|
|
+ let message;
|
|
|
+ if ("G056_S" == info.goodsType) {
|
|
|
+ message = info.goodsNm + " 의" + info.itemNm + "/" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
+ } else {
|
|
|
+ message = info.goodsNm + " 의" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
+ }
|
|
|
+
|
|
|
+ fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
|
|
|
+ } else if (info.goodsQty < info.minOrdQty) {
|
|
|
+ let message = info.goodsNm + " 의 최소 구매수량은 " + info.minOrdQty + "개입니다.\n최소 구매 수량으로 주문하시겠습니까?";
|
|
|
+ fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
|
|
|
+ } else if (info.goodsQty > info.maxOrdQty) {
|
|
|
+ let message = info.goodsNm + " 의 최대 구매 사능 수량은 " + info.maxOrdQty + "개입니다. 최대 구매 가능한 수량으로 주문하시겠습니까?";
|
|
|
+ fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
|
|
|
} else if (listIndex < list.length) {
|
|
|
- // 혹시 else일 경우
|
|
|
fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
- }
|
|
|
- } else if (info.ordCanQty < info.goodsQty) { // 최소 주문 수량보다 장바구니에 적게 들어왔을 경우
|
|
|
- let message;
|
|
|
- if ("G056_S" == info.goodsType) {
|
|
|
- message = info.goodsNm + " 의" + info.itemNm + "/" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
} else {
|
|
|
- message = info.goodsNm + " 의" + info.colorNm + "/" + info.optCd2 + "의 수량이 부족합니다.\n구매가능 수량은 " + info.ordCanQty + "개입니다.\n구매가능 수량만큼 주문하시겠습니까?";
|
|
|
+ fnOrderValidation(list, -1, cartSqArr, allYn);
|
|
|
}
|
|
|
-
|
|
|
- fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
|
|
|
- } else if (info.goodsQty < info.minOrdQty) {
|
|
|
- let message = info.goodsNm + " 의 최소 구매수량은 " + info.minOrdQty + "개입니다.\n최소 구매 수량으로 주문하시겠습니까?";
|
|
|
- fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, list, listIndex, cartSqArr, allYn);
|
|
|
- } else if (info.goodsQty > info.maxOrdQty) {
|
|
|
- let message = info.goodsNm + " 의 최대 구매 사능 수량은 " + info.maxOrdQty + "개입니다. 최대 구매 가능한 수량으로 주문하시겠습니까?";
|
|
|
- fnUpdateConfirmChangeQty(message, info.cartSq, info.minOrdQty, 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 fnUpdateConfirmChangeQty(message, cartSq, goodsQty, list, listIndex, cartSqArr, allYn) {
|
|
|
- mcxDialog.confirmC(message, { //내용
|
|
|
- btn : ["취소", "확인"],
|
|
|
- btnClick: function (index) {
|
|
|
- if (index == 1) { //button1 일때 처리문
|
|
|
- orderFlag = false; return false;
|
|
|
- } else { //button2 일때 처리문
|
|
|
- updateGoodsQty(cartSq, goodsQty);
|
|
|
- fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+
|
|
|
+ function fnUpdateConfirmChangeQty(message, cartSq, goodsQty, list, listIndex, cartSqArr, allYn) {
|
|
|
+ mcxDialog.confirmC(message, { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false; return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ updateGoodsQty(cartSq, goodsQty);
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- function fnRemoveCartSqConfirm(message, cartSqArr, cartSq, list, listIndex, allYn) {
|
|
|
- mcxDialog.confirmC(message, { //내용
|
|
|
- btn : ["취소", "확인"],
|
|
|
- btnClick: function (index) {
|
|
|
- if (index == 1) { //button1 일때 처리문
|
|
|
- orderFlag = false; return false;
|
|
|
- } else { //button2 일때 처리문
|
|
|
- fnCheckOffCartSqArr(cartSqArr, info.cartSq);
|
|
|
- fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function fnRemoveCartSqConfirm(message, cartSqArr, cartSq, list, listIndex, allYn) {
|
|
|
+ mcxDialog.confirmC(message, { //내용
|
|
|
+ btn : ["취소", "확인"],
|
|
|
+ btnClick: function (index) {
|
|
|
+ if (index == 1) { //button1 일때 처리문
|
|
|
+ orderFlag = false; return false;
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ fnCheckOffCartSqArr(cartSqArr, info.cartSq);
|
|
|
+ fnOrderValidation(list, listIndex, cartSqArr, allYn);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- function fnCheckOffCartSqArr(cartSqArr, cartSq) {
|
|
|
- // 체크박스 해제
|
|
|
- $("#cartListForm input[name=cartSqArr]").each(function () {
|
|
|
- if ($(this).val() == cartSq) {
|
|
|
- $(this).prop("checked", false);
|
|
|
- }
|
|
|
- });
|
|
|
+ function fnCheckOffCartSqArr(cartSqArr, cartSq) {
|
|
|
+ // 체크박스 해제
|
|
|
+ $("#cartListForm input[name=cartSqArr]").each(function () {
|
|
|
+ if ($(this).val() == cartSq) {
|
|
|
+ $(this).prop("checked", false);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 장바구니 선택된것 삭제 > cartSq 0으로 변경
|
|
|
- for (let i = 0; i < cartSqArr.length; i++) {
|
|
|
- if (cartSqArr[i] == cartSq) {
|
|
|
- cartSqArr[i] = 0;
|
|
|
+ // 장바구니 선택된것 삭제 > cartSq 0으로 변경
|
|
|
+ for (let i = 0; i < cartSqArr.length; i++) {
|
|
|
+ if (cartSqArr[i] == cartSq) {
|
|
|
+ cartSqArr[i] = 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // 주문하기
|
|
|
- function fnSubmitNoMember(cartSq) {
|
|
|
- let cartSqArr = [];
|
|
|
- orderFlag = true;
|
|
|
+ // 주문하기
|
|
|
+ function fnSubmitNoMember(cartSq) {
|
|
|
+ let cartSqArr = [];
|
|
|
+ orderFlag = true;
|
|
|
|
|
|
- if($("#cartListForm input[name=cartSqArr]:checked").length < 1) {
|
|
|
- mcxDialog.alert("구매하실 상품을 선택해주세요.");
|
|
|
- return false;
|
|
|
- }
|
|
|
+ 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 input[name=cartSqArr]:checked").each(function () {
|
|
|
- cartSqArr.push($(this).val());
|
|
|
- });
|
|
|
-
|
|
|
- fnOrderCheck(cartSqArr, 0, "Y");
|
|
|
- } else {
|
|
|
- fnOrderCheck(cartSq, 0, "N");
|
|
|
+ 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 input[name=cartSqArr]:checked").each(function () {
|
|
|
+ cartSqArr.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ fnOrderCheck(cartSqArr, 0, "Y");
|
|
|
+ } else {
|
|
|
+ fnOrderCheck(cartSq, 0, "N");
|
|
|
+ }
|
|
|
+ } else { //button2 일때 처리문
|
|
|
+ location.href="/signin";
|
|
|
}
|
|
|
- } else { //button2 일때 처리문
|
|
|
- location.href="/signin";
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if(cartSq == "all") {
|
|
|
- // 선택된 장바구니 번호
|
|
|
- $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
- cartSqArr.push($(this).val());
|
|
|
});
|
|
|
-
|
|
|
- fnOrderCheck(cartSqArr, loginInfo.custNo, "Y");
|
|
|
} else {
|
|
|
- fnOrderCheck(cartSq, loginInfo.custNo, "N");
|
|
|
+ if(cartSq == "all") {
|
|
|
+ // 선택된 장바구니 번호
|
|
|
+ $("#cartListForm input[name=cartSqArr]:checked").each(function () {
|
|
|
+ cartSqArr.push($(this).val());
|
|
|
+ });
|
|
|
+
|
|
|
+ fnOrderCheck(cartSqArr, loginInfo.custNo, "Y");
|
|
|
+ } else {
|
|
|
+ fnOrderCheck(cartSq, loginInfo.custNo, "N");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // 주문 데이터 밸리데이션 체크
|
|
|
- function fnOrderCheck(cartSq, custNo, allYn) {
|
|
|
- // 선택된 장바구니 정보 가공
|
|
|
- let data = { cartSqArr : cartSq
|
|
|
- , custNo : custNo
|
|
|
+ // 주문 데이터 밸리데이션 체크
|
|
|
+ function fnOrderCheck(cartSq, custNo, allYn) {
|
|
|
+ // 선택된 장바구니 정보 가공
|
|
|
+ let data = { cartSqArr : cartSq
|
|
|
+ , custNo : custNo
|
|
|
+ }
|
|
|
+ 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 {
|
|
|
+ fnOrderValidation(result, 0, cartSq, allYn);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- 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 {
|
|
|
- fnOrderValidation(result, 0, cartSq, allYn);
|
|
|
+
|
|
|
+ //옵션변경 팝업열기
|
|
|
+ function fnChangeCartOptCd(cartSq) {
|
|
|
+ $.ajax( {
|
|
|
+ type: "POST",
|
|
|
+ url : '/cart/goods/info',
|
|
|
+ dataType : 'html',
|
|
|
+ data : {cartSq : cartSq},
|
|
|
+ success : function(result) {
|
|
|
+ $("#cartOptionModal").remove();
|
|
|
+ $("#optModifyPop01").html(result);
|
|
|
+ $('#optModifyPop01').show().addClass("active");
|
|
|
+ $("body").css({"overflow":"hidden"});
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 장바구니 구매 수량 변경
|
|
|
+ function updateGoodsQty(cartSq, goodsQty) {
|
|
|
+ let url = '/cart/update/goodsQty';
|
|
|
+ // 선택된 장바구니 정보 가공
|
|
|
+ let data = { cartSq : cartSq
|
|
|
+ , goodsQty : goodsQty
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //옵션변경 팝업열기
|
|
|
- function fnChangeCartOptCd(cartSq) {
|
|
|
- $.ajax( {
|
|
|
- type: "POST",
|
|
|
- url : '/cart/goods/info',
|
|
|
- dataType : 'html',
|
|
|
- data : {cartSq : cartSq},
|
|
|
- success : function(result) {
|
|
|
- $("#cartOptionModal").remove();
|
|
|
- $("#optModifyPop01").html(result);
|
|
|
- $('#optModifyPop01').show().addClass("active");
|
|
|
- $("body").css({"overflow":"hidden"});
|
|
|
+ let jsonData = JSON.stringify(data);
|
|
|
+
|
|
|
+ gagajf.ajaxJsonSubmit(url, jsonData, function(result) {
|
|
|
+ //alert(result.changeQty);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 페이지 이동
|
|
|
+ function fnGoToGoodsDetail(goodsCd) {
|
|
|
+ cfnGoToPage(_PAGE_GOODS_DETAIL + goodsCd);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 전체선택 버튼
|
|
|
+ $("#od_item_all").on("change", function() {
|
|
|
+ if($("#od_item_all").is(":checked")) {
|
|
|
+ $("input[name=cartSqArr]").prop("checked", true);
|
|
|
+ changeCartSqArr();
|
|
|
+ } else {
|
|
|
+ $("input[name=cartSqArr]").prop("checked", false);
|
|
|
+ // 하단 합계금액, 구매하기 수량 변경
|
|
|
+ $("#cartListForm .realOrderAmtText").text("0");
|
|
|
+ $("#cartListForm .realOrderQtyText").text("0");
|
|
|
+ $("#cartListForm .area_order .number").text("0");
|
|
|
+ $("#cartListForm .od_amount_box .sumListPrice").text("0");
|
|
|
+ $("#cartListForm .od_amount_box .totDelvFee").text("0");
|
|
|
+ $("#cartListForm .od_amount_box .totDcAmt").text("0");
|
|
|
+ $("#cartListForm .totalprice_box .sumRealPayAmt").text("0");
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
-
|
|
|
- // 장바구니 구매 수량 변경
|
|
|
- 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);
|
|
|
+ //수량조절 이벤트
|
|
|
+ $(document).on('click','.optModifyPop01 .number_count .minus',function(e){
|
|
|
+ var $input = $(this).parent().find('input');
|
|
|
+ var count = parseInt($input.val()) - 1;
|
|
|
+ count = count < 1 ? 1 : count;
|
|
|
+ $input.val(count);
|
|
|
+ $input.change();
|
|
|
+ //수량1개 이하 감소버튼 비활성화
|
|
|
+ if ($input.val() == 1) {
|
|
|
+ $('.optModifyPop01 .number_count .minus').addClass('min_val');
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).on('click','.optModifyPop01 .number_count .plus',function(e){
|
|
|
+ var $input = $(this).parent().find('input');
|
|
|
+ $input.val(parseInt($input.val()) + 1);
|
|
|
+ $input.change();
|
|
|
+ //수량2개 이상부터 감소버튼 활성화
|
|
|
+ $('.optModifyPop01 .number_count .minus').removeClass('min_val');
|
|
|
+ return false;
|
|
|
+ }).on('keyup','.optModifyPop01 .number_count input[type=text]',function(e){
|
|
|
+ //텍스트, 0 입력금지
|
|
|
+ $(this).val($(this).val().replace(/[^1-9]/g,""));
|
|
|
});
|
|
|
- }
|
|
|
|
|
|
- // 페이지 이동
|
|
|
- function fnGoToGoodsDetail(goodsCd) {
|
|
|
- cfnGoToPage(_PAGE_GOODS_DETAIL + goodsCd);
|
|
|
- }
|
|
|
+ /* 팝업 - 옵션변경 > 컬러선택 표기 */
|
|
|
+ $(document).on('click','.optModifyPop .opt_color ul li a',function(e){
|
|
|
+ $(this).parents('.opt_color').find('li a').removeClass('on');
|
|
|
+ $(this).addClass('on');
|
|
|
+ var optColor = $('.optModifyPop .opt_color ul li a.on img').attr('alt');
|
|
|
+ $('.optModify_pop .opt_color .opt_header .color').text(optColor);
|
|
|
+ return false;
|
|
|
+ });
|
|
|
|
|
|
- // 전체선택 버튼
|
|
|
- $("#od_item_all").on("change", function() {
|
|
|
- if($("#od_item_all").is(":checked")) {
|
|
|
- $("input[name=cartSqArr]").prop("checked", true);
|
|
|
- changeCartSqArr();
|
|
|
- } else {
|
|
|
- $("input[name=cartSqArr]").prop("checked", false);
|
|
|
- // 하단 합계금액, 구매하기 수량 변경
|
|
|
- $("#cartListForm .realOrderAmtText").text("0");
|
|
|
- $("#cartListForm .realOrderQtyText").text("0");
|
|
|
- $("#cartListForm .area_order .number").text("0");
|
|
|
- $("#cartListForm .od_amount_box .sumListPrice").text("0");
|
|
|
- $("#cartListForm .od_amount_box .totDelvFee").text("0");
|
|
|
- $("#cartListForm .od_amount_box .totDcAmt").text("0");
|
|
|
- $("#cartListForm .totalprice_box .sumRealPayAmt").text("0");
|
|
|
+ /* 쿠폰정보 닫기 */
|
|
|
+ function cancelCartCpn() {
|
|
|
+ $("#cartListForm #sumRealPayAmt").text(Number(sumRealPayAmt).toLocaleString());
|
|
|
+ $("#cartListForm #totDcAmt").text(Number(totDcAmt).toLocaleString());
|
|
|
+ $("#cartListForm .area_salecoupon .coupon_box").hide();
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
- //수량조절 이벤트
|
|
|
- $(document).on('click','.optModifyPop01 .number_count .minus',function(e){
|
|
|
- var $input = $(this).parent().find('input');
|
|
|
- var count = parseInt($input.val()) - 1;
|
|
|
- count = count < 1 ? 1 : count;
|
|
|
- $input.val(count);
|
|
|
- $input.change();
|
|
|
- //수량1개 이하 감소버튼 비활성화
|
|
|
- if ($input.val() == 1) {
|
|
|
- $('.optModifyPop01 .number_count .minus').addClass('min_val');
|
|
|
- }
|
|
|
- return false;
|
|
|
- }).on('click','.optModifyPop01 .number_count .plus',function(e){
|
|
|
- var $input = $(this).parent().find('input');
|
|
|
- $input.val(parseInt($input.val()) + 1);
|
|
|
- $input.change();
|
|
|
- //수량2개 이상부터 감소버튼 활성화
|
|
|
- $('.optModifyPop01 .number_count .minus').removeClass('min_val');
|
|
|
- return false;
|
|
|
- }).on('keyup','.optModifyPop01 .number_count input[type=text]',function(e){
|
|
|
- //텍스트, 0 입력금지
|
|
|
- $(this).val($(this).val().replace(/[^1-9]/g,""));
|
|
|
- });
|
|
|
-
|
|
|
- /* 팝업 - 옵션변경 > 컬러선택 표기 */
|
|
|
- $(document).on('click','.optModifyPop .opt_color ul li a',function(e){
|
|
|
- $(this).parents('.opt_color').find('li a').removeClass('on');
|
|
|
- $(this).addClass('on');
|
|
|
- var optColor = $('.optModifyPop .opt_color ul li a.on img').attr('alt');
|
|
|
- $('.optModify_pop .opt_color .opt_header .color').text(optColor);
|
|
|
- return false;
|
|
|
- });
|
|
|
- </script>
|
|
|
+ </script>
|
|
|
+ </form>
|
|
|
</th:block>
|
|
|
</body>
|
|
|
</html>
|