const moment = require('../../utils/moment.min'); const $api = require('../../utils/api').API; const app = getApp(); Page({ data: { active: '', region: ["500000", "500100"], cityName: '重庆', inputShow: false, nowTime: new Date(), page: { size: 7, current: 1, queryDate: moment(new Date()).format('YYYY-MM-DD'), landListedId: '' }, tabs: [{ id: 1, name: '测算日期' }, { id: 2, name: '城市区域' }], list: [], refresher: false, setScroll: true, // 搜索框 is_search: false, is_focusing: false,//是否聚焦 }, onReady() { this.refresh() }, // 地图搜索框 searchFun() { this.setData({ is_search: true, is_focusing: true, }) }, blurFun() {//隐藏 this.setData({ is_search: this.data.page.landListedId ? true : false, is_focusing: false, }) }, // 清空搜索内容 emptyFun() { this.setData({ ['page.landListedId']: '', is_focusing: true, }) this.refresh(); }, onShow() { if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ selected: 3 }) } }, // 待测试 goUnder() { wx.navigateTo({ url: '/pages/look-list/look-list?title=待测算', }) }, bindAddressChange(res) { let cityName = res.detail.value[1] if (cityName) { this.setData({ cityName }) } ; }, bindTimeChange(res) { let queryDate = res.detail.value let t = "page.queryDate" if (queryDate) { this.setData({ [t]: queryDate }) this.refresh() } ; }, comeHistory() { wx.navigateTo({ url: '../../pages/calculation-detail/calculation-detail', }) }, comeDetail(e) { $api.AJAX('GET', 'applets/measuredata/' + e.currentTarget.dataset.mid, true).then(res => { if (res.data) { if (res.data.measureType == 0) { wx.navigateTo({ url: '/pages/look-detail/look-detail?active=4&id=' + e.currentTarget.dataset.id + '&mid=' + e.currentTarget.dataset.mid, }) } else { wx.navigateTo({ url: '/pages/look-detail/look-detail?active=5&id=' + e.currentTarget.dataset.id + '&mid=' + e.currentTarget.dataset.mid, }) } } else { wx.navigateTo({ url: '/pages/look-detail/look-detail?active=4&id=' + e.currentTarget.dataset.id + '&mid=' + e.currentTarget.dataset.mid, }) } }) }, tabDowm(e) { let active = e.currentTarget.dataset.id if (active === this.data.active) { this.setData({ active: '', setScroll: true }) } else { this.setData({ active, setScroll: false }) } }, hideMark() { this.setData({active: '', setScroll: true}) }, getList() { // let list = this.data.list.concat(this.data.list); let t = "page.current" let p = this.data.page.current + 1 this.setData({[t]: p}) $api.getCalulaList(this.data.page).then(res => { let list = this.data.list.concat(res.data.records) this.setData({list}) }) }, refresh() { $api.getCalulaList(this.data.page).then(res => { let t = "page.current" this.setData({ list: [], [t]: 1, }) this.setData({ list: res.data.records, refresher: false } ) }) }, vmodel(e) { let t = "page.landListedId" this.setData({ [t]: e.detail.value }) this.refresh(); }, showInput() { if (this.data.inputShow == true) { return false } this.setData({ inputShow: true }) }, hideInput() { this.setData({ inputShow: false }) } });