Commit 2f2eb8af by Administrator

Merge remote-tracking branch 'origin/master'

parents 7ad16b83 256800e3
<include file="__THEME__/public_header_w3g"/> <include file="__THEME__/public_header_w3g"/>
<style> <link rel="stylesheet" href="__APP__/css/recharge_3g.css">
body { <div class="body">
padding: 0 !important; <!-- <div class="header2">
} <a href="{:U('home/User/index')}" class="icon-back"></a>
</style> <div>会员充值</div>
<div id="app"> </div> -->
<div class="layout_v" style="background: white;">
<div class="integral">
<div class="vip_buy_top_state"> <span>当前身份:</span>
<span class="text_12_400 color_999999">当前身份:<?php if($learnc['vip_type']==0):?>非会员<?php else: echo $learnc['vip_type_txt'];endif;?></span> <span><?php if($learnc['vip_type']==0):?>非VIP会员<?php else: echo $learnc['vip_type_txt'];endif;?></span>
</div> </div>
<form action="{:U('classroom/Pay/rechargeVip')}" method="post">
<div class="home_list_part" style="margin-top: 0.75rem;"> <div class="teacher_bd" style="display: block">
<div class="home_list_header layout_h">
<div class="home_list_header_v_line"></div> <if condition="$is_wx and in_array('wxpay',$payConfig['pay'])">
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择会员</span> <input type="hidden" value="wxpay" name="pay" />
</div> <else/>
</div> <volist name="payWay" id="vo" offset="0" length="1">
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;"> <input type="hidden" value="{$vo}" name="pay" />
<div v-for="(item, index) in vips" :key="index" @click="type = item.id" class="layout_h_v_c"> </volist>
<van-icon :name="type == item.id ? '__THEME__/img/picker_y@3x.png' : '__THEME__/img/picker_n@3x.png'" style="margin-right: 0.4375rem;" size="18" ></van-icon> </if>
<div class="vip_buy_type layout_h_c" :style="item.color"> <input type="hidden" value="1" name="type" />
<span class="text_12_400 self_center color_white" >{{item.title}}</span> <div class="pay_dl">
<div class="g-join">
<div class="chong">充会员</div>
<div class="disc">每月可免费学习多个收费课程,还有更多惊喜折扣</div>
</div>
<div id="vip_type">
<div class="margin-vip_type">
<volist name="user_vip" id="vo">
<div class="vip_type_item g-vo <php>if($key == 0){</php> on <php>}</php>">
<div class="vip-type">
<div class="icon turn"></div>
<div class="txt">{$vo.title}</div>
</div>
<input class="g-radio" type="radio" data-vip-month="{$vo.vip_month}" data-vip-year="{$vo.vip_year}" <php>if($key == 0){</php>checked="checked"<php>}</php> name="user_vip" value="{$vo.id}"/>
</div>
</volist>
</div>
</div> </div>
</div> </div>
</div>
<div class="pay_dl marsty_docse">
<div class="home_list_part" style="margin-top: 2.25rem;"> <div id="vip_type_time">
<div class="home_list_header layout_h"> <div class="g-time on">
<div class="home_list_header_v_line"></div> <input type="radio" name="vip_type_time" id="vip_month" readonly data-value="{$user_vip[0]['vip_month']|default=0}" value="month" checked />
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择时长</span> <em>¥{$user_vip[0]['vip_month']|default=0}</em>/月
</div> </div>
</div> <div class="g-time">
<input type="radio" name="vip_type_time" id="vip_year" readonly data-value="{$user_vip[0]['vip_year']|default=0}" value="year" />
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;"> <em>¥{$user_vip[0]['vip_year']|default=0}</em>/年
<div @click="isYear = false" :class="monthFrame" class="layout_center" style="margin-right: 1.875rem;"> </div>
<van-image height="100%" width="100%" v-if="!isYear" class="element_bg" src="__THEME__/img/KK@3x.png" ></van-image> </div>
<span class="text_16_600" :class="isYear ? 'color_999999' : 'color_primary'">{{monthPrice}}</span> <div id="vip_time">
<span class="text">数量 :</span>
<div class="vip_count">
<p class="reduce"><i class="icon icon-jian"></i></p>
<input type="text" class="head_search upload_input_a myInput1 num" readonly name="vip_time" value="1">
<p class="plus"><i class="icon icon-jia-copy"></i></p>
</div>
<span class="change"></span>
</div>
</div> </div>
<div @click="isYear = true" :class="yearFrame" class="layout_center">
<van-image height="100%" width="100%" v-if="isYear" class="element_bg" src="__THEME__/img/KK@3x.png" ></van-image>
<span class="text_16_600" :class="isYear ? 'color_primary' : 'color_999999'">{{yearPrice}}</span>
<div class="pay_dl vip_pay_way">
<php>if($is_wx){unset($payWay['支付宝支付']);}$firstPayWay = current($payWay);</php>
<if condition="in_array('wxpay',$payConfig['pay'])">
<label class="vip_pay_way_item selected" onclick="select_pay(this,3);">
<img src="__APP__/images/weixin.png" alt="">
<h3 class="name">微信支付</h3>
<i class="icon <if condition='$is_wx or $firstPayWay eq wxpay'>on<else/>yuan</if>"></i>
</label>
</if>
<!-- <if condition="in_array('alipay',$payConfig['pay']) and ($is_wx eq false)">-->
<!-- <label class="vip_pay_way_item" onclick="select_pay(this,1);"><img src="__APP__/images/zfb.png" alt="">-->
<!-- <h3 class="name">支付宝支付</h3>-->
<!-- <i class="icon <if condition='$firstPayWay eq alipay'>on<else/>yuan</if>"></i>-->
<!-- </label>-->
<!-- </if>-->
<!-- <if condition="in_array('lcnpay',$payConfig['pay'])">-->
<!-- <label class="vip_pay_way_item" onclick="select_pay(this,5);">-->
<!-- <img src="__APP__/images/yue.png" alt=""> <h3 class="name">余额支付</h3>-->
<!-- <i class="icon <if condition='$firstPayWay eq lcnpay'>on<else/>yuan</if>"></i>-->
<!-- </label>-->
<!-- </if>-->
</div> </div>
</div>
<div class="pay_dt vip_pay_Agreed">
<div class="home_list_part layout_h_v_c" style="margin-top: 1.5rem;margin-bottom: 1.5rem;"> <label>
<span class="text_14_400 color_999999">数量:</span> <input id="vip_recharge" type="checkbox" checked name="checkbox" />同意
<van-icon @click="onMinus" name="__THEME__/img/minus.png" size="20" ></van-icon> <a target="_blank" href="{:U('basic/Single/info',array('id'=>'buy'))}">《{$site['site_keyword']}虚拟货币服务协议》</a>
<span class="text_16_600 color_primary" style="margin-left: 0.5rem;margin-right: 0.5rem;">{{count}}</span> </label>
<van-icon @click="onPlus" name="__THEME__/img/plus.png" size="20" ></van-icon>
<span class="text_14_400 color_999999" style="margin-left: 0.25rem;">{{isYear ? "年" : "月"}}</span>
</div>
</div>
<div style="background: #F5F5F5;height: 0.5rem;"></div>
<div class="layout_v">
<div class="home_list_part" style="margin-top: 1.25rem;">
<div class="home_list_header layout_h">
<div class="home_list_header_v_line"></div>
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择支付方式</span>
</div> </div>
</div>
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;"> <div class="money_box">
<div class="layout_h_v_c"> <a href="javascript:;" class="g-money">实付<em class="red_txt ft18" id="price_show">¥{$user_vip[0]['vip_month']}</em></a>
<van-image height="28" width="28" fit="cover" src="__THEME__/img/wechat_logo.png"></van-image> <a class="g-true" href="javascript:;" onclick="rechangeVip(this);">确认支付</a>
<span class="text_14_400 color_333333" style="margin-left: 0.75rem;">微信</span>
</div> </div>
<van-icon name="__THEME__/img/picker_y@3x.png" size="20" ></van-icon>
</div>
</div>
<div class="layout_h_v_c fixed_bottom_bar">
<span class="text_14_600 color_333333" style="margin-right: 0.5rem;">合计</span>
<span class="text_14_600 color_FF3B3B">¥{{totalPrice}}</span>
<span class="text_12_400 color_999999">{{discount}}</span>
<div class="weight_full layout_h_r">
<div class="vip_buy_pay_button layout_center"><span class="text_14_400 color_white">立即支付</span></div>
</div> </div>
</div> </form>
</div> </div>
<if condition="$is_wx eq false">
<style>
#_ts_box_h5{width:290px;height:180px;text-align: center;color: #535353;border-radius: 5px;position: fixed;background: #fff;-webkit-box-shadow: 0 2px 5px #dddddd;-moz-box-shadow: 0 2px 5px #dddddd;-khtml-box-shadow: 0 2px 5px #dddddd;-ms-box-shadow: 0 0 15px #888888;box-shadow: 0 0 15px #888888;z-index: 997;left: 50%;top: 50%;transform: translate(-50%,-50%);background: #fff;}
._hide_box_h5{z-index:996;filter:alpha(opacity=50);background:#666;opacity: 0.5;-moz-opacity: 0.5;left:0;top:0;height:99%;width:100%;position:fixed;}
#_ts_box_h5 ._box_hd{padding: 20px 0px;color: black;font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.16);}
#_layer-content{padding: 15px 0px;color: rgba(255, 35, 0, 0.69);font-size: 16px;border-bottom: 1px solid rgba(0, 0, 0, 0.1);}
._layer-wt{padding: 15px 0px;color: #908d8d;font-size: 16px;}
</style>
<div class="_hide_box_h5" style="display: none;"></div>
<div id="_ts_box_h5" style="display: none;">
<div class="_box_hd" >请确认微信支付是否完成</div>
<div id="_layer-content">已完成支付</div>
<div class="_layer-wt"><a href="{:U('home/User/recharge')}">支付遇到问题,联系客服</a></div>
</div>
</if>
<script> <script>
'<if condition="$is_wx eq false">'
new Vue({ $(function(){
el: '#app', var wpay = "{$_GET['wpay']}";
data: function() { var ppn = "{$_GET['ppn']}";
return { if(wpay != ''){
type: 1, $('._hide_box_h5,#_ts_box_h5').show();
isYear: false, $('#_layer-content').click(function(){
count: 1, $('._hide_box_h5,#_ts_box_h5').hide();
vips: [] s = setInterval(function(){
} $.ajax({
}, url: "{:U('classroom/Pay/getPayStatus')}",
computed: { data:{pay_pass_num:ppn},
monthFrame: function() { type:'post',
return !this.isYear ? 'vip_buy_price_frame_none' : 'vip_buy_price_frame' success: function(res){
}, try{
yearFrame: function() { res = JSON.parse(res);
return this.isYear ? 'vip_buy_price_frame_none' : 'vip_buy_price_frame' if(res.status == 1){
}, clearInterval(s);
monthPrice: function() { ui.success('充值成功');
return this.vips.hx_firstOf( r => { return r.id == this.type }).vip_month + "元/月" setTimeout(function(){
}, window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data
yearPrice: function() { },2000);
return this.vips.hx_firstOf( r => { return r.id == this.type }).vip_year + "元/年" }
}, }catch(e){
totalPrice: function() { return;
if(this.isYear) { }
let y = this.vips.hx_firstOf( r => { return r.id == this.type }).vip_year }
return (y * this.count).toFixed(2) });
},1800);
});
}
});
'</if>'
$(function() {
$(".pay_dl .g-vo .g-radio:checked").siblings(".icon").addClass("icon-xuanze").removeClass("icon-yuan1")
$(".pay_dl .g-vo").click(function(){
$(this).children(".icon").addClass("icon-xuanze").removeClass("icon-yuan1").parent(".g-vo").siblings(".g-vo").find(".icon").addClass("icon-yuan1").removeClass("icon-xuanze");
$(this).children('input').prop('checked',true);
});
$("#vip_type_time .g-time").click(function(){
$(this).addClass("on").siblings().removeClass("on");
$(this).find("input").attr("checked","checked").parents(".g-time").siblings().find("input").removeAttr("checked");
});
$("#vip_time .vip_count .icon").click(function(){
var num=$("#vip_time .vip_count .num").val();
if ($(this).hasClass("icon-jian")){
if(num==1){
num=1;
}else{
num--;
if (num<0) {
num=0;
$("#vip_time .vip_count .num").val(num);
}else {
$("#vip_time .vip_count .num").val(num);
}
} }
let h = this.vips.hx_firstOf( r => { return r.id == this.type }).vip_month
return (h * this.count).toFixed(2) } else {
}, num++;
discount: function() { $("#vip_time .vip_count .num").val(num);
return "(已优惠:¥0元)"
} }
}, });
created:function(){ $(".header").hide();
this.vips = {:json_encode($user_vip)}; $(".choose").click(function(){
this.vips.forEach( r => { $(this).addClass("on").siblings().removeClass('on');
if(r.title == "乡试") { $('.teacher_bd').stop(true,true).hide().eq($(this).index()).show();
r.color = { background: "#65C000" } });
} else if(r.title == "会试") {
r.color = { background: "#32C5FF" } $(document).on('click','[name="group-list"] label',function(){
} else if(r.title == "殿试") { $(this).addClass('selected').siblings().removeClass('selected');
r.color = { background: "#F5A623" } var pay = $(this).parents('form').find('input:hidden[name="pay"]').val();
}
}) if(pay == 'cardpay'){
}, $('#oline_pay_div').hide(100);
methods: { $('#cardpay_div').show(100);
onMinus: function() { }else{
if(this.count - 1 >= 1) { $('#oline_pay_div').show(100);
this.count -= 1 $('#cardpay_div').hide(100);
}
},
onPlus: function() {
this.count += 1
} }
});
$('.btn_je_box a.btn_hui_h:eq(1)').click();
$('.btn_je_box a.btn_hui_h').click(function(){
$(this).parents('form').find('input:hidden[name="money"]').val($(this).attr('val')+$(this).attr('give'));
$('#lan_txt_cost').text($(this).attr('val'));
$('input#custom_money').val('').blur();
});
$('input#custom_money').change(function(e) {
$('.btn_je_box').children().removeAttr('selected');
$(this).parents('form').find('input:hidden[name="money"]').val($(this).val());
$('#lan_txt_cost').text($(this).val());
});
//选择充值VIP类型
$('.g-vo').click(function(){
$('.g-vo').removeClass("on");
$(this).addClass("on")
var _this = $(this).children("input");
var vip_month = _this.attr('data-vip-month');
var vip_year = _this.attr('data-vip-year');
var vip_time = $('input[name="vip_time"]').val();
var html = '<div class="g-time on" onclick="wode(this)"><input type="radio" name="vip_type_time" id="vip_month" data-value="'+vip_month+'" value="month" checked/><em>¥ '+vip_month+'</em>/月</div><div class="g-time" onclick="wode(this)"><input type="radio" name="vip_type_time" id="vip_year" data-value="'+vip_year+'" value="year" /><em>¥'+vip_year+'</em>/年</div>';
$("#vip_type_time").html(html);
var text = $('input[name="vip_type_time"]:checked').attr('data-value')*vip_time;
$('#price_show').html("¥"+text);
});
//选择充值时长
$(document).on("click","#vip_type_time .g-time",function(){
var _this = this;
var _val = $(_this).find("input").attr("data-value");
var val = $(_this).find("input").val();
var vip_time = $('input[name="vip_time"]').val();
var text = _val*vip_time;
$(_this).addClass("on").siblings().removeClass("on");
$(_this).find("input").attr("checked","checked").parents(".g-time").siblings().find("input").removeAttr("checked");
if( val == 'year') {
$('#vip_time .change').text('年');
} else {
$('#vip_time .change').text('月');
}
$('#price_show').html("¥"+text);
});
//输入月数
$('#vip_time .icon').click(function(){
var _this = this;
var vip_time = parseInt($("#vip_time .vip_count .num").val());
var val = $('input[name="vip_type_time"]:checked').attr('data-value');
if(vip_time <= 0 || isNaN(vip_time)){
$("#vip_time .vip_count .num").val('');$('#price_show').html("¥"+0);return ;
}else{
$("#vip_time .vip_count .num").val(vip_time);
}
$('#price_show').html("¥"+vip_time*val);
});
});
function select_pay(sbt,val){
var form = $(sbt).parents('form');
if(val==1){
form.find('input:hidden[name="pay"]').val("alipay");
}else if(val==2){
form.find('input:hidden[name="pay"]').val("unionpay");
}else if(val==3){
form.find('input:hidden[name="pay"]').val("wxpay");
}else if(val==4){
form.find('input:hidden[name="pay"]').val("cardpay");
}else if(val==5){
form.find('input:hidden[name="pay"]').val("lcnpay");
}
$(sbt).find(".yuan").addClass("on").removeClass("yuan");
$(sbt).siblings().find(".on").removeClass("on").addClass("yuan");
}
//充值VIP
function rechangeVip(sbt){
var form = $(sbt).parents('form');
var pay = form.find('input:hidden[name="pay"]').val();
var type = form.find('input:hidden[name="type"]').val();
if( pay != 'alipay' && pay!='unionpay' && pay!='wxpay' && pay!='lcnpay'){
ui.error('错误的支付方式');
return false;
}
if(type != 0 && type !=1){
ui.error('充值类型错误');
return false;
} }
})
'<if condition="$is_wx eq false">'
$(function(){
var wpay = "{$_GET['wpay']}";
var ppn = "{$_GET['ppn']}";
if(wpay != ''){
$('._hide_box_h5,#_ts_box_h5').show();
$('#_layer-content').click(function(){
$('._hide_box_h5,#_ts_box_h5').hide();
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:ppn},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('充值成功');
setTimeout(function(){
window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data
},2000);
}
}catch(e){
return;
}
}
});
},1800);
});
}
});
'</if>'
//充值VIP if(!$("#vip_recharge").is(':checked')){
function rechangeVip(sbt){ ui.error("请同意《{$site['site_keyword']}虚拟货币服务协议》");
var form = $(sbt).parents('form'); return false;
var pay = form.find('input:hidden[name="pay"]').val(); }
var type = form.find('input:hidden[name="type"]').val(); var s = 0;
if( pay != 'alipay' && pay!='unionpay' && pay!='wxpay' && pay!='lcnpay'){ if(pay == 'wxpay'){
ui.error('错误的支付方式'); $.ajax({
return false; url: "{:U('classroom/Pay/rechargeVip')}",
} data:form.serialize(),
if(type != 0 && type !=1){ async:false,
ui.error('充值类型错误'); type:'post',
return false; success: function(data){
} var data = getResponseData(data);
if(!$("#vip_recharge").is(':checked')){ if(data.status == 1){
ui.error("请同意《{$site['site_keyword']}虚拟货币服务协议》"); var pay_pass_num = data.data.pay_pass_num;
return false; '<if condition="$is_wx">'
} WeixinJSBridge.invoke(
var s = 0; 'getBrandWCPayRequest',JSON.parse(data.data.html),
if(pay == 'wxpay'){ function(res){
$.ajax({ if(res.err_msg == "get_brand_wcpay_request:ok" ){
url: "{:U('classroom/Pay/rechargeVip')}", s = setInterval(function(){
data:form.serialize(), $.ajax({
async:false, url: "{:U('classroom/Pay/getPayStatus')}",
type:'post', data:{pay_pass_num:pay_pass_num},
success: function(data){ type:'post',
var data = getResponseData(data); success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('充值成功');
setTimeout(function(){
window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data
},1500);
}
}catch(e){
return;
}
}
});
},1800);
}
}
);
'<else/>'
var a = document.createElement('a');
a.href = data.data.html;
a.click();
return false;
'</if>'
}else{
ui.error(e.data);
setTimeout(function(){
window.location.href = '{:U("home/User/recharge")}';
},2000);
}
},
error: function(){
return false
}
if(data.status == 1){ });
var pay_pass_num = data.data.pay_pass_num; }else if(pay == 'lcnpay'){
'<if condition="$is_wx">' $.ajax({
WeixinJSBridge.invoke( url: "{:U('classroom/Pay/rechargeVip')}",
'getBrandWCPayRequest',JSON.parse(data.data.html), data:form.serialize(),
function(res){ async:false,
if(res.err_msg == "get_brand_wcpay_request:ok" ){ type:'post',
s = setInterval(function(){ dataType:"json",
$.ajax({ success: function(data){
url: "{:U('classroom/Pay/getPayStatus')}", if(typeof data != 'object'){
data:{pay_pass_num:pay_pass_num}, var data = eval('('+data+')');
type:'post', }
success: function(res){ if(data.status == 1){
try{ ui.success('充值成功',{
res = JSON.parse(res); end:function(){
if(res.status == 1){ window.location.href = "{:U('home/User/index')}";
clearInterval(s); }
ui.success('充值成功'); });
setTimeout(function(){ return true;
window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data }else{
},1500); ui.error(e.data);
} setTimeout(function(){
}catch(e){ window.location.href = '{:U("home/User/recharge")}';
return; },2000);
} }
} },
}); error: function(){
},1800); return false
} }
}
);
'<else/>'
var a = document.createElement('a');
a.href = data.data.html;
a.click();
return false;
'</if>'
}else{
ui.error(e.data);
setTimeout(function(){
window.location.href = '{:U("home/User/recharge")}';
},2000);
}
},
error: function(){
return false
}
}); });
}else if(pay == 'lcnpay'){ }else{
$.ajax({ form.submit();
url: "{:U('classroom/Pay/rechargeVip')}", }
data:form.serialize(), }
async:false,
type:'post',
dataType:"json",
success: function(data){
if(typeof data != 'object'){
var data = eval('('+data+')');
}
if(data.status == 1){
ui.success('充值成功',{
end:function(){
window.location.href = "{:U('home/User/index')}";
}
});
return true;
}else{
ui.error(e.data);
setTimeout(function(){
window.location.href = '{:U("home/User/recharge")}';
},2000);
}
},
error: function(){
return false
}
}); function wode(a){
}else{ $(a).addClass("on").siblings().removeClass("on");
form.submit(); $(a).find("input").attr("checked","checked").parents(".g-time").siblings().find("input").removeAttr("checked");
} }
}
</script> </script>
<include file="__THEME__/public_footer_w3g"/> <include file="__THEME__/public_footer_w3g"/>
<include file="__THEME__/public_header_w3g"/>
<style>
body {
padding: 0 !important;
}
</style>
<div id="app">
<div class="layout_v" style="background: white;">
<div class="vip_buy_top_state">
<span class="text_12_400 color_999999">当前身份:<?php if($learnc['vip_type']==0):?>非会员<?php else: echo $learnc['vip_type_txt'];endif;?></span>
</div>
<div class="home_list_part" style="margin-top: 0.75rem;">
<div class="home_list_header layout_h">
<div class="home_list_header_v_line"></div>
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择会员</span>
</div>
</div>
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;">
<div v-for="(item, index) in vips" :key="index" @click="type = item.id" class="layout_h_v_c">
<van-icon :name="type == item.id ? '__THEME__/img/picker_y@3x.png' : '__THEME__/img/picker_n@3x.png'" style="margin-right: 0.4375rem;" size="18" ></van-icon>
<div class="vip_buy_type layout_h_c" :style="item.color">
<span class="text_12_400 self_center color_white" >{{item.title}}</span>
</div>
</div>
</div>
<div class="home_list_part" style="margin-top: 2.25rem;">
<div class="home_list_header layout_h">
<div class="home_list_header_v_line"></div>
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择时长</span>
</div>
</div>
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;">
<div @click="isYear = false" :class="monthFrame" class="layout_center" style="margin-right: 1.875rem;">
<van-image height="100%" width="100%" v-if="!isYear" class="element_bg" src="__THEME__/img/KK@3x.png" ></van-image>
<span class="text_16_600" :class="isYear ? 'color_999999' : 'color_primary'">{{monthPrice}}</span>
</div>
<div @click="isYear = true" :class="yearFrame" class="layout_center">
<van-image height="100%" width="100%" v-if="isYear" class="element_bg" src="__THEME__/img/KK@3x.png" ></van-image>
<span class="text_16_600" :class="isYear ? 'color_primary' : 'color_999999'">{{yearPrice}}</span>
</div>
</div>
<div class="home_list_part layout_h_v_c" style="margin-top: 1.5rem;margin-bottom: 1.5rem;">
<span class="text_14_400 color_999999">数量:</span>
<van-icon @click="onMinus" name="__THEME__/img/minus.png" size="20" ></van-icon>
<span class="text_16_600 color_primary" style="margin-left: 0.5rem;margin-right: 0.5rem;">{{count}}</span>
<van-icon @click="onPlus" name="__THEME__/img/plus.png" size="20" ></van-icon>
<span class="text_14_400 color_999999" style="margin-left: 0.25rem;">{{isYear ? "年" : "月"}}</span>
</div>
</div>
<div style="background: #F5F5F5;height: 0.5rem;"></div>
<div class="layout_v">
<div class="home_list_part" style="margin-top: 1.25rem;">
<div class="home_list_header layout_h">
<div class="home_list_header_v_line"></div>
<span class="text_16_600 color_333333 self_center" style="margin-left: 0.5rem;">选择支付方式</span>
</div>
</div>
<div class="home_list_part layout_h_b" style="margin-top: 0.75rem;">
<div class="layout_h_v_c">
<van-image height="28" width="28" fit="cover" src="__THEME__/img/wechat_logo.png"></van-image>
<span class="text_14_400 color_333333" style="margin-left: 0.75rem;">微信</span>
</div>
<van-icon name="__THEME__/img/picker_y@3x.png" size="20" ></van-icon>
</div>
</div>
<div class="layout_h_v_c fixed_bottom_bar">
<span class="text_14_600 color_333333" style="margin-right: 0.5rem;">合计</span>
<span class="text_14_600 color_FF3B3B">¥{{totalPrice}}</span>
<span class="text_12_400 color_999999">{{discount}}</span>
<div class="weight_full layout_h_r">
<div class="vip_buy_pay_button layout_center"><span class="text_14_400 color_white">立即支付</span></div>
</div>
</div>
</div>
<script>
new Vue({
el: '#app',
data: function() {
return {
type: 1,
isYear: false,
count: 1,
vips: []
}
},
computed: {
monthFrame: function() {
return !this.isYear ? 'vip_buy_price_frame_none' : 'vip_buy_price_frame'
},
yearFrame: function() {
return this.isYear ? 'vip_buy_price_frame_none' : 'vip_buy_price_frame'
},
monthPrice: function() {
return this.vips.hx_firstOf( r => { return r.id == this.type }).vip_month + "元/月"
},
yearPrice: function() {
return this.vips.hx_firstOf( r => { return r.id == this.type }).vip_year + "元/年"
},
totalPrice: function() {
if(this.isYear) {
let y = this.vips.hx_firstOf( r => { return r.id == this.type }).vip_year
return (y * this.count).toFixed(2)
}
let h = this.vips.hx_firstOf( r => { return r.id == this.type }).vip_month
return (h * this.count).toFixed(2)
},
discount: function() {
return "(已优惠:¥0元)"
}
},
created:function(){
this.vips = {:json_encode($user_vip)};
this.vips.forEach( r => {
if(r.title == "乡试") {
r.color = { background: "#65C000" }
} else if(r.title == "会试") {
r.color = { background: "#32C5FF" }
} else if(r.title == "殿试") {
r.color = { background: "#F5A623" }
}
})
},
methods: {
onMinus: function() {
if(this.count - 1 >= 1) {
this.count -= 1
}
},
onPlus: function() {
this.count += 1
}
}
})
'<if condition="$is_wx eq false">'
$(function(){
var wpay = "{$_GET['wpay']}";
var ppn = "{$_GET['ppn']}";
if(wpay != ''){
$('._hide_box_h5,#_ts_box_h5').show();
$('#_layer-content').click(function(){
$('._hide_box_h5,#_ts_box_h5').hide();
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:ppn},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('充值成功');
setTimeout(function(){
window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data
},2000);
}
}catch(e){
return;
}
}
});
},1800);
});
}
});
'</if>'
//充值VIP
function rechangeVip(sbt){
var form = $(sbt).parents('form');
var pay = form.find('input:hidden[name="pay"]').val();
var type = form.find('input:hidden[name="type"]').val();
if( pay != 'alipay' && pay!='unionpay' && pay!='wxpay' && pay!='lcnpay'){
ui.error('错误的支付方式');
return false;
}
if(type != 0 && type !=1){
ui.error('充值类型错误');
return false;
}
if(!$("#vip_recharge").is(':checked')){
ui.error("请同意《{$site['site_keyword']}虚拟货币服务协议》");
return false;
}
var s = 0;
if(pay == 'wxpay'){
$.ajax({
url: "{:U('classroom/Pay/rechargeVip')}",
data:form.serialize(),
async:false,
type:'post',
success: function(data){
var data = getResponseData(data);
if(data.status == 1){
var pay_pass_num = data.data.pay_pass_num;
'<if condition="$is_wx">'
WeixinJSBridge.invoke(
'getBrandWCPayRequest',JSON.parse(data.data.html),
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ){
s = setInterval(function(){
$.ajax({
url: "{:U('classroom/Pay/getPayStatus')}",
data:{pay_pass_num:pay_pass_num},
type:'post',
success: function(res){
try{
res = JSON.parse(res);
if(res.status == 1){
clearInterval(s);
ui.success('充值成功');
setTimeout(function(){
window.location.href = "{:U('home/UserShow/index',['uid'=>$uid])}";//res.data
},1500);
}
}catch(e){
return;
}
}
});
},1800);
}
}
);
'<else/>'
var a = document.createElement('a');
a.href = data.data.html;
a.click();
return false;
'</if>'
}else{
ui.error(e.data);
setTimeout(function(){
window.location.href = '{:U("home/User/recharge")}';
},2000);
}
},
error: function(){
return false
}
});
}else if(pay == 'lcnpay'){
$.ajax({
url: "{:U('classroom/Pay/rechargeVip')}",
data:form.serialize(),
async:false,
type:'post',
dataType:"json",
success: function(data){
if(typeof data != 'object'){
var data = eval('('+data+')');
}
if(data.status == 1){
ui.success('充值成功',{
end:function(){
window.location.href = "{:U('home/User/index')}";
}
});
return true;
}else{
ui.error(e.data);
setTimeout(function(){
window.location.href = '{:U("home/User/recharge")}';
},2000);
}
},
error: function(){
return false
}
});
}else{
form.submit();
}
}
</script>
<include file="__THEME__/public_footer_w3g"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment