123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- ##tlayout("www/layout.htm"){
- <nav class="my-nav">
- <ul class="container list-unstyled nav-list clearfix">
- <li><a href="/user">个人中心</a></li>
- <li><a href="/user/orders">我的订单</a></li>
- <li><a href="/user/diy">我的定制</a></li>
- <li class="active"><a href="/user/address">收货地址</a></li>
- </ul>
- </nav>
- <section class="container">
- <div class="row my-account">
- <div class="col-sm-2">
- <ul class="list-unstyled account-list">
- <li class="active">
- <a href="/user/address">收货地址</a>
- </li>
- </ul>
- </div>
- <div class="col-sm-10">
- <div class="account-form">
- <h3 class="account-title">收货地址</h3>
- <form class="order-form" action="/user/updateAddress" method="post" id="submit_form">
- <div class="row">
- <div class="form-group col-sm-6">
- <label><span style="color: red;">*</span>收件人</label>
- <input type="text" class="form-control" name="take_name" placeholder="请输入收件人" value="${user.take_name!}" />
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-6">
- <label><span style="color: red;">*</span>手机号</label>
- <input type="text" class="form-control" name="take_phone" placeholder="请输入手机号" value="${user.take_phone!}" />
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-6">
- <label>邮编</label>
- <input type="text" class="form-control" name="take_post_code" placeholder="请输入邮编" value="${user.take_post_code!}" />
- </div>
- </div>
- <div class="row" id="area_list">
- <div class="form-group col-sm-3">
- <label for="city"><span style="color: red;">*</span>地区</label>
- <select class="form-control" onchange="changeArea(this)" name="take_area_id" id="area_list_1">
- <option value="">--请选择--</option>
- ##for(_item in area_list!){
- <option value="${_item.id!}">${_item.name!}</option>
- ##}
- </select>
- </div>
- </div>
- <div class="row">
- <div class="form-group col-sm-6">
- <label><span style="color: red;">*</span>详细地址</label>
- <textarea class="form-control" rows="3" name="take_address" placeholder="请输入详细地址">${user.take_address!}</textarea>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-3">
- <button type="button" onclick="submitForm()" class="btn btn-lightblue btn-block">提交</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </section>
- <script>
- $(document).ready(function(){
- ##if(exist("area") && area!=null){
- ##if(area.level==1){
- $("#area_list_1").val("${area_1!}");
- ##}else if(area.level==2){
- $("#area_list_1").val("${area_1!}");
- $.post("/shop/getArea",{id:"${area_1!}"},function(data){
- if(data.success){
- if(data.area_list!=null && data.area_list.length!=0){
- $("#area_list_1").removeAttr("name");
- var html="";
- html+="<div class='form-group col-sm-3'>";
- html+="<label> </label>";
- html+="<select class='form-control' onchange='changeArea(this)' name='take_area_id' id='area_list_2'>";
- html+="<option value=''>--请选择--</option>";
- $.each(data.area_list,function(index, array){
- html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
- });
- html+="</select>";
- html+="</div>";
- $("#area_list").append(html);
- $("#area_list_2").val("${area_2!}");
- }else{
- $("#area_list_1").attr("name", "take_area_id");
- }
- }else{
- alert(data.msg);
- }
- });
- ##}else{
- $("#area_list_1").val("${area_1!}");
- $.post("/shop/getArea",{id:"${area_1!}"},function(data){
- if(data.success){
- if(data.area_list!=null && data.area_list.length!=0){
- $("#area_list_1").removeAttr("name");
- var html="";
- html+="<div class='form-group col-sm-3'>";
- html+="<label> </label>";
- html+="<select class='form-control' onchange='changeArea(this)' name='take_area_id' id='area_list_2'>";
- html+="<option value=''>--请选择--</option>";
- $.each(data.area_list,function(index, array){
- html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
- });
- html+="</select>";
- html+="</div>";
- $("#area_list").append(html);
- $("#area_list_2").val("${area_2!}");
- $.post("/shop/getArea",{id:"${area_2!}"},function(data_1){
- if(data_1.success){
- if(data_1.area_list!=null && data_1.area_list.length!=0){
- $("#area_list_2").removeAttr("name");
- var html="";
- html+="<div class='form-group col-sm-3'>";
- html+="<label> </label>";
- html+="<select class='form-control' onchange='changeArea(this)' name='take_area_id' id='area_list_3'>";
- html+="<option value=''>--请选择--</option>";
- $.each(data_1.area_list,function(index, array){
- html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
- });
- html+="</select>";
- html+="</div>";
- $("#area_list").append(html);
- $("#area_list_3").val("${area_3!}");
- }else{
- $("#area_list_2").attr("name", "take_area_id");
- }
- }else{
- alert(data.msg);
- }
- });
- }else{
- $("#area_list_1").attr("name", "take_area_id");
- }
- }else{
- alert(data.msg);
- }
- });
- ##}
- ##}
- });
- function changeArea(object){
-
- $(object).parent().nextAll().remove();
- if($(object).val()!=null && $(object).val()!=""){
- $.post("/shop/getArea",{id:$(object).val()},function(data){
- if(data.success){
- if(data.area_list!=null && data.area_list.length!=0){
- $(object).removeAttr("name");
- var html="";
- html+="<div class='form-group col-sm-3'>";
- html+="<label> </label>";
- html+="<select class='form-control' onchange='changeArea(this)' name='take_area_id' id='area_list_" + ($("#area_list").find("select").length + 1) + "'>";
- html+="<option value=''>--请选择--</option>";
- $.each(data.area_list,function(index, array){
- html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
- });
- html+="</select>";
- html+="</div>";
- $("#area_list").append(html);
- }else{
- $(object).attr("name", "take_area_id");
- }
- }else{
- alert(data.msg);
- }
- });
- }
- }
- function submitForm(){
-
- $('#submit_form').ajaxSubmit({
- success: function(data){
- alert(data.msg);
- if(data.success){
- location.reload();
- }
- }
- });
- }
- </script>
- ##}
|