<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  <title><?php echo $shoname; ?></title>
  <link rel="shortcut icon" href="" />
        
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">

  <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->

  <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  <script type="text/javascript">
      window.sysinfo = {
        <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
        <?php if( !empty($_W['acid'])  ){ ?>'acid': '{$_W['acid']}',<?php } ?>
        <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
        <?php if( !empty($_W['uid']) ) {  ?>'uid': '{$_W['uid']}',<?php } ?>
        'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php  }else{  ?>0<?php } ?>,
        'siteroot': '{$_W['siteroot']}',
        'siteurl': '{$_W['siteurl']}',
        'attachurl': '{$_W['attachurl']}',
        'attachurl_local': '{$_W['attachurl_local']}',
        'attachurl_remote': '{$_W['attachurl_remote']}',
        'module': {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
        'cookie': {'pre': ''},
        'account': {:json_encode($_W['account'])},
      };
  </script>
		
  <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  <link href="/static/css/snailfish.css" rel="stylesheet">
</head>
<body layadmin-themealias="default">

<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-header layui-elem-quote">当前位置：<span class="line-text">供应商提现</span></div>
		<div class="layui-card-body" style="padding:15px;">
			
			<form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
				
				<div class="layui-form-item">
					<label class="layui-form-label">打款类型</label>
					<div class="layui-input-block">
						<?php if($supply_commiss_tixianway_weixin == 2){ ?>
						<label class='radio-inline'>
							<input type='radio' name='supply_apply_type' title="微信（审核后自动打款）" value=1 <?php if( $last_tixian_order['bankname'] == '微信'){ ?>checked<?php } ?> /> 
						</label>
						<?php } ?>
						<?php if($supply_commiss_tixianway_alipay == 2){ ?>
						<label class='radio-inline'>
							<input type='radio' name='supply_apply_type' title="支付宝（审核+手动转账）" value=2  <?php if( $last_tixian_order['bankname'] == '支付宝'){ ?>checked<?php } ?> /> 
						</label>
						<?php } ?>
						
						<?php if($supply_commiss_tixianway_bank == 2){ ?>
						 <label class='radio-inline'>
							<input type='radio' name='supply_apply_type' value=3 title="银行卡（审核+手动转账）"  <?php if( $last_tixian_order['bankname'] != '微信' && $last_tixian_order['bankname'] != '支付宝' &&$last_tixian_order['supply_apply_type'] != 4){ ?>checked<?php } ?> /> 
						</label>
						<?php } ?>
						
						
						<?php if($supply_commiss_tixianway_weixin_offline == 2){ ?> 
						 <label class='radio-inline'>
							<input type='radio' name='supply_apply_type' value=4  title="微信私下转（审核+手动转账）" <?php if( $last_tixian_order['supply_apply_type'] == 4 ){ ?>checked<?php } ?> /> 
						</label>
						<?php } ?>
						
					</div>
				</div>
				<?php if($supply_commiss_tixianway_weixin == 2){ ?>
				<div id="weixin" <?php if( $last_tixian_order['bankname'] != '微信'){ ?> style="display:none;"<?php } ?>>
					
					
					
					<?php if( empty($bind_member) ){ ?>
					<div class="layui-form-item">
						<label class="layui-form-label must">绑定微信号</label>
						<div class="layui-input-block">
							未绑定，请联系平台管理员绑定
							<input type="text" name="nousername"  style="display:none;" />
							<input type="text" name="weixin_account" value="11" style="display:none;" />
						</div>
					</div>
					<?php }else{ ?>
					<div class="layui-form-item">
						<label class="layui-form-label must">绑定微信号</label>
						<div class="layui-input-block">
							{$bind_member['username']}
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label must">微信真实姓名</label>
						<div class="layui-input-block">
							<input type="text" name="nousername" value="11" style="display:none;" />
							<input type="text" name="weixin_account" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankaccount']}"  />
							<span class='help-block'></span>
						</div>
					</div>
					<?php } ?>
					
				</div>
				<?php } ?>
				<?php if($supply_commiss_tixianway_alipay == 2){ ?>
				<div id="alpay" <?php if( $last_tixian_order['bankname'] != '支付宝'){ ?> style="display:none;"<?php } ?>>
					<div class="layui-form-item">
						<label class="layui-form-label must">支付宝账号</label>
						<div class="layui-input-block">
							<input type="text" name="alipay_account" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankaccount']}"  />
							<span class='help-block'></span>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label must">支付宝真实姓名</label>
						<div class="layui-input-block">
							<input type="text" name="alipay_truename" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankusername']}"  />
							<span class='help-block'></span>
						</div>
					</div>
				</div>
				<?php } ?>
				<?php if($supply_commiss_tixianway_bank == 2){ ?>
				<div id="iccard" <?php if( $last_tixian_order['bankname'] == '支付宝' || $last_tixian_order['bankname'] == '微信' || $last_tixian_order['supply_apply_type'] == 4){ ?> style="display:none;"<?php } ?>>
					<div class="layui-form-item">
						<label class="layui-form-label must">银行名称</label>
						<div class="layui-input-block">
							<input type="text" name="card_name" data-rule-required="true" class="form-control" value="<?php if(  $last_tixian_order['supply_apply_type'] == 3){ ?>{$last_tixian_order['bankname']}<?php } ?>"  />
							<span class='help-block'></span>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label must">银行卡账户</label>
						<div class="layui-input-block">
							<input type="text" name="card_account" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankaccount']}"  />
							<span class='help-block'></span>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label must">持卡人姓名</label>
						<div class="layui-input-block">
							<input type="text" name="card_username" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankusername']}"  />
							<span class='help-block'></span>
						</div>
					</div>
				</div>
				<?php } ?>
				
				
				<?php if($supply_commiss_tixianway_weixin_offline == 2){ ?> 
				<div id="iccard_wx" <?php if( $last_tixian_order['supply_apply_type'] != 4 ){ ?> style="display:none;"<?php } ?>>
					<div class="layui-form-item">
						<label class="layui-form-label must">微信号：</label>
						<div class="layui-input-block">
							<input type="text" name="weixin_account_xx" data-rule-required="true" class="form-control" value="{$last_tixian_order['bankaccount']}"  />
							<span class='help-block'>准确可搜索到的微信号</span>
						</div>
					</div>
				</div>
				<?php } ?>
				
				<div class="layui-form-item">
					<label class="layui-form-label must">提现金额</label>
					<div class="layui-input-block">
						<input type="text" name="ti_money" id="ti_money" data-rule-required="true" class="form-control" value="{$supply_commiss['money']}"  />
						<span class='help-block'>最低提现金额 {$supply_min_apply_money},本次最多可提现 <span class="text-danger">{$supply_commiss['money']}</span>,
							提现手续费<span class="text-danger">{$commiss_bili}%</span>,共<b id="fuwu_free"></b>元,最终到账<b id="final_money"></b>元
						</span>
					</div>
				</div>
				<div class="layui-form-item">
				  <label class="layui-form-label"></label>
				  <div class="layui-input-block">
					<input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
				  </div>
				</div>
			</form>
		</div>
	</div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>

<script>
	layui.config({
		base: '/layuiadmin/' //静态资源所在路径
	}).extend({
		index: 'lib/index' //主入口模块
	}).use('index');
</script>

<script>
//由于模块都一次性加载，因此不用执行 layui.use() 来加载对应模块，直接使用即可：
var layer = layui.layer;
var $;

layui.use(['jquery', 'layer','form','colorpicker'], function(){ 
  $ = layui.$;
  var form = layui.form;
  var colorpicker = layui.colorpicker;
 
	
   //表单赋值
    colorpicker.render({
      elem: '#minicolors'
      ,color: '{$data['nav_bg_color']}'
      ,done: function(color){
        $('#test-colorpicker-form-input').val(color);
      }
    });
  
  //监听提交
  form.on('submit(formDemo)', function(data){
	
	
			var allRadio = document.getElementsByName("supply_apply_type");
			var i;
			
			for( i = 0; i < allRadio.length; i++) {
			
				if(allRadio[i].checked && allRadio[i].value =="1"){
					var nun = document.getElementsByName("nousername")[0];
					var wa = document.getElementsByName("weixin_account")[0];
					var reg = /^\s*$/	
					
					if ( reg.test(nun.value) ) {
						layer.msg('未绑定，请联系平台管理员绑定', {icon: 5});
						return false;
					}
					
					if ( reg.test(wa.value) ) {
						layer.msg('微信真实姓名', {icon: 5});
						return false;
					}
				}
			
			
				if(allRadio[i].checked && allRadio[i].value =="2"){
					var aa = document.getElementsByName("alipay_account")[0];
				
					var reg = /^\s*$/
					if ( reg.test(aa.value) ) {
						layer.msg('请填写支付宝账号', {icon: 5});
						return false;
					}
				}

				
				if(allRadio[i].checked && allRadio[i].value =="3"){
					var cn = document.getElementsByName("card_name")[0];
					var ca = document.getElementsByName("card_account")[0];
					var cu = document.getElementsByName("card_username")[0];
					var reg = /^\s*$/
					if ( reg.test(cn.value) ) {
						layer.msg('请填写银行名称', {icon: 5});
						return false;
					}
					if ( reg.test(ca.value) ) {
						layer.msg('请填写银行卡账户', {icon: 5});
						return false;
					}
					if ( reg.test(cu.value) ) {
						layer.msg('请填写持卡人姓名', {icon: 5});
						return false;
					}
				
				}
				
				if(allRadio[i].checked && allRadio[i].value =="4"){
					var wa = document.getElementsByName("weixin_account_xx")[0];
					var reg = /^\s*$/
					if ( reg.test(wa.value) ) {
						layer.msg('请填写微信号', {icon: 5});
						return false;
					}
			}
	}
		
	 $.ajax({
		url: data.form.action,
		type: data.form.method,
		data: data.field,
		dataType:'json',
		success: function (info) {
		  
			if(info.status == 0)
			{
				layer.msg(info.result.message,{icon: 1,time: 2000});
			}else if(info.status == 1){
				var go_url = location.href;
				if( info.result.hasOwnProperty("url") )
				{
					go_url = info.result.url;
				}
				
				layer.msg('操作成功',{time: 1000,
					end:function(){
						location.href = info.result.url;
					}
				}); 
			}
		}
	});
	
    return false;
  });
})

</script>  
<script>

var tixian_free = {$commiss_bili};


$(function(){
	
	tongji_free();
	
	$('input[name=supply_apply_type]').click(function(){
		var s_type = $(this).val();
		
		if(s_type == 1)
		{
			$('#alpay').hide();
			$('#iccard').hide();
			$('#iccard_wx').hide();
			$('#weixin').show();
		}else if(s_type == 2){
			$('#weixin').hide();
			$('#iccard').hide();
			$('#iccard_wx').hide();
			$('#alpay').show();
		}else if( s_type == 3){
			$('#weixin').hide();
			$('#alpay').hide();
			$('#iccard_wx').hide();
			$('#iccard').show();
		}else if( s_type == 4){
			$('#weixin').hide();
			$('#alpay').hide();
			$('#iccard').hide();
			$('#iccard_wx').show();
		}
	})
	
	$('#ti_money').on('change', function(){
		tongji_free();
	})
	
})

function tongji_free()
{
	var  ti_money = $('#ti_money').val();
	
	var tongj_money =  ( ( parseFloat(ti_money) * tixian_free ) / 100 ).toFixed(2);
	var final_money = (ti_money-tongj_money).toFixed(2);
    tongj_money = '<span class="text-danger">'+tongj_money+'</span>';
	$('#fuwu_free').html( tongj_money );
    $('#final_money').html( '<span class="text-danger">'+final_money+'</span>' );

}
</script>

</body>
</html>