xiaokuaisong-xiaochengxu/uniapp04/pages/fullOrder/fullOrder.vue
2024-10-18 15:53:00 +08:00

347 lines
6.9 KiB
Vue

<script setup lang="ts">
/* 我的订单 */
import { ref } from 'vue'
import { reactive } from 'vue'
const currentIndex = ref(0);
const tabs = ref([
{ name: '全部' },
{ name: '进行中' },
{ name: '已完成' }
]);
const switchTab = (index) => {
currentIndex.value = index;
};
const { safeAreaInsets } = uni.getSystemInfoSync()
const orderTabs = ref([
{ orderState: 0, title: '全部' },
{ orderState: 1, title: '进行中' },
{ orderState: 2, title: '评价' },
{ orderState: 3, title: '退款' },
])
const active = ref(1)
const list1 = reactive([
{ title: '备餐中' },
{ title: '已出餐' },
{ title: '已完成' }
])
</script>
<template>
<view class="tab-menu">
<view class="tab-item"
v-for="(tab, index) in tabs"
:key="index"
:class="{active: currentIndex === index}"
@click="switchTab(index)">
{{ tab.name }}
</view>
</view>
<view class="content">
<block v-if="currentIndex === 0">
</block>
<block v-if="currentIndex === 1">
</block>
<block v-if="currentIndex === 2">
</block>
</view>
<view class="viewport">
<!-- 订单列表 -->
<scroll-view scroll-y class="orders">
<view class="card" v-for="item in 3" :key="item">
<view class="status">
<text class="title">果果家超市 ></text>
<text>进行中...</text>
<text class="icon-delete"></text>
</view>
<navigator
v-for="sku in 1"
:key="sku"
class="goods"
:url="`/pagesOrder/detail/detail?id=1`"
hover-class="none"
>
<view class="cover">
<image
mode="aspectFit"
src="https://img95.699pic.com/photo/50069/5445.jpg_wh860.jpg"
></image>
</view>
<view class="meta">
<view class="type">烧烤</view>
<view class="type">牛肉 50串</view>
<text class="type">下单即送20积分</text>
</view>
</navigator>
<view>
<uni-steps :options="list1" :active="active" />
</view>
<view class="action">
<template v-if="true">
<view class="button primary">在线联系</view>
<navigator url="/pages/orderEvaluation/orderEvaluation" class="button primary">去评价</navigator>
</template>
<template v-else>
<navigator
class="button secondary"
:url="`/pagesOrder/create/create?orderId=id`"
hover-class="none"
>
再次购买
</navigator>
<view v-if="false" class="button primary">确认收货</view>
</template>
</view>
</view>
<view class="loading-text" :style="{ paddingBottom: safeAreaInsets?.bottom + 'px' }">
{{ true ? '没有更多数据~' : '正在加载...' }}
</view>
</scroll-view>
</view>
</template>
<style lang="scss">
page {
height: 100%;
overflow: hidden;
}
.viewport {
height: 100%;
display: flex;
flex-direction: column;
background-color: #fff;
}
.tabs {
display: flex;
justify-content: space-around;
line-height: 60rpx;
margin: 0 10rpx;
background-color: #fff;
box-shadow: 0 4rpx 6rpx rgba(240, 240, 240, 0.6);
position: relative;
z-index: 9;
.item {
flex: 1;
text-align: center;
padding: 20rpx;
font-size: 28rpx;
color: #262626;
}
.cursor {
position: absolute;
left: 0;
bottom: 0;
width: 20%;
height: 6rpx;
padding: 0 50rpx;
background-color: #4095e5;
transition: all 0.4s;
}
}
.swiper {
background-color: #4095e5;
}
.orders {
.card {
min-height: 100rpx;
padding: 20rpx;
margin: 20rpx 20rpx 0;
border-radius: 10rpx;
background-color: #fff;
&:last-child {
padding-bottom: 40rpx;
}
}
.status {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #999;
margin-bottom: 15rpx;
.title {
color: #343434;
font-weight: 700;
flex: 1;
}
.primary {
color: #ff9240;
}
.icon-delete {
line-height: 1;
margin-left: 10rpx;
padding-left: 10rpx;
border-left: 1rpx solid #e3e3e3;
}
}
.goods {
display: flex;
margin-bottom: 20rpx;
.cover {
width: 170rpx;
height: 170rpx;
margin-right: 20rpx;
border-radius: 10rpx;
overflow: hidden;
position: relative;
}
.quantity {
position: absolute;
bottom: 0;
right: 0;
line-height: 1;
padding: 6rpx 4rpx 6rpx 8rpx;
font-size: 24rpx;
color: #fff;
border-radius: 10rpx 0 0 0;
background-color: rgba(0, 0, 0, 0.6);
}
.meta {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.name {
height: 80rpx;
font-size: 26rpx;
color: #444;
}
.type {
line-height: 1.8;
padding: 0 15rpx;
margin-top: 10rpx;
font-size: 24rpx;
align-self: flex-start;
border-radius: 4rpx;
color: #888;
background-color: #f7f7f8;
}
.more {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
font-size: 22rpx;
color: #333;
}
}
.action {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 20rpx;
.button {
width: 180rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 20rpx;
border-radius: 60rpx;
border: 1rpx solid #ccc;
font-size: 26rpx;
color: #444;
}
.secondary {
color: #4095e5;
border-color: #4095e5;
}
.primary {
color: #fff;
background-color: #4095e5;
}
}
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
}
image {
width: 100%;
height: 100%;
border-radius: 20px;
}
.status-btn {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
height: 92rpx;
margin: 30rpx;
background-color: #007AFF;
}
.example-body {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
padding: 15px;
flex-direction: row;
}
.tab-menu {
display: flex;
justify-content: space-around;
padding: 10px 0;
background-color: #f5f5f5;
}
.tab-item {
padding: 10px;
cursor: pointer;
}
.tab-item.active {
color: #007aff;
font-weight: bold;
}
</style>