<template>
	<view>
		<view class="content">
			<u-search :placeholder="$t('search.placeholder')" @custom="data" v-model="keyword"></u-search>
		</view>
		
		<view class="content-one" v-for="(item,index) in datalist" :key="index">
			<view class="content-one-view">
			</view>
			<view class="content-one-text">{{ $t('search.rewarded') }}：{{item.money}}元</view>
			<!-- <view class="content-one-time">2020-10-28</view> -->
			<view class="content-two">
				<view>
					{{ $t('search.tireType') }}
				</view>
				<view>
					{{item.tireModel}}
				</view>
			</view>
			<view class="content-two">
				<view>
					{{ $t('search.tireCode') }}
				</view>
				<view>
					{{item.tyreNum}}
				</view>
			</view>
			<view class="content-two">
				<view>
					{{ $t('search.rewardType') }}
				</view>
				<view>
					{{item.getWay}}
				</view>
			</view>
			<view class="content-two">
				<view>
					{{ $t('search.time') }}
				</view>
				<view>
					{{item.createTime}}
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	import {
		request
	} from '../../../common/request/request'
	require("promise.prototype.finally").shim()
	export default {
		data() {
			return {
				datalist: [
					
				],
				input: '',
				keyword: ''
			}
		},
		methods: {
			data(e) {
				
				this.input = e
				
				request({
						url: '/myPage/getPageScanRewordList',
						method: 'post',
						data: {
							storeId:this.$store.state.storeInfo.storeId,
							userId:this.$store.state.storeInfo.userId,
							'current': '1',	
							'size': '10',
							'searchKey': this.input
						}
					}).then(res => {
						
						this.datalist = res.data.data
						// 判断扫码类型
						for (var i = 0; i < res.data.data.length; i++) {
							if (res.data.data[i].getWay == 0) {
								this.getWay = this.$t('search.scanCodeType1')
							} else {
								this.getWay = this.$t('search.scanCodeType2')
							}
						}
						
					}).catch(err => {
						
					})
					.finally(() => {
						setTimeout(() => {
							uni.hideLoading();
							this.loading = false;
						}, 1000)
				
					})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		margin-top: 30rpx;
	}
	.content-one {
		width: 690rpx;
		// height: 338rpx;
		background: #FFFFFF;
		box-shadow: 0px 0px 24px 0px rgba(101, 176, 249, 0.41);
		border-radius: 20px;
		margin: 0 auto;
		margin-top: 50rpx;
	}
	.content-one-view {
		width: 6rpx;
		height: 30rpx;
		background: #0292FD;
		position: relative;
		top: 20rpx;
		left: 30rpx;
	}
	.content-one-text {
		position: relative;
		top: -8rpx;
		left: 60rpx;
		font-size: 24rpx;
		font-weight: bold;
		color: #000;
	}
	.content-one-time {
		position: relative;
		top: -40rpx;
		left: 530rpx;
		font-size: 16rpx;
		color: #626262;
	}
	.content-two {
		font-size: 24rpx;
		color: #6A6A6A;
		display: flex;
		justify-content: space-between;
		width: 600rpx;
		margin: 0 auto;
	}
	
	.content-two>view:nth-child(2) {
		margin-bottom: 20rpx;
		
	}
</style>
