<template>
	<view class="page">
		<navBar title="城市展厅" :back="true" color="black" background="white" />

		<view class="content">
			<view class="cartDef" style="" v-for="(item,index) in bannerList1">
				<!-- background:' url('+picBase+item.cover+') no-repeat;' -->
				<image :src="picBase+item.logo" mode=""
					style="width: 104rpx;height: 104rpx;margin-top: 64rpx;border-radius: 50%;">
				</image>
				<view class="companyName">
					吉格斯
				</view>
				<view class="connect">
					<image src="@/static/index/dianhua.png" mode=""
						style="width: 30rpx;height: 30rpx;display: inline-block;"></image>
					<view class="txt">
						联系电话
					</view>
				</view>

				<view class="connectDes">
					<view class="num">
						{{item.phone}}
					</view>
					<view class="callBtn" @click="call(item.phone)">
						拨号
					</view>
				</view>

				<view class="addr">
					<image src="@/static/index/weizhi.png" mode=""
						style="width: 24rpx;height: 32rpx;display: inline-block;"></image>
					<view class="txt">
						{{item.company}}
					</view>
				</view>

				<view class="addrInfo">
					<view class="txt">
						{{item.address}}
					</view>
					<image @click="daohang(item)" src="@/static/index/daohang.png" mode=""
						style="width: 36rpx;height: 36rpx;display: inline-block;"></image>
				</view>

			</view>
		</view>
		<u-loadmore style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />

		<u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
	</view>
</template>

<script>
	import {
		getAddressDataReq,
	} from '@/api/index/index.js'
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				bannerList1: [],

				loading: true
			}
		},
		async onLoad(options) {
			let res1 = await getAddressDataReq()
			if (res1.code == 0) {
				this.bannerList1 = res1.data
				this.loading = false
				console.log('地址轮播图数据-列表页', this.bannerList1);
			} else {
				this.loading = false
				this.$toast(res1.message)
			}

		},
		methods: {
			call(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
				})
			},
			daohang(item) {
				console.log('item', item, {
					name: item.company,
					address: item.address,
					latitude: item.latitude,
					longitude: item.longitude,
				});
				uni.openLocation({
					name: item.company,
					address: item.address,
					latitude: Number(item.latitude),
					longitude: Number(item.longitude),
					success: function() {
						console.log('success');
					}
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>