166 lines
5.8 KiB
JavaScript
166 lines
5.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const api_api = require("../../api/api.js");
|
|
const hooks_useNav = require("../../hooks/useNav.js");
|
|
if (!Array) {
|
|
const _easycom_search2 = common_vendor.resolveComponent("search");
|
|
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
|
|
const _easycom_orderList2 = common_vendor.resolveComponent("orderList");
|
|
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
|
|
const _easycom_cc_myTabbar2 = common_vendor.resolveComponent("cc-myTabbar");
|
|
(_easycom_search2 + _easycom_up_swiper2 + _easycom_orderList2 + _easycom_z_paging2 + _easycom_cc_myTabbar2)();
|
|
}
|
|
const _easycom_search = () => "../../components/search/search.js";
|
|
const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
|
|
const _easycom_orderList = () => "../../components/orderList/orderList.js";
|
|
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
|
|
const _easycom_cc_myTabbar = () => "../../uni_modules/cc-myTabbar/components/cc-myTabbar/cc-myTabbar.js";
|
|
if (!Math) {
|
|
(_easycom_search + _easycom_up_swiper + _easycom_orderList + _easycom_z_paging + _easycom_cc_myTabbar)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "home",
|
|
setup(__props) {
|
|
const { nav, navTo } = hooks_useNav.useNav();
|
|
const dataList = common_vendor.ref([]);
|
|
const paging = common_vendor.ref(null);
|
|
const query = common_vendor.reactive({
|
|
lon: "",
|
|
lat: "",
|
|
orderByType: 1,
|
|
//1-最近;2-空闲较多
|
|
keyWord: ""
|
|
});
|
|
const list1 = common_vendor.ref([]);
|
|
common_vendor.onLoad(async () => {
|
|
let _res = await api_api.bannerList();
|
|
list1.value = _res;
|
|
});
|
|
common_vendor.onShow(() => {
|
|
common_vendor.index.hideTabBar();
|
|
});
|
|
let toKft = (e) => {
|
|
common_vendor.index.makePhoneCall({
|
|
phoneNumber: "4008005326"
|
|
//仅为示例
|
|
});
|
|
};
|
|
const queryList = async () => {
|
|
common_vendor.index.showLoading({
|
|
title: "加载中..."
|
|
});
|
|
try {
|
|
if (!query.lon && !query.lat) {
|
|
const { longitude: lon, latitude: lat } = await common_vendor.index.getLocation();
|
|
query.lon = lon;
|
|
query.lat = lat;
|
|
}
|
|
} catch (err) {
|
|
common_vendor.index.__f__("log", "at pages/home/home.vue:116", err);
|
|
}
|
|
common_vendor.index.__f__("log", "at pages/home/home.vue:118", query);
|
|
api_api.aroundAreaApi(query).then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/home/home.vue:121", res, "list");
|
|
paging.value.complete(res);
|
|
common_vendor.index.hideLoading();
|
|
}).catch((res) => {
|
|
paging.value.complete(false);
|
|
common_vendor.index.hideLoading();
|
|
});
|
|
};
|
|
let tabChange = (e) => {
|
|
query.orderByType = e;
|
|
paging.value.reload();
|
|
};
|
|
let isPagingRefNotFound = () => {
|
|
return !paging.value;
|
|
};
|
|
common_vendor.onPullDownRefresh(() => {
|
|
if (isPagingRefNotFound())
|
|
return;
|
|
paging.value.reload().catch(() => {
|
|
});
|
|
});
|
|
common_vendor.onPageScroll((e) => {
|
|
if (isPagingRefNotFound())
|
|
return;
|
|
paging.value.updatePageScrollTop(e.scrollTop);
|
|
e.scrollTop < 10 && paging.value.doChatRecordLoadMore();
|
|
});
|
|
common_vendor.onReachBottom(() => {
|
|
if (isPagingRefNotFound())
|
|
return;
|
|
paging.value.pageReachBottom();
|
|
});
|
|
const toOrder = () => {
|
|
common_vendor.index.switchTab({
|
|
url: "/pages/order/order"
|
|
});
|
|
};
|
|
let searchChange = (e) => {
|
|
query.keyWord = e;
|
|
paging.value.reload();
|
|
};
|
|
let showMode = () => {
|
|
common_vendor.index.showModal({
|
|
title: "提示",
|
|
content: "暂未开放",
|
|
showCancel: false,
|
|
confirmText: "确认",
|
|
success: () => {
|
|
}
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.o(common_vendor.unref(searchChange)),
|
|
b: common_vendor.p({
|
|
list: list1.value,
|
|
height: "150rpx",
|
|
keyName: "imageUrl",
|
|
indicator: true
|
|
}),
|
|
c: common_assets._imports_0,
|
|
d: common_vendor.o(toOrder),
|
|
e: common_assets._imports_1,
|
|
f: common_vendor.o((...args) => common_vendor.unref(showMode) && common_vendor.unref(showMode)(...args)),
|
|
g: common_assets._imports_2,
|
|
h: common_vendor.o(($event) => common_vendor.unref(navTo)("/pageMake/invoice/invoice")),
|
|
i: common_assets._imports_3,
|
|
j: common_vendor.o((...args) => common_vendor.unref(toKft) && common_vendor.unref(toKft)(...args)),
|
|
k: common_vendor.n(query.orderByType == 1 ? "order_list_active" : ""),
|
|
l: common_vendor.o(($event) => common_vendor.unref(tabChange)(1)),
|
|
m: common_vendor.n(query.orderByType == 2 ? "order_list_active" : ""),
|
|
n: common_vendor.o(($event) => common_vendor.unref(tabChange)(2)),
|
|
o: common_vendor.f(dataList.value, (item, index, i0) => {
|
|
return {
|
|
a: "07e72d3c-3-" + i0 + ",07e72d3c-2",
|
|
b: common_vendor.p({
|
|
toNav: true,
|
|
info: item
|
|
}),
|
|
c: index
|
|
};
|
|
}),
|
|
p: common_vendor.sr(paging, "07e72d3c-2", {
|
|
"k": "paging"
|
|
}),
|
|
q: common_vendor.o(queryList),
|
|
r: common_vendor.o(($event) => dataList.value = $event),
|
|
s: common_vendor.p({
|
|
["use-page-scroll"]: true,
|
|
modelValue: dataList.value
|
|
}),
|
|
t: common_vendor.p({
|
|
tabBarShow: 0
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-07e72d3c"]]);
|
|
_sfc_main.__runtimeHooks = 1;
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/home/home.js.map
|