good-activity.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view
  3. class="common_contant"
  4. :style="{
  5. padding: active.activeType == '2' ? '' : '24rpx',
  6. backgroundColor: active.activeType == '1' ? '#F7F7F7' : '#fff'
  7. }"
  8. >
  9. <tui-skeleton
  10. v-if="skeletonShow"
  11. backgroundColor="#fafafa"
  12. borderRadius="10rpx"
  13. :isLoading="true"
  14. :loadingType="5"
  15. />
  16. <view v-else>
  17. <view class="img_big" v-if="active.activeType == '2'" @click="activeProducts">
  18. <image style="width: 100%;height: 100%;" :src="active.activeImageVos[0].image" mode="aspectFill"></image>
  19. </view>
  20. <view class="special_all" v-if="active.activeType == '3'">
  21. <SpecialItem v-for="(item, index) in active.activeImageVos" :key="index" :activeImage="item" />
  22. </view>
  23. <view class="product_all" v-if="active.activeType == '1'">
  24. <ProGood v-for="item in active.products" :key="item" :storeInfo="item" />
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import jumpMixins from '@/mixins/jumpMixins.js'
  31. import SpecialItem from './components/cm-special.vue'
  32. import ProGood from './components/procurement_good.vue'
  33. import shareMixin from '@/mixins/shareMixin.js'
  34. export default {
  35. mixins: [ shareMixin,jumpMixins ],
  36. components: {
  37. SpecialItem,
  38. ProGood
  39. },
  40. data() {
  41. return {
  42. skeletonShow: true,
  43. active: {}, // 活动数据
  44. refleshdata: {} // 刷新数据
  45. }
  46. },
  47. mounted() {},
  48. onLoad(options) {
  49. this.refleshdata = options
  50. this.specialInfo(options)
  51. },
  52. onPullDownRefresh() {
  53. this.skeletonShow = true
  54. this.specialInfo(this.refleshdata)
  55. uni.stopPullDownRefresh()
  56. },
  57. methods: {
  58. // 活动数据
  59. async specialInfo(options) {
  60. try {
  61. const { data } = await this.SpecialService.specialInfo({ organizeId: options.organizeId, activeId: options.jumpActiveId })
  62. this.active = data.active
  63. uni.setNavigationBarTitle({
  64. title: data.active.topic
  65. })
  66. this.skeletonShow = false
  67. } catch (error) {
  68. console.log('error', error)
  69. }
  70. },
  71. // 跳转活动商品列表
  72. activeProducts() {
  73. uni.navigateTo({
  74. url: '/pages/goods/active-product?activeImageId=' + this.active.activeImageVos[0].id
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .common_contant {
  82. height: 100%;
  83. box-sizing: border-box;
  84. }
  85. .img_big {
  86. width: 100vw;
  87. height: 100vh;
  88. }
  89. .product_all {
  90. background: #f7f7f7;
  91. display: flex;
  92. justify-content: space-between;
  93. flex-wrap: wrap;
  94. align-items: center;
  95. }
  96. </style>