<template>
	<view>
		<block v-if="logs.length > 0">
			<view class="logs" v-for="(item, index) in logs" :key="index">
				<view class="logs-item">
					<label>交易权证</label>
					{{item.goods.goods_name}}
				</view>
				<view class="logs-item">
					<label>交易单价</label>
					￥{{item.price}}
				</view>
				<view class="logs-item">
					<label>交易数量</label>
					{{item.qty}}
				</view>
				<view class="logs-item">
					<label>转让用户</label>
					{{item.sellUser.nickname}}
				</view>
				<view class="logs-item">
					<label>购买用户</label>
					{{item.buyUser.nickname}}
				</view>
				<view class="logs-item">
					<label>交易时间</label>
					{{item.created_at}}
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import { marketsLogs } from '@/apis/interfaces/market'
	export default {
		data() {
			return {
				logs: [],
				page: {}
			};
		},
		created(){
			marketsLogs().then(res => {
				console.log(res.data)
				this.logs = res.data
				this.page = res.page
			}).catch(err => {
				uni.showToast({
					title: err.message,
					icon : 'none'
				})
			})
		}
	}
</script>

<style lang="scss" scoped>
	.logs{
		background: white;
		margin-top: $margin;
		padding: ($padding - 10) $padding;
		.logs-item{
			padding-left: 200rpx;
			height: 50rpx;
			line-height: 50rpx;
			position: relative;
			text-align: right;
			font-size: $title-size-m;
			@extend .nowrap;
			label{
				position: absolute;
				left: 0;
				top: 0;
				width: 200rpx;
				text-align: left;
				color: $text-gray;
			}
		}
	}
</style>
