This commit is contained in:
A1300399510 2023-06-28 12:02:58 +08:00
parent e120ed68bf
commit abd6311019
5 changed files with 63 additions and 10 deletions

View File

@ -984,6 +984,14 @@ Page({
if (field == "leasetime") {
popUpIs = "ofDate"
popUpStepState = 1
let today = new Date();
let year = today.getFullYear();
let month = String(today.getMonth() + 1).padStart(2, '0');
let day = String(today.getDate()).padStart(2, '0');
value = `${year}-${month}-${day}`;
this.setData({
'newinfo.leasetime': value
})
}
this.setData({
@ -1098,6 +1106,23 @@ Page({
else targetValue.push(key)
}
if (popUpdate.field == "location") {
console.log("key", key >>> 0);
let index = targetValue.indexOf((key >>> 0).toString())
console.log("index", index, targetValue);
if (index != -1) targetValue.splice(index, 1);
// if (index !== -1) location.splice(index, 1);
// if () {
// }
// targetValue
}
if (popUpdate.field == "location" && targetValue.length > 6) return
targetValue.sort()
@ -1113,6 +1138,29 @@ Page({
},
// 目标区域的的特殊不限处理
targetAreaUnlimited(e) {
let key = e.currentTarget.dataset.key
let location = this.data.newinfo['location']
let index = location.indexOf(key);
// 选中的
if (index !== -1) location.splice(index, 1);
else { // 取消
location = location.filter(item => item && !item.startsWith(key.toString()));
location.push(key)
}
location.sort()
if (location.length > 6) return
this.data.newinfo['location'] = location
this.setData({
['popUpdate.value']: location,
newinfo: this.data.newinfo
})
},
// 弹出上角的关闭弹窗
closePopUp() {
let currentField = this.data.fieldinfo[this.data.popUpit][this.data.step].field
@ -1263,7 +1311,8 @@ Page({
return
}
if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == "gender" && this.data.newinfo['type'].indexOf("合租") == -1) {
console.log("type", this.data.newinfo['type']);
if (this.data.fieldinfo[this.data.popUpit][this.data.step].field == "gender" && this.data.newinfo['type'] && this.data.newinfo['type'].indexOf("合租") == -1) {
this.setData({
step: this.data.step + 1
})
@ -1619,7 +1668,7 @@ Page({
if (field == "rent" && this.data.newinfo[field].length < 2) {
this.setData({
[`nnewinfo${field}`]: popUpdate['value']
[`newinfo${field}`]: popUpdate['value']
})
}

View File

@ -640,7 +640,8 @@
<view class="target-area-list">
<view class="target-area-item flexacenter" wx:for="{{ newinfo.location }}" wx:key="index">
<view class="target-area-index flexcenter">{{ index + 1 }}</view>
<view class="target-area-content">{{ locationObj[m1.floor(item)] }} > {{ locationObj[item] }}</view>
<view wx:if="{{ m1.floor(item) == item }}" class="target-area-content">{{ locationObj[m1.floor(item)] + '>' + '不限' }}</view>
<view wx:else class="target-area-content">{{ locationObj[m1.floor(item)] }} > {{ locationObj[item] }}</view>
<image bindtap="deleteLocation" data-key="{{ item }}" class="target-area-cross" src="/img/close-c.png"></image>
</view>
</view>
@ -665,16 +666,17 @@
<view class="pop-area-item" wx:for="{{ item.choices }}" wx:for-item="ite">
<view class="pop-area-name">{{ ite.value }}</view>
<view class="pop-area-content flexflex">
<view class="pop-area-content-item flexcenter {{ m1.fn(newinfo.location,ite.key,item.field).indexOf ? 'pitch' : '' }}" catchtap="targetAreaUnlimited" data-key="{{ ite.key }}">不限</view>
<view class="pop-area-content-item flexcenter {{ m1.fn(newinfo.location,it.key,item.field).indexOf ? 'pitch' : '' }}" wx:for="{{ ite.choices }}" wx:key="index" wx:for-item="it" catchtap="selectMultipleOption" data-key="{{ it.key }}">{{ it.value }}</view>
</view>
</view>
</view>
<view class="pop-area-pitch-list flexacenter" wx:if="{{ newinfo.location.length != 0 }}">
<view class="pop-area-pitch-item flexacenter" wx:for="{{ newinfo.location }}" wx:key="index">
<view class="pop-area-pitch-index flexcenter">{{ index + 1}}</view>
<view class="pop-area-pitch-content flexacenter">{{ locationObj[m1.floor(item)] + '>' + locationObj[item] }}</view>
<view wx:if="{{ m1.floor(item) == item }}" class="pop-area-pitch-content flexacenter">{{ locationObj[m1.floor(item)] + '>' + '不限' }}</view>
<view wx:else class="pop-area-pitch-content flexacenter">{{ locationObj[m1.floor(item)] + '>' + locationObj[item] }}</view>
<image class="pop-area-pitch-cross" catchtap="deleteLocation" data-key="{{ item }}" src="/img/close-c.png"></image>
</view>
</view>

View File

@ -509,7 +509,7 @@ Page({
let pendingData = element['location'] || []
let locationList = []
for (const key in location) {
if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`)
if (pendingData.indexOf(key) != -1) locationList.push(`${location[Math.trunc(key)]} > ${ Math.trunc(key) != key ? location[key] : '不限' }`)
}
element['locationList'] = locationList
})
@ -520,7 +520,6 @@ Page({
list
})
}
},

View File

@ -389,11 +389,13 @@ Page({
let location = langs.location // 遍历替换区域的值 所有房源
let pendingData = info['location'] || ''
let locationList = []
console.log("location", pendingData);
for (const key in location) {
if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) {
// if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) {
if (pendingData.indexOf(key) != -1) {
locationList.push({
head: location[Math.trunc(key)],
end: location[key],
end: Math.trunc(key) != key ? location[key] : '不限',
})
}
}

View File

@ -968,7 +968,8 @@ Page({
if (Array.isArray(pendingData)) {
let locationList = []
for (const key in location) {
if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`)
// if (pendingData.indexOf(key) != -1 && Math.trunc(key) != key) locationList.push(`${location[Math.trunc(key)]} > ${location[key]}`)
if (pendingData.indexOf(key) != -1) locationList.push(`${location[Math.trunc(key)]} > ${ Math.trunc(key) != key ? location[key] : '不限' }`)
}
ele['locationList'] = locationList
} else if (location[pendingData]) ele['location'] = `${location[Math.trunc(pendingData)]} > ${location[pendingData]}`