list1.vue 4.53 KB
<template>
	<view>
		<view class="list1 flex justify-content-between" v-for="(item,index) of shopList" :key="index">
			<view class=" flex" >
				<view style="position: relative;">
					<image :src="'http://app.xn--43vp3ce98aj8m.com/'+item.avatar" @click.stop="previewImage(item.avatar)"
						style="width: 140rpx;border-radius: 15rpx;height: 100%;" mode="aspectFill"></image>
					<!-- <image src="../../../static/home/shou1.png" v-if="!item.is_follow" class="postion1" mode="widthFix"></image> -->
					<image :src="item.is_follow?'../../../static/home/shou2.png':'../../../static/home/shou1.png'"
						class="postion1" mode="widthFix" @click="change(item)"></image>
				</view>
				<view style="margin-left: 15rpx;width:100%;" @click="goNav('/pages/wanl-home/detail?id='+item.id)">
					<view style="width: 400rpx;overflow: hidden;">
						<span style="font-weight: bold;font-size: 25rpx;" >{{item.shopname}}</span>
						<text class="text1">{{item.mu}}亩</text>
						<text class="text2">{{item.production}}/斤</text>
					</view>
					<scroll-view :scroll-x="true" style="width: 400rpx;">
						<view style="display: flex;width: 400rpx;overflow: hidden;">
							<view style="position: relative;margin-right: 20rpx;" v-for="(val,num) of item.user_list"
								:key="num">
								<image @click.stop="previewImage(val.image)" :src="'http://app.xn--43vp3ce98aj8m.com/'+val.image"  class="img" mode="aspectFill">
								</image>
								<view class="postion">
									<image src="/static/home/shi.png" mode="widthFix"></image>
									<text style="font-size: 21rpx;color: #fff;" v-if="val.type=='1'">村长</text>
									<text style="font-size: 21rpx;color: #fff;" v-if="val.type=='2'">社长</text>
									<text style="font-size: 21rpx;color: #fff;" v-if="val.type=='3'">村民</text>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
			</view>
			<view style="width:170rpx;margin-left: 15rpx;">
				<view class="flex justify-content-around" @click="goNav('/pages/wanl-home/detail?id='+item.id)">
					<image src="../../../static/home/message.png" style="width: 30rpx;" mode="widthFix"></image>
					<image src="../../../static/home/v.png" style="width: 30rpx;" mode="widthFix"></image>
				</view>
				<view class="btn" @click="goNav('/pages/wanl-home/detail?id='+item.id)">预约下单</view>
				<view class="num">
					{{item.payment}}人付款
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['shopList'],
		data() {
			return {}
		},
		watch: {
			shopList(val) {
				console.log('商家的信息', val)
			}
		},
		methods: {
			previewImage(val){
				console.log('previewImage',val);
				if(val.indexOf('http')<=-1){
					val = 'http://app.xn--43vp3ce98aj8m.com/'+val;
				}
				uni.previewImage({
					urls:[val],
					current:0,
				})
			},
			goNav(url) {
				console.log('tz?')
				uni.navigateTo({
					url: url
				})
			},
			change(val) {
				this.API.setFindUser2({
					type: 'follow',
					shop_id: val.id
				}).then(res => {
					uni.showToast({
						icon: 'success',
						title: res.data.data == 1 ? '收藏成功' : '取消成功',
						duration: 800
					})
					val.is_follow = !val.is_follow
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.text1 {
		margin-left: 10rpx;
		font-size: 21rpx;
		color: #2E607C;
		background-color: #E3F5FF;
		padding: 8rpx 10rpx;
		border-radius: 15rpx;
	}

	.text2 {
		margin-left: 10rpx;
		font-size: 21rpx;
		color: #2E7C3B;
		background-color: #E3FFEE;
		padding: 10rpx 10rpx;
		border-radius: 15rpx;
	}

	.img {
		width: 100rpx;
		height: 120rpx;
		border-radius: 15rpx;
		margin-top: 20rpx;
	}



	image {
		width: 100%;
		height: 100%;
	}



	.list {
		margin-top: 40rpx;
		background-color: #fff;
		padding: 20rpx 30rpx;
		border-radius: 20rpx;

		.list_title {
			font-size: 26rpx;
		}

		.more {
			font-size: 24rpx;
			color: #C5C5C5;
		}

		.list1 {
			margin-top: 20rpx;
			border-bottom: 2rpx solid #D4D4D4;
			padding-bottom: 10rpx;
		}
	}

	.postion {
		position: absolute;
		background-color: rgba(0, 0, 0, 0.5);
		width: 100rpx;
		height: 50rpx;
		bottom: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 0 0 15rpx 15rpx;

		image {
			width: 25rpx;
			margin-right: 15rpx;
		}
	}

	.btn {
		color: #fff;
		background: linear-gradient(to right, #FFA0A0, #FF5A5A);
		font-size: 20rpx;
		margin: 30rpx 0 25rpx;
		padding: 10rpx 10rpx;
		border-radius: 15rpx;
		text-align: center;
	}

	.num {
		font-size: 22rpx;
		color: #D4D4D4;
	}

	.postion1 {
		position: absolute;
		top: 10rpx;
		left: 10rpx;
		width: 50rpx;
	}
</style>