0
0
Files
Babyclass/resources/views/withdraw/wechat.blade.php
2020-08-04 10:17:22 +08:00

235 lines
8.2 KiB
PHP

@extends('layouts.app')
@section('content')
<section class="padding_btm">
<div class="j_account_money">
余额<span style="font-size: .8rem">{{ number_format(Auth::user()->account->cash,2)}}</span>&nbsp;&nbsp;
<br>
@if(!empty(Auth::user()->openid))
您当前绑定的微信昵称为:<span>{{ Auth::user()->info->nickname }}</span>
@endif
</div>
<!--提现-->
<form action="{{ route('withdraw.wechatdo') }}" method="get" accept-charset="utf-8">
<div class="formbox" style="border-bottom:1px solid #eee">
<div class="formbox-label">
提现方式
</div>
<div class="mode_choice">
<img src="/assets/home/img/pay001.jpg" class="mode_i">
<div class="mode_choice_text">
提现到微信零钱
</div>
<div class="mode_choice_input radio">
<input type="radio" checked id="true_message" value="0" >
<label for="payment" ></label>
</div>
</div>
</div>
<div class="formbox" id="register">
<div class="formbox-label" style="position:relative">
提现金额
<div class="touch_num all_ti">全部提现</div>
</div>
<div class="formbox-input">
<input type="hidden" name="mobile" value="{{ Auth::user()->mobile }}" >
<input type="tel" name="amount" value="" placeholder="最少提现金额为{{ $withdraw_min }}" class="formbox-input-text">
</div>
<div class="formbox-input" style="border-top: 0">
<input type="tel" name="code" value="" placeholder="短信验证码" style="width:40%;">
<button type="button" id="send" @click="sendSmsCode" class="btn pull-right has-margin-sm" style="background-color: #ddd;color: #666;border-radius: .2rem;">获取短信验证码</button>
</div>
</div>
<div class="max_notice" style="line-height:1.1rem;text-align:justify;padding:.5rem .75rem">
<i class="icon-exclamation-sign"></i>&nbsp;实际到账额度:<span id="take">0</span></br>
<i class="icon-exclamation-sign"></i>&nbsp;每次提现额度为{{ $withdraw_min }} ~ {{ $withdraw_max }}</br>
</div>
@if(empty(Auth::user()->openid))
<div class="j_bottom" style="position:static;">
<button class="j_submit btn" type="button">请先绑定微信</button>
</div>
@else
@csrf
<div class="j_bottom" style="position:static;">
<button class="j_submit btn ajax_post " tip type="button">提现</button>
</div>
@endif
</form>
</section>
@endsection
@section('script')
<script type="text/javascript">
/*填写支付宝信息*/
$("#true_message").click(function(){
var value = $(this).val();
if (value==0) {
$(this).val(1);
$(".true_show").show();
}else{
$(this).val(0);
$(".true_show").hide();
}
});
$('.ajax_post').click(function(){
var $this = $(this);
var $form = $this.parents('form');
var $tips = $this.attr('tip') || '确认要执行该操作吗?';
var $action = $form.attr("action");
$this.attr('disabled', 'disabled');
var query = $form.serialize();
var amount = $('input[name=amount]').val();
var str = '您提现'+amount+'元,实到'+amount+'元,确定要提现吗?'
layer.confirm(str, {
title:'校验信息',
btn: ['确定','取消'],
offset: ['30%', '15%'],
area: ['70%', '35%']
}, function(){
$.ajax({
type: "POST",
url: $action,
data: query,
success: function(res) {
if (res.statusCode=='200') {
if (res.redirect) {
layer.confirm(res.message, {
title:'提现成功',
btn: ['跳转','取消'],
offset: ['30%', '15%'],
area: ['70%', '35%']
}, function(){
location.href = res.redirect;
}, function(){});
}else{
updateAlert(res.message, res.status);
}
}else{
updateAlert(res.message, res.status, function() {
if (res.redirect) {
location.href = res.redirect;
}
});
}
$this.removeAttr('disabled');
},
error: function(error) {
$this.removeAttr('disabled');
if (error.responseJSON.errors) {
var err = '';
$.each(error.responseJSON.errors, function(i, n) {
err += n + "\r\n";
})
updateAlert(err, 'warning');
} else if (error.responseJSON.message) {
updateAlert(error.responseJSON.message, 'warning');
} else {
updateAlert('发生未知错误', 'warning');
}
}
});
}, function(){
$this.removeAttr('disabled');
});
});
var app = new Vue({
el: '#register',
data: {
inputMobile: false,
inputCode: false,
codeSend: false,
mobile: '',
code: ''
},
methods: {
sendSmsCode: function() {
$.post("{{ route('auth.sms') }}", {mobile: {{ Auth::user()->mobile }}, channel: "BINDLast", '_token': '{{ csrf_token() }}'}, function(res) {
if (res.statusCode == 200) {
updateAlert(res.message);
settime($('#send'));
app.codeSend = true;
} else {
updateAlert(res.message);
}
});
}
},
watch: {
mobile: function() {
var reg = /^1[3456789]{1}[0-9]{9}$|14[57]{1}[0-9]{8}$|^[0][9]\d{8}$/;
if (reg.test(this.mobile)) {
this.inputMobile = true;
} else {
this.inputMobile = false;
}
},
code: function() {
var reg = /\d{4}/;
if (reg.test(this.code)) {
this.inputCode = true;
} else {
this.inputCode = false;
}
},
},
computed: {
disable: function () {
return !(this.inputMobile && this.inputCode && this.codeSend);
}
}
});
var countdown = 60;
function settime(obj) {
if (countdown == 0) {
obj.removeAttr("disabled");
obj.html("获取验证码");
countdown = 60;
return;
} else {
obj.attr("disabled", true);
obj.html("重新发送(" + countdown + ")");
countdown--;
}
setTimeout(function() {
settime(obj)
}, 1000)
}
$('.all_ti').click(function(){
var all = parseInt("{{ Auth::user()->account->cash }}");
var withdraw_max = "{{ $withdraw_max }}";
if(all>withdraw_max){
all=withdraw_max;
}
$('input[name=amount]').val(all);
$('#take').html(all);
});
$('input[name=amount]').bind('input propertychange', function() {
var withdraw_max = "{{ $withdraw_max }}";
if($(this).val()==''){
var price=0
}else{
var price = parseInt($(this).val());
}
if(price>withdraw_max){
price=withdraw_max;
}
$(this).val(price);
var take = price;
$('#take').html(take);
});
</script>
@endsection