You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

454 lines
16 KiB
HTML

5 years ago
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/platform.css" rel="stylesheet">
<style>
.trunk-list .table3 {width: 100%;}
.table3 tr td{border: 1px solid #E0E7EF;}
.pagenation{line-height: 6.5vh;}
.pagenation>div {text-align: right;}
.trunk-list .table3 tr {height: 4.2vh;}
</style>
</block>
<block name="body">
<div class="page-search normal_list charge-agentPay-search">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>福利></span><span>平台币代充</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_yve.png"><span class="title_main">平台币代充</span>
</div>
<div class="trunk-content article" style="height: 622px;">
<div class="trunk-search clearfix">
<div class="tab">
<a href="#" class="current">给玩家代充</a>
<a href="{:U('agent_pay_list')}" class="">代充记录</a>
</div>
</div>
<div class="trunk-list">
<form id="form" action="{:U('agent_pay')}" method="post">
<table class="table2">
<tr>
<td class="l"><span class="req">*</span>我的账户余额:</td>
<td class="r">
<span >{$pro.balance_coin}元</span>
<span class="noticetxt"></span>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>游戏名称:</td>
<td class="r">
<select id="game_id" name="game_id" class="reselect select_gallery" style="width:220px;">
<option value="" data="0">请选择游戏</option>
<volist name=":get_apply_game_welfare_list(session('promote_auth.pid'))" id="vo">
<option data="{$vo.discount}" value="{$vo.game_id}">{$vo.game_name}</option>
</volist>
</select>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>充值用户名:</td>
<td class="r">
<select id="account" name="user_account" class="reselect select_gallery" style="width:220px;">
<option value="">请选择充值用户</option>
<volist name=":get_user_by_game(session('promote_auth.pid'))" id="vo">
<option value="{$vo.user_account}">{$vo.user_account}</option>
</volist>
</select>
<span class="noticetxt">(玩家必须为本渠道下玩家)</span>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>充值金额:</td>
<td class="r"><input type="text" class="txt" id="pay_fmoney" name="amount" autocomplete="off" placeholder="请输入充值金额">
<span class="noticetxt">(请输入整数)</span>
</td>
</tr>
<tr class="zhe">
<td class="l">折扣:</td>
<td class="r" id="tgghdaichongfirstzhekou" style="font-size: 16px; color: red;font-weight: bolder;" autocomplete="off">
折扣
</td>
</tr>
<tr>
<td class="l">充值方式:</td>
<td class="r form-radio jspayradio">
<if condition="get_tool_status('alipay') eq 1 ">
<!--<label><input type="radio" value="alipay" name="pay_type"><i class=""></i><span>支付宝</span></label>-->
</if>
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1">
<label><input type="radio" value="swiftpass" name="pay_type"><i></i><span>微信</span></label>
</if>
<if condition="get_tool_status('goldpig') eq 2">
<label><input type="radio" value="goldpig" name="pay_type"><i></i><span>金猪支付</span></label>
</if>
<label><input type="radio" value="pingtaibi" name="pay_type"><i></i><span>平台币</span></label>
</td>
</tr>
<tr>
<td class="l">
应付金额:</td><td class="r"><span style="font-size: 18px;color: #ff7d16;font-weight: 600;" id="yingfu">0</span>
<input name="discount" value="" id="discount" type="hidden">
</td>
</tr>
<tr>
<td class="l">
实付金额:</td><td class="r"><span style="font-size: 18px;color: #ff7d16;font-weight: 600;" id="shifu">0</span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<button type="button" class="tjbnt btn" onclick="check()" >确认</button>
<input type="hidden" name="server_id" value="0">
<input type="hidden" name="server_name" value="">
<input type="hidden" name="real_amount" id="real_amount" value="0">
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="page-explain charge-agentPay-explain">
<div class="trunk-content article border_normal">
<table class="desccontent">
<tr><td class="title" style="width: 100px;display: inline-block;">会长代充说明:</td><td class="det">会长代充功能是指,会长通过推广员后台给渠道下玩家折扣充值的功能;会长代充可使用账户平台币余额支付,亦可以下方支付方式现金支付;会长代充后将以绑定平台币的形式发放到玩家账户。</td></tr>
</table>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(function(){
$("#promote_child").change();
$(".select_gallery").select2();
$('.jspayradio input:first').prop('checked',true).siblings('i').addClass('current');
$('.jspayradio input').click(function() {
var that=$(this);
$('.jspayradio i').removeClass('current');
if (that.prop('checked')) {
that.siblings('i').addClass('current');
}
});
$(".zhe").hide();
});
$('#game_id').change(function(){
if($("#game_id option:selected").val() !=""){
$(".zhe").show();
}else{
$(".zhe").hide();
}
var radio = $("#game_id option:selected").attr('data');
//radio = radio/10;
$('.zhe td.r').html(radio+"折");
$("#discount").val(radio);
var uccount = $('#account');
var game_id = $(this).val();
$.ajax({
type:'post',
dataType:'json',
data:{game_id:game_id},
url:'{:U("get_user_play")}',
success:function(data) {
uccount.find('option').remove().end().append('<option value="">请选择充值用户</option>');
if(parseInt(data.status)==1) {
var html = '';
$.each(data.data,function(i,n) {
html += '<option value="'+n.user_account+'">'+n.user_account+'</option>';
});
uccount.append(html);
uccount.select2();
} else {
layer.msg(data.info);
}
},
error:function() {
layer.msg('服务器故障!');
}
});
});
$(function () {
if($("#game_id option:selected").val() !=""){
$(".zhe").show();
}else{
$(".zhe").hide();
}
var radio = $("#game_id option:selected").attr('data');
$('.zhe td.r').html(radio+"折");
$("#discount").val(radio);
});
function sub_from() {
var pay_type = $("input[name='pay_type']:checked").val();
if(pay_type) {
var form = $('#form');
if(pay_type == 'swiftpass') {
$.ajax({
type:'post',
dataType:'json',
url:'{:U("agent_pay_action")}',
data:form.serialize(),
success:function(data) {
if(parseInt(data.status)==1) {
if(data.data) {
img_qrcode(data.data);
}else if(data.url) {
window.location.href=data.url;
} else {
layer.msg(data.info);
}
} else {
layer.msg(data.info);
}
},
error:function() {
layer.msg('服务器故障!');
}
});
} else {
form.submit();
}
} else {
layer.msg('请选择充值方式');
}
}
function check() {
data = validation();
if (data.status != 1) {
layer.msg(data.msg, {icon: 2});
return false;
} else {
if($("input[name='pay_type']:checked").val()) {
layer.prompt(
{
formType: 1,
title: '请输入二级密码',
value: ''
},
function (val) {
$.ajax({
url: '{:U("checkpwd")}',
type: 'post',
dataType: 'json',
data: {'pwd': val},
success: function (data) {
if (data.status > 0) {
sub_from();
} else {
layer.msg(data.msg)
}
},
error: function () {
alert("错误");
}
});
});
} else {
layer.msg('请选择充值方式');
}
}
}
$("#pay_fmoney").keyup(function () {
var ratio = $("#discount").val();
var jine = $(this).val();
if(ratio ==''){layer.msg("请选择充值游戏名称");$(this).val('');}
if (jine) {
if (/^\+?[1-9][0-9]*$/.test(jine)) {
if (ratio >= 1) {
var real_amount = (jine * (ratio / 100) * 10).toFixed(2);
$("#yingfu").html(jine);
$("#real_amount").val(real_amount);
$("#shifu").html(real_amount);
} else {
var money = $(this).val();
$("#yingfu").html(money);
$("#real_amount").val(money);
$("#shifu").html(money);
}
} else {
$("#yingfu").html(0);
$("#shifu").html(0);
layer.msg("充值金额必须是正整数");
}
} else {
$("#yingfu").html(0);
$("#shifu").html(0);
}
});
function validation() {
var json_data = "";
var limits = {$pro['pay_limit']};
if ($("#game_id").val() == '') {
return json_data = {'status': 0, 'msg': '请选择充值游戏名称'}
}
if ($.trim($('#account').val()).length == 0) {
return json_data = {'status': 0, 'msg': '充值用户名不能为空'}
}
if (!checkAccount()) {
return json_data = {'status': 0, 'msg': '此用户没玩过这个游戏'}//此用户不属于您的渠道
}
if ($.trim($('#pay_fmoney').val()).length == 0 || $("#real_amount").val() == 0) {
return json_data = {'status': 0, 'msg': '充值金额不能为空'}
}
if (!intege($('#pay_fmoney').val())) {
return json_data = {'status': 0, 'msg': '充值金额必须是正整数'};
}
if (!checkSecond()) {
return json_data = {'status': 0, 'msg': '请设置二级密码'}
}
return json_data = {'status': 1, 'msg': '成功'};
}
$("#account").on('change',function() {
if($.trim($('#game_id').val())=='') {
$(this).val('');layer.msg('请先选择游戏');return false;
}
return false;
});
$("#account").blur(function () {
var status = checkAccount();
var account = $('#account').val();
if(account!=''){
if (!status) {
layer.msg('此用户没玩过这个游戏', {icon: 2});
}
}
})
function checkSecond() {
var status = 1;
$.ajax({
type: "post",
url: "{:U('checkSecond')}",
async: false,
dataType: "json",
success: function (data) {
status = data.status;
}
});
return status;
}
function checkAccount() {
var status = 0;
$.ajax({
type: "post",
url: "{:U('checkAccount')}",
async: false,
data: {user_account: $("#account").val(), game_id: $("#game_id").val()},
dataType: "json",
success: function (data) {
status = data.status;
}
});
// alert(status);
return status;
}
function intege(data) {
var re = /^[1-9]+[0-9]*]*$/;
if (!re.test(data)) {
return false;
}
else {
return true;
}
}
$("#promote_child").change(function(){
var coin = get_child_coin($(this).val());
$("#money").text(coin+'元')
})
function get_child_coin(cid){
var coin = 0;
$.ajax({
url:"{:U('PromoteCoin/get_coin')}",
data:{id:cid},
type:'post',
async:false,
success:function(data){
coin = data.coin;
},
errror:function(){
layer.msg("服务器故障!");
}
});
if(coin == null){
coin = 0;
}
return coin;
}
</script>
<script type="text/javascript">
function img_qrcode(data) {
layer.open({
type: 1,
title: "微信扫码支付",
closeBtn: 1,
shadeClose: true,
skin: 'yourclass',
btn:['确认充值','返回'],
content: '<div class="d_body" style="height:px;text-align:center;"><div class="d_content"><div class="text_center"> <table class="list" align="right" width="100%"><tbody><tr><td class="text_right">订单号</td><td class="text_left">' + data.out_trade_no + '</td></tr><tr><td class="text_right">充值金额</td><td class="text_left">本次充值' + data.amount + '元,实际付款' + data.pay_money + '元</td></tr></tbody></table><img src="' + data.code_img_url + '" height="301" width="301"><img src="/Public/Media/images/wx_pay_tips.png"></div></div></div>',
end:function(){window.location.href="{:U('Charge/agent_pay')}";}
});
var order_number = "'"+data.out_trade_no+"'";
setInterval("callback("+order_number+")",1000);
}
</script>
<script type="text/javascript">
function callback(out_trado_no) {
$.ajax({
type: 'POST',
url: "{:U('Charge/checkOrder')}" ,
data:{"order_number":out_trado_no},
success:function(data){
if (data.status > 0){
layer.msg('支付成功');
window.location.href = "{:U('Charge/agent_pay_list')}"
}
}
});
}
</script>
</block>