app-product-list.vue 5.9 KB

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