dt_goods_list_home.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="goods_list">
  3. <view class="goods_item" v-for="(item,index) in dataList" :key="index" @tap="jumpGoodsDes(item.id)">
  4. <scroll-view scroll-x="true">
  5. <view class="goods_img">
  6. <view v-for="(imgsItem,imgsIndex) in item.productImages" :key="imgsIndex">
  7. <image :src="imgsItem.large||'http://139.9.103.171:1888/img/image/goods_def.png'" mode="widthFix"></image>
  8. </view>
  9. </view>
  10. </scroll-view>
  11. <view class="goods_info">
  12. <view class="mid-wrap">
  13. <view class="goods_top">
  14. <view class="goods_time" v-if="false">10分钟</view>
  15. <view class="goods_title dt-text-row-two">{{item.name}}</view>
  16. </view>
  17. <view class="goods_des one_line_ellipsis">{{item.caption}}</view>
  18. </view>
  19. <view class="goods_active" v-if="false">
  20. <view class="active_item">特价抢购</view>
  21. <view class="active_item">1元换购</view>
  22. <view class="active_item">包邮</view>
  23. </view>
  24. <scroll-view scroll-x="true" style="width: 100%;margin: 20upx 0 12upx;">
  25. <view v-if="item.promotion" style="display: flex;white-space: nowrap;">
  26. <view v-if="item.promotion.coupon" style="
  27. padding: 4rpx 8rpx;
  28. font-size: 20upx;
  29. color: #DB4444;
  30. background:rgba(219,68,68,0.1);
  31. margin-right: 5upx;
  32. border-radius: 25px;">
  33. {{item.promotion.coupon.name}}
  34. </view>
  35. <view v-if="item.promotion.freeShipping" style="
  36. padding: 4rpx 8rpx;
  37. font-size: 20upx;
  38. color: #DB4444;
  39. background:rgba(219,68,68,0.1);
  40. margin-right: 5upx;
  41. border-radius: 25px;">
  42. {{item.promotion.freeShipping.name}}
  43. </view>
  44. <view v-if="item.promotion.gifts.length>0"
  45. v-for="(giftsItem,giftsIndex) in item.promotion.gifts"
  46. :key="giftsIndex"
  47. style="
  48. padding: 4rpx 8rpx;
  49. font-size: 20upx;
  50. color: #DB4444;
  51. background:rgba(219,68,68,0.1);
  52. margin-right: 5upx;
  53. border-radius: 25px;">
  54. {{giftsItem.name}}
  55. </view>
  56. <view v-if="item.promotion.moneyOffs.length>0"
  57. v-for="(moneyOffs,moneyOffsIndex) in item.promotion.moneyOffs"
  58. :key="moneyOffsIndex"
  59. style="
  60. padding: 4rpx 8rpx;
  61. font-size: 20upx;
  62. color: #444FDB;
  63. background:rgba(68,79,219,0.1);
  64. margin-right: 5upx;
  65. border-radius: 25px;">
  66. {{moneyOffs.name}}
  67. </view>
  68. </view>
  69. </scroll-view>
  70. <view class="goods_bottom">
  71. <view class="sell_info">
  72. <view class="sell_price">
  73. <text style="font-size: 20upx;margin-top: 10upx;color: #ee1515;">¥</text>
  74. <text class="price">{{item.price}}</text>
  75. <text>{{item.marketPrice?"¥"+item.marketPrice:''}}</text>
  76. </view>
  77. <!-- <view class="sell_count">销量{{item.sales}}笔</view> -->
  78. </view>
  79. <!-- <image src="/static/image/shop_car_icon.png" class="buy"></image> -->
  80. <view style="font-weight: 500;font-size:32upx;color: #fff;line-height: 60upx;padding: 0 20upx;background-color: #DB4444;border-radius: 25px;">立即购买</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. props: {
  89. height:{
  90. type:[String,Number],
  91. default:70
  92. },
  93. dataList: {
  94. type: Array,
  95. default: []
  96. }
  97. },
  98. data() {
  99. return {};
  100. },
  101. computed: {
  102. midStyle(){
  103. return 'height:'+uni.upx2px(this.height)+'px'
  104. },
  105. },
  106. methods: {
  107. jumpGoodsDes(id) {
  108. console.log(id);
  109. uni.navigateTo({
  110. url: "/pagesM/pages/goods_des?id=" + id
  111. })
  112. }
  113. },
  114. created() { }
  115. };
  116. </script>
  117. <style lang="scss">
  118. .goods_list {
  119. display: flex;
  120. flex-direction: row;
  121. flex-wrap: wrap;
  122. // background: #F2F2F2;
  123. background: transparent;
  124. width: 100%;
  125. .goods_item {
  126. border-radius: 10upx;
  127. background: #fff;
  128. overflow: hidden;
  129. padding: 30upx;
  130. margin: 0 20upx 20upx;
  131. width: 100%;
  132. .goods_img {
  133. width: 100%;
  134. display: flex;
  135. align-items: center;
  136. image {
  137. display: block;
  138. border-radius: 10upx;
  139. width: 210upx;
  140. height: 210upx;
  141. margin-right: 12upx;
  142. }
  143. }
  144. .goods_info {
  145. margin-top: 20upx;
  146. box-sizing: border-box;
  147. .mid-wrap{
  148. .goods_top {
  149. display: flex;
  150. flex-direction: row;
  151. align-items: center;
  152. .goods_time {
  153. font-size: 18upx;
  154. border-radius: 4upx;
  155. background: $dt-color-primary;
  156. padding: 5upx 10upx;
  157. color: #fff;
  158. margin-right: 10upx;
  159. }
  160. .goods_title {
  161. flex: 1;
  162. color: #3A3A3A;
  163. font-size: 28upx;
  164. font-weight: bold;
  165. letter-spacing: 1upx;
  166. }
  167. }
  168. .goods_des {
  169. font-size: 24upx;
  170. color: #C1C1C1;
  171. margin-top: 10upx;
  172. }
  173. }
  174. .goods_active {
  175. display: flex;
  176. flex-direction: row;
  177. align-items: center;
  178. flex-wrap: wrap;
  179. margin-top: 10upx;
  180. .active_item {
  181. // border-radius: 4upx;
  182. padding: 5upx 10upx;
  183. color: #ee1515;
  184. font-size: 18upx;
  185. margin-right: 10upx;
  186. position: relative;
  187. margin-bottom: 10upx;
  188. // border: 2upx solid #ee1515;
  189. }
  190. .active_item::after {
  191. display: flex;
  192. box-sizing: border-box;
  193. align-items: center;
  194. content: "";
  195. position: absolute;
  196. top: 0;
  197. left: 0;
  198. width: 200%;
  199. height: 200%;
  200. transform: scale(0.5);
  201. transform-origin: 0 0;
  202. border: 1upx solid #ee1515;
  203. border-radius: 4upx;
  204. pointer-events: none;
  205. }
  206. }
  207. .goods_bottom {
  208. display: flex;
  209. flex-direction: row;
  210. justify-content: space-between;
  211. align-items: center;
  212. padding: 0 10upx 10upx;
  213. .sell_info {
  214. display: flex;
  215. flex-direction: column;
  216. .sell_price {
  217. display: flex;
  218. flex-direction: row;
  219. align-items: center;
  220. .price{
  221. font-size: 36upx;
  222. font-weight:800;
  223. color: #DB4444;
  224. }
  225. text:last-child {
  226. color: #888888;
  227. font-size: 22upx;
  228. text-decoration: line-through;
  229. margin-left: 20upx;
  230. margin-top: 10upx;
  231. }
  232. }
  233. .sell_count {
  234. margin-top: 10upx;
  235. font-size: 22upx;
  236. color: #888888;
  237. }
  238. }
  239. .buy {
  240. width: 40upx;
  241. height: 40upx;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. </style>