<template>
	<!-- 选择门店 -->
	<view>
		<u-navbar border title="选择门店" autoBack placeholder></u-navbar>
		<tree-item v-for="item in treeData" :key="item.id" :item="item" @confirm="confirm"></tree-item>
	</view>
</template>

<script>
	import TreeItem from '@/components/TreeItem.vue';
	export default {
		components: {
			TreeItem
		},
		data() {
			return {
				treeData: [],
				navTitle: '',
				selectiveType: '',
			}
		},
		onLoad(receive) {
			this.navTitle = receive.title
			this.selectiveType = receive.id
			this.getList()
		},
		methods: {
			getList() {
				this.$api.get('/api/store/all').then(res => {
					if (res.code == 200) {
						this.treeData = res.data
						console.log(this.treeData,25)
					}
				})
			},
			// 选择门店
			confirm(cmpCode) {
				console.log(cmpCode,666)
				uni.navigateTo({
					url: '/pages/order/delivery?id=' + this.selectiveType + '&title=' + this.navTitle +
						'&cmpCode=' + cmpCode
				});
			}
		}
	}
</script>

<style lang="scss">
</style>