<template>
	<view class="warehouseDetail-wrap">
		<view class="panel-box flex align_center justify_between">
			<view class="pimgs">
				<u-image :src="productData && productData.productMsg||`../../static/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
			</view>
			<view class="info-con flex_1">
				<view>{{productData && productData.productCode || '--'}}</view>
				<view class="padding_7">{{productData && productData.productName || '--'}}</view>
			</view>
		</view>
		<view class="warehouseDetail-info">
			<view class="info-item flex align_center justify_between">
				<view class="info-name">变动类型</view>
				<view v-if="paramsData && paramsData.flowType">{{paramsData.flowType=='OUT'?'出库':paramsData.flowType=='PUT'?'入库':'--'}}</view>
				<view v-else>--</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">变动数量</view>
				<view v-if="paramsData && paramsData.flowType && paramsData.flowType=='PUT'">
					<view style="color: green;display: inline-block">
						<text v-if="paramsData && paramsData.putQty && paramsData.putQty!=0">+</text>{{ toThousands(paramsData && paramsData.putQty||0) }}
					</view>
					{{paramsData && paramsData.product && paramsData.product.unit}}
				</view>
				<view v-if="paramsData && paramsData.flowType && paramsData.flowType=='OUT'">
					<view style="color: red;display: inline-block">
						<text v-if="paramsData && paramsData.outQty && paramsData.outQty!=0">-</text>{{ toThousands(paramsData && paramsData.outQty||0) }}
					</view>
					{{paramsData && paramsData.product && paramsData.product.unit}}
				</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">单据类型</view>
				<view>{{paramsData && paramsData.bizTypeDictValue || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">单据审核时间</view>
				<view>{{paramsData && paramsData.auditTime || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">单位名称</view>
				<view v-if="paramsData">
					<text v-if="paramsData.unitType&&paramsData.unitType=='CUSTOMER'">{{ paramsData.unitNameCurrent||'--' }}</text>
					<text v-else>{{ paramsData.unitName||'--' }}</text>
				</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">批次号</view>
				<view>{{paramsData && paramsData.stockBatchNo || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">关联单据号</view>
				<view>{{paramsData && paramsData.bizNo || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">仓库</view>
				<view>{{paramsData && paramsData.warehouseName || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">仓位</view>
				<view>{{paramsData && paramsData.warehouseLocationName || '--'}}</view>
			</view>
			<view class="info-item flex align_center justify_between" v-if="$hasPermissions('M_showCostPrice_mobile')">
				<view class="info-name">总成本</view>
				<view>￥{{toThousands(paramsData && paramsData.totalCost || 0, 2)}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">总售价</view>
				<view>￥{{toThousands(paramsData && paramsData.totalPrice || 0, 2)}}</view>
			</view>
			<view class="info-item flex align_center justify_between">
				<view class="info-name">出入库状态</view>
				<view>{{paramsData && paramsData.stateDictValue || '--'}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { toThousands } from '@/libs/tools'
	export default{
		data(){
			return {
				productData: null,
				paramsData: null,
				theme: '',
				toThousands
			}
		},
		onLoad(option) {
			this.theme = getApp().globalData.theme
			this.productData = option.productData ? JSON.parse(option.productData) : null
			this.paramsData = option.data ? JSON.parse(option.data) : null
		},
		methods: {}
	}
</script>

<style lang="scss">
	page{
		background: #f8f8f8;
	}
	.warehouseDetail-wrap{
		padding: 30upx;
		.panel-box {
			background-color: #ffffff;
			padding: 20upx 20upx;
			border-radius: 20upx;
			box-shadow: 3upx 2upx 6upx #eee;
			margin-bottom: 30upx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.info-con{
				margin-left: 20upx;
				.padding_7{
					padding: 14upx 0 0;
				}
			}
		}
		.warehouseDetail-info{
			background-color: #ffffff;
			padding: 10upx 20upx 20upx;
			border-radius: 20upx;
			box-shadow: 3upx 2upx 6upx #eee;
			.info-item{
				border-bottom: 1px dashed #e4e7ed;
				padding: 20upx 0;
				.info-name{
					color: #464646;
				}
			}
		}
	}
</style>
