index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <page-meta page-style="overflow: hidden" />
  3. <page title="魔换" ref="pageRef" light nav-color="transparent">
  4. <tabbar
  5. :data="tabbarData"
  6. :initial="initial"
  7. custom-class="paddingX20 marginB7"
  8. @change="onChange"
  9. ref="tabRef"
  10. />
  11. <publish-record v-if="index === 0" />
  12. <bid-record v-if="index === 1" />
  13. <sell-list v-if="index === 2" />
  14. <buy-record v-if="index === 3" />
  15. <image
  16. v-if="index === 2"
  17. @click="showWallet"
  18. :src="resource.sell_wallet"
  19. class="fixedBtn"
  20. />
  21. <image
  22. v-if="index === 0"
  23. @click="showPublish"
  24. :src="resource.sell_publish"
  25. class="fixedBtn"
  26. />
  27. </page>
  28. </template>
  29. <script>
  30. import tabbar from '@/components/tabbar'
  31. import loginMixin from '@/mixin/login'
  32. import publishRecord from './publish_record'
  33. import bidRecord from './bid_record'
  34. import buyRecord from './buy_record'
  35. import sellList from './sell-list'
  36. import resource from '@/utils/resource'
  37. export default {
  38. mixins: [loginMixin],
  39. components: { tabbar, publishRecord, bidRecord, buyRecord, sellList },
  40. data() {
  41. return {
  42. tabbarData: ['我发布的', '我出价的', '我卖出的', '我买到的'],
  43. initial: -1,
  44. index: -1,
  45. resource
  46. }
  47. },
  48. onLoad(options) {
  49. if (options.active) {
  50. this.initial = options.active - 0
  51. this.index = this.initial
  52. } else {
  53. this.initial = 0
  54. this.index = 0
  55. }
  56. },
  57. methods: {
  58. init() {
  59. let index = this.index
  60. this.index = -1
  61. this.$nextTick(() => {
  62. this.index = index
  63. })
  64. },
  65. onChange(index) {
  66. this.index = index
  67. },
  68. showWallet() {
  69. this.$router.push('wallet', { type: 1 })
  70. },
  71. showPublish() {
  72. this.$router.push('store', { type: 1 })
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. </style>
  79. <style lang="scss" scoped>
  80. .bg {
  81. position: fixed;
  82. z-index: -1;
  83. left: 0;
  84. right: 0;
  85. top: 0;
  86. width: 100%;
  87. height: 100%;
  88. opacity: 0.3;
  89. }
  90. .fixedBtn {
  91. width: 94rpx;
  92. height: 100rpx;
  93. position: fixed;
  94. right: 20rpx;
  95. bottom: 180rpx;
  96. }
  97. </style>