feat: 完善模板内容后台配置能力
This commit is contained in:
1 parent
2bc2193b44
commit
9266ec824a
37 files changed
+2273
-63
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user