<template>
	<!-- 发布成功 -->
	<view class="successRelease">
		<far-bottom></far-bottom>
		<!-- 头部背景图区域 -->
		<view class="successReleaseTitle" :style="{'background-image':' url('+imageRoot+'succesImg.png)'}">
			<view class="titleTips">
				<image :src="imgfixUrls + 'merchant/success.png'"/>
				<span>发布成功!</span>
			</view>
			<view class="tips">
				<span>完善信息或置顶、红包，可以大幅度提高信息传播效果哦！</span>
			</view>
			<view class="titleButton">
				<view  @click="goMyPost">
					<span>查看信息</span>
				</view>
				<view  @click="goPostRelease">
					<span>再发一条</span>
				</view>
			</view>
		</view>
		<!-- 头部背景图区域 -->
		
		<!-- 置顶选项 -->
		<view class="zdView" v-if="extension.set.is_openTop !== 0 && (CustomerService.payclose == 1 && platform == 'ios') || extension.list.length  == 0?false:true">
			<view class="zdViewTitle">
				<span>置顶信息，提高10倍曝光率！</span>
			</view>
			<scroll-view class="zdScroll" > 
				<view class="zdScrollPackage" >
					<view class="button" v-for="(item,index) in extension.list" @click="goPayment(item.day)">
						<span>置顶{{item.day}}天(收费{{item.price}}元)</span>
					</view>
				</view>
			</scroll-view>
		</view>
		<!-- 置顶选项 -->
		
		<!-- 红包选项 -->
		<view class="hbView" v-if="extension.set.is_openRed !== '0' && (CustomerService.payclose == 1 && platform == 'ios') || extension.red_list.length == 0?false:true">
			<view class="zdViewTitle">
				<span>红包推广，提高10倍曝光率！</span>
			</view>
			<scroll-view class="zdScroll">
				<view class="zdScrollPackage">
					<view class="button" v-for="(item,index) in extension.red_list" @click="goPayment1(item.num,item.red_price)">
						<span>{{item.num}}个红包{{item.red_price}}元</span>
					</view>
				</view>
			</scroll-view>
		</view>
		<!-- 红包选项 -->
		
		<view class="full">
			
		</view>
	</view>
</template>

<script>
import App from '@/common/js/app.js';

// #ifdef H5
import wxApi from '@/common/js/wxApi.js';
// #endif	
	
	export default {
		data() {
			return {
				extension:{},
				status:null,
				platform:'',
				CustomerService:{},
				id:null
			};
		},
		onLoad(e){
			let _this=this
			_this.status=e.status
			_this.id=e.id
			this.CustomerService = uni.getStorageSync('CustomerService');
			if(uni.getSystemInfoSync().system.indexOf('Android') === -1){
				console.log('我是iOS')
				this.platform ='ios';
			}else{
				console.log('我是安卓')
				this.platform = 'android';
			}
			this.init();
		},
		methods:{
			init(){
				let _this=this
				_this.getExtension()
			},
			// 发布成功后的扩展操作
			getExtension(){
				let _this=this
				let data={}
				App._post_form('&p=pocket&do=extension',data,res=>{
						_this.extension=res.data;
						console.log(_this.extension.set)
				})
			},
			goMyPost(){
				App.navigationTo({
					url:'pages/subPages/myPost/myPost'
				})
			},
			goPostRelease(){
				App.navigationTo({
					url:'pages/mainPages/sendInformation/sendInformation'
				})
			},
			goPayment(num){
				let _this=this
				let data={
					id:_this.id,
					num:num,
					payfor:2
				}
				App._post_form('&p=pocket&do=createOrder',data,res=>{
					App.navigationTo({
						url:'pages/mainPages/payment/payment?orderid='+res.data.orderid+'&plugin=pocket'
					})
				})
			},
			goPayment1(num,money){
				let _this=this
				let data={
					id:_this.id,
					num:num,
					money:money,
					payfor:3
				}
				App._post_form('&p=pocket&do=createOrder',data,res=>{
					App.navigationTo({
						url:'pages/mainPages/payment/payment?orderid='+res.data.orderid+'&plugin=pocket'
					})
				})
			}
		}
	}
</script>

<style lang="less" scoped>
.full{
	height: 140upx;
}	
.zdScrollPackage{
	padding: 0 30upx;
}	
.button{
	height: 105upx;
	border-bottom: 1upx solid rgba(238,238,238,1);
	>span{
		line-height: 105upx;
		font-size:28upx;
		lor:rgba(51,51,51,1);
	}
}	
.zdScroll{

}	
.zdViewTitle{
	border-bottom: 1upx solid rgba(238,238,238,1);
	height: 85upx;
	>span{
		padding-left: 30upx;
		line-height: 85upx;
		font-size:24upx;
		lor:rgba(153,153,153,1);
	}
}
.hbView{
	overflow: hidden;
	margin:20upx auto 0 auto;
	width:690upx;
	background:rgba(255,255,255,1);
	border-radius:20upx 20upx 0px 0px;
}	
.zdView{
	overflow: hidden;
	margin:-180upx auto 0 auto;
	width:690upx;
	background:rgba(255,255,255,1);
	border-radius:20upx 20upx 0px 0px;
}	
.titleButton{
	margin: 50upx 0 0 0;
	text-align:center;
	>view{
		margin:0 20upx;
		display: inline-block;
		width:200upx;
		height:70upx;
		border:1upx solid rgba(255,255,255,1);
		border-radius:35upx;
		text-align: center;
		>span{
			line-height: 70upx;
			font-size:28upx;
			color:rgba(255,255,255,1);
		}
	}
}	
.tips{
	margin: 20upx 0 0 0;
	text-align:center;
	>span{
		font-size:24upx;
		color:rgba(255,228,228,1);
	}
}	
.successRelease{
	font-size: 0;
	background: #F8F8F8;
}
page{
	overflow-x: hidden;
	background: #F8F8F8;
}
.successReleaseTitle{
	border: 1upx solid rgba(0,0,0,0);
	width:750upx;
	height:562upx;
	background-size: 100%;
	background-repeat:no-repeat ;
}
.titleTips{
	
	margin: 90upx 0 0 0;
	text-align:center;
	>image{
		vertical-align: middle;
		width:50upx;
		height: 50upx;
	}
	>span{
		margin-left: 10upx;
		vertical-align: middle;
		font-size:42upx;
		color:rgba(255,255,255,1);
	}
}
</style>
