Files
ShaFaFanXin/前端/unpackage/dist/dev/mp-weixin/api/index.js

102 lines
3.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const utils_request = require("../utils/request.js");
const getBanners = () => {
return Promise.resolve(new UTSJSONObject({
code: 0,
message: "success",
data: [
new UTSJSONObject({
id: "1",
image: "/static/mock/banner1.svg",
title: "专业沙发翻新服务",
link: "/pages/service/index"
}),
new UTSJSONObject({
id: "2",
image: "/static/mock/banner2.svg",
title: "十年品质保证",
link: "/pages/about/index"
}),
new UTSJSONObject({
id: "3",
image: "/static/mock/banner3.svg",
title: "免费上门评估",
link: "/pages/booking/index"
})
]
}));
};
const getCaseList = (params = null) => {
const queryParams = new UTSJSONObject(
{
page: params ? params["page"] || 1 : 1,
limit: params ? params["pageSize"] || params["limit"] || 10 : 10,
status: "published"
// 只获取已发布的案例
}
// 如果有分类且不是all则添加serviceType参数
);
if (params && params["category"] && params["category"] != "all") {
queryParams["serviceType"] = params["category"];
}
return utils_request.get("/cases", queryParams);
};
const getCaseDetail = (id) => {
return utils_request.get(`/cases/${id}`);
};
const getHotCases = () => {
return utils_request.get("/cases", new UTSJSONObject({ limit: 4, status: "published" }));
};
const getActiveServices = () => {
return utils_request.get("/services/active");
};
const getCompanyInfo = () => {
return Promise.resolve(new UTSJSONObject({
code: 0,
message: "success",
data: new UTSJSONObject({
name: "优艺家沙发翻新",
slogan: "让旧沙发焕发新生",
description: "优艺家专注沙发翻新服务10余年拥有专业的技术团队和丰富的经验。我们提供各类沙发翻新、维修、清洁服务让您的旧沙发重新焕发光彩。",
phone: "400-888-8888",
wechat: "youyijia2024",
address: "北京市朝阳区XX路XX号",
workTime: "周一至周日 9:00-18:00",
features: [
new UTSJSONObject({ title: "专业团队", desc: "10年以上经验的专业师傅" }),
new UTSJSONObject({ title: "品质保证", desc: "使用优质材料,质保一年" }),
new UTSJSONObject({ title: "免费上门", desc: "免费上门测量和评估" }),
new UTSJSONObject({ title: "快速交付", desc: "3-7天完成翻新服务" })
]
})
}));
};
const submitBooking = (data) => {
return utils_request.post("/booking", data);
};
const getMyBookings = (params = null) => {
const queryParams = params ? new UTSJSONObject({
page: params["page"] || 1,
limit: params["limit"] || 10,
status: params["status"]
}) : new UTSJSONObject({});
return utils_request.get("/booking/my", queryParams);
};
const cancelBooking = (id) => {
return utils_request.post(`/booking/${id}/cancel`, new UTSJSONObject({}));
};
const wechatLogin = (code) => {
return utils_request.post("/auth/wechat/login", new UTSJSONObject({ code }));
};
exports.cancelBooking = cancelBooking;
exports.getActiveServices = getActiveServices;
exports.getBanners = getBanners;
exports.getCaseDetail = getCaseDetail;
exports.getCaseList = getCaseList;
exports.getCompanyInfo = getCompanyInfo;
exports.getHotCases = getHotCases;
exports.getMyBookings = getMyBookings;
exports.submitBooking = submitBooking;
exports.wechatLogin = wechatLogin;
//# sourceMappingURL=../../.sourcemap/mp-weixin/api/index.js.map