community-goods.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <u-popup v-model="show" mode="bottom" height="900" closeable border-radius="14">
  3. <view class="xl p-24 text-center bold">TA提到的商品</view>
  4. <navigator v-for="(goodsItem, index) in lists" :key="index" hover-class="none"
  5. :url="'/pages/goods_details/goods_details?id=' + goodsItem.id">
  6. <view class="goods flex">
  7. <u-image width="160" height="160" :src="goodsItem.image"></u-image>
  8. <view class="m-l-20 goods-info">
  9. <view class="line-2 nr normal">
  10. {{ goodsItem.name }}
  11. </view>
  12. <view class="primary xl p-t-30">¥{{ goodsItem.goods_price }}</view>
  13. </view>
  14. </view>
  15. </navigator>
  16. </u-popup>
  17. </template>
  18. <script>
  19. import {
  20. getCommunityGoodsLists
  21. } from "@/api/community.js"
  22. export default {
  23. name: "community-goods",
  24. props: {
  25. value: {
  26. type: Boolean
  27. },
  28. communityId: {
  29. type: [String, Number],
  30. default: ''
  31. }
  32. },
  33. data() {
  34. return {
  35. lists: []
  36. }
  37. },
  38. computed: {
  39. // 弹窗Popup显示状态
  40. show: {
  41. get: function() {
  42. return this.value
  43. },
  44. set: function(value) {
  45. value ? this.initRecommendGoods() : ''
  46. this.$emit('input', value)
  47. }
  48. }
  49. },
  50. methods: {
  51. // 获取
  52. initRecommendGoods() {
  53. getCommunityGoodsLists({
  54. id: this.communityId
  55. }).then(res => {
  56. this.lists = res.data
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .goods {
  64. padding: 20rpx;
  65. border-top: 1px solid $-color-body;
  66. .goods-info {
  67. height: 160rpx;
  68. }
  69. }
  70. </style>