<template>
	<div>
		<uni-nav-bar title="退仓复核" :status-bar="true" background-color="#3F92F9" color="#FFF">
			<view slot="left">
				<u-icon name="account-fill" color="#FFF" size="35"></u-icon>
				<span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span>
			</view>
			<view slot="right" @tap="$utils.open(`/pages/index/index`)">
				<span style="color: #FFFFFF;">返回</span>
			</view>
		</uni-nav-bar>
		<ul>
			<li v-for="i in checkList" :key="i.stockBackId">
				<view class="text">
					退仓人员：{{i.realName}}
				</view>
				<view class="text">
					提交时间：{{i.operationTime}}
				</view>
				<view class="text">
					面料卷数：{{i.operationNum}}
				</view>
				<view class="text">
					面料米数：{{i.operationMeters}}
				</view>
				<view class="btn-warp">
					<button style="background-color: red;" @click="open(i.stockBackId)">删除</button>
					<button style="" @click="toDtl(i.stockBackId)">去复核</button>
				</view>
			</li>
		</ul>
		<u-modal v-model="show" @confirm="listDetele(deleteid)" :content="content" :show-cancel-button="true" :mask-close-able="true"></u-modal>
	</div>
</template>

<script>
	export default {
		name: "xx",
		data() {
			return {
				checkList: [],
				show:false,
				content:"你确定删除这条信息？",
				deleteid:null,
			}
		},
		created() {
			this.selectList()
		},
		methods: {
			open(_id) {
				this.deleteid = _id
				this.show = true
			},
			toDtl(_id) {
				console.log(_id)
				const v = this
				uni.removeStorage({
					key: 'reviewDtl',
					success: function(res) {
						v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
					},
					fail() {
						v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
					}
				});
			},
			listDetele(_id) {
				uni.request({
					url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/delete',
					method: 'POST',
					header: {
						'Content-Type': 'application/json',
					},
					data: {
						stockBackId: _id
					},
					success: res => {
						this.$msg.showToast('操作成功！')
						this.selectList()
					},
				});
			},
			selectList() {
				const v = this
				uni.request({
					url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/checkList',
					method: 'POST',
					header: {
						'Content-Type': 'application/json',
					},
					data: v.req,
					success: res => {
						console.log(res)
						this.checkList = res.data.data
					},
				});
			},
		},
	}
</script>

<style scoped lang="less">
	ul {
		padding: 0 20rpx;

		li {
			.text {
				height: 60rpx;
				line-height: 60rpx;
				padding: 0 20rpx;
			}

			border-radius: 5rpx;
			list-style: none;
			background-color: #fff;
			overflow: hidden;
			margin-top: 20rpx;

			.btn-warp {
				display: flex;
				justify-content: space-between;
			}

			button {
				background-color: blue;
				margin-top: 20prx;
				color: #fff;
				width: 48%;
			}
		}
	}
</style>
