121 lines
4.5 KiB
Plaintext
121 lines
4.5 KiB
Plaintext
|
|
@model NP.Model.VMPay
|
||
|
|
@{
|
||
|
|
|
||
|
|
}
|
||
|
|
<table class="bskList">
|
||
|
|
<thead><tr><th><input type="checkbox" onchange="javascript:checkall(this, 'checkcart'); calc();" /></th><th>장바구니 내역</th></tr></thead>
|
||
|
|
<tbody id="tbody1">
|
||
|
|
@foreach (var d in Model.PayCarts)
|
||
|
|
{
|
||
|
|
<tr>
|
||
|
|
<th><input type="checkbox" onclick="calc();" class="checkcart" value="@d.pcno" data-payamt="@(d.payamt * d.pcnt)" data-ptype="@d.ptype" /></th>
|
||
|
|
<td>
|
||
|
|
<a href="#" style="cursor: default">
|
||
|
|
<h5>
|
||
|
|
<span class="@(d.ptype == 0 ? "blu":"org")">@(d.ptype == 0?"강좌":"교재")</span>
|
||
|
|
@Html.Raw(d.ptype == 0 ? ("<span class=\"ppl\">"+ d.cshapename + "</span>") : "")
|
||
|
|
@Html.Raw(d.ptype == 0 && d.isrefund == 1 ? "<span class=\"grn\">환급</span>" : "")
|
||
|
|
<b>@d.itemname</b>
|
||
|
|
</h5>
|
||
|
|
<dl>
|
||
|
|
<dd>@Html.Raw(d.ptype == 0 ? ("<span class=\"bk\">"+(Math.Truncate((d.setime-d.sstime).TotalDays + 1))+"일</span></dd>") : "")
|
||
|
|
@Html.Raw(d.ptype == 0 ? "<dd><span class=\"org\">"+d.pcnt+"명</span></dd>" : "")
|
||
|
|
<dd><span class="red">@(d.payamt * d.pcnt)</span>원</dd>
|
||
|
|
</dl>
|
||
|
|
</a>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
@if (Model.PayCarts.Count() < 1)
|
||
|
|
{
|
||
|
|
<div style="padding: 10px; text-align: center;">-장바구니 내역이 없습니다.</div>
|
||
|
|
}
|
||
|
|
<div class="bskTotal">
|
||
|
|
<h5>강의 주문 합계 : <b id="payamt">0</b><span>원</span></h5>
|
||
|
|
<p id="dbox" style="@(Model.PayCarts.Where(w=>w.ptype > 0).Count() > 0 ? "":"display: none;")">(배송비 <span>@ViewBag.damt.ToString("#,0")원</span> 포함)</p>
|
||
|
|
</div>
|
||
|
|
<ul class="bskBtn col3">
|
||
|
|
<li><a href="#" onclick="delme()">선택삭제</a></li>
|
||
|
|
<li><a href="#" onclick="pay(0)">선택결제</a></li>
|
||
|
|
<li><a href="#" onclick="pay(1)" class="bk">전체항목 결제하기</a></li>
|
||
|
|
</ul>
|
||
|
|
@section scriptsHeader{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
@section scripts{
|
||
|
|
<script>
|
||
|
|
$(document).ready(function () {
|
||
|
|
$("input.checkcart").on("change", function () {
|
||
|
|
calc();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
function calc() {
|
||
|
|
sett("payamt", 0);
|
||
|
|
var hasbook = false;
|
||
|
|
var tamt = 0;
|
||
|
|
$.each($("#tbody1 input.checkcart:checked"), function (i, c) {
|
||
|
|
if (!hasbook && $(c).attr("data-ptype") != "0") {
|
||
|
|
hasbook = true;
|
||
|
|
}
|
||
|
|
tamt += getint($(c).attr("data-payamt"));
|
||
|
|
});
|
||
|
|
if (hasbook) {
|
||
|
|
tamt += @ViewBag.damt;
|
||
|
|
}
|
||
|
|
sett("payamt", commaset(tamt));
|
||
|
|
}
|
||
|
|
function delme() {
|
||
|
|
if ($("#tbody1 input.checkcart:checked").length > 0) {
|
||
|
|
var pcnos = "";
|
||
|
|
$.each($("#tbody1 input.checkcart:checked"), function (i, c) {
|
||
|
|
pcnos += "," + $(c).val();
|
||
|
|
});
|
||
|
|
capp("/fcommon/paycartdel", { pcnos: pcnos.substr(1) }, "cbpaycartdel");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbpaycartdel() {
|
||
|
|
if (capResult.code == 1000) {
|
||
|
|
$.each($("#tbody1 input.checkcart:checked"), function (i, c) {
|
||
|
|
$(c).closest("tr").addClass("delme").fadeOut("fast");
|
||
|
|
});
|
||
|
|
setTimeout(function () {
|
||
|
|
$("tr.delme").remove();
|
||
|
|
calc();
|
||
|
|
}, 500);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function pay(idx) {
|
||
|
|
if (idx == 0) {
|
||
|
|
if ($("#tbody1 input.checkcart:checked").length < 1) {
|
||
|
|
msg("결제할 내역을 선택해주세요.");
|
||
|
|
} else {
|
||
|
|
var pcnos = "";
|
||
|
|
$.each($("#tbody1 input.checkcart:checked"), function (i, c) {
|
||
|
|
pcnos += "," + $(c).val();
|
||
|
|
});
|
||
|
|
capp("/fcommon/paycartflag", { pcnos: pcnos.substr(1) }, "cbpaycartflag");
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
if ($("#tbody1 input.checkcart").length < 1) {
|
||
|
|
msg("결제할 내역이 없습니다.");
|
||
|
|
} else {
|
||
|
|
var pcnos = "";
|
||
|
|
$.each($("#tbody1 input.checkcart"), function (i, c) {
|
||
|
|
pcnos += "," + $(c).val();
|
||
|
|
});
|
||
|
|
capp("/fcommon/paycartflag", { pcnos: pcnos.substr(1) }, "cbpaycartflag");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
function cbpaycartflag() {
|
||
|
|
if (capResult.code == 1000) {
|
||
|
|
bglayer();
|
||
|
|
location.href = "/My/CartPay";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
}
|