exchange_order.vue 1.1 KB

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