"use strict"; const common_vendor = require("../../common/vendor.js"); const pages_supplierindex_api = require("./api.js"); if (!Array) { const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup"); _easycom_u_popup2(); } const _easycom_u_popup = () => "../../uni_modules/vk-uview-ui/components/u-popup/u-popup.js"; if (!Math) { _easycom_u_popup(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "searchjigou", setup(__props) { common_vendor.onShow(() => { search(); }); common_vendor.onReachBottom(() => { nextPage(); }); const hulijigouArray = common_vendor.ref([]); const hulitarget = common_vendor.ref(-1); const popupshow = common_vendor.ref(false); const supervalue = common_vendor.ref(""); const jumpRuzhu = () => { popupshow.value = false; common_vendor.index.navigateTo({ url: "/pages/supplierindex/workjoin" }); }; let inputTimer = null; const detectinput = () => { if (inputTimer) clearTimeout(inputTimer); inputTimer = setTimeout(() => { inputTimer = null; search(); }, 600); }; common_vendor.onUnmounted(() => { if (inputTimer) clearTimeout(inputTimer); }); const buttonOpen = common_vendor.ref(false); const clickCard = (index) => { if (hulitarget.value === index) { hulitarget.value = -1; buttonOpen.value = false; } else { hulitarget.value = index; if (hulijigouArray.value[index].suppliersStatus == null || hulijigouArray.value[index].suppliersStatus == `3`) { buttonOpen.value = true; } else { buttonOpen.value = false; } } }; const clearvalue = () => { hulitarget.value = -1; supervalue.value = ""; search(); }; const goBack = () => { common_vendor.index.navigateBack(); }; const pageNo = common_vendor.ref(1); const search = () => { pageNo.value = 1; canpull.value = true; buttonOpen.value = false; hulitarget.value = -1; let data = { title: supervalue.value, pageNo: pageNo.value }; pages_supplierindex_api.getApplySuppliersOrgInfo(data).then((res) => { if (res.success) { hulijigouArray.value = res.result.records; if (res.result.records.length !== 5) { canpull.value = false; } } }); }; const canpull = common_vendor.ref(true); const nextPage = () => { if (canpull.value) { pageNo.value++; let data = { title: supervalue.value, pageNo: pageNo.value }; pages_supplierindex_api.getApplySuppliersOrgInfo(data).then((res) => { if (res.success) { hulijigouArray.value.push(...res.result.records); } }); } }; const sumbit = common_vendor.ref(false); const apply = () => { if (sumbit.value) { return; } sumbit.value = true; pages_supplierindex_api.getSupInfoByOpenId().then((res) => { if (res.result === null) { common_vendor.index.setStorageSync("nostaffmessage", hulijigouArray.value[hulitarget.value].orgCode); common_vendor.index.setStorageSync("specicalid", ""); common_vendor.index.setStorageSync("baddata", ""); common_vendor.index.setStorageSync("backhuancun", {}); common_vendor.index.navigateTo({ url: `/pages/addsupplier/information` }); } else { let data = { orgCode: hulijigouArray.value[hulitarget.value].orgCode, openId: common_vendor.index.getStorageSync("openid") }; pages_supplierindex_api.applySupOrg(data).then((data2) => { if (data2.success) { common_vendor.index.requestSubscribeMessage({ // 这里填后台申请好的 templateId 数组 tmplIds: ["cWVzXm1C-iitx1gNFn1nZdijq9R_3fCv8vLbiqs9zww"], success: (res2) => { popupshow.value = true; setTimeout(() => search(), 1e3); }, fail: (err) => { common_vendor.index.__f__("error", "at pages/supplierindex/searchjigou.vue:282", "订阅接口调用失败:", err); common_vendor.index.showToast({ title: "订阅失败", icon: "none" }); } }); } setTimeout(() => sumbit.value = false, 1e3); }); } }); }; return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.o(goBack), b: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`, c: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`, d: common_vendor.o(search), e: common_vendor.o([($event) => supervalue.value = $event.detail.value, detectinput]), f: supervalue.value, g: supervalue.value }, supervalue.value ? { h: common_vendor.o(clearvalue) } : {}, { i: common_vendor.o(search), j: common_vendor.f(hulijigouArray.value, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t(item.departName), b: common_vendor.t(item.orgLeader), c: common_vendor.t(item.orgLeaderPhone), d: item.suppliersStatus === `1` }, item.suppliersStatus === `1` ? {} : {}, { e: item.suppliersStatus === `2` }, item.suppliersStatus === `2` ? {} : {}, { f: item.suppliersStatus === `3` }, item.suppliersStatus === `3` ? {} : {}, { g: common_vendor.t(item.orgAddress), h: index, i: common_vendor.s(hulitarget.value === index ? { border: `4rpx solid #0093FF` } : {}), j: common_vendor.o(($event) => clickCard(index), index) }); }), k: buttonOpen.value }, buttonOpen.value ? { l: common_vendor.o(apply) } : {}, { m: common_vendor.o(($event) => jumpRuzhu()), n: common_vendor.o(($event) => popupshow.value = $event), o: common_vendor.p({ mode: "bottom", ["border-radius"]: "40", modelValue: popupshow.value }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e5e79ae1"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/supplierindex/searchjigou.js.map