diff --git a/pages/askHousing/askHousing.js b/pages/askHousing/askHousing.js index 8208e60..58306c9 100644 --- a/pages/askHousing/askHousing.js +++ b/pages/askHousing/askHousing.js @@ -210,6 +210,7 @@ Page({ popUpIs: 'AListOF', popUpStepState: 1, it: 'basic', + field: "rentalduration" }, leasetime: { name: '起租日期', @@ -274,7 +275,7 @@ Page({ name: '发布者性别', popUpIs: 'AListOF', popUpStepState: 1, - field: "gender" + field: "publishergender" }, introduction: { name: '求租描述', @@ -497,17 +498,17 @@ Page({ if (this.data.types == 'edit' || this.data.types == 'edit1') { requestData = { uniqid: this.data.uniqid, - token: this.options.token + token: this.options.token, + intermediary: 6, } } else { requestData = { uniqid: this.data.uniqid, + intermediary: 6, } } - miucms.request(`${app.globalData.baseURL}/tenement/v2/api/publish`, { - intermediary: 6 - }).then(res => { + miucms.request(`${app.globalData.baseURL}/tenement/v2/api/publish`, requestData).then(res => { wx.hideLoading() this.setData({ loding: false @@ -531,6 +532,7 @@ Page({ let locationtail = "" let aa = this.data.aa let locationObj = {} + for (const key in data.fieldinfo) { let choices = null data.fieldinfo[key].forEach(element => { @@ -555,8 +557,8 @@ Page({ fieldinfoNew[element.field]['leftSliderPriceWidthX'] = '0%' fieldinfoNew[element.field]['rightSliderPriceWidthX'] = '0%' + console.log("Array.isArray(data.info[element.field])", data.info[element.field]); if (Array.isArray(data.info[element.field]) && data.info[element.field].length == 0) { - // data.info[element.field] = [0, 10000] fieldinfoNew[element.field]['slider1Value'] = 0 fieldinfoNew[element.field]['slider2Value'] = 10000 } else { @@ -574,9 +576,10 @@ Page({ choices.forEach(el => { if (!el) return if ((this.data.types == 'edit' || this.data.types == 'edit1') && el.key == data.info.type) { - choices.forEach(e => { - if (e.key == [Math.trunc(el.key)]) data.info.type = e.value + '>' + el.value + choices.forEach((e, i) => { + if (e.key == Math.trunc(el.key)) data.info.type = e.value + '>' + el.value }) + } if (el.key % 1 == 0) { choicesnew[el.key - 1] = { @@ -725,6 +728,7 @@ Page({ this.data.areaRegionIndex = el.key - 1 } } + if (el.key % 1 == 0) { choicesnew[el.key - 1] = { value: el.value, @@ -1689,7 +1693,12 @@ Page({ if (popUpIs == 'unilineInput' || popUpIs == 'multilineInput' || popUpIs == 'multilineInput1') this.data.focustitle = field - if ((field == "floor" || field == "property" || field == 'sunshinearea') && this.data.newinfo[field].length == 0) { + if (field == "acreage" && this.data.newinfo[field].length < 2) { + this.data.newinfo[field] = [0, 1000] + this.data.fieldinfoNew[field]['value'] = [0, 1000] + this.data.fieldinfoNew[field]['slider1Value'] = 0 + this.data.fieldinfoNew[field]['slider2Value'] = 1000 + } else if ((field == "floor" || field == "property" || field == 'sunshinearea') && this.data.newinfo[field].length == 0) { this.data.newinfo[field] = [0] this.data.fieldinfoNew[field]['value'] = [0] } else this.data.fieldinfoNew[field]['value'] = this.data.newinfo[field] @@ -1705,6 +1714,8 @@ Page({ focustitle: this.data.focustitle }) + console.log("popUpdate", this.data.popUpdate); + }, // 选择弹窗选项 单选 @@ -2131,8 +2142,12 @@ Page({ } - if ((field == "floor" || field == "property" || field == 'sunshinearea') && this.data.newinfo[field].length == 0) { - // this.data.newinfo[field] = [0] + if (field == "acreage" && this.data.newinfo[field].length < 2) { + this.data.newinfo[field] = [0, 1000] + popUpdate['value'] = [0, 1000] + popUpdate['slider1Value'] = 0 + popUpdate['slider2Value'] = 1000 + } else if ((field == "floor" || field == "property" || field == 'sunshinearea') && this.data.newinfo[field].length == 0) { this.setData({ [`newinfo.${field}`]: [0] }) @@ -2230,13 +2245,12 @@ Page({ let fieldinfo = this.data.fieldinfo // 所在楼层 - if (status == 0 && this.data.popUpIs == 'floor') { - this.data.newinfo.floor = this.data.floorValue[0] - 2 > 0 ? this.data.floorValue[0] - 2 + '楼' : this.data.floorValue[0] - 3 + '楼' - } + // if (status == 0 && this.data.popUpIs == 'floor') { + // this.data.newinfo.floor = this.data.floorValue[0] - 2 > 0 ? this.data.floorValue[0] - 2 + '楼' : this.data.floorValue[0] - 3 + '楼' + // } + + if (this.data.newinfo && this.data.newinfo.subject) this.data.newinfo.subject = this.data.newinfo.subject.trim() - if (this.data.newinfo && this.data.newinfo.subject) { - this.data.newinfo.subject = this.data.newinfo.subject.trim() - } let newinfo = { // 下面验证需要提交的数据,...解决浅拷贝问题 ...this.data.newinfo @@ -2244,7 +2258,7 @@ Page({ newinfo.images = this.data.imgs newinfo.video = this.data.videos - newinfo.floor = parseInt(newinfo.floor) // floor数据加了‘楼’子需要转正整数 + // newinfo.floor = parseInt(newinfo.floor) // floor数据加了‘楼’子需要转正整数 // if (newinfo.acreage != null && newinfo.acreage != "") { // newinfo.acreage = Number(newinfo.acreage) // } @@ -2281,10 +2295,9 @@ Page({ if (element.field == "type") { let fieldinfoNew = this.data.fieldinfoNew fieldinfoNew[element.field].choices.forEach(el => { - // el.choices.forEach(e => { - if (newinfo.type && newinfo.type.indexOf(el.value) >= 0) newinfo.type = el.key - - // }) + el.choices.forEach(e => { + if (newinfo.type && newinfo.type.indexOf(e.value) >= 0) newinfo.type = e.key + }) }) } @@ -2298,13 +2311,13 @@ Page({ } // 房屋类型 - if (element.field == "property") { - element.choices.forEach(res => { - if (res.value == newinfo.property) { - newinfo.property = res.key - } - }) - } + // if (element.field == "property") { + // element.choices.forEach(res => { + // if (res.value == newinfo.property) { + // newinfo.property = res.key + // } + // }) + // } // 性别 if (element.field == "gender") { @@ -2315,10 +2328,9 @@ Page({ }) } - // 电梯 - if (element.field == "elevator" || element.field == 'publishergender') { + // 电梯 晾晒区 + if (element.field == "elevator" || element.field == 'publishergender' || element.field == 'intermediary') { element.choices.forEach(res => { - console.log(res); if (res.value == newinfo[element.field]) { newinfo[element.field] = res.key } @@ -2326,27 +2338,28 @@ Page({ } // 发布者身份 - if (element.field == 'intermediary') { - element.choices.forEach((el, index) => { - if (el.value == newinfo.intermediary) { - newinfo.intermediary = el.key - } - }) - } + // if (element.field == 'intermediary') { + // element.choices.forEach((el, index) => { + // if (el.value == newinfo.intermediary) { + // newinfo.intermediary = el.key + // } + // }) + // } // 所在区域 - if (element.field == 'location') { - this.data.fieldinfoNew[element.field].choices.forEach(el => { - el.choices.forEach(e => { - if (newinfo.location && newinfo.location.indexOf(e.value) >= 0) { - newinfo.location = e.key - } - }) - }) - } + // if (element.field == 'location') { + // this.data.fieldinfoNew[element.field].choices.forEach(el => { + // el.choices.forEach(e => { + // if (newinfo.location && newinfo.location.indexOf(e.value) >= 0) { + // newinfo.location = e.key + // } + // }) + // }) + // } }) } + // miucms.request(app.globalData.baseURL + '/tenement/publish/submit', { miucms.request(app.globalData.baseURL + '/tenement/v2/api/publish/submit', { info: newinfo, @@ -2361,7 +2374,8 @@ Page({ }) } else { wx.redirectTo({ - url: '/pages/show/show?uniqid=' + res.data.uniqid + '&cityid=' + this.data.newcity.id, + // url: '/pages/show/show?uniqid=' + res.data.uniqid + '&cityid=' + this.data.newcity.id, + url: '/pages/show/show?uniqid=' + res.data.uniqid }) } } diff --git a/pages/askHousing/askHousing.wxml b/pages/askHousing/askHousing.wxml index a41230e..ba4a910 100644 --- a/pages/askHousing/askHousing.wxml +++ b/pages/askHousing/askHousing.wxml @@ -40,7 +40,6 @@ } } - // module.exports.fn = fn; @@ -919,7 +918,7 @@ 目标区域* - + {{ index + 1 }} 九龙 > {{ locationObj[item] }} diff --git a/pages/edit/edit.js b/pages/edit/edit.js index 2a39c67..5f43195 100644 --- a/pages/edit/edit.js +++ b/pages/edit/edit.js @@ -317,7 +317,7 @@ Page({ }, { name: '发布者身份', popUpIs: 'AListOF', - popUpStepState: 1, + popUpStepState: 0, field: "intermediary" }, { name: '房屋视频', @@ -561,17 +561,17 @@ Page({ if (this.data.types == 'edit' || this.data.types == 'edit1') { requestData = { uniqid: this.data.uniqid, - token: this.options.token + token: this.options.token, + intermediary: 3, } } else { requestData = { uniqid: this.data.uniqid, + intermediary: 3, } } // miucms.request(`${app.globalData.baseURL}/tenement/publish`, requestData).then(res => { - miucms.request(`${app.globalData.baseURL}/tenement/v2/api/publish`, { - intermediary: 3 - }).then(res => { + miucms.request(`${app.globalData.baseURL}/tenement/v2/api/publish`, requestData).then(res => { wx.hideLoading() this.setData({ loding: false @@ -838,7 +838,7 @@ Page({ // 初始化弹出的窗口 firstStepPopover() { - return + // return // let field = 'type' // let step = 0 // let it = 'basic' @@ -1712,6 +1712,7 @@ Page({ value, field } = "" + if (e.currentTarget) { choices = e.currentTarget.dataset.choices key = e.currentTarget.dataset.key @@ -1719,6 +1720,13 @@ Page({ field = e.currentTarget.dataset.field } else field = e + if (field == "intermediary" && value == "求房源") { + + wx.navigateTo({ + url: `/pages/askHousing/askHousing?uniqid=${this.data.uniqid}`, + }) + return + } let popUpSubtitle1 = this.data.popUpSubtitle let popUpIs = "" @@ -2284,7 +2292,8 @@ Page({ }) } else { wx.redirectTo({ - url: '/pages/show/show?uniqid=' + res.data.uniqid + '&cityid=' + this.data.newcity.id, + // url: '/pages/show/show?uniqid=' + res.data.uniqid + '&cityid=' + this.data.newcity.id, + url: '/pages/show/show?uniqid=' + res.data.uniqid, }) } } diff --git a/pages/edit/edit.wxml b/pages/edit/edit.wxml index b97ae87..7fd7b3e 100644 --- a/pages/edit/edit.wxml +++ b/pages/edit/edit.wxml @@ -842,8 +842,8 @@ - - + + diff --git a/pages/index/index.js b/pages/index/index.js index 7395166..d8a3e51 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -77,10 +77,16 @@ Page({ }) } + let findHouseSource = data.data.findHouseSource + + findHouseSource.forEach(element => { + if (Array.isArray(element['rent'])) element['rent'] = `${element['rent'][0]} ~ ${ element['rent'][1] }` + }) + that.setData({ HKapartment: data.data.HKapartment, otherHousing: data.data.otherHousing, - findHouseSource: data.data.findHouseSource, + findHouseSource, HKhousing: data.data.HKhousing, banner: data.data.banner, service: data.data.service, diff --git a/pages/show/show.js b/pages/show/show.js index a0dec27..cf5d3f5 100644 --- a/pages/show/show.js +++ b/pages/show/show.js @@ -70,7 +70,31 @@ Page({ listingcount: 0, // 房东一共有几个房源 elseResourceData: [], // 其他房源数据 unitTop: 0, // 租金预算的高度 - bottomUnitState: false // 底部租金 预算显示状态 + bottomUnitState: false, // 底部租金 预算显示状态 + basicRequirementsList: [{ // 求房源的基本数据 键值对 + key: "property", + name: "房屋类型" + }, { + key: "floor", + name: "所在楼层" + }, { + key: "elevator", + name: "电梯" + }, { + key: "sunshinearea", + name: "晾晒区" + }, { + key: "acreage", + name: "面积" + }, { + key: "gender", + name: "同住人性别要求" + }, { + key: "publishergender", + name: "发布者性别" + }, ], + + langs: {}, // 语言包 }, to_share() { @@ -124,6 +148,8 @@ Page({ screenWidth: screenWidth, }) this.get_config() + app.globalData['langs'] ? this.data.langs = app.globalData['langs'] : this.getDtailsLangs() + }, onShow() { if (wx.getEnterOptionsSync().query && wx.getEnterOptionsSync().query.scancode_time && app.globalData.scancode_time != wx.getEnterOptionsSync().query.scancode_time) { @@ -133,7 +159,6 @@ Page({ q: wx.getEnterOptionsSync().query.q }) this.get_config() - console.log('onshow有更新') } }, onUnload() { @@ -197,9 +222,11 @@ Page({ source: that.data.source, q: that.data.q }) - miucms.request(app.globalData.config.show.init, sendData).then(data => { + // miucms.request(app.globalData.config.show.init, sendData).then(data => { + miucms.request(`${app.globalData.baseURL}/tenement/v2/api/details`, sendData).then(data => { wx.hideLoading() - if (data.extraparam) { + // if (data.extraparam) { + if (data.code != 200) { wx.showModal({ title: '提示', content: data.message, @@ -211,6 +238,15 @@ Page({ } }) } else { + + data = data.data + // data.info.intermediary = 6 + let info = data.info + if (Array.isArray(info['rent'])) { + info['rent'] = info['rent'][0] + ' ~ ' + info['rent'][1] + } + + that.setData({ irentCouponBig: app.globalData.irentCouponBig || true, info: data.info, @@ -227,26 +263,26 @@ Page({ groupid: data.groupid, listingcount: data.listingcount, landlordcertification: data.landlordcertification, + langs: this.data.langs, loding: false }) if (data.info && data.info.introduction && data.info.introduction.length > 0 && data.info.introduction != ' ') { WxParse.wxParse('info.introduction', 'html', '
' + data.info.introduction + '
', that, 0); } - if (data.info && data.info.message && data.info.message.length > 0 && data.info.message != ' ') { - WxParse.wxParse('info.message', 'html', '
' + data.info.message + '
', that, 0); - } + if (data.info && data.info.message && data.info.message.length > 0 && data.info.message != ' ') WxParse.wxParse('info.message', 'html', '
' + data.info.message + '
', that, 0); + // 认证房东 和 listingcount (他的房源数量) >1 时加载其他房源接口 if (data.groupid == 19 && data.listingcount > 1) this.getElseResource() // 判断是否需要请求顶部广告 - if (data.ads.bannertop) this.requestTopAds(data.ads.bannertop) + if (data.ads && data.ads.bannertop) this.requestTopAds(data.ads.bannertop) // 判断是否是求房源 如果是需要获取租金位置 this.getRentalLocation() - + this.againstTargetArea() } }).catch(res => { wx.hideLoading() @@ -257,8 +293,70 @@ Page({ }) }, - copy: function (e) { + // 获取语言包 保存全局 + getDtailsLangs() { + miucms.request(`${app.globalData.baseURL}/tenement/v2/api/details/langs`).then(res => { + if (res.code != 200) return + let data = res.data + this.setData({ + langs: data + }) + app.globalData['langs'] = data + }) + }, + + // 对照目标区域的 + againstTargetArea() { + let langs = this.data.langs + console.log("langs", langs); + if (Object.keys(langs).length == 0) { + setTimeout(() => { + this.againstTargetArea() + }, 800) + } else { + let info = this.data.info + + if (Array.isArray(info['acreage'])) info['acreage'] = info['acreage'][0] + ' ~ ' + info['acreage'][1] + + let list = ['type', 'rentalduration', 'intermediary'] + console.log("info['floor']", info['floor']); + if (Array.isArray(info['floor'])) list.push('floor') + + + let differentNames = { + "intermediary": "intermediary_text" + } + + list.forEach(element => { + if (info[element] == 0) info[differentNames[element] ? differentNames[element] : element] = '不限' + else info[differentNames[element] ? differentNames[element] : element] = langs[element][info[element]] + }) + + let location = langs.location + let pendingData = info['location'] + let locationList = [] + for (const key in location) { + if (pendingData.indexOf(key) != -1) { + locationList.push({ + head: location[Math.trunc(key)], + end: location[key], + }) + } + } + + info['locationList'] = locationList + + this.setData({ + info + }) + + + } + + }, + + copy: function (e) { var that = this; let num = that.data.info[e.currentTarget.dataset.num] + ''; let hint = e.currentTarget.dataset.hint @@ -760,6 +858,8 @@ Page({ // 点击复制的公共方法 publicCopy(e) { let value = e.currentTarget.dataset.value + + if (typeof value === 'number') value = value + '' miucms.copy(value) }, diff --git a/pages/show/show.wxml b/pages/show/show.wxml index 7981684..ac959a0 100644 --- a/pages/show/show.wxml +++ b/pages/show/show.wxml @@ -48,8 +48,9 @@ {{ info.subject }} @@ -65,7 +66,6 @@
- @@ -85,10 +85,28 @@ 基本要求 - - 房屋类型 - 不限 - + + + {{ item.name }} + {{ info[item.key] + ' 平方呎' }} + + + {{ langs[item.key][it] }} {{ index == info[item.key].length - 1 ? '' : '/' }} + + + + 不限 + + + {{ langs['gender'][info[item.key]] }} + + + {{ langs[item.key][info[item.key]] }} + + {{ info[item.key] }} + + + @@ -100,23 +118,23 @@
- - 新界 + + {{ item.head }} - 将军澳/坑口/宝琳 + {{ item.end }} - + 求租描述 -