123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <view class="app-related-suggestion-product" v-if="goods_list.length > 0">
- <view v-if="isRecommend" class="app-top dir-left-nowrap main-center cross-center">
- <view class="app-content dir-left-nowrap main-between cross-center">
- <view class="app-line"></view>
- <view v-if="showIcon" class="app-icon-love image-cover image-no-rep"></view>
- <text class="app-text">{{text}}</text>
- <view class="app-line"></view>
- </view>
- </view>
- <view class="app-bottom dir-top-nowrap">
- <view class="row dir-left-nowrap main-between box-grow-1" v-for="(item , index) in goods_list" :key="index">
- <view class="item box-grow-0" v-for="(good, key) in item" :key="key" @click="route_jump(good)">
- <view class="image-name dir-top-nowrap main-left">
- <image lazy-load="true" class="app-image" :src="good.cover_pic"></image>
- <view class="out-dialog" v-if="good.goods_stock == 0 && appSetting.is_show_stock == '1'">
- <image :src="appSetting.is_use_stock == '1' ? appImg.book_out : appSetting.sell_out_pic"></image>
- </view>
- <view class="name" v-if="isShowGoodsName == 1">{{good.name}}</view>
- </view>
- <template v-if="sign === 'advance'">
- <view class="advance-content">
- <view class="deposit" v-if="good.advanceGoods" :class="theme+ '-m-back ' + theme">
- 定金¥{{good.advanceGoods.deposit}}抵{{good.advanceGoods.swell_deposit}}
- </view>
- </view>
- </template>
- <view class="content dir-top-nowrap main-right" :class="[`${sign !== 'advance' ? `content-no` : `content-yes`}`]">
- <view class="member-price" v-if="good.is_level == 1">
- <app-member-price :theme="themeObject" :price="good.level_price"></app-member-price>
- </view>
- <view class="sup-vip" v-if="good.vip_card_appoint.discount">
- <app-sup-vip :is_vip_card_user="good.vip_card_appoint.is_vip_card_user" :discount="good.vip_card_appoint.discount"></app-sup-vip>
- </view>
- <view class="price-total dir-left-nowrap main-between cross-center">
- <view>
- <text class="price" :class="sign !== 'gift' ? theme + '-m-text ' + theme : theme + '-color '">
- {{sign === 'advance' ? '¥': ''}}{{good.price_content}}
- </text>
- <text v-if="isListUnderlinePrice == 1" class="origin-price">
- ¥{{good.original_price}}
- </text>
- </view>
- <view class="volume" v-if="isShowSalesNum == 1">
- {{good.sales}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <app-load-text v-if="!request"></app-load-text>
- </view>
- </template>
- <script>
- import { mapState, mapGetters } from 'vuex';
- export default {
- name: 'app-related-suggestion-product',
- data() {
- return {
- request: this.value,
- goods_list: []
- }
- },
- props: {
- isRecommend: {
- type: Boolean,
- default: function(){
- return true;
- }
- },
- showIcon: {
- type: Boolean,
- default: function(){
- return true;
- }
- },
- value: {
- type: Boolean,
- default: function() {
- return true;
- }
- },
- list: {
- type: Array,
- default:function() {
- return [];
- }
- },
- text: {
- type: String,
- default:function() {
- return '相关推荐';
- }
- },
- sign: String,
- theme: String,
- themeObject: Object
- },
- computed: {
- ...mapState({
- height : state=>state.gConfig.systemInfo.windowHeight,
- appSetting: state => state.mallConfig.mall.setting,
- appImg: state => state.mallConfig.__wxapp_img.mall,
- mall: state => state.mallConfig.mall,
- isShowGoodsName: state => state.mallConfig.mall.setting.is_show_goods_name,
- isShowSalesNum: state => state.mallConfig.mall.setting.is_show_sales_num,
- isListUnderlinePrice: state => state.mallConfig.mall.setting.is_list_underline_price
- }),
- newList() {
- this.goods_list = [];
- for (let i = 0; i < this.list.length; i+=2) {
- if (i+1 !== this.list.length) {
- this.goods_list.push([this.list[i], this.list[i+1]]);
- } else {
- this.goods_list.push([this.list[i]]);
- }
- }
- },
- ...mapGetters('mallConfig',{
- getVideo: 'getVideo'
- })
- },
- methods: {
- route_jump(data) {
- // #ifndef MP-BAIDU
- if (data.video_url && this.getVideo == 1) {
- uni.navigateTo({
- url: `/pages/goods/video?goods_id=${data.id}&sign=${this.sign}`
- });
- } else {
- uni.navigateTo({
- url: data.page_url
- });
- }
- // #endif
- // #ifdef MP-BAIDU
- uni.navigateTo({
- url: data.page_url
- });
- // #endif
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .app-related-suggestion-product {
- width: $screen-width;
- background-color: #f7f7f7;
- .app-top {
- width: 100%;
- height: #{40+32+24rpx};
- .app-content {
- height: #{24rpx};
- width: calc(100% - #{450rpx});
- .app-line {
- width: #{56rpx};
- height: #{2rpx};
- background-color: #bbbbbb;
- }
- .app-icon-love {
- width: #{24rpx};
- height: #{24rpx};
- background-image: url('../../../static/image/icon/icon-favorite.png');
- }
- .app-text {
- font-size: #{24rpx};
- color: #999999;
- }
- }
- }
-
- }
-
- .app-bottom {
- width: #{750upx};
- padding: #{0 10upx};
- .row {
- width: 100%;
- margin-bottom: #{10upx};
- }
- .item {
- width: #{358upx};
- background-color: #ffffff;
- margin: #{5upx 0 0 0};
- border-radius: #{16upx};
- }
- .image-name {
- width: 100%;
- position: relative;
- .app-image {
- width: #{358upx};
- height: #{370upx};
- border-top-left-radius: #{16upx};
- border-top-right-radius: #{16upx};
- }
- .out-dialog {
- border-top-left-radius: #{16upx};
- border-top-right-radius: #{16upx};
- width: #{358upx};
- height: #{370upx};
- position: absolute;
- top: 0;
- left: 0;
- background-color: rgba(0,0,0,.5);
- image {
- width: #{358upx};
- height: #{370upx};
- }
- }
- .name {
- font-size: #{28upx};
- color: #353535;
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- line-height: #{32upx};
- height: #{64upx};
- width: #{318upx};
- margin: #{20upx 20upx 0 20upx};
- }
- }
- }
-
- .price-total {
- margin-bottom: #{20upx};
- font-size: #{28upx};
- line-height: 1;
- .price {
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
- .volume {
- word-break: break-all;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- font-size: #{24rpx};
- color: #999999;
- }
- }
- .content {
- padding: #{0 24upx 0 24upx};
- }
-
- .content-no {
- height: calc(100% - #{454upx});
- }
-
- .advance-content {
- height: #{40upx};
- padding: #{0 0 0 24upx};
- margin-bottom: #{10upx};
- }
-
- .content-yes {
- height: calc(100% - #{494upx});
- }
-
- .deposit {
- display: inline-block;
- font-size: #{19rpx};
- color: #ffffff;
- line-height: 1;
- border-radius: #{7rpx};
- padding: #{5rpx 5rpx};
- word-break: break-all;
- text-overflow: ellipsis;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- margin: #{8upx 0};
- }
- .member-price {
- padding: #{8upx 0};
- }
- .sup-vip {
- margin-bottom: #{8upx};
- }
- .origin-price {
- font-size: 21upx;
- color: #999999;
- text-decoration:line-through;
- }
- </style>
|