No Description

typeChoice.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. var name = '';
  2. var regionCode = '';
  3. var token = '';
  4. var nextName = '';
  5. var nextCode = '';
  6. var httpStr = '';
  7. $().ready(function() {
  8. var qs = parseQueryString(window.location.href);
  9. console.log(qs)
  10. name = qs.name;
  11. regionCode = qs.code;
  12. token = qs.token;
  13. httpStr = qs.httpStr;
  14. cituInfoData();
  15. goBack();
  16. goNextStep();
  17. })
  18. //初始
  19. function init () {
  20. $(".typeListRight").css('background','#D7D7D7')
  21. .find('.disc').css('background','#FFFFFF');
  22. $(".typeListRight").eq(0).css('background','#5D7DFF')
  23. .find('.disc').css('background','#5D7DFF');
  24. $(".nextStep").css({'background':'#5D7DFF','box-shadow':' 0 0 6px 0 rgba(93, 125, 255, 0.7)','-webkit-box-shadow':' 0 0 6px 0 rgba(93, 125, 255, 0.7)'});
  25. $(".nextStep").removeAttr('disabled');
  26. nextCode = $(".typeListRight").eq(0).parent().attr('data-code');
  27. nextName = $(".typeListRight").eq(0).parent().attr('data-nextname');
  28. }
  29. //点击进行公积金类型选择
  30. function selectionTypes () {
  31. $(".typeListRight").click(function () {
  32. $(".typeListRight").css('background','#D7D7D7')
  33. .find('.disc').css('background','#FFFFFF');
  34. $(this).css('background','#5D7DFF')
  35. .find('.disc').css('background','#5D7DFF');
  36. nextCode = $(this).parent().attr('data-code');
  37. nextName = $(this).parent().attr('data-nextname');
  38. })
  39. }
  40. //nav返回上一页
  41. function goBack () {
  42. $("nav i").click(function () {
  43. history.go(-1)
  44. })
  45. }
  46. //公积金类型数据
  47. function cituInfoData () {
  48. console.log(name)
  49. $.ajax({
  50. type:"POST",
  51. url: "/api/city/info",
  52. headers:{
  53. 'token': '5dac206be8b1f5736285fc03a08adb3c'
  54. },
  55. data:{
  56. 'region': name
  57. },
  58. success: function (res) {
  59. console.log(res)
  60. if(res.errno == 0 && res.rst.data){
  61. var list = res.rst.data.list;
  62. var html = '';
  63. if(list.length > 0){
  64. for(var i = 0 ; i < list.length ; i++){
  65. html += `<div class="typeList" data-code="${list[i].region_code}" data-nextname="${list[i].region}">
  66. <div class="typeListLeft">
  67. <h4>${list[i].region}</h4>
  68. <p>${list[i].parent_region}</p>
  69. </div>
  70. <div class="typeListRight">
  71. <div class="hollowCircle">
  72. <div class="disc"></div>
  73. </div>
  74. </div>
  75. </div>`
  76. }
  77. $(".list").html(html);
  78. init();
  79. selectionTypes();
  80. }
  81. }else{
  82. $(".nextStep").css({'background':'#CCCCCC','box-shadow':'none'});
  83. $(".nextStep").attr('disabled','disabled');
  84. }
  85. }
  86. });
  87. }
  88. //下一步
  89. function goNextStep () {
  90. $(".nextStep").click(function () {
  91. console.log('ffff')
  92. console.log(httpStr)
  93. window.location.href = httpStr + '&name=' + nextName + '&code=' + nextCode + '&token=' + token
  94. })
  95. }