You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

137 lines
2.5 KiB

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
},
onReady() {
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){
wx.navigateTo({
url: '/pages/look-detail/look-detail?active=4&id='+e.currentTarget.dataset.id,
})
},
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
})
},
showInput(){
if(this.data.inputShow==true){return false}
this.setData({
inputShow:true
})
},
hideInput(){
this.setData({
inputShow:false
})
}
});