index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <page-meta page-style="overflow: hidden" />
  3. <page title="仓库" ref="pageRef" nav-color="#fff" custom-class="paddingB25">
  4. <tabbar
  5. :data="tabbarData"
  6. custom-class="paddingX20 marginB7"
  7. @change="onChange"
  8. ref="tabRef"
  9. />
  10. <no-use
  11. v-if="index === 0"
  12. ref="noUseRef"
  13. @convert-success="onConvertSuccess"
  14. @take-success="onTakeSuccess"
  15. :type="type"
  16. />
  17. <safe v-if="index === 1" />
  18. <pick-up v-if="index === 2" ref="pickUpRef" />
  19. <convert v-if="index === 3" ref="convertRef" />
  20. <goods-gift v-if="index === 4" />
  21. </page>
  22. </template>
  23. <script>
  24. import tabbar from '@/components/tabbar'
  25. import noUse from './no_use.vue'
  26. import pickUp from './pick_up'
  27. import convert from './convert'
  28. import goodsGift from './goods_gift.vue'
  29. import safe from './safe'
  30. import loginMixin from '@/mixin/login'
  31. export default {
  32. mixins: [loginMixin],
  33. components: { tabbar, noUse, pickUp, convert, safe, goodsGift },
  34. data() {
  35. return {
  36. tabbarDataHide: ['未使用', '保险柜', '已提货', '已兑换', '已转赠'],
  37. tabbarData: ['未使用', '保险柜', '已提货'],
  38. index: 0,
  39. type: 0
  40. }
  41. },
  42. onLoad(options) {
  43. this.type = options.type
  44. this.$event.on(this.$event.key.STORE_REFRESH, this.refresh)
  45. },
  46. onUnload() {
  47. this.$event.off(this.$event.key.STORE_REFRESH)
  48. },
  49. onShow(){
  50. if(this.index == 0){
  51. this.$refs.noUseRef.refresh(true)
  52. }
  53. },
  54. computed: {
  55. hide() {
  56. return !this.$store.state.hide
  57. }
  58. },
  59. methods: {
  60. init() {
  61. let index = this.index
  62. this.index = -1
  63. this.$nextTick(() => {
  64. this.index = index
  65. })
  66. },
  67. refresh() {
  68. if (this.index === 0) {
  69. this.$refs.noUseRef &&
  70. this.$refs.noUseRef.refresh &&
  71. this.$refs.noUseRef.refresh(true)
  72. }
  73. },
  74. onChange(index) {
  75. this.index = index
  76. },
  77. onConvertSuccess() {
  78. // this.$refs.tabRef.change(2)
  79. },
  80. onTakeSuccess() {
  81. // this.$refs.tabRef.change(1)
  82. }
  83. }
  84. }
  85. </script>
  86. <style></style>
  87. <style lang="scss" scoped>
  88. .bg {
  89. position: fixed;
  90. z-index: -1;
  91. left: 0;
  92. right: 0;
  93. top: 0;
  94. width: 100%;
  95. height: 100%;
  96. opacity: 0.3;
  97. }
  98. </style>