<template>
	<view class="mainBox">
		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" background-color="#157A2C" color="#fff"  title="公海客户" @clickLeft="back">
		</uni-nav-bar>
		<u-list @scrolltolower="scrolltolower">
			<contactList :btnList="btnList" ref="contactListRef"></contactList>

		</u-list>
		<view class="add" @click="add">
			<u-icon name="plus" color="#fff"></u-icon>
		</view>

	</view>
</template>

<script>
	import contactList from './contactList.vue'

	export default {
		components: {
			contactList
		},
		data() {
			return {

				treeList: [],
				btnList: [{
					name: '修改',
					apiName: '',
					btnType: 'primary',
					type: '1',
					pageUrl: '/pages/saleManage/contact/add',
					judge: [{
						key: 'assignStatus',
						value: [0]
					}],
				},{
					name: '详情',
					apiName: '',
					btnType: 'primary',
					type: '1',
					pageUrl: '/pages/saleManage/contact/components/drawer'
				},{
					name: '释放',
					apiName: 'setFree',
					btnType: 'warning ',
					type: '2',
					pageUrl: '',
					judge: [{
						key: 'assignStatus',
						value: [1]
					}],
				}, {
					name: '指派',
					apiName: 'assignModelShow',
					btnType: 'warning ',
					type: '2',
					pageUrl: '',
					judge: [{
						key: 'assignStatus',
						value: [0]
					}],
				}, {
					name: '删除',
					apiName: 'del',
					btnType: 'error',
					type: '2',
					pageUrl: '',
					judge: [{
						key: 'assignStatus',
						value: [0]
					}],
				}]
			}
		},

		async onLoad() {
			this.$nextTick(() => {
				this.$refs.contactListRef.getList({
					type: 1
				})
			})
		},

		methods: {
			add() {
				uni.navigateTo({
					url: '/pages/saleManage/contact/add'
				})
			},
			scrolltolower() {
				this.$refs.contactListRef.getList({
					type: 1
				})
			},
		}
	}
</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;
	}
</style>