app-product-list.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="app-product-list">
  3. <view class="app-item dir-left-nowrap" v-for="(item, index) in list" :key="index" @click="route_go(item)">
  4. <image class="app-image" :src="item.goods.cover_pic"></image>
  5. <view class="out-dialog" v-if="item.miaosha_num == 0 && appSetting.is_show_stock == '1'">
  6. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  7. </view>
  8. <view class="app-content">
  9. <text class="app-name">{{item.goods.name}}</text>
  10. <view class="app-percentage">
  11. <view :style="{width: `${item.goods.miaosha_percentage}`}"></view>
  12. </view>
  13. <view class="app-text dir-left-nowrap main-between cross-center">
  14. <text class="app-already">已抢购{{item.goods.miaosha_count}}{{item.goods.unit}}</text>
  15. <text class="app-past">仅剩{{item.goods.miaosha_num}}{{item.goods.unit}}</text>
  16. </view>
  17. <view class="price-button dir-left-nowrap main-between cross-bottom">
  18. <view class="price app-price dir-top-nowrap main-right cross-top">
  19. <view v-if="item.is_level">
  20. <app-member-price :price="item.level_price"></app-member-price>
  21. </view>
  22. <app-sup-vip :is_vip_card_user="item.vip_card_appoint.is_vip_card_user" margin="4rpx 0 0" v-if="item.vip_card_appoint.discount" :discount="item.vip_card_appoint.discount"></app-sup-vip>
  23. <view class="app-min-price" :class="[theme + '-m-text', theme]">¥{{item.goods.min_price}}</view>
  24. <view class="app-original-price">¥{{item.goods.original_price}}</view>
  25. </view>
  26. <view class="app-button" style="color: #ffffff;" :class="[theme + '-m-back', theme]" v-if="status === 1 && item.miaosha_num > 0">马上抢购</view>
  27. <view class="app-button no-button" :class="[theme + '-m-text', theme + '-m-border',theme]" v-if="(status === 0 || status === 2) && item.miaosha_num > 0">查看商品</view>
  28. <view class="app-button" style="background-color: #CDCDCD;color: #fff;" v-if="item.miaosha_num == 0">下次再来</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view :style="{width: `100%`, height: `${botHeight}rpx`}" v-if="empty"></view>
  33. </view>
  34. </template>
  35. <script>
  36. import {mapState, mapGetters} from 'vuex';
  37. export default {
  38. name: 'app-product-list',
  39. data() {
  40. return {
  41. is_vip: true,
  42. }
  43. },
  44. computed: {
  45. ...mapState({
  46. appImg: state => state.mallConfig.__wxapp_img.mall,
  47. appSetting: state => state.mallConfig.mall.setting,
  48. }),
  49. ...mapGetters('mallConfig', {
  50. getVideo: 'getVideo'
  51. }),
  52. },
  53. props: {
  54. list: {
  55. type: Array,
  56. default() {
  57. return [];
  58. }
  59. },
  60. status: {
  61. type: Number
  62. },
  63. empty: Boolean,
  64. botHeight: Number,
  65. theme: {
  66. type: String,
  67. default() {
  68. return 'a';
  69. }
  70. }
  71. },
  72. methods: {
  73. route_go(data) {
  74. // #ifndef MP-BAIDU
  75. if (data.goods.video_url && this.getVideo == 1) {
  76. uni.navigateTo({
  77. url: `/pages/goods/video?goods_id=${data.goods_id}&sign=miaosha`
  78. });
  79. } else {
  80. uni.navigateTo({
  81. url: `/plugins/miaosha/goods/goods?id=${data.goods_id}`,
  82. });
  83. }
  84. // #endif
  85. // #ifdef MP-BAIDU
  86. uni.navigateTo({
  87. url: `/plugins/miaosha/goods/goods?id=${data.goods_id}`,
  88. });
  89. // #endif
  90. }
  91. }
  92. }
  93. </script>
  94. <style scoped lang="scss">
  95. .app-product-list {
  96. width: #{750rpx};
  97. background-color:white;
  98. overflow: hidden;
  99. .app-item {
  100. width: #{750rpx};
  101. padding: #{12rpx} #{24rpx} 0 0;
  102. border-bottom: #{1rpx} solid #e2e2e2;
  103. background-color: white;
  104. position: relative;
  105. .app-image {
  106. width: #{262rpx};
  107. height: #{262rpx};
  108. }
  109. .out-dialog {
  110. width: #{262rpx};
  111. height: #{262rpx};
  112. position: absolute;
  113. top: #{12rpx};
  114. left: 0;
  115. background-color: rgba(0,0,0,.5);
  116. image {
  117. width: #{262rpx};
  118. height: #{262rpx};
  119. }
  120. }
  121. .app-content {
  122. width: #{440rpx};
  123. margin-left: #{24rpx};
  124. padding-top: #{18rpx};
  125. margin-bottom: #{10rpx};
  126. .app-name {
  127. font-size: #{28rpx};
  128. color: #353535;
  129. word-break: break-all;
  130. text-overflow: ellipsis;
  131. display: -webkit-box;
  132. -webkit-box-orient: vertical;
  133. -webkit-line-clamp: 1;
  134. overflow: hidden;
  135. }
  136. .app-percentage {
  137. width: #{440rpx};
  138. height: #{24rpx};
  139. border-radius: #{12rpx};
  140. background-color: #ffb7b7;
  141. margin-top: #{16rpx};
  142. overflow: hidden;
  143. >view {
  144. height: #{24rpx};
  145. border-radius: #{12rpx};
  146. background-color: #ff4544;
  147. }
  148. }
  149. .app-text {
  150. font-size: #{24rpx};
  151. margin-top: #{4rpx};
  152. }
  153. .app-already {
  154. color: #666666;
  155. }
  156. .app-past {
  157. color: #ff4544;
  158. }
  159. .price-button {
  160. width: #{440rpx};
  161. min-height: #{132rpx};
  162. .price {
  163. width: #{440-164rpx};
  164. height: #{132rpx};
  165. }
  166. .app-price {
  167. .app-min-price {
  168. font-size: #{40rpx};
  169. height: #{40rpx};
  170. margin-top: #{-4rpx};
  171. }
  172. .app-original-price {
  173. font-size: #{24rpx};
  174. color: #999999;
  175. text-decoration: line-through;
  176. }
  177. }
  178. .app-button {
  179. width: #{164rpx};
  180. height: #{68rpx};
  181. font-size: #{26rpx};
  182. text-align: center;
  183. line-height: #{68rpx};
  184. border-radius: #{34rpx};
  185. margin-bottom: #{5rpx};
  186. }
  187. .no-button {
  188. background-color: white;
  189. border: #{1rpx} solid;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. </style>