123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template name="recommend">
- <!-- 供应商信息 -->
- <view class="recommend clearfix">
- <view class="recommend-empty" v-if="isEmpty">暂无相关推荐商品</view>
- <view class="recommend-list" v-else>
- <view class="row-list" v-for="(pros, idx) in recommendList" :key="idx" @click.stop="navToDetailPage(pros.id)">
- <view class="list-image"><image :src="pros.image" mode=""></image></view>
- <view class="list-name">{{pros.name}}</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { mapState,mapMutations} from 'vuex';
- import authorize from '@/common/config/authorize.js'
- import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
- import tuiNomore from "@/components/tui-components/nomore/nomore"
-
- export default{
- name:'recommend',
- props:{
- queryProductid: {
- type: Number,
- default: 0
- },
- queryType:{
- type: String,
- default: '0'
- }
- },
- components:{
- tuiLoadmore,
- tuiNomore,
- },
- data() {
- return{
- current:0,
- recommendList:[],
- isEmpty:false,
- pageSize:4,
- productID:'',
- }
- },
- created() {
- this.productID = this.queryProductid
- this.infoRecommend(this.queryProductid,this.queryType)
- },
- computed: {
- ...mapState(['identity'])
- },
- methods:{
- infoRecommend(id,type){
- this.ProductService.queryProductDetilsRelevant({ productId:id,recommendType:type ? type : 0,identity:this.identity }).then(response =>{
- if( response.data && response.data.length > 0){
- this.isEmpty = false
- this.recommendList = response.data
- }else{
- this.isEmpty = true
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- //轮播图切换修改背景色
- swiperChange(e) {
- const index = e.detail.current;
- this.current = index;
- },
- navToDetailPage(id) {//跳转商品详情页
- this.$api.navigateTo(`/pages/goods/product?id=${id}`)
- }
- }
- }
- </script>
- <style lang="scss">
- .recommend{
- background: #F7F7F7;
- width: 100%;
- .recommend-empty{
- width: 702rpx;
- height: 100rpx;
- line-height: 100rpx;
- padding: 0 24rpx;
- font-size: $font-size-28;
- color: #999999;
- text-align: center;
- }
- .recommend-list{
- width: 100%;
- height: auto;
- position: relative;
- box-sizing: border-box;
- padding: 0rpx 24rpx;
- .row-list{
- width: 340rpx;
- height: auto;
- float: left;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
- border-radius: 20rpx;
- background: #FFFFFF;
- &:nth-child(2n){
- margin-right: 0;
- }
- .list-image{
- width: 100%;
- height: 340rpx;
- border-radius: 20rpx 20rpx 0 0;
- image{
- width: 100%;
- height: 340rpx;
- border-radius: 20rpx 20rpx 0 0;
- }
- }
- .list-name{
- font-size: $font-size-28;
- color: $text-color;
- line-height:88rpx;
- padding: 0 10rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
- }
- .swiper__recommenddots-box{
- position: absolute;
- bottom: -20rpx;
- left: 0;
- right: 0;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- flex: 1;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- height: 60rpx;
- background: #FFFFFF;
- .swiper__dots-item{
- width: 8rpx;
- height: 8rpx;
- border-radius: 100%;
- margin-left: 6px;
- background-color:rgba(0,0,0,.3);
- }
- .swiper__dots-long{
- width: 32rpx;
- height: 8rpx;
- border-radius: 4rpx;
- background-color: #000;
- transition: all 0.4s;
- }
- }
- }
- </style>
|