<template>
	<view>
		<view @click="navToDetailPage(productItem)">
			<view class="image-wrapper">
				<image :src="productPreviewPicture(productItem)" mode="aspectFill"></image>
				<view class="prohibit prohibit-text" v-if="getProductProhibit(productItem)">
					{{getProductProhibit(productItem)}}
				</view>
			</view>
			<text class="title clamp">{{productItem.productName}}</text>
		</view>
		<produceOperation :item="productItem" :prohibitBag="getProductProhibit(productItem)"></produceOperation>
	</view>
</template>

<script>
	import produceOperation from './produceOperation'
	import {
		productItem,
		getProductProhibit
	} from '../js/request.js'

	export default {
		components: {
			produceOperation
		},
		props: ['item'],
		data() {
			return {
				productItem: productItem(this.item)
			}
		},
		watch: {
			item(val) {
				this.productItem = productItem(val)
			}
		},
		methods: {
			...{
				getProductProhibit
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '../static/scss/guess.scss';
</style>
