yysj.js 4.53 KB

$(function () {
  var Date = undefined;
  var appuintText = undefined
  var bustime = undefined;
  // 国有房屋无业点击选中记录
  var busIndex = undefined
  // 办事中心
  var halloffice = undefined
  var data = {
    'dateList': [
      {
        week: '星期一',
        date: '10月15号'
      },
      {
        week: '星期二',
        date: '10月16号'
      },
      {
        week: '星期三',
        date: '10月17号'
      },
      {
        week: '星期二',
        date: '10月18号'
      },
      {
        week: '星期五',
        date: '10月19号'
      },
      {
        week: '星期六',
        date: '10月19号'
      }
    ],
    "busList": [{
      startTime: "09:30",
      endTime: "10:30",
      orgBusinessList: [
        {
          shortName: "一般抵押登记",
          isyy: 1,
          residueNumber: "约满"
        },
        {
          shortName: "查封/解封登记",
          isyy: 1,
          residueNumber: "约满"
        },
        {
          shortName: "有证房抵押首次登记",
          isyy: 1,
          residueNumber: "约满"
        },
        {
          shortName: "商品房抵押登记",
          isyy: 0,
          residueNumber: "余3位"
        }
      ]
    }],
  };

  // 获取当前选中的日期
  data.dateList[0].isSelect = true
  for (var i = 0; i < data.dateList.length; i++) {
    if (data.dateList[i].isSelect) {
      Date = data.dateList[i].date
      bustime =  data.dateList[i].week
    }
  };

  layui.use('element', function () {
    let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function (elem) {
      layer.msg(elem.text());
    });
  });
  function a(i) {
    Date = data.dateList[i].date
    bustime = data.dateList[i].week
    $(".swiper-slide").eq(i).addClass('active').siblings().removeClass('active');
  }

  layui.use('laytpl', function () {
    laytpl = layui.laytpl;
    var getTpl = document.getElementById('date').innerHTML
      , view = document.getElementById('swiperDate');
    laytpl(getTpl).render(data, function (html) {
      view.innerHTML = html;
    });

    var getTpl1 = document.getElementById('business_item').innerHTML
      , view1 = document.getElementById('business_list');
    laytpl(getTpl1).render(data, function (html) {
      view1.innerHTML = html;
    });
  });
  var swiper = new Swiper('.swiper-container', {
    slidesPerView: 5,
    spaceBetween: 20,
    slidesPerGroup: 1,
    observer: true,
    observeParents: true,
    on: {
      click: function (swiper) {
        var index = swiper['clickedIndex'];
        a(index);
      }
    },
    loopFillGroupWithBlank: true,
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
  });
  function handle(){
    layui.use('layer', function () {
      layer.open({
        type: 1,
        title: '请确认以下信息',
        shadeClose: true,
        area: ['500px', '320px'],
        scrollbar: false,
        skin: 'confimInfo',
        content: '<div class="infoContent">'
          + '<ul>'
          + '<li><span>姓名</span>:任超</li>'
          + '<li><span>身份证号</span>:610124193335522</li>'
          + '<li><span>联系电话</span>:18740677386</li>'
          + '</ul>'
          + '<div class="listItem"><h3>大厅名称:</h3>'+halloffice+'</div>'
          + '<div class="listItem"><h3>预约业务:</h3>' + appuintText + '</div>'
          + '<div class="listItem"><h3>预约时间:</h3>' + Date + '&nbsp;&nbsp;' + bustime + '</div>'
          + '<div class="confimButton"><button type="button" class="layui-btn cancel layui-btn-primary">取消</button><button type="button" class="layui-btn confim layui-btn-normal">确定</button></div>'
          + '</div>'
      });
    })
  }
  // 业务选择
  $(document).on('click', '.business_item ul .item_appoint', function () {
    halloffice = GetRequest()
    appuintText = $(this).find('h3').text()
    handle()
  });



  $(document).on('click', '.cancel', function () {
    layer.closeAll()
  })
  $(document).on('click', '.confim', function () {
    window.location.href = "./yyjg.html"
  })
});
function GetRequest() {
  var url = location.search; //获取url中"?"符后的字串
  var theRequest = new Object();
  if (url.indexOf("?") != -1) {
    var str = url.substr(1);
    strs = str.split("?");
    for (var i = 0; i < strs.length; i++) {
      theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
    }
  }
  return theRequest.halloffice;
}