<style lang="scss">
	.container{
		min-height: 100%;
		background:#f6f6f6;
		padding:30rpx 0;
		.card{
			margin-top:0;
			&>.head{
				display:flex;
				align-items: center;
				border-bottom: 2rpx solid #D8D8D8;
				padding-bottom:20rpx;
				text{
					&:first-child{
						flex-shrink: 0;
						color:#10C176;
						margin-right:20rpx;
					}
					&:nth-child(2){
						flex-grow: 1;
						color:#10C176;
					}
					&:nth-child(3){
						flex-shrink: 0;
						color:#FBB65C;
						margin-left:10rpx;
					}
				}
			}
			&>.plant-youbian{
				margin-top:20rpx;
				display:flex;
				flex-direction: row-reverse;
				align-items: center;
				justify-content: flex-end;
				text{
					flex-grow: 1;
					font-weight: bold;
					display:flex;
					align-items: center;
					&:after{
						content:"("attr(data-unit)")";
						font-size:20rpx;
						color:#999;
						margin-left:6rpx;
					}
				}
			}
			&>.company{
				margin-top:12rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				text{
					&:first-child{
						font-size:24rpx;
						color:#999;
					}
					&:nth-child(2){
						color:#10C176;
					}
				}
			}
		}
	}
</style>
<template>
	<view class="container">
		<view class="card" v-for="(v,k) in list" :key="k" @click="$u.route({url:'pages/stock/goods_detail'})">
			<view class="head">
				<text class="plant-rili"/> <text>批次号：{{v.batchNo}}</text> <text>{{v.inOutType}}</text>
			</view>
			<view class="plant-youbian"> <text :data-unit="v.specDescribe">{{v.substanceName}}</text> </view>
			<view class="company">
				<text>{{v.supplierName}}</text> <text>{{v.number}}袋(共{{v.equivalentAmount}}{{v.unit}})</text>
			</view>
		</view>
	</view>
</template>
<script>
import request from '@/common/request.js'
export default {
	data(){
		return{
			searchVal:{
				baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId,
				pageNo:1,
				pageSize:6,
			},
			list:[],
			total:0,
		}
	},
	onLoad(options){
		this.search()
	},
	methods:{
		async search(){
			if(this.total==0 || this.list.length<this.total){
				var res=await request("/api/OutInManageApi/queryOutInRecord",{
					method:"post",
					body: this.searchVal
				})
				if(res.statu){
					this.list=this.list.concat(res.data.list)
					this.total=res.data.total
					this.searchVal.pageNo++
					if(this.list.length==this.total)uni.showToast({title:"加载完成！",icon:"none"})
				}else{
					uni.showModal({
						title:"提示",
						content:res.msg||"获取出入库记录失败！",
						showCancel:false,
					})
				}
			}
		}
	},
	onReachBottom(){
		this.search()
	},
}
</script>