Files
juipnet/Host/Views/Product/Index - 副本 (2).cshtml
“wanyongkang” b562aba2b1 忽略dll文件git
2023-07-29 10:19:42 +08:00

292 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@using Hncore.Pass.Vpn.Response.Product
@using Microsoft.Extensions.Configuration
@using Hncore.Pass.BaseInfo.Response
@using Hncore.Infrastructure.Serializer;
@inject IConfiguration m_Configuration
@model List<ProductWithPackageResponse>
@{
ViewData["Title"] = "购买产品";
UserLoginModel user = null;
if (this.Context.Request.Cookies.TryGetValue("userInfo", out string userCookie))
{
user = userCookie.FromJsonTo<UserLoginModel>();
}
var pid = this.Context.Request.Query.ContainsKey("id") ? this.Context.Request.Query["id"].ToString() : "";
var defaultProduct = Model.Select(m => m.Product).FirstOrDefault();
if (pid == "")
{
pid = Model.Select(m => m.Product).FirstOrDefault().Id.ToString();
}
else
{
defaultProduct = Model.Select(m => m.Product).FirstOrDefault(m => m.Id.ToString() == pid);
}
var productPackages = Model.Where(m => m.Product.Id == defaultProduct.Id).FirstOrDefault().Packages.Where(p => p.Status == 1 && p.IsTest == 0);//.Select(m => m.Packages.Where(p => p.Status == 1 && p.IsTest == 0).FirstOrDefault());
var defaultPackage = productPackages.FirstOrDefault();// Model.Where(m => m.Product.Id == defaultProduct.Id).Select(m => m.Packages.FirstOrDefault()).FirstOrDefault();
var baseUrl = m_Configuration["BaseInfoUrl"];
Func<string, string> P = (path) => $"{baseUrl}{path}";
}
<style>
.clear {
clear: both;
}
.clearfix:after {
content: ".";
display: block;
visibility: hidden;
height: 0;
clear: both
}
.main-page {
margin: 0 auto;
width: 1170px;
padding-bottom:50px;
}
.main-page .left {
width:15%;
border-right: 1px #ccc solid;
margin-top: 25px;
padding-right:10px;
}
.main-page .left, .main-page .right {
float: left;
}
.main-page .nav-back {
height: 300px;
}
.main-page .nav {
position: relative;
margin-top: -300px;
width: 136px;
text-align: center;
font-size: 18px;
font-family: "微软雅黑";
color: #000;
}
.main-page .nav div {
height: 47px;
line-height: 47px;
margin-bottom: 8px;
border-radius: 2px;
cursor: pointer;
}
.main-page .nav div.on {
background: #0c215d;
color: #fff;
}
.main-page .right {
width: 85%;
height: 800px;
}
.main-page .content {
position: relative;
overflow: hidden;
}
.contentNew {
border:none;
}
.youhuiNew {
font-size:14px;
border:none;
text-align:center;
padding:5px 0;
color:red;
}
.mtop {
margin-top:30px;
}
</style>
<!-- ad -->
<div class="container-fluid ad">
<a asp-action="taobao" asp-controller="article"> <img src="~/img/acBanner.png"></a>
</div>
@*新布局*@
<p class="text-center tit"><img src="~/img/titi_choose.png"></p>
<div class="main-page">
<div class="left">
<div class="nav-back"></div>
<div class="nav">
@foreach (var item in Model)
{
<div class="productItem" id="@("p"+item.Product.Id)" a-pid="@item.Product.Id" a-pkg-id="@(item.Packages.FirstOrDefault(m=>m.Status==1).Id)">@item.Product.Name</div>
}
</div>
</div>
<div class="right">
<div class="contentNew">
@foreach (var item in Model)
{
<div class="container stepOne packagebox" id="@("box"+item.Product.Id)">
<div class="container bg_taocan">
<div class="row">
<div class="col-lg-3 text-center photo">
<div class="photoK">
@*<img src="/@item.Product.Image">*@
<p>@item.Product.Name</p>
</div>
</div>
<div class="col-lg-6 intro">
<p>@item.Product.Name</p>
@foreach (var str in item.Product.ContentLine)
{
<p>·@str</p>
}
</div>
<div class="col-lg-3 text-center twoButton">
@if (user == null)
{
<p><button type="button" class="btn btn-warning testLogin" a-productId="@item.Product.Id">免费试用</button></p>
<p><button type="button" class="btn btn-warning reBuy">续费通道</button></p>
}
else
{
<p>
<a asp-action="test" asp-controller="product" asp-route-id="@item.Product.Id"><button type="button" class="btn btn-warning">免费试用</button></a>
</p>
<p>
<a asp-action="myaccounts" asp-controller="user"><button type="button" class="btn btn-warning">续费通道</button></a>
</p>
}
</div>
</div>
</div>
<p class="text-center nameSmall">—<span>@item.Product.Name</span>—</p>
<div class="card">
@foreach (var package in item.Packages.Where(m => m.IsTest == 0 && m.Status == 1))
{
<div class="item packageitem" id="@("pkg"+package.Id)" a-pkg-id="@package.Id">
<p class="tianka">@package.Name</p>
<p><span class="price">@package.Price</span>元</p>
<p class="yuanjia">原价:<span>@package.LinePrice</span>元</p>
<p>@(package.DayPrice)元/天</p>
<p class="qixian">@package.Profile</p>
<img src="~/img/check.png" class="cardCheck">
</div>
}
</div>
<p class="youhuiNew mtop">需求5个以上可以联系客服设置优惠价</p>
<p class="youhuiNew">温馨提示:若您之前享优惠价,请联系客服帮你改价哦</p>
@if (user == null)
{
<p class="tijiao"><button type="button" class="btn btn-primary login">提交</button></p>
}
else
{
<p class="tijiao"><button type="button" class="btn btn-primary btn-submit">提交</button></p>
}
</div>
}
</div>
</div>
<div class="clear"></div>
</div>
@section Scripts{
<script type="text/javascript">
var currentPkgId = 0;
var testProductId = 0;
function select(id) {
var el = "#p" + id;
var packageBox = "#box" + id;
$(".packagebox").hide();
$(packageBox).show();
$(el).addClass("on");
$(el).siblings().removeClass("on");
var pkgid = $(el).attr("a-pkg-id");
selectPackage(pkgid);
}
function selectPackage(id) {
currentPkgId = id;
var el = "#pkg" + id;
//$(".packageitem").hide();
//$(el).show()
$(el).addClass("kuang");
$(el).siblings().removeClass("kuang");
$(el).find(".cardCheck").show();
$(el).siblings().find(".cardCheck").hide();
}
function loginSuccess(data) {
window.location.href = "Buy?id=" + currentPkgId;
}
function testLoginSuccess(data) {
window.location.href = "Test?id=" + testProductId;
}
function reBuyLoginSuccess(data) {
window.location.href = "/User/MyAccounts";
}
$(function () {
$(".productItem").click(function () {
//$(this).addClass("kuang");
//$(this).siblings().removeClass("kuang");
//$(this).find(".check").show();
//$(this).siblings().find(".check").hide();
var pid = $(this).attr('a-pid');
select(pid);
});
$(".card .item").click(function () {
currentPkgId = $(this).attr('a-pkg-id');
selectPackage(currentPkgId)
//$(this).addClass("kuang");
//$(this).siblings().removeClass("kuang");
//$(this).find(".cardCheck").show();
//$(this).siblings().find(".cardCheck").hide();
})
$(".btn-submit").click(function () {
window.location.href = "Buy?id=" + currentPkgId;
})
$(".testLogin").click(function () {
loginCallback = testLoginSuccess;
testProductId = $(this).attr("a-productId");
$(".mask").show();
$(".main").show();
$(".main").addClass("animated bounceInDown");
});
$(".reBuy").click(function () {
loginCallback = reBuyLoginSuccess;
$(".mask").show();
$(".main").show();
$(".main").addClass("animated bounceInDown");
});
})
select(@defaultProduct.Id)
</script>
@*<script type="text/javascript">
$(".main-page .nav div").mouseenter(function () {
var $this = $(this);
var index = $this.index();
}).mouseleave(function () {
var $this = $(this);
var index = $this.index();
}).click(function () {
var $this = $(this);
var index = $this.index();
var l = -(index * 800);
$(".main-page .nav div").removeClass("on");
$(".main-page .nav div").eq(index).addClass("on");
$(".main-page .content .con-ggh:eq(0)").stop().animate({ "margin-top": l }, 500);
});
</script>*@
}