active-product.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view class="">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="active-product" v-else>
  11. <ProGood v-for="item in activeProductList" :key="item" :storeInfo="item" />
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import ProGood from './components/procurement_good.vue'
  17. export default {
  18. components: {
  19. ProGood,
  20. },
  21. data() {
  22. return {
  23. skeletonShow: true,
  24. activeProductList: [], // 活动商品列表
  25. refleshdata: {} // 刷新数据
  26. }
  27. },
  28. onLoad(options) {
  29. this.refleshdata = options
  30. this.activeProduct(options)
  31. },
  32. onPullDownRefresh() {
  33. this.skeletonShow = true
  34. this.activeProduct(this.refleshdata)
  35. uni.stopPullDownRefresh()
  36. },
  37. methods: {
  38. // 楼层商品数据
  39. async activeProduct(options) {
  40. try{
  41. const {data} = await this.SpecialService.activeProduct({imageId: options.activeImageId})
  42. this.activeProductList = data
  43. uni.setNavigationBarTitle({
  44. title: data[0].topic
  45. })
  46. this.skeletonShow = false
  47. }catch(error){
  48. console.log(error)
  49. }
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. page {
  56. background-color: #f7f7f7;
  57. }
  58. .active-product {
  59. background: #f7f7f7;
  60. display: flex;
  61. flex-wrap: wrap;
  62. padding: 24rpx;
  63. justify-content: space-between;
  64. }
  65. </style>