Commit 170e0190 authored by 李尚科's avatar 李尚科

house fix

parent 2b44d06c
...@@ -4,63 +4,63 @@ ...@@ -4,63 +4,63 @@
const Service = require('egg').Service; const Service = require('egg').Service;
const PRICE_RANGE = [ const PRICE_RANGE = [
{ name: '不限', min: 0, max: 0 }, { name: '不限', id: -100, min: 0, max: 0 },
{ name: '2000元以下', min: 0, max: 2000 }, { name: '2000元以下', id: -101, min: 0, max: 2000 },
{ name: '2000元-3000元', min: 2000, max: 3000 }, { name: '2000元-3000元', id: -102, min: 2000, max: 3000 },
{ name: '3000元-4000元', min: 3000, max: 4000 }, { name: '3000元-4000元', id: -103, min: 3000, max: 4000 },
{ name: '4000元-5000元', min: 4000, max: 5000 }, { name: '4000元-5000元', id: -104, min: 4000, max: 5000 },
{ name: '5000元-6000元', min: 5000, max: 6000 }, { name: '5000元-6000元', id: -105, min: 5000, max: 6000 },
{ name: '6000元-7000元', min: 6000, max: 7000 }, { name: '6000元-7000元', id: -106, min: 6000, max: 7000 },
{ name: '7000元-8000元', min: 7000, max: 8000 }, { name: '7000元-8000元', id: -107, min: 7000, max: 8000 },
{ name: '8000元-10000元', min: 8000, max: 10000 }, { name: '8000元-10000元', id: -108, min: 8000, max: 10000 },
{ name: '10000元以上', min: 10000, max: 10000000000000 }, { name: '10000元以上', id: -109, min: 10000, max: 10000000000000 },
] ]
const HOUSE_TYPE = [ const HOUSE_TYPE = [
{ name: '不限', min: 0, max: 0, value: 0, }, { name: '不限', id: -110, min: 0, max: 0, value: 0, },
{ name: '1室', min: 1, max: 1, value: 1, }, { name: '1室', id: -111, min: 1, max: 1, value: 1, },
{ name: '2室', min: 2, max: 2, value: 2, }, { name: '2室', id: -112, min: 2, max: 2, value: 2, },
{ name: '3室', min: 3, max: 3, value: 3, }, { name: '3室', id: -113, min: 3, max: 3, value: 3, },
{ name: '4室', min: 4, max: 4, value: 4, }, { name: '4室', id: -114, min: 4, max: 4, value: 4, },
{ name: '5室', min: 4, max: 4, value: 5, }, { name: '5室', id: -115, min: 4, max: 4, value: 5, },
{ name: '5室以上', min: 5, max: 10000, value: 6, }, { name: '5室以上', id: -116, min: 5, max: 10000, value: 6, },
{ name: '别墅', min: 10000, max: 10000000, value: 7, }, { name: '别墅', id: -117, min: 10000, max: 10000000, value: 7, },
] ]
const NEW_HOUSE_UNIT_PRICE = [ const NEW_HOUSE_UNIT_PRICE = [
{ name: '不限', min: 0, max: 0 }, { name: '不限', id: -118, min: 0, max: 0 },
{ name: '1万以下', min: 0, max: 10000 }, { name: '1万以下', id: -119, min: 0, max: 10000 },
{ name: '1万-2万', min: 10000, max: 20000 }, { name: '1万-2万', id: -120, min: 10000, max: 20000 },
{ name: '2万-3万', min: 20000, max: 30000 }, { name: '2万-3万', id: -121, min: 20000, max: 30000 },
{ name: '3万-4万', min: 30000, max: 40000 }, { name: '3万-4万', id: -122, min: 30000, max: 40000 },
{ name: '4万-5万', min: 40000, max: 50000 }, { name: '4万-5万', id: -123, min: 40000, max: 50000 },
{ name: '5万-6万', min: 60000, max: 70000 }, { name: '5万-6万', id: -124, min: 60000, max: 70000 },
] ]
const NEW_HOUSE_TOTAL_PRICE = [ const NEW_HOUSE_TOTAL_PRICE = [
{ name: '不限', min: 0, max: 0 }, { name: '不限', id: -125, min: 0, max: 0 },
{ name: '100万以下', min: 0, max: 100 }, { name: '100万以下', id: -126, min: 0, max: 100 },
{ name: '100万-200万', min: 100, max: 200 }, { name: '100万-200万', id: -127, min: 100, max: 200 },
{ name: '200万-300万', min: 200, max: 300 }, { name: '200万-300万', id: -128, min: 200, max: 300 },
{ name: '300万-400万', min: 300, max: 400 }, { name: '300万-400万', id: -129, min: 300, max: 400 },
{ name: '400万-500万', min: 400, max: 500 }, { name: '400万-500万', id: -130, min: 400, max: 500 },
{ name: '500万-600万', min: 500, max: 600 }, { name: '500万-600万', id: -131, min: 500, max: 600 },
{ name: '600万-700万', min: 600, max: 700 }, { name: '600万-700万', id: -132, min: 600, max: 700 },
{ name: '700万-800万', min: 700, max: 800 }, { name: '700万-800万', id: -133, min: 700, max: 800 },
{ name: '800万-900万', min: 800, max: 900 }, { name: '800万-900万', id: -134, min: 800, max: 900 },
{ name: '900万-1000万', min: 900, max: 1000 }, { name: '900万-1000万', id: -135, min: 900, max: 1000 },
{ name: '1000万以上', min: 1000, max: 0 }, { name: '1000万以上', id: -136, min: 1000, max: 0 },
] ]
const NEW_HOUSE_AREA = [ const NEW_HOUSE_AREA = [
{ name: '不限', min: 0, max: 0 }, { name: '不限', id: -137, min: 0, max: 0 },
{ name: '50平米以下', min: 0, max: 50 }, { name: '50平米以下', id: -138, min: 0, max: 50 },
{ name: '50平米-70平米', min: 50, max: 70 }, { name: '50平米-70平米', id: -139, min: 50, max: 70 },
{ name: '70平米-90平米', min: 70, max: 90 }, { name: '70平米-90平米', id: -140, min: 70, max: 90 },
{ name: '90平米-120平米', min: 90, max: 120 }, { name: '90平米-120平米', id: -141, min: 90, max: 120 },
{ name: '120平米-150平米', min: 120, max: 150 }, { name: '120平米-150平米', id: -142, min: 120, max: 150 },
{ name: '150平米-200平米', min: 150, max: 200 }, { name: '150平米-200平米', id: -143, min: 150, max: 200 },
{ name: '200平米以上', min: 200, max: 999 } { name: '200平米以上', id: -144, min: 200, max: 999 }
] ]
class OptionService extends Service { class OptionService extends Service {
...@@ -75,10 +75,10 @@ class OptionService extends Service { ...@@ -75,10 +75,10 @@ class OptionService extends Service {
return { return {
result: [ result: [
{ name: '品牌', id: 0, path: [], nameShow: '', _children: brands }, { name: '品牌', id: -1, path: [], nameShow: '', _children: brands },
{ name: '区域', id: 0, path: [], nameShow: '', _children: areas }, { name: '区域', id: -2, path: [], nameShow: '', _children: areas },
{ name: '价格', id: 0, path: [], nameShow: '', _children: prices }, { name: '价格', id: -3, path: [], nameShow: '', _children: prices },
{ name: '户型', id: 0, path: [], nameShow: '', _children: house_types }] { name: '户型', id: -4, path: [], nameShow: '', _children: house_types }]
}; };
} }
...@@ -94,14 +94,14 @@ class OptionService extends Service { ...@@ -94,14 +94,14 @@ class OptionService extends Service {
return { return {
result: [ result: [
{ name: '区域', id: 0, path: [], nameShow: '', _children: areas }, { name: '区域', id: -1, path: [], nameShow: '', _children: areas },
{ {
name: '价格', id: 0, path: [], nameShow: '', _children: [ name: '价格', id: -2, path: [], nameShow: '', _children: [
{ name: '总价', id: 0, path: [], nameShow: '', _children: total_price }, { name: '总价', id: -3, _children: total_price },
{ name: '单价', id: 0, path: [], nameShow: '', _children: unit_price }] { name: '单价', id: -4, _children: unit_price }]
}, },
{ name: '面积', id: 0, path: [], nameShow: '', _children: house_area }, { name: '面积', id: -5, path: [], nameShow: '', _children: house_area },
{ name: '户型', id: 0, path: [], nameShow: '', _children: house_types }, { name: '户型', id: -6, path: [], nameShow: '', _children: house_types },
] ]
}; };
} }
...@@ -119,6 +119,7 @@ class OptionService extends Service { ...@@ -119,6 +119,7 @@ class OptionService extends Service {
id: developer.id, id: developer.id,
name: developer.name, name: developer.name,
image: developer.logo, image: developer.logo,
value: developer.id,
}); });
} }
...@@ -140,7 +141,7 @@ class OptionService extends Service { ...@@ -140,7 +141,7 @@ class OptionService extends Service {
const ret = [] const ret = []
for (let j in districts) { for (let j in districts) {
const district = districts[j]; const district = districts[j];
const _children = [{id:0, name: '不限'}]; const _children = [{ id: 0, name: '不限' }];
const bizcircles = await ctx.blockModel.HouseBizcircle.all({ where: { district_id: district.id } }); const bizcircles = await ctx.blockModel.HouseBizcircle.all({ where: { district_id: district.id } });
if (!bizcircles || bizcircles.length === 0) { if (!bizcircles || bizcircles.length === 0) {
continue; continue;
...@@ -150,6 +151,7 @@ class OptionService extends Service { ...@@ -150,6 +151,7 @@ class OptionService extends Service {
_children.push({ _children.push({
id: bizcircle.id, id: bizcircle.id,
name: bizcircle.name, name: bizcircle.name,
value: bizcircle.id,
// district_id: bizcircle.district_id, // district_id: bizcircle.district_id,
}); });
} }
...@@ -158,6 +160,7 @@ class OptionService extends Service { ...@@ -158,6 +160,7 @@ class OptionService extends Service {
name: district.name, name: district.name,
// city_id: district.city_id, // city_id: district.city_id,
_children: _children, _children: _children,
value: district.id,
}) })
} }
......
...@@ -198,75 +198,6 @@ class RentalHouseService extends Service { ...@@ -198,75 +198,6 @@ class RentalHouseService extends Service {
} }
//获取房源类型
async getRentalHouseTypes(rental_house_id) {
const { ctx } = this;
const house_type_filter = {
pageSize: 1000,
queryConditions: [
{
key: 'rentalHouseId',
value: rental_house_id,
operator: 'equal',
},
{
key: 'state',
value: '1',
operator: 'equal',
},
]
}
const house_types_results = await ctx.service.houseCommon.rentalHouseType.all(house_type_filter);
const house_types = house_types_results.results;
let house_type_image_filter = {
pageSize: 10000,
queryConditions: [
{
key: 'state',
value: 1,
operator: 'equal'
},
{
key: 'type',
value: 3,
operator: 'equal',
},
],
};
const ret = {};
for (let i in house_types) {
const house_type = house_types[i];
house_type_image_filter.queryConditions.push({
key: 'connectId',
value: house_type.id,
operator: 'equal',
});
const house_type_images_results = await ctx.service.houseCommon.houseImage.all(house_type_image_filter);
const type = house_type.type || 1;
const house_type_value = HOUSE_TYPE[type];
if (!ret[type]) {
ret[type] = {
name: house_type_value.name,
results: [],
count: 0,
}
}
ret[type].results.push({
id: house_type.id,
name: house_type.name,
area: house_type.area,
price: house_type.price,
images: R.project(['id', 'path', 'description'])(house_type_images_results.results),
});
ret[type].count++;
}
return ret;
}
async formatRentalHouseBasic(rental_houses) { async formatRentalHouseBasic(rental_houses) {
...@@ -293,8 +224,8 @@ class RentalHouseService extends Service { ...@@ -293,8 +224,8 @@ class RentalHouseService extends Service {
2、房型说明:独门独户,拎包入住,满足各种需求,采光 2、房型说明:独门独户,拎包入住,满足各种需求,采光
3、社区配套:健身房、休憩区、小影院、娱乐室、商务区、无人商店、快递柜。 3、社区配套:健身房、休憩区、小影院、娱乐室、商务区、无人商店、快递柜。
4、房间配套:空调、Wifi、洗衣机、热水器、冰箱、床、衣柜、电脑桌、沙发。`, 4、房间配套:空调、Wifi、洗衣机、热水器、冰箱、床、衣柜、电脑桌、沙发。`,
// room_configuration: JSON.parse(rental_house.roomConfiguration),//房间配置 room_configuration: JSON.parse(rental_house.roomConfiguration),//房间配置
room_configuration: rental_house.roomConfiguration,//房间配置 // room_configuration: rental_house.roomConfiguration,//房间配置
notice: rental_house.notice,//入住须知 notice: rental_house.notice,//入住须知
}; };
ret.push(temp_rental_house); ret.push(temp_rental_house);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment