<template>
	<view class="wraper">
		<image class="cover" v-if="detail.base_data.goods_img" :src="baseUrl + '/' + detail.base_data.goods_img" mode="aspectFit"></image>
		
		<view class="title">{{detail.base_data.goods_name}}</view>
		
		<view class="information font-28 mb-2">
			<view class="w-100 flex j-between a-center mb-3">
				<view class="descColor">商品规格</view>
				<view>{{detail.base_data.goods_attr}}</view>
			</view>
			<view class="w-100 flex j-between a-center mb-3">
				<view class="descColor">产品产地</view>
				<view>{{detail.base_data.production_place}}</view>
			</view>
			<view class="w-100 flex j-between a-center mb-3">
				<view class="descColor">商品条码</view>
				<view>{{detail.base_data.bar_code}}</view>
			</view>
			<view class="w-100 flex j-between a-center mb-3">
				<view class="descColor">生产日期</view>
				<view>{{detail.base_data.production_data}}</view>
			</view>
			<view class="w-100 flex j-between a-center">
				<view class="descColor">保质期</view>
				<view>{{detail.base_data.shelf_life}}</view>
			</view>
		</view>
		
		<preview-zz
			v-if="detail.dynamic_data.sup_zhizhao && detail.dynamic_data.sup_zhizhao.length > 0"
			name="供货商"
			:originName="detail.dynamic_data.sup_name"
			:originCode="detail.dynamic_data.sup_unit_credit_code"
			:list="detail.dynamic_data.sup_zhizhao"
		/>
		
		<preview-zz
			v-if="detail.dynamic_data.jxs_zhizhao && detail.dynamic_data.jxs_zhizhao.length > 0"
			name="经销商"
			:originName="detail.dynamic_data.jxs_name"
			:originCode="detail.dynamic_data.sup_unit_credit_code"
			:list="detail.dynamic_data.jxs_unit_credit_code"
		/>
	</view>
</template>

<script>
	import previewZz from './components/preview_zz.vue'
	import { safeOrigin } from '@/apis/order.js'
	export default {
		data() {
			return {
				detail: {}
			}
		},
		
		components: {
			previewZz
		},
		
		onLoad(ops) {
			const { og_id } = ops
			this.og_id = og_id
			this.getData()
		},
		
		methods: {
			getData() {
				safeOrigin(this.og_id)
					.then(({status, data}) => {
						if(status) {
							this.detail = data
						}
					})
			}
		}
	}
</script>

<style lang="scss" scoped>
.cover {
	width: 750rpx;
	height: 750rpx;
	background-color: #fff;
	margin-bottom: 20rpx;
}

.title {
	@include borderBox(40rpx, 30rpx);
	background-color: #fff;
	margin-bottom: 20rpx;
}
.information {
	width: 100%;
	@include borderBox(40rpx, 30rpx);
	background-color: #fff;
}
</style>
