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.

255 lines
6.9 KiB

4 years ago
// pages/look-detail/look-detail.js
4 years ago
const $api = require('../../utils/api').API;
const gisUtil = require('../../utils/gitUtil')
4 years ago
Page({
4 years ago
/**
* 页面的初始数据
*/
data: {
state: true,
landListedId: '',
myData: {},
tabList: [{
id: 1,
name: '公告信息'
}, {
id: 2,
name: '成交信息'
}, {
id: 3,
name: '呈现项目'
},
// {
// id: 6,
// name: '拟供地块'
// }
],
sedTabList: [{
id: 4,
name: '基础测算'
}, {
id: 5,
name: '高级测算'
}],
active: 1,//当前选择项
markShow: false,
annoutInfo: {},
clinchInfo: {},
presentInfo: {
list: {},
more: []
},
latitude: '29.56',
longitude: '106.58',
basisInfo: {},
seniorInfo: {},
polygons: [],
orgiData: {},
isDone: false,
mid: '',
},
4 years ago
setMark(e) {
let {
markShow
} = this.data;
$api.getCalulaDeatail(this.data.landListedId).then(res => {
if (res.data) {
this.setData({
orgiData: res.data
})
}
if (markShow) {
let active = Number(e.currentTarget.dataset.id)
this.setData({
state: false,
markShow: false,
active
})
} else {
this.setData({
markShow: true
})
}
4 years ago
})
4 years ago
},
tabDowm(e) {
4 years ago
let active = Number(e.currentTarget.dataset.id)
4 years ago
if (active !== this.data.active) {
this.setData({
active
})
}
},
comeBack() {
wx.navigateBack({
delta: 1
4 years ago
})
4 years ago
},
markHide() {
4 years ago
this.setData({
4 years ago
markShow: false
4 years ago
})
4 years ago
},
getData(id) {
$api.AJAX('GET', 'applets/landlistedlonlat/list/' + id, {
landListedId: id
}, true).then(res => {
if (res&&res.data&&res.data.length > 0) {
if (res.data[0].centerPoint) {
let centerPoint = res.data[0].centerPoint;
this.setData({
longitude: centerPoint[0],
latitude: centerPoint[1],
})
gisUtil.setWKT(this, res, 2)
}
4 years ago
}
})
4 years ago
4 years ago
$api.getLandDetail(this.data.landListedId).then(res => {
for (let key in res.data) {
if (!res.data[key]) {
res.data[key] = ''
}
}
4 years ago
if(res.data.totalConsArea&&res.data.totalConsArea!=''&&res.data.totalConsArea!=0){
res.data.bizSpaceRatio=((res.data.bizSpace/res.data.totalConsArea)*100).toFixed(2);
res.data.commerceSpaceRatio=((res.data.commerceSpace/res.data.totalConsArea)*100).toFixed(2);
}else{
res.data.bizSpaceRatio=0;
res.data.commerceSpaceRatio=0;
}
4 years ago
4 years ago
this.setData({
myData: res.data
})
4 years ago
let totalConsArea = res.data.totalConsArea;
$api.AJAX('GET', 'applets/landlistedconstructionplan/list/' + this.data.landListedId, true).then(res => {
let plan = 0;
let planRatio = 0;
let unplan = 0;
for(let i in res.data){
if(res.data[i].constructionType=='1'){
plan+=res.data[i].constructionArea
}else if(res.data[i].constructionType=='2'){
unplan+=res.data[i].constructionArea
}
}
if (totalConsArea&&totalConsArea!=''&&totalConsArea!=0){
planRatio = (plan/totalConsArea*100).toFixed(2);
}
this.setData({
'myData.plan': plan,
'myData.planRatio': planRatio,
'myData.unplan': unplan,
})
})
$api.AJAX('GET', 'applets/landlistedconductenterprise/list/' + this.data.landListedId, true).then(res => {
this.setData({
'myData.enterprise': res.data
})
})
4 years ago
$api.getPreSaleDetailList({landListedId: this.data.landListedId}).then(res => {
this.setData({
'presentInfo.more': res.data
})
})
$api.getPreSaleTotal({landListedId: this.data.landListedId}).then(res => {
this.setData({
'presentInfo.list': res.data
})
})
4 years ago
})
},
goCalculate() {
if (this.data.active === 4) {
let basis = this.selectComponent('#basis');
basis.calculate()
} else {
4 years ago
let senior = this.selectComponent('#senior');
senior.calculate()
}
4 years ago
4 years ago
},
clearData() {
if (this.data.active === 4) {
let basis = this.selectComponent('#basis');
basis.clearData()
} else {
let senior = this.selectComponent('#senior');
senior.clearData()
}
},
save() {
if (this.data.active === 4) {
let basis = this.selectComponent('#basis');
basis.save()
} else {
let senior = this.selectComponent('#senior');
senior.save()
}
},
submit() {
if (this.data.active === 4) {
let basis = this.selectComponent('#basis');
console.log(basis);
basis.submit()
} else {
let senior = this.selectComponent('#senior');
senior.submit()
}
4 years ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let active = options.active;
4 years ago
this.setData({
4 years ago
landListedId: options.id,
mid: options.mid
4 years ago
})
4 years ago
this.getData(options.id)
if (active) {
active = Number(active);
if (active > 3) {
this.setData({
state: false,
active
})
} else {
this.setData({
active
})
}
}
},
4 years ago
4 years ago
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
4 years ago
4 years ago
},
4 years ago
4 years ago
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 1
})
}
},
4 years ago
})