feat: 按林境门作原型完善静态小程序

This commit is contained in:
que01 committed 2026-09-22 16:43:29 +08:00
1 parent 4afb6bbbe8
commit 8489c8ca79
26 files changed
+92 -964

No files matched your search

+10 -62
View File
@@ -1,72 +1,20 @@
const { request, customerRequest } = require("../../utils/request");
const { bookingViewModel } = require("../../utils/labels");
const { getTemplate } = require("../../utils/templates");
const { brand, trustContent } = require("../../utils/linjing-data");
Page({
data: {
loading: true,
error: "",
bookings: [],
cancellingId: "",
template: getTemplate("personal"),
brand, trustContent, records: [],
},
onLoad() {
this.load();
this.setData({ records: wx.getStorageSync("linjingInquiryRecords") || [] });
},
onShow() {
this.load();
this.setData({ records: wx.getStorageSync("linjingInquiryRecords") || [] });
},
load() {
const token = wx.getStorageSync("customerToken");
if (!token) return this.setData({ loading: false, bookings: [], error: "" });
this.setData({ loading: true, error: "" });
Promise.all([customerRequest("/customer/bookings"), request("/public/brand")])
.then(([items, brand]) => {
getApp().globalData.brand = brand;
const template = getTemplate(brand.templateKey);
this.setData({
template,
bookings: (Array.isArray(items) ? items : []).map((item) =>
bookingViewModel(item, template),
),
loading: false,
});
})
.catch((error) => this.setData({ loading: false, error: error.message || "网络请求失败" }));
call() {
wx.makePhoneCall({ phoneNumber: brand.phone.replace(/[^0-9-]/g, "") });
},
retry() {
this.load();
},
contact() {
const brand = getApp().globalData.brand || {};
if (brand.contactPhone) return wx.makePhoneCall({ phoneNumber: brand.contactPhone });
if (brand.contactWechat)
return wx.showModal({
title: "联系品牌方",
content: "微信号:" + brand.contactWechat,
showCancel: false,
});
wx.showToast({ title: "暂未配置联系方式", icon: "none" });
},
cancel(e) {
const id = e.currentTarget.dataset.id;
if (this.data.cancellingId) return;
wx.showModal({
title: "取消预约",
content: "确定取消这笔预约吗?",
success: (result) => {
if (!result.confirm) return;
this.setData({ cancellingId: id });
customerRequest("/customer/bookings/" + id + "/cancel", { method: "POST", data: {} })
.then(() => {
this.setData({ cancellingId: "" });
wx.showToast({ title: "已取消预约", icon: "success" });
this.load();
})
.catch((error) => {
this.setData({ cancellingId: "" });
wx.showToast({ title: error.message || "取消失败", icon: "none" });
});
},
});
copyWechat() { wx.setClipboardData({ data: brand.wechat, success: () => wx.showToast({ title: "微信号已复制", icon: "none" }) }); },
recordsPage() { wx.navigateTo({ url: "/pages/records/index" }); },
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
});
+1 -4
View File
@@ -2,8 +2,5 @@
"navigationBarTitleText": "我的订单",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": {
"brand-loading": "/components/ui/brand-loading/brand-loading",
"brand-empty": "/components/ui/brand-empty/brand-empty"
}
"usingComponents": { "t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon" }
}
+1 -16
View File
@@ -1,16 +1 @@
<view class="page">
<view class="heading-row"><text class="heading">我的订单</text><text class="phone" bindtap="contact">☎</text></view>
<brand-loading wx:if="{{loading}}" />
<view wx:elif="{{error}}" class="inline-error"><text>{{error}}</text><button size="mini" bindtap="retry">重新加载</button></view>
<brand-empty wx:elif="{{!bookings.length}}" description="完成预约后,订单会显示在这里" />
<block wx:else>
<view class="status-banner"><view><text class="status-title">订单状态</text><text class="status-sub">查看每笔预约的最新进展</text></view><text class="check">✓</text></view>
<view wx:for="{{bookings}}" wx:key="id" class="card">
<view class="card-visual"><view class="dish-placeholder"></view><view class="card-main"><text class="name">{{item.serviceName}}</text><text class="summary">{{item.quantityLabel}} · {{item.fulfillmentLabel}} · {{item.requestedTime || '时间待确认'}}</text></view></view>
<view class="card-foot"><text class="price">{{item.estimatedAmount ? '¥'+item.estimatedAmount/100 : '人工沟通报价'}}</text><text class="status">{{item.statusLabel}}</text></view>
<view class="actions"><button class="contact" size="mini" bindtap="contact">{{template.contactLabel}}</button><button class="cancel" wx:if="{{item.status === 'received'}}" loading="{{cancellingId === item.id}}" disabled="{{!!cancellingId}}" size="mini" data-id="{{item.id}}" bindtap="cancel">{{cancellingId === item.id ? '取消中...' : template.cancelLabel}}</button></view>
<text class="cancel-note" wx:if="{{item.status === 'received'}}">{{template.cancelNote}}</text>
</view>
<view class="faq"><view class="faq-title">常见问题 <text>›</text></view><view>○ 怎么确认预约? <text>›</text></view><view>○ 配送范围有多远? <text>›</text></view><view>○ 可以改时间吗? <text>›</text></view></view>
</block>
</view>
<view class="page"><view class="contact-card"><view class="identity"><view class="avatar">林</view><view><text class="founder">{{brand.founder}}</text><text class="role">{{brand.title}}</text></view></view><view class="contact-line"><text>专线电话</text><view><text>{{brand.phone}}</text><button bindtap="call"><t-icon name="call" size="28rpx"/> 呼叫</button></view></view><view class="contact-line"><text>工作室微信</text><view><text>{{brand.wechat}}</text><button bindtap="copyWechat"><t-icon name="file-copy" size="28rpx"/> 复制</button></view></view><view class="contact-line address"><text>实体工坊</text><text>{{brand.studioAddress}}</text></view></view><view class="records-entry" bindtap="recordsPage"><view class="entry-icon"><t-icon name="logo-notion" size="38rpx"/></view><view class="entry-copy"><text>我的量房与定制咨询</text><text>追踪主理人出图进度与现场勘测排期</text></view><text class="count">{{records.length}} 条记录 <t-icon name="chevron-right" size="30rpx"/></text></view><view class="info-card"><view class="card-title"><t-icon name="map" size="34rpx"/> <text>直派服务区域与履约说明</text></view><view class="note"><text class="note-title">直派核心圈:</text><text>上海、杭州、宁波、苏州、无锡、南京及深圳、广州。主理人及资深装配总工亲赴现场。</text></view><view class="note"><text class="note-title">全国其他城市私邸:</text><text>接受建筑设计师联合委托,安排远程 3D 激光测绘支持与专用物流直运安装。</text></view></view><view class="info-card"><view class="card-title"><t-icon name="secured" size="34rpx"/> <text>一门一档 · 终生质保规约</text></view><text class="bullet">门体内部防变形航空合金骨架承诺 10 年结构质保;</text><text class="bullet">重型天地轴、进口地弹簧及磁吸五金 5 年免费维护;</text><text class="bullet">每樘门出厂前进行 5000 次启闭校正;</text><text class="bullet">原木天然肌理享有首年 2 次木蜡油保养服务。</text></view></view>
+3 -170
View File
@@ -1,170 +1,3 @@
.page {
min-height: 100vh;
padding: 24rpx 32rpx 60rpx;
background: #fbf7f1;
color: #2b2b2b;
}
.heading-row {
display: flex;
justify-content: space-between;
align-items: center;
margin: 12rpx 0 32rpx;
}
.heading {
font-size: 48rpx;
font-weight: 700;
}
.phone {
font-size: 48rpx;
color: #7a4a2b;
}
.status-banner {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
padding: 34rpx 32rpx;
background: #f4ebd9;
border-radius: 16rpx;
}
.status-title {
display: block;
font-size: 40rpx;
font-weight: 700;
}
.status-sub {
display: block;
margin-top: 10rpx;
font-size: 28rpx;
}
.check {
color: #b54a2c;
font-size: 88rpx;
line-height: 1;
}
.card {
margin-bottom: 18rpx;
padding: 22rpx;
background: #f4ebd9;
border-radius: 16rpx;
}
.card-visual {
display: flex;
gap: 20rpx;
align-items: center;
}
.dish-placeholder {
width: 190rpx;
height: 190rpx;
flex: none;
border-radius: 12rpx;
background: #c79555;
}
.name {
display: block;
font-size: 36rpx;
font-weight: 700;
margin-bottom: 14rpx;
}
.summary {
font-size: 28rpx;
line-height: 1.6;
}
.card-foot {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 24rpx;
padding: 18rpx 4rpx;
border-top: 1rpx solid #dfcda9;
}
.status {
padding: 8rpx 20rpx;
border: 1rpx solid #b54a2c;
border-radius: 30rpx;
color: #b54a2c;
}
.price {
color: #b54a2c;
font-size: 42rpx;
}
.actions {
display: flex;
gap: 16rpx;
margin-top: 18rpx;
}
.actions button {
flex: 1;
border-radius: 12rpx;
font-size: 29rpx;
}
.contact {
background: #2b2b2b;
color: #fff;
}
.cancel {
background: #b54a2c;
color: #fff;
}
.cancel-note {
display: block;
margin-top: 18rpx;
text-align: center;
font-size: 25rpx;
}
.faq {
margin-top: 24rpx;
padding: 28rpx 30rpx;
background: #fff;
border-radius: 16rpx;
}
.faq view {
padding: 20rpx 0;
border-bottom: 1rpx solid #eee;
font-size: 29rpx;
}
.faq view:last-child {
border-bottom: 0;
}
.faq-title {
font-size: 36rpx !important;
font-weight: 700;
}
.faq text {
float: right;
color: #7a4a2b;
font-size: 40rpx;
}
.state,
.empty {
text-align: center;
padding: 100rpx 20rpx;
color: #7a4a2b;
}
.check {
box-sizing: border-box;
display: flex;
width: 108rpx;
height: 108rpx;
align-items: center;
justify-content: center;
padding: 18rpx;
border: 8rpx solid #b54a2c;
border-radius: 50%;
color: #b54a2c;
font-size: 56rpx;
line-height: 1;
}
.inline-error {
padding: 72rpx 32rpx;
display: flex;
flex-direction: column;
align-items: center;
color: var(--brand-color-muted);
}
.inline-error button {
margin-top: 24rpx;
color: var(--brand-color-primary);
background: var(--brand-color-subtle);
}
.page{min-height:100vh;padding:28rpx 32rpx 56rpx;background:#f7f5f1;color:#252525}.contact-card{padding:34rpx 30rpx;background:#202221;color:#fff;border-radius:18rpx}.identity{display:flex;align-items:center;gap:20rpx}.avatar{width:88rpx;height:88rpx;border:2rpx solid #8a6846;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#d9c8b2;font:42rpx serif}.founder{display:block;font:34rpx serif}.role{display:block;margin-top:8rpx;color:#d9c8b2;font-size:22rpx}.contact-line{display:flex;justify-content:space-between;align-items:center;margin-top:22rpx;padding-top:18rpx;border-top:1rpx solid rgba(255,255,255,.12);color:#aaa;font-size:23rpx}.contact-line>view{display:flex;align-items:center;gap:10rpx;color:#fff}.contact-line button{margin:0;padding:0 14rpx;background:rgba(255,255,255,.1);color:#d9c8b2;font-size:21rpx}.records-entry,.info-card{margin-top:20rpx;padding:28rpx;background:#fff;border:1rpx solid #e6ded5;border-radius:16rpx}.records-entry{display:flex;justify-content:space-between;font-size:26rpx}.records-entry text:last-child{color:#8a6846}.card-title{display:block;font-weight:700;font-size:27rpx}.note,.bullet{display:block;margin-top:16rpx;color:#77736b;font-size:24rpx;line-height:1.75}
.entry-icon{width:64rpx;height:64rpx;border-radius:12rpx;background:rgba(138,104,70,.1);color:#8a6846;display:flex;align-items:center;justify-content:center}.records-entry{align-items:center;gap:18rpx}.entry-copy{flex:1}.entry-copy text{display:block}.entry-copy text:last-child{margin-top:8rpx;color:#77736b;font-size:21rpx}.count{color:#8a6846;font-size:22rpx}.card-title{display:flex;align-items:center;gap:12rpx;color:#202221}.note{padding:20rpx;background:#f7f5f1;border:1rpx solid #e6ded5;border-radius:12rpx}.note-title{display:block;margin-bottom:6rpx;color:#202221;font-weight:700}.bullet{padding-left:8rpx}
.contact-line button{display:flex;align-items:center;justify-content:center;gap:6rpx;height:44rpx;line-height:44rpx;white-space:nowrap}.contact-line button t-icon{display:inline-flex;vertical-align:middle}