<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <!--validate css-->
    <link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
    <!--fileinput css-->
    <link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">

<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">

        <section class="content-header">
            <h1>
                收货地址管理管理
                <small>收货地址管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">收货地址管理</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- general form elements disabled -->
                    <div class="box box-primary">
                        <form role="form" id="myForm">
                                                            <input id="id" name="id" value="$!{data.id}" hidden="true"/>
                                                        <div class="box-body">
                                                            <div class="form-group form-md-line-input">
                                                                <label>openId<font style="color: red"></font></label>
                                                                <input type="text"
                                                                       class="form-control" name="consultId"
                                                                       id="openId" readonly="readonly"
                                                                       maxlength="50" placeholder="openId"
                                                                       value="$!{data.openId}"
                                                                >

                                                                <label>患者姓名<font style="color: red"></font></label>
                                                                <input type="text"
                                                                       class="form-control" name="addressName"
                                                                       id="addressName" readonly="readonly"
                                                                       maxlength="50" placeholder="患者姓名"
                                                                       value="$!{data.addressName}"
                                                                >
                                                                <label>性别<font style="color: red"></font></label>
                                                                <input type="text"
                                                                       class="form-control" name="sex"
                                                                       id="sex" readonly="readonly"
                                                                       maxlength="50" placeholder="性别"
                                                                       value="$!{data.sex}"
                                                                >
                                                                <label>联系方式<font style="color: red"></font></label>
                                                                <input type="text"
                                                                       class="form-control" name="phone"
                                                                       id="phone" readonly="readonly"
                                                                       maxlength="50" placeholder="联系方式"
                                                                       value="$!{data.phone}"
                                                                >
<!--                                                                       $!{data.provinceId}-->
<!--                                                                       $!{data.provinceName}-->

                                                                <label>省份<font style="color: red"></font></label><br>
                                                                <input class="form-control" id="province" name="provinceName"
                                                                       type="text" readonly="readonly"
                                                                       maxlength="50" placeholder="省份"
                                                                       value="$!{data.provinceName}"
                                                                >
<!--                                                                onchange="getCityList(this.value);"-->
<!--                                                                    <option></option>-->
                                                                </input><br>
                                                                <label>城市<font style="color: #ff0000"></font></label><br>
                                                                <input class="form-control" id="city" name="cityName"
                                                                       type="text" readonly="readonly"
                                                                       maxlength="50" placeholder="城市"
                                                                       value="$!{data.cityName}"
                                                                >
<!--                                                                       onchange="getReginList(this.value);"-->

<!--                                                                    <option></option>-->
                                                                </input><br>
                                                                <label>区/县<font style="color: red"></font></label><br>
                                                                <input class="form-control" id="county" name="countyName"
                                                                       type="text" readonly="readonly"
                                                                       maxlength="50" placeholder="城市"
                                                                       value="$!{data.countyName}"
                                                                >
<!--                                                                    <option></option>-->
                                                                </input><br>
                                                                <label>详细地址<font style="color: red"></font></label>
                                                                <input type="text"
                                                                       class="form-control" name="address"
                                                                       id="address" readonly="readonly"
                                                                       maxlength="50" placeholder="联系方式"
                                                                       value="$!{data.address}"
                                                                >

                                                            </div>

                            <div class="box-footer">
<!--                                #if($shiro.hasPermission("qy:address:edit"))-->
<!--                                <input class="btn btn-primary" id="save" value="保存" type="button"  onclick="tijiao()">-->
<!--                                #end-->
                                <a href="#springUrl('/a/address/list')" class="btn btn-default">返回</a>
                            </div>
                        </form>
                        <!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->

<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>

    let areaList=null
   let listProvince=null
   let listCity=null
   let listRegin=null
function tijiao(){
        var url = "#springUrl('/a/address/formData')"
        var provinceId = $("#province").val();
        var cityId = $("#city").val();
        var areaId = $("#county").val();
        var  address =$("#address").val();
        var id= $("#id").val();
    $.ajax({
        type: "GET",   //提交的方法
        url:url, //提交的地址
        data:{ id,provinceId,cityId,areaId,address},// 序列化表单值
        async: false,
        success: function(data) {  //成功

            if (data){

                location.href = "#springUrl('/a/address/list')";
            }else {
                alert("修改失败")
            }

        }
    });
}



    $().ready(function () {

        var sex = $("#sex").val();
        if (sex == '0') {
            $("#sex").val("女");
        } else if (sex == '0') {
            $("#sex").val("男");
        } else {
            $("#sex").val("");
        }
    })

   //     var url = "#springUrl('/a/address/listArea')"
   //      $.ajax({
   //          url:url,
   //          type:"GET",
   //          success:function(data){
   //       console.log(data)
   //              areaList=data
   //             listProvince=data.filter(x=>x.cityType==1)
   //              var province = document.querySelector('#province') //querySelector获取id="province"的元素
   //              for (index in listProvince) {
   //                  var op = new Option(listProvince[index].areaName, listProvince[index].areaId, false, false)
   //                  //将循环出来的元素追加到province下拉框里
   //                  province.options[province.length] = op
   //              }
   //              var  provinceId = "$!{data.provinceId}";
   //              $('#province option').each(function () {
   //                 if($(this).val() == provinceId){
   //                     $(this).attr('selected', 'selected');
   //                     getCityList(provinceId);
   //                 }
   //              })
   //
   //          }
   //      });
   //      // var all_select = $('#province > option')
   //      //
   //      // for (var i = 0; i < all_select.length; i++) {
   //      //     console.log(all_select.length)
   //      //     var svalue = all_select[i]
   //      //     console.log(svalue+"$!{data.provinceId}")
   //      //     if (svalue == '') {
   //      //         console.log("$!{data.provinceName}")
   //      //         //取select中所有的option的值与其进行对比，相等则令这个option添加上selected属性
   //      //         $("#province option[value='" + svalue + "']").attr('selected', 'selected')
   //      //     }
   //      // }'
   //
   //
   //
   //
   //      Cfapp.init();
   //      // recdTypeAdd.init();
   //  });
   //
   //  function getCityList(areaId) {
   //      listCity=areaList.filter(x=>x.affiliationareaId==areaId&&x.cityType==2)
   //      $("#city").empty();
   //      $("#county").empty();
   //       var city = document.querySelector('#city')
   //      for (index in listCity) {
   //          var op = new Option(listCity[index].areaName, listCity[index].areaId, false, false)
   //          //将循环出来的元素追加到province下拉框里
   //          city.options[city.length] = op
   //      }
   //      var  cityId = "$!{data.cityId}";
   //      $('#city option').each(function () {
   //          if($(this).val() == cityId){
   //              $(this).attr('selected', 'selected');
   //              getReginList(cityId);
   //          }
   //      })
   //
   //  }
   //
   // function getReginList(areaId) {
   //     listRegin=areaList.filter(x=>x.affiliationareaId==areaId&&x.cityType==3)
   //     $("#county").empty();
   //      var county = document.querySelector('#county')
   //     for (index in listRegin) {
   //         // 1、new Option("文本","值",true,true).后面两个true分别表示默认被选中和有效
   //         var op = new Option(listRegin[index].areaName, listRegin[index].areaId, false, false)
   //         //将循环出来的元素追加到province下拉框里，第一次训话length=1，第二次循环length=2
   //         county.options[county.length] = op
   //     }
   //     var  countyId = "$!{data.countyId}";
   //     $('#county option').each(function () {
   //         if($(this).val() == countyId){
   //             $(this).attr('selected', 'selected');
   //         }
   //     })
   // }
   //
   //
   //
   //




    // var recdTypeAdd = function () {
    //     var initForm = function () {
    //         var initFormCtrl = function () {
    //             bindEvent();
    //         };
    //         var bindEvent = function () {
    //
    //             $("#myForm").validate({
    //                 rules: {},
    //                 messages: {},
    //                 submitHandler: function (form) {
    //                     // $("#save").attr("disabled", true);
    //
    //                     $.getJSON("#springUrl('/a/address/formData')",$("#myForm").serialize(), function (returnobj) {
    //                         // $("#save").attr("disabled", false);
    //                         if (returnobj.errorNo == 2) {  //保存成功
    //                             Cfapp.confirm({
    //                                 message: "添加成功",
    //                                 btnoktext: "继续添加",
    //                                 btncanceltext: "关闭",
    //                                 success: function () {
    //                                     location.href = "#springUrl('/a/address/form')";
    //                                 },
    //                                 cancel: function () {
    //                                     location.href = "#springUrl('/a/address/list')";
    //                                 }
    //                             });
    //                         } else if (returnobj.errorNo == 0) {  //修改成功
    //                             Cfapp.alert({
    //                                 message: "更新成功",
    //                                 btntext: "确定",
    //                                 success: function () {
    //                                     location.href = "#springUrl('/a/address/list')";
    //                                 }
    //                             });
    //                         } else {
    //                             Cfapp.alert({
    //                                 message: "创建失败",
    //                                 btntext: "确定",
    //                                 success: function () {
    //                                     location.href = "#springUrl('/a/address/list')";
    //                                 }
    //                             });
    //                         }
    //                     });
    //                 }
    //             })
    //         }
    //         initFormCtrl();
    //     }
    //     return {
    //
    //         //main function to initiate the module
    //         init: function () {
    //             initForm();
    //         }
    //
    //     };
    // }();
</script>
</body>
<!-- END BODY -->
</html>