<template>
	<!-- 设备退回列表 -->
	<view class="overview">
		<u-sticky zIndex="3">
			<view class="head">
				<u-search placeholder="请输入设备名称" v-model="keyword" @search="getList" @custom="getList"></u-search>
			</view>
		</u-sticky>
		<view class="main" v-for="(item, index) in deviceList" :key="index">

			<view class="u-img">
				<img src="../../static/th.png"></img>
			</view>
			<view class="content" @click="toDetails(item)">
				<view>
					<u-text :text="'设备名称：'+item.equipName"></u-text>
				</view>
				<view>
					<u-text :text="'退回原因：'+item.untreadReason"></u-text>
				</view>
				<view>
					<u-text :text="'退回数量：'+item.returnNum"></u-text>
				</view>
			</view>
			<u-icon name="arrow-right" @click="toDetails(item)"></u-icon>
		</view>
		<u-divider text="没有更多数据了"></u-divider>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 1.2搜索内容
				keyword: '',

				// 3.设备列表
				deviceList: [],
			}
		},

		onShow: function() {
			this.getList()
		},
		methods: {
			async getList() {
				const {
					data: res
				} = await this.$http('/app/untitledList',{"name":this.keyword})
				if (res.code) return
				this.deviceList = res.data
			},
			// // 跳转详情页
			toDetails(item) {
				wx.navigateTo({
					url: 'untitled_details?form=' + JSON.stringify(item),
				})
			}
			
		}
	}
</script>

<style lang="scss">
	.overview {
		background: #f6f6f6;
		// padding: 2.667vw 0;
		.head {
			background: #fff;
			padding: 2.667vw;
			
			display: flex;
			justify-content: space-evenly;
			align-items: center;
			input {
				padding: 1vw;
				border-radius: 1vw;
			}
		}
		// 展示信息
		.main {
			background: #ffffff;
			margin: 1.667vh;
			display: flex;
			justify-content: space-around;
			padding: 2vh 0;
			height: 14vh;
			
			.u-image {
				float: left;
			}

			.content {
				flex-direction: column;
				align-items: flex-start;
				justify-content: space-around;
				display: flex;
				width: 55vw;

				.c-status {
					display: flex;
				}
			}

			.u-img {
				height: calc(14vh-80px);
				width: 80px;
				position: relative;

				img {
					height: 60px;
					width: 60px;
					position: absolute;
					top: 0;
					bottom: 0;
					left: 0;
					right: 0;
					margin: auto;
				}
			}
		}
	}
</style>
