<template>
<view class="burst">
	<view class="item" v-for="(item,index) in list" @click="godDetail(item)" :key="index">
		<image :src="item.image"></image>
		<view class="content">
			<view class="title">{{item.store_name}}</view>
			<view class="price">
				<text>￥</text>
				{{item.price}}
			</view>
			<view class="ziying">
				{{item.merchant?(item.merchant.is_trader==1?'自营':item.merchant.type_name):''}}
			</view>
			<view class="info">
				<text class="score">{{item.rate}}评分</text>
				<text class="comment">{{item.reply_count}}评论</text>
			</view>
			<view class="store">
				<text class="name">
					{{item.merchant?item.merchant.mer_name:''}}
				</text>
				<text class="goStore" @click.stop="goStore(item.mer_id)">进店></text>
			</view>
		</view>
	</view>
</view>
</template>

<script>
import { configMap } from "@/utils";
import { mapGetters } from "vuex";
import {getProductslist,initiateAssistApi} from '@/api/store.js';
import { goShopDetail } from '@/libs/order.js'
export default{
	data(){
		return{
			list:[]
		}
	},
	computed: {
		
		...configMap({margin_ico_switch: 0,margin_ico: '',hide_mer_status:0,recommend_switch: 0},mapGetters(['uid','isLogin','scrollTop','viewColor','keyColor'])),
	},
	methods:{
		get_product_list() {
			getProductslist({
				cate_id: '',
				order: '',
				price_on: '',
				price_off: '',
				brand_id: '',
				keyword: '',
				is_trader: '',
				mer_type_id: '',
				filter_params: '',
				page: 1,
				limit: 30,
				// is_burst:1
			}).then(res => {
				console.log(res,"-=-")
				this.list = res.data.list;
			}).catch(err => {
				that.loading = false;
				
			});
		},
		goStore(id) {
			uni.navigateTo({
				url: `/pages/store/home/index?id=${id}`
			})
		},
		// 去详情页
		godDetail(item) {
			
			goShopDetail(item, this.uid).then(res => {
				if (this.isLogin) {
					initiateAssistApi(item.activity_id).then(res => {
						let id = res.data.product_assist_set_id;
						uni.hideLoading();
						uni.navigateTo({
							url: '/pages/activity/assist_detail/index?id=' + id
						});
					}).catch((err) => {
						uni.showToast({
							title: err,
							icon: 'none'
						})
					});
				} else {
					toLogin()
				}
			})
		},
	},
	onLoad() {
		this.get_product_list()
	}
}
</script>

<style lang="scss" scoped>
.burst{
	.item{
		padding:30rpx;
		margin-bottom:20rpx;
		display: flex;
		background: #fff;
		margin:0 24rpx;
		margin-top:24rpx;
		border-radius: 20px;
		image{
			width: 210rpx;
			height:210rpx;
			
			flex-shrink: 0;
		}
		.content{
			flex:1;
			height:200rpx;
			margin-left:25rpx;
			
			.title{
			
				font-family: Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 32rpx;
				color: #333333;
			
				width:calc(100vw - 335rpx);
				overflow: hidden;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
				
			}
			.price{
				
				font-family: Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 34rpx;
				color: #E53623;
				margin-top:5rpx;
				text{
					font-size:28rpx;
				}
			}
			.ziying{
				padding:6rpx 10rpx;
				background: #E53623;
				border-radius: 4rpx;
				margin-top:5rpx;
				
				font-weight: 400;
				font-size: 20rpx;
				color: #FFFFFF;
				display: inline-block;
			}
			.info{
				margin-top:10rpx;
				font-weight: 400;
				font-size: 24rpx;
				color: #C0C5CA;
				.score{
					margin-right:20rpx;
				}
			}
			.store{
				.name{
				
					font-weight: 400;
					font-size: 24rpx;
					color: #C0C5CA;
				}
				.goStore{
					color:#333333;
					font-size: 24rpx;
					margin-left:10rpx;
				}
			}
		}
	}
}
</style>