var menDian = '';
  var changDi = '';
window.onload = function () {
  initData();
  document.getElementById('btn').addEventListener('click', function() {
      if(menDian==""||changDi==""){
            alert('请先选择门店情况和场地情况');
        }else{
          window.sessionStorage.setItem('menDian',menDian);
          window.sessionStorage.setItem('changDi',changDi);
          window.open('./jiaMeng4.html','_self');
        }
    });
    document.getElementById('men-dian').addEventListener('click', function() {
    openMenDianModel();
      setMenDianOption();
    });
    document.getElementById('chan-di').addEventListener('click', function() {
        openChanDiModel();
        setChanDiOption();
    });

  }; 
  function initData(){
    menDian = '已有自购门店';
    document.getElementById('men-dian').innerHTML = '已有自购门店';
    changDi = '可满足20台以上设备停留场地';
    document.getElementById('chan-di').innerHTML = '可满足20台以上设备停留场地';
  }
  function resetQu(){
    document.getElementById('qu').innerHTML ='<div class="model-item" data-value="0">请选择</div>';
  }
  function openMenDianModel(){
    document.getElementById('men-dian-model').style = 'display: flex;';
  }
  function closeMenDianModel(){
    document.getElementById('men-dian-model').style = 'display: none;';
  }
  function setMenDianOption(){
     let listHtml = '';
    for (let index = 0; index < menDianList.length; index++) {
      const element = menDianList[index];
      listHtml += `<div class="model-item" data-value="`+element.name+`">`+element.name+`</div>`
    }
    if(listHtml==""){
      listHtml = ` <div class="model-item" data-value="0">请选择</div>`
    }
    document.getElementById('men-dian-content').innerHTML = listHtml;
    document.getElementById('men-dian-content').addEventListener('click', function(e) {
      menDian = e.target.dataset.value;
      document.getElementById('men-dian').innerHTML = e.target.dataset.value;
      closeMenDianModel();
    });
    
  }
  function openChanDiModel(){
    document.getElementById('chan-di-model').style = 'display: flex;';
  }
  function closeChanDiModel(){
    document.getElementById('chan-di-model').style = 'display: none;';
  }
  
  function setChanDiOption(){
    let listHtml = '';
    for (let index = 0; index < chanDiList.length; index++) {
      const element = chanDiList[index];
      listHtml += `<div class="model-item" data-value="`+element.name+`">`+element.name+`</div>`
    }
    if(listHtml==""){
      listHtml = ` <div class="model-item" data-value="0">请选择</div>`
    }
    document.getElementById('chan-di-content').innerHTML = listHtml;
    document.getElementById('chan-di-content').addEventListener('click', function(e) {
      changDi = e.target.dataset.value;
      document.getElementById('chan-di').innerHTML = e.target.dataset.value;
      closeChanDiModel();
    });
  }
  var menDianList = [
    {
        name:'已有自购门店'
    },
    {
        name:'已有租用门店'
    },
    {
        name:'门店待租用'
    },
  ];
  var chanDiList = [
    {
        name:'可满足20台以上设备停留场地'
    },
    {
        name:'可满足10台以上设备停留场地'
    },
  ];
