acdr-ui/dist/dev/mp-weixin/pages/index/components/recommendedServices.js

82 lines
2.9 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const common_vendor = require("../../../common/vendor.js");
const utils_commUtils = require("../../../utils/commUtils.js");
const service_personalService = require("../../../service/personalService.js");
const service_mapService = require("../../../service/mapService.js");
if (!Math) {
(RecommendedServiceCard + LocalLoader + EmptyState)();
}
const RecommendedServiceCard = () => "../../../components/RecommendedServiceCard.js";
const EmptyState = () => "../../../components/EmptyState.js";
const LocalLoader = () => "../../../components/LocalLoader.js";
const _sfc_main = {
__name: "recommendedServices",
setup(__props) {
const toDetail = (item) => {
common_vendor.index.navigateTo({
url: "/pages/service/detail?id=" + item.id
});
};
const loading = common_vendor.ref(false);
const services = common_vendor.ref([]);
const getQuickServices = () => __async(this, null, function* () {
const location = yield service_mapService.getLocation();
const nearbys = yield service_personalService.getNearbyServices(location.latitude, location.longitude);
services.value = nearbys;
});
common_vendor.onLoad(() => __async(this, null, function* () {
loading.value = true;
yield getQuickServices();
loading.value = false;
}));
return (_ctx, _cache) => {
return common_vendor.e({
a: services.value.length > 0
}, services.value.length > 0 ? {
b: common_vendor.f(services.value, (item, index, i0) => {
return {
a: "bdee1576-0-" + i0,
b: common_vendor.p({
image: common_vendor.unref(utils_commUtils.imgUrl)(item.url),
title: item.serviceName,
description: item.description,
price: item.price
}),
c: common_vendor.o(($event) => toDetail(item), index),
d: index
};
})
} : {}, {
c: common_vendor.o(($event) => loading.value = $event),
d: common_vendor.p({
modelValue: loading.value
}),
e: services.value.length == 0 && !loading.value
}, services.value.length == 0 && !loading.value ? {} : {});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bdee1576"]]);
wx.createComponent(Component);
//# sourceMappingURL=recommendedServices.js.map