<template>
	<view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
		<tm-menubars title="消息列表" :shadow="0" :showback="true"></tm-menubars>
		<div class="dizhi">
			<view class="contdz pt-20" v-for="item in addList" :key="item.id">
				<view>
					<text> {{item.name}}</text>
					<text class="ml-40 text-gray text-size-m">{{item.mobile}}</text>
					<tm-button class="ml-50" :round="10" theme="gray" size="s">{{item.label}}</tm-button>
				</view>
				<view class="text-gray text-size-s mt-15">
					<text>{{item.region}} {{item.address}}</text>
					<image class="fr xiugai" src="/static/img/109.png" mode="widthFix" @click="goRedact(item)"></image>
				</view>
			</view>
		</div>
		<tm-button :round="24" class="sao mb-40 mt-40" block @click="xinjian">新建收获地址</tm-button>
		<!-- 弹出层消息 -->
		<tm-message ref="toast"></tm-message>
	</view>
</template>
<script>
	import {
		myRequest
	} from '@/api/request.js'
	export default {
		data() {
			return {
				checked1: false,
				checked2: false,
				checked3: false,
				beizu: '',
				addList: []
			};
		},
		onLoad() {

		},
		created() {
			var that = this;
			setTimeout(function() {
				if (uni.getStorageSync("token") == "") {
					uni.redirectTo({
						url: "/pages/login/index"
					})
				}
			}, 1000)
			this.sys = uni.getSystemInfoSync();
			this.getAddList();
		},
		methods: {
			xinjian() {
				uni.navigateTo({
					url: "/pages/shouhuodi/index",
				})
			},
			// 获取地址列表
			getAddList() {
				let that = this;
				myRequest({
					url: '/api/Address/addressList',
					method: 'get',
					data: that.reqData
				}).then(res => {
					console.log(res.data);
					if (res.data.code == 200) {
						that.addList = res.data.data;
					} else {
						that.$refs.toast.show({
							model: 'error',
							label: res.data.msg
						})
					}
				})
			},

			// 编辑地址
			goRedact(item) {
				uni.navigateTo({
					// url: '/pages/shouhuodi/index?data='+data
					url: '/pages/shouhuodi/index?id='+item.id
				})
			}
		},
	}
</script>

<style lang="scss">
	/deep/ .tm-menubars .body {
		background-color: #1b1b1b !important;
	}

	/deep/ .zhuti {
		padding: 10px 10px;
	}

	/deep/ .kuang {
		margin: 0 !important;
		padding: 0px !important;
	}

	.sao {
		width: 88%;
		margin: 0 auto;
		margin-top: 30px;
	}

	.dizhi {
		background: #1B1B1B;
	}

	.xiugai {
		width: 18px;
		height: 18px;
	}

	.contdz {
		width: 90%;
		margin: 0 auto;
		border-bottom: 1px solid #303030;
		padding-bottom: 15px;
	}
</style>
