refactor: 完善小程序品牌组件视觉层
This commit is contained in:
1 parent
e4adfc6b13
commit
8872316ad3
17 files changed
+72
-10
No files matched your search
@@ -0,0 +1 @@
|
||||
Component({ options: { addGlobalClass: true } });
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="card"><slot /></view>
|
||||
@@ -0,0 +1,7 @@
|
||||
.card {
|
||||
padding: 28rpx;
|
||||
background: var(--brand-color-surface);
|
||||
border: 1rpx solid rgba(122, 74, 43, 0.1);
|
||||
border-radius: var(--brand-radius-card);
|
||||
box-shadow: 0 8rpx 24rpx rgba(122, 74, 43, 0.06);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
Component({
|
||||
properties: {
|
||||
message: { type: String, value: "暂时无法加载内容" },
|
||||
actionText: { type: String, value: "重新加载" },
|
||||
},
|
||||
methods: {
|
||||
retry() {
|
||||
this.triggerEvent("retry");
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "component": true }
|
||||
@@ -0,0 +1 @@
|
||||
<view class="error"><text class="message">{{message}}</text><button class="retry" bindtap="retry">{{actionText}}</button></view>
|
||||
@@ -0,0 +1,20 @@
|
||||
.error {
|
||||
padding: 72rpx 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: var(--brand-color-muted);
|
||||
}
|
||||
.message {
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.retry {
|
||||
margin: 0;
|
||||
padding: 0 28rpx;
|
||||
color: var(--brand-color-primary);
|
||||
background: var(--brand-color-subtle);
|
||||
border-radius: 999rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 68rpx;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="field"><view wx:if="{{label}}" class="label">{{label}}<text wx:if="{{required}}" class="required"> *</text></view><t-textarea wx:if="{{type === 'textarea'}}" value="{{value}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /><t-input wx:else value="{{value}}" type="{{type}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /></view>
|
||||
<view class="field"><view wx:if="{{label}}" class="label">{{label}}<text wx:if="{{required}}" class="required"> *</text></view><view class="field-control"><t-textarea wx:if="{{type === 'textarea'}}" value="{{value}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /><t-input wx:else value="{{value}}" type="{{type}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /></view></view>
|
||||
@@ -10,9 +10,21 @@
|
||||
.required {
|
||||
color: var(--brand-color-primary);
|
||||
}
|
||||
.field-control {
|
||||
padding: 4rpx 20rpx;
|
||||
background: var(--brand-color-surface);
|
||||
border: 1rpx solid #eadfce;
|
||||
border-radius: var(--brand-radius-control);
|
||||
}
|
||||
t-input,
|
||||
t-textarea {
|
||||
--td-input-bg-color: var(--brand-color-surface);
|
||||
--td-input-border-color: #eadfce;
|
||||
--td-input-border-radius: var(--brand-radius-control);
|
||||
--td-input-vertical-padding: 20rpx;
|
||||
--td-input-bg-color: transparent;
|
||||
--td-input-border-color: transparent;
|
||||
--td-input-default-text-color: var(--brand-color-text);
|
||||
--td-input-placeholder-text-color: #a98f7b;
|
||||
--td-textarea-background-color: transparent;
|
||||
--td-textarea-border-color: transparent;
|
||||
--td-textarea-text-color: var(--brand-color-text);
|
||||
--td-textarea-placeholder-color: #a98f7b;
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"brand-button": "/components/ui/brand-button/brand-button",
|
||||
"brand-field": "/components/ui/brand-field/brand-field"
|
||||
"brand-field": "/components/ui/brand-field/brand-field",
|
||||
"brand-card": "/components/ui/brand-card/brand-card"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
<view class="product"><view class="product-image"><image wx:if="{{service.coverUrl}}" src="{{service.coverUrl}}" mode="aspectFill"/><view wx:else class="dish-placeholder"></view></view><view class="product-copy"><text class="name">{{service.name || '选择服务'}}</text><text class="price">{{service.priceText || '沟通报价'}}</text></view><text class="available">{{template.available}}</text></view>
|
||||
<view class="quantity"><text>数量</text><view class="stepper"><button bindtap="decrease">−</button><text>{{quantity}} 份</text><button bindtap="increase">+</button></view></view>
|
||||
<view class="fulfillment"><text class="field-title">{{template.modeLabel}}</text><view class="choices"><button class="choice {{fulfillment === 'pickup' ? 'active' : ''}}" data-value="pickup" bindtap="chooseFulfillment">{{template.modeA}}</button><button class="choice {{fulfillment === 'delivery' ? 'active' : ''}}" data-value="delivery" bindtap="chooseFulfillment">{{template.modeB}}</button></view></view>
|
||||
<view class="form"><brand-field label="怎么称呼" placeholder="请输入你的称呼" required value="{{form.customerName}}" bind:change="input" data-key="customerName"/><brand-field label="联系方式" placeholder="手机号或微信号" required value="{{form.wechatId}}" bind:change="input" data-key="wechatId"/><brand-field label="期望时间" placeholder="例如:下周三 14:00" value="{{form.requestedTime}}" bind:change="input" data-key="requestedTime"/><brand-field wx:if="{{fulfillment === 'delivery'}}" label="{{template.locationLabel}}" placeholder="{{template.locationPlaceholder}}" value="{{form.deliveryAddress}}" bind:change="input" data-key="deliveryAddress"/><brand-field label="{{template.requestType === 'package' ? '备注' : '需求说明'}}" placeholder="{{template.notePlaceholder}}" type="textarea" value="{{form.note}}" bind:change="input" data-key="note"/></view>
|
||||
<brand-card><view class="form"><brand-field label="怎么称呼" placeholder="请输入你的称呼" required value="{{form.customerName}}" bind:change="input" data-key="customerName"/><brand-field label="联系方式" placeholder="手机号或微信号" required value="{{form.wechatId}}" bind:change="input" data-key="wechatId"/><brand-field label="期望时间" placeholder="例如:下周三 14:00" value="{{form.requestedTime}}" bind:change="input" data-key="requestedTime"/><brand-field wx:if="{{fulfillment === 'delivery'}}" label="{{template.locationLabel}}" placeholder="{{template.locationPlaceholder}}" value="{{form.deliveryAddress}}" bind:change="input" data-key="deliveryAddress"/><brand-field label="{{template.requestType === 'package' ? '备注' : '需求说明'}}" placeholder="{{template.notePlaceholder}}" type="textarea" value="{{form.note}}" bind:change="input" data-key="note"/></view></brand-card>
|
||||
<view class="notice">● {{template.submitNotice}}</view><brand-button loading="{{submitting}}" disabled="{{submitting}}" bind:tap="submit">{{submitting ? '提交中...' : template.submitLabel}}</brand-button>
|
||||
</view>
|
||||
@@ -4,6 +4,7 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty",
|
||||
"brand-error": "/components/ui/brand-error/brand-error"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<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="state error"><text>{{error}}</text><button size="mini" bindtap="retry">重新加载</button></view>
|
||||
<brand-error wx:elif="{{error}}" message="{{error}}" bind:retry="retry" />
|
||||
<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>
|
||||
|
||||
@@ -3,6 +3,10 @@ const { getTemplate } = require("../../utils/templates");
|
||||
Page({
|
||||
data: { loading: true, error: "", services: [], filtered: [], category: "package", labels: {} },
|
||||
onLoad() {
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
this.setData({ loading: true, error: "" });
|
||||
Promise.all([
|
||||
request("/public/offerings"),
|
||||
request("/public/services"),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty",
|
||||
"brand-error": "/components/ui/brand-error/brand-error"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="heading"><text>服务列表</text><text class="sub">{{labels.sub}}</text></view><view class="categories"><view class="category package {{category === 'package' ? 'selected' : ''}}" data-category="package" bindtap="switchCategory"><text class="category-title">● {{labels.first}}</text><text>{{labels.firstSub}}</text></view><view class="category chef {{category === 'private_chef' ? 'selected' : ''}}" data-category="private_chef" bindtap="switchCategory"><text class="category-title">● {{labels.second}}</text><text>{{labels.secondSub}}</text></view></view><brand-loading wx:if="{{loading}}" /><view wx:elif="{{error}}" class="state">{{error}}</view><brand-empty wx:elif="{{!filtered.length}}" description="{{labels.empty}}" /><view wx:else><view wx:for="{{filtered}}" wx:key="id" class="card" data-id="{{item.id}}" data-offering-id="{{item.kind ? item.id : ''}}" bindtap="book"><view class="dish-image"><image wx:if="{{item.coverUrl}}" src="{{item.coverUrl}}" mode="aspectFill"/><view wx:else class="dish-placeholder"></view></view><view class="card-content"><view class="card-head"><view class="name">{{item.name}}</view><text class="available">{{item.isEnabled !== false ? labels.available : labels.unavailable}}</text></view><text class="desc">{{item.description || item.summary}}</text><view class="card-bottom"><text class="price">{{item.priceText || '面议'}}</text><button size="mini">查看详情</button></view></view></view></view></view>
|
||||
<view class="page"><view class="heading"><text>服务列表</text><text class="sub">{{labels.sub}}</text></view><view class="categories"><view class="category package {{category === 'package' ? 'selected' : ''}}" data-category="package" bindtap="switchCategory"><text class="category-title">● {{labels.first}}</text><text>{{labels.firstSub}}</text></view><view class="category chef {{category === 'private_chef' ? 'selected' : ''}}" data-category="private_chef" bindtap="switchCategory"><text class="category-title">● {{labels.second}}</text><text>{{labels.secondSub}}</text></view></view><brand-loading wx:if="{{loading}}" /><brand-error wx:elif="{{error}}" message="{{error}}" bind:retry="load" /><brand-empty wx:elif="{{!filtered.length}}" description="{{labels.empty}}" /><view wx:else><view wx:for="{{filtered}}" wx:key="id" class="card" data-id="{{item.id}}" data-offering-id="{{item.kind ? item.id : ''}}" bindtap="book"><view class="dish-image"><image wx:if="{{item.coverUrl}}" src="{{item.coverUrl}}" mode="aspectFill"/><view wx:else class="dish-placeholder"></view></view><view class="card-content"><view class="card-head"><view class="name">{{item.name}}</view><text class="available">{{item.isEnabled !== false ? labels.available : labels.unavailable}}</text></view><text class="desc">{{item.description || item.summary}}</text><view class="card-bottom"><text class="price">{{item.priceText || '面议'}}</text><button size="mini">查看详情</button></view></view></view></view></view>
|
||||
Reference in new issue
Block a user