app-related-suggestion-product.vue 8.0 KB

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