<template>
	<view class="page">
		<!-- 搜索 -->
		<view class="head-search">
			<view class="search">
			<!-- 	<view class="icon">
					<image src="/static/search.png" mode=""></image>
				</view>
				<view class="hint">
					<text class="min">请输入关键词</text>
					<text class="max">搜索</text>
				</view> -->
				<u-search placeholder="请输入" v-model="keyword" @search="sousu" @custom="sousu"></u-search>
			</view>
		</view>
		<view class="screen-list">
			<view class="list" @click="setList(0)">
				<text>类型</text>
				<image :src="$imgUrl('/down.png')"></image>
			</view>
			<view class="list" @click="setList(1)">
				<text>租金</text>
				<image :src="$imgUrl('/down.png')"></image>
			</view>
			<!-- <view class="list">
				<text>默认排序</text>
				<image src="../../static/down.png"></image>
			</view> -->
			<view class="list" @click="setList(2)">
				<text>筛选</text>
				<image :src="$imgUrl('/down.png')"></image>
			</view>
			<u-select v-model="show" :list="companys" @confirm="handleCompanyConfirm" mini borderless></u-select>
		</view>
		<!-- 订单列表 -->
		<view class="goods-data">
			<view class="goods-list">
				<view class="list" v-for="(item,index) in tableData" :key="index">
					<view class="thumb">
						<image :src="item.locationDiagram" mode="widthFix"></image>
					</view>
					<view class="item">
						<view class="title">
							<text class="one-omit">{{item.advertisingName}}</text>
						</view>
						<view>
							<view class="goods-list-text">
								<view class="goods-list-txt">轮播顺序：<text>{{item.rotationOrder}}</text></view>
								<view class="goods-list-txt">所属移动端：<text>{{item.affiliation}}</text></view>
							</view>
							<view class="goods-list-text">
								<view class="goods-list-txt">投放定价：<text>100元/天</text></view>
								<view class="goods-list-txt">历史平均点击率：<text>80%</text></view>
							</view>
							<view class="goods-list-text">
								<view class="goods-list-txt">高频时段：<text>18:00 - 20:00</text></view>
								<view class="goods-list-txt">单次可租赁时间：<text>1天</text></view>
							</view>
						</view>
						<view>
							<view @click="advertisementTime" class="goods-btn">可租赁时段
							<image  :src="$imgUrl('/right1.png')"></image></view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tableData: [],
				pageindex: {
				  pageNumber: 1,
				  pageSize: 10,
				  advertisingType:'线上广告位'
				},
				keyword:'',
				show:false,
				companys:[
					{
						value: '1',
						label: '线上广告位'
					},
					{
						value: '2',
						label: '线下广告位'
					}
				]
			};
		},
		mounted() {
		this.getAll()
		  },
		methods: {
			advertisementTime() {
				uni.navigateTo({
					url: '/pages/advertisementTime/advertisementTime'
				})
			},
			//查询全数据
				 getAll() {
					
				     this.$http.sendRequest('/cereAdvertisingInformation/likeGet', 'POST', this.pageindex,1).then(res => {
				     	//成功回调
						this.tableData = res.data.data.content
				     	console.log(res.data.data.content)
				     }).catch(err => {
				     	console.log(err)
				     	//请求失败
				     })
			},
			setList(val){
				console.log(val)
				if(val == 0){
					this.companys=[
					{
						value: '1',
						label: '线上广告位'
					},
					{
						value: '2',
						label: '线下广告位'
					}
				]
				}else if(val ==1){
					this.companys = []
				}else if(val ==2){
					this.companys = []
				}
				
				this.show = true
			},
			handleCompanyConfirm(val){
				console.log(val)
				
				let page = {
					pageNumber: 1,
					pageSize: 10,
					advertisingType:val[0].label
				}
				this.$http.sendRequest('/cereAdvertisingInformation/likeGet', 'POST', page, 1).then(res => {
					//成功回调
					this.tableData = res.data.data.content
				})
			},
			sousu(){
				if(this.keyword != ''){
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'advertisement.scss';
</style>
