32 lines
1008 B
JavaScript
32 lines
1008 B
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../common/vendor.js");
|
||
|
const utils_http = require("../utils/http.js");
|
||
|
function getNearbyServices(latitude, longitude, options = {}) {
|
||
|
const query = {
|
||
|
latitude,
|
||
|
longitude,
|
||
|
serviceName: options.serviceName,
|
||
|
minPrice: options.minPrice,
|
||
|
maxPrice: options.maxPrice,
|
||
|
priceOrder: options.priceOrder,
|
||
|
distanceOrder: options.distanceOrder,
|
||
|
current: options.current || 1,
|
||
|
size: options.size || 10
|
||
|
};
|
||
|
return utils_http.httpGet("/personal-service/referralServices", query).then((response) => {
|
||
|
if (response.code === 200) {
|
||
|
return response.records;
|
||
|
} else {
|
||
|
return Promise.reject(response.message || "获取服务列表失败");
|
||
|
}
|
||
|
}).catch((error) => {
|
||
|
console.error("请求失败:", error);
|
||
|
common_vendor.index.showToast({
|
||
|
icon: "none",
|
||
|
title: "获取服务列表失败,请稍后重试"
|
||
|
});
|
||
|
return Promise.reject(error);
|
||
|
});
|
||
|
}
|
||
|
exports.getNearbyServices = getNearbyServices;
|