No Description

typeChoice.js 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/listinfo",
  50. data:{
  51. 'region': name
  52. },
  53. success: function (res) {
  54. console.log(res)
  55. if(res.errno == 0 && res.rst.city){
  56. var list = res.rst.city.list;
  57. var html = '';
  58. if(list.length > 0){
  59. for(var i = 0 ; i < list.length ; i++){
  60. html += `<div class="typeList" data-code="${list[i].region_code}" data-nextname="${list[i].region}">
  61. <div class="typeListLeft">
  62. <h4>${list[i].region}</h4>
  63. <p>${list[i].parent_region}</p>
  64. </div>
  65. <div class="typeListRight">
  66. <div class="hollowCircle">
  67. <div class="disc"></div>
  68. </div>
  69. </div>
  70. </div>`
  71. }
  72. $(".list").html(html);
  73. init();
  74. selectionTypes();
  75. }
  76. }else{
  77. $(".nextStep").css({'background':'#CCCCCC','box-shadow':'none'});
  78. $(".nextStep").attr('disabled','disabled');
  79. }
  80. }
  81. });
  82. }
  83. //下一步
  84. function goNextStep () {
  85. $(".nextStep").click(function () {
  86. console.log('ffff')
  87. console.log(httpStr)
  88. window.location.href = httpStr + '&name=' + nextName + '&code=' + nextCode + '&token=' + token
  89. })
  90. }