<template>
	<view :style="{ minHeight: sys.windowHeight + 'px' }"
		:class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
		<tm-menubars title="详情" :shadow="0" :showback="true"></tm-menubars>
		<image class="touimg" :src="moren" mode="widthFix"></image>
		<view class="qiehuancla">
			<view :class="index==0?'border':'border1'" class="da" v-for="(item,index) in datall.images" @click="qiehuan(index,item)">
				<image class="xiaoimg" :src="item"></image>
				<image v-if="index==chooseindex" class="sanjiao" src="/static/img/93.png" mode="widthFix"></image>
			</view>
			<!-- <view :class="index==1?'border':'border1'" class="da" @click="qiehuan(1)">
				<image class="xiaoimg" src="/static/img/92.png"></image>
				<image v-if="index==1" class="sanjiao" src="/static/img/93.png" mode="widthFix"></image>
			</view>
			<view :class="index==2?'border':'border1'" class="da" @click="qiehuan(2)">
				<image class="xiaoimg" src="/static/img/92.png"></image>
				<image v-if="index==2" class="sanjiao" src="/static/img/93.png" mode="widthFix"></image>
			</view>
			<view :class="index==3?'border':'border1'" class="da" @click="qiehuan(3)">
				<image class="xiaoimg" src="/static/img/92.png"></image>
				<image v-if="index==3" class="sanjiao" src="/static/img/93.png" mode="widthFix"></image>
			</view>
			<view :class="index==4?'border':'border1'" class="da" @click="qiehuan(4)">
				<image class="xiaoimg" src="/static/img/92.png"></image>
				<image v-if="index==4" class="sanjiao" src="/static/img/93.png" mode="widthFix"></image>
			</view> -->
			<view style="clear: both;"></view>
		</view>
		<tm-sheet class="contzui">
			<div class="zhuti" v-if="datall !=0">
				<view class="text-white">{{datall.title}}</view>
				<!-- <view class="text-gray text-size-m mt-20">adidas 白色、黑色和灰色双层泡沫和网布 Triple S 运动鞋是与 adidas 携手推出的合作款。</view> -->
				<!-- <view class="shoucang mt-30 fr">
					<view class="fl di mr-20" @click="shouc">
						<tm-translate ref="a_3" :auto="true" :duration="80"  animation-name="zoomIn">
							<image :src="shoucangsrc?'/static/img/15.png':'/static/img/8.png'" mode="widthFix" style="margin-right: 15px;"></image>
						</tm-translate>
					</view>
					<view class="fl di" @click="zan">
						<tm-translate ref="a_2" :auto="true" :duration="80"  animation-name="zoomIn">
							<image :src="dianzan?'/static/img/16.png':'/static/img/9.png'" mode="widthFix" style="margin-right: 15px;"></image>
						</tm-translate>
					</view>
				</view> -->
				<view style="clear: both;"></view>
			</div>
		</tm-sheet>
		<tm-sheet :padding="[0, 0]" class="jiaoxi">
			<view class="zhuti shangpin">
				<view class="mb-30 mt-20 text-white">商品</view>
				<tm-cartCellListFood  v-on:jiaruFun="jiarufuFun" v-for="item in test" :typeclick="typeclick" :mdata="item" :cart-num.sync="item.buy"></tm-cartCellListFood>
			</view>
		</tm-sheet>
		
		<!-- 弹出层消息 -->
		<tm-message ref="toast"></tm-message>
	</view>
</template>	
<script>
import{myRequest} from '@/api/request.js'
export default {
	data() {
		return {
			index:0,
			shoucangsrc:true,
			dianzan:true,
			test: [],
			typeclick:3,//1加入购物车，2购物车,3详情
			datall:0,
			chooseindex:0,
			moren:''
		};
	},
	onLoad(e) {
		this.id=e.id?e.id:8;
	},
	created() {
		this.sys = uni.getSystemInfoSync();
		this.getDate();
	},
	methods: {
		getDate(){
			let that = this;
			myRequest({
				url: "/api/ShopCollocation/getShopCollocationDetails",
				method: 'post',
				data: {id:that.id}
			}).then(res => {
				if (res.data.code == 200) {
					that.datall=res.data.data.data;
					that.moren=that.datall.images[0]
					res.data.data.details.forEach(item => {
						that.test.push({
							img: item.shopGoods.image,
							title: item.shopGoods.goods_name,
							label: item.shopGoods.goods_details,
							goods_id:item.shop_goods_id,
							id: item.shopGoods.id,
						})
					})
				} else {
					that.$refs.toast.show({
						model: 'error',
						label: res.data.msg
					})
				}
			})
		},
		jiarufuFun(data){
			uni.navigateTo({
				url: "/pages/shopdetail/index",
			})
			console.log(data)
		},
		shouc(){
			this.shoucangsrc=! this.shoucangsrc;
			this.$refs.a_3.play()
		},
		zan(){
			this.dianzan=! this.dianzan;
			this.$refs.a_2.play()
		},
		qiehuan(index,item){
			this.chooseindex=index;
			this.moren=item;
		}
	},
}
</script>

<style lang="scss">
	/deep/ .tm-menubars .body{
		background-color: #1b1b1b !important;
	}
	/deep/ .zhuti{padding: 10px 10px;}
	/deep/ .kuang{margin:0 !important;padding: 0px !important;}
	.touimg{width: 100%;display: block;}
	.qiehuancla{width: 100%;}
	.xiaoimg{width: 100%;height: 55px;display: block;}
	.qiehuancla .da{width: 19.4%;float: left;height: 55px;position:relative;}
	.border{border: 1px solid #0178FD;}
	.border1{border: 1px solid #0D0D0D;}
	.sanjiao{width: 18px;height: 18px;position: absolute;top: -10px;left:39%;}
	.shoucang image{width: 45px;}
	.qiehuan{float: right;}
	.qiehuan .a_1{margin-top: 25%;}
	.qiehuan .anniu{width: 20px;height: 20px !important;}
	.di{background: #0D0D0D;width: 45px;height: 45px;text-align: center;line-height: 50px;border-radius: 30px;}
	.di image{width: 22px;margin: 0 !important;height: 20px !important;}
	.contzui{margin:0;}
	/deep/ .shangpin .white.bk{background-color:#1b1b1b!important;}
	/deep/ .shangpin .tm-cartCellListFood{padding: 0px 10px 15px 10px !important;
	margin-top: 5px !important;margin-bottom: 20px !important;
	border-bottom: 1px solid #303030;}
	/deep/ .shangpin .border-t-1.bk{border-top:1px solid #1B1B1B!important;}
	/deep/ .shangpin .round-3{width:110px !important;height:110px !important;}
	/deep/ .shangpin .tm-cartCellListFood-img{width:110px !important;height:110px !important;}
	.fudong{position: fixed;right:30px;bottom:80px;background: #0DABF2;width: 60px;height:60px;
	border-radius: 30px;text-align: center;}
	/deep/ .shangpin .title{color: white !important;font-size: 16px;}
	/deep/ .shangpin .text-red{color: white !important;}
	.jiaoxi{margin: 0px;margin-top: 15px;}
	/deep/ .shangpin .tm-cartCellListFood-label{font-size: 14px;color: white !important;margin-top: 10px !important;}
</style>
