goods-list.vue 6.9 KB

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