No Description

typeChoice.js 2.6KB

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