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

100 lines
2.1 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
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: '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. }
  45. },
  46. onLoad(e) {
  47. this.assetsType = e.type
  48. this.tabIndex = this.assetsType === 'all' ? 0 : this.assetsType === 'unpaid' ? 1 : this.assetsType === 'paid' ? 2 : 0
  49. // 需要固定swiper的高度
  50. this.height = (uni.getSystemInfoSync().windowHeight) + 'px'
  51. },
  52. methods: {
  53. getUserOrder() {
  54. this.$http(this.API.API_USERORDER, {state: this.tabs[this.tabIndex].type,page: 1,per_page: 20}).then(res => {
  55. console.log(res);
  56. }).catch(err => err);
  57. },
  58. // 轮播菜单
  59. swiperChange(e) {
  60. this.tabIndex = e.detail.current
  61. },
  62. //返回
  63. back() {
  64. if (this.assetsType === 'all2') {
  65. // #ifdef H5
  66. window.history.go(-2)
  67. // #endif
  68. // #ifndef H5
  69. uni.navigateBack({
  70. delta: 2
  71. });
  72. // #endif
  73. } else {
  74. // #ifdef H5
  75. window.history.go(-1)
  76. // #endif
  77. // #ifndef H5
  78. uni.navigateBack({
  79. delta: 1
  80. });
  81. // #endif
  82. }
  83. }
  84. },
  85. created() {
  86. this.getUserOrder()
  87. }
  88. }
  89. </script>
  90. <style>
  91. </style>