<template>
	<div class="module-item-goods" :style="!module.base.m ? 'margin-top:0' : ''" v-if="shopList.length>0">
		<div class="item-goods-con" :style="style">
			<view>
				<moduleBg :base="module.base" />
				<moduleTwtit :type="module.type" :title="module.title" v-if="module.title.s" />
			</view>
			
			<div class="item-goods-style1" :class="module.base.s == 1 ? 'style2' : ''">
				<div class="scroll-true flex-grow-1">
					<div class="item" style="width: 30%;" v-for="(item, index) in shopList" :key="index"
						@click="$util.openPtGoods(shopList,index)">
						<div class="pic" style="height: auto;">
							<image style="width: 100%;height: 212upx;" class="pic_img" :src="url+item.thumb" />
						</div>
						<div class="c" style="padding: 0 5px;">
							<div class="tit" v-if="module.base.t.s">
								<moduleText :text="module.base.t" :name="item.name" />
							</div>
							<div class="price" v-if="module.base.sjg ">
								<template v-if="module.base.sjg">
									<span>
										<b>￥{{ item.collage_price }}</b>
									</span>
								</template>
							</div>

							<div v-if="module.base.sgm">
								<span style="text-decoration:line-through;color: #999" class='ft24'>
									￥{{item.price }}
								</span>
							</div>

						</div>
					</div>
				</div>
			</div>
			
			<div class="noadd" v-if="shopList.length == 0">
				暂无拼团商品
			</div>
			
		</div>
	</div>
</template>

<script>
	import moduleBg from './bg.vue';
	import moduleText from './text.vue';
	import moduleTwtit from './twtit.vue';
	export default {
		props: ['module'],
		components: {
			moduleBg,
			moduleText,
			moduleTwtit
		},

		data() {
			return {
				url: getApp().globalData.URL,
				shopList: [],
			};
		},

		computed: {
			style() {
				if (this.module.base.fc != '') {
					return `color:${this.module.base.fc}`;
				}
			}
		},

		mounted() {
			this.getGoodsList();
		},

		methods: {
			getGoodsList() {
				var shopList = [];
				this.$http.request('template/collageGoodsList', {
					store_id: this.$store.state.store_id,
					controller: "admin",
					page: 1,
					limit: 6,
				}, "", true, "").then(t => {
					if (t.code == '200' || t.code == '0' ||t.code == 200) {
						for (let i of t.data) {
							shopList.push({
								name: i.name,
								price: i.price,
								collage_price: i.collage_price,
								thumb: i.thumb,
								id: i.id,
								collage_id: i.collage_id,
							})
						}
						this.module.list = shopList;
						this.shopList = shopList;
						// console.log(this.module.list, "this.module.list")
					} else {
						this.shopList = [];
						this.module.list = shopList;
					}
				})
			},
		},

	};
</script>

<style>
	@import url("./goods.css");
	.noadd {
		position: relative;
		color: #999;
	}
</style>
