product-list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="product-list">
  3. <view class="item dir-left-nowrap" v-for="(item, key) in goods_list" :key="key" @click="route_go(item)">
  4. <view class="box-grow-0 cover-pic">
  5. <image class="pic" :src="item.cover_pic"></image>
  6. <view class="out-dialog" v-if="item.goods_stock == 0 && appSetting.is_show_stock == '1'">
  7. <image mode="aspectFill" :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  8. </view>
  9. </view>
  10. <view class="cont dir-top-nowrap main-between">
  11. <text class="name t-omit-two">{{item.name}}</text>
  12. <view class="box-grow-0 cross-bottom"
  13. v-if="item.is_level == 1 && item.is_negotiable != 1">
  14. <app-member-price :price="item.level_price"></app-member-price>
  15. </view>
  16. <app-sup-vip class="margin-vip" :is_vip_card_user="item.vip_card_appoint.is_vip_card_user"
  17. v-if="item.vip_card_appoint.discount > 0"
  18. :discount="item.vip_card_appoint.discount">
  19. </app-sup-vip>
  20. <view class="price-but dir-left-nowrap main-between cross-center">
  21. <view class="price dir-top-nowrap">
  22. <text class="price_content">{{item.price_content}}</text>
  23. <text class="sales">{{item.sales}}</text>
  24. </view>
  25. <view class="but">
  26. <view v-if="item.is_negotiable != 1 && isShowCart == 1 && item.goods_stock > 0" class="box-grow-0 cart-box">
  27. <img @click.stop="specification(item)" class="goods-cart cross-bottom "
  28. src="/static/image/icon/goods-cart.png">
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {mapGetters, mapState} from 'vuex';
  38. import appMemberPrice from "../../components/page-component/app-member-mark/app-member-price.vue";
  39. import appSupVip from '../../components/page-component/app-sup-vip/app-sup-vip.vue';
  40. export default {
  41. name: "product-list",
  42. props : [`goods_list`],
  43. components: {
  44. 'app-member-price': appMemberPrice,
  45. 'app-sup-vip': appSupVip,
  46. },
  47. data() {
  48. return {
  49. previewUrl: '',
  50. submitUrl: '',
  51. attrGroup: [],
  52. selectAttr: {},
  53. item: {},
  54. show: 0
  55. }
  56. },
  57. computed: {
  58. ...mapGetters('mallConfig', {
  59. getVideo: 'getVideo',
  60. isShowCart: 'getShowCart'
  61. }),
  62. ...mapState({
  63. appSetting: state => state.mallConfig.mall.setting,
  64. appImg: state => state.mallConfig.__wxapp_img.mall
  65. })
  66. },
  67. methods: {
  68. specification(goods) {
  69. if (goods.sign === 'mch') {
  70. this.previewUrl = this.$api.mch.order_preview;
  71. this.submitUrl = this.$api.mch.order_submit;
  72. } else {
  73. this.previewUrl = '';
  74. this.submitUrl = '';
  75. }
  76. this.$emit('attr', this.previewUrl, this.submitUrl, goods.attr_groups, goods);
  77. },
  78. route_go(item) {
  79. // #ifndef MP-BAIDU
  80. if (item.video_url && this.getVideo == 1) {
  81. uni.navigateTo({
  82. url: `/pages/goods/video?goods_id=${item.id}&sign=${item.sign}`
  83. });
  84. } else {
  85. uni.navigateTo({
  86. url: item.page_url
  87. });
  88. }
  89. // #endif
  90. // #ifdef MP-BAIDU
  91. uni.navigateTo({
  92. url: item.page_url
  93. });
  94. // #endif
  95. },
  96. onAttr(data) {
  97. this.selectAttr = data;
  98. },
  99. }
  100. }
  101. </script>
  102. <style scoped lang="scss">
  103. .cover-pic {
  104. position: relative;
  105. border-radius: #{8upx};
  106. margin-right: #{20upx};
  107. }
  108. .out-dialog {
  109. width: #{150upx};
  110. height: #{150upx};
  111. position: absolute;
  112. top: 0;
  113. left: 0;
  114. z-index: 10;
  115. background-color: rgba(0,0,0,.5);
  116. image {
  117. width: #{150upx};
  118. height: #{150upx};
  119. }
  120. }
  121. .item {
  122. width: #{504upx};
  123. border-bottom: #{1upx} solid #e2e2e2;
  124. margin: #{20upx 0 0 0};
  125. }
  126. .cover-pic {
  127. width: #{150upx};
  128. height: #{150upx};
  129. border-radius: #{8upx};
  130. margin-right: #{20upx};
  131. position: relative;
  132. }
  133. .pic {
  134. width: #{150upx};
  135. height: #{150upx};
  136. }
  137. .out-dialog {
  138. width: #{150rpx};
  139. height: #{150rpx};
  140. position: absolute;
  141. top: 0;
  142. left: 0;
  143. z-index: 10;
  144. background-color: rgba(0,0,0,.5);
  145. image {
  146. width: #{150rpx};
  147. height: #{150rpx};
  148. }
  149. }
  150. .cont {
  151. width: #{334upx};
  152. }
  153. .name {
  154. font-size: #{28upx};
  155. line-height: #{36upx};
  156. color: #353535;
  157. margin-top: #{5upx};
  158. }
  159. .margin-vip {
  160. margin: #{8upx 0 0 0};
  161. }
  162. .price-but {
  163. margin-bottom: #{20upx};
  164. margin-top: #{8upx};
  165. }
  166. .price_content {
  167. font-size: #{32upx};
  168. color: #ff4544;
  169. line-height: 1;
  170. text-align: left;
  171. }
  172. .cart-box {
  173. width:#{56rpx};
  174. height:#{56rpx};
  175. border-radius: 50%;
  176. border: 1px solid #ff4544;
  177. position: relative;
  178. }
  179. .sales {
  180. font-size: #{20upx};
  181. line-height: 1;
  182. color: #999999;
  183. margin-top: #{5upx};
  184. padding-left: #{5upx};
  185. }
  186. .goods-cart {
  187. width: #{32rpx};
  188. height: #{32rpx};
  189. position: absolute;
  190. top: 50%;
  191. left: 50%;
  192. transform: translate(-50%, -50%);
  193. }
  194. </style>