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.
253 lines
5.5 KiB
253 lines
5.5 KiB
// pages/look-list/look-list.js |
|
const moment = require('../../utils/moment.min'); |
|
const $api = require('../../utils/api').API; |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
active: '', |
|
tabs:[{id:1,name:'排序'},{id:2,name:'日期'},{id:3,name:'交易状态'},{id:4,name:'区域'},{id:5,name:'类型'}], |
|
list:[], |
|
refresher: false, |
|
setScroll: true, |
|
inputShow:false, |
|
region: ["500000", "500100"], |
|
nowTime:new Date(), |
|
page:{ |
|
size:10, |
|
current:1, |
|
startDate:'', |
|
endDate:'', |
|
city:'', |
|
transactionStatus:'', |
|
measureStatus:'', |
|
landCode:'' |
|
}, |
|
searchNode:{ |
|
date:{height:0,bottom:0}, |
|
sale:{height:0,bottom:0}, |
|
calcu:{height:0,bottom:0} |
|
}, |
|
measureStatus:'', |
|
transactionStatus:'', |
|
arraySale:[], |
|
arrayCalcu:[], |
|
saleList:[], |
|
calcuList:[], |
|
saleNum:null, |
|
calcuNum:null |
|
}, |
|
changeRadio(e){ |
|
let type=e.currentTarget.dataset.type; |
|
switch (type){ |
|
case 'sale': |
|
this.setData({ |
|
saleNum:e.currentTarget.dataset.num, |
|
'page.transactionStatus':this.data.saleList[e.currentTarget.dataset.num].value |
|
}); |
|
break; |
|
case 'calcu': |
|
this.setData({ |
|
calcuNum:e.currentTarget.dataset.num, |
|
'page.measureStatus':this.data.calcuList[e.currentTarget.dataset.num].value |
|
}); |
|
break; |
|
} |
|
}, |
|
|
|
comeBack(){ |
|
wx.navigateBack({ |
|
delta: 1 |
|
}) |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
$api.getDict('land_transaction').then(res=>{ |
|
this.setData({ |
|
saleList:res.data |
|
}) |
|
}) |
|
$api.getDict('measure_status').then(res=>{ |
|
this.setData({ |
|
calcuList:res.data |
|
}) |
|
}) |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
this.refresh() |
|
}, |
|
|
|
tabDowm(e){ |
|
let active = e.currentTarget.dataset.id |
|
if(active===this.data.active){ |
|
this.setData({active:'',setScroll:true}) |
|
}else{ |
|
this.setData({active,setScroll:false}) |
|
} |
|
}, |
|
getList(){ |
|
let t="page.current" |
|
let p=this.data.page.current+1 |
|
this.setData({[t]:p}) |
|
$api.getLandlistedPage(this.data.page).then(res=>{ |
|
let list = this.data.list.concat(res.data.records) |
|
this.setData({list}) |
|
}) |
|
}, |
|
refresh(){ |
|
$api.getLandlistedPage(this.data.page).then(res=>{ |
|
res.data.records.map(e=>{ |
|
for(let key in e){ |
|
if(!e[key]){ |
|
e[key]='' |
|
} |
|
} |
|
}) |
|
let t="page.current" |
|
this.setData({ |
|
list:[], |
|
[t]:1, |
|
}) |
|
this.setData({ |
|
list:res.data.records, |
|
refresher:false} |
|
) |
|
}) |
|
}, |
|
goSearch(){ |
|
this.inShow(); |
|
this.setData({ |
|
'searchNode.date.height':0, |
|
'searchNode.date.bottom':0, |
|
}) |
|
this.refresh() |
|
}, |
|
hideMark(){ |
|
this.setData({active:'',setScroll:true}) |
|
}, |
|
inShow(){ |
|
for(let key in this.data.searchNode){ |
|
if(this.data.searchNode[key].height>0){ |
|
this.setData({ |
|
[`searchNode.${key}`]:{height:0,bottom:0} |
|
}) |
|
} |
|
} |
|
}, |
|
comeDetail(e){ |
|
let id=e.currentTarget.dataset.id; |
|
console.log(e.currentTarget.dataset.id) |
|
wx.navigateTo({ |
|
url: '/pages/look-detail/look-detail?id='+id, |
|
}) |
|
}, |
|
bindTimeChange(res){ |
|
console.log(res) |
|
let queryDate = res.detail.value |
|
if(res.currentTarget.dataset.type=='start'){ |
|
let t="page.startDate" |
|
if (queryDate) { |
|
this.setData({ |
|
[t]:queryDate |
|
}) |
|
}; |
|
}else{ |
|
let t="page.endDate" |
|
if (queryDate) { |
|
this.setData({ |
|
[t]:queryDate |
|
}) |
|
}; |
|
} |
|
}, |
|
bindAddressChange(res) { |
|
let cityName = res.detail.value[1] |
|
let t="page.city" |
|
if (cityName) { |
|
this.setData({ |
|
[t]:cityName |
|
}) |
|
this.refresh() |
|
}; |
|
}, |
|
bindSaleChange(res){ |
|
let value= this.data.arraySale[res.detail.value].value; |
|
let label= this.data.arraySale[res.detail.value].label |
|
let t="page.transactionStatus" |
|
if (value) { |
|
this.setData({ |
|
[t]:value, |
|
transactionStatus:label |
|
}) |
|
this.refresh() |
|
}; |
|
}, |
|
bindCalcuChange(res){ |
|
let value= this.data.arrayCalcu[res.detail.value].value; |
|
let label= this.data.arrayCalcu[res.detail.value].label |
|
let t="page.measureStatus" |
|
if (value) { |
|
this.setData({ |
|
[t]:value, |
|
measureStatus:label |
|
}) |
|
this.refresh() |
|
}; |
|
}, |
|
showDown(e){ |
|
const _this=this; |
|
for(let key in this.data.searchNode){ |
|
if(this.data.searchNode[key].height>0){ |
|
this.setData({ |
|
[`searchNode.${key}`]:{height:0,bottom:0} |
|
}) |
|
} |
|
} |
|
switch (e.currentTarget.dataset.type){ |
|
case 'date': |
|
setTimeout(()=>{ |
|
_this.setData({'searchNode.date.height':200,'searchNode.date.bottom':-200,}); |
|
},300) |
|
break; |
|
case 'sale': |
|
setTimeout(()=>{ |
|
_this.setData({'searchNode.sale.height':200,'searchNode.sale.bottom':-200,}); |
|
},300) |
|
break; |
|
case 'calcu': |
|
setTimeout(()=>{ |
|
_this.setData({'searchNode.calcu.height':200,'searchNode.calcu.bottom':-200,}); |
|
},300) |
|
break; |
|
} |
|
}, |
|
demo(){ |
|
console.log(999) |
|
}, |
|
vmodel(e){ |
|
let t="page.landCode" |
|
this.setData({ |
|
[t]:e.detail.value |
|
}) |
|
}, |
|
showInput(){ |
|
if(this.data.inputShow==true){return false} |
|
this.setData({ |
|
inputShow:true |
|
}) |
|
}, |
|
hideInput(){ |
|
this.setData({ |
|
inputShow:false |
|
}) |
|
} |
|
}) |