<template>
	<block>
		<view class="nav-right-item flex" v-for="(item, index) in list" :key="item.productSn">
			<view class="uni-col-2">
				<u-image :src="item.images+'?x-oss-process=image/resize,m_fixed,h_120,w_120,color_ffffff'" @click="viewImg(item)" border-radius="30" width="100" height="100" bg-color="#EBEBEB" ></u-image>
			</view>
			<view class="item-info uni-col-10">
				<view class="item-name">
					<text>{{item.name}}</text>
				</view>
				<view class="item-detail">
					<view class="item-detail-info">
						<view class="flex justify_between">
							<text class="item-detail-text flex_1">{{item.code}}</text>
							<text class="item-detail-text">库存：{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
						</view>
						<view class="flex" v-if="item.productTypeSn=='543766811373752320'">
							<u-tag :text="item.origCode" mode="light" borderColor="#ffffff" shape="circle" type="success"></u-tag>
						</view>
						<view class="flex justify_between">
							<view class="item-detail-text flex_1" @click="openPriceModal(item,0,showShelfDetial)">
								<text class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice&&configPrice&&configPrice.shelf_price_show == '1'">{{item.price?'￥'+item.price:'暂无价格'}}</text>
								<text class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice&&configPrice&&configPrice.shelf_cost_show == '1'">{{item.cost?'￥'+item.cost:'暂无价格'}}</text>
								<u-icon name="arrow-right" v-if="priceShowVal&&showShelfDetial"></u-icon>
							</view>
							<view class="item-detail-text" v-if="item.currentInven">
								<u-button shape="circle" @click="addPart(item)" v-if="!item.checked" :custom-style="{width:'48upx',height:'48upx',background:'#066cff'}" type="primary" size="mini">
									<u-icon name="plus" color="#fff" size="28"></u-icon>
								</u-button>
								<u-number-box v-else @change="updateNums" @blur="updateNums" v-model="item.qty" :index="item.productSn" :min="0" :max="item.currentInven"></u-number-box>
							</view>
							<view class="item-detail-text" v-else>
								<text @click="addPart(item)" v-if="!item.checked" class="phtxt">我要急送</text>
								<u-number-box v-else @change="updateNums" @blur="updateNums" v-model="item.qty" :index="item.productSn" :min="0"></u-number-box>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</block>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => {
					return []
				}
			},
			configPrice: {
				type: Object,
				default: () => {
					return {}
				}
			},
			showCarPrice: {
				type: Boolean,
				default: false
			},
			showCostPrice: {
				type: Boolean,
				default: false
			},
			showShelfDetial: {
				type: Boolean,
				default: false
			},
			showNonShelfDetial: {
				type: Boolean,
				default: false
			},
			priceShowVal: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
			}
		},
		methods: {
			openPriceModal(item, type, show) {
				this.$emit('openPrice', item, type, show)
			},
			addPart(item) {
				this.$emit('addPart', item, 'other')
			},
			updateNums(e) {
				this.$emit('updateNums', e)
			},
			viewImg(item){
				this.$emit('viewImg',item)
			}
		}
	}
</script>

<style>
</style>