- 新增 back-white.svg 和 home.svg 图标文件 - 重构 YjyfNavBar 组件,默认主题改为橙色,使用 SVG 图标 - 统一各页面导航栏为自定义组件,替换原生导航栏 - 调整所有页面背景色为 #F5F6F8,统一视觉风格 - 优化渐变背景为 135deg 线性渐变,消除分层断层 - 更新 pages.json 配置,所有页面使用自定义导航样式
103 行
3.4 KiB
Vue
103 行
3.4 KiB
Vue
<template>
|
|
<view class="page">
|
|
<!-- 统一规范顶部白底导航栏 -->
|
|
<YjyfNavBar theme="orange" :title="catName || '服务列表'" />
|
|
|
|
<view class="head">
|
|
<text class="cat">{{ catName || '全部服务' }}</text>
|
|
<text class="count">{{ list.length }} 项可预约</text>
|
|
</view>
|
|
|
|
<view class="list">
|
|
<view class="item" v-for="s in list" :key="s.id" @tap="goDetail(s)">
|
|
<view class="thumb"><text class="thumb-txt">{{ s.name.slice(0, 2) }}</text></view>
|
|
<view class="info">
|
|
<text class="name">{{ s.name }}</text>
|
|
<text class="desc">{{ s.description || '专业师傅上门服务,验收满意再付款' }}</text>
|
|
<view class="row">
|
|
<text class="price">{{ s.price_text }}</text>
|
|
<text class="sales">已售 {{ s.sales }}</text>
|
|
</view>
|
|
</view>
|
|
<view class="btn">下单</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="empty" v-if="!loading && !list.length">
|
|
<text>该类目暂无服务</text>
|
|
</view>
|
|
<view class="loading" v-if="loading"><text>加载中...</text></view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue';
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
import api from '@/utils/api.js';
|
|
|
|
const list = ref([]);
|
|
const catName = ref('');
|
|
const loading = ref(false);
|
|
let catId = 0;
|
|
let keyword = '';
|
|
|
|
function goDetail(s) {
|
|
uni.navigateTo({ url: '/pages/service/detail?id=' + s.id });
|
|
}
|
|
|
|
async function load() {
|
|
loading.value = true;
|
|
try {
|
|
const params = { cat_id: catId };
|
|
if (keyword) params.keyword = keyword;
|
|
const res = await api.services(params);
|
|
list.value = res.list || [];
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
}
|
|
|
|
onLoad((options) => {
|
|
catId = Number(options.cat_id || 0);
|
|
keyword = options.keyword ? decodeURIComponent(options.keyword) : '';
|
|
catName.value = options.cat_name
|
|
? decodeURIComponent(options.cat_name)
|
|
: (keyword ? '搜索:' + keyword : '');
|
|
load();
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 40rpx; }
|
|
.head {
|
|
display: flex; align-items: baseline; justify-content: space-between;
|
|
padding: 26rpx 28rpx 18rpx;
|
|
}
|
|
.cat { font-size: 34rpx; font-weight: 700; color: #1F1F1F; }
|
|
.count { font-size: 22rpx; color: #9A9A9A; }
|
|
.list { padding: 0 28rpx; }
|
|
.item {
|
|
display: flex; align-items: center; padding: 24rpx;
|
|
background: #fff; border-radius: 20rpx; margin-bottom: 20rpx;
|
|
box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06);
|
|
}
|
|
.thumb {
|
|
width: 108rpx; height: 108rpx; border-radius: 16rpx; flex-shrink: 0;
|
|
background: linear-gradient(160deg, #FFF7F0 0%, #FCE9D6 100%);
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.thumb-txt { font-size: 30rpx; font-weight: 700; color: #B85E2A; }
|
|
.info { flex: 1; min-width: 0; margin-left: 20rpx; display: flex; flex-direction: column; }
|
|
.name { font-size: 30rpx; font-weight: 600; color: #1F1F1F; }
|
|
.desc { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
.row { display: flex; align-items: baseline; margin-top: 10rpx; }
|
|
.price { font-size: 30rpx; font-weight: 700; color: #F0710D; }
|
|
.sales { margin-left: 14rpx; font-size: 20rpx; color: #B5B5B5; }
|
|
.btn {
|
|
flex-shrink: 0; margin-left: 12rpx; padding: 0 24rpx; line-height: 56rpx;
|
|
border-radius: 28rpx; color: #fff; font-size: 24rpx;
|
|
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
|
}
|
|
.empty, .loading { padding: 80rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
|
</style>
|