fix: 收敛模板编辑发布契约并还原餐饮页面视觉
This commit is contained in:
1 parent
20bcb43534
commit
f4061a24bd
102 files changed
+4510
-870
No files matched your search
@@ -1,18 +1,71 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { openPage } = require("../../utils/navigation");
|
||||
// 每种内容对应一个固定视觉区域,按已配置记录优先选择,避免旧记录遮住编辑结果。
|
||||
function selectSlot(items, type) {
|
||||
return (
|
||||
items
|
||||
.filter((item) => item.type === type)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
Number(Object.keys(b.config || {}).length > 0) -
|
||||
Number(Object.keys(a.config || {}).length > 0),
|
||||
)[0] || null
|
||||
);
|
||||
}
|
||||
Page({
|
||||
data: { brand: {}, presentation: {}, trustItems: [], loading: true },
|
||||
data: {
|
||||
brand: {},
|
||||
presentation: {},
|
||||
schedule: null,
|
||||
coverage: null,
|
||||
process: null,
|
||||
loading: true,
|
||||
error: false,
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
this.setData({ loading: true, error: false });
|
||||
return loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const items = workspace.trustItems || [];
|
||||
const schedule = selectSlot(items, "schedule");
|
||||
const coverage = selectSlot(items, "coverage");
|
||||
const process = selectSlot(items, "process");
|
||||
const config = schedule?.config || {};
|
||||
const rows = [
|
||||
{
|
||||
title: config.weekdayLabel,
|
||||
detail: config.weekdayDetail,
|
||||
hours: config.weekdayHours,
|
||||
tag: config.weekdayTag,
|
||||
tone: "orange",
|
||||
},
|
||||
{
|
||||
title: config.weekendLabel,
|
||||
detail: config.weekendDetail,
|
||||
hours: config.weekendHours,
|
||||
tag: config.weekendTag,
|
||||
tone: "blue",
|
||||
},
|
||||
].filter((row) => row.title && row.detail);
|
||||
const steps = Array.isArray(process?.config?.steps)
|
||||
? process.config.steps
|
||||
.filter((step) => step.title && step.detail)
|
||||
.map((step, index) => ({ ...step, index }))
|
||||
: [];
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
presentation: workspace.brand?.visualPresentation?.service || {},
|
||||
trustItems: workspace.trustItems || [],
|
||||
schedule: rows.length ? { ...schedule, rows } : null,
|
||||
coverage:
|
||||
coverage?.config?.pickupDetail && coverage?.config?.deliveryDetail ? coverage : null,
|
||||
process: steps.length ? { ...process, steps } : null,
|
||||
loading: false,
|
||||
}),
|
||||
)
|
||||
.catch(() => this.setData({ loading: false }));
|
||||
});
|
||||
})
|
||||
.catch(() => this.setData({ loading: false, error: true }));
|
||||
},
|
||||
inquire() {
|
||||
openPage("/pages/inquiry/index");
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
<view class="page service-page">
|
||||
<block wx:for="{{trustItems}}" wx:key="title">
|
||||
<view wx:if="{{item.type === 'schedule'}}" class="service-card"><view class="card-head"><view class="head-title"><text class="icon">◷</text><text>{{item.title}}</text></view></view><view class="schedule schedule-primary"><view class="schedule-main"><view class="schedule-title"><text class="dot orange"></text><text>{{item.summary || item.title}}</text></view><text class="schedule-line">{{item.content}}</text></view></view></view>
|
||||
<view wx:if="{{item.type === 'coverage'}}" class="service-card"><view class="card-title"><text class="icon">⌁</text><text>{{item.title}}</text></view><view class="delivery-grid"><view class="delivery-item"><text class="delivery-title orange-text">{{presentation.coverageLabel || '服务范围'}}</text><text>{{item.content}}</text></view></view></view>
|
||||
<view wx:if="{{item.type === 'process'}}" class="service-card process-card"><view class="card-title"><text class="icon">☷</text><text>{{item.title}}</text></view><text wx:if="{{item.summary}}" class="card-sub">{{item.summary}}</text><view class="steps"><view wx:for="{{item.lines}}" wx:for-item="step" wx:key="*this" class="step"><text class="step-no">{{index + 1}}</text><view><text class="step-title">{{presentation.stepLabel || '步骤'}} {{index + 1}}</text><text>{{step}}</text></view></view></view><view class="process-foot"><text>{{item.content}}</text><button bindtap="inquire">{{presentation.processAction || '立即咨询'}} <text>→</text></button></view></view>
|
||||
<view wx:if="{{loading}}" class="empty-state">正在加载出摊服务…</view>
|
||||
<view wx:elif="{{error}}" class="empty-state">服务信息加载失败<button bindtap="load">重试</button></view>
|
||||
<block wx:else>
|
||||
<view wx:if="{{schedule}}" class="service-card schedule-card">
|
||||
<view class="card-head"><view class="head-title"><image class="icon" src="../../assets/service/clock.png" /><text>{{schedule.title}}</text></view><text wx:if="{{schedule.config.status}}" class="status-pill">{{schedule.config.status}}</text></view>
|
||||
<view wx:for="{{schedule.rows}}" wx:for-item="row" wx:key="tone" class="schedule {{row.tone === 'blue' ? 'schedule-weekend' : 'schedule-primary'}}">
|
||||
<view class="schedule-row-head"><view class="schedule-title"><text class="dot {{row.tone}}"></text><text>{{row.title}}</text></view><text wx:if="{{row.tag}}" class="schedule-tag {{row.tone === 'blue' ? 'blue-tag' : 'orange-tag'}}">{{row.tag}}</text></view>
|
||||
<text class="schedule-line">{{row.detail}}</text><text wx:if="{{row.hours}}" class="schedule-muted">{{row.hours}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{coverage}}" class="service-card coverage-card"><view class="simple-title"><image class="icon" src="../../assets/service/bike.png" /><text>{{coverage.title}}</text></view><view class="delivery-grid"><view class="delivery-item"><view class="delivery-title"><image class="small-icon" src="../../assets/service/footprints.png" /><text>{{coverage.config.pickupTitle}}</text></view><text>{{coverage.config.pickupDetail}}</text></view><view class="delivery-item"><view class="delivery-title"><image class="small-icon" src="../../assets/service/bike-blue.png" /><text>{{coverage.config.deliveryTitle}}</text></view><text>{{coverage.config.deliveryDetail}}</text></view></view></view>
|
||||
<view wx:if="{{process}}" class="service-card process-card"><view class="simple-title"><image class="icon" src="../../assets/service/list.png" /><text>{{process.title}}</text></view><text wx:if="{{process.config.intro}}" class="card-sub">{{process.config.intro}}</text><view class="steps"><view wx:for="{{process.steps}}" wx:for-item="step" wx:key="index" class="step"><text class="step-no">{{index + 1}}</text><view><text class="step-title">{{step.title}}</text><text>{{step.detail}}</text></view></view></view><view class="process-foot"><view><text wx:if="{{process.config.minimumNote}}">{{process.config.minimumNote}}</text><text wx:if="{{process.config.minimumNote && process.config.refundNote}}" class="divider">|</text><text wx:if="{{process.config.refundNote}}">{{process.config.refundNote}}</text></view><button bindtap="inquire">{{presentation.processAction || '立即咨询'}} <text>→</text></button></view></view>
|
||||
<view wx:if="{{!schedule && !coverage && !process}}" class="empty-state">出摊服务信息正在完善中</view>
|
||||
</block>
|
||||
</view>
|
||||
@@ -1,14 +1,14 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 28rpx 32rpx 150rpx;
|
||||
padding: 32rpx 32rpx 64rpx;
|
||||
background: #f7f5f1;
|
||||
color: #292725;
|
||||
}
|
||||
.service-card {
|
||||
margin-bottom: 24rpx;
|
||||
padding: 30rpx 28rpx;
|
||||
margin-bottom: 28rpx;
|
||||
padding: 32rpx;
|
||||
border: 1rpx solid #eee9e3;
|
||||
border-radius: 28rpx;
|
||||
border-radius: 48rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 8rpx 20rpx rgba(60, 45, 30, 0.035);
|
||||
}
|
||||
@@ -20,9 +20,17 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.simple-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
color: #302d29;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.card-head {
|
||||
justify-content: space-between;
|
||||
padding-bottom: 22rpx;
|
||||
padding-bottom: 24rpx;
|
||||
border-bottom: 1rpx solid #eeeae5;
|
||||
}
|
||||
.head-title,
|
||||
@@ -46,13 +54,10 @@
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.schedule {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
margin-top: 22rpx;
|
||||
padding: 22rpx 18rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 24rpx;
|
||||
border: 1rpx solid #f1ddd0;
|
||||
border-radius: 20rpx;
|
||||
border-radius: 32rpx;
|
||||
}
|
||||
.schedule-primary {
|
||||
background: #fffaf6;
|
||||
@@ -67,7 +72,7 @@
|
||||
.schedule-title {
|
||||
gap: 12rpx;
|
||||
color: #272522;
|
||||
font-size: 22rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.dot {
|
||||
@@ -88,13 +93,13 @@
|
||||
margin-top: 12rpx;
|
||||
margin-left: 26rpx;
|
||||
color: #655e56;
|
||||
font-size: 20rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.schedule-muted {
|
||||
margin-top: 5rpx;
|
||||
color: #9a948c;
|
||||
font-size: 18rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.schedule-tag {
|
||||
height: max-content;
|
||||
@@ -114,22 +119,22 @@
|
||||
.delivery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 18rpx;
|
||||
margin-top: 22rpx;
|
||||
gap: 20rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
.delivery-item {
|
||||
padding: 20rpx;
|
||||
padding: 24rpx;
|
||||
border: 1rpx solid #eeeae5;
|
||||
border-radius: 20rpx;
|
||||
border-radius: 32rpx;
|
||||
background: #fbfaf8;
|
||||
color: #777169;
|
||||
font-size: 19rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.delivery-title {
|
||||
display: block;
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 22rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.orange-text {
|
||||
@@ -142,10 +147,10 @@
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
color: #8b857e;
|
||||
font-size: 19rpx;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.steps {
|
||||
margin: 24rpx 0 0 14rpx;
|
||||
margin: 28rpx 0 0 16rpx;
|
||||
padding-left: 26rpx;
|
||||
border-left: 3rpx solid #f7cda9;
|
||||
}
|
||||
@@ -155,7 +160,7 @@
|
||||
gap: 18rpx;
|
||||
margin-bottom: 26rpx;
|
||||
color: #79736c;
|
||||
font-size: 19rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.step:last-child {
|
||||
@@ -173,24 +178,24 @@
|
||||
border-radius: 50%;
|
||||
background: #ef7c26;
|
||||
color: #fff;
|
||||
font-size: 18rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.step-title {
|
||||
display: block;
|
||||
margin-bottom: 5rpx;
|
||||
color: #3d3934;
|
||||
font-size: 22rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.process-foot {
|
||||
justify-content: space-between;
|
||||
gap: 12rpx;
|
||||
margin-top: 28rpx;
|
||||
padding-top: 22rpx;
|
||||
margin-top: 32rpx;
|
||||
padding-top: 24rpx;
|
||||
border-top: 1rpx solid #eeeae5;
|
||||
color: #777169;
|
||||
font-size: 18rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.strong {
|
||||
@@ -215,3 +220,31 @@
|
||||
margin-left: 8rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.schedule-row-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
flex: none;
|
||||
}
|
||||
.small-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-right: 12rpx;
|
||||
flex: none;
|
||||
}
|
||||
.delivery-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #1c1917;
|
||||
}
|
||||
.empty-state {
|
||||
padding: 64rpx 0;
|
||||
text-align: center;
|
||||
color: #78716c;
|
||||
}
|
||||
Reference in new issue
Block a user