YNICTE/FO/Views/Course/Book.cshtml

120 lines
4.1 KiB
Plaintext
Raw Permalink Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.Book
<div class="bookInfo">
<h5>@Model.bkname</h5>
<table class="bookTable">
<tr>
<th>
<div class="bkSlider">
@if (Model.Files.Count() < 1)
{
<a href="../img/online/fair_book_sample01.jpg" target="_blank" class="bkThumb" style="background:url('../img/online/fair_book_sample01.jpg')no-repeat center center;"></a>
}
@foreach(var d in Model.Files)
{
<a href="@ViewBag.Files@d.fileurl" target="_blank" class="bkThumb" style="background:url('@ViewBag.Files@d.fileurl')no-repeat center center;"></a>
}
</div>
</th>
<td>
<p><span>판매가</span><b>@Model.price.ToString("#,0")</b><em>원</em></p>
<ul>
<li>저자 : @Model.author</li>
<li>출판사 : @Model.publisher</li>
<li>출판일 : @Model.pubdateymd</li>
<li>배송비 : 2,500원</li>
</ul>
</td>
</tr>
</table>
<div class="bookCost">
<h5>총 결제금액</h5>
<ul>
<li><a href="#" onclick="calc(-1)">-</a></li>
<li><input type="text" class="int nocomma" id="pcnt2" value="1"/></li>
<li><a href="#" onclick="calc(1)">+</a></li>
</ul>
<p><b id="price">@Model.price.ToString("#,0")</b><span>원</span></p>
<dl>
<dt><a href="#" onclick="save(0)"><span>장바구니</span></a></dt>
<dd><a href="#" onclick="save(1)"><span>결제하기</span></a></dd>
</dl>
</div>
</div><!-- fairInfo -->
<ul class="fairTab col2">
<li class="current"><a href="javascript:fairTab('01');">교재설명</a></li>
<li><a href="javascript:fairTab('02');">목차</a></li>
</ul>
<div class="fairCont" id="fairCont01" style="padding: 20px 30px;">
@Html.Raw(Model.introhtml??"")
</div>
<div class="fairCont" id="fairCont02" style="padding: 20px 30px;">
@Html.Raw(Model.contents ?? "")
</div>
<form id="mform" method="get" action="">
<input type="hidden" name="bkno" id="bkno" value="@Model.bkno" />
<input type="hidden" name="pcnt" id="pcnt" value="0" />
</form>
@section scriptsHeader{
}
@section scripts{
<script>
$(document).ready(function () {
$('.bkSlider').slick({
swipe: false,
autoplay: true,
autoplaySpeed: 5000,
speed: 600,
arrows: true,
dots: false,
fade: true
});
fairTab('01');
$("#pcnt2").on("change", calc2);
});
function save(idx) {
if (idx == 0) {
capp("/fcommon/buybook", { bkno: @Model.bkno, pcnt: getint(val("pcnt2")), iscart: true }, "cbsave");
} else {
bglayer();
setTimeout(function () {
setv("pcnt", getint(val("pcnt2")));
$("#mform").attr("action", "/Course/BookBuy").submit();
}, 10);
}
}
function cbsave() {
if (capResult.code == -81) {
msg("이미 등록된 교재입니다.");
} else if (capResult.code == 1000) {
confirmtoggle(true, "장바구니 저장이 완료되었습니다. 장바구니로 이동하시겠습니까?", "location.href='/My/Cart';");
} else if (capResult.code == 9999) {
gologin(null, "/Course/Book?bkno=@Model.bkno");
}
}
function fairTab(num) {
$('.fairCont').hide();
$('.fairTab li').removeClass('current');
$('.fairTab li:nth-child(' + num + ')').addClass('current');
$('#fairCont' + num).fadeIn();
};
function calc(pm) {
var pcnt = getint(val("pcnt2")) + pm;
if (pcnt < 0) {
pcnt = 0;
}
setv("pcnt2", pcnt);
sett("price", bindComma(pcnt *@Model.price));
}
function calc2() {
var pcnt = getint(val("pcnt2"));
if (pcnt < 0) {
pcnt = 0;
}
setv("pcnt2", pcnt);
sett("price", bindComma(pcnt *@Model.price));
}
</script>
}