<template>
	<view class="pages">
		<web-view :src="certificateUrl
		+'credentialNo='+item.credentialNo
		+'&customerName='+item.customerName
		+'&year='+item.year
		+'&carbonAmount='+item.carbonAmount
		+'&orderAmount='+item.orderAmount
		+'&buyDate='+item.buyDate
		+'&nickName='+item.nickName
		+'&companyName='+item.companyName
		+'&isH5=1'
		">
		</web-view>
	</view>
</template>

<script>
	export default {
		components:{
			
		},
		data() {
			return {
				$getimg:this.$getimg,
				certificateUrl:this.config.certificateUrl,
				thetoken:'',
				orderid:'',
				item:[],
				path:'',
				params:{},
			}
		},
		onShow() {
		
		},
		onLoad(e) {
			console.log('config',this.config);
			this.thetoken = 'Bearer' + ' ' + this.$store.state.token;
			this.orderid = e.orderid;
			uni.showLoading({
				title: '正在获取证书信息'
			});
			this.$api.http.get(this.config.apiBaseurl + '/carbon-h5/wap/order/getCredentialByOrderId?orderId='+this.orderid,{
				header: {
				Accept:'application/json',
				Authorization: this.thetoken, 
			},
			}).then(res => {
				uni.hideLoading();
				// this.info = Object.assign(this.info, data);
				// this.info.url = '/static/html2canvas/index.html?key=' + this.orderid;
				this.item = res.data.retBody;
				console.log('this.base.views',this.base.views);
				this.base.views[1].text = `证书编号:${res.data.retBody.credentialNo}`;
				this.base.views[2].text = `尊敬的 ${res.data.retBody.customerName}:`;
				this.base.views[3].text = `感谢您对“碳汇+”生态产品价值实现的支持，您购买了 ${res.data.retBody.year}年度碳汇量${res.data.retBody.carbonAmount}kg，您购碳资金${res.data.retBody.orderAmount}元，已全额转入${res.data.retBody.farmerName}的银行账户。`;
				console.log('res',JSON.parse(JSON.stringify(res.data.retBody)));
			}).catch(err =>{
				console.log('err',err)
			});

		},
		methods: {

		}
	}
</script>

<style>
	@import url("./certificate.css");
</style>
