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

94 lines
1.9 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 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: 'unpaid'
  29. }, {
  30. name: '已付款',
  31. type: 'paid'
  32. },
  33. {
  34. name: '已完成',
  35. type: 'complete'
  36. },
  37. {
  38. name:'售后',
  39. type: 'after_sales'
  40. }
  41. ],
  42. tabIndex: 0, // 当前tab的下标
  43. assetsType: '', //账户类型
  44. orderType: []
  45. }
  46. },
  47. onLoad(e) {
  48. this.assetsType = e.type
  49. this.tabIndex = this.assetsType === 'all' ? 0 : this.assetsType === 'unpaid' ? 1 : this.assetsType === 'paid' ? 2 : 0
  50. // 需要固定swiper的高度
  51. this.height = (uni.getSystemInfoSync().windowHeight) + 'px'
  52. },
  53. methods: {
  54. // 轮播菜单
  55. swiperChange(e) {
  56. this.tabIndex = e.detail.current
  57. },
  58. //返回
  59. back() {
  60. if (this.assetsType === 'all2') {
  61. // #ifdef H5
  62. window.history.go(-2)
  63. // #endif
  64. // #ifndef H5
  65. uni.navigateBack({
  66. delta: 2
  67. });
  68. // #endif
  69. } else {
  70. // #ifdef H5
  71. window.history.go(-1)
  72. // #endif
  73. // #ifndef H5
  74. uni.navigateBack({
  75. delta: 1
  76. });
  77. // #endif
  78. }
  79. }
  80. },
  81. created() {
  82. }
  83. }
  84. </script>
  85. <style>
  86. </style>