<template>
	<view>
		<u-navbar placeholder leftIconSize="22px" @leftClick="leftClick">
			<view class="u-nav-slot" slot="center">
				<!-- <u-icon name="arrow-left" size="22" @leftClick="leftClick"></u-icon> -->
				<view>
					<u-search v-model="keyword" height="60rpx" placeholder="请输入药品" borderColor="#4CAF50" bgColor="#fff"
						:showAction="false"></u-search>
				</view>
			</view>
		</u-navbar>
		<view class="box_shop_card">
			<view class="box_shop_item" @click="goMerchant">
				<view class="store_img center_in">{{ 1}}</view>
				<view class="home_box_content">
					<view class="home_name_shop">阳关大药房</view>
					<view class="subhead_title">距离您 0.8 公里</view>
					<view class="subhead_title">营业时间:08:00-22:00</view>
				</view>
			</view>
			<view class="shop_tabs_box">
				<view class="item_tab_box" v-for="(item,index) in list" :key="index">
					<view class="box_shop">{{index+1}}</view>
					<view class="tab_title">{{item.title}}</view>
				</view>
			</view>
		</view>
		<view class="card_commodity">
			<view class="box_shop_commodity" v-for="(item,index) in shopList" :key="index" @click="goDetails">
				<view class="image_shop_drug">{{index + 1}}</view>
				<view class="shop_headline">{{item.title}}</view>
				<view class="shop_subhead">{{item.title}}</view>
				<view class="space_between box_trolley">
					<view class="font_green title_money">￥{{item.money}}</view>
					<view class="shopping_cart">加入购物车</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				list: [{
					title: '感冒药'
				}, {
					title: '维生素'
				}, {
					title: '医疗器械'
				}, {
					title: '外用药'
				}, {
					title: '中药'
				}],
				shopList: [{
					title: '布洛芬环视胶囊',
					money: 29.8,
				}, {
					title: '维生素c片',
					money: 29.8,
				}, {
					title: '布洛芬环视胶囊',
					money: 29.8,
				}, {
					title: '布洛芬环视胶囊',
					money: 29.8,
				}, {
					title: '维生素c片',
					money: 29.8,
				}]
			}
		},
		methods: {
			leftClick() {
				uni.navigateBack({
					delta: 1
				});
			},
			// 商品详情
			goDetails() {
				uni.navigateTo({
					url: '/pages/home/productDetails'
				});
			},
			// 商家资质
			goMerchant() {
				uni.navigateTo({
					url: '/pages/home/certification'
				});
			}
		}
	}
</script>

<style lang="scss">
	.u-nav-slot {
		width: 75%;
		// width: calc(100% - 88rpx);
		display: flex;
		justify-content: flex-start;
		// margin-left: 70rpx;
	}

	::v-deep .u-navbar__content {
		justify-content: flex-end;
	}

	.box_shop_card {
		background-color: #fff;
	}

	.box_shop_item {
		display: flex;
		padding: 20rpx;
		border-radius: 10rpx;
	}

	.store_img {
		flex: none;
		width: 150rpx;
		height: 130rpx;
		background-color: #F3F4F6;
	}

	.subhead_title {
		margin-top: 8rpx;
		font-size: 28rpx;
		color: #82848a;
	}

	.home_box_content {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: calc(100% - 20rpx);
		margin-left: 20rpx;
	}

	.home_name_shop {
		font-size: 30rpx;
		font-weight: bold;
	}

	.shop_tabs_box {
		display: flex;
		justify-content: space-evenly;
		padding-bottom: 20rpx;
	}

	.item_tab_box {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.box_shop {
		width: 80rpx;
		height: 80rpx;
		background-color: #F3F4F6;
	}

	.tab_title {
		font-size: 30rpx;
		margin-top: 5rpx;
	}

	.card_commodity {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		grid-column-gap: 20rpx;
		padding: 20rpx;
	}

	.image_shop_drug {
		width: 100%;
		height: 200rpx;
		background-color: #F3F4F6;
	}

	.box_shop_commodity {
		padding: 10px;
		break-inside: avoid;
		flex: none;
		// display: grid;
		margin-bottom: 20rpx;
		background-color: #fff;
		border-radius: 10px;
	}

	.shop_headline {
		font-size: 30rpx;
		font-weight: bold;
		padding: 10rpx 0rpx;
	}

	.shop_subhead {
		font-size: 26rpx;
	}

	.box_trolley {
		margin-top: 10rpx;
	}

	.title_money {
		font-weight: bold;
	}

	.shopping_cart {
		background-color: $x-color;
		padding: 6px 10px;
		border-radius: 30px;
		color: #fff;
		font-size: 24rpx;
	}
</style>