2020-10-07 20:25:03 +08:00
|
|
|
|
@using Hncore.Pass.Vpn.Response.Product
|
|
|
|
|
|
@using Hncore.Infrastructure.Extension
|
|
|
|
|
|
@using Hncore.Pass.BaseInfo.Response
|
|
|
|
|
|
@using Hncore.Infrastructure.Serializer;
|
|
|
|
|
|
@using Hncore.Pass.BaseInfo.Service
|
|
|
|
|
|
@model PackageInfoResponse
|
|
|
|
|
|
@inject UserService m_UserService
|
|
|
|
|
|
@{
|
|
|
|
|
|
ViewData["Title"] = "购买产品";
|
|
|
|
|
|
UserLoginModel user = null;
|
|
|
|
|
|
Hncore.Pass.BaseInfo.Models.User userEntity = new Hncore.Pass.BaseInfo.Models.User();
|
|
|
|
|
|
if (this.Context.Request.Cookies.TryGetValue("userInfo", out string userCookie))
|
|
|
|
|
|
{
|
|
|
|
|
|
user = userCookie.FromJsonTo<UserLoginModel>();
|
|
|
|
|
|
userEntity = await m_UserService.GetById(user.Id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-05-08 16:44:55 +08:00
|
|
|
|
<script src="~/js/vue.js"></script>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
|
2020-12-13 12:53:37 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
let realverify = {
|
|
|
|
|
|
cookie:document.cookie,
|
|
|
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
async:false,
|
|
|
|
|
|
url: 'http://php-api.juip.com/api/Realname/index',
|
|
|
|
|
|
dataType: "json",
|
|
|
|
|
|
contentType: "application/json",
|
|
|
|
|
|
data: JSON.stringify(realverify),
|
|
|
|
|
|
beforeSend: function(xhr) {
|
|
|
|
|
|
xhr.withCredentials = true;
|
|
|
|
|
|
},
|
|
|
|
|
|
crossDomain: true,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
if (res.Code == -10000) {
|
2020-12-27 17:22:06 +08:00
|
|
|
|
alert('接主管部门要求,会员需要实名认证方可使用该产品,点击确定前往 用户主页、个人信息 实名认证。');
|
2020-12-27 19:06:35 +08:00
|
|
|
|
window.location.href="/User/IndexInfo";
|
2020-12-13 12:53:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
<vc:redirecct-login></vc:redirecct-login>
|
|
|
|
|
|
<vc:pay-wait></vc:pay-wait>
|
|
|
|
|
|
<div id="app">
|
|
|
|
|
|
<div class="cpTop">
|
|
|
|
|
|
<p class="choose">当前已选产品:</p>
|
|
|
|
|
|
<div class="kArea">
|
|
|
|
|
|
<div class="cpKuang">
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
<p><img src="~/@Model.Product.Image"></p>
|
|
|
|
|
|
<p>@Model.Product.Name</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
<p class="kaci">@Model.Package.Name</p>
|
|
|
|
|
|
<p class="grayText">@(Model.Package.DayPrice)元/天</p>
|
|
|
|
|
|
<p class="grayText">@Model.Package.Profile</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
¥ <span class="price">@Model.Package.Price</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="chongxin">
|
|
|
|
|
|
<div class="item redText">
|
|
|
|
|
|
*请确认好所需产品,买错产品换货将产生费用
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
<button type="button" class="btnBlue" onclick="history.go(-1)">返回重新选择</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- con -->
|
|
|
|
|
|
<div class="container zhuce">
|
|
|
|
|
|
<div class="reg_tab">
|
|
|
|
|
|
<div class="item dan active_dan">
|
|
|
|
|
|
续费
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="conDan">
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
2020-11-30 13:56:19 +08:00
|
|
|
|
IP产品账号:
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7 shuru">
|
|
|
|
|
|
<input type="text" v-model="OneBuyModel.Account" disabled />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
@*<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
2020-11-30 13:56:19 +08:00
|
|
|
|
IP账号密码:
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7 shuru">
|
|
|
|
|
|
<input type="text" v-model="OneBuyModel.Pwd" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>*@
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
连接数:
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7">
|
|
|
|
|
|
<div class="jiajian">
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
<span>{{OneBuyModel.ConnectCount}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
选择优惠券:
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7 select">
|
|
|
|
|
|
<select class="chooseYhq" v-model="OneBuyModel.CouponId">
|
|
|
|
|
|
<option value="0">请选择优惠券</option>
|
|
|
|
|
|
<option v-for="item in Coupons" :value="item.Id">{{item.Name}}</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
2020-10-12 21:54:19 +08:00
|
|
|
|
余额:
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7">
|
2020-10-12 21:54:19 +08:00
|
|
|
|
<div class="">
|
|
|
|
|
|
当前账户余额<span class="blueText">@(userEntity.RestAmount)</span>元
|
|
|
|
|
|
<a href="/User/Index">前往充值</a>
|
|
|
|
|
|
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row" v-if="showPayType">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
支付方式:
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7 pay">
|
|
|
|
|
|
<div class="radio" v-on:click="OneBuyModel.OPayType=100">
|
2020-10-12 21:54:19 +08:00
|
|
|
|
<input id="zhifubaopay_s1" name="OPayType" type="radio" v-model="OneBuyModel.OPayType" value="100">
|
|
|
|
|
|
<label for="zhifubaopay_s1" class="radio-label"><img src="~/m/img/zfb.png"> 支付宝支付</label>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="radio" v-on:click="OneBuyModel.OPayType=70">
|
2020-10-12 21:54:19 +08:00
|
|
|
|
<input id="weixinpay_s1" name="OPayType" type="radio" v-model="OneBuyModel.OPayType" value="70">
|
|
|
|
|
|
<label for="weixinpay_s1" class="radio-label"><img src="~/m/img/wx.png"> 微信支付</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="radio" >
|
|
|
|
|
|
<input id="UseAccountAmount" name="OPayType" type="radio" v-model="OneBuyModel.UseAccountAmount" value="1">
|
|
|
|
|
|
<label for="UseAccountAmount" class="radio-label" style="line-height:150%"> 余额支付</label>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
总金额:
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7">
|
|
|
|
|
|
<span>{{TotalAmount}}</span>元
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
应付款:
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7">
|
|
|
|
|
|
<span class="yingfu" style="font-size: 35px;font-weight: bold;">{{PayAmount}}</span>元
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-04-23 18:17:13 +08:00
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-sm-5 col-xs-5">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-7 col-xs-7">
|
|
|
|
|
|
<p>{{auto_discount_text}}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2021-04-13 14:37:10 +08:00
|
|
|
|
<p class="grayText songquan">淘宝每次下单获得优惠券</p>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
<p class="grayText songquan" style="color:red">{{Tip}}</p>
|
|
|
|
|
|
<div class="ok">
|
2020-10-24 18:53:34 +08:00
|
|
|
|
<button type="button" class="pay-botton btnPay" v-on:click="onePay">确认支付</button>
|
2020-10-07 20:25:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="aliPayBox" style="display:none"></div>
|
|
|
|
|
|
@section Scripts{
|
|
|
|
|
|
<script>
|
|
|
|
|
|
var productId =@(Model.Product.Id);
|
|
|
|
|
|
var app = new Vue({
|
|
|
|
|
|
el: '#app',
|
|
|
|
|
|
data: {
|
2021-04-23 18:17:13 +08:00
|
|
|
|
auto_discount_text:'',
|
2020-10-07 20:25:03 +08:00
|
|
|
|
showPayType: true,
|
|
|
|
|
|
Tip:'',
|
|
|
|
|
|
RestAmount: @(userEntity.RestAmount),
|
|
|
|
|
|
Coupons: [],
|
|
|
|
|
|
SelectCoupon: {},
|
|
|
|
|
|
OrderInfo: {},
|
|
|
|
|
|
OneBuyModel: {
|
|
|
|
|
|
Price:@(Model.Package.Price),
|
|
|
|
|
|
PackageId:@(Model.Package.Id),
|
|
|
|
|
|
OrderType: @ViewBag.orderType,
|
|
|
|
|
|
Account: '@ViewBag.accounts',
|
|
|
|
|
|
CouponAmount: 0,
|
|
|
|
|
|
Pwd: '',
|
|
|
|
|
|
ConnectCount: @(ViewBag.ConnectCount),
|
|
|
|
|
|
CouponId: 0,
|
|
|
|
|
|
UseAccountAmount: 0,
|
|
|
|
|
|
OPayType: 100,
|
|
|
|
|
|
PayChannel:40,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
TotalAmount: function () {
|
|
|
|
|
|
var count = this.OneBuyModel.Account.split(',').length;
|
|
|
|
|
|
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count;
|
|
|
|
|
|
return total.toFixed(2);
|
|
|
|
|
|
},
|
|
|
|
|
|
PayAmount: function () {
|
|
|
|
|
|
var count = this.OneBuyModel.Account.split(',').length;
|
|
|
|
|
|
var restAmout = this.OneBuyModel.UseAccountAmount == 1 ? this.RestAmount : 0;
|
2020-10-12 21:54:19 +08:00
|
|
|
|
var total = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount ;
|
2020-10-07 20:25:03 +08:00
|
|
|
|
total= total < 0 ? 0 : total;
|
2021-04-23 18:17:13 +08:00
|
|
|
|
total = parseFloat(total.toFixed(2));
|
|
|
|
|
|
|
2021-05-11 14:32:34 +08:00
|
|
|
|
|
2021-04-24 15:04:31 +08:00
|
|
|
|
|
|
|
|
|
|
//最低价
|
2021-04-25 14:29:30 +08:00
|
|
|
|
var min_cost = @(Model.Package.MinPrice) * this.OneBuyModel.ConnectCount * count - this.OneBuyModel.CouponAmount;
|
2021-04-24 15:04:31 +08:00
|
|
|
|
if(total<min_cost){
|
|
|
|
|
|
total = min_cost;
|
|
|
|
|
|
}
|
2021-04-23 18:17:13 +08:00
|
|
|
|
|
2020-10-07 20:25:03 +08:00
|
|
|
|
return total.toFixed(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
'OneBuyModel.CouponId': { //加引号监听对象里的属性
|
|
|
|
|
|
handler: function (newValue, oldValue) {
|
|
|
|
|
|
var totalAmount = this.OneBuyModel.Price * this.OneBuyModel.ConnectCount;
|
|
|
|
|
|
for (var i = 0; i < this.Coupons.length; i++) {
|
|
|
|
|
|
var item = this.Coupons[i];
|
|
|
|
|
|
if (totalAmount < item.AllowMinAmount) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.Id == newValue) {
|
|
|
|
|
|
if (item.CouponType == 1) {//满减
|
|
|
|
|
|
this.OneBuyModel.CouponAmount = item.CouponValue;
|
|
|
|
|
|
} else {
|
2020-10-12 19:37:47 +08:00
|
|
|
|
//亲 请勿非法操作呦^.^ 请按照正常的流程操作 我们后台是有记录滴
|
|
|
|
|
|
if($(".kaci").text() == '天卡'){
|
|
|
|
|
|
this.OneBuyModel.CouponAmount = totalAmount * item.CouponValue * 0.1;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
alert('非天卡无效');
|
|
|
|
|
|
this.OneBuyModel.CouponId = '0';
|
|
|
|
|
|
}
|
2020-10-07 20:25:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
return;
|
2020-10-12 21:54:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.OneBuyModel.CouponAmount = 0;
|
2020-10-07 20:25:03 +08:00
|
|
|
|
}
|
2020-10-12 21:54:19 +08:00
|
|
|
|
}
|
2020-10-07 20:25:03 +08:00
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
},
|
|
|
|
|
|
'OneBuyModel.OPayType': { //加引号监听对象里的属性
|
|
|
|
|
|
handler: function (newValue, oldValue) {
|
|
|
|
|
|
var wx = 10;
|
|
|
|
|
|
if (isWeiXin()) wx = 20;
|
|
|
|
|
|
this.OneBuyModel.PayChannel = newValue == 70 ? wx : 40;
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted: function () {
|
|
|
|
|
|
if (isWeiXin()) {
|
|
|
|
|
|
this.OneBuyModel.PayChannel = 20;
|
|
|
|
|
|
this.OneBuyModel.OPayType = 70;
|
|
|
|
|
|
this.showPayType = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getCoupons();
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getCoupons: function () {
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
var url = '/api/sells/v1/coupon/GetAvailableCoupon';
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'GET',
|
|
|
|
|
|
url: url,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
if (res.Code == 10000) {
|
|
|
|
|
|
that.Coupons = res.Data.map(m => m.Coupon);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
onePay: function () {
|
2020-10-22 09:48:00 +08:00
|
|
|
|
$(".pay-botton").hide();
|
2020-10-12 21:54:19 +08:00
|
|
|
|
if (this.OneBuyModel.UseAccountAmount) {
|
|
|
|
|
|
if (this.RestAmount < this.PayAmount){
|
|
|
|
|
|
alert('余额不足,请充值。您也可以使用微信、支付宝支付。');return;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.RestAmount = this.RestAmount - this.PayAmount;
|
|
|
|
|
|
}
|
2020-10-07 20:25:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
if (this.OneBuyModel.UseAccountAmount === true) this.OneBuyModel.UseAccountAmount = 1;
|
|
|
|
|
|
if (this.OneBuyModel.UseAccountAmount === false) this.OneBuyModel.UseAccountAmount = 0;
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
showPayWait();
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
url: '/product/CreateOrder',
|
|
|
|
|
|
dataType: "json",
|
|
|
|
|
|
contentType: "application/json",
|
|
|
|
|
|
data: JSON.stringify(this.OneBuyModel),
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
if (res.Code == 10000) {
|
|
|
|
|
|
hidePayWait();
|
|
|
|
|
|
that.payCallback(res.Data)
|
|
|
|
|
|
//that.isPay(res.Data.OrderInfo.OrderNo);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//that.Tip = res.Message;
|
|
|
|
|
|
tipPayWait(res.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
payCallback: function (data) {
|
|
|
|
|
|
this.OrderInfo = data.OrderInfo;
|
2021-03-15 15:21:53 +08:00
|
|
|
|
if (!data.PayData) { alert("下单成功"); return; }
|
2020-10-07 20:25:03 +08:00
|
|
|
|
var payChannel = this.OrderInfo.PayChannel;
|
|
|
|
|
|
if (payChannel == 10) {
|
|
|
|
|
|
this.h5WxPay(data.PayData)
|
|
|
|
|
|
} else if (payChannel == 20) {
|
|
|
|
|
|
this.jsWxPay(data.PayData);
|
|
|
|
|
|
} else if (payChannel == 40) {
|
|
|
|
|
|
this.aliPay(data.PayData);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
h5WxPay(payData) {
|
|
|
|
|
|
window.location.href = payData;
|
|
|
|
|
|
},
|
|
|
|
|
|
jsWxPay(payData) {
|
|
|
|
|
|
WeixinJSBridge.invoke(
|
|
|
|
|
|
'getBrandWCPayRequest',
|
|
|
|
|
|
JSON.parse(payData),
|
|
|
|
|
|
function (res) {
|
|
|
|
|
|
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
|
|
|
window.location.href = "/User/MyAccounts";
|
|
|
|
|
|
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
alert("支付失败" + res.err_msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
aliPay(payData) {
|
|
|
|
|
|
$("#aliPayBox").html(payData);
|
|
|
|
|
|
},
|
|
|
|
|
|
isPay: function (orderNo) {
|
|
|
|
|
|
var handler = setInterval(function () {
|
|
|
|
|
|
var url = '/product/IsPay?orderNo=' + orderNo;
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
type: 'GET',
|
|
|
|
|
|
url: url,
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
if (res.Code == 10000 && res.Data == 1) {
|
|
|
|
|
|
clearInterval(handler);
|
|
|
|
|
|
// $(".payMask").hide();
|
|
|
|
|
|
window.location.href = "/user/myaccounts";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 3000)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
}
|