@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="row">
                <div class="col-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">{{ __('auto.绑定手机号') }}</h4>

                            <form class="forms-sample" id="form">

                                <div class="form-group">
                                    <label for="nickname">*手机号</label>
                                    <input type="text"  class="form-control required" name="PhoneNum" placeholder="{{ __('auto.请输入绑定手机号') }}" maxlength="11" minlength="5">
                                </div>
                                <div class="form-group">
                                    <label for="nickname">*密码</label>
                                    <input type="text"  class="form-control required" name="LogonPass" placeholder="{{ __('auto.请输入登录密码') }}" maxlength="32" minlength="1">
                                </div>

                                <button type="button" onclick="commit({{ $UserID }})" class="btn btn-sm btn-gradient-primary btn-icon-text">
                                    <i class="mdi mdi-file-check btn-icon-prepend"></i>
                                    {{ __('auto.提交') }}
                                </button>
                                <button type="button" onclick="cancel()" class="btn btn-sm btn-gradient-warning btn-icon-text">
                                    <i class="mdi mdi-reload btn-icon-prepend"></i>
                                    {{ __('auto.取消') }}
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>


        function commit(UserID){


            var data = $("#form").serializeObject();


            myRequest("/admin/code/bind_phone/"+UserID,"post", data,function(res){
                if(res.code == '200'){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        parent.location.reload();
                    },1500)
                }else{
                    layer.msg(res.msg)
                }
            });
        }
        function cancel() {
            parent.location.reload();
        }
    </script>
@endsection
