app-product-list.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="page-width product-list dir-top-nowrap">
  3. <view class="page-width row dir-left-nowrap main-between box-grow-1" v-for="(row, key) in goods_list" :key="key">
  4. <view @click="routeGo(item)"
  5. class="goods box-grow-0 dir-top-nowrap main-between"
  6. v-for="(item, index) in row"
  7. :key="index">
  8. <view class="image-name dir-top-nowrap main-left" >
  9. <view class="out-dialog" v-if="item.goods_stock == 0 && appSetting.is_show_stock == '1'">
  10. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  11. </view>
  12. <image class="image" :src="item.cover_pic" :lazy-load="true" mode="aspectFill"></image>
  13. <view class="name t-omit-two" v-if="is_name && isShowGoodsName == 1">{{item.name}}</view>
  14. </view>
  15. <view class="content dir-top-nowrap main-right" :style="{height: is_name ? 'calc(100% - #{426rpx})': 'height: calc(100% - #{384rpx});'}" >
  16. <!-- 会员价 -->
  17. <view class="member-price" v-if="item.is_level == 1 && item.is_negotiable != 1">
  18. <app-member-price
  19. :price="item.level_price"
  20. ></app-member-price>
  21. </view>
  22. <!-- 超级会员卡 -->
  23. <view class="app-sup-vip" v-if="item.vip_card_appoint.discount > 0">
  24. <app-sup-vip
  25. :discount="item.vip_card_appoint.discount"
  26. :is_vip_card_user="item.vip_card_appoint.is_vip_card_user"
  27. ></app-sup-vip>
  28. </view>
  29. <!-- 价格 销量 -->
  30. <view
  31. class="price-total page-width dir-left-nowrap main-between cross-center"
  32. >
  33. <text :class="[`${theme}-color`, 'price']">
  34. {{item.price_content}}
  35. </text>
  36. <template v-if="sign === 'gift'">
  37. <text v-if="item.is_negotiable != 1" class="gray sales">{{item.sales}}</text>
  38. </template>
  39. <template v-else>
  40. <text v-if="item.is_negotiable != 1 && isShowSalesNum == 1" class="gray sales">{{item.sales}}</text>
  41. <div v-if="item.is_negotiable != 1 && isShowCart == 1 && item.goods_stock > 0" class="cart-box moneyAndBtn-btn">
  42. <!-- #ifdef MP-ALIPAY -->
  43. <!-- <img style="-webkit-background-origin: content-box;background-origin: content-box;"
  44. @click.stop="specification(item)"
  45. class="goods-cart"
  46. src="/static/image/icon/goods-cart.png"> -->
  47. <!-- #endif -->
  48. <!-- #ifndef MP-ALIPAY -->
  49. <!-- <img @click.stop="specification(item)"
  50. class="goods-cart"
  51. src="/static/image/icon/goods-cart.png"> -->
  52. <!-- #endif -->
  53. 立即报名
  54. </div>
  55. </template>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <app-attr ref="attr" :goods="item" :select-attr="selectAttr" :attr-group-list="attrGroup" :show="show"
  61. @attrtap="onAttr"></app-attr>
  62. </view>
  63. </template>
  64. <script>
  65. import { mapState, mapGetters } from "vuex";
  66. import appMemberPrice from '../../../components/page-component/app-member-mark/app-member-price.vue';
  67. import appSupVip from '../../../components/page-component/app-sup-vip/app-sup-vip.vue';
  68. import appAttr from '../../../components/page-component/app-attr/app-attr.vue';
  69. export default {
  70. name: 'product-list',
  71. props: {
  72. goods_list: Array,
  73. theme: String,
  74. is_name: {
  75. type: Boolean,
  76. default: true,
  77. },
  78. sign: String,
  79. },
  80. computed: {
  81. ...mapState({
  82. appImg: state => state.mallConfig.__wxapp_img.mall,
  83. isShowCart: state => state.mallConfig.mall.setting.is_show_cart,
  84. isShowGoodsName: state => state.mallConfig.mall.setting.is_show_goods_name,
  85. isShowSalesNum: state => state.mallConfig.mall.setting.is_show_sales_num,
  86. appSetting: state => state.mallConfig.mall.setting,
  87. }),
  88. },
  89. methods: {
  90. routeGo(data) {
  91. this.$emit('routeGo', data);
  92. },
  93. specification(goods) {
  94. this.attrGroup = goods.attr_groups;
  95. this.item = goods;
  96. this.show = Math.random();
  97. },
  98. onAttr(data) {
  99. this.selectAttr = data;
  100. },
  101. },
  102. data() {
  103. return {
  104. show: 0,
  105. item: null,
  106. selectAttr: {},
  107. attrGroup: [],
  108. }
  109. },
  110. components: {
  111. 'app-member-price': appMemberPrice,
  112. 'app-sup-vip': appSupVip,
  113. 'app-attr': appAttr,
  114. },
  115. }
  116. </script>
  117. <style scoped lang="scss">
  118. .moneyAndBtn-btn{
  119. font-size:24upx;
  120. font-family:Source Han Sans CN;
  121. font-weight:500;
  122. color: #fff;
  123. background: #F09A21;
  124. padding: 10upx 22upx;
  125. text-align: center;
  126. box-shadow: 0 4px 10px #999;
  127. border-radius: 8upx;
  128. }
  129. .product-list {
  130. padding: #{0 20upx};
  131. position: relative;
  132. .row {
  133. margin-top: #{15upx};
  134. .goods {
  135. background-color: #ffffff;
  136. width: #{344upx};
  137. border-radius: #{15upx};
  138. }
  139. }
  140. }
  141. /*图片名字*/
  142. .image-name {
  143. width: 100%;
  144. border-top-left-radius: #{15upx};
  145. border-top-right-radius: #{15upx};
  146. position: relative;
  147. .out-dialog {
  148. border-top-left-radius: #{15upx};
  149. border-top-right-radius: #{15upx};
  150. width: #{344upx};
  151. height: #{344upx};
  152. position: absolute;
  153. top: 0;
  154. z-index: 10;
  155. left: 0;
  156. background-color: rgba(0,0,0,.5);
  157. image {
  158. width: #{344upx};
  159. height: #{344upx};
  160. }
  161. }
  162. .image {
  163. width: 100%;
  164. height: #{344upx};
  165. border-top-left-radius: #{15upx};
  166. border-top-right-radius: #{15upx};
  167. }
  168. .name {
  169. font-size: #{26upx};
  170. color: #353535;
  171. padding: #{0 24upx};
  172. margin-top: #{20upx};
  173. line-height: #{31upx};
  174. height: #{62upx};
  175. }
  176. }
  177. .content-name {
  178. height: calc(100% - #{426upx});
  179. }
  180. .content-no {
  181. height: calc(100% - #{384upx});
  182. }
  183. /*复杂内容*/
  184. .content {
  185. padding: #{0 24upx};
  186. .price-total {
  187. margin: #{16upx 0 30upx 0};
  188. .sales {
  189. font-size: #{20rpx};
  190. margin-left:#{12rpx};
  191. }
  192. .price {
  193. font-size: #{28rpx};
  194. }
  195. }
  196. /*会员价组件*/
  197. .member-price {
  198. margin-top: #{12upx};
  199. }
  200. /*超级会员卡组件*/
  201. .app-sup-vip {
  202. margin-top: #{9upx};
  203. }
  204. }
  205. /*默认文字颜色*/
  206. .default-color {
  207. color: #ff4544;
  208. }
  209. .cart-box {
  210. position: relative;
  211. }
  212. .goods-cart {
  213. width: #{92rpx};
  214. height: #{92rpx};
  215. position: absolute;
  216. padding: #{32rpx};
  217. right: #{-24rpx};
  218. top: #{-50rpx};
  219. }
  220. </style>