<template>
	<view class="bg-white">
		<picker class="" @change="PickerChange" mode="multiSelector" range-key="name" :value="index" :range="options1">
			<view class="text-xl">
				{{picker[index].name}}
				<text class="cuIcon-unfold lg text-gray margin-left-xs"></text>
			</view>
		</picker>
		<view class="margin-sm">
			<view v-for="(item,index) in mechanismList" :key="index" @click="xuanzephone(item)" class="padding bg-white margin-top-sm flex justify-between align-center"
			 style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
				<view class="">
					<view class="text-bold" style="color: #333333;font-size: 30rpx;">
						{{item.name}}
					</view>
					<view class="margin-top-sm" style="color: #999999; font-size: 26rpx;">
						地址：<text style="color: #666666;">{{item.address}}</text>
					</view>
					<view class="margin-top-sm" style="color: #999999; font-size: 26rpx;">
						距离：<text style="color: #666666;">{{parseInt(item.distance/1000)}}km</text>
					</view>
				</view>
				<view class="">
					<u-radio-group v-model="value">
						<u-radio @change="radioChange" :key="index" :name="item.id">
						</u-radio>
					</u-radio-group>
				</view>
			</view>
		</view>
		<view class="cu-tabbar-height"></view>
		<view class="cu-tabbar-height"></view>
	</view>
</template>

<script>
	export default {
		onLoad() {

		},
		onShow() {

		},
		mounted() {
			this.getMechanismList()
			this.getareaList()
		},
		data() {
			return {
				value: "",
				value1: 1,
				mechanismList: [],
				options1: [],
				pageindex: 1
			}
		},
		methods: {
			xuanzephone(item) {
				this.value = item.id
			},
			PickerChange(value) {
				this.value1 = value
			},
			getMechanismList: async function() {
				let res = await this.$request.post("/api/v1/organization/organizationList", {
					page: this.pageindex,
					latitude: uni.getStorageSync('latitude'),
					longitude: uni.getStorageSync('longitude')
				})
				console.log(res)
				if (res.status == 0) {
					this.mechanismList = res.data.data
				}
			},
			getareaList: async function() {
				let res = await this.$request.post("/api/v1/common/areaList")
				console.log(res)
				if (res.status == 0) {
					this.options1 = res.data
				}
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #fff;
	}
	.main {}
</style>
