feat:"完成页面接口的对接"
This commit is contained in:
@@ -1 +1 @@
|
||||
<view id="{{o}}" change:eS="{{uV.sS}}" eS="{{$eS[o]}}" change:eA="{{uV.sA}}" eA="{{$eA[o]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="header-section"><view class="company-logo"><text class="logo-text">优艺家</text></view><text class="company-name">{{a}}</text><text class="company-slogan">{{b}}</text></view><view class="section"><section-header u-i="00470dc0-0" bind:__l="__l" u-p="{{c||''}}"></section-header><view class="intro-card"><text class="intro-text">{{d}}</text></view></view><view class="section"><section-header u-i="00470dc0-1" bind:__l="__l" u-p="{{e||''}}"></section-header><view class="features-grid"><view wx:for="{{f}}" wx:for-item="item" wx:key="c" class="feature-item"><view class="feature-icon-bg"><text class="feature-icon">✓</text></view><text class="feature-title">{{item.a}}</text><text class="feature-desc">{{item.b}}</text></view></view></view><view class="section"><section-header u-i="00470dc0-2" bind:__l="__l" u-p="{{g||''}}"></section-header><view class="contact-card"><view class="contact-item" bindtap="{{i}}"><view class="contact-icon-bg"><text class="contact-icon">📞</text></view><view class="contact-info"><text class="contact-label">客服电话</text><text class="contact-value">{{h}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item" bindtap="{{k}}"><view class="contact-icon-bg"><text class="contact-icon">💬</text></view><view class="contact-info"><text class="contact-label">微信号</text><text class="contact-value">{{j}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item" bindtap="{{m}}"><view class="contact-icon-bg"><text class="contact-icon">📍</text></view><view class="contact-info"><text class="contact-label">公司地址</text><text class="contact-value">{{l}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item"><view class="contact-icon-bg"><text class="contact-icon">🕐</text></view><view class="contact-info"><text class="contact-label">营业时间</text><text class="contact-value">{{n}}</text></view></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{o}}" change:eS="{{uV.sS}}" eS="{{$eS[o]}}" change:eA="{{uV.sA}}" eA="{{$eA[o]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="header-section"><view class="company-logo"><text class="logo-text">优艺家</text></view><text class="company-name">{{a}}</text><text class="company-slogan">{{b}}</text></view><view class="section"><section-header u-i="4554258f-0" bind:__l="__l" u-p="{{c||''}}"></section-header><view class="intro-card"><text class="intro-text">{{d}}</text></view></view><view class="section"><section-header u-i="4554258f-1" bind:__l="__l" u-p="{{e||''}}"></section-header><view class="features-grid"><view wx:for="{{f}}" wx:for-item="item" wx:key="c" class="feature-item"><view class="feature-icon-bg"><text class="feature-icon">✓</text></view><text class="feature-title">{{item.a}}</text><text class="feature-desc">{{item.b}}</text></view></view></view><view class="section"><section-header u-i="4554258f-2" bind:__l="__l" u-p="{{g||''}}"></section-header><view class="contact-card"><view class="contact-item" bindtap="{{i}}"><view class="contact-icon-bg"><text class="contact-icon">📞</text></view><view class="contact-info"><text class="contact-label">客服电话</text><text class="contact-value">{{h}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item" bindtap="{{k}}"><view class="contact-icon-bg"><text class="contact-icon">💬</text></view><view class="contact-info"><text class="contact-label">微信号</text><text class="contact-value">{{j}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item" bindtap="{{m}}"><view class="contact-icon-bg"><text class="contact-icon">📍</text></view><view class="contact-info"><text class="contact-label">公司地址</text><text class="contact-value">{{l}}</text></view><text class="contact-arrow">›</text></view><view class="contact-item"><view class="contact-icon-bg"><text class="contact-icon">🕐</text></view><view class="contact-info"><text class="contact-label">营业时间</text><text class="contact-value">{{n}}</text></view></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
const utils_config = require("../../utils/config.js");
|
||||
class FormData extends UTS.UTSType {
|
||||
static get$UTSMetadata$() {
|
||||
return {
|
||||
@@ -11,7 +10,8 @@ class FormData extends UTS.UTSType {
|
||||
userName: { type: String, optional: false },
|
||||
phone: { type: String, optional: false },
|
||||
address: { type: String, optional: false },
|
||||
sofaType: { type: String, optional: false },
|
||||
serviceId: { type: Number, optional: false },
|
||||
appointmentDate: { type: String, optional: false },
|
||||
problem: { type: String, optional: false }
|
||||
};
|
||||
},
|
||||
@@ -24,29 +24,36 @@ class FormData extends UTS.UTSType {
|
||||
this.userName = this.__props__.userName;
|
||||
this.phone = this.__props__.phone;
|
||||
this.address = this.__props__.address;
|
||||
this.sofaType = this.__props__.sofaType;
|
||||
this.serviceId = this.__props__.serviceId;
|
||||
this.appointmentDate = this.__props__.appointmentDate;
|
||||
this.problem = this.__props__.problem;
|
||||
delete this.__props__;
|
||||
}
|
||||
}
|
||||
class SofaType extends UTS.UTSType {
|
||||
class ServiceItem extends UTS.UTSType {
|
||||
static get$UTSMetadata$() {
|
||||
return {
|
||||
kind: 2,
|
||||
get fields() {
|
||||
return {
|
||||
id: { type: String, optional: false },
|
||||
name: { type: String, optional: false }
|
||||
id: { type: Number, optional: false },
|
||||
name: { type: String, optional: false },
|
||||
type: { type: String, optional: false },
|
||||
description: { type: String, optional: false },
|
||||
price: { type: Number, optional: false }
|
||||
};
|
||||
},
|
||||
name: "SofaType"
|
||||
name: "ServiceItem"
|
||||
};
|
||||
}
|
||||
constructor(options, metadata = SofaType.get$UTSMetadata$(), isJSONParse = false) {
|
||||
constructor(options, metadata = ServiceItem.get$UTSMetadata$(), isJSONParse = false) {
|
||||
super();
|
||||
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
|
||||
this.id = this.__props__.id;
|
||||
this.name = this.__props__.name;
|
||||
this.type = this.__props__.type;
|
||||
this.description = this.__props__.description;
|
||||
this.price = this.__props__.price;
|
||||
delete this.__props__;
|
||||
}
|
||||
}
|
||||
@@ -57,24 +64,65 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
userName: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
sofaType: "",
|
||||
serviceId: 0,
|
||||
appointmentDate: "",
|
||||
problem: ""
|
||||
}));
|
||||
const imageList = common_vendor.ref([]);
|
||||
const sofaTypes = common_vendor.ref([]);
|
||||
const serviceList = common_vendor.ref([]);
|
||||
const submitting = common_vendor.ref(false);
|
||||
const initSofaTypes = () => {
|
||||
sofaTypes.value = utils_config.SOFA_CATEGORIES.filter((item) => {
|
||||
return item.id != "all";
|
||||
}).map((item) => {
|
||||
return new SofaType({
|
||||
id: item.id,
|
||||
name: item.name
|
||||
});
|
||||
const minDate = common_vendor.ref("");
|
||||
const loadServices = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getActiveServices();
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:196", "服务列表响应:", res);
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
let list = [];
|
||||
if (Array.isArray(data)) {
|
||||
list = data;
|
||||
} else {
|
||||
list = data["list"] || [];
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:206", "解析的服务列表:", list);
|
||||
serviceList.value = list.map((item) => {
|
||||
const basePrice = item["basePrice"] || "0";
|
||||
return new ServiceItem({
|
||||
id: item["id"],
|
||||
name: item["name"],
|
||||
type: item["type"],
|
||||
description: item["description"],
|
||||
price: parseFloat(basePrice)
|
||||
});
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:217", "最终服务列表:", serviceList.value);
|
||||
} else {
|
||||
common_vendor.index.__f__("error", "at pages/booking/index.uvue:219", "服务列表响应异常,code:", res.code, "data:", res.data);
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/booking/index.uvue:222", "加载服务列表失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
const selectSofaType = (id) => {
|
||||
formData.value.sofaType = id;
|
||||
const initMinDate = () => {
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(now.getDate()).padStart(2, "0");
|
||||
minDate.value = `${year}-${month}-${day}`;
|
||||
const tomorrow = /* @__PURE__ */ new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
const tYear = tomorrow.getFullYear();
|
||||
const tMonth = String(tomorrow.getMonth() + 1).padStart(2, "0");
|
||||
const tDay = String(tomorrow.getDate()).padStart(2, "0");
|
||||
formData.value.appointmentDate = `${tYear}-${tMonth}-${tDay}`;
|
||||
};
|
||||
const selectService = (id) => {
|
||||
formData.value.serviceId = id;
|
||||
};
|
||||
const onDateChange = (e = null) => {
|
||||
formData.value.appointmentDate = e.detail.value;
|
||||
};
|
||||
const chooseImage = () => {
|
||||
common_vendor.index.chooseImage(new UTSJSONObject({
|
||||
@@ -119,6 +167,20 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (formData.value.serviceId == 0) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请选择服务类型",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (formData.value.appointmentDate == "") {
|
||||
common_vendor.index.showToast({
|
||||
title: "请选择预约时间",
|
||||
icon: "none"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
const handleSubmit = () => {
|
||||
@@ -129,19 +191,28 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return Promise.resolve(null);
|
||||
submitting.value = true;
|
||||
try {
|
||||
const data = new UTSJSONObject({
|
||||
userName: formData.value.userName,
|
||||
phone: formData.value.phone,
|
||||
address: formData.value.address,
|
||||
sofaType: formData.value.sofaType,
|
||||
problem: formData.value.problem,
|
||||
images: imageList.value
|
||||
const validImages = imageList.value.filter((url) => {
|
||||
return url.startsWith("http://") || url.startsWith("https://");
|
||||
});
|
||||
if (imageList.value.length > 0 && validImages.length === 0) {
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:340", "警告:图片为微信临时路径,暂不支持上传");
|
||||
}
|
||||
const data = new UTSJSONObject({
|
||||
serviceId: formData.value.serviceId,
|
||||
contactName: formData.value.userName,
|
||||
contactPhone: formData.value.phone,
|
||||
address: formData.value.address,
|
||||
appointmentTime: formData.value.appointmentDate + "T10:00:00.000Z",
|
||||
requirements: formData.value.problem,
|
||||
images: validImages
|
||||
// 只提交有效的URL
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:354", "提交预约数据:", data);
|
||||
const res = yield api_index.submitBooking(data);
|
||||
const result = res.data;
|
||||
common_vendor.index.__f__("log", "at pages/booking/index.uvue:356", "预约提交结果:", res);
|
||||
common_vendor.index.showModal(new UTSJSONObject({
|
||||
title: "预约成功",
|
||||
content: result["message"],
|
||||
content: "我们会尽快与您联系,请保持电话畅通",
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
common_vendor.index.navigateBack(new UTSJSONObject({
|
||||
@@ -154,17 +225,14 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
}
|
||||
}));
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/booking/index.uvue:270", "提交预约失败", e);
|
||||
common_vendor.index.showToast({
|
||||
title: "提交失败,请重试",
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.__f__("error", "at pages/booking/index.uvue:375", "提交预约异常:", e);
|
||||
}
|
||||
submitting.value = false;
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad(() => {
|
||||
initSofaTypes();
|
||||
initMinDate();
|
||||
loadServices();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
"raw js";
|
||||
@@ -181,23 +249,30 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
f: common_vendor.o(($event) => {
|
||||
return common_vendor.unref(formData).address = $event.detail.value;
|
||||
}),
|
||||
g: common_vendor.f(common_vendor.unref(sofaTypes), (item, k0, i0) => {
|
||||
g: common_vendor.f(common_vendor.unref(serviceList), (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.name),
|
||||
b: common_vendor.unref(formData).sofaType == item.id ? 1 : "",
|
||||
c: common_vendor.unref(formData).sofaType == item.id ? 1 : "",
|
||||
b: common_vendor.unref(formData).serviceId == item.id ? 1 : "",
|
||||
c: common_vendor.unref(formData).serviceId == item.id ? 1 : "",
|
||||
d: item.id,
|
||||
e: common_vendor.o(($event) => {
|
||||
return selectSofaType(item.id);
|
||||
return selectService(item.id);
|
||||
}, item.id)
|
||||
};
|
||||
}),
|
||||
h: common_vendor.unref(formData).problem,
|
||||
i: common_vendor.o(($event) => {
|
||||
h: common_vendor.unref(formData).appointmentDate
|
||||
}, common_vendor.unref(formData).appointmentDate ? {
|
||||
i: common_vendor.t(common_vendor.unref(formData).appointmentDate)
|
||||
} : {}, {
|
||||
j: common_vendor.unref(formData).appointmentDate,
|
||||
k: common_vendor.unref(minDate),
|
||||
l: common_vendor.o(onDateChange),
|
||||
m: common_vendor.unref(formData).problem,
|
||||
n: common_vendor.o(($event) => {
|
||||
return common_vendor.unref(formData).problem = $event.detail.value;
|
||||
}),
|
||||
j: common_vendor.t(common_vendor.unref(formData).problem.length),
|
||||
k: common_vendor.f(common_vendor.unref(imageList), (item, index, i0) => {
|
||||
o: common_vendor.t(common_vendor.unref(formData).problem.length),
|
||||
p: common_vendor.f(common_vendor.unref(imageList), (item, index, i0) => {
|
||||
return {
|
||||
a: item,
|
||||
b: common_vendor.o(($event) => {
|
||||
@@ -206,12 +281,12 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
c: index
|
||||
};
|
||||
}),
|
||||
l: common_vendor.unref(imageList).length < 9
|
||||
q: common_vendor.unref(imageList).length < 9
|
||||
}, common_vendor.unref(imageList).length < 9 ? {
|
||||
m: common_vendor.o(chooseImage)
|
||||
r: common_vendor.o(chooseImage)
|
||||
} : {}, {
|
||||
n: common_vendor.o(handleSubmit),
|
||||
o: common_vendor.sei(common_vendor.gei(_ctx, ""), "view")
|
||||
s: common_vendor.o(handleSubmit),
|
||||
t: common_vendor.sei(common_vendor.gei(_ctx, ""), "view")
|
||||
});
|
||||
return __returned__;
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view id="{{o}}" change:eS="{{uV.sS}}" eS="{{$eS[o]}}" change:eA="{{uV.sA}}" eA="{{$eA[o]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="header-section"><text class="header-title">预约翻新服务</text><text class="header-desc">填写以下信息,我们会尽快与您联系</text></view><view class="form-section"><view class="form-item"><text class="form-label"><text class="required">*</text> 您的姓名 </text><input class="form-input" type="text" placeholder="请输入您的姓名" placeholder-class="placeholder" value="{{a}}" bindinput="{{b}}"/></view><view class="form-item"><text class="form-label"><text class="required">*</text> 联系电话 </text><input class="form-input" type="number" placeholder="请输入您的手机号" placeholder-class="placeholder" maxlength="11" value="{{c}}" bindinput="{{d}}"/></view><view class="form-item"><text class="form-label"><text class="required">*</text> 您的地址 </text><input class="form-input" type="text" placeholder="请输入详细地址" placeholder-class="placeholder" value="{{e}}" bindinput="{{f}}"/></view><view class="form-item"><text class="form-label">沙发类型</text><view class="type-grid"><view wx:for="{{g}}" wx:for-item="item" wx:key="d" class="{{['type-item', item.c && 'type-active']}}" bindtap="{{item.e}}"><text class="{{['type-text', item.b && 'type-text-active']}}">{{item.a}}</text></view></view></view><view class="form-item"><text class="form-label">问题描述</text><block wx:if="{{r0}}"><textarea class="form-textarea" placeholder="请描述沙发的问题(如:皮面开裂、褪色、塌陷等)" placeholder-class="placeholder" maxlength="500" value="{{h}}" bindinput="{{i}}"></textarea></block><text class="textarea-count">{{j}}/500</text></view><view class="form-item"><text class="form-label">上传图片(可选)</text><view class="upload-grid"><view wx:for="{{k}}" wx:for-item="item" wx:key="c" class="upload-item"><image class="upload-image" src="{{item.a}}" mode="aspectFill"></image><view class="upload-delete" bindtap="{{item.b}}"><text class="delete-icon">×</text></view></view><view wx:if="{{l}}" class="upload-add" bindtap="{{m}}"><text class="add-icon">+</text><text class="add-text">添加图片</text></view></view><text class="upload-tip">最多可上传9张图片</text></view></view><view class="bottom-space"></view></scroll-view><view class="submit-bar"><view class="submit-btn" bindtap="{{n}}"><text class="submit-text">提交预约</text></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{t}}" change:eS="{{uV.sS}}" eS="{{$eS[t]}}" change:eA="{{uV.sA}}" eA="{{$eA[t]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="header-section"><text class="header-title">预约翻新服务</text><text class="header-desc">填写以下信息,我们会尽快与您联系</text></view><view class="form-section"><view class="form-item"><text class="form-label"><text class="required">*</text> 您的姓名 </text><input class="form-input" type="text" placeholder="请输入您的姓名" placeholder-class="placeholder" value="{{a}}" bindinput="{{b}}"/></view><view class="form-item"><text class="form-label"><text class="required">*</text> 联系电话 </text><input class="form-input" type="number" placeholder="请输入您的手机号" placeholder-class="placeholder" maxlength="11" value="{{c}}" bindinput="{{d}}"/></view><view class="form-item"><text class="form-label"><text class="required">*</text> 您的地址 </text><input class="form-input" type="text" placeholder="请输入详细地址" placeholder-class="placeholder" value="{{e}}" bindinput="{{f}}"/></view><view class="form-item"><text class="form-label"><text class="required">*</text> 服务类型 </text><view class="type-grid"><view wx:for="{{g}}" wx:for-item="item" wx:key="d" class="{{['type-item', item.c && 'type-active']}}" bindtap="{{item.e}}"><text class="{{['type-text', item.b && 'type-text-active']}}">{{item.a}}</text></view></view></view><view class="form-item"><text class="form-label"><text class="required">*</text> 预约时间 </text><picker mode="date" value="{{j}}" start="{{k}}" bindchange="{{l}}"><view class="picker-value"><text wx:if="{{h}}" class="picker-text">{{i}}</text><text wx:else class="picker-placeholder">请选择预约日期</text></view></picker></view><view class="form-item"><text class="form-label">问题描述</text><block wx:if="{{r0}}"><textarea class="form-textarea" placeholder="请描述沙发的问题(如:皮面开裂、褪色、塌陷等)" placeholder-class="placeholder" maxlength="500" value="{{m}}" bindinput="{{n}}"></textarea></block><text class="textarea-count">{{o}}/500</text></view><view class="form-item"><text class="form-label">上传图片(可选)</text><view class="upload-grid"><view wx:for="{{p}}" wx:for-item="item" wx:key="c" class="upload-item"><image class="upload-image" src="{{item.a}}" mode="aspectFill"></image><view class="upload-delete" bindtap="{{item.b}}"><text class="delete-icon">×</text></view></view><view wx:if="{{q}}" class="upload-add" bindtap="{{r}}"><text class="add-icon">+</text><text class="add-text">添加图片</text></view></view><text class="upload-tip">提示:当前仅支持预览,图片暂不会上传到服务器</text></view></view><view class="bottom-space"></view></scroll-view><view class="submit-bar"><view class="submit-btn" bindtap="{{s}}"><text class="submit-text">提交预约</text></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
@@ -80,6 +80,23 @@
|
||||
color: #C0C4CC;
|
||||
}
|
||||
|
||||
/* 日期选择器 */
|
||||
.picker-value {
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
height: 40px;
|
||||
justify-content: center;
|
||||
}
|
||||
.picker-text {
|
||||
font-size: 28rpx;
|
||||
color: #303133;
|
||||
}
|
||||
.picker-placeholder {
|
||||
font-size: 28rpx;
|
||||
color: #C0C4CC;
|
||||
}
|
||||
|
||||
/* 沙发类型选择 */
|
||||
.type-grid {
|
||||
flex-direction: row;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
const utils_config = require("../../utils/config.js");
|
||||
if (!Array) {
|
||||
const _easycom_before_after_1 = common_vendor.resolveComponent("before-after");
|
||||
_easycom_before_after_1();
|
||||
@@ -21,6 +22,7 @@ class CaseDetail extends UTS.UTSType {
|
||||
categoryName: { type: String, optional: false },
|
||||
beforeImages: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false },
|
||||
afterImages: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false },
|
||||
compareAfterImages: { type: UTS.UTSType.withGenerics(Array, [String]), optional: false },
|
||||
description: { type: String, optional: false },
|
||||
material: { type: String, optional: false },
|
||||
duration: { type: String, optional: false },
|
||||
@@ -42,6 +44,7 @@ class CaseDetail extends UTS.UTSType {
|
||||
this.categoryName = this.__props__.categoryName;
|
||||
this.beforeImages = this.__props__.beforeImages;
|
||||
this.afterImages = this.__props__.afterImages;
|
||||
this.compareAfterImages = this.__props__.compareAfterImages;
|
||||
this.description = this.__props__.description;
|
||||
this.material = this.__props__.material;
|
||||
this.duration = this.__props__.duration;
|
||||
@@ -63,6 +66,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
categoryName: "",
|
||||
beforeImages: [],
|
||||
afterImages: [],
|
||||
compareAfterImages: [],
|
||||
description: "",
|
||||
material: "",
|
||||
duration: "",
|
||||
@@ -76,37 +80,57 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getCaseDetail(caseId.value);
|
||||
const data = res.data;
|
||||
caseDetail.value = new CaseDetail(
|
||||
{
|
||||
id: data["id"],
|
||||
title: data["title"],
|
||||
category: data["category"],
|
||||
categoryName: data["categoryName"],
|
||||
beforeImages: data["beforeImages"],
|
||||
afterImages: data["afterImages"],
|
||||
description: data["description"],
|
||||
material: data["material"],
|
||||
duration: data["duration"],
|
||||
price: data["price"],
|
||||
views: data["views"],
|
||||
likes: data["likes"],
|
||||
createTime: data["createTime"]
|
||||
}
|
||||
// 更新标题
|
||||
);
|
||||
common_vendor.index.setNavigationBarTitle({
|
||||
title: caseDetail.value.title
|
||||
if (res.code === 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const images = data["images"] || [];
|
||||
const beforeImages = data["beforeImages"] || [];
|
||||
const afterImages = data["afterImages"] || [];
|
||||
const createdAt = data["createdAt"] || "";
|
||||
const displayAfterImages = afterImages.length > 0 ? afterImages : images;
|
||||
const compareAfterImages = afterImages.length > 0 ? afterImages : [];
|
||||
caseDetail.value = new CaseDetail(
|
||||
{
|
||||
id: String(data["id"]),
|
||||
title: data["title"],
|
||||
category: data["serviceType"] || "",
|
||||
categoryName: utils_config.getServiceTypeName(data["serviceType"]),
|
||||
beforeImages,
|
||||
afterImages: displayAfterImages,
|
||||
compareAfterImages,
|
||||
description: data["description"],
|
||||
material: data["materials"] || "优质材料",
|
||||
duration: (data["duration"] || 0) + "天",
|
||||
price: data["price"] != null ? "¥" + data["price"] : "面议",
|
||||
views: data["views"] || 0,
|
||||
likes: data["likes"] || 0,
|
||||
createTime: createdAt.split("T")[0] || ""
|
||||
}
|
||||
// 更新标题
|
||||
);
|
||||
common_vendor.index.setNavigationBarTitle({
|
||||
title: caseDetail.value.title
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.message || "加载失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/cases/detail.uvue:197", "获取案例详情失败:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "加载失败",
|
||||
icon: "none"
|
||||
});
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/cases/detail.uvue:173", "获取案例详情失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
const previewImages = (index) => {
|
||||
const urls = caseDetail.value.afterImages || [];
|
||||
const current = urls[index] || urls[0] || "";
|
||||
common_vendor.index.previewImage({
|
||||
current: index,
|
||||
urls: caseDetail.value.afterImages
|
||||
current,
|
||||
urls
|
||||
});
|
||||
};
|
||||
const handleFavorite = () => {
|
||||
@@ -164,7 +188,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
f: common_vendor.t(common_vendor.unref(caseDetail).likes),
|
||||
g: common_vendor.p({
|
||||
beforeImage: common_vendor.unref(caseDetail).beforeImages[0] || "",
|
||||
afterImage: common_vendor.unref(caseDetail).afterImages[0] || "",
|
||||
afterImage: common_vendor.unref(caseDetail).compareAfterImages[0] || "",
|
||||
showTitle: true
|
||||
}),
|
||||
h: common_vendor.t(common_vendor.unref(caseDetail).material),
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view id="{{q}}" change:eS="{{uV.sS}}" eS="{{$eS[q]}}" change:eA="{{uV.sA}}" eA="{{$eA[q]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="gallery-section"><swiper class="gallery-swiper" circular indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="c"><image class="gallery-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper><view class="gallery-tag"><text class="gallery-tag-text">{{b}}</text></view></view><view class="info-section"><text class="case-title">{{c}}</text><view class="case-meta"><text class="case-price">{{d}}</text><view class="case-stats"><text class="stat-text">👁 {{e}}</text><text class="stat-text">❤ {{f}}</text></view></view></view><view class="compare-section"><before-after u-i="eec33e1e-0" bind:__l="__l" u-p="{{g||''}}"></before-after></view><view class="detail-section"><view class="detail-header"><text class="detail-title">翻新详情</text></view><view class="detail-list"><view class="detail-item"><text class="detail-label">使用材质</text><text class="detail-value">{{h}}</text></view><view class="detail-item"><text class="detail-label">翻新工期</text><text class="detail-value">{{i}}</text></view><view class="detail-item"><text class="detail-label">完成日期</text><text class="detail-value">{{j}}</text></view></view><view class="detail-desc"><text class="desc-title">案例描述</text><text class="desc-content">{{k}}</text></view></view><view class="bottom-space"></view></scroll-view><view class="bottom-bar"><view class="bar-left"><view class="bar-btn" bindtap="{{m}}"><text class="bar-icon">{{l}}</text><text class="bar-label">收藏</text></view><view class="bar-btn" bindtap="{{n}}"><text class="bar-icon">📤</text><text class="bar-label">分享</text></view></view><view class="bar-right"><view class="contact-btn" bindtap="{{o}}"><text class="contact-text">在线咨询</text></view><view class="booking-btn" bindtap="{{p}}"><text class="booking-text">立即预约</text></view></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{q}}" change:eS="{{uV.sS}}" eS="{{$eS[q]}}" change:eA="{{uV.sA}}" eA="{{$eA[q]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="gallery-section"><swiper class="gallery-swiper" circular indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="c"><image class="gallery-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper><view class="gallery-tag"><text class="gallery-tag-text">{{b}}</text></view></view><view class="info-section"><text class="case-title">{{c}}</text><view class="case-meta"><text class="case-price">{{d}}</text><view class="case-stats"><text class="stat-text">👁 {{e}}</text><text class="stat-text">❤ {{f}}</text></view></view></view><view class="compare-section"><before-after u-i="1bc77b3c-0" bind:__l="__l" u-p="{{g||''}}"></before-after></view><view class="detail-section"><view class="detail-header"><text class="detail-title">翻新详情</text></view><view class="detail-list"><view class="detail-item"><text class="detail-label">使用材质</text><text class="detail-value">{{h}}</text></view><view class="detail-item"><text class="detail-label">翻新工期</text><text class="detail-value">{{i}}</text></view><view class="detail-item"><text class="detail-label">完成日期</text><text class="detail-value">{{j}}</text></view></view><view class="detail-desc"><text class="desc-title">案例描述</text><text class="desc-content">{{k}}</text></view></view><view class="bottom-space"></view></scroll-view><view class="bottom-bar"><view class="bar-left"><view class="bar-btn" bindtap="{{m}}"><text class="bar-icon">{{l}}</text><text class="bar-label">收藏</text></view><view class="bar-btn" bindtap="{{n}}"><text class="bar-icon">📤</text><text class="bar-label">分享</text></view></view><view class="bar-right"><view class="contact-btn" bindtap="{{o}}"><text class="contact-text">在线咨询</text></view><view class="booking-btn" bindtap="{{p}}"><text class="booking-text">立即预约</text></view></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
@@ -93,6 +93,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
page.value = 1;
|
||||
caseList.value = [];
|
||||
noMore.value = false;
|
||||
common_vendor.index.__f__("log", "at pages/cases/list.uvue:114", 111);
|
||||
fetchCaseList();
|
||||
};
|
||||
const fetchCaseList = () => {
|
||||
@@ -102,38 +103,49 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = new UTSJSONObject({
|
||||
category: currentCategory.value,
|
||||
serviceType: currentCategory.value != "all" ? currentCategory.value : void 0,
|
||||
page: page.value,
|
||||
pageSize: utils_config.PAGE_SIZE
|
||||
limit: utils_config.PAGE_SIZE,
|
||||
status: "published"
|
||||
});
|
||||
const res = yield api_index.getCaseList(params);
|
||||
const data = res.data;
|
||||
const list = data["items"] || [];
|
||||
total.value = data["total"] || 0;
|
||||
const newList = list.map((item) => {
|
||||
return new CaseItem({
|
||||
id: item["id"],
|
||||
title: item["title"],
|
||||
category: item["category"],
|
||||
categoryName: item["categoryName"],
|
||||
coverImage: item["coverImage"],
|
||||
material: item["material"],
|
||||
duration: item["duration"],
|
||||
price: item["price"],
|
||||
views: item["views"],
|
||||
likes: item["likes"]
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const list = data["list"] || [];
|
||||
total.value = data["total"] || 0;
|
||||
const newList = list.map((item) => {
|
||||
const images = item["images"] || [];
|
||||
const afterImages = item["afterImages"] || [];
|
||||
const beforeImages = item["beforeImages"] || [];
|
||||
const coverImage = images.length > 0 ? images[0] : afterImages.length > 0 ? afterImages[0] : beforeImages.length > 0 ? beforeImages[0] : "";
|
||||
return new CaseItem({
|
||||
id: String(item["id"]),
|
||||
title: item["title"],
|
||||
category: item["serviceType"],
|
||||
categoryName: utils_config.getServiceTypeName(item["serviceType"]),
|
||||
coverImage,
|
||||
material: item["materials"] || "暂无",
|
||||
duration: (item["duration"] || 0) + "天",
|
||||
price: item["price"] != null ? "¥" + item["price"] : "面议",
|
||||
views: item["views"] || 0,
|
||||
likes: item["likes"] || 0
|
||||
});
|
||||
});
|
||||
});
|
||||
if (page.value == 1) {
|
||||
caseList.value = newList;
|
||||
} else {
|
||||
caseList.value = [...caseList.value, ...newList];
|
||||
}
|
||||
if (caseList.value.length >= total.value) {
|
||||
noMore.value = true;
|
||||
if (page.value == 1) {
|
||||
caseList.value = newList;
|
||||
} else {
|
||||
caseList.value = [...caseList.value, ...newList];
|
||||
}
|
||||
if (caseList.value.length >= total.value) {
|
||||
noMore.value = true;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/cases/list.uvue:160", "获取案例列表失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/cases/list.uvue:170", "获取案例列表失败", e);
|
||||
common_vendor.index.showToast({
|
||||
title: "加载失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
loading.value = false;
|
||||
});
|
||||
@@ -171,7 +183,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return {
|
||||
a: item.id,
|
||||
b: common_vendor.o(goToDetail, item.id),
|
||||
c: "15d594f8-0-" + i0,
|
||||
c: "32628196-0-" + i0,
|
||||
d: common_vendor.p({
|
||||
caseData: item
|
||||
})
|
||||
|
||||
@@ -136,30 +136,47 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
new AdvantageItem({ icon: "🚗", title: "上门服务", desc: "免费评估" }),
|
||||
new AdvantageItem({ icon: "💰", title: "价格透明", desc: "无隐形消费" })
|
||||
]);
|
||||
const initServiceTypes = () => {
|
||||
serviceTypes.value = utils_config.SERVICE_TYPES.map((item) => {
|
||||
return new ServiceType({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icon: item.icon
|
||||
});
|
||||
const fetchServiceTypes = () => {
|
||||
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"] || [];
|
||||
serviceTypes.value = list.map((item) => {
|
||||
return new ServiceType({
|
||||
id: String(item["id"]),
|
||||
name: item["name"],
|
||||
icon: item["icon"] || "/static/icons/default.png"
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:165", "获取服务类型失败", e);
|
||||
serviceTypes.value = [
|
||||
new ServiceType({ id: "repair", name: "局部修复", icon: "/static/icons/repair.png" }),
|
||||
new ServiceType({ id: "refurbish", name: "整体翻新", icon: "/static/icons/refurbish.png" })
|
||||
];
|
||||
}
|
||||
});
|
||||
};
|
||||
const fetchBanners = () => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getBanners();
|
||||
const data = res.data;
|
||||
bannerList.value = data.map((item) => {
|
||||
return new BannerItem({
|
||||
id: item["id"],
|
||||
image: item["image"],
|
||||
title: item["title"],
|
||||
link: item["link"]
|
||||
if (res.code === 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
bannerList.value = data.map((item) => {
|
||||
return new BannerItem({
|
||||
id: item["id"],
|
||||
image: item["image"],
|
||||
title: item["title"],
|
||||
link: item["link"]
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:174", "获取轮播图失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:190", "获取轮播图失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -167,24 +184,30 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const res = yield api_index.getHotCases();
|
||||
const data = res.data;
|
||||
const list = data["items"] || [];
|
||||
hotCases.value = list.map((item) => {
|
||||
return new CaseItem({
|
||||
id: item["id"],
|
||||
title: item["title"],
|
||||
category: item["category"],
|
||||
categoryName: item["categoryName"],
|
||||
coverImage: item["coverImage"],
|
||||
material: item["material"],
|
||||
duration: item["duration"],
|
||||
price: item["price"],
|
||||
views: item["views"],
|
||||
likes: item["likes"]
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const list = data["list"] || [];
|
||||
hotCases.value = list.map((item) => {
|
||||
const images = item["images"] || [];
|
||||
const afterImages = item["afterImages"] || [];
|
||||
const beforeImages = item["beforeImages"] || [];
|
||||
const coverImage = images.length > 0 ? images[0] : afterImages.length > 0 ? afterImages[0] : beforeImages.length > 0 ? beforeImages[0] : "";
|
||||
return new CaseItem({
|
||||
id: String(item["id"]),
|
||||
title: item["title"],
|
||||
category: item["serviceType"] || "",
|
||||
categoryName: utils_config.getServiceTypeName(item["serviceType"]),
|
||||
coverImage,
|
||||
material: item["materials"] || "暂无",
|
||||
duration: (item["duration"] || 0) + "天",
|
||||
price: item["price"] != null ? "¥" + item["price"] : "面议",
|
||||
views: item["views"] || 0,
|
||||
likes: item["likes"] || 0
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:200", "获取热门案例失败", e);
|
||||
common_vendor.index.__f__("error", "at pages/index/index.uvue:224", "获取热门案例失败", e);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -221,7 +244,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
});
|
||||
};
|
||||
common_vendor.onLoad(() => {
|
||||
initServiceTypes();
|
||||
fetchServiceTypes();
|
||||
fetchBanners();
|
||||
fetchHotCases();
|
||||
});
|
||||
@@ -245,7 +268,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
a: item.id,
|
||||
b: item.id,
|
||||
c: common_vendor.o(handleServiceClick, item.id),
|
||||
d: "767a328a-1-" + i0,
|
||||
d: "0a3a932a-1-" + i0,
|
||||
e: common_vendor.p({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
@@ -270,7 +293,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
return {
|
||||
a: item.id,
|
||||
b: common_vendor.o(goToCaseDetail, item.id),
|
||||
c: "767a328a-3-" + i0,
|
||||
c: "0a3a932a-3-" + i0,
|
||||
d: common_vendor.p({
|
||||
caseData: item
|
||||
})
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view id="{{i}}" change:eS="{{uV.sS}}" eS="{{$eS[i]}}" change:eA="{{uV.sA}}" eA="{{$eA[i]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><nav-bar u-i="767a328a-0" bind:__l="__l" u-p="{{a||''}}"></nav-bar><scroll-view class="page-content" scroll-y enable-flex="true" enhanced="true"><view class="banner-section"><swiper class="banner-swiper" circular autoplay indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{b}}" wx:for-item="item" wx:key="c"><image class="banner-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper></view><view class="service-section"><view class="service-grid"><service-card wx:for="{{c}}" wx:for-item="item" wx:key="b" id="{{item.a}}" virtualHostId="{{item.a}}" bindclick="{{item.c}}" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e||''}}"></service-card></view></view><view class="advantage-section"><view class="advantage-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="d" class="advantage-item"><text class="advantage-icon">{{item.a}}</text><view class="advantage-info"><text class="advantage-title">{{item.b}}</text><text class="advantage-desc">{{item.c}}</text></view></view></view></view><view class="case-section"><section-header bindmore="{{e}}" u-i="767a328a-2" bind:__l="__l" u-p="{{f||''}}"></section-header><view class="case-list"><case-card wx:for="{{g}}" wx:for-item="item" wx:key="a" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d||''}}"></case-card></view></view><view class="booking-section" bindtap="{{h}}"><view class="booking-content"><view class="booking-left"><text class="booking-title">免费上门评估</text><text class="booking-desc">专业师傅免费上门,为您的沙发量身定制翻新方案</text></view><view class="booking-btn"><text class="booking-btn-text">立即预约</text></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{i}}" change:eS="{{uV.sS}}" eS="{{$eS[i]}}" change:eA="{{uV.sA}}" eA="{{$eA[i]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><nav-bar u-i="0a3a932a-0" bind:__l="__l" u-p="{{a||''}}"></nav-bar><scroll-view class="page-content" scroll-y enable-flex="true" enhanced="true"><view class="banner-section"><swiper class="banner-swiper" circular autoplay indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="#ffffff"><swiper-item wx:for="{{b}}" wx:for-item="item" wx:key="c"><image class="banner-image" src="{{item.a}}" mode="aspectFill" bindtap="{{item.b}}"></image></swiper-item></swiper></view><view class="service-section"><view class="service-grid"><service-card wx:for="{{c}}" wx:for-item="item" wx:key="b" id="{{item.a}}" virtualHostId="{{item.a}}" bindclick="{{item.c}}" u-i="{{item.d}}" bind:__l="__l" u-p="{{item.e||''}}"></service-card></view></view><view class="advantage-section"><view class="advantage-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="d" class="advantage-item"><text class="advantage-icon">{{item.a}}</text><view class="advantage-info"><text class="advantage-title">{{item.b}}</text><text class="advantage-desc">{{item.c}}</text></view></view></view></view><view class="case-section"><section-header bindmore="{{e}}" u-i="0a3a932a-2" bind:__l="__l" u-p="{{f||''}}"></section-header><view class="case-list"><case-card wx:for="{{g}}" wx:for-item="item" wx:key="a" bindclick="{{item.b}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d||''}}"></case-card></view></view><view class="booking-section" bindtap="{{h}}"><view class="booking-content"><view class="booking-left"><text class="booking-title">免费上门评估</text><text class="booking-desc">专业师傅免费上门,为您的沙发量身定制翻新方案</text></view><view class="booking-btn"><text class="booking-btn-text">立即预约</text></view></view></view><view class="bottom-space"></view></scroll-view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view id="{{j}}" change:eS="{{uV.sS}}" eS="{{$eS[j]}}" change:eA="{{uV.sA}}" eA="{{$eA[j]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="banner"><view class="banner-content"><text class="banner-title">专业沙发翻新服务</text><text class="banner-desc">让旧沙发焕发新生</text></view></view><view class="section"><section-header u-i="7558dcb8-0" bind:__l="__l" u-p="{{a||''}}"></section-header><view class="service-grid"><view wx:for="{{b}}" wx:for-item="item" wx:key="d" class="service-item" bindtap="{{item.e}}"><view class="service-icon-bg"><text class="service-icon">{{item.a}}</text></view><text class="service-name">{{item.b}}</text><text class="service-desc">{{item.c}}</text></view></view></view><view class="section"><section-header u-i="7558dcb8-1" bind:__l="__l" u-p="{{c||''}}"></section-header><view class="process-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="e" class="process-item"><view class="process-step"><text class="step-num">{{item.a}}</text></view><view class="process-content"><text class="process-title">{{item.b}}</text><text class="process-desc">{{item.c}}</text></view><view wx:if="{{item.d}}" class="process-line"></view></view></view></view><view class="section"><section-header u-i="7558dcb8-2" bind:__l="__l" u-p="{{e||''}}"></section-header><view class="material-list"><view wx:for="{{f}}" wx:for-item="item" wx:key="e" class="material-item"><view class="material-header"><text class="material-name">{{item.a}}</text><text class="material-price">{{item.b}}</text></view><text class="material-desc">{{item.c}}</text><view class="material-tags"><text wx:for="{{item.d}}" wx:for-item="tag" wx:key="b" class="material-tag">{{tag.a}}</text></view></view></view></view><view class="section"><section-header u-i="7558dcb8-3" bind:__l="__l" u-p="{{g||''}}"></section-header><view class="faq-list"><view wx:for="{{h}}" wx:for-item="item" wx:key="e" class="faq-item" bindtap="{{item.f}}"><view class="faq-header"><text class="faq-question">{{item.a}}</text><text class="faq-arrow">{{item.b}}</text></view><view wx:if="{{item.c}}" class="faq-answer"><text class="faq-answer-text">{{item.d}}</text></view></view></view></view><view class="bottom-space"></view></scroll-view><view class="bottom-bar"><view class="bar-info"><text class="bar-title">免费上门评估</text><text class="bar-desc">专业师傅为您量身定制方案</text></view><view class="bar-btn" bindtap="{{i}}"><text class="bar-btn-text">立即预约</text></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
<view id="{{j}}" change:eS="{{uV.sS}}" eS="{{$eS[j]}}" change:eA="{{uV.sA}}" eA="{{$eA[j]}}" class="{{['page', virtualHostClass]}}" style="{{virtualHostStyle}}" hidden="{{virtualHostHidden || false}}"><scroll-view class="page-scroll" scroll-y enable-flex="true" enhanced="true"><view class="banner"><view class="banner-content"><text class="banner-title">专业沙发翻新服务</text><text class="banner-desc">让旧沙发焕发新生</text></view></view><view class="section"><section-header u-i="3b972967-0" bind:__l="__l" u-p="{{a||''}}"></section-header><view class="service-grid"><view wx:for="{{b}}" wx:for-item="item" wx:key="d" class="service-item" bindtap="{{item.e}}"><view class="service-icon-bg"><text class="service-icon">{{item.a}}</text></view><text class="service-name">{{item.b}}</text><text class="service-desc">{{item.c}}</text></view></view></view><view class="section"><section-header u-i="3b972967-1" bind:__l="__l" u-p="{{c||''}}"></section-header><view class="process-list"><view wx:for="{{d}}" wx:for-item="item" wx:key="e" class="process-item"><view class="process-step"><text class="step-num">{{item.a}}</text></view><view class="process-content"><text class="process-title">{{item.b}}</text><text class="process-desc">{{item.c}}</text></view><view wx:if="{{item.d}}" class="process-line"></view></view></view></view><view class="section"><section-header u-i="3b972967-2" bind:__l="__l" u-p="{{e||''}}"></section-header><view class="material-list"><view wx:for="{{f}}" wx:for-item="item" wx:key="e" class="material-item"><view class="material-header"><text class="material-name">{{item.a}}</text><text class="material-price">{{item.b}}</text></view><text class="material-desc">{{item.c}}</text><view class="material-tags"><text wx:for="{{item.d}}" wx:for-item="tag" wx:key="b" class="material-tag">{{tag.a}}</text></view></view></view></view><view class="section"><section-header u-i="3b972967-3" bind:__l="__l" u-p="{{g||''}}"></section-header><view class="faq-list"><view wx:for="{{h}}" wx:for-item="item" wx:key="e" class="faq-item" bindtap="{{item.f}}"><view class="faq-header"><text class="faq-question">{{item.a}}</text><text class="faq-arrow">{{item.b}}</text></view><view wx:if="{{item.c}}" class="faq-answer"><text class="faq-answer-text">{{item.d}}</text></view></view></view></view><view class="bottom-space"></view></scroll-view><view class="bottom-bar"><view class="bar-info"><text class="bar-title">免费上门评估</text><text class="bar-desc">专业师傅为您量身定制方案</text></view><view class="bar-btn" bindtap="{{i}}"><text class="bar-btn-text">立即预约</text></view></view></view><wxs src="/common/uniView.wxs" module="uV"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const utils_config = require("../../utils/config.js");
|
||||
const api_index = require("../../api/index.js");
|
||||
class UserInfo extends UTS.UTSType {
|
||||
static get$UTSMetadata$() {
|
||||
return {
|
||||
@@ -67,33 +68,69 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
}
|
||||
}));
|
||||
};
|
||||
const fetchStats = () => {
|
||||
bookingCount.value = 0;
|
||||
const favorites = common_vendor.index.getStorageSync(utils_config.STORAGE_KEYS.FAVORITES);
|
||||
favoriteCount.value = favorites ? favorites.length : 0;
|
||||
};
|
||||
const handleLogin = () => {
|
||||
common_vendor.index.getUserProfile(new UTSJSONObject({
|
||||
desc: "用于完善用户资料",
|
||||
success: (res = null) => {
|
||||
userInfo.value = new UserInfo(
|
||||
{
|
||||
id: "",
|
||||
nickName: res.userInfo.nickName,
|
||||
avatar: res.userInfo.avatarUrl,
|
||||
phone: ""
|
||||
success: (profileRes = null) => {
|
||||
common_vendor.index.login(new UTSJSONObject({
|
||||
provider: "weixin",
|
||||
success: (loginRes) => {
|
||||
return common_vendor.__awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
const code = loginRes.code;
|
||||
try {
|
||||
const res = yield api_index.wechatLogin(code);
|
||||
if (res.code === 0 && res.data != null) {
|
||||
const data = res.data;
|
||||
const token = data["access_token"];
|
||||
const userDataObj = data["user"];
|
||||
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.TOKEN, token);
|
||||
userInfo.value = new UserInfo({
|
||||
id: String(userDataObj["id"]),
|
||||
nickName: profileRes.userInfo.nickName,
|
||||
avatar: profileRes.userInfo.avatarUrl,
|
||||
phone: (_a = userDataObj["phone"]) !== null && _a !== void 0 ? _a : ""
|
||||
});
|
||||
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.USER_INFO, new UTSJSONObject({
|
||||
id: userDataObj["id"],
|
||||
nickName: profileRes.userInfo.nickName,
|
||||
avatar: profileRes.userInfo.avatarUrl,
|
||||
phone: userDataObj["phone"]
|
||||
}));
|
||||
isLoggedIn.value = true;
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
fetchStats();
|
||||
} else {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/user/index.uvue:248", "登录失败", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败,请重试",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
// 保存用户信息
|
||||
);
|
||||
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.USER_INFO, new UTSJSONObject({
|
||||
nickName: res.userInfo.nickName,
|
||||
avatar: res.userInfo.avatarUrl
|
||||
}));
|
||||
common_vendor.index.setStorageSync(utils_config.STORAGE_KEYS.TOKEN, "mock_token_" + Date.now().toString());
|
||||
isLoggedIn.value = true;
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
title: "授权失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
@@ -123,15 +160,27 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
}));
|
||||
};
|
||||
const goToBookingList = () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "功能开发中",
|
||||
icon: "none"
|
||||
if (!isLoggedIn.value) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请先登录",
|
||||
icon: "none"
|
||||
});
|
||||
return null;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/user/booking-list"
|
||||
});
|
||||
};
|
||||
const goToFavorites = () => {
|
||||
common_vendor.index.showToast({
|
||||
title: "功能开发中",
|
||||
icon: "none"
|
||||
if (!isLoggedIn.value) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请先登录",
|
||||
icon: "none"
|
||||
});
|
||||
return null;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/user/favorites"
|
||||
});
|
||||
};
|
||||
const goToAbout = () => {
|
||||
|
||||
Reference in New Issue
Block a user