goodslist.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <cover-view class="div goods-inner">
  3. <text class="div goods-title">相关商品</text>
  4. <cover-image mode="aspectFit" src="@/static/image/live/close.png" class="img close" @click="hide" />
  5. <scroll-view :scroll-y="true" :show-scrollbar="false" class="div goods-box" v-if="goods && goods.length">
  6. <cover-view class="div goods-item" v-for="item in goods" :key="item.goods_id" @click="sendgoods(item)">
  7. <cover-image mode="aspectFit" class="img goods-img" :src="item.goods_image" @click="goGoods(item)"/>
  8. <cover-view class="div goods-info">
  9. <cover-view class="name-wrapper"><text class="div name" @click="goGoods(item)">{{item.goods_name}}</text></cover-view>
  10. <cover-view><text class="div price">¥ {{item.goods_price}}</text></cover-view>
  11. </cover-view>
  12. <cover-image mode="aspectFit" src="@/static/image/live/cart.png" class="img cart" @click="sendgoods(item)"/>
  13. </cover-view>
  14. </scroll-view>
  15. <cover-view class="div empty" v-else>
  16. <text class="empty-text">没有相关商品</text>
  17. </cover-view>
  18. </cover-view>
  19. </template>
  20. <script>
  21. import { urlencode } from '@/util/common'
  22. export default {
  23. props: {
  24. goods: {
  25. type: Array,
  26. default: function () {
  27. return []
  28. }
  29. }
  30. },
  31. data () {
  32. return {}
  33. },
  34. methods: {
  35. hide () {
  36. this.$emit('hidegoods')
  37. },
  38. sendgoods (goods) {
  39. this.$emit('buy', goods)
  40. },
  41. goGoods(goods){
  42. uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { 'goods_id': goods.goods_id } )})
  43. }
  44. },
  45. computed: {}
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. .goods-inner {
  50. padding: 0 24rpx;
  51. /* #ifndef APP-PLUS-NVUE */
  52. box-sizing: border-box;
  53. /* #endif */
  54. }
  55. .goods-title {
  56. height: 114rpx;
  57. line-height: 114rpx;
  58. font-family: PingFangSC-Medium;
  59. font-size:16px;
  60. color: #111111;
  61. /* #ifndef APP-PLUS-NVUE */
  62. letter-spacing: 0;
  63. /* #endif */
  64. text-align: left;
  65. /* #ifndef APP-PLUS-NVUE */
  66. display: block;
  67. /* #endif */
  68. border-bottom: 1px solid #DBDBDB;
  69. }
  70. .close {
  71. height: 64rpx;
  72. width: 64rpx;
  73. position: absolute;
  74. right: 24rpx;
  75. top: 24rpx;
  76. }
  77. .goods-item {
  78. padding: 24rpx 0;
  79. border-bottom: 1px solid #eee;
  80. position: relative;
  81. /* #ifndef APP-PLUS-NVUE */
  82. display: flex;
  83. /* #endif */;
  84. flex-direction: row;
  85. }
  86. .goods-box {
  87. padding: 24rpx;
  88. position: absolute;
  89. left:0;
  90. right: 0;
  91. top:120rpx;
  92. bottom:0;
  93. /* #ifndef APP-PLUS-NVUE */
  94. box-sizing: border-box;
  95. /* #endif */
  96. }
  97. .goods-item-img {
  98. width: 84rpx;
  99. height: 171rpx;
  100. margin-top: 24rpx;
  101. }
  102. .goods-info {
  103. flex:1;
  104. /* #ifndef APP-PLUS-NVUE */
  105. display: flex;
  106. /* #endif */
  107. padding-left: 24rpx;
  108. flex-direction: column;
  109. justify-content: space-between;
  110. }
  111. .goods-img {
  112. height: 140rpx;
  113. width: 140rpx;
  114. /* #ifndef APP-PLUS-NVUE */
  115. display: inline-block;
  116. vertical-align: middle;
  117. /* #endif */
  118. }
  119. .name-wrapper{
  120. /* #ifndef APP-PLUS-NVUE */
  121. display: flex;
  122. /* #endif */
  123. }
  124. .name {
  125. flex:1;
  126. font-family: PingFangSC-Medium;
  127. font-size:14px;
  128. color: #333333;
  129. /* #ifndef APP-PLUS-NVUE */
  130. letter-spacing: 0;
  131. /* #endif */
  132. lines:2;
  133. }
  134. .price {
  135. height: 30rpx;
  136. line-height: 30rpx;
  137. font-size: 14px;
  138. color: #EE4E4E;
  139. }
  140. .cart{
  141. position: absolute;
  142. right: 24rpx;
  143. width: 36rpx;
  144. height: 36rpx;
  145. bottom: 28rpx;
  146. }
  147. .empty{text-align: center;padding-top:50rpx;}
  148. .empty-text{font-size:16px;}
  149. </style>