<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "makerz"}-->
<div class="layui-fluid oe_fluid" style="padding-top:10px;">

  <div class="layui-card">
    <div class="layui-card-header">人工实名认证</div>
    <div class="layui-card-body">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th><font color="red"></font>会员：</th>
          <td colspan="3">
            <!--{if !empty($user.headimg)}-->
            <img src="<!--{$user.headimg}-->" width="20px" height="20px" f="viewimg" />
            <!--{/if}-->
            <!--{$user.username}-->/uid:<!--{$user.userid}-->/<!--{$user.age}-->岁/
            <!--{hook mod="var" item="gender" type="text" value=$user.gender}-->
          </td>
        </tr>
        
        <tr>
          <th width="14%"><font color="red">*</font> 性别：</th>
          <td width="36%">
            <div class="layui-input-inline input-150">
            <!--{hook mod="var" item="gender" name="gender" type="select" text="=请选择=" value=$user.gender}-->
            </div>
          </td>
          <th width="14%"><font color="red">*</font> 生日：</th>
          <td width="36%">
            <div class="layui-input-inline input-80"><!--{hook mod="year" name="ageyear" type="select" text="年"  value=$user.ageyear}--></div> - 
            <div class="layui-input-inline input-80"><!--{hook mod="month" name="agemonth" type="select" text="月" value=$user.agemonth}--></div> - 
            <div class="layui-input-inline input-80"><!--{hook mod="day" name="ageday" type="select" text="日" value=$user.ageday}--></div>
          </td>
        </tr>
        <tr>
          <th>真实姓名：</th>
          <td>
            <input type="text" name="truename" id="truename" class="layui-input input-150" value="<!--{$user.truename}-->" />
          </td>
          <th>身份证号：</th>
          <td>
            <input type="text" name="idnumber" id="idnumber" class="layui-input input-200" f="user_checkcan" data-type="idnumber" data-uid="<!--{$user.userid}-->" value="<!--{$user.idnumber}-->" />
            <span id="idnumber_tips"></span>

          </td>
        </tr>
        <tr>
          <th>身份证正面：</th>
          <td>
            <div class="layui-btn">
              <i class="layui-icon layui-icon-upload"></i>
              点击上传
              <input type="file" name="img1" id="img1" value="" f="but_upload_image" data-mod="paper" />
            </div>
            <div class="upload_loading" id="img1_loading" style="display:none;"></div>
            <input type="hidden" id="img1_thumb" name="img1_thumb" value="" />
            <input type="hidden" id="img1_url" name="paper1" value="<!--{$user.paper1}-->" />
 
            <div class="tblform_tips normal">&nbsp;&nbsp;&nbsp;预览：</div>
            <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
              <img src="<!--{$urlpath}--><!--{if !empty($user.paper1)}--><!--{$user.paper1}--><!--{else}-->tpl/static/images/waitimg.jpg<!--{/if}-->" width="30px" height="30px" id="img1_preview" f="viewimg" />
            </div>
            <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img1" data-input="img1">移除</a>
          </td>
          <th>身份证反面：</th>
          <td>
            <div class="layui-btn">
              <i class="layui-icon layui-icon-upload"></i>
              点击上传
              <input type="file" name="img2" id="img2" value="" f="but_upload_image" data-mod="paper" />
            </div>
            <div class="upload_loading" id="img2_loading" style="display:none;"></div>
            <input type="hidden" id="img2_thumb" name="img2_thumb" value="" />
            <input type="hidden" id="img2_url" name="paper2" value="<!--{$user.paper2}-->" />
            
            <div class="tblform_tips normal">&nbsp;&nbsp;&nbsp;预览：</div>
            <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
              <img src="<!--{$urlpath}--><!--{if !empty($user.paper2)}--><!--{$user.paper2}--><!--{else}-->tpl/static/images/waitimg.jpg<!--{/if}-->" width="30px" height="30px" id="img2_preview" f="viewimg" />
            </div>
            <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img2" data-input="img2">移除</a>
          </td>
        </tr>
        
        <tr>
          <th>手持身份证：</th>
          <td>
            <div class="layui-btn">
              <i class="layui-icon layui-icon-upload"></i>
              点击上传
              <input type="file" name="img3" id="img3" value="" f="but_upload_image" data-mod="paper" />
            </div>
            <div class="upload_loading" id="img3_loading" style="display:none;"></div>
            <input type="hidden" id="img3_thumb" name="img3_thumb" value="" />
            <input type="hidden" id="img3_url" name="paper3" value="<!--{$user.paper3}-->" />
 
            <div class="tblform_tips normal">&nbsp;&nbsp;&nbsp;预览：</div>
            <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
              <img src="<!--{$urlpath}--><!--{if !empty($user.paper3)}--><!--{$user.paper3}--><!--{else}-->tpl/static/images/waitimg.jpg<!--{/if}-->" width="30px" height="30px" id="img3_preview" f="viewimg" />
            </div>
            <a href="javascript:;" class="oe_deluploadimg" f="removeimg" data-preview="img3" data-input="img3">移除</a>
          </td>
          <th>认证状态：</th>
          <td>
            <div class="layui-input-inline input-150">
            <select name="idrz" id="idrz">
              <option value="">请选择</option>
              <option value="1"<!--{if $user.idrz == '1'}--> selected<!--{/if}-->>实名通过</option>
              <option value="0"<!--{if $user.idrz == '0'}--> selected<!--{/if}-->>待实名</option>
            </select>
            </div>
          </td>
        </tr>
              
      </table>
    </div>
  </div>

  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>
  
</div>

<script type="text/javascript">
$(function(){
    layui.use('form', function(){
        $form = layui.form;
        //编辑保存...
        $form.on('submit(editform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
                
                $gender = $("#gender").val();
                $ageyear = $("#ageyear").val();
                $agemonth = $("#agemonth").val();
                $ageday = $("#ageday").val();
                $truename = $("#truename").val();
                $idnumber = $("#idnumber").val();
                $paper1 = $("#img1_url").val();
                $paper2 = $("#img2_url").val();
                $paper3 = $("#img3_url").val();
                $idrz = $("#idrz").val();
                
                if ($gender == "0" || $gender == "") {
                    layer.msg("请选择性别");
                    return false;
                }
                if ($ageyear == "0" || $ageyear == "") {
                    layer.msg("请选择出生日期年");
                    return false;
                }
                if ($agemonth == "0" || $agemonth == "") {
                    layer.msg("请选择出生日期月");
                    return false;
                }
                if ($ageday == "0" || $ageday == "") {
                    layer.msg("请选择出生日期日");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"savemakerz", id:"<!--{$uid}-->", 
                        gender:$gender, ageyear:$ageyear, agemonth:$agemonth, ageday:$ageday, 
                        truename:$truename, idnumber:$idnumber, paper1:$paper1, paper2:$paper2, 
                        paper3:$paper3, idrz:$idrz, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function($data) {
                        $json = eval($data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("编辑成功");
                            setTimeout(function(){
                              window.parent.location.reload();
                            }, 800);
                        }
                        else {
                            if ($result.length == 0) {
                                $result = "编辑失败，请检查";
                            }
                            layer.msg($result);
                        }
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });
            }
        });   
    });
    
});
</script>
<!--{/if}-->
</body>
</html>