app-product-list.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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" :style="{'color': theme.color}">¥{{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;" :style="{'background-color': theme.background}" v-if="status === 1 && item.miaosha_num > 0">马上抢购</view>
  27. <view class="app-button no-button" :style="{'color': theme.color, 'border-color': theme.border}" 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. platform: function(state) {
  49. return state.gConfig.systemInfo.platform;
  50. }
  51. }),
  52. ...mapGetters('mallConfig', {
  53. getVideo: 'getVideo'
  54. }),
  55. },
  56. props: {
  57. list: {
  58. type: Array,
  59. default() {
  60. return [];
  61. }
  62. },
  63. status: {
  64. type: Number
  65. },
  66. empty: Boolean,
  67. botHeight: Number,
  68. theme: {
  69. type: Object,
  70. }
  71. },
  72. methods: {
  73. route_go(data) {
  74. // #ifndef MP-BAIDU
  75. if (data.goods.video_url && this.getVideo == 1) {
  76. // #ifdef MP
  77. uni.navigateTo({
  78. url: `/pages/goods/video?goods_id=${data.goods_id}&sign=miaosha`
  79. });
  80. // #endif
  81. // #ifdef H5
  82. uni.navigateTo({
  83. url: `/plugins/miaosha/goods/goods?id=${data.goods_id}`,
  84. });
  85. // #endif
  86. } else {
  87. uni.navigateTo({
  88. url: `/plugins/miaosha/goods/goods?id=${data.goods_id}`,
  89. });
  90. }
  91. // #endif
  92. // #ifdef MP-BAIDU
  93. uni.navigateTo({
  94. url: `/plugins/miaosha/goods/goods?id=${data.goods_id}`,
  95. });
  96. // #endif
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .app-product-list {
  103. width: #{750rpx};
  104. background-color:white;
  105. overflow: hidden;
  106. .app-item {
  107. width: #{750rpx};
  108. padding: #{12rpx} #{24rpx} 0 0;
  109. border-bottom: #{1rpx} solid #e2e2e2;
  110. background-color: white;
  111. position: relative;
  112. .app-image {
  113. width: #{262rpx};
  114. height: #{262rpx};
  115. }
  116. .out-dialog {
  117. width: #{262rpx};
  118. height: #{262rpx};
  119. position: absolute;
  120. top: #{12rpx};
  121. left: 0;
  122. background-color: rgba(0,0,0,.5);
  123. image {
  124. width: #{262rpx};
  125. height: #{262rpx};
  126. }
  127. }
  128. .app-content {
  129. width: #{440rpx};
  130. margin-left: #{24rpx};
  131. padding-top: #{18rpx};
  132. margin-bottom: #{10rpx};
  133. .app-name {
  134. font-size: #{28rpx};
  135. color: #353535;
  136. word-break: break-all;
  137. text-overflow: ellipsis;
  138. display: -webkit-box;
  139. -webkit-box-orient: vertical;
  140. -webkit-line-clamp: 1;
  141. overflow: hidden;
  142. }
  143. .app-percentage {
  144. width: #{440rpx};
  145. height: #{24rpx};
  146. border-radius: #{12rpx};
  147. background-color: #ffb7b7;
  148. margin-top: #{16rpx};
  149. overflow: hidden;
  150. >view {
  151. height: #{24rpx};
  152. border-radius: #{12rpx};
  153. background-color: #ff4544;
  154. }
  155. }
  156. .app-text {
  157. font-size: #{24rpx};
  158. margin-top: #{4rpx};
  159. }
  160. .app-already {
  161. color: #666666;
  162. }
  163. .app-past {
  164. color: #ff4544;
  165. }
  166. .price-button {
  167. width: #{440rpx};
  168. min-height: #{132rpx};
  169. .price {
  170. width: #{440-164rpx};
  171. height: #{132rpx};
  172. }
  173. .app-price {
  174. .app-min-price {
  175. font-size: #{40rpx};
  176. height: #{40rpx};
  177. margin-top: #{-4rpx};
  178. }
  179. .app-original-price {
  180. font-size: #{24rpx};
  181. color: #999999;
  182. text-decoration: line-through;
  183. }
  184. }
  185. .app-button {
  186. width: #{164rpx};
  187. height: #{68rpx};
  188. font-size: #{26rpx};
  189. text-align: center;
  190. line-height: #{68rpx};
  191. border-radius: #{34rpx};
  192. margin-bottom: #{5rpx};
  193. }
  194. .no-button {
  195. background-color: white;
  196. border: #{1rpx} solid;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. </style>