buy_address.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <div class="dsc-receipt-info">
  2. <div class="dsc-receipt-info-title">
  3. <h3>{$Think.lang.consignee_information}</h3>
  4. <a href="javascript:void(0)" ds_type="buy_edit" id="edit_reciver">[{$Think.lang.modification}]</a></div>
  5. <div id="addr_list" class="dsc-candidate-items">
  6. <ul>
  7. <li>
  8. <span class="true-name">{$address_info.address_realname}</span>
  9. <span class="address">{if $address_info.cityerror}<span style="color: #ff4040;vertical-align: revert;">{$Think.lang.cart_step1_city_fail}</span>{/if}{if condition="$address_info.chain_id"}[{$Think.lang.self_service_station}]{/if}{$address_info.area_info}{$address_info.address_detail}</span>
  10. <span class="phone"><i class="iconfont">&#xe60e;</i>{if condition="$address_info.address_mob_phone"}{$address_info.address_mob_phone}{else}{$address_info.address_tel_phone}{/if}</span>
  11. </li>
  12. </ul>
  13. </div>
  14. </div>
  15. <script type="text/javascript">
  16. //隐藏收货地址列表
  17. function hideAddrList(addr_id, true_name, address, phone,cityerror) {
  18. $('#edit_reciver').show();
  19. $("#address_id").val(addr_id);
  20. $("#addr_list").html('<ul><li><span style="color: #ff4040;">'+cityerror+'</span><span class="true-name">' + true_name + '</span><span class="address">' + address + '</span><span class="phone"><i class="iconfont">&#xe60e;</i>' + phone + '</span></li></ul>');
  21. $('.current_box').removeClass('current_box');
  22. ableOtherEdit();
  23. $('#edit_payment').click();
  24. }
  25. //加载收货地址列表
  26. $('#edit_reciver').on('click', function() {
  27. $(this).hide();
  28. disableOtherEdit('{$Think.lang.save_consignee_information} ');
  29. $(this).parent().parent().addClass('current_box');
  30. var url = HOMESITEURL + '/Buy/load_addr.html';
  31. $('#addr_list').load(url);
  32. });
  33. //异步显示每个店铺运费 city_id计算运费area_id计算是否支持货到付款 goods判断是否支持配送到收货地区
  34. function showShippingPrice(city_id, area_id) {
  35. $('#buy_city_id').val('');
  36. $('#buy_city_id').val(city_id);
  37. var url = HOMESITEURL + '/Buy/change_addr.html';
  38. var goods = '';
  39. $('*[ds_goods]').each(function(){
  40. goods=$(this).attr('ds_goods');
  41. })
  42. $.post(url, {'freight_hash': '{$freight_hash}',city_id: city_id, 'area_id': area_id,'goods':goods}, function(data) {
  43. if (data.state == 'success') {
  44. $('#buy_city_id').val(city_id);
  45. $('#allow_offpay').val(data.allow_offpay);
  46. if (data.allow_offpay_batch) {
  47. var arr = new Array();
  48. $.each(data.allow_offpay_batch, function(k, v) {
  49. arr.push('' + k + ':' + (v ? 1 : 0));
  50. });
  51. $('#allow_offpay_batch').val(arr.join(";"));
  52. }
  53. $('#offpay_hash').val(data.offpay_hash);
  54. $('#offpay_hash_batch').val(data.offpay_hash_batch);
  55. var content = data.content;
  56. var amount = 0;
  57. for (var i in content) {
  58. $('#eachStoreFreight_' + i).attr('data-freight',content[i])
  59. amount = amount + parseFloat(content[i]);
  60. }
  61. calcOrder();
  62. $(".dsc-bottom").html("<a href='javascript:void(0)' class='dsc-btn dsc-btn-acidblue fr'>{$Think.lang.cart_index_submit_order}</a>")
  63. $('.limit').remove();
  64. }else{
  65. $('.limit').remove();
  66. if (data.limitidarray) {
  67. $.each(data.limitidarray, function(k, v) {
  68. $(".goodsid_"+v).append('<dd class="limit"> <span style="color:#ff4040">{$Think.lang.cart_step1_goods_fail}</span></dd>')
  69. });
  70. }
  71. $(".dsc-bottom").html("<span class='fr' style='color:#ff4040;margin-right:20px;font-size:18px'>{$Think.lang.cart_step1_address_fail}</span>")
  72. }
  73. }, 'json');
  74. }
  75. //异步获取商品自提点
  76. function showChainList(area_id){
  77. $('*[ds_goods]').each(function(){
  78. var goods=$(this).attr('ds_goods');
  79. var url = HOMESITEURL + '/Buy/change_chain.html';
  80. var obj=$(this)
  81. obj.find('select').val(0)
  82. $.post(url, {goods: goods, 'area_id': area_id}, function(data) {
  83. var chain_list=data.result.chain_list
  84. if(data.code==10000 && chain_list.length){
  85. var html='<option value="0">{$Think.lang.option_chain}</option>'
  86. for(var i in chain_list){
  87. html+='<option value="'+chain_list[i].chain_id+'">'+chain_list[i].chain_addressname+'('+chain_list[i].chain_area_info+chain_list[i].chain_address+')'+'</option>'
  88. }
  89. obj.find('select').html(html)
  90. obj.show()
  91. }else{
  92. obj.hide()
  93. }
  94. }, 'json');
  95. })
  96. }
  97. $(function() {
  98. {notempty name="$address_info.address_id"}
  99. showShippingPrice({$address_info.city_id},{$address_info.area_id});
  100. showChainList({$address_info.area_id})
  101. {else /}
  102. $('#edit_reciver').click();
  103. {/notempty}
  104. });
  105. </script>