<template>
	<view class="mainBox">
		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="跟进记录"
			@clickLeft="back">
		</uni-nav-bar>

		<followList ref="followListRef" :linkList="linkList" pageName="businessOpportunity">
		</followList>
	
	</view>
</template>

<script>
	import followList from "@/pages/saleManage/contact/components/followList.vue"
	import {
		contactDetail,
	} from '@/api/saleManage/contact/index.js'
	import {
		getfollowList,
		savefollowList,
		getDetail
	} from '@/api/saleManage/businessOpportunity/index.js'
	export default {
		components: {
			followList,
		},

		data() {
			return {
				linkList: []
			}
		},
		computed: {

		},


		onLoad(data) {
			uni.$off('savefollowList')
			uni.$on('savefollowList', (item) => {
				item.contactId=this.form.contactId
				item.opportunityId=this.form.id
			
				savefollowList(item)
			})
			getDetail(data.id).then(async res => {
				this.form = res
				const {
					linkList
				} = await contactDetail(res.contactId)
				const followList = await getfollowList({
					pageNum: 1,
					size: 1000,
					opportunityId: res.id,
				})
				this.linkList = linkList
				this.$nextTick(() => {
					this.$refs.followListRef.init(followList.list)

				})




			})
		},
		onUnload() {
			uni.$off('savefollowList')
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.add {
		width: 96rpx;
		height: 96rpx;
		border-radius: 48rpx;
		background: #3c9cff;
		position: fixed;
		bottom: 100rpx;
		right: 24rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.top-wrapper {
		background-color: #fff;
		display: flex;
		width: 750rpx;
		height: 88rpx;
		padding: 16rpx 32rpx;
		align-items: center;
		gap: 16rpx;

		/deep/.uni-section {
			margin-top: 0px;
		}

		/deep/.uni-section-header {
			padding: 0px;

		}

		.search_btn {
			width: 120rpx;
			height: 70rpx;
			line-height: 70rpx;
			padding: 0 24rpx;
			background: $theme-color;
			font-size: 32rpx;
			color: #fff;
			margin: 0;
			margin-left: 26rpx;
		}

		.menu_icon {
			width: 44rpx;
			height: 44rpx;
			margin-left: 14rpx;
		}
	}
</style>