shop-detail.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="container">
  3. <view class="tabs">
  4. <scroll-view scroll-x class="bg-white nav">
  5. <view class="flex text-center">
  6. <view class="cu-item flex-sub" :class="index==current?'text-base cur text-xl text-bold ':'text-lg'"
  7. v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)">
  8. {{item.name}}
  9. </view>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. <view style="height: 100%;">
  14. <swiper style="height: 100%;" :current="current" @change="swiperChange" @animationfinish="animationfinish">
  15. <swiper-item v-for="(item,index) in tabs" :key="index">
  16. <scroll-view scroll-y style="height: 100%;">
  17. <shop-info v-if="current==0&&id!=''" ref="shopInfo" :shopId="id"></shop-info>
  18. <shop-activity v-if="current==1&&id!=''" ref="mallInfo" :shopId="id"></shop-activity>
  19. </scroll-view>
  20. </swiper-item>
  21. </swiper>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import shopActivity from "./comps/shop-activity.vue"
  27. import shopInfo from "./comps/shop-info.vue"
  28. export default {
  29. components:{
  30. shopInfo,shopActivity
  31. },
  32. data() {
  33. return {
  34. id: '',
  35. detail: {},
  36. tags: [],
  37. current: 0,
  38. swiperCurrent: 0,
  39. tabs: [{
  40. name: '商户信息',
  41. value: 0
  42. },
  43. {
  44. name: '商户活动',
  45. value: 1
  46. }
  47. ],
  48. }
  49. },
  50. onLoad(options) {
  51. this.id=options.id
  52. },
  53. methods: {
  54. tabChange(index) {
  55. this.current = index
  56. },
  57. swiperChange(e) {
  58. uni.pageScrollTo({
  59. scrollTop: 0,
  60. duration: 0
  61. });
  62. this.current = e.detail.current
  63. },
  64. animationfinish({
  65. detail: {
  66. current
  67. }
  68. }) {
  69. this.swiperCurrent = current;
  70. this.current = current;
  71. },
  72. }
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .text-xl {
  77. font-size: 34rpx;
  78. }
  79. .container {
  80. height: calc(100vh);
  81. background-color: #F6F6F6;
  82. padding: 78rpx 0rpx 0rpx;
  83. .tabs {
  84. position: fixed;
  85. top: -12rpx;
  86. left: 0;
  87. width: 100%;
  88. background-color: #FFFFFF;
  89. box-sizing: border-box;
  90. z-index: 3;
  91. }
  92. }
  93. </style>