index-product-list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="product-list" v-if="product.length > 0">
  3. <view class="item" v-for="(item, index) in newProduct" :key="index" :class="{'item-bottom-bor': index !== product.length-1}" @click="route_jump(item)">
  4. <app-form-id>
  5. <view class="item-in dir-left-wrap main-between cross-center">
  6. <image class="goods-cover" :src="item.cover_pic" :lazy-load="true"></image>
  7. <view class="out-dialog" v-if="item.goods_stock == 0 && appSetting.is_show_stock == '1'">
  8. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  9. </view>
  10. <view class="item-content dir-top-nowrap main-between">
  11. <view>
  12. <text class="item-name">{{item.name}}</text>
  13. <view class="item-time dir-left-wrap">
  14. <image class="icon" src="/static/image/icon/time.png"></image>
  15. <text class="text">距预售截止:</text>
  16. <text class="text-time" :class="theme.color">{{item.html}}</text>
  17. </view>
  18. </view>
  19. <view class="price-button dir-left-nowrap main-between">
  20. <view class="price">
  21. <text class="symbol" :class="theme.color" v-if="item.use_attr == 0">定金¥{{Number(item.advanceGoods.deposit)}}抵¥{{Number(item.advanceGoods.swell_deposit)}}</text>
  22. <text class="symbol" :class="theme.color" v-if="item.use_attr == 1">定金¥{{Number(item.attr[0].deposit)}}抵¥{{Number(item.attr[0].swell_deposit)}}</text>
  23. <view class="dir-left-nowrap cross-center">
  24. <template v-if="item.is_level == 1">
  25. <app-member-price :theme="theme" :price="item.level_price"></app-member-price>
  26. </template>
  27. <app-sup-vip :is_vip_card_user="item.vip_card_appoint.is_vip_card_user" margin="0 0 0 10rpx" v-if="item.vip_card_appoint.discount" :discount="item.vip_card_appoint.discount"></app-sup-vip>
  28. </view>
  29. <view class="all-price">
  30. <text class="new-price" :class="theme.color">¥{{Number(item.price)}}</text>
  31. <text class="old-price">¥{{Number(item.original_price)}}</text>
  32. </view>
  33. </view>
  34. <view v-if="item.goods_stock > 0" class="button" :class="theme.back">抢购</view>
  35. </view>
  36. </view>
  37. </view>
  38. </app-form-id>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {mapGetters, mapState} from 'vuex';
  44. export default {
  45. name: 'index-product-list',
  46. props: {
  47. product: {
  48. type: Array,
  49. default() {
  50. return [];
  51. }
  52. },
  53. theme: Object,
  54. },
  55. methods: {
  56. route_jump(data) {
  57. // #ifndef MP-BAIDU
  58. if (data.goodsWarehouse.video_url && this.getVideo == 1) {
  59. uni.navigateTo({
  60. url: `/pages/goods/video?goods_id=${data.id}&sign=advance`
  61. });
  62. } else {
  63. uni.navigateTo({
  64. url: data.page_url,
  65. });
  66. }
  67. // #endif
  68. // #ifdef MP-BAIDU
  69. uni.navigateTo({
  70. url: data.page_url,
  71. });
  72. // #endif
  73. }
  74. },
  75. computed: {
  76. newProduct() {
  77. for (let i = 0; i < this.product.length; i++) {
  78. let attr = this.product[i].attr;
  79. let compare = function (obj1, obj2) {
  80. let val1 = Number(obj1.deposit);
  81. let val2 = Number(obj2.deposit);
  82. if (val1 < val2) {
  83. return -1;
  84. } else if (val1 > val2) {
  85. return 1;
  86. } else {
  87. return 0;
  88. }
  89. };
  90. this.product[i].attr = attr.sort(compare);
  91. }
  92. return this.product;
  93. },
  94. ...mapGetters('mallConfig',{
  95. vip: 'getVip',
  96. getVideo: 'getVideo'
  97. }),
  98. ...mapState({
  99. appImg: state => state.mallConfig.__wxapp_img.mall,
  100. appSetting: state => state.mallConfig.mall.setting,
  101. mall: state => state.mallConfig.mall
  102. })
  103. }
  104. }
  105. </script>
  106. <style scoped lang="scss">
  107. .product-list {
  108. width: #{750rpx};
  109. .item {
  110. height: #{268rpx};
  111. background-color: #ffffff;
  112. width: 100%;
  113. padding: #{24rpx};
  114. position: relative;
  115. .item-in {
  116. width: #{702rpx};
  117. height: #{220rpx};
  118. .goods-cover {
  119. width: #{220rpx};
  120. height: #{220rpx};
  121. border-radius: #{12rpx};
  122. }
  123. .out-dialog {
  124. width: #{220rpx};
  125. height: #{220rpx};
  126. position: absolute;
  127. bottom: 0;
  128. left: 0;
  129. background-color: rgba(0,0,0,.5);
  130. image {
  131. width: #{220rpx};
  132. height: #{220rpx};
  133. }
  134. }
  135. .item-content {
  136. width: #{458rpx};
  137. height: #{220rpx};
  138. }
  139. .item-name {
  140. width: #{458rpx};
  141. line-height: 35upx;
  142. padding: #{7rpx} 0;
  143. font-size: #{25rpx};
  144. color: #353535;
  145. word-break: break-all;
  146. text-overflow: ellipsis;
  147. display: -webkit-box;
  148. -webkit-box-orient: vertical;
  149. -webkit-line-clamp: 2;
  150. overflow: hidden;
  151. }
  152. .item-time {
  153. width: #{458rpx};
  154. height: #{24rpx};
  155. margin-top: #{8rpx};
  156. line-height: #{24rpx};
  157. .icon {
  158. width: #{24rpx};
  159. height: #{24rpx};
  160. margin-right: #{12rpx};
  161. }
  162. .text {
  163. font-size: #{25rpx};
  164. color: #adadad;
  165. }
  166. .text-time {
  167. font-size: #{25rpx};
  168. }
  169. }
  170. .price-button {
  171. width: #{458rpx};
  172. height: #{73rpx};
  173. margin-bottom: #{28rpx};
  174. .price {
  175. width: #{354rpx};
  176. height: #{73rpx};
  177. .symbol {
  178. display: inline-block;
  179. padding: #{0rpx 4rpx};
  180. font-size: #{24rpx};
  181. border: #{1rpx} solid;
  182. border-radius: #{8rpx};
  183. margin: #{5upx 0 5upx 0};
  184. }
  185. .all-price {
  186. line-height: 1;
  187. font-size: #{28rpx};
  188. margin-top: #{8upx};
  189. .new-price {
  190. font-size: #{28rpx};
  191. line-height: 1;
  192. }
  193. .old-price {
  194. font-size: #{21rpx};
  195. color: #999999;
  196. text-decoration: line-through;
  197. margin-left: #{12rpx};
  198. line-height: 1;
  199. }
  200. }
  201. }
  202. .button {
  203. width: #{104rpx};
  204. height: #{56rpx};
  205. margin-top: #{60rpx};
  206. border-radius: #{28rpx};
  207. font-size: #{28rpx};
  208. color: #ffffff;
  209. text-align: center;
  210. line-height: #{56rpx};
  211. }
  212. }
  213. }
  214. }
  215. .item-bottom-bor {
  216. border-bottom: #{1rpx} solid #eeeeee;
  217. }
  218. }
  219. </style>