接口

parent 571bbf6c
import { request } from '../utils/request';
// 分类
// 店铺信息
export function getStoreInformation(data) {
return request({
url: `/sgyrdd/shop/getById?shopId=${data}`,
method: 'GET',
});
}
// 店铺信息
export function groupBuyList(data) {
return request({
url: `/sgyrdd/prod/groupBuyList?shopId=${data}`,
method: 'GET',
});
}
// 商家评论列表分页
export function getEvaluationPage(data) {
return request({
url: `/sgyrdd/evaluation/page`,
method: 'GET',
data,
});
}
// 获取商家优惠券
export function couponShopList(data) {
return request({
url: `/sgyrdd/coupon/couponShopList/${data}`,
method: 'GET',
});
}
This diff is collapsed.
// 根据经纬度计算距离,参数分别为第一点的纬度、经度;第二点的纬度、经度
export function getDistance(lat1, lng1, lat2, lng2) {
const R = 6371; // 地球半径,单位为千米
const dLat = deg2rad(lat2 - lat1);
const dLng = deg2rad(lng2 - lng1);
const a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c;
if (distance >= 1) {
return distance.toFixed(2) + '千米';
} else {
return (distance * 1000).toFixed(2) + '米';
}
}
// 将角度转换为弧度
function deg2rad(deg) {
return deg * (Math.PI / 180);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment