feat: 接入小程序业务提供项详情渲染
This commit is contained in:
1 parent
5e26999c72
commit
8fd399f4c2
7 files changed
+92
-5
No files matched your search
@@ -0,0 +1,14 @@
|
||||
const { request } = require("../../utils/request");
|
||||
Page({
|
||||
data: { loading: true, error: "", item: null },
|
||||
onLoad(options) {
|
||||
request("/public/offerings/" + encodeURIComponent(options.id))
|
||||
.then((item) => this.setData({ item, loading: false }))
|
||||
.catch(() => this.setData({ loading: false, error: "详情加载失败" }));
|
||||
},
|
||||
submit() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/booking/index?serviceId=" + encodeURIComponent(this.data.item?.id || ""),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "服务详情",
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view wx:if="{{loading}}" class="state">加载中...</view><view wx:elif="{{error}}" class="state">{{error}}</view><view wx:else><image wx:if="{{item.coverUrl}}" class="cover" src="{{item.coverUrl}}" mode="aspectFill"/><view class="title">{{item.name}}</view><view class="summary">{{item.summary}}</view><view class="price">{{item.priceText || '沟通报价'}}</view><view wx:for="{{item.sections}}" wx:for-item="section" wx:key="title" class="section"><view class="section-title">{{section.title}}</view><view class="section-content">{{section.content}}</view><view wx:for="{{section.items}}" wx:for-item="sectionItem" wx:key="*this" class="section-item">{{sectionItem}}</view></view><button class="cta" bindtap="submit">{{item.cta.label || '立即咨询'}}</button></view></view>
|
||||
@@ -0,0 +1,55 @@
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
padding: 32rpx;
|
||||
background: #fbf7f1;
|
||||
color: #2b2b2b;
|
||||
}
|
||||
.cover {
|
||||
width: 100%;
|
||||
height: 360rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.title {
|
||||
margin-top: 28rpx;
|
||||
font-size: 48rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.summary {
|
||||
margin-top: 14rpx;
|
||||
color: #7a4a2b;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.price {
|
||||
margin-top: 20rpx;
|
||||
color: #b54a2c;
|
||||
font-size: 38rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.section {
|
||||
margin-top: 28rpx;
|
||||
padding: 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.section-content {
|
||||
margin-top: 14rpx;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.section-item {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.cta {
|
||||
margin-top: 36rpx;
|
||||
background: #b54a2c;
|
||||
color: #fff;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
.state {
|
||||
text-align: center;
|
||||
padding: 120rpx;
|
||||
color: #7a4a2b;
|
||||
}
|
||||
Reference in new issue
Block a user