xiaokuaisong-xiaochengxu/uniapp04/pages/fullOrder/fullOrder.vue

293 lines
5.4 KiB
Vue
Raw Permalink Normal View History

2024-10-18 07:53:00 +00:00
<script setup lang="ts">
2025-04-11 06:42:29 +00:00
import { onLoad } from '@dcloudio/uni-app'
import { ref, reactive, onMounted } from 'vue'
import { apiImageUrl } from '../../API/api'
import orderStateVue from './orderState.vue';
import orderStateZeroVue from './orderStateZero.vue';
import orderStateOneNvue from './orderStateOne.nvue';
import orderStateThree from './orderStateThree.vue';
import orderStateFiveVue from './orderStateFive.vue';
2024-10-18 07:53:00 +00:00
2025-04-11 06:42:29 +00:00
const currentIndex = ref(0);
const tabs = ref([
{ name: '未支付' }, // 对应type=1
{ name: '已支付' }, // 对应type=2
{ name: '已退款' }, // 对应type=3
{ name: '已出餐' }, // 对应type=4
{ name: '已完成' } // 对应type=5
]);
2024-10-18 07:53:00 +00:00
2025-04-11 06:42:29 +00:00
onLoad((options) => {
if (options.type) {
const typeNumber = parseInt(options.type)
currentIndex.value = typeNumber - 1 // 将type值转为数组索引
}
})
2024-10-18 07:53:00 +00:00
2025-04-11 06:42:29 +00:00
const switchTab = (index) => {
currentIndex.value = index;
};
2024-10-18 07:53:00 +00:00
2025-04-11 06:42:29 +00:00
const { safeAreaInsets } = uni.getSystemInfoSync()
2024-10-18 07:53:00 +00:00
</script>
2025-04-11 06:42:29 +00:00
2024-10-18 07:53:00 +00:00
<template>
<view class="tab-menu">
2025-04-11 06:42:29 +00:00
<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">
<orderStateVue></orderStateVue>
</block>
<block v-if="currentIndex === 1">
<orderStateZeroVue></orderStateZeroVue>
</block>
<block v-if="currentIndex === 2">
<orderStateOneNvue></orderStateOneNvue>
</block>
<block v-if="currentIndex === 3">
<orderStateThree></orderStateThree>
</block>
<block v-if="currentIndex === 4">
<orderStateFiveVue></orderStateFiveVue>
</block>
</view>
2024-10-18 07:53:00 +00:00
</template>
2025-04-11 06:42:29 +00:00
2024-10-18 07:53:00 +00:00
<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>