chain_add.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. {extend name="default/base/base_member" /}
  2. {block name="member_main"}
  3. <div class="eject_con">
  4. <div class="adds">
  5. <div class="alert alert-success">
  6. <ul>
  7. <li>{$Think.lang.address_description}</li>
  8. </ul>
  9. </div>
  10. <div id="warning"></div>
  11. <form method="post" action="{:url('Memberaddress/chain_add')}" id="address_form" target="_parent">
  12. <input type="hidden" name="address_id" value="{$address_info.address_id|default=''}" />
  13. <dl>
  14. <dt><i class="required">*</i>{$Think.lang.region_selection}:</dt>
  15. <dd>{$Think.lang.find}
  16. <span>
  17. <input type="hidden" value="{$address_info.city_id|default=''}" name="city_id" id="_area_2">
  18. <input type="hidden" value="{$address_info.area_id|default=''}" name="area_id" id="_area">
  19. <input type="hidden" name="area_info" id="region" value="{$address_info.area_info|default=''}"/>
  20. </span>{$Think.lang.scope_since_mention_service}。
  21. </dd>
  22. </dl>
  23. <div class="dsmc-chain">
  24. <div id="zt_address"></div>
  25. <div class="chain-map" id="container" style="height:250px;width:250px"></div>
  26. </div>
  27. <dl>
  28. <dt><i class="required">*</i>{$Think.lang.name_of_consignee}{$Think.lang.ds_colon}</dt>
  29. <dd>
  30. <input type="text" class="text w100" name="true_name" value="{$address_info.address_realname|default=''}"/>
  31. <p class="hint"></p>
  32. </dd>
  33. </dl>
  34. <dl>
  35. <dt>{$Think.lang.consignee_number}{$Think.lang.ds_colon}</dt>
  36. <dd>
  37. <input type="text" class="text w200" name="tel_phone" value="{$address_info.address_tel_phone|default=''}"/>
  38. <p class="hint">{$Think.lang.area_code_extension}</p>
  39. </dd>
  40. </dl>
  41. <dl>
  42. <dt><i class="required">*</i>{$Think.lang.mobile_phone}{$Think.lang.ds_colon}</dt>
  43. <dd>
  44. <input type="text" class="text w200" name="mob_phone" value="{$address_info.address_mob_phone|default=''}"/>
  45. </dd>
  46. </dl>
  47. <div class="bottom">
  48. <input type="submit" class="submit" value="{$Think.lang.ds_common_button_save}" />
  49. <a class="dsm-btn ml5" href="javascript:DialogManager.close('daisou');">{$Think.lang.ds_cancel}</a>
  50. </div>
  51. </form>
  52. </div>
  53. </div>
  54. <script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
  55. <!--{if $Think.config.ds_config.mapak_type eq '1'}-->
  56. <script type="text/javascript">
  57. window._AMapSecurityConfig = {
  58. securityJsCode:"{$Think.config.ds_config.gaode_jscode}",
  59. }
  60. </script>
  61. <script type="text/javascript" src="//webapi.amap.com/maps?v=2.0&key={$Think.config.ds_config.gaode_ak}"></script>
  62. <!--{else}-->
  63. <script type="text/javascript" src="{$Think.HTTP_TYPE}api.map.baidu.com/api?v=2.0&ak={{$Think.config.ds_config.baidu_ak}}"></script>
  64. <!--{/if}-->
  65. <script type="text/javascript">
  66. var map
  67. $(document).ready(function () {
  68. if({$Think.config.ds_config.mapak_type} == '1'){
  69. map = new AMap.Map("container");
  70. }else{
  71. map = new BMap.Map("container");
  72. }
  73. $("#region").ds_region();
  74. $('#address_form').validate({
  75. submitHandler: function (form) {
  76. if ($('input[type="radio"]:checked').size() == 1) {
  77. ds_ajaxpost('address_form');
  78. }
  79. },
  80. rules: {
  81. true_name: {
  82. required: true
  83. },
  84. tel_phone: {
  85. required: check_phone,
  86. minlength: 6,
  87. maxlength: 20
  88. },
  89. mob_phone: {
  90. required: check_phone,
  91. minlength: 11,
  92. maxlength: 11,
  93. digits: true
  94. }
  95. },
  96. messages: {
  97. true_name: {
  98. required: '{$Think.lang.please_fill_name_consignee}'
  99. },
  100. tel_phone: {
  101. required: '{$Think.lang.fill_least_one_phone}',
  102. minlength: '{$Think.lang.please_correct_fill_phone_number}',
  103. maxlength: '{$Think.lang.please_correct_fill_phone_number}'
  104. },
  105. mob_phone: {
  106. required: '{$Think.lang.fill_least_one_phone}',
  107. minlength: '{$Think.lang.please_fill_phone_number_correctly}',
  108. maxlength: '{$Think.lang.please_fill_phone_number_correctly}',
  109. digits: '{$Think.lang.please_fill_phone_number_correctly}'
  110. }
  111. },
  112. groups: {
  113. phone: 'tel_phone mob_phone'
  114. }
  115. });
  116. $('#address_form').on('change', 'select', function () {
  117. area_id = $('#address_form').find('select').last().val();
  118. if($("#address_form select:eq(1)").length>0 && $("#address_form select:eq(1) option:selected").val()!=''){
  119. var name=$("#address_form select:eq(1) option:selected").text();
  120. }
  121. if (area_id != '{$Think.lang.ds_please_choose}') {
  122. if({$Think.config.ds_config.mapak_type} == '1'){
  123. AMap.plugin("AMap.Geocoder", function () {
  124. var geocoder = new AMap.Geocoder({});
  125. geocoder.getLocation(name, function(status, result) {
  126. if(result.info == "OK"){
  127. var location = result.geocodes[0].location;
  128. var lng = location.lng;
  129. var lat = location.lat;
  130. map.panTo([lng, lat]);
  131. }
  132. });
  133. })
  134. }else{
  135. map.centerAndZoom($('#address_form').find('select').first().find('option:selected').text(), 15);
  136. }
  137. $('#zt_address').load("{$Think.HOME_SITE_URL}/memberaddress/chain_list.html?chain_id={$address_info.chain_id|default=''}&area_id=" + area_id);
  138. }
  139. });
  140. {if intval($Request.param.address_id)}
  141. $('#zt_address').load("{$Think.HOME_SITE_URL}/memberaddress/chain_list.html?chain_id={$address_info.chain_id|default=''}&area_id={$address_info.area_id|default=''}");
  142. {/if}
  143. });
  144. function check_phone() {
  145. return ($('input[name="tel_phone"]').val() == '' && $('input[name="mob_phone"]').val() == '');
  146. }
  147. </script>
  148. {/block}