address.htm 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. ##tlayout("wap/layout.htm",{head_title:"收货地址"}){
  2. <div class="body">
  3. <div class="pay_choose">
  4. <form action="/wap/user/updateAddress" method="post" id="submit_form">
  5. <div class="tip_title">用户信息</div>
  6. <div class="wells_row wells_row_notomargin">
  7. <div class="wells_item wells_item_input">
  8. <span class="wells_item_hd wells_item_hd_w5"><span style="color: red;">*</span>收件人</span>
  9. <span class="right_title right_title_w100">
  10. <input type="text" class="weui_input" placeholder="请输入收件人" name="take_name" value="${user.take_name!}" />
  11. </span>
  12. </div>
  13. <div class="wells_item wells_item_input">
  14. <span class="wells_item_hd wells_item_hd_w5"><span style="color: red;">*</span>手机号</span>
  15. <span class="right_title right_title_w100">
  16. <input type="tel" class="weui_input" placeholder="请输入手机号" name="take_phone" value="${user.take_phone!}" />
  17. </span>
  18. </div>
  19. <div class="wells_item wells_item_input">
  20. <span class="wells_item_hd wells_item_hd_w5">邮编</span>
  21. <span class="right_title right_title_w100">
  22. <input type="text" class="weui_input" placeholder="请输入邮编" name="take_post_code" value="${user.take_post_code!}" />
  23. </span>
  24. </div>
  25. </div>
  26. <div class="tip_title"><span style="color: red;">*</span>地区</div>
  27. <div class="wells_row wells_row_notomargin">
  28. <div class="wells_item wells_item_nopadding" id="area_list">
  29. <div class="weui-cell weui-cell_select">
  30. <div class="weui-cell__bd">
  31. <select class="weui-select" onchange="changeArea(this)" name="take_area_id" id="area_list_1">
  32. <option value="">--请选择--</option>
  33. ##for(_item in area_list!){
  34. <option value="${_item.id!}">${_item.name!}</option>
  35. ##}
  36. </select>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="wells_item wells_item_nopadding">
  41. <textarea class="weui_textarea" name="take_address" placeholder="请输入详细地址" style="padding:10px 0;">${user.take_address!}</textarea>
  42. </div>
  43. </div>
  44. </form>
  45. </div>
  46. <div class="weui_btn_area">
  47. <a href="javascript:void(0)" onclick="submitForm()" class="weui_btn btn_success">保存</a>
  48. </div>
  49. </div>
  50. <a href="/wap" class="goback"><span>首页</span></a>
  51. <script>
  52. $(document).ready(function(){
  53. ##if(exist("area") && area!=null){
  54. ##if(area.level==1){
  55. $("#area_list_1").val("${area_1!}");
  56. ##}else if(area.level==2){
  57. $("#area_list_1").val("${area_1!}");
  58. $.post("/shop/getArea",{id:"${area_1!}"},function(data){
  59. if(data.success){
  60. if(data.area_list!=null && data.area_list.length!=0){
  61. $("#area_list_1").removeAttr("name");
  62. var html="";
  63. html+="<div class='weui-cell weui-cell_select'>";
  64. html+="<div class='weui-cell__bd'>";
  65. html+="<select class='weui-select' onchange='changeArea(this)' name='take_area_id' id='area_list_2'>";
  66. html+="<option value=''>--请选择--</option>";
  67. $.each(data.area_list,function(index, array){
  68. html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
  69. });
  70. html+="</select>";
  71. html+="</div>";
  72. html+="</div>";
  73. $("#area_list").append(html);
  74. $("#area_list_2").val("${area_2!}");
  75. }else{
  76. $("#area_list_1").attr("name", "take_area_id");
  77. }
  78. }else{
  79. alert(data.msg);
  80. }
  81. });
  82. ##}else{
  83. $("#area_list_1").val("${area_1!}");
  84. $.post("/shop/getArea",{id:"${area_1!}"},function(data){
  85. if(data.success){
  86. if(data.area_list!=null && data.area_list.length!=0){
  87. $("#area_list_1").removeAttr("name");
  88. var html="";
  89. html+="<div class='weui-cell weui-cell_select'>";
  90. html+="<div class='weui-cell__bd'>";
  91. html+="<select class='weui-select' onchange='changeArea(this)' name='take_area_id' id='area_list_2'>";
  92. html+="<option value=''>--请选择--</option>";
  93. $.each(data.area_list,function(index, array){
  94. html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
  95. });
  96. html+="</select>";
  97. html+="</div>";
  98. html+="</div>";
  99. $("#area_list").append(html);
  100. $("#area_list_2").val("${area_2!}");
  101. $.post("/shop/getArea",{id:"${area_2!}"},function(data_1){
  102. if(data_1.success){
  103. if(data_1.area_list!=null && data_1.area_list.length!=0){
  104. $("#area_list_2").removeAttr("name");
  105. var html="";
  106. html+="<div class='weui-cell weui-cell_select'>";
  107. html+="<div class='weui-cell__bd'>";
  108. html+="<select class='weui-select' onchange='changeArea(this)' name='take_area_id' id='area_list_3'>";
  109. html+="<option value=''>--请选择--</option>";
  110. $.each(data_1.area_list,function(index, array){
  111. html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
  112. });
  113. html+="</select>";
  114. html+="</div>";
  115. html+="</div>";
  116. $("#area_list").append(html);
  117. $("#area_list_3").val("${area_3!}");
  118. }else{
  119. $("#area_list_2").attr("name", "take_area_id");
  120. }
  121. }else{
  122. alert(data.msg);
  123. }
  124. });
  125. }else{
  126. $("#area_list_1").attr("name", "take_area_id");
  127. }
  128. }else{
  129. alert(data.msg);
  130. }
  131. });
  132. ##}
  133. ##}
  134. });
  135. function changeArea(object){
  136. $(object).parent().parent().nextAll().remove();
  137. if($(object).val()!=null && $(object).val()!=""){
  138. $.post("/wap/shop/getArea",{id:$(object).val()},function(data){
  139. if(data.success){
  140. if(data.area_list!=null && data.area_list.length!=0){
  141. $(object).removeAttr("name");
  142. var html="";
  143. html+="<div class='weui-cell weui-cell_select'>";
  144. html+="<div class='weui-cell__bd'>";
  145. html+="<select class='weui-select' onchange='changeArea(this)' name='take_area_id' id='area_list_" + ($("#area_list").find("select").length + 1) + "'>";
  146. html+="<option value=''>--请选择--</option>";
  147. $.each(data.area_list,function(index, array){
  148. html+="<option value=" + array["id"] + ">" + array["name"] + "</option>";
  149. });
  150. html+="</select>";
  151. html+="</div>";
  152. html+="</div>";
  153. $("#area_list").append(html);
  154. }else{
  155. $(object).attr("name", "take_area_id");
  156. }
  157. }else{
  158. alert(data.msg);
  159. }
  160. });
  161. }
  162. }
  163. function submitForm(){
  164. $('#submit_form').ajaxSubmit({
  165. success: function(data){
  166. alert(data.msg);
  167. if(data.success){
  168. ##if(type==1){
  169. window.location.href="/wap/shop/ordersMsg";
  170. ##}else{
  171. location.reload();
  172. ##}
  173. }
  174. }
  175. });
  176. }
  177. </script>
  178. ##}