时空网前端
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.

85 lines
1.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <!-- 当设置tab-width,指定每个tab宽度时,则不使用flex布局,改用水平滑动 -->
  4. <view class="padding-lr">
  5. <me-tabs style="border-top: 1px solid #f7f7f7;box-sizing:content-box;border-radius: 10px;" v-model="tabIndex" :tabs="tabs" :fixed="true"></me-tabs>
  6. </view>
  7. <swiper :style="{height: height}" :current="tabIndex" @change="swiperChange">
  8. <swiper-item v-for="(tab,i) in tabs" :key="i">
  9. <mescroll-item :i="i" :index="tabIndex" :tabs="tabs"></mescroll-item>
  10. </swiper-item>
  11. </swiper>
  12. </view>
  13. </template>
  14. <script>
  15. import MescrollItem from "./order-item.vue";
  16. export default {
  17. components: {
  18. MescrollItem
  19. },
  20. data() {
  21. return {
  22. height: "400px", // 需要固定swiper的高度
  23. tabs: [{
  24. name: '全部',
  25. type: 'all'
  26. }, {
  27. name: '待付款',
  28. type: 'delivered'
  29. }, {
  30. name: '已付款',
  31. type: 'receiving'
  32. },
  33. {
  34. name: '已完成',
  35. type: 'complete'
  36. }],
  37. tabIndex: 0, // 当前tab的下标
  38. assetsType: '' //账户类型
  39. }
  40. },
  41. onLoad(e) {
  42. this.assetsType = e.type
  43. this.tabIndex = this.assetsType === 'all' ? 0 : this.assetsType === 'delivered' ? 1 : this.assetsType === 'receiving' ? 2 : 0
  44. // 需要固定swiper的高度
  45. this.height = (uni.getSystemInfoSync().windowHeight -30) + 'px'
  46. },
  47. methods: {
  48. // 轮播菜单
  49. swiperChange(e) {
  50. this.tabIndex = e.detail.current
  51. },
  52. //返回
  53. back() {
  54. if (this.assetsType === 'all2') {
  55. // #ifdef H5
  56. window.history.go(-2)
  57. // #endif
  58. // #ifndef H5
  59. uni.navigateBack({
  60. delta: 2
  61. });
  62. // #endif
  63. } else {
  64. // #ifdef H5
  65. window.history.go(-1)
  66. // #endif
  67. // #ifndef H5
  68. uni.navigateBack({
  69. delta: 1
  70. });
  71. // #endif
  72. }
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. </style>