123 lines
3.8 KiB
JavaScript
123 lines
3.8 KiB
JavaScript
var a = getApp();
|
|
|
|
Page({
|
|
data: {
|
|
token: a.globalData.token,
|
|
array: [ "商业住宅小区", "个人自建房" ],
|
|
index: 0,
|
|
xqArray: [],
|
|
xqAll: [],
|
|
xqIndex: 0,
|
|
xqSelected: "",
|
|
communityName: "",
|
|
communityId: "",
|
|
locationCode: "",
|
|
houseName: "",
|
|
roomNum: "",
|
|
floorNum: "",
|
|
isLoading: !1
|
|
},
|
|
bindPickerChange: function(a) {
|
|
this.setData({
|
|
index: a.detail.value
|
|
});
|
|
},
|
|
bindPickerChange1: function(a) {
|
|
var t;
|
|
t = 0 == a.detail.value ? "" : this.data.xqAll[a.detail.value - 1].residentialId,
|
|
this.setData({
|
|
xqIndex: a.detail.value,
|
|
xqSelected: t
|
|
});
|
|
},
|
|
submitJoin: function() {
|
|
var t = this;
|
|
if (!t.data.isLoading) {
|
|
if (0 == t.data.xqIndex && !t.data.houseName) return void wx.showToast({
|
|
title: "请选择小区",
|
|
icon: "error"
|
|
});
|
|
if (!t.data.floorNum) return void wx.showToast({
|
|
title: "请输入楼栋",
|
|
icon: "error"
|
|
});
|
|
if (!t.data.roomNum) return void wx.showToast({
|
|
title: "请输入门牌号",
|
|
icon: "error"
|
|
});
|
|
var o, e;
|
|
t.data.xqSelected ? (o = t.data.xqSelected, e = "ID") : (o = t.data.houseName, e = "非ID");
|
|
var i = {
|
|
communityId: t.data.communityId,
|
|
areaId: t.data.communityId,
|
|
areaCode: t.data.locationCode,
|
|
communityName: t.data.communityName,
|
|
buildingType: t.data.array[t.data.index],
|
|
residential: o,
|
|
residentialValue: e,
|
|
building: t.data.floorNum,
|
|
houseNumber: t.data.roomNum,
|
|
buildingValue: "非ID",
|
|
houseNumberValue: "非ID",
|
|
locationCode: t.data.locationCode
|
|
};
|
|
t.setData({
|
|
isLoading: !0
|
|
}), a.restAjax.post(a.restAjax.path(a.apis.joinCommunity, [ a.baseUrls.requestUrl ]), i, {
|
|
headers: {
|
|
token: a.globalData.token
|
|
}
|
|
}, function(a, o) {
|
|
wx.showToast({
|
|
title: "加入成功",
|
|
icon: "success"
|
|
}), setTimeout(function() {
|
|
t.setData({
|
|
isLoading: !1
|
|
}), wx.navigateBack({
|
|
delta: 2
|
|
});
|
|
}, 1500);
|
|
}, function(a, o) {
|
|
console.log(o), wx.showToast({
|
|
title: o.msg,
|
|
icon: "error"
|
|
}), t.setData({
|
|
isLoading: !1
|
|
});
|
|
});
|
|
}
|
|
},
|
|
getHouseList: function() {
|
|
var t = this;
|
|
a.restAjax.get(a.restAjax.path(a.apis.getHouse, [ a.baseUrls.communityUrl ]), {
|
|
areaCode: t.data.locationCode
|
|
}, {
|
|
headers: {
|
|
token: a.globalData.token
|
|
}
|
|
}, function(a, o) {
|
|
for (var e = [ "请选择小区" ], i = 0; i < o.length; i++) e.push(o[i].residentialName);
|
|
t.setData({
|
|
xqArray: e,
|
|
xqAll: o
|
|
});
|
|
}, function(a, t) {
|
|
console.log(t);
|
|
});
|
|
},
|
|
onLoad: function(a) {
|
|
this.setData({
|
|
communityName: a.communityName,
|
|
communityId: a.communityId,
|
|
locationCode: a.locationCode
|
|
}), this.getHouseList();
|
|
},
|
|
onReady: function() {},
|
|
onShow: function() {},
|
|
onHide: function() {},
|
|
onUnload: function() {},
|
|
onPullDownRefresh: function() {},
|
|
onReachBottom: function() {},
|
|
onShareAppMessage: function() {}
|
|
}); |