301 lines
10 KiB
JavaScript
301 lines
10 KiB
JavaScript
"use strict";
|
||
const common_vendor = require("../../common/vendor.js");
|
||
const api_index = require("../../api/index.js");
|
||
if (!Array) {
|
||
const _easycom_section_header_1 = common_vendor.resolveComponent("section-header");
|
||
_easycom_section_header_1();
|
||
}
|
||
const _easycom_section_header = () => "../../components/section-header/section-header.js";
|
||
if (!Math) {
|
||
_easycom_section_header();
|
||
}
|
||
class ServiceType extends UTS.UTSType {
|
||
static get$UTSMetadata$() {
|
||
return {
|
||
kind: 2,
|
||
get fields() {
|
||
return {
|
||
id: { type: Number, optional: false },
|
||
name: { type: String, optional: false },
|
||
desc: { type: String, optional: false },
|
||
emoji: { type: String, optional: false },
|
||
type: { type: String, optional: false },
|
||
basePrice: { type: Number, optional: false }
|
||
};
|
||
},
|
||
name: "ServiceType"
|
||
};
|
||
}
|
||
constructor(options, metadata = ServiceType.get$UTSMetadata$(), isJSONParse = false) {
|
||
super();
|
||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||
this.id = this.__props__.id;
|
||
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__;
|
||
}
|
||
}
|
||
class ProcessItem extends UTS.UTSType {
|
||
static get$UTSMetadata$() {
|
||
return {
|
||
kind: 2,
|
||
get fields() {
|
||
return {
|
||
step: { type: Number, optional: false },
|
||
title: { type: String, optional: false },
|
||
description: { type: String, optional: false }
|
||
};
|
||
},
|
||
name: "ProcessItem"
|
||
};
|
||
}
|
||
constructor(options, metadata = ProcessItem.get$UTSMetadata$(), isJSONParse = false) {
|
||
super();
|
||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||
this.step = this.__props__.step;
|
||
this.title = this.__props__.title;
|
||
this.description = this.__props__.description;
|
||
delete this.__props__;
|
||
}
|
||
}
|
||
class MaterialItem extends UTS.UTSType {
|
||
static get$UTSMetadata$() {
|
||
return {
|
||
kind: 2,
|
||
get fields() {
|
||
return {
|
||
name: { type: String, optional: false },
|
||
price: { type: String, optional: false },
|
||
desc: { type: String, optional: false },
|
||
tags: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false }
|
||
};
|
||
},
|
||
name: "MaterialItem"
|
||
};
|
||
}
|
||
constructor(options, metadata = MaterialItem.get$UTSMetadata$(), isJSONParse = false) {
|
||
super();
|
||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||
this.name = this.__props__.name;
|
||
this.price = this.__props__.price;
|
||
this.desc = this.__props__.desc;
|
||
this.tags = this.__props__.tags;
|
||
delete this.__props__;
|
||
}
|
||
}
|
||
class FaqItem extends UTS.UTSType {
|
||
static get$UTSMetadata$() {
|
||
return {
|
||
kind: 2,
|
||
get fields() {
|
||
return {
|
||
question: { type: String, optional: false },
|
||
answer: { type: String, optional: false },
|
||
expanded: { type: Boolean, optional: false }
|
||
};
|
||
},
|
||
name: "FaqItem"
|
||
};
|
||
}
|
||
constructor(options, metadata = FaqItem.get$UTSMetadata$(), isJSONParse = false) {
|
||
super();
|
||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||
this.question = this.__props__.question;
|
||
this.answer = this.__props__.answer;
|
||
this.expanded = this.__props__.expanded;
|
||
delete this.__props__;
|
||
}
|
||
}
|
||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||
__name: "index",
|
||
setup(__props) {
|
||
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 materials = common_vendor.ref([
|
||
new MaterialItem({
|
||
name: "头层牛皮",
|
||
price: "¥800-1500/平",
|
||
desc: "采用进口头层牛皮,质地柔软,透气性好,使用寿命长",
|
||
tags: ["进口原料", "透气舒适", "耐用耐磨"]
|
||
}),
|
||
new MaterialItem({
|
||
name: "二层牛皮",
|
||
price: "¥400-800/平",
|
||
desc: "经济实惠的选择,经过特殊处理后外观与头层相近",
|
||
tags: ["性价比高", "外观精美", "易打理"]
|
||
}),
|
||
new MaterialItem({
|
||
name: "科技布",
|
||
price: "¥200-500/平",
|
||
desc: "新型环保面料,防水防污,清洁方便,触感舒适",
|
||
tags: ["防水防污", "易清洁", "环保健康"]
|
||
}),
|
||
new MaterialItem({
|
||
name: "棉麻布艺",
|
||
price: "¥150-400/平",
|
||
desc: "天然面料,透气舒适,适合追求自然风格的客户",
|
||
tags: ["天然环保", "透气清爽", "风格多样"]
|
||
})
|
||
]);
|
||
const faqList = common_vendor.ref([
|
||
new FaqItem({
|
||
question: "翻新需要多长时间?",
|
||
answer: "根据沙发的大小和翻新程度不同,一般需要3-10个工作日。局部修复1-3天,整体翻新5-10天。",
|
||
expanded: false
|
||
}),
|
||
new FaqItem({
|
||
question: "翻新后能保证多久?",
|
||
answer: "我们提供2年质保服务,质保期内如有非人为损坏,免费维修。头层牛皮正常使用可达10年以上。",
|
||
expanded: false
|
||
}),
|
||
new FaqItem({
|
||
question: "可以上门取送吗?",
|
||
answer: "是的,我们提供免费上门取送服务(市区范围内),郊区会收取少量运输费用。",
|
||
expanded: false
|
||
}),
|
||
new FaqItem({
|
||
question: "如何报价?",
|
||
answer: "我们提供免费上门评估服务,师傅会根据沙发的实际情况给出详细报价,价格透明无隐形消费。",
|
||
expanded: false
|
||
}),
|
||
new FaqItem({
|
||
question: "定金和尾款如何支付?",
|
||
answer: "确认订单后支付30%定金,翻新完成验收满意后支付尾款。支持微信、支付宝、银行转账等多种方式。",
|
||
expanded: false
|
||
})
|
||
]);
|
||
const fetchServices = () => {
|
||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||
try {
|
||
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: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;
|
||
};
|
||
const handleServiceClick = (item) => {
|
||
common_vendor.index.navigateTo({
|
||
url: "/pages/booking/index"
|
||
});
|
||
};
|
||
const goToBooking = () => {
|
||
common_vendor.index.navigateTo({
|
||
url: "/pages/booking/index"
|
||
});
|
||
};
|
||
common_vendor.onLoad(() => {
|
||
fetchServices();
|
||
fetchServiceProcess();
|
||
});
|
||
return (_ctx, _cache) => {
|
||
"raw js";
|
||
const __returned__ = {
|
||
a: common_vendor.p({
|
||
title: "服务类型"
|
||
}),
|
||
b: common_vendor.f(common_vendor.unref(serviceTypes), (item, k0, i0) => {
|
||
return {
|
||
a: common_vendor.t(item.emoji),
|
||
b: common_vendor.t(item.name),
|
||
c: common_vendor.t(item.desc),
|
||
d: item.id,
|
||
e: common_vendor.o(($event) => {
|
||
return handleServiceClick();
|
||
}, item.id)
|
||
};
|
||
}),
|
||
c: common_vendor.p({
|
||
title: "服务流程"
|
||
}),
|
||
d: common_vendor.f(common_vendor.unref(processList), (item, index, i0) => {
|
||
return common_vendor.e({
|
||
a: common_vendor.t(item.step),
|
||
b: common_vendor.t(item.title),
|
||
c: common_vendor.t(item.description),
|
||
d: index < common_vendor.unref(processList).length - 1
|
||
}, index < common_vendor.unref(processList).length - 1 ? {} : {}, {
|
||
e: item.step
|
||
});
|
||
}),
|
||
e: common_vendor.p({
|
||
title: "材质说明"
|
||
}),
|
||
f: common_vendor.f(common_vendor.unref(materials), (item, k0, i0) => {
|
||
return {
|
||
a: common_vendor.t(item.name),
|
||
b: common_vendor.t(item.price),
|
||
c: common_vendor.t(item.desc),
|
||
d: common_vendor.f(item.tags, (tag, k1, i1) => {
|
||
return {
|
||
a: common_vendor.t(tag),
|
||
b: tag
|
||
};
|
||
}),
|
||
e: item.name
|
||
};
|
||
}),
|
||
g: common_vendor.p({
|
||
title: "常见问题"
|
||
}),
|
||
h: common_vendor.f(common_vendor.unref(faqList), (item, index, i0) => {
|
||
return common_vendor.e({
|
||
a: common_vendor.t(item.question),
|
||
b: common_vendor.t(item.expanded ? "−" : "+"),
|
||
c: item.expanded
|
||
}, item.expanded ? {
|
||
d: common_vendor.t(item.answer)
|
||
} : {}, {
|
||
e: index,
|
||
f: common_vendor.o(($event) => {
|
||
return toggleFaq(index);
|
||
}, index)
|
||
});
|
||
}),
|
||
i: common_vendor.o(goToBooking),
|
||
j: common_vendor.sei(common_vendor.gei(_ctx, ""), "view")
|
||
};
|
||
return __returned__;
|
||
};
|
||
}
|
||
});
|
||
wx.createPage(_sfc_main);
|
||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/service/index.js.map
|