youdas/pages/mall/order-list.vue
2025-06-23 01:52:56 +08:00

69 lines
2.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 滑动切换选项卡演示(标准写法) -->
<template>
<PageNoContainer ref="pageContainer" title="我的订单" :showBack="true">
<!-- 使用z-paging-swiper为根节点可以免计算高度 -->
<z-paging-swiper :fixed="false">
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中 -->
<!-- 注意此处的z-tabs为独立的组件可替换为第三方的tabs若需要使用z-tabs请在插件市场搜索z-tabs并引入否则会报插件找不到的错误 -->
<template #top>
<z-tabs ref="tabs" :list="tabList" :current="current" @change="tabsChange" />
</template>
<!-- swiper必须设置height:100%因为swiper有默认的高度只有设置高度100%才可以铺满页面 -->
<swiper class="swiper" :current="current" @transition="swiperTransition"
@animationfinish="swiperAnimationfinish">
<swiper-item class="swiper-item" v-for="(item, index) in tabList" :key="index">
<order-list-item :tabIndex="index" :currentIndex="current" :responseCallback="responseCallback">
</order-list-item>
</swiper-item>
</swiper>
</z-paging-swiper>
</PageNoContainer>
</template>
<script setup>
import { ref } from 'vue';
const paging = ref(null);
const tabs = ref(null);
const current = ref(0);
const tabList = ref(['全部', '待发货', '待收货', '评价', '售后']);
onLoad((options) => {
console.log(options);
if (options.type) {
current.value = Number(options.type);
}
});
// tabs通知swiper切换
const tabsChange = (index) => {
current.value = index;
}
// swiper滑动中
const swiperTransition = (e) => {
tabs.value.setDx(e.detail.dx);
}
// swiper滑动结束
const swiperAnimationfinish = (e) => {
current.value = e.detail.current;
tabs.value.unlockDx();
}
const responseCallback = (params) => {
return new Promise((resolve, reject) => {
resolve({ list: [] });
});
}
</script>
<style lang="scss" scoped>
.swiper {
height:90vh;
}
.swiper-item {
}
</style>