<template>
	<view>
		<view class="banner" v-html="contract_info"></view>
		</view>
</template>

<script>
import adoptApi from '@/api/home/index.js';
export default {
	data() {
		return {
			primary:this.$theme.primary,
			contract_info: '',
			 settingFile:getApp().globalData.siteinfo,
		};
	},
	onLoad(options) {
		// type1 甲方 2，合同
		if (options.type == 1) {
			adoptApi.partydetail({ id: options.id }).then(res => {
				if (res.status == 200) {
					uni.setNavigationBarTitle({ title: res.data.contract_info.title });
					this.contract_info=res.data.contract_info.content.replace(/\<img src="/gi,`<img style='width:100%;display:block' src="${this.settingFile.root_rich_img}`);
				} else {
					this.$api.msg(res.msg);
				}
			});
		} else {  
			adoptApi
				.contract_tplinfo({
					contract_id: options.id ,
					goods_id:options.orderid,
				})
				.then(res => {
					if (res.status == 200) {
						uni.setNavigationBarTitle({ title: res.data.contract_info.title });
						this.contract_info = res.data.contract_info.replace(/\<img src="/gi,`<img style='width:100%' src="${this.settingFile.root_rich_img}`);
					} else {
						this.$api.msg(res.msg);
					}
				});
		}
	},
	methods: {}
};
</script>

<style>
.banner {
	padding: 0 25px;
	padding-top: 15px;
	line-height: 50rpx;
}
</style>
