"use strict"; const common_vendor = require("../../common/vendor.js"); const pages_addjigou_api_addjigou = require("./api/addjigou.js"); if (!Array) { const _easycom_u_modal2 = common_vendor.resolveComponent("u-modal"); const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup"); (_easycom_u_modal2 + _easycom_u_popup2)(); } const _easycom_u_modal = () => "../../uni_modules/vk-uview-ui/components/u-modal/u-modal.js"; const _easycom_u_popup = () => "../../uni_modules/vk-uview-ui/components/u-popup/u-popup.js"; if (!Math) { (_easycom_u_modal + _easycom_u_popup)(); } const _sfc_main = { __name: "where", setup(__props) { const address = common_vendor.ref([]); const show = common_vendor.ref(false); const content = common_vendor.ref(""); const jigouweizhi = common_vendor.ref(""); common_vendor.ref(false); const popupshow = common_vendor.ref(false); const list = common_vendor.ref([]); const form = common_vendor.reactive({ orgLeader: "", orgLeaderPhone: "", orgAddress: "", orgPropertyType: "", orgBuildingArea: "", orgAddress: "", orgCoordinateLo: "", orgCoordinateLa: "", id: common_vendor.index.getStorageSync("specicalid") || "", tel: common_vendor.index.getStorageSync("tel"), status: "1" }); common_vendor.ref(""); common_vendor.ref(""); common_vendor.ref(""); function takeFirst(arr, num) { const count = Math.max(0, Math.min(num, arr.length)); return arr.slice(0, count); } const deleteUP = (index) => { address.value = takeFirst(address.value, index); if (index) { clickcard(list.value[index - 1]); } else { list.value = []; pages_addjigou_api_addjigou.getdate(`xzqhdm`).then((res) => { list.value = dedupeFirstLetter(res.result); }); } common_vendor.index.__f__("log", "at pages/addjigou/where.vue:178", "删除了", index); }; const next = () => { const allNonEmpty = form.orgLeader && form.orgLeaderPhone && form.orgAddress && form.orgPropertyType && form.orgBuildingArea; if (allNonEmpty) { pages_addjigou_api_addjigou.changemessage(form).then((res) => { if (res.success) { if (res.message == `保存成功!`) { common_vendor.index.setStorageSync("specicalid", ""); common_vendor.index.reLaunch({ url: `/pages/login/workjoin?type=1` }); } else { common_vendor.index.setStorageSync("specicalid", res.result.id); common_vendor.index.reLaunch({ url: `/pages/login/workjoin?type=1` }); } } else { common_vendor.index.showToast({ title: res.message, icon: "error" }); } }); } else { common_vendor.index.showToast({ title: "请完善信息", icon: "error" }); } }; const goBack = () => { common_vendor.index.navigateBack(); }; const clickcard = (element) => { if (address.value.length < 3) { list.value = []; address.value.push(element); pages_addjigou_api_addjigou.getdate(element.id).then((res) => { if (res.result.length) { list.value = dedupeFirstLetter(res.result); } else { popupshow.value = false; form.address = ""; address.value.forEach((res2) => { form.address += res2.name; }); const keys = ["orgProvince", "orgCity", "orgDistrict"]; keys.forEach((key, idx) => { var _a, _b; form[key] = ((_a = address.value[idx]) == null ? void 0 : _a.id) ? (_b = address.value[idx]) == null ? void 0 : _b.id : ""; }); address.value = []; list.value = []; pages_addjigou_api_addjigou.getdate(`xzqhdm`).then((res2) => { list.value = dedupeFirstLetter(res2.result); }); } }); } }; const openpopupshow = () => { popupshow.value = true; }; common_vendor.onShow(() => { const data = common_vendor.index.getStorageSync("dingwei"); if (data) { common_vendor.index.__f__("log", "at pages/addjigou/where.vue:261", "data", data); jigouweizhi.value = data.name; form.orgAddress = data.name; form.orgCoordinateLo = data.lng; form.orgCoordinateLa = data.lat; common_vendor.index.removeStorageSync("dingwei"); } }); function dedupeFirstLetter(arr) { const seen = /* @__PURE__ */ new Set(); return arr.map((item) => { const letter = item.firstLetter; if (!letter || seen.has(letter)) { return { ...item, firstLetter: "" }; } else { seen.add(letter); return item; } }); } common_vendor.onLoad(() => { pages_addjigou_api_addjigou.getdate(`xzqhdm`).then((res) => { list.value = dedupeFirstLetter(res.result); }); if (common_vendor.index.getStorageSync("baddata")) { let data = common_vendor.index.getStorageSync("baddata"); if (data.orgProvince_dictText) { form.address = data.orgProvince_dictText + data.orgCity_dictText + data.orgDistrict_dictText; } form.orgProvince = data.orgProvince; form.orgCity = data.orgCity; form.orgDistrict = data.orgDistrict; form.orgAddress = data.orgAddress; form.orgLeader = data.orgLeader; form.orgLeaderPhone = data.orgLeaderPhone; form.orgPropertyType = data.orgPropertyType; form.orgBuildingArea = data.orgBuildingArea; } }); return (_ctx, _cache) => { return { a: common_vendor.o(($event) => show.value = $event), b: common_vendor.p({ content: content.value, modelValue: show.value }), c: common_vendor.o(($event) => popupshow.value = false), d: common_vendor.f(address.value, (item, index, i0) => { return { a: common_vendor.t(item.name), b: common_vendor.o(($event) => deleteUP(index)) }; }), e: common_vendor.f(address.value, (item, k0, i0) => { return {}; }), f: common_vendor.f(list.value, (item, index, i0) => { return { a: common_vendor.t(item.firstLetter), b: common_vendor.t(item.name), c: index, d: common_vendor.o(($event) => clickcard(item), index) }; }), g: common_vendor.o(($event) => popupshow.value = $event), h: common_vendor.p({ mode: "bottom", ["border-radius"]: "20", height: "600px", modelValue: popupshow.value }), i: form.address, j: common_vendor.o(($event) => form.address = $event.detail.value), k: common_vendor.o(openpopupshow), l: form.orgAddress, m: common_vendor.o(($event) => form.orgAddress = $event.detail.value), n: form.orgLeader, o: common_vendor.o(($event) => form.orgLeader = $event.detail.value), p: form.orgLeaderPhone, q: common_vendor.o(($event) => form.orgLeaderPhone = $event.detail.value), r: form.orgPropertyType, s: common_vendor.o(($event) => form.orgPropertyType = $event.detail.value), t: form.orgBuildingArea, v: common_vendor.o(($event) => form.orgBuildingArea = $event.detail.value), w: common_vendor.o(goBack), x: common_vendor.o(next) }; }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-549d1cee"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/addjigou/where.js.map