app-related-suggestion-product.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="app-related-suggestion-product" v-if="goods_list.length > 0">
  3. <view v-if="isRecommend" class="app-top dir-left-nowrap main-center cross-center">
  4. <view class="app-content dir-left-nowrap main-between cross-center">
  5. <view class="app-line"></view>
  6. <view class="app-icon-love image-cover image-no-rep"></view>
  7. <text class="app-text">{{text}}</text>
  8. <view class="app-line"></view>
  9. </view>
  10. </view>
  11. <view class="app-bottom dir-top-nowrap">
  12. <view class="row dir-left-nowrap main-between box-grow-1" v-for="(item , index) in goods_list" :key="index">
  13. <view class="item box-grow-0" v-for="(good, key) in item" :key="key" @click="route_jump(good)">
  14. <view class="image-name dir-top-nowrap main-left">
  15. <image lazy-load="true" class="app-image" :src="good.cover_pic"></image>
  16. <view class="out-dialog" v-if="good.goods_stock == 0 && appSetting.is_show_stock == '1'">
  17. <image :src="appSetting.is_use_stock == '1' ? appImg.book_out : appSetting.sell_out_pic"></image>\
  18. </view>
  19. <view class="name" v-if="isShowGoodsName == 1">{{good.name}}</view>
  20. </view>
  21. <template v-if="sign === 'advance'">
  22. <view class="advance-content">
  23. <view class="deposit" v-if="good.advanceGoods">
  24. 定金¥{{good.advanceGoods.deposit}}抵{{good.advanceGoods.swell_deposit}}
  25. </view>
  26. </view>
  27. </template>
  28. <view class="content dir-top-nowrap main-right" :class="[`${sign !== 'advance' ? `content-no` : `content-yes`}`]">
  29. <view class="member-price" v-if="good.is_level == 1">
  30. <app-member-price :price="good.level_price"></app-member-price>
  31. </view>
  32. <view class="sup-vip" v-if="good.vip_card_appoint.discount > 0">
  33. <app-sup-vip :is_vip_card_user="good.vip_card_appoint.is_vip_card_user" :discount="good.vip_card_appoint.discount"></app-sup-vip>
  34. </view>
  35. <view class="price-total dir-left-nowrap main-between">
  36. <text class="price">
  37. {{sign === 'advance' ? '¥': ''}}{{good.price_content}}
  38. </text>
  39. <text class="volume" v-if="isShowSalesNum == 1">
  40. {{good.sales}}
  41. </text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <app-load-text v-if="!request"></app-load-text>
  48. </view>
  49. </template>
  50. <script>
  51. import { mapState, mapGetters } from 'vuex';
  52. import appLoadText from '../../basic-component/app-load-text/app-load-text.vue';
  53. import appSupVip from '../app-sup-vip/app-sup-vip.vue';
  54. import appMemberPrice from'../app-member-mark/app-member-price.vue';
  55. export default {
  56. name: 'app-related-suggestion-product',
  57. components: {
  58. 'app-load-text': appLoadText,
  59. 'app-sup-vip': appSupVip,
  60. 'app-member-price': appMemberPrice,
  61. },
  62. data() {
  63. return {
  64. request: this.value,
  65. goods_list: [],
  66. }
  67. },
  68. props: {
  69. isRecommend: {
  70. type: Boolean,
  71. default: function(){
  72. return true;
  73. }
  74. },
  75. value: {
  76. type: Boolean,
  77. default: function() {
  78. return true;
  79. }
  80. },
  81. list: {
  82. type: Array,
  83. default:function() {
  84. return [];
  85. }
  86. },
  87. text: {
  88. type: String,
  89. default:function() {
  90. return '相关推荐';
  91. }
  92. },
  93. sign: String,
  94. },
  95. computed: {
  96. ...mapState({
  97. height : state=>state.gConfig.systemInfo.windowHeight,
  98. appSetting: state => state.mallConfig.mall.setting,
  99. appImg: state => state.mallConfig.__wxapp_img.mall,
  100. mall: state => state.mallConfig.mall,
  101. isShowGoodsName: state => state.mallConfig.mall.setting.is_show_goods_name,
  102. isShowSalesNum: state => state.mallConfig.mall.setting.is_show_sales_num,
  103. }),
  104. newList() {
  105. this.goods_list = [];
  106. for (let i = 0; i < this.list.length; i+=2) {
  107. if (i+1 !== this.list.length) {
  108. this.goods_list.push([this.list[i], this.list[i+1]]);
  109. } else {
  110. this.goods_list.push([this.list[i]]);
  111. }
  112. }
  113. },
  114. ...mapGetters('mallConfig',{
  115. getVideo: 'getVideo'
  116. }),
  117. },
  118. methods: {
  119. route_jump(data) {
  120. // #ifndef MP-BAIDU
  121. if (data.video_url && this.getVideo == 1) {
  122. uni.navigateTo({
  123. url: `/pages/goods/video?goods_id=${data.id}&sign=${this.sign}`
  124. });
  125. } else {
  126. uni.navigateTo({
  127. url: data.page_url
  128. });
  129. }
  130. // #endif
  131. // #ifdef MP-BAIDU
  132. uni.navigateTo({
  133. url: data.page_url
  134. });
  135. // #endif
  136. }
  137. }
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. .app-related-suggestion-product {
  142. width: $screen-width;
  143. background-color: #f7f7f7;
  144. .app-top {
  145. width: 100%;
  146. height: #{40+32+24rpx};
  147. .app-content {
  148. height: #{24rpx};
  149. width: calc(100% - #{450rpx});
  150. .app-line {
  151. width: #{56rpx};
  152. height: #{1rpx};
  153. background-color: #bbbbbb;
  154. }
  155. .app-icon-love {
  156. width: #{24rpx};
  157. height: #{24rpx};
  158. background-image: url('../../../static/image/icon/icon-favorite.png');
  159. }
  160. .app-text {
  161. font-size: #{24rpx};
  162. color: #999999;
  163. }
  164. }
  165. }
  166. }
  167. .app-bottom {
  168. width: #{750upx};
  169. padding: #{0 10upx};
  170. .row {
  171. width: 100%;
  172. margin-bottom: #{10upx};
  173. }
  174. .item {
  175. width: #{358upx};
  176. background-color: #ffffff;
  177. margin: #{5upx 0 0 0};
  178. border-radius: #{16upx};
  179. }
  180. .image-name {
  181. width: 100%;
  182. position: relative;
  183. .app-image {
  184. width: #{358upx};
  185. height: #{370upx};
  186. border-top-left-radius: #{16upx};
  187. border-top-right-radius: #{16upx};
  188. }
  189. .out-dialog {
  190. border-top-left-radius: #{16upx};
  191. border-top-right-radius: #{16upx};
  192. width: #{358upx};
  193. height: #{370upx};
  194. position: absolute;
  195. top: 0;
  196. left: 0;
  197. background-color: rgba(0,0,0,.5);
  198. image {
  199. width: #{358upx};
  200. height: #{370upx};
  201. }
  202. }
  203. .name {
  204. font-size: #{28upx};
  205. color: #353535;
  206. word-break: break-all;
  207. text-overflow: ellipsis;
  208. display: -webkit-box;
  209. -webkit-box-orient: vertical;
  210. -webkit-line-clamp: 2;
  211. overflow: hidden;
  212. line-height: #{32upx};
  213. height: #{64upx};
  214. width: #{318upx};
  215. margin: #{20upx 20upx 0 20upx};
  216. }
  217. }
  218. }
  219. .price-total {
  220. margin-bottom: #{20upx};
  221. font-size: #{28upx};
  222. line-height: 1;
  223. .price {
  224. word-break: break-all;
  225. text-overflow: ellipsis;
  226. display: -webkit-box;
  227. -webkit-box-orient: vertical;
  228. color: #ff4544;
  229. }
  230. .volume {
  231. word-break: break-all;
  232. text-overflow: ellipsis;
  233. display: -webkit-box;
  234. -webkit-box-orient: vertical;
  235. -webkit-line-clamp: 1;
  236. font-size: #{24rpx};
  237. color: #999999;
  238. }
  239. }
  240. .content {
  241. padding: #{0 24upx 0 24upx};
  242. }
  243. .content-no {
  244. height: calc(100% - #{454upx});
  245. }
  246. .advance-content {
  247. height: #{40upx};
  248. padding: #{0 0 0 24upx};
  249. margin-bottom: #{10upx};
  250. }
  251. .content-yes {
  252. height: calc(100% - #{494upx});
  253. }
  254. .deposit {
  255. display: inline-block;
  256. font-size: #{19rpx};
  257. color: #ffffff;
  258. line-height: 1;
  259. background-color: #ff4544;
  260. border-radius: #{7rpx};
  261. padding: #{5rpx 5rpx};
  262. word-break: break-all;
  263. text-overflow: ellipsis;
  264. -webkit-box-orient: vertical;
  265. -webkit-line-clamp: 1;
  266. overflow: hidden;
  267. margin: #{8upx 0};
  268. }
  269. .member-price {
  270. padding: #{8upx 0};
  271. }
  272. .sup-vip {
  273. margin-bottom: #{8upx};
  274. }
  275. </style>