user_order.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view class="user-order">
  3. <tabs :current="active" @change="changeShow" bar-width="60" :is-scroll="false">
  4. <tab v-for="(item, index) in order" :key="index" :name="item.name">
  5. <order-list :order-type="item.type" :i="index" :index="active"></order-list>
  6. </tab>
  7. </tabs>
  8. <float-tab></float-tab>
  9. </view>
  10. </template>
  11. <script>
  12. import { orderType } from '@/utils/type';
  13. export default {
  14. data() {
  15. return {
  16. active: -1,
  17. order: [{
  18. name: '全部',
  19. type: orderType.ALL
  20. }, {
  21. name: '待付款',
  22. type: orderType.PAY
  23. }, {
  24. name: '待收货',
  25. type: orderType.DELIVERY
  26. }, {
  27. name: '已完成',
  28. type: orderType.FINISH
  29. }, {
  30. name: '已关闭',
  31. type: orderType.CLOSE
  32. }]
  33. };
  34. },
  35. onLoad (options) {
  36. const{order} = this
  37. let type = this.$Route.query.type || orderType.ALL;
  38. let index = order.findIndex(item => item.type == type)
  39. this.changeShow(index);
  40. },
  41. methods: {
  42. changeShow(index) {
  43. if(index != -1) {
  44. this.$nextTick(() => {
  45. this.active = index
  46. })
  47. }
  48. },
  49. }
  50. };
  51. </script>
  52. <style>
  53. </style>