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.
479 lines
21 KiB
479 lines
21 KiB
2 years ago
|
"use strict";
|
||
|
var __assign = (this && this.__assign) || function () {
|
||
|
__assign = Object.assign || function(t) {
|
||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||
|
s = arguments[i];
|
||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||
|
t[p] = s[p];
|
||
|
}
|
||
|
return t;
|
||
|
};
|
||
|
return __assign.apply(this, arguments);
|
||
|
};
|
||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
|
});
|
||
|
};
|
||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||
|
function step(op) {
|
||
|
if (f) throw new TypeError("Generator is already executing.");
|
||
|
while (_) try {
|
||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||
|
switch (op[0]) {
|
||
|
case 0: case 1: t = op; break;
|
||
|
case 4: _.label++; return { value: op[1], done: false };
|
||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||
|
default:
|
||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||
|
if (t[2]) _.ops.pop();
|
||
|
_.trys.pop(); continue;
|
||
|
}
|
||
|
op = body.call(thisArg, _);
|
||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||
|
}
|
||
|
};
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
var rerquest_1 = require("../../../config/rerquest");
|
||
|
var promise_wx_api_1 = require("../../../utils/promise-wx-api");
|
||
|
var location_1 = require("../../../utils/location");
|
||
|
var app = getApp();
|
||
|
Component({
|
||
|
properties: {
|
||
|
isNovice: {
|
||
|
type: Boolean,
|
||
|
value: false,
|
||
|
},
|
||
|
},
|
||
|
data: {
|
||
|
hasChose: false,
|
||
|
isShowHouseList: true,
|
||
|
selectedarea: false,
|
||
|
region: ["山东省", "青岛市", "市北区"],
|
||
|
currentAddress: "",
|
||
|
contact: "",
|
||
|
qrUrl: "",
|
||
|
gridList: [],
|
||
|
params: {
|
||
|
pageNo: 1,
|
||
|
pageSize: 20,
|
||
|
isNone: false,
|
||
|
isAuthorized: 1,
|
||
|
areaCode: "",
|
||
|
selectedAreaCode: "",
|
||
|
province: "",
|
||
|
city: "",
|
||
|
area: "",
|
||
|
},
|
||
|
idCard: "",
|
||
|
buildingName: "",
|
||
|
},
|
||
|
observers: {
|
||
|
buildingName: function () {
|
||
|
this.getList();
|
||
|
},
|
||
|
},
|
||
|
methods: {
|
||
|
onLoad: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
return __generator(this, function (_a) {
|
||
|
switch (_a.label) {
|
||
|
case 0:
|
||
|
this.getContactPhone();
|
||
|
wx.showLoading({ title: "请求中" });
|
||
|
return [4, this.getLocation()];
|
||
|
case 1:
|
||
|
_a.sent();
|
||
|
wx.hideLoading();
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
getContactPhone: function () {
|
||
|
var _this = this;
|
||
|
rerquest_1.default({
|
||
|
method: "POST",
|
||
|
url: "resi/guide/stranger/marketcontactinfo",
|
||
|
ifToken: false,
|
||
|
}).then(function (res) {
|
||
|
console.log(res.data);
|
||
|
_this.setData({
|
||
|
contact: res.data.phone,
|
||
|
qrUrl: res.data.qrUrl,
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
getLocation: function (isQuiet) {
|
||
|
if (isQuiet === void 0) { isQuiet = true; }
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var st, isAuthorized, _a, msg, data;
|
||
|
return __generator(this, function (_b) {
|
||
|
switch (_b.label) {
|
||
|
case 0: return [4, promise_wx_api_1.wxGetSetting()];
|
||
|
case 1:
|
||
|
st = _b.sent();
|
||
|
isAuthorized = 0;
|
||
|
if (st.msg == "success" && st.data.authSetting["scope.userLocation"]) {
|
||
|
isAuthorized = 1;
|
||
|
}
|
||
|
return [4, location_1.default(isQuiet)];
|
||
|
case 2:
|
||
|
_a = _b.sent(), msg = _a.msg, data = _a.data;
|
||
|
console.log(msg, data);
|
||
|
if (msg === "success") {
|
||
|
this.setData({
|
||
|
selectedarea: true,
|
||
|
currentAddress: data.address,
|
||
|
"params.isAuthorized": isAuthorized,
|
||
|
"params.province": data.province,
|
||
|
"params.city": data.city,
|
||
|
"params.area": data.district,
|
||
|
"params.selectedAreaCode": data.adcode,
|
||
|
"params.areaCode": data.adcode,
|
||
|
});
|
||
|
this.resetGridList();
|
||
|
this.getList();
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
reLocation: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
return __generator(this, function (_a) {
|
||
|
console.log("重新获取定位");
|
||
|
this.getLocation(false);
|
||
|
return [2];
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
bindRegionChange: function (e) {
|
||
|
console.log("picker发送选择改变,携带值为", e.detail.value[0]);
|
||
|
var province = e.detail.value[0];
|
||
|
var city = e.detail.value[1];
|
||
|
var area = e.detail.value[2];
|
||
|
var adcode = e.detail.code[2];
|
||
|
this.setData({
|
||
|
selectedarea: true,
|
||
|
region: e.detail.value,
|
||
|
"params.province": province,
|
||
|
"params.city": city,
|
||
|
"params.area": area,
|
||
|
"params.areaCode": adcode,
|
||
|
"params.selectedAreaCode": adcode,
|
||
|
});
|
||
|
this.resetGridList();
|
||
|
this.getList();
|
||
|
},
|
||
|
onReachBottom: function () {
|
||
|
if (!this.data.isShowHouseList) {
|
||
|
this.getList();
|
||
|
}
|
||
|
},
|
||
|
handleBlur: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
if (!this.identityCodeValid(value)) {
|
||
|
return wx.showToast({
|
||
|
title: "证件号格式错误",
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
handleBlur_new: function (e) {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var value;
|
||
|
return __generator(this, function (_a) {
|
||
|
console.log(JSON.stringify(e));
|
||
|
value = e.detail.value;
|
||
|
console.log("value:", value);
|
||
|
return [2];
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
handleInput: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
this.setData({
|
||
|
idCard: value,
|
||
|
});
|
||
|
},
|
||
|
handleInput_new: function (e) {
|
||
|
var value = e.detail.value;
|
||
|
this.setData({
|
||
|
buildingName: value,
|
||
|
isShowHouseList: true,
|
||
|
});
|
||
|
},
|
||
|
identityCodeValid: function (idcode) {
|
||
|
return /^(\d{15}$)|(^\d{17}([0-9]|X)$)|(^[a-zA-Z]{2}\d{7}$|^[a-zA-Z]{1}\d{8}$)/.test(idcode);
|
||
|
},
|
||
|
handleCancle_new: function () {
|
||
|
this.setData({
|
||
|
buildingName: "",
|
||
|
});
|
||
|
this.resetGridList();
|
||
|
this.getList();
|
||
|
},
|
||
|
handleItem: function (e) {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var index, gridList, item, _a, msg, _b, code, data;
|
||
|
return __generator(this, function (_c) {
|
||
|
switch (_c.label) {
|
||
|
case 0:
|
||
|
console.log("eeee----", e.currentTarget.dataset.index);
|
||
|
index = e.currentTarget.dataset.index;
|
||
|
gridList = this.data.gridList;
|
||
|
item = gridList[index];
|
||
|
if (item.showItem) {
|
||
|
item.showItem = false;
|
||
|
this.setData({
|
||
|
gridList: gridList,
|
||
|
});
|
||
|
return [2];
|
||
|
}
|
||
|
return [4, promise_wx_api_1.wxRequestPost("gov/org/icneighborhood/open/list", {
|
||
|
gridId: item.gridId,
|
||
|
}, {
|
||
|
isQuiet: false,
|
||
|
})];
|
||
|
case 1:
|
||
|
_a = _c.sent(), msg = _a.msg, _b = _a.data.data, code = _b.code, data = _b.data;
|
||
|
wx.hideLoading();
|
||
|
if (msg === "success" && code === 0) {
|
||
|
console.log("data----", data);
|
||
|
if (data.total > 0) {
|
||
|
item.showItem = true;
|
||
|
item.village = data.list.map(function (n) { return n.neighborHoodName; }).join("、");
|
||
|
this.setData({
|
||
|
gridList: gridList,
|
||
|
});
|
||
|
}
|
||
|
else {
|
||
|
wx.showToast({
|
||
|
title: "还没有小区哦",
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
wx.showToast({
|
||
|
title: msg,
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
handleSearch: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var url, extAppid, _a, msg, _b, code, data, gridList;
|
||
|
return __generator(this, function (_c) {
|
||
|
switch (_c.label) {
|
||
|
case 0:
|
||
|
if (!this.data.idCard) {
|
||
|
wx.showToast({
|
||
|
title: "请输入证件号",
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
return [2];
|
||
|
}
|
||
|
url = "epmetuser/icresiuser/icUserMatchGrid";
|
||
|
extAppid = wx.getStorageSync("extAppid");
|
||
|
wx.showLoading({ title: "" });
|
||
|
return [4, promise_wx_api_1.wxRequestPost(url, {
|
||
|
appId: extAppid,
|
||
|
idCard: this.data.idCard,
|
||
|
}, {
|
||
|
isQuiet: false,
|
||
|
})];
|
||
|
case 1:
|
||
|
_a = _c.sent(), msg = _a.msg, _b = _a.data.data, code = _b.code, data = _b.data;
|
||
|
wx.hideLoading();
|
||
|
if (msg === "success" && code === 0) {
|
||
|
this.resetGridList();
|
||
|
gridList = this.data.gridList;
|
||
|
gridList = [];
|
||
|
gridList.push(__assign(__assign({}, data), { showItem: false }));
|
||
|
this.setData({
|
||
|
gridList: gridList,
|
||
|
});
|
||
|
console.log("data-sssss", data);
|
||
|
}
|
||
|
else {
|
||
|
wx.showToast({
|
||
|
title: msg,
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
handleFocus: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
return __generator(this, function (_a) {
|
||
|
this.setData({
|
||
|
isShowHouseList: true,
|
||
|
});
|
||
|
this.getList();
|
||
|
return [2];
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
getList: function () {
|
||
|
var isShowHouseList = this.data.isShowHouseList;
|
||
|
if (isShowHouseList) {
|
||
|
this.getNeighborhoodlist();
|
||
|
}
|
||
|
else {
|
||
|
this.getGridList();
|
||
|
}
|
||
|
},
|
||
|
resetGridList: function () {
|
||
|
this.setData({
|
||
|
"params.pageNo": 1,
|
||
|
"params.isNone": false,
|
||
|
});
|
||
|
},
|
||
|
getNeighborhoodlist: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var url, _a, msg, _b, code, data, gridList, _data;
|
||
|
return __generator(this, function (_c) {
|
||
|
switch (_c.label) {
|
||
|
case 0:
|
||
|
url = "gov/org/icneighborhood/neighborhoodlist";
|
||
|
return [4, promise_wx_api_1.wxRequestPost(url, {
|
||
|
buildingName: this.data.buildingName,
|
||
|
}, {
|
||
|
isQuiet: false,
|
||
|
})];
|
||
|
case 1:
|
||
|
_a = _c.sent(), msg = _a.msg, _b = _a.data.data, code = _b.code, data = _b.data;
|
||
|
if (msg === "success" && code === 0) {
|
||
|
this.resetGridList();
|
||
|
gridList = this.data.gridList;
|
||
|
gridList = [];
|
||
|
_data = data &&
|
||
|
data.map(function (item) {
|
||
|
return __assign(__assign({}, item), { showItem: false });
|
||
|
});
|
||
|
gridList = _data;
|
||
|
this.setData({
|
||
|
gridList: gridList,
|
||
|
});
|
||
|
}
|
||
|
else {
|
||
|
wx.showToast({
|
||
|
title: msg,
|
||
|
icon: "none",
|
||
|
duration: 1500,
|
||
|
});
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
getGridList: function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var params, extAppid, url, _a, msg, _b, code, data, gridList, _data;
|
||
|
return __generator(this, function (_c) {
|
||
|
switch (_c.label) {
|
||
|
case 0:
|
||
|
params = this.data.params;
|
||
|
if (params.isNone)
|
||
|
return [2, console.log("没有更多了")];
|
||
|
extAppid = wx.getStorageSync("extAppid");
|
||
|
url = extAppid
|
||
|
? "resi/guide/stranger/publiclocationgridlist"
|
||
|
: "resi/guide/stranger/getlocationcustomergridlist";
|
||
|
wx.showLoading({ title: "" });
|
||
|
return [4, promise_wx_api_1.wxRequestPost(url, __assign(__assign({}, params), { appId: extAppid, isNovice: this.data.isNovice }), {
|
||
|
isQuiet: false,
|
||
|
})];
|
||
|
case 1:
|
||
|
_a = _c.sent(), msg = _a.msg, _b = _a.data.data, code = _b.code, data = _b.data;
|
||
|
wx.hideLoading();
|
||
|
if (msg === "success" && code === 0) {
|
||
|
gridList = this.data.gridList;
|
||
|
_data = data &&
|
||
|
data.map(function (item) {
|
||
|
return __assign(__assign({}, item), { showItem: false });
|
||
|
});
|
||
|
if (params.pageNo == 1) {
|
||
|
gridList = _data;
|
||
|
}
|
||
|
else {
|
||
|
gridList.push.apply(gridList, _data);
|
||
|
}
|
||
|
this.setData({
|
||
|
gridList: gridList,
|
||
|
hasChose: true,
|
||
|
"params.pageNo": params.pageNo + 1,
|
||
|
"params.isNone": data.length < params.pageSize,
|
||
|
});
|
||
|
return [2, false];
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
loginGrid: function (e) {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var gid, cid;
|
||
|
return __generator(this, function (_a) {
|
||
|
switch (_a.label) {
|
||
|
case 0:
|
||
|
gid = e.currentTarget.dataset.gid;
|
||
|
cid = e.currentTarget.dataset.cid;
|
||
|
app.globalData.customerId = cid;
|
||
|
app.globalData.gridId = gid;
|
||
|
wx.showLoading({ title: "" });
|
||
|
return [4, app.enterGridData()];
|
||
|
case 1:
|
||
|
_a.sent();
|
||
|
wx.hideLoading();
|
||
|
app.setAccountInfo({ isLogined: true });
|
||
|
if (wx.getStorageSync("isFromQr") &&
|
||
|
wx.getStorageSync("isFromQr") == "1") {
|
||
|
wx.reLaunch({
|
||
|
url: "/subpages/points/pages/fangyi/xinxi/create/index",
|
||
|
});
|
||
|
wx.removeStorageSync("isFromQr");
|
||
|
}
|
||
|
else {
|
||
|
wx.reLaunch({
|
||
|
url: "/pages/main/index",
|
||
|
});
|
||
|
}
|
||
|
return [2];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
});
|