<template>
	<view class="container">
		<uni-section :title="merchant.name" type="line">
			<uni-card padding="0" spacing="0">
				<uni-list>
					<uni-list-item :title="merchantType"></uni-list-item>
					<uni-list-item :title="merchantCommunity"></uni-list-item>
					<uni-list-item :title="merchantTel"></uni-list-item>
					<uni-list-item :title="merchantAddress"></uni-list-item>
					<uni-list-item :title="merchantContact"></uni-list-item>
				</uni-list>
			</uni-card>
		</uni-section>
	</view>
</template>

<script>
	import request from '../../api/merchant.js';
	import { BASE_URL } from '../../env.js';
	export default {
		components: {},
		onLoad: function (option) {
			this.merchantId = option.id;
		},
		data() {
			return {
				merchantId: '',
				merchant: {},
			}
		},
		async mounted() {
			const resp = await request.getMerchantInfo({ merchantId: this.merchantId});
			this.merchant = resp.data;

			if(this.merchant.address == null) this.merchant.address = "";
			if(this.merchant.contact == null) this.merchant.contact = "";
			if(this.merchant.tel == null) this.merchant.tel = "";
		},
		computed:{
			merchantType(){return "类型: "+ this.merchant.type;},
			merchantCommunity(){return "社区:" + this.merchant.affiliatedCommunity;},
			merchantTel(){return "电话:" + this.merchant.tel;},
			merchantAddress(){return "地址:" + this.merchant.address;},
			merchantContact(){return "联系人:" + this.merchant.contact;}
		},
		methods: {

		}
	}
</script>

<style>
</style>