fix: 对齐服务分类和订单视觉结构
This commit is contained in:
1 parent
662649a08f
commit
13ead2d426
5 files changed
+5
-5
No files matched your search
@@ -1,2 +1,2 @@
|
||||
const API = 'http://localhost:3001';
|
||||
Page({data:{loading:true,services:[]},onLoad(){wx.request({url:API+'/public/services',success:res=>this.setData({services:res.data,loading:false}),fail:()=>this.setData({loading:false})})},book(e){wx.navigateTo({url:'/pages/booking/index?serviceId='+e.currentTarget.dataset.id})}});
|
||||
Page({data:{loading:true,services:[],filtered:[],category:'package'},onLoad(){wx.request({url:API+'/public/services',success:res=>this.setData({services:res.data,filtered:res.data.filter(x=>x.priceAmount!==null),loading:false}),fail:()=>this.setData({loading:false})})},switchCategory(e){const category=e.currentTarget.dataset.category;const filtered=category==='package'?this.data.services.filter(x=>x.priceAmount!==null):this.data.services.filter(x=>x.priceAmount===null);this.setData({category,filtered})},book(e){wx.navigateTo({url:'/pages/booking/index?serviceId='+e.currentTarget.dataset.id})}});
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="heading"><text>服务列表</text><text class="sub">今日可订</text></view><view wx:if="{{loading}}" class="state">加载中...</view><view wx:else><view wx:for="{{services}}" wx:key="id" class="card" data-id="{{item.id}}" bindtap="book"><view><text class="name">{{item.name}}</text><text class="desc">{{item.description}}</text><text class="price">{{item.priceText || '面议'}}</text></view><button size="mini">{{item.priceAmount ? '预约' : '咨询'}}</button></view></view></view>
|
||||
<view class="page"><view class="heading"><text>服务列表</text><text class="sub">今日可订</text></view><view class="categories"><view class="category package {{category === 'package' ? 'selected' : ''}}" data-category="package" bindtap="switchCategory"><text>● 普通套餐</text><text>日常家常饭</text></view><view class="category chef {{category === 'private_chef' ? 'selected' : ''}}" data-category="private_chef" bindtap="switchCategory"><text>● 私厨服务</text><text>聚餐定制</text></view></view><view wx:if="{{loading}}" class="state">加载中...</view><view wx:elif="{{!filtered.length}}" class="state">暂无可订服务</view><view wx:else><view wx:for="{{filtered}}" wx:key="id" class="card" data-id="{{item.id}}" bindtap="book"><view><view class="name">{{item.name}}</view><text class="desc">{{item.description}}</text><text class="price">{{item.priceText || '面议'}}</text></view><button size="mini">{{item.priceAmount ? '预约' : '咨询'}}</button></view></view></view>
|
||||
@@ -1 +1 @@
|
||||
.page{min-height:100vh;padding:24rpx 32rpx;background:#FBF7F1;color:#2B2B2B}.heading{margin:12rpx 0 28rpx}.heading text:first-child{display:block;font-size:48rpx;font-weight:700}.sub{display:block;margin-top:8rpx;font-size:30rpx}.card{display:flex;justify-content:space-between;align-items:center;margin-bottom:16rpx;padding:30rpx;background:#fff;border-radius:32rpx}.name{display:block;font-size:34rpx;font-weight:700}.desc{display:block;margin:10rpx 0;color:#7A4A2B;font-size:27rpx}.price{display:block;color:#B54A2C;font-size:38rpx}.card button{background:#B54A2C;color:#fff;border-radius:36rpx}.state{text-align:center;padding:80rpx;color:#7A4A2B}
|
||||
.page{min-height:100vh;padding:24rpx 32rpx;background:#FBF7F1;color:#2B2B2B}.heading{margin:12rpx 0 28rpx}.heading text:first-child{display:block;font-size:48rpx;font-weight:700}.sub{display:block;margin-top:8rpx;font-size:30rpx}.categories{display:flex;gap:16rpx;margin-bottom:28rpx}.category{flex:1;padding:28rpx 22rpx;border-radius:16rpx;font-size:30rpx}.category text{display:block}.category text+text{margin-top:12rpx;font-size:25rpx}.package{background:#B54A2C;color:#fff}.chef{background:#F4EBD9;color:#2B2B2B}.category.selected{box-shadow:0 0 0 4rpx #E8A75F}.card{display:flex;justify-content:space-between;align-items:center;margin-bottom:16rpx;padding:30rpx;background:#fff;border-radius:16rpx}.name{display:block;font-size:34rpx;font-weight:700}.desc{display:block;margin:10rpx 0;color:#7A4A2B;font-size:27rpx}.price{display:block;color:#B54A2C;font-size:38rpx}.card button{background:#B54A2C;color:#fff;border-radius:36rpx}.state{text-align:center;padding:80rpx;color:#7A4A2B}
|
||||
Reference in new issue
Block a user