IndexPromotionList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="div promotion-list">
  3. <view class="div promotion-list-header" @click="promotionListClick">
  4. <text class="span header-title">{{ title }}</text>
  5. <text class="span header-more">更多</text>
  6. </view>
  7. <view class="div promotion-list-body">
  8. <view class='promotion-item' v-for="(item,index) in items" :key="index" @click="productClick(item.goods_id)">
  9. <view class='img' :style="'width:'+windowWidth+'px;height:'+windowWidth+'px'"><image mode="aspectFit" :src="item.goods_image"/></image></view>
  10. <view class='name'>{{item.goods_name}}</view>
  11. <view class='price-wrapper'>
  12. <view class='xianshigoods_price'>¥{{item.xianshigoods_price}}</view>
  13. <view class='goods_price'>¥{{item.goods_price}}</view>
  14. </view>
  15. <view class='end-time'>
  16. <view class="left">截止</view>
  17. <view class="right">{{item.xianshigoods_end_time}}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { urlencode,getFontSize } from '@/util/common'
  25. import IndexProductBody from './IndexProductBody'
  26. export default {
  27. name: 'IndexProductList',
  28. data () {
  29. return {}
  30. },
  31. props: ['items', 'title', 'type'],
  32. components: {
  33. IndexProductBody
  34. },
  35. computed: {
  36. windowWidth: function () {
  37. const res = uni.getSystemInfoSync()
  38. var width=res.windowWidth
  39. var size=getFontSize()
  40. return (width-3*.6*size)/3
  41. },
  42. },
  43. methods: {
  44. promotionListClick: function () {
  45. uni.navigateTo({ url: '/pages/home/goodslist/Goodslist'+'?'+urlencode( { xianshi: 1 })})
  46. },
  47. productClick(goods_id){
  48. uni.navigateTo({ url: '/pages/home/goodsdetail/Goodsdetail'+'?'+urlencode( { goods_id: goods_id } )})
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .promotion-list {
  55. background: #ffffff;
  56. margin-top:$modelSpace;
  57. padding: 0 $pageSpace;
  58. .promotion-item{width:32%;margin-right: 2%;}
  59. .promotion-item:nth-child(3){margin-right: 0;}
  60. .promotion-list-header {
  61. display: flex;
  62. height:2rem;
  63. justify-content: space-between;
  64. align-items: center;
  65. margin-bottom:.5rem;
  66. .header-title {
  67. font-size:$mainFontSize;
  68. color: #F08B1A;
  69. font-weight:700;
  70. padding: 0 .5rem;
  71. }
  72. .header-more{
  73. font-size:$fontSize;
  74. color:$descTextColor;
  75. }
  76. }
  77. .promotion-list-body {
  78. display: flex;
  79. flex-wrap: wrap;
  80. .promotion-item{
  81. .img{
  82. border-radius: .5rem;
  83. overflow: hidden;
  84. }
  85. .name{
  86. font-size: 0.64rem;
  87. white-space: nowrap;
  88. text-align: center;
  89. color: #333;
  90. height: 1rem;
  91. line-height: 1rem;
  92. overflow: hidden;
  93. text-overflow: ellipsis;
  94. -webkit-line-clamp: 1;
  95. padding-top: .3rem;
  96. }
  97. .price-wrapper{
  98. font-size: 0.45rem;
  99. padding: .1rem 0;
  100. margin: .4rem 0;
  101. display: -webkit-box;
  102. display: -ms-flexbox;
  103. display: flex;
  104. background: linear-gradient(
  105. 125deg, #E1102D 50.5%, #fff 50.5%, #E1102D 50.5%, #fff 50.5%);
  106. border-radius: .2rem;
  107. border: 1px solid #E1102D;
  108. color: #fff;
  109. .xianshigoods_price{
  110. display: flex;
  111. flex: 1;
  112. width: 50%;
  113. justify-content: center;
  114. }
  115. .goods_price{
  116. display: flex;
  117. color: #848484;
  118. text-decoration: line-through;
  119. width: 50%;
  120. justify-content: center;
  121. }
  122. }
  123. .end-time{
  124. display: flex;
  125. font-size: 0.45rem;
  126. color: #F08B1A;
  127. border: 1px solid #F08B1A;
  128. border-radius: .3rem;
  129. width: 80%;
  130. margin: 0 auto;
  131. height: 1rem;
  132. line-height: 1rem;
  133. overflow: hidden;
  134. .left{
  135. background: #feeedd;
  136. border-right: 1px solid #F08B1A;
  137. border-radius: 6px;
  138. width: 30%;
  139. text-align: center;
  140. }
  141. .right{
  142. margin-left: .2rem;
  143. width: 70%;
  144. text-align: center;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. </style>