<?php require "layout/innerHeader.php" ?>

<!-- content -->
<section class="content pagecontent">
  <div class="container">
    <aside class="leftmenu panel-shadow" id="leftmenu">
      <h3 class="title">
        <i class="icon-dashboard"></i> 我的操作台
        <i class="arrow" onclick="$('#leftmenu').toggleClass('opened')"></i>
      </h3>
      <ul>
        <li><a href="edit-account.php">企业基本信息</a></li>
        <li><a href="forgetPsChange.php">修改登录密码</a></li>
        <li><a href="order-detail.php">新增销售订单</a></li>
        <li class="active"><a href="address-manage.php">地址管理</a></li>
      </ul>
    </aside>


    <div class="content-box panel-shadow">
      <div class="page-title">
        <h2 class="title  border-theme"><span class="text-theme">地址管理</span></h2>
      </div>

      <div class="row">
        <div class="col-md-4">
          <div class="btn-group mb10">
            <div class="input-group">
              <div class="input-group-addon">收货人</div>
              <input type="text" placeholder="请输入收货人姓名" class="form-control">
            </div>
          </div>
        </div>
        <div class="col-md-4">
          <div class="btn-group mb10">
            <div class="input-group">
              <div class="input-group-addon">手机号</div>
              <input type="text" placeholder="请输入手机号" class="form-control">
            </div>
          </div>
        </div>
        <div class="col-md-4">
          <button class="btn btn-default mb10" type="button"><i class="icon-search"></i> 查询</button>
          <button class="btn btn-default mb10 ml5" type="button">清除</button>

          <button class="btn btn-success mb10 ml10" type="button" onclick="showAddressDetail(null)"><i class="icon-plus"></i> 新增地址</button>
        </div>
      </div>

      <div class="table-responsive">
        <table class="table table-striped table-sideborder nm">
          <thead>            
            <tr>
              <th width="80">收货人</th>
              <th width="80">手机号</th>
              <th >地址</th>
              <th class="text-center">默认地址</th>
              <th width="200" class="text-center">操作</th>
            </tr>
          </thead>
          <tbody>
            <tr data-id="111">
              <td>刘XX</td>
              <td>13800000000</td>
              <td>上海市宝山区南京路12号3号楼201室</td>
              <td class="text-center"><span class="text-muted">否</span></td>
              <td class="text-center">
                <button class="btn btn-sm btn-theme" type="button">设为默认</button>
                <button class="btn btn-sm btn-theme ml5" type="button"  onclick="showAddressDetail('111')">编辑</button>
                <button class="btn btn-sm btn-danger ml5" type="button">删除</button>
              </td>
            </tr>
            <tr data-id="222">
              <td>刘XX</td>
              <td>13800000000</td>
              <td>上海市宝山区南京路12号3号楼201室</td>
              <td class="text-center"><span class="text-theme">是</span></td>
              <td class="text-center">
                <button class="btn btn-sm btn-theme" type="button" onclick="showAddressDetail('222')">编辑</button>
                <button class="btn btn-sm btn-danger ml5" type="button">删除</button>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</section>

<!--新增编辑地址-->
<div id="addressDetail" class="modal fade">
	<div class="modal-dialog">
		<form class="modal-content form-horizontal form-bordered min" action="" autocomplete="off" name="addressForm">
			<div class="modal-header">
				<button data-dismiss="modal" class="close" type="button">×</button>
				<h4 class="modal-title">新增地址</h4>
			</div>
			<div class="modal-body">
				<div class="indicator"><span class="spinner"></span></div>

				<div class="form-group">
          <label class="col-sm-3 control-label"><span class="text-danger">*</span> 收货人姓名</label>
          <div class="col-sm-6">
            <input class="form-control" name="name" value="" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label"><span class="text-danger">*</span> 联系电话</label>
          <div class="col-sm-6">
            <input class="form-control" name="phone" value="" />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-3 control-label"><span class="text-danger">*</span> 详细地址</label>
          <div class="col-sm-9">
            <textarea class="form-control" name="address" value="" rows="2"></textarea>
          </div>
        </div>
        <div class="form-group">
					<label class="col-sm-3 control-label">默认地址</label>
					<div class="col-sm-9">
						<label class="radio-inline"><input type="radio" name="setDefault" value="1">是</label>
						<label class="radio-inline"><input type="radio" name="setDefault" value="2" checked="">否</label>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary btn-submit">确定提交</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
			</div>
		</form>
	</div>
</div>

<?php include "layout/footer.php" ?>
<script type="text/javascript">
  function showAddressDetail(id){
    $("#addressDetail").modal("show").find("form[name='addressForm']").get(0).reset();
    $("#addressDetail .modal-title").text("新增地址");
    if(id){
      //获取地址信息
      $("#addressDetail .indicator").show();
      $("#addressDetail .modal-title").text("编辑地址");

      setTimeout(() => {
        $("#addressDetail .indicator").hide();
      }, 1000);
    }
  }
  $(function() {
    
  });
</script>
</body>
</html>