<template>
	<div>
		<el-dialog title="收货地址" :visible.sync="dialogVisible" width="500" height="400">
			<el-table :data="tableData" stripe border style="width: 99%;">
				<el-table-column label="操作">
					<template slot-scope="scope">
						<el-button size="mini" type="danger" @click="sendToParent(scope.row)">选择</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="address" label="收货地址" width="400" show-overflow-tooltip>
				</el-table-column>
			</el-table>
		</el-dialog>
	</div>
</template>

<script>
	import axios from '@/axios';

	export default {
		props: {

		},
		data() {
			return {
				tableData: [],
				currentPage: 1,
				totalRows: 0,
				pageSizes: [10, 20, 30, 40],
				pageSize: 10,
				query: '',
				isShow: false,
				dialogVisible: false,
					fId:'',
			};
		},
		methods: {
			getTableData() {
				var url = 'MaintCustomer/queryAddress.do'
				var param = {
					fId:this.fId
				}
				axios.get(url, param).then(response => {
					if (response.data.code == 0) {
						this.tableData = response.data.data
				
					} else {
						this.$message({
							type: 'error',
							message: '保存失败' + response.data.msg,
						});
					}
					this.loading = false
				});
			},
			// 修改每页行数
			handleSizeChange(val) {
				this.pageSize = val
				this.getTableData()
			},
			// 修改当前页事件
			handleCurrentChange(val) {
				this.currentPage = val
				this.getTableData()
			},
			sendToParent: function(row) {
				this.$emit('receviceFromChild', row);
				this.dialogVisible = false
			},
			show(fId) {
				this.fId = fId
				this.dialogVisible = true
				this.getTableData()
			},
			search() {
				this.currentPage = 1
				this.getTableData()
			}
		},
		mounted() {

		}
	}
</script>
