feat:"完成页面接口的对接"
This commit is contained in:
@@ -15,10 +15,12 @@ class ServiceType extends UTS.UTSType {
|
||||
kind: 2,
|
||||
get fields() {
|
||||
return {
|
||||
id: { type: String, optional: false },
|
||||
id: { type: Number, optional: false },
|
||||
name: { type: String, optional: false },
|
||||
desc: { type: String, optional: false },
|
||||
emoji: { type: String, optional: false }
|
||||
emoji: { type: String, optional: false },
|
||||
type: { type: String, optional: false },
|
||||
basePrice: { type: Number, optional: false }
|
||||
};
|
||||
},
|
||||
name: "ServiceType"
|
||||
@@ -31,6 +33,8 @@ class ServiceType extends UTS.UTSType {
|
||||
this.name = this.__props__.name;
|
||||
this.desc = this.__props__.desc;
|
||||
this.emoji = this.__props__.emoji;
|
||||
this.type = this.__props__.type;
|
||||
this.basePrice = this.__props__.basePrice;
|
||||
delete this.__props__;
|
||||
}
|
||||
}
|
||||
@@ -108,13 +112,14 @@ class FaqItem extends UTS.UTSType {
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
__name: "index",
|
||||
setup(__props) {
|
||||
const serviceTypes = common_vendor.ref([
|
||||
new ServiceType({ id: "repair", name: "局部修复", desc: "破损、划痕修复", emoji: "🔧" }),
|
||||
new ServiceType({ id: "recolor", name: "改色翻新", desc: "皮面改色换新", emoji: "🎨" }),
|
||||
new ServiceType({ id: "refurbish", name: "整体翻新", desc: "全面翻新升级", emoji: "✨" }),
|
||||
new ServiceType({ id: "custom", name: "定制换皮", desc: "个性化定制", emoji: "💎" })
|
||||
const serviceTypes = common_vendor.ref([]);
|
||||
const processList = common_vendor.ref([
|
||||
new ProcessItem({ step: 1, title: "在线预约", description: "填写信息,预约上门时间" }),
|
||||
new ProcessItem({ step: 2, title: "上门评估", description: "专业师傅免费上门勘察" }),
|
||||
new ProcessItem({ step: 3, title: "确认方案", description: "沟通翻新方案和价格" }),
|
||||
new ProcessItem({ step: 4, title: "取件翻新", description: "取回沙发进行专业翻新" }),
|
||||
new ProcessItem({ step: 5, title: "送货验收", description: "送货上门,满意付款" })
|
||||
]);
|
||||
const processList = common_vendor.ref([]);
|
||||
const materials = common_vendor.ref([
|
||||
new MaterialItem({
|
||||
name: "头层牛皮",
|
||||
@@ -168,23 +173,41 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
expanded: false
|
||||
})
|
||||
]);
|
||||
const fetchServiceProcess = () => {
|
||||
const fetchServices = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getServiceProcess();
|
||||
const data = res.data;
|
||||
processList.value = data.map((item) => {
|
||||
return new ProcessItem({
|
||||
step: item["step"],
|
||||
title: item["title"],
|
||||
description: item["description"]
|
||||
const res = yield api_index.getActiveServices();
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const list = data["list"] || [];
|
||||
const emojiMap = new UTSJSONObject({
|
||||
fabric: "🛋️",
|
||||
leather: "💺",
|
||||
cleaning: "✨",
|
||||
repair: "🔧",
|
||||
custom: "💎"
|
||||
});
|
||||
});
|
||||
serviceTypes.value = list.map((item) => {
|
||||
const type = item["type"];
|
||||
return new ServiceType({
|
||||
id: item["id"],
|
||||
name: item["name"],
|
||||
desc: item["description"],
|
||||
emoji: emojiMap[type] || "🛋️",
|
||||
type,
|
||||
basePrice: item["basePrice"]
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/service/index.uvue:217", "获取服务流程失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/service/index.uvue:237", "获取服务列表失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
const fetchServiceProcess = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
});
|
||||
};
|
||||
const toggleFaq = (index) => {
|
||||
faqList.value[index].expanded = !faqList.value[index].expanded;
|
||||
};
|
||||
@@ -199,6 +222,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad(() => {
|
||||
fetchServices();
|
||||
fetchServiceProcess();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
|
||||
Reference in New Issue
Block a user