<template>
	<view class="page">
		<!-- 搜索 -->
		<!-- <view class="head-search">
			<view class="search">
					<input class="uni-input"  placeholder="请输入关键词" />
				<view class="icon">
					<image :src="$imgUrl('/search.png')"  ></image>
				</view>
				
			</view>
		</view> -->
		<!-- 创建按钮 -->
		<!-- <view class="page-footer" @click="createWen">
		  <view class="footer-buy">
		    <view class="cart-add">
		      <text>创建活动</text>
		    </view>
		  </view>
		</view> -->
		
		<view class="screen-list">
			<view style="margin-right:20px;" :class="listIn == index ?'color':''" @click="sel(item.state,index)" v-for="(item,index) in shenlist">{{item.title}}</view>
		</view>
		<!-- 订单列表 -->
		<view class="goods-data">
			<view class="goods-list">
				<view  class="goods-border" v-for="(item,index) in tableData" :key="index">
					<view class="list ">
						<view class="thumb">
							<image :src="$img+item.coverImage || $imgUrl('/img/2.jpg')" mode=""></image>
						</view>
						<view class="item">
							<view class="">
								<text class="one-omit">宣传标题：{{item.schemeTitle}}</text>
							</view>
							<view class="title">
								<text class="one-omit color">创建人：{{item.createUser}}</text>
							</view>
							<view class="title">
								<text class="one-omit color">创建时间：{{item.createDate}}</text>
							</view>
							<view class="title">
								<text class="one-omit color">审核状态： {{item.state == '1'?'待提交':item.state == '2'?'待审批':item.state == '5'?'审核通过':'已驳回'}}</text>
							</view>
						</view>
					</view>
				<view class="canyu">
					<view class="xq"  @click="godetle(item.id)">查看详情</view>
					<view class="tij" @click="tijiao(item.id)" v-if="item.state =='1'">提交审核</view>
					<!-- <view class="bj" @click="edit(item)">编辑</view> -->
					<view class="close" @click="del(item.id)" v-if="item.state == '1'">删除</view>
				</view>
				</view>
			
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shenlist:[{
					state:'0',
					title:'全部'
				},
				{
					state:'2',
					title:'待审核'
				}],
				listIn:0,
				tableData:[],
				pageindex: {
					pageNumber: 0,
					pageSize: 10,
					createUser:'',
					schemeTitle:''
				},
			};
		},
		mounted(){
			this.getALL()
		},
		methods: {
			getALL(){
				this.pageindex.createUser =uni.getStorageSync('user').phone
				this.$http.sendRequest('/cerePromotion/queryByPage', 'POST', this.pageindex,1).then(res => {
					//成功回调
					this.tableData = res.data.data.content
				})
			},
			sel(val,index){
				console.log(val)
				this.listIn = index 
				if(val=='0'){
					this.pageindex={
					pageNumber: 0,
					pageSize: 10,
					createUser:''
					}
				}else{
					this.pageindex.state = val
				}
				this.getALL()
			},
			reconciliationdetail() {
	
			},
			del(ids){
				this.$http.sendRequest('/cerePromotion/deleteById', 'POST', {id:ids},1).then(res => {
					//成功回调
					this.getALL()
				})
			},
			edit(item){
				let val = JSON.stringify(item)
				uni.navigateTo({
					url:`/pagesA/application/application?item=${val}`
				})
			},
			tijiao(ids){
				this.$http.sendRequest('/cerePromotion/editPromotionPlanning', 'POST', {id:ids,state:'2'},1).then(res => {
					//成功回调
					this.getALL()
				})
			},
			godetle(id){
				uni.navigateTo({
					url:`/pagesA/projectManagement/projectDetails?id=${id}`
				})
			},
			
		}
	}
</script>

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