Generating commit message...
This commit is contained in:
178
mini-program/pages/animal/detail.vue
Normal file
178
mini-program/pages/animal/detail.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 动物图片轮播 -->
|
||||
<swiper class="animal-swiper" :indicator-dots="true">
|
||||
<swiper-item v-for="(img, index) in animal.images" :key="index">
|
||||
<image :src="img" mode="aspectFill" class="swiper-image"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- 动物基本信息 -->
|
||||
<view class="animal-info">
|
||||
<text class="name">{{ animal.name }}</text>
|
||||
<view class="meta">
|
||||
<text class="species">{{ animal.species }}</text>
|
||||
<text class="price">¥{{ animal.price }}</text>
|
||||
</view>
|
||||
<text class="location">{{ animal.location }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 动物详情 -->
|
||||
<view class="section">
|
||||
<text class="section-title">动物介绍</text>
|
||||
<text class="description">{{ animal.description }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 认养信息 -->
|
||||
<view class="section">
|
||||
<text class="section-title">认养说明</text>
|
||||
<text class="adoption-info">{{ animal.adoptionInfo }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-bar">
|
||||
<button class="btn adopt" @click="handleAdopt">立即认养</button>
|
||||
<button class="btn contact" @click="handleContact">联系管理员</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
animal: {
|
||||
id: 1,
|
||||
name: '小羊驼',
|
||||
species: '羊驼',
|
||||
price: 1000,
|
||||
location: '西藏牧场',
|
||||
images: [
|
||||
'/static/animals/alpaca1.jpg',
|
||||
'/static/animals/alpaca2.jpg'
|
||||
],
|
||||
description: '这是一只可爱的羊驼,性格温顺,喜欢与人互动。',
|
||||
adoptionInfo: '认养后您将获得:\n1. 专属认养证书\n2. 定期照片和视频\n3. 牧场参观机会'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAdopt() {
|
||||
uni.showModal({
|
||||
title: '确认认养',
|
||||
content: '确定要认养这只可爱的' + this.animal.name + '吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '认养成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleContact() {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: '13800138000'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
|
||||
.animal-swiper {
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
.swiper-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.animal-info {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
|
||||
.species {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.price {
|
||||
font-size: 28rpx;
|
||||
color: #ff9500;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.location {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.section {
|
||||
padding: 30rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.description, .adoption-info {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.adoption-info {
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
margin: 0 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.adopt {
|
||||
background-color: #ff2d55;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.contact {
|
||||
background-color: #fff;
|
||||
color: #ff2d55;
|
||||
border: 1rpx solid #ff2d55;
|
||||
}
|
||||
</style>
|
||||
260
mini-program/pages/flower/order.vue
Normal file
260
mini-program/pages/flower/order.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 花束选择 -->
|
||||
<view class="section">
|
||||
<text class="section-title">选择花束</text>
|
||||
<scroll-view class="flower-list" scroll-x>
|
||||
<view
|
||||
v-for="(item, index) in flowers"
|
||||
:key="index"
|
||||
class="flower-item"
|
||||
:class="{active: selectedFlower === index}"
|
||||
@click="selectFlower(index)"
|
||||
>
|
||||
<image :src="item.image" class="flower-image"></image>
|
||||
<text class="flower-name">{{ item.name }}</text>
|
||||
<text class="flower-price">¥{{ item.price }}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 收花人信息 -->
|
||||
<view class="section">
|
||||
<text class="section-title">收花人信息</text>
|
||||
<view class="form-item">
|
||||
<text class="label">姓名</text>
|
||||
<input v-model="receiver.name" placeholder="请输入收花人姓名" />
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="label">电话</text>
|
||||
<input v-model="receiver.phone" type="number" placeholder="请输入收花人电话" />
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="label">地址</text>
|
||||
<input v-model="receiver.address" placeholder="请输入详细地址" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 祝福语 -->
|
||||
<view class="section">
|
||||
<text class="section-title">祝福语</text>
|
||||
<textarea
|
||||
v-model="greeting"
|
||||
placeholder="写下您的祝福..."
|
||||
class="greeting-input"
|
||||
></textarea>
|
||||
</view>
|
||||
|
||||
<!-- 订单汇总 -->
|
||||
<view class="order-summary">
|
||||
<text class="summary-text">总计: ¥{{ flowers[selectedFlower].price }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<view class="action-bar">
|
||||
<button class="submit-btn" @click="submitOrder">立即下单</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selectedFlower: 0,
|
||||
flowers: [
|
||||
{
|
||||
name: '浪漫玫瑰',
|
||||
price: 199,
|
||||
image: '/static/flowers/rose.jpg'
|
||||
},
|
||||
{
|
||||
name: '温馨康乃馨',
|
||||
price: 159,
|
||||
image: '/static/flowers/carnation.jpg'
|
||||
},
|
||||
{
|
||||
name: '向日葵花束',
|
||||
price: 179,
|
||||
image: '/static/flowers/sunflower.jpg'
|
||||
},
|
||||
{
|
||||
name: '百合花束',
|
||||
price: 219,
|
||||
image: '/static/flowers/lily.jpg'
|
||||
}
|
||||
],
|
||||
receiver: {
|
||||
name: '',
|
||||
phone: '',
|
||||
address: ''
|
||||
},
|
||||
greeting: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectFlower(index) {
|
||||
this.selectedFlower = index
|
||||
},
|
||||
submitOrder() {
|
||||
if (!this.validateForm()) return
|
||||
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
|
||||
// 模拟API请求
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '下单成功',
|
||||
icon: 'success'
|
||||
})
|
||||
this.resetForm()
|
||||
}, 1500)
|
||||
},
|
||||
validateForm() {
|
||||
if (!this.receiver.name) {
|
||||
uni.showToast({ title: '请输入收花人姓名', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if (!this.receiver.phone) {
|
||||
uni.showToast({ title: '请输入收花人电话', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
if (!this.receiver.address) {
|
||||
uni.showToast({ title: '请输入收花地址', icon: 'none' })
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
resetForm() {
|
||||
this.receiver = {
|
||||
name: '',
|
||||
phone: '',
|
||||
address: ''
|
||||
}
|
||||
this.greeting = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
padding-bottom: 120rpx;
|
||||
}
|
||||
|
||||
.section {
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.flower-list {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.flower-item {
|
||||
display: inline-block;
|
||||
width: 200rpx;
|
||||
margin-right: 20rpx;
|
||||
text-align: center;
|
||||
padding: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
border: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.flower-item.active {
|
||||
border-color: #ff2d55;
|
||||
background-color: #fff5f7;
|
||||
}
|
||||
|
||||
.flower-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.flower-name {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.flower-price {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #ff2d55;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 80rpx;
|
||||
border: 1rpx solid #eee;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.greeting-input {
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
border: 1rpx solid #eee;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.order-summary {
|
||||
position: fixed;
|
||||
bottom: 120rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
padding: 20rpx 30rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.summary-text {
|
||||
font-size: 32rpx;
|
||||
color: #ff2d55;
|
||||
font-weight: bold;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background-color: #ff2d55;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
</style>
|
||||
687
mini-program/pages/index/index.vue
Normal file
687
mini-program/pages/index/index.vue
Normal file
@@ -0,0 +1,687 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部状态栏占位 -->
|
||||
<view class="status-bar"></view>
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-bar">
|
||||
<view class="search-input">
|
||||
<uni-icons type="search" size="16" color="#999"></uni-icons>
|
||||
<input type="text" placeholder="搜索目的地、用户、动物" placeholder-class="placeholder" @focus="navigateToSearch" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 轮播图 -->
|
||||
<swiper class="banner-swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500">
|
||||
<swiper-item v-for="(item, index) in banners" :key="index" @click="navigateTo(item.link)">
|
||||
<image :src="item.image" mode="aspectFill" class="banner-image" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<!-- 功能入口 -->
|
||||
<view class="feature-grid">
|
||||
<view class="feature-item" @click="navigateTo('/pages/travel/list')">
|
||||
<view class="feature-icon travel">
|
||||
<uni-icons type="map" size="24" color="#007aff"></uni-icons>
|
||||
</view>
|
||||
<text class="feature-text">找搭子</text>
|
||||
</view>
|
||||
<view class="feature-item" @click="navigateTo('/pages/animal/list')">
|
||||
<view class="feature-icon animal">
|
||||
<uni-icons type="heart" size="24" color="#ff2d55"></uni-icons>
|
||||
</view>
|
||||
<text class="feature-text">认领动物</text>
|
||||
</view>
|
||||
<view class="feature-item" @click="navigateTo('/pages/flower/order')">
|
||||
<view class="feature-icon flower">
|
||||
<uni-icons type="flower" size="24" color="#ff9500"></uni-icons>
|
||||
</view>
|
||||
<text class="feature-text">送花服务</text>
|
||||
</view>
|
||||
<view class="feature-item" @click="navigateTo('/pages/promotion/invite')">
|
||||
<view class="feature-icon promotion">
|
||||
<uni-icons type="gift" size="24" color="#34c759"></uni-icons>
|
||||
</view>
|
||||
<text class="feature-text">推广奖励</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公告栏 -->
|
||||
<view class="notice-bar">
|
||||
<uni-icons type="sound" size="16" color="#ff9500"></uni-icons>
|
||||
<swiper class="notice-swiper" vertical autoplay circular :interval="3000">
|
||||
<swiper-item v-for="(notice, index) in notices" :key="index">
|
||||
<text class="notice-text">{{notice}}</text>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 推荐旅行计划 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">推荐旅行计划</text>
|
||||
<text class="section-more" @click="navigateTo('/pages/travel/list')">更多</text>
|
||||
</view>
|
||||
<scroll-view class="plan-list" scroll-x="true" show-scrollbar="false">
|
||||
<view class="plan-card" v-for="(plan, index) in travelPlans" :key="index" @click="navigateTo(`/pages/travel/detail?id=${plan.id}`)">
|
||||
<image :src="plan.coverImage" mode="aspectFill" class="plan-image" />
|
||||
<view class="plan-info">
|
||||
<text class="plan-destination">{{ plan.destination }}</text>
|
||||
<text class="plan-date">{{ plan.startDate }} - {{ plan.endDate }}</text>
|
||||
<view class="plan-meta">
|
||||
<text class="plan-budget">¥{{ plan.budget }}</text>
|
||||
<text class="plan-members">{{ plan.currentMembers }}/{{ plan.maxMembers }}人</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 热门动物 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">热门动物</text>
|
||||
<text class="section-more" @click="navigateTo('/pages/animal/list')">更多</text>
|
||||
</view>
|
||||
<view class="animal-grid">
|
||||
<view class="animal-card" v-for="(animal, index) in animals" :key="index" @click="navigateTo(`/pages/animal/detail?id=${animal.id}`)">
|
||||
<image :src="animal.image" mode="aspectFill" class="animal-image" />
|
||||
<view class="animal-tag" v-if="animal.isHot">热门</view>
|
||||
<view class="animal-info">
|
||||
<text class="animal-name">{{ animal.name }}</text>
|
||||
<text class="animal-species">{{ animal.species }}</text>
|
||||
<text class="animal-price">¥{{ animal.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 送花服务 -->
|
||||
<view class="section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">精选花束</text>
|
||||
<text class="section-more" @click="navigateTo('/pages/flower/list')">更多</text>
|
||||
</view>
|
||||
<scroll-view class="flower-list" scroll-x="true" show-scrollbar="false">
|
||||
<view class="flower-card" v-for="(flower, index) in flowers" :key="index" @click="navigateTo(`/pages/flower/detail?id=${flower.id}`)">
|
||||
<image :src="flower.image" mode="aspectFill" class="flower-image" />
|
||||
<view class="flower-info">
|
||||
<text class="flower-name">{{ flower.name }}</text>
|
||||
<text class="flower-desc">{{ flower.description }}</text>
|
||||
<text class="flower-price">¥{{ flower.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
<view class="tab-bar">
|
||||
<view class="tab-item active">
|
||||
<uni-icons type="home" size="24" color="#007aff"></uni-icons>
|
||||
<text class="tab-text">首页</text>
|
||||
</view>
|
||||
<view class="tab-item" @click="navigateTo('/pages/discover/index')">
|
||||
<uni-icons type="compass" size="24" color="#999"></uni-icons>
|
||||
<text class="tab-text">发现</text>
|
||||
</view>
|
||||
<view class="tab-item" @click="navigateTo('/pages/message/index')">
|
||||
<uni-icons type="chat" size="24" color="#999"></uni-icons>
|
||||
<text class="tab-text">消息</text>
|
||||
<view class="badge" v-if="unreadCount > 0">{{unreadCount > 99 ? '99+' : unreadCount}}</view>
|
||||
</view>
|
||||
<view class="tab-item" @click="navigateTo('/pages/user/center')">
|
||||
<uni-icons type="person" size="24" color="#999"></uni-icons>
|
||||
<text class="tab-text">我的</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
banners: [
|
||||
{ image: '/static/banners/banner1.jpg', link: '/pages/travel/list' },
|
||||
{ image: '/static/banners/banner2.jpg', link: '/pages/animal/list' },
|
||||
{ image: '/static/banners/banner3.jpg', link: '/pages/flower/list' }
|
||||
],
|
||||
notices: [
|
||||
'欢迎来到结伴客,找到志同道合的旅伴!',
|
||||
'新用户注册即送50积分,可兑换精美礼品',
|
||||
'推荐好友加入,双方各得30积分奖励'
|
||||
],
|
||||
travelPlans: [
|
||||
{
|
||||
id: 1,
|
||||
destination: '西藏拉萨',
|
||||
startDate: '10月1日',
|
||||
endDate: '10月7日',
|
||||
budget: 5000,
|
||||
currentMembers: 3,
|
||||
maxMembers: 6,
|
||||
coverImage: '/static/travel/tibet.jpg'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
destination: '云南大理',
|
||||
startDate: '10月5日',
|
||||
endDate: '10月12日',
|
||||
budget: 3500,
|
||||
currentMembers: 2,
|
||||
maxMembers: 4,
|
||||
coverImage: '/static/travel/yunnan.jpg'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
destination: '新疆喀什',
|
||||
startDate: '10月10日',
|
||||
endDate: '10月20日',
|
||||
budget: 6000,
|
||||
currentMembers: 4,
|
||||
maxMembers: 8,
|
||||
coverImage: '/static/travel/xinjiang.jpg'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
destination: '青海湖',
|
||||
startDate: '10月15日',
|
||||
endDate: '10月20日',
|
||||
budget: 4000,
|
||||
currentMembers: 2,
|
||||
maxMembers: 5,
|
||||
coverImage: '/static/travel/qinghai.jpg'
|
||||
}
|
||||
],
|
||||
animals: [
|
||||
{
|
||||
id: 1,
|
||||
name: '小羊驼',
|
||||
species: '羊驼',
|
||||
price: 1000,
|
||||
isHot: true,
|
||||
image: '/static/animals/alpaca.jpg'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '小绵羊',
|
||||
species: '绵羊',
|
||||
price: 800,
|
||||
isHot: false,
|
||||
image: '/static/animals/sheep.jpg'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '小花猪',
|
||||
species: '猪',
|
||||
price: 600,
|
||||
isHot: true,
|
||||
image: '/static/animals/pig.jpg'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '小公鸡',
|
||||
species: '鸡',
|
||||
price: 300,
|
||||
isHot: false,
|
||||
image: '/static/animals/chicken.jpg'
|
||||
}
|
||||
],
|
||||
flowers: [
|
||||
{
|
||||
id: 1,
|
||||
name: '浪漫玫瑰',
|
||||
description: '11朵红玫瑰',
|
||||
price: 199,
|
||||
image: '/static/flowers/rose.jpg'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '向日葵花束',
|
||||
description: '9朵向日葵',
|
||||
price: 179,
|
||||
image: '/static/flowers/sunflower.jpg'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '百合花束',
|
||||
description: '7朵白百合',
|
||||
price: 229,
|
||||
image: '/static/flowers/lily.jpg'
|
||||
}
|
||||
],
|
||||
unreadCount: 5
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 获取系统信息设置状态栏高度
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
this.statusBarHeight = systemInfo.statusBarHeight;
|
||||
|
||||
// 加载数据
|
||||
this.loadData();
|
||||
},
|
||||
methods: {
|
||||
loadData() {
|
||||
// 实际开发中,这里应该从API获取数据
|
||||
console.log('加载首页数据');
|
||||
},
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
});
|
||||
},
|
||||
navigateToSearch() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/search/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 移除图标字体相关样式 */
|
||||
|
||||
/* 页面样式 */
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fa;
|
||||
padding-bottom: 100rpx; /* 为底部导航留出空间 */
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f5f5f5;
|
||||
border-radius: 50rpx;
|
||||
padding: 15rpx 30rpx;
|
||||
}
|
||||
|
||||
.search-input .iconfont {
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.search-input input {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.banner-swiper {
|
||||
height: 300rpx;
|
||||
margin: 0 30rpx 30rpx;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.feature-grid {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 20rpx 30rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.feature-icon .iconfont {
|
||||
font-size: 50rpx;
|
||||
}
|
||||
|
||||
.feature-icon.travel {
|
||||
background-color: rgba(0, 122, 255, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon.travel .iconfont {
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.feature-icon.animal {
|
||||
background-color: rgba(255, 45, 85, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon.animal .iconfont {
|
||||
color: #ff2d55;
|
||||
}
|
||||
|
||||
.feature-icon.flower {
|
||||
background-color: rgba(255, 149, 0, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon.flower .iconfont {
|
||||
color: #ff9500;
|
||||
}
|
||||
|
||||
.feature-icon.promotion {
|
||||
background-color: rgba(52, 199, 89, 0.1);
|
||||
}
|
||||
|
||||
.feature-icon.promotion .iconfont {
|
||||
color: #34c759;
|
||||
}
|
||||
|
||||
.feature-text {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.notice-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff8e6;
|
||||
padding: 15rpx 30rpx;
|
||||
margin: 0 30rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.notice-bar .iconfont {
|
||||
font-size: 32rpx;
|
||||
color: #ff9500;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.notice-swiper {
|
||||
height: 40rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.notice-text {
|
||||
font-size: 24rpx;
|
||||
color: #ff9500;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 30rpx;
|
||||
background-color: #ffffff;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
position: relative;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.section-title::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 8rpx;
|
||||
height: 30rpx;
|
||||
background-color: #007aff;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.section-more {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.plan-list {
|
||||
white-space: nowrap;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.plan-card {
|
||||
display: inline-block;
|
||||
width: 300rpx;
|
||||
margin-right: 20rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 15rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.plan-image {
|
||||
width: 100%;
|
||||
height: 180rpx;
|
||||
}
|
||||
|
||||
.plan-info {
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.plan-destination {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.plan-date {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.plan-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.plan-budget {
|
||||
font-size: 26rpx;
|
||||
color: #ff9500;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.plan-members {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.animal-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.animal-card {
|
||||
background: #ffffff;
|
||||
border-radius: 15rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.animal-image {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.animal-tag {
|
||||
position: absolute;
|
||||
top: 15rpx;
|
||||
right: 15rpx;
|
||||
background-color: #ff2d55;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.animal-info {
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.animal-name {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.animal-species {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.animal-price {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #ff9500;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.flower-list {
|
||||
white-space: nowrap;
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.flower-card {
|
||||
display: inline-block;
|
||||
width: 240rpx;
|
||||
margin-right: 20rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 15rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.flower-image {
|
||||
width: 100%;
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.flower-info {
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.flower-name {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.flower-desc {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 10rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.flower-price {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #ff9500;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tab-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item .iconfont {
|
||||
font-size: 40rpx;
|
||||
color: #999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.tab-item.active .iconfont {
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.tab-item.active .tab-text {
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 50%;
|
||||
transform: translateX(10rpx);
|
||||
background-color: #ff2d55;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
min-width: 32rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 6rpx;
|
||||
}
|
||||
</style>
|
||||
167
mini-program/pages/travel/detail.vue
Normal file
167
mini-program/pages/travel/detail.vue
Normal file
@@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 封面图 -->
|
||||
<image :src="plan.coverImage" mode="widthFix" class="cover-image"></image>
|
||||
|
||||
<!-- 计划标题和基本信息 -->
|
||||
<view class="plan-header">
|
||||
<text class="title">{{ plan.destination }}</text>
|
||||
<view class="meta">
|
||||
<text class="date">{{ plan.startDate }} - {{ plan.endDate }}</text>
|
||||
<text class="budget">预算: ¥{{ plan.budget }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 行程详情 -->
|
||||
<view class="section">
|
||||
<text class="section-title">行程安排</text>
|
||||
<view class="schedule" v-for="(day, index) in plan.schedule" :key="index">
|
||||
<text class="day">第{{ index + 1 }}天</text>
|
||||
<text class="content">{{ day }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 同行要求 -->
|
||||
<view class="section">
|
||||
<text class="section-title">同行要求</text>
|
||||
<text class="requirements">{{ plan.requirements }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="action-bar">
|
||||
<button class="btn join" @click="handleJoin">加入计划</button>
|
||||
<button class="btn contact" @click="handleContact">联系发起人</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
plan: {
|
||||
id: 1,
|
||||
destination: '西藏',
|
||||
startDate: '10月1日',
|
||||
endDate: '10月7日',
|
||||
budget: 5000,
|
||||
coverImage: '/static/travel/tibet.jpg',
|
||||
schedule: [
|
||||
'拉萨市区游览,参观布达拉宫、大昭寺',
|
||||
'前往纳木错,欣赏圣湖美景',
|
||||
'林芝地区游览,参观雅鲁藏布大峡谷',
|
||||
'返回拉萨,自由活动',
|
||||
'日喀则地区游览,参观扎什伦布寺',
|
||||
'珠峰大本营一日游',
|
||||
'返回拉萨,结束行程'
|
||||
],
|
||||
requirements: '1. 年龄18-35岁\n2. 身体健康,能适应高原环境\n3. 有团队精神,乐于分享'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleJoin() {
|
||||
uni.showToast({
|
||||
title: '已申请加入',
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
handleContact() {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: '13800138000'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
|
||||
.cover-image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.plan-header {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.section {
|
||||
padding: 30rpx;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.schedule {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.day {
|
||||
font-size: 28rpx;
|
||||
color: #007aff;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.requirements {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
white-space: pre-line;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
margin: 0 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.join {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.contact {
|
||||
background-color: #fff;
|
||||
color: #007aff;
|
||||
border: 1rpx solid #007aff;
|
||||
}
|
||||
</style>
|
||||
160
mini-program/pages/user/center.vue
Normal file
160
mini-program/pages/user/center.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-header">
|
||||
<image :src="user.avatar" class="avatar"></image>
|
||||
<view class="user-info">
|
||||
<text class="username">{{ user.nickname }}</text>
|
||||
<text class="member-level">{{ user.memberLevel }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单状态 -->
|
||||
<view class="order-status">
|
||||
<view
|
||||
class="status-item"
|
||||
v-for="item in orderStatus"
|
||||
:key="item.type"
|
||||
@click="navigateToOrder(item.type)"
|
||||
>
|
||||
<text class="count">{{ item.count }}</text>
|
||||
<text class="text">{{ item.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="function-list">
|
||||
<view
|
||||
class="function-item"
|
||||
v-for="item in functions"
|
||||
:key="item.text"
|
||||
@click="navigateTo(item.url)"
|
||||
>
|
||||
<uni-icons :type="item.icon" size="20" color="#666"></uni-icons>
|
||||
<text class="text">{{ item.text }}</text>
|
||||
<uni-icons type="arrowright" size="16" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
user: {
|
||||
avatar: '/static/user/avatar.jpg',
|
||||
nickname: '旅行爱好者',
|
||||
memberLevel: '黄金会员'
|
||||
},
|
||||
orderStatus: [
|
||||
{ type: 'all', text: '全部订单', count: 5 },
|
||||
{ type: 'unpaid', text: '待付款', count: 1 },
|
||||
{ type: 'undelivered', text: '待发货', count: 1 },
|
||||
{ type: 'delivered', text: '待收货', count: 2 },
|
||||
{ type: 'completed', text: '已完成', count: 1 }
|
||||
],
|
||||
functions: [
|
||||
{ icon: 'heart', text: '我的认养', url: '/pages/user/adoptions' },
|
||||
{ icon: 'map', text: '我的旅行计划', url: '/pages/user/travels' },
|
||||
{ icon: 'gift', text: '我的送花订单', url: '/pages/user/flowers' },
|
||||
{ icon: 'star', text: '我的收藏', url: '/pages/user/favorites' },
|
||||
{ icon: 'settings', text: '账户设置', url: '/pages/user/settings' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
navigateToOrder(type) {
|
||||
uni.navigateTo({ url: `/pages/user/orders?type=${type}` })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
background-color: #f8f9fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.user-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 40rpx 30rpx;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.username {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.member-level {
|
||||
font-size: 24rpx;
|
||||
color: #ff9500;
|
||||
background-color: #fff8e6;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
padding: 30rpx 0;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.count {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.function-list {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.function-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.function-item .text {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
</style>
|
||||
480
mini-program/pages/user/orders.vue
Normal file
480
mini-program/pages/user/orders.vue
Normal file
@@ -0,0 +1,480 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 订单类型选项卡 -->
|
||||
<view class="tab-bar">
|
||||
<view
|
||||
v-for="(tab, index) in tabs"
|
||||
:key="index"
|
||||
class="tab-item"
|
||||
:class="{ active: currentTab === index }"
|
||||
@click="switchTab(index)"
|
||||
>
|
||||
<text>{{ tab.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<scroll-view
|
||||
class="order-list"
|
||||
scroll-y="true"
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<view v-if="orders.length === 0" class="empty-tip">
|
||||
<image src="/static/user/empty-order.png" class="empty-image"></image>
|
||||
<text>暂无相关订单</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-for="(order, index) in orders"
|
||||
:key="index"
|
||||
class="order-item"
|
||||
@click="navigateToDetail(order.id)"
|
||||
>
|
||||
<!-- 订单头部 -->
|
||||
<view class="order-header">
|
||||
<text class="order-type">{{ getOrderTypeName(order.type) }}</text>
|
||||
<text class="order-status">{{ getStatusText(order.status) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 订单内容 -->
|
||||
<view class="order-content">
|
||||
<image :src="order.image" class="order-image"></image>
|
||||
<view class="order-info">
|
||||
<text class="order-title">{{ order.title }}</text>
|
||||
<text class="order-desc">{{ order.description }}</text>
|
||||
<view class="order-price-box">
|
||||
<text class="order-price">¥{{ order.price }}</text>
|
||||
<text class="order-count">x{{ order.count }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单底部 -->
|
||||
<view class="order-footer">
|
||||
<text class="order-total">共{{ order.count }}件商品 合计:¥{{ order.price * order.count }}</text>
|
||||
<view class="order-actions">
|
||||
<button
|
||||
v-if="order.status === 'unpaid'"
|
||||
class="action-btn primary"
|
||||
@click.stop="payOrder(order.id)"
|
||||
>立即付款</button>
|
||||
<button
|
||||
v-if="order.status === 'delivered'"
|
||||
class="action-btn primary"
|
||||
@click.stop="confirmReceive(order.id)"
|
||||
>确认收货</button>
|
||||
<button
|
||||
v-if="order.status === 'completed'"
|
||||
class="action-btn"
|
||||
@click.stop="reviewOrder(order.id)"
|
||||
>评价</button>
|
||||
<button
|
||||
class="action-btn"
|
||||
@click.stop="deleteOrder(order.id)"
|
||||
>删除订单</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="loading" class="loading">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-if="noMore && orders.length > 0" class="no-more">
|
||||
<text>没有更多订单了</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabs: [
|
||||
{ text: '全部', type: 'all' },
|
||||
{ text: '待付款', type: 'unpaid' },
|
||||
{ text: '待发货', type: 'undelivered' },
|
||||
{ text: '待收货', type: 'delivered' },
|
||||
{ text: '已完成', type: 'completed' }
|
||||
],
|
||||
currentTab: 0,
|
||||
orders: [],
|
||||
page: 1,
|
||||
loading: false,
|
||||
noMore: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 如果有传入类型参数,切换到对应选项卡
|
||||
if (options.type) {
|
||||
const index = this.tabs.findIndex(tab => tab.type === options.type)
|
||||
if (index !== -1) {
|
||||
this.currentTab = index
|
||||
}
|
||||
}
|
||||
this.loadOrders()
|
||||
},
|
||||
methods: {
|
||||
switchTab(index) {
|
||||
if (this.currentTab === index) return
|
||||
this.currentTab = index
|
||||
this.page = 1
|
||||
this.orders = []
|
||||
this.noMore = false
|
||||
this.loadOrders()
|
||||
},
|
||||
loadOrders() {
|
||||
if (this.loading || this.noMore) return
|
||||
|
||||
this.loading = true
|
||||
|
||||
// 模拟API请求
|
||||
setTimeout(() => {
|
||||
const type = this.tabs[this.currentTab].type
|
||||
const newOrders = this.getMockOrders(type, this.page)
|
||||
|
||||
if (newOrders.length === 0) {
|
||||
this.noMore = true
|
||||
} else {
|
||||
this.orders = [...this.orders, ...newOrders]
|
||||
this.page++
|
||||
}
|
||||
|
||||
this.loading = false
|
||||
}, 1000)
|
||||
},
|
||||
loadMore() {
|
||||
this.loadOrders()
|
||||
},
|
||||
getMockOrders(type, page) {
|
||||
// 模拟数据,实际应从API获取
|
||||
const allOrders = [
|
||||
{
|
||||
id: '1001',
|
||||
type: 'travel',
|
||||
status: 'unpaid',
|
||||
title: '西藏旅行计划',
|
||||
description: '10月1日-10月7日',
|
||||
price: 5000,
|
||||
count: 1,
|
||||
image: '/static/travel/tibet.jpg'
|
||||
},
|
||||
{
|
||||
id: '1002',
|
||||
type: 'animal',
|
||||
status: 'undelivered',
|
||||
title: '小羊驼认养',
|
||||
description: '认养期限:1年',
|
||||
price: 1000,
|
||||
count: 1,
|
||||
image: '/static/animals/alpaca.jpg'
|
||||
},
|
||||
{
|
||||
id: '1003',
|
||||
type: 'flower',
|
||||
status: 'delivered',
|
||||
title: '浪漫玫瑰花束',
|
||||
description: '11朵红玫瑰',
|
||||
price: 199,
|
||||
count: 1,
|
||||
image: '/static/flowers/rose.jpg'
|
||||
},
|
||||
{
|
||||
id: '1004',
|
||||
type: 'flower',
|
||||
status: 'completed',
|
||||
title: '向日葵花束',
|
||||
description: '9朵向日葵',
|
||||
price: 179,
|
||||
count: 1,
|
||||
image: '/static/flowers/sunflower.jpg'
|
||||
}
|
||||
]
|
||||
|
||||
// 根据类型筛选
|
||||
let filteredOrders = allOrders
|
||||
if (type !== 'all') {
|
||||
filteredOrders = allOrders.filter(order => order.status === type)
|
||||
}
|
||||
|
||||
// 分页
|
||||
const pageSize = 5
|
||||
const start = (page - 1) * pageSize
|
||||
const end = page * pageSize
|
||||
|
||||
return filteredOrders.slice(start, end)
|
||||
},
|
||||
getOrderTypeName(type) {
|
||||
const typeMap = {
|
||||
travel: '旅行计划',
|
||||
animal: '动物认养',
|
||||
flower: '送花服务'
|
||||
}
|
||||
return typeMap[type] || '订单'
|
||||
},
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
unpaid: '待付款',
|
||||
undelivered: '待发货',
|
||||
delivered: '待收货',
|
||||
completed: '已完成'
|
||||
}
|
||||
return statusMap[status] || '未知状态'
|
||||
},
|
||||
navigateToDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/user/order-detail?id=${id}`
|
||||
})
|
||||
},
|
||||
payOrder(id) {
|
||||
uni.showModal({
|
||||
title: '支付提示',
|
||||
content: '确定要支付此订单吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 模拟支付流程
|
||||
uni.showLoading({
|
||||
title: '支付中...'
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
// 更新订单状态
|
||||
this.updateOrderStatus(id, 'undelivered')
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
confirmReceive(id) {
|
||||
uni.showModal({
|
||||
title: '确认收货',
|
||||
content: '确认已收到商品吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '确认成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
// 更新订单状态
|
||||
this.updateOrderStatus(id, 'completed')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
reviewOrder(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/user/review?id=${id}`
|
||||
})
|
||||
},
|
||||
deleteOrder(id) {
|
||||
uni.showModal({
|
||||
title: '删除订单',
|
||||
content: '确定要删除此订单吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 从列表中移除
|
||||
const index = this.orders.findIndex(order => order.id === id)
|
||||
if (index !== -1) {
|
||||
this.orders.splice(index, 1)
|
||||
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
updateOrderStatus(id, newStatus) {
|
||||
const order = this.orders.find(order => order.id === id)
|
||||
if (order) {
|
||||
order.status = newStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.tab-bar {
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 40rpx;
|
||||
height: 4rpx;
|
||||
background-color: #007aff;
|
||||
}
|
||||
|
||||
.order-list {
|
||||
flex: 1;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.empty-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
background-color: #fff;
|
||||
border-radius: 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.order-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.order-type {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.order-status {
|
||||
font-size: 28rpx;
|
||||
color: #ff9500;
|
||||
}
|
||||
|
||||
.order-content {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.order-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.order-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.order-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.order-desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.order-price-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.order-price {
|
||||
font-size: 28rpx;
|
||||
color: #ff2d55;
|
||||
}
|
||||
|
||||
.order-count {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.order-footer {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.order-total {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
text-align: right;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.order-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
margin-left: 20rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 0 30rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border: 1rpx solid #ddd;
|
||||
background-color: #fff;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.action-btn.primary {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.loading, .no-more {
|
||||
text-align: center;
|
||||
padding: 20rpx 0;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user