feat: 完善模板内容后台配置能力

This commit is contained in:
que01 committed 2026-09-28 17:30:34 +08:00
1 parent 2bc2193b44
commit 9266ec824a
37 files changed
+2273 -63

No files matched your search

@@ -1,7 +1,7 @@
{
"pages": ["pages/index/index"],
"window": {
"navigationBarTitleText": "阿成校园餐",
"navigationBarTitleText": "品牌首页",
"navigationBarBackgroundColor": "#FFF8F0",
"navigationBarTextStyle": "black"
},
@@ -1 +1 @@
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '今日出摊点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text class="notice-time">{{presentation.stallTime || '17:00 - 22:30 · 今日营业中'}}</text><text wx:for="{{trustItems}}" wx:if="{{item.type === 'schedule'}}" wx:key="title" class="notice-desc">{{item.content}}</text></view><view class="actions"><button bindtap="openInquiry">预约 / 定制</button><button class="muted" bindtap="openOfferings">今日菜单</button></view></view><view class="scene-wrap"><view class="section-head"><text class="eyebrow">真实出摊现场</text><text class="more">{{brand.name}}</text></view><image src="{{brand.heroImage}}" mode="aspectFill" bindtap="openService"/></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '今日餐品与预订'}}</text><text class="heading">{{presentation.worksTitle || '套餐、聚餐与定制餐'}}</text></view><text class="more" bindtap="openOfferings">全部餐品 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view wx:for="{{trustItems}}" wx:if="{{item.type === 'promise' || item.type === 'case'}}" wx:key="title" class="promise"><text class="eyebrow light">{{item.title}}</text><text class="promise-title">{{item.summary}}</text><text class="quote">{{item.content}}</text></view></view>
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '服务地点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text wx:if="{{presentation.stallTime}}" class="notice-time">{{presentation.stallTime}}</text><text wx:for="{{trustItems}}" wx:if="{{item.type === 'schedule'}}" wx:key="title" class="notice-desc">{{item.content}}</text></view><view class="actions"><button bindtap="openInquiry">咨询 / 预订</button><button class="muted" bindtap="openOfferings">查看餐品</button></view></view><view class="scene-wrap"><view class="section-head"><text class="eyebrow">{{brand.name}}</text></view><image src="{{brand.heroImage}}" mode="aspectFill" bindtap="openService"/></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '餐品与服务'}}</text><text class="heading">{{presentation.worksTitle || '可选餐品'}}</text></view><text class="more" bindtap="openOfferings">查看全部 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view wx:for="{{trustItems}}" wx:if="{{item.type === 'promise' || item.type === 'case'}}" wx:key="title" class="promise"><text class="eyebrow light">{{item.title}}</text><text class="promise-title">{{item.summary}}</text><text class="quote">{{item.content}}</text></view></view>
@@ -1 +1 @@
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '今日菜单'}}</text><text class="subtitle">{{presentation.subtitle || '现做现吃,支持提前预留和团体定制'}}</text></view><view wx:if="{{categories.length > 1}}" class="filters"><view wx:for="{{categories}}" wx:key="key" class="filter {{item.key === category ? 'active' : ''}}" data-key="{{item.key}}" bindtap="chooseCategory">{{item.label}}</view></view><view class="search"><text class="search-icon">⌕</text><input value="{{query}}" placeholder="搜索餐品、牛肉、卤肉、鸡腿" bindinput="search" /></view><view class="tip">米饭免费续,支持微辣、免葱姜蒜,团体餐可提前预留。</view><view class="list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><view class="dish-media"><image src="{{item.image}}" mode="aspectFill"/><text class="tag">{{item.category || '现做餐品'}}</text></view><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="chips"><text>现做</text><text>今日有售</text></view><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">详情 / 预留 ›</text></view></view></view></view><button class="cta" bindtap="inquire">团体活动 / 定制餐咨询</button></view>
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '餐品与服务'}}</text><text class="subtitle">{{presentation.subtitle}}</text></view><view wx:if="{{categories.length > 1}}" class="filters"><view wx:for="{{categories}}" wx:key="key" class="filter {{item.key === category ? 'active' : ''}}" data-key="{{item.key}}" bindtap="chooseCategory">{{item.label}}</view></view><view class="search"><text class="search-icon">⌕</text><input value="{{query}}" placeholder="搜索餐品" bindinput="search" /></view><view wx:if="{{presentation.menuTip}}" class="tip">{{presentation.menuTip}}</view><view class="list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><view class="dish-media"><image src="{{item.image}}" mode="aspectFill"/><text class="tag">{{item.category || '餐品'}}</text></view><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">查看详情 ›</text></view></view></view></view><button class="cta" bindtap="inquire">咨询 / 预订</button></view>
@@ -1 +1 @@
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '出摊与配送'}}</text><text>{{brand.studioAddress || brand.address}}</text><text>{{presentation.coverageContent || '支持校园摊位自取、宿舍配送和班级活动定制。'}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '服务地点与方式'}}</text><text>{{brand.studioAddress || brand.address}}</text><text wx:if="{{presentation.coverageContent}}">{{presentation.coverageContent}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
@@ -5,14 +5,15 @@ Page({
data: { brand: {}, presentation: {}, trustItems: [], offerings: [], error: "" },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
.then((workspace) => {
this.setData({
brand: workspace.brand || {},
presentation: workspace.brand?.visualPresentation?.home || {},
trustItems: workspace.trustItems || [],
offerings: workspace.offerings || [],
}),
)
});
wx.setNavigationBarTitle({ title: workspace.brand?.name || "品牌首页" });
})
.catch((error) => this.setData({ error: error.message }));
},
selectOffering(event) {
@@ -1,5 +1,5 @@
{
"navigationBarTitleText": "阿成校园餐",
"navigationBarTitleText": "品牌首页",
"usingComponents": {
"acheng-home": "/components/templates/acheng-home/acheng-home"
}
@@ -34,12 +34,14 @@ Page({
formId: "",
submitting: false,
formError: "",
presentation: {},
},
onLoad(options) {
this.offeringId = options.offeringId || "";
loadWorkspaceWithFallback()
.then((workspace) => {
this.forms = workspace.inquiryForms || [];
this.setData({ presentation: workspace.brand?.visualPresentation?.inquiry || {} });
this.selectForm();
})
.catch((error) => this.setData({ formError: error.message }));
@@ -112,7 +114,7 @@ Page({
wx.setStorageSync("latestInquirySubmission", result);
this.setData({ submitting: false, subView: "history" });
this.loadRecords();
wx.showToast({ title: "已提交,阿成会尽快联系你", icon: "none" });
wx.showToast({ title: "咨询已提交", icon: "none" });
});
const fail = (error) =>
this.setData({ submitting: false, formError: error.message || "提交失败,请重试" });
@@ -2,8 +2,8 @@
<view class="sub-tabs"><view class="sub-tab {{subView === 'form' ? 'active' : ''}}" data-view="form" bindtap="switchView">▤ 新建咨询 / 预订</view><view class="sub-tab {{subView === 'history' ? 'active' : ''}}" data-view="history" bindtap="switchView">▣ 我的咨询记录 ({{records.length}})</view></view>
<block wx:if="{{subView === 'form'}}">
<view class="form-card">
<text class="form-title">定制 / 预留需求登记</text>
<text class="form-desc">告诉阿成时间与人数,阿成量身帮你们排菜(免收预约定金)</text>
<text class="form-title">{{presentation.title || '咨询 / 预订'}}</text>
<text wx:if="{{presentation.subtitle}}" class="form-desc">{{presentation.subtitle}}</text>
<view wx:for="{{fields}}" wx:key="key" class="field">
<text class="label">{{item.label}} <b wx:if="{{item.required}}">*</b></text>
<picker wx:if="{{item.type === 'select' || item.type === 'radio'}}" range="{{item.options}}" range-key="label" data-key="{{item.key}}" bindchange="choose"><view class="picker">{{values[item.key] || '请选择' + item.label}}</view></picker>
@@ -12,21 +12,20 @@
<input wx:else type="{{item.type === 'number' ? 'number' : 'text'}}" value="{{values[item.key]}}" data-key="{{item.key}}" bindinput="input" placeholder="{{item.placeholder || '请填写' + item.label}}" />
</view>
<view wx:if="{{formError}}" class="error">! {{formError}}</view>
<view class="promise">◷ <text>承诺:阿成将在 15~30 分钟内主动加微信沟通,未成单绝不骚扰。</text></view>
<button class="submit" loading="{{submitting}}" bindtap="submit">➤ 立即提交咨询(免收定金)</button>
<view wx:if="{{presentation.promise}}" class="promise"><text>{{presentation.promise}}</text></view>
<button class="submit" loading="{{submitting}}" bindtap="submit">{{presentation.submitLabel || '提交咨询'}}</button>
</view>
</block>
<block wx:else>
<view wx:if="{{!records.length}}" class="empty"><text class="empty-icon">▣</text><text class="empty-title">暂无咨询记录</text><text>快向阿成提交一份预订需求吧~</text><button bindtap="switchToForm">新建咨询</button></view>
<view wx:if="{{!records.length}}" class="empty"><text class="empty-icon">▣</text><text class="empty-title">暂无咨询记录</text><text>提交需求后,可以在这里查看处理进度。</text><button bindtap="switchToForm">新建咨询</button></view>
<view wx:else class="history-list">
<view wx:for="{{records}}" wx:key="id" class="history-card">
<view class="history-head"><text class="record-id">单号 #{{item.id}}</text><text class="record-status">{{item.status}}</text></view>
<text class="history-title">{{item.title}}</text>
<text wx:for="{{item.summary}}" wx:for-item="line" wx:key="key">{{line.label}}:{{line.value}}</text>
<view wx:if="{{item.replyNote}}" class="reply"><b>阿成微信留言:</b>{{item.replyNote}}</view>
<view class="history-foot">提交时间:{{item.createdAt}}<text>如有修改可随时微信留言</text></view>
<view wx:if="{{item.replyNote}}" class="reply"><b>处理回复:</b>{{item.replyNote}}</view>
<view class="history-foot">提交时间:{{item.createdAt}}</view>
</view>
<text class="history-note">仅展示近 30 天内的微信预约咨询历史</text>
</view>
</block>
</view>
@@ -1,6 +1,6 @@
<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><text class="status-pill">准时出摊</text></view><view class="schedule schedule-primary"><view class="schedule-main"><view class="schedule-title"><text class="dot orange"></text><text>{{item.summary}}</text></view><text class="schedule-line">{{item.content}}</text></view></view></view>
<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}}</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">服务范围</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:key="*this" class="step"><text class="step-no">{{index + 1}}</text><view><text class="step-title">步骤 {{index + 1}}</text><text>{{item}}</text></view></view></view><view class="process-foot"><text>{{item.content}}</text><button bindtap="inquire">立即咨询 <text>→</text></button></view></view>
</block>
@@ -216,6 +216,24 @@
"input": "text",
"placeholder": "例如:17:00 - 22:30 · 今日营业中"
},
{
"key": "coverageContent",
"binding": "brand.config.visualPresentation.profile.coverageContent",
"label": "取餐与配送说明",
"input": "textarea"
},
{
"key": "coverageTitle",
"binding": "brand.config.visualPresentation.profile.coverageTitle",
"label": "服务方式标题",
"input": "text"
},
{
"key": "worksEyebrow",
"binding": "brand.config.visualPresentation.home.worksEyebrow",
"label": "餐品区域小标题",
"input": "text"
},
{
"key": "worksTitle",
"binding": "brand.config.visualPresentation.home.worksTitle",
@@ -248,6 +266,13 @@
"label": "菜单页说明",
"input": "textarea",
"maxLength": 120
},
{
"key": "menuTip",
"binding": "brand.config.visualPresentation.offerings.menuTip",
"label": "菜单提示",
"help": "只填写当前实际提供的取餐、加菜或定制服务。",
"input": "textarea"
}
]
},
@@ -276,6 +301,223 @@
"label": "提交按钮文字",
"input": "text",
"placeholder": "例如:提交预订需求"
},
{
"key": "promise",
"binding": "brand.config.visualPresentation.inquiry.promise",
"label": "真实服务承诺",
"help": "仅填写能兑现的回复时间、订金和联系规则;留空则不显示。",
"input": "textarea"
}
]
},
{
"key": "dishDetail",
"title": "餐品与服务详情",
"description": "每项餐品或服务单独填写;没有内容的详情区块不会展示。",
"target": "offering",
"fields": [
{
"key": "categoryLabel",
"binding": "offering.config.categoryLabel",
"label": "餐品类别",
"input": "text"
},
{
"key": "detailHero",
"binding": "offering.config.detailHero",
"label": "详情主图",
"input": "image"
},
{
"key": "area",
"binding": "offering.config.area",
"label": "供应地点",
"input": "text"
},
{
"key": "series",
"binding": "offering.config.series",
"label": "套餐或系列说明",
"input": "text"
},
{
"key": "spaceType",
"binding": "offering.config.spaceType",
"label": "适合场景",
"input": "text"
},
{
"key": "background",
"binding": "offering.config.details.background",
"label": "餐品介绍",
"input": "textarea"
},
{
"key": "designConcept",
"binding": "offering.config.details.designConcept",
"label": "口味与分量",
"input": "textarea"
},
{
"key": "keywords",
"binding": "offering.config.keywords",
"label": "餐品特色",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "特色" }]
},
{
"key": "crafts",
"binding": "offering.config.details.crafts",
"label": "制作方式",
"input": "list",
"itemValueKey": "value",
"itemFields": [{ "key": "value", "label": "制作说明" }]
},
{
"key": "materialsList",
"binding": "offering.config.details.materialsList",
"label": "食材与搭配",
"input": "list",
"itemFields": [
{ "key": "name", "label": "食材或搭配" },
{ "key": "spec", "label": "说明" }
]
}
]
},
{
"key": "detailCopy",
"title": "详情页说明",
"description": "解释价格、餐品内容和咨询后会怎样处理。",
"target": "brand",
"fields": [
{
"key": "priceLabel",
"binding": "brand.config.visualPresentation.detail.priceLabel",
"label": "价格说明标题",
"input": "text"
},
{
"key": "spaceLabel",
"binding": "brand.config.visualPresentation.detail.spaceLabel",
"label": "适合场景标题",
"input": "text"
},
{
"key": "backgroundTitle",
"binding": "brand.config.visualPresentation.detail.backgroundTitle",
"label": "餐品介绍标题",
"input": "text"
},
{
"key": "conceptTitle",
"binding": "brand.config.visualPresentation.detail.conceptTitle",
"label": "口味与分量标题",
"input": "text"
},
{
"key": "craftsTitle",
"binding": "brand.config.visualPresentation.detail.craftsTitle",
"label": "制作方式标题",
"input": "text"
},
{
"key": "materialsTitle",
"binding": "brand.config.visualPresentation.detail.materialsTitle",
"label": "食材与搭配标题",
"input": "text"
},
{
"key": "inquiryAction",
"binding": "brand.config.visualPresentation.detail.inquiryAction",
"label": "咨询按钮文字",
"input": "text"
},
{
"key": "inquiryHint",
"binding": "brand.config.visualPresentation.detail.inquiryHint",
"label": "咨询后的处理说明",
"help": "只写能够兑现的联系和确认方式。",
"input": "textarea"
}
]
},
{
"key": "successCopy",
"title": "提交成功页",
"description": "顾客提交后看到的确认信息与后续预期。",
"target": "brand",
"fields": [
{
"key": "eyebrow",
"binding": "brand.config.visualPresentation.success.eyebrow",
"label": "页面小标题",
"input": "text"
},
{
"key": "title",
"binding": "brand.config.visualPresentation.success.title",
"label": "确认标题",
"input": "text"
},
{
"key": "intro",
"binding": "brand.config.visualPresentation.success.intro",
"label": "后续联系说明",
"help": "若写回复时间,请确认日常能兑现。",
"input": "textarea"
},
{
"key": "recordsAction",
"binding": "brand.config.visualPresentation.success.recordsAction",
"label": "查看记录按钮",
"input": "text"
},
{
"key": "homeAction",
"binding": "brand.config.visualPresentation.success.homeAction",
"label": "返回首页按钮",
"input": "text"
}
]
},
{
"key": "recordsCopy",
"title": "咨询记录页",
"description": "顾客查看预订与咨询处理进度时看到的内容。",
"target": "brand",
"fields": [
{
"key": "title",
"binding": "brand.config.visualPresentation.records.title",
"label": "记录页标题",
"input": "text"
},
{
"key": "createAction",
"binding": "brand.config.visualPresentation.records.createAction",
"label": "新增咨询按钮",
"input": "text"
},
{
"key": "emptyTitle",
"binding": "brand.config.visualPresentation.records.emptyTitle",
"label": "暂无记录标题",
"input": "text"
},
{
"key": "emptyDescription",
"binding": "brand.config.visualPresentation.records.emptyDescription",
"label": "暂无记录说明",
"input": "textarea"
},
{
"key": "emptyAction",
"binding": "brand.config.visualPresentation.records.emptyAction",
"label": "空状态按钮",
"input": "text"
}
]
}