猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

128 lines
2.6 KiB

<template>
<view>
<view class="header-buts flex flex-center">
<view class="flex buts-box">
<view class="buts" :class="{'buts-active':activeIndex===1}" @click="activeIndex=1">总订单</view>
<view class="buts" :class="{'buts-active':activeIndex===2}" @click="activeIndex=2">日订单</view>
</view>
</view>
<up-sticky bgColor="#fff" v-if="activeIndex == 1">
<view class="container-tabs">
<up-tabs :list="tabList1" lineWidth="68rpx" :activeStyle="{
color: '#FFFFFF',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#FFFFFF',
transform: 'scale(1)'
}" :itemStyle="{height:'88rpx',padding:'0 52rpx'}" lineColor="#FFFFFF" @click="activeIndex1Click"></up-tabs>
</view>
</up-sticky>
<up-sticky bgColor="#fff" v-else>
<view class="container-tabs">
<up-tabs :list="tabList2" lineWidth="68rpx" :activeStyle="{
color: '#FFFFFF',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#FFFFFF',
transform: 'scale(1)'
}" :itemStyle="{height:'88rpx',padding:'0 52rpx', width : '400rpx'}" lineColor="#FFFFFF"></up-tabs>
</view>
</up-sticky>
<view class="container">
<systemOrder :list="list" :current="current" v-if="activeIndex == 1" />
<orderListByData :list="list" v-else />
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from "vue";
import systemOrder from "./components/systemOrder.vue";
import orderListByData from "./components/orderListByData.vue";
import {
onShow
} from "@dcloudio/uni-app"
import {
getIsLogin
} from "@/utils/auth.js"
// import personOrder from "./components/personOrder.vue";
// import lossOrder from "./components/lossOrder.vue";
import {
getAppOrderList,
} from "@/api/order/order.js"
onShow(() => {
if (!getIsLogin()) {
uni.navigateTo({
url: "/pages/login/index"
})
}
})
const current = ref(0)
const activeIndex = ref(1)
const list = ref([])
const tabList1 = reactive([{
name: '待服务',
badge: {
// value: 5,
}
},
{
name: '进行中',
badge: {
// value: 5,
}
},
{
name: '已完成',
badge: {
// value: 5,
}
},
])
const tabList2 = reactive([{
name: '待上门',
badge: {
// value: 5,
}
},
{
name: '已完成',
badge: {
// value: 5,
}
},
])
function getList() {
getAppOrderList()
.then(res => {
if (res.code == 200) {
list.value = res.rows
}
})
}
getList()
const activeIndex1Click = (item) => {
current.value = item.index;
}
</script>
<style scoped lang="scss">
@import "index.scss";
</style>