<template>
	<view>
		<view class="cu-bar search  bg-white">
			<view class="search-form round " >
				<text class="cuIcon-search"></text>
				<input v-model="keyword" :adjust-position="false" type="text" placeholder="搜索平台名称" confirm-type="search"></input>
			</view>
			<view class="action" @click="search">
				<text class="text-bold">搜索</text>
			</view>
		</view>
		
		<view class="card" v-for="(item,index) in list" :key="index">
			<view class="left">
				<image :src="item.icon" mode=""></image>
				<view class="">
					<text>{{item.name}}</text>
				</view>
			</view>
			
			<view class="right">
				<image src="../../static/icon/points-value.png" mode=""></image>
				<text class="data">{{item.value}}</text>
				<text class="value">（价值￥{{item.value / 100}}）</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword:'',
				list:[]
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList(){
				this.list=[
					{
						icon:'/pagesA/static/platform/yidong.png',
						name:'中国移动',
						value:this.$u.random(100, 2000)
					},
					{
						icon:'/pagesA/static/platform/liantong.png',
						name:'中国联通',
						value:this.$u.random(100, 2000)
					},
					{
						icon:'/pagesA/static/platform/dianxin.png',
						name:'中国电信',
						value:this.$u.random(100, 2000)
					},
					{
						icon:'/pagesA/static/platform/gongshang.png',
						name:'中国工商银行',
						value:this.$u.random(100, 2000)
					},
					{
						icon:'/pagesA/static/platform/guangfa.png',
						name:'广发银行',
						value:this.$u.random(100, 2000)
					}
				]
				this.list=this.$u.randomArray(this.list)
			},
			search(){
				if (this.$isNotEmpty(this.keyword)) {
					this.list=this.list.filter(item=>item.name.indexOf(this.keyword)>0)
				}else{
					this.getList()
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.card{
		margin: 20rpx;
		border-radius: 20rpx;
		padding:36rpx 30rpx;
		background-color: #FFFFFF;
		display: flex;
		justify-content: space-between;
		
		.left{
			display: flex;
			image{
				flex: 1;
				width: 60rpx;
				height: 60rpx;
			}
			
			view{
				display: flex;
				justify-content: center;
				align-items: center;
				text{
					padding-left: 20rpx;
					font-weight: 800;
					font-size: 30rpx;
				}
			}
			
			
		}
		
		.right{
			display: flex;
			justify-content: center;
			align-items: center;
			image{
				width: 40rpx;
				height: 40rpx;
			}
			
			.data{
				margin-left: 10rpx;
				font-size: 32rpx;
				color: #F39248;
			}
			.value{
				font-size: 28rpx;
				color: #666666;
			}
		}
	}
</style>
