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.
 

459 lines
19 KiB

// components/detail-senior/detail-senior.js
const $api = require('../../utils/api').API;
const measure = require('../../utils/measure')
Component({
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
mid: {
type: String,
},
//测算数据
info: {
type: Object,
value: {}
},
//基础数据
dataInfo: {
type: Object,
value: {}
},
// 查询数据
orgiData: {
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
tabInput: [false, true, false, false, false],
priceData: {
housingPrice: null,
commercePrice: null,
businessPrice: null,
parkingPrice: null,
parkingAllocation: null,
singleIndicator: null,
parkingSaleRate: null,
singlePrimeCost: null,
commerceRate: null,
businessRate: null,
manageFeeRate: null,
salesRate: null,
financialRate: null,
financingRate: null,
loansRate: null,
financingInterest: null,
loansInterest: null,
financingPeriod: null,
loansPeriod: null,
freeHousingRate: null,
freeCommerceRate: null,
freeBusinessRate: null,
selfHousingRate: null,
selfHousingPrice: null,
selfCommerceRate: null,
selfCommercePrice: null,
selfBusinessRate: null,
selfBusinessPrice: null,
selfBusinessSale: null,
selfCommerceSale: null,
selfHousingSale: null,
forecastFloorPrice: null,//预测楼面价
},
tabHDate: ['土地价格', '楼面价', '土地总价', '净利率', '溢价率'], // 标题内容
tabW: ['167', '114', '157', '134', '120'],
rowKey: ['Tprice', 'Lprice', 'AllPrice', 'Interest', 'PremiumRate'],
rowData: [{
Tprice: '起拍价',
Lprice: 0,
AllPrice: 0,
Interest: 0,
PremiumRate: 0
},
{
Tprice: '预测成交价',
Lprice: null,
AllPrice: 0,
Interest: 0,
PremiumRate: 0
},
],
isMeasure: false,
params: {
selfHousingSale: '',
selfCommerceSale: '',
selfBusinessSale: '',
},
arr: [
{label: '否', value: '0'},
{label: '是', value: '1'},
],
measureDataId: '',
parking_sale_rate: '',
finance_rate: '',
measureData: {
"landListedId": null,
"businessPrice": 0,//商务定价
"businessRate": 0,//商务配比
"commercePrice": 0,//商业定价
"commerceRate": 0,//商业配比
"errorAbsoluteValue": 0,//误差绝对值
"financialRate": 0,//财务费率
"financingInterest": 0,//前融利率
"financingPeriod": 0,//前融周期
"financingRate": 0,//前融比例
"floorPrice": 0,//起拍楼面价
"forecastFloorPrice": 0,//预测楼面价
"forecastLandTotalPrice": 0,//预测土地总价
"forecastNetProfitRatio": 0,//预测净利率
"forecastPremiumRate": 0,// 预测溢价率
"freeBusinessRate": 0,//无偿移交商务计容占比
"freeCommerceRate": 0,//无偿移交商业计容占比
"freeHousingRate": 0,//无偿移交住宅计容占比
"housingPrice": 0,//住宅定价
"landTotalPrice": 0,// 土地总价
"loansInterest": 0,// 开发贷利率
"loansPeriod": 0,//开发贷周期
"loansRate": 0,//开发贷比例
"manageFeeRate": 0,//管理费率
// "measureDataId": 0,// 测算数据id
"measureType": 0,// 测算类型(0:基础,1:高级)
"netProfitRatio": 0,//净利率
"parkingAllocation": 0,//车位配比(个/100㎡)
"parkingPrice": 0,//车位定价
"parkingSaleRate": 0,// 车位可售
"premiumRate": 0,//溢价率
"salesRate": 0,//销售费率
"selfBusinessSale": 0,//
"selfBusinessPrice": 0,//商务可售价格
"selfBusinessRate": 0,// 自持商务计容占比
"selfCommerceSale": 0,//
"selfCommercePrice": 0,//商业可售价格
"selfCommerceRate": 0,//自持商业计容占比
"selfHousingSale": 0,//
"selfHousingPrice": 0,//住宅可售价格
"selfHousingRate": 0,//自持住宅计容占比
"singleIndicator": 0,// 单车指标
"singlePrimeCost": 0,//单方成本
"transactionFloorPrice": 0,// 成交楼面价
"statusCd": 1000
}
},
ready() {
//回填数据
$api.AJAX('GET', 'applets/measuredata/' + this.properties.mid, true).then(res => {
if (res.data && res.data.measureType == 1) {
this.setData({
'priceData.housingPrice': res.data.housingPrice,
'priceData.commercePrice': res.data.commercePrice,
'priceData.businessPrice': res.data.businessPrice,
'priceData.parkingPrice': res.data.parkingPrice,
'priceData.parkingAllocation': res.data.parkingAllocation,
'priceData.singleIndicator': res.data.singleIndicator,
'priceData.singlePrimeCost': res.data.singlePrimeCost,
'priceData.manageFeeRate': res.data.manageFeeRate,
'priceData.salesRate': res.data.salesRate,
'priceData.financialRate': res.data.financialRate,
'priceData.loansRate': res.data.loansRate,
'priceData.financingInterest': res.data.financingInterest,
'priceData.loansInterest': res.data.loansInterest,
'priceData.financingPeriod': res.data.financingPeriod,
'priceData.loansPeriod': res.data.loansPeriod,
'priceData.freeHousingRate': res.data.freeHousingRate,
'priceData.freeCommerceRate': res.data.freeCommerceRate,
'priceData.freeBusinessRate': res.data.freeBusinessRate,
'priceData.selfHousingRate': res.data.selfHousingRate,
'priceData.selfHousingPrice': res.data.selfHousingPrice,
'priceData.selfCommerceRate': res.data.selfCommerceRate,
'priceData.selfCommercePrice': res.data.selfCommercePrice,
'priceData.selfBusinessRate': res.data.selfBusinessRate,
'priceData.selfBusinessPrice': res.data.selfBusinessPrice,
})
}
if (this.data.dataInfo) {
this.setData({
'priceData.commerceRate': (((parseFloat(this.data.dataInfo.bizSpace) / parseFloat(this.data.dataInfo.totalConsArea)).toFixed(3)) * 100).toFixed(2),
'priceData.businessRate': (((parseFloat(this.data.dataInfo.bizSpace) / parseFloat(this.data.dataInfo.totalConsArea)).toFixed(3)) * 100).toFixed(2),
'rowData[0].Lprice': this.data.dataInfo.floorPrice ? parseFloat(this.data.dataInfo.floorPrice).toFixed(3) : 0,//transferPrice
'rowData[0].AllPrice': parseFloat(this.data.dataInfo.transferPrice).toFixed(3),
'rowData[1].AllPrice': parseFloat(this.data.dataInfo.transferPrice).toFixed(3),
})
if (this.data.orgiData && this.data.orgiData.measureType === 1) {
let data = JSON.parse(JSON.stringify(this.data.orgiData))
this.data.measureDataId = data.measureDataId;
this.data.isMeasure = true;
this.setData({
params: {
selfHousingSale: data.selfHousingSale === 1 ? '是' : '否',
selfCommerceSale: data.selfCommerceSale === 1 ? '是' : '否',
selfBusinessSale: data.selfBusinessSale === 1 ? '是' : '否',
}
})
for (let key in data) {
for (let key2 in this.data.measureData) {
if (key == key2) {
if (!data[key]) {
this.data.measureData[key2] = 0
} else {
this.data.measureData[key2] = data[key]
}
}
}
for (let key3 in this.data.priceData) {
if (key == key3) {
if (!data[key]) {
this.setData({
[`priceData.${key3}`]: 0
})
// this.data.priceData[key3]=0
} else {
this.setData({
[`priceData.${key3}`]: data[key]
})
}
}
}
}
console.log(this.data.priceData)
this.setData({
'rowData[0].Interest': this.data.measureData.netProfitRatio,
'rowData[1].Interest': this.data.measureData.forecastNetProfitRatio,
'rowData[1].Lprice': this.data.measureData.forecastFloorPrice,
'rowData[1].PremiumRate': this.data.measureData.forecastPremiumRate,
})
}
}
})
//车位配比
$api.getDict('parking_sale_rate').then(res => {
this.setData({
parking_sale_rate: res.data[0].value,
'priceData.parkingSaleRate': res.data[0].value
})
})
//财务费率
$api.getDict('finance_rate').then(res => {
this.setData({
finance_rate: res.data[0].value,
'priceData.financialRate': res.data[0].value
})
})
},
/**
* 组件的方法列表
*/
methods: {
bindChange(e) {
let type = e.currentTarget.dataset.type;
// console.log(type)
for (let key in this.data.params) {
if (key == type) {
this.setData({
[`params.${key}`]: this.data.arr[e.detail.value].label
})
}
}
for (let key in this.data.priceData) {
if (key == type) {
this.setData({
[`priceData.${key}`]: this.data.arr[e.detail.value].value
})
}
}
console.log(this.data.priceData)
},
vmodel(e) {
for (let key in this.data.priceData) {
if (key == e.currentTarget.dataset.type) {
this.data.priceData[key] = e.detail.value
}
}
console.log(this.data.priceData)
},
calculate() {
let table = this.selectComponent('#table');
if (table.data.myData) {
this.setData({
'priceData.forecastFloorPrice': table.data.myData
})
} else if (this.data.measureData.forecastFloorPrice) {
table.data.myData = this.data.measureData.forecastFloorPrice
this.setData({
'priceData.forecastFloorPrice': this.data.measureData.forecastFloorPrice
})
}
console.log(this.data.priceData)
for (let key in this.data.priceData) {
if (!this.data.priceData[key] && this.data.priceData[key] != 0) {
console.log(key)
wx.showToast({
title: '请确定输入是否完整',
icon: 'none',
duration: 2000
})
return false;
}
}
for (let key in this.data.measureData) {
for (let key2 in this.data.priceData) {
if (typeof this.data.priceData[key2] == 'string') {
this.data.priceData[key2] = parseFloat(this.data.priceData[key2])
}
if (key2 == key) {
this.data.measureData[key] = this.data.priceData[key2]
}
}
}
this.setData({
'rowData[0].Interest': (measure(this.data.measureData, parseFloat(this.data.dataInfo.totalConsArea), parseFloat(this.data.dataInfo.startingFloorPrice), parseFloat(this.data.dataInfo.allocationCapacity), parseFloat(this.data.dataInfo.allocationNotCapacity))).toFixed(3),
'rowData[1].Interest': (measure(this.data.measureData, parseFloat(this.data.dataInfo.totalConsArea), parseFloat(table.data.myData), parseFloat(this.data.dataInfo.allocationCapacity), parseFloat(this.data.dataInfo.allocationNotCapacity))).toFixed(3),
'rowData[1].Lprice': table.data.myData,
'rowData[1].PremiumRate': ((parseFloat(table.data.myData) - parseFloat(this.data.dataInfo.startingFloorPrice)) / parseFloat(this.data.dataInfo.startingFloorPrice)).toFixed(3),
})
this.data.measureData.netProfitRatio = parseFloat(this.data.rowData[0].Interest);
this.data.measureData.forecastNetProfitRatio = parseFloat(this.data.rowData[1].Interest);
this.data.measureData.premiumRate = parseFloat(this.data.rowData[0].PremiumRate);
this.data.measureData.forecastPremiumRate = parseFloat(this.data.rowData[1].PremiumRate);
this.data.isMeasure = true;
// measure()
// console.log(this.data.dataInfo)
},
save() {
if (!this.data.isMeasure) {
wx.showToast({
title: '请先完成数据测算',
icon: 'none',
duration: 2000
})
return false;
}
if (this.data.orgiData && this.data.orgiData.statusCd == '1100') {
wx.showToast({
title: '该测算数据已被保存',
icon: 'none',
duration: 2000
})
return false;
}
let data = JSON.parse(JSON.stringify(this.data.measureData))
if (this.data.measureDataId) {
data.measureDataId = this.data.measureDataId
}
data.landListedId = this.data.dataInfo.landListedId;
data.statusCd = 1100;
data.measureType = 1;
$api.measureData(data).then(res => {
if (res.msg == 'ok') {
wx.showToast({
title: '保存成功',
icon: 'none',
duration: 2000
})
}
})
console.log(this.data.measureData)
},
submit() {
if (!this.data.isMeasure) {
wx.showToast({
title: '请先完成数据测算',
icon: 'none',
duration: 2000
})
return false;
}
if (this.data.orgiData && this.data.orgiData.statusCd == '1100') {
wx.showToast({
title: '该测算数据已被保存',
icon: 'none',
duration: 2000
})
return false;
}
let data = JSON.parse(JSON.stringify(this.data.measureData))
if (this.data.measureDataId) {
data.measureDataId = this.data.measureDataId
}
data.landListedId = this.data.dataInfo.landListedId;
data.statusCd = 1000;
data.measureType = 1;
$api.measureData(data).then(res => {
console.log(res)
if (res.msg == 'ok') {
wx.showToast({
title: '提交成功',
icon: 'none',
duration: 2000
})
}
})
},
//重做
clearData() {
this.setData({
priceData: {
housingPrice: null,
commercePrice: null,
businessPrice: null,
parkingPrice: null,
parkingAllocation: null,
singleIndicator: null,
parkingSaleRate: this.data.parking_sale_rate,
singlePrimeCost: null,
commerceRate: (parseFloat(this.data.dataInfo.bizSpace) / parseFloat(this.data.dataInfo.totalConsArea)).toFixed(3),
businessRate: (parseFloat(this.data.dataInfo.bizSpace) / parseFloat(this.data.dataInfo.totalConsArea)).toFixed(3),
manageFeeRate: null,
salesRate: null,
financialRate: this.data.finance_rate,
financingRate: null,
loansRate: null,
financingInterest: null,
loansInterest: null,
financingPeriod: null,
loansPeriod: null,
freeHousingRate: null,
freeCommerceRate: null,
freeBusinessRate: null,
selfHousingRate: null,
selfHousingPrice: null,
selfCommerceRate: null,
selfCommercePrice: null,
selfBusinessRate: null,
selfBusinessPrice: null,
selfBusinessSale: null,
selfCommerceSale: null,
selfHousingSale: null,
forecastFloorPrice: null,//预测楼面价
},
rowData: [{
Tprice: '起拍价',
Lprice: this.data.dataInfo.floorPrice ? parseFloat(this.data.dataInfo.floorPrice).toFixed(3) : 0,//transferPrice,
AllPrice: parseFloat(this.data.dataInfo.transferPrice).toFixed(3),
Interest: 0,
PremiumRate: 0
},
{
Tprice: '预测成交价',
Lprice: null,
AllPrice: parseFloat(this.data.dataInfo.transferPrice).toFixed(3),
Interest: 0,
PremiumRate: 0
},
],
isMeasure: false,
params: {
selfHousingSale: '',
selfCommerceSale: '',
selfBusinessSale: '',
},
})
}
}
})