You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

232 lines
7.6 KiB

  1. <!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  2. <title>新增收货地址</title><meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
  3. <link href="<?php echo env('APP_URL'); ?>/css/weixin/style.css" type="text/css" rel="stylesheet">
  4. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/jquery.min.js"></script>
  5. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/weixin/mobile.js"></script>
  6. <meta name="keywords" content="关键词"><meta name="description" content="描述"></head><body style="background-color:#f1f1f1;">
  7. <div class="classreturn loginsignup ">
  8. <div class="ds-in-bl return"><a href="javascript:history.back(-1);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/return.png" alt="返回"></a></div>
  9. <div class="ds-in-bl tit center"><span>新增收货地址</span></div>
  10. <div class="ds-in-bl nav_menu"><a href="javascript:void(0);"><img src="<?php echo env('APP_URL'); ?>/images/weixin/class1.png" alt="菜单"></a></div>
  11. </div>
  12. <div class="flool tpnavf cl">
  13. <div class="nav_list">
  14. <ul>
  15. <a href="index.html"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/home_icon.png"><p>首页</p></li></a>
  16. <a href="/Weixin/index.php?m=Store&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/brand_icon.png"><p>分类</p></li></a>
  17. <a href="/Weixin/index.php?m=Cart&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/car_icon.png"><p>购物车</p></li></a>
  18. <a href="/Weixin/index.php?m=User&amp;a=index"><li><img src="<?php echo env('APP_URL'); ?>/images/weixin/center_icon.png"><p>个人中心</p></li></a></ul>
  19. <div class="cl"></div>
  20. </div>
  21. </div>
  22. <style>
  23. .adr_add{margin:0 10px;}
  24. .adr-form-group{margin-top:10px;}
  25. .adr-form-group input[type=text],.adr-form-group textarea{
  26. display: block;
  27. width: 100%;
  28. font-size:16px;
  29. padding:10px;
  30. color: #777;
  31. vertical-align: middle;
  32. background-color: #fff;
  33. background-image: none;
  34. border: 1px solid #ddd;
  35. border-radius: 0;box-sizing:border-box;
  36. }
  37. .adr-form-group select{padding:5px;margin-right:10px;}
  38. .bottoma{display:block;font-size:18px;padding:10px;color:white;background-color: #f23030;text-align:center;}
  39. </style>
  40. <div class="adr_add">
  41. <div class="adr-form-group">
  42. <label for="doc-ipt-email-1">收货人</label>
  43. <input name="name" type="text" class="" id="name" placeholder="输入姓名">
  44. </div>
  45. <div class="adr-form-group">
  46. <label for="doc-ipt-email-1">手机号码</label>
  47. <input type="text" name="mobile" class="" id="mobile" placeholder="输入手机号码">
  48. </div>
  49. <div class="adr-form-group">
  50. 地区: <select id='sheng'></select><select id='shi'></select><select id='qu'></select>
  51. <script>
  52. // JavaScript Document
  53. $(document).ready(function(e) {
  54. //加载省的数据
  55. LoadSheng();
  56. //加载市的数据
  57. LoadShi();
  58. //加载区的数据
  59. LoadQu();
  60. //给省的下拉加点击事件
  61. $("#sheng").change(function(){
  62. //重新加载市
  63. LoadShi();
  64. //重新加载区
  65. LoadQu();
  66. });
  67. //给市的下拉加点击事件
  68. $("#shi").change(function(){
  69. //重新加载区
  70. LoadQu();
  71. });
  72. });
  73. //加载省份的方法
  74. function LoadSheng(parent_id,select_id)
  75. {
  76. //省的父级代号
  77. parent_id = parent_id || '86';
  78. select_id = select_id || 0;
  79. $.ajax({
  80. async:false,
  81. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  82. data:{id:parent_id},
  83. type:"GET",
  84. dataType:"json",
  85. success: function(res){
  86. var hang = res.data;
  87. var str = "";
  88. for(var i=0;i<hang.length;i++)
  89. {
  90. if(select_id != 0 && select_id == hang[i].id)
  91. {
  92. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  93. }
  94. else
  95. {
  96. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  97. }
  98. }
  99. $("#sheng").html(str);
  100. }
  101. });
  102. }
  103. //加载市的方法
  104. function LoadShi(parent_id,select_id)
  105. {
  106. //找市的父级代号
  107. parent_id = parent_id || $("#sheng").val();
  108. select_id = select_id || 0;
  109. $.ajax({
  110. async:false,
  111. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  112. data:{id:parent_id},
  113. type:"GET",
  114. dataType:"json",
  115. success: function(res){
  116. var hang = res.data;
  117. var str = "";
  118. for(var i=0;i<hang.length;i++)
  119. {
  120. if(select_id != 0 && select_id == hang[i].id)
  121. {
  122. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  123. }
  124. else
  125. {
  126. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  127. }
  128. }
  129. $("#shi").html(str);
  130. }
  131. });
  132. }
  133. //加载区的方法
  134. function LoadQu(parent_id,select_id)
  135. {
  136. //找区的父级代号
  137. parent_id = parent_id || $("#shi").val();
  138. select_id = select_id || 0;
  139. $.ajax({
  140. url:'<?php echo env('APP_API_URL')."/region_list"; ?>',
  141. data:{id:parent_id},
  142. type:"GET",
  143. dataType:"json",
  144. success: function(res){
  145. var hang = res.data;
  146. var str = "";
  147. for(var i=0;i<hang.length;i++)
  148. {
  149. if(select_id != 0 && select_id == hang[i].id)
  150. {
  151. str = str+"<option selected='selected' value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  152. }
  153. else
  154. {
  155. str = str+"<option value='"+hang[i].id+"'>"+hang[i].name+"</option>";
  156. }
  157. }
  158. $("#qu").html(str);
  159. }
  160. });
  161. }
  162. </script>
  163. </div>
  164. <div class="adr-form-group">
  165. <label for="doc-ta-1">详细地址</label>
  166. <textarea name="address" class="" rows="3" id="address"></textarea>
  167. </div>
  168. <div class="adr-form-group">
  169. <label>
  170. <input type="checkbox" name="is_default" id="is_default"> 设为默认
  171. </label>
  172. </div>
  173. </div>
  174. <a style="margin:10px;" class="bottoma" href="javascript:adr_dosubmit();">提交</a>
  175. <script type="text/javascript" src="<?php echo env('APP_URL'); ?>/js/layer/mobile/layer.js"></script>
  176. <script>
  177. function adr_dosubmit()
  178. {
  179. var access_token = '<?php echo $_SESSION['weixin_user_info']['access_token']; ?>';
  180. var url = '<?php echo env('APP_API_URL').'/user_address_add'; ?>';
  181. var name = $("#name").val();
  182. var mobile = $("#mobile").val();
  183. var address = $("#address").val();
  184. var province = '福建';
  185. var city = '厦门';
  186. var district = '湖里';
  187. var is_default = 0;
  188. if(document.getElementById("is_default").checked){is_default = 1;}
  189. $.post(url,{access_token:access_token,name:name,mobile:mobile,address:address,province:province,city:city,district:district,is_default:is_default},function(res)
  190. {
  191. if(res.code==0)
  192. {
  193. //提示
  194. layer.open({
  195. content: res.msg
  196. ,skin: 'msg'
  197. ,time: 2 //2秒后自动关闭
  198. });
  199. window.history.back();
  200. }
  201. else
  202. {
  203. //提示
  204. layer.open({
  205. content: res.msg
  206. ,skin: 'msg'
  207. ,time: 2 //2秒后自动关闭
  208. });
  209. var url = "http://www.baidu.com";
  210. location.href = url;
  211. }
  212. },'json');
  213. }
  214. </script>
  215. </body></html>