<template>
	<view>
		<u-navbar title="商家信息" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
		<view class="company">该商品由以下商家提供</view>
		<view class="detail-description" v-for="(item,index) in merchantInfo" :key="index">
			<image :src="item" mode=""></image>
		</view>
	</view>
</template>

<script>
	import env from '../../config/env.js'
	import $http from '@/utils/request.js'
	export default {
		data() {
			return {
				merchantInfo: [],
				goodsId:'',
				data:[],
			}
		},
		onLoad(opthios) {
			this.goodsId = opthios.goodsId
		},
		onShow() {
			this.getDetail()
		},
		methods: {
			toGoodsDetail(){
				uni.navigateBack({})
			},
			getDetail(){
				uni.showLoading({
					title: '加载中'
				});
				$http.post('/api/v1/mp/user/exchange/goods/detail', {
					goodsId: this.goodsId,
					noToken: true
				}).then(res => {
					uni.hideLoading();
					if (res.code == 0) {
						let merchantInfos = res.data.merchantInfo.split(',')
						merchantInfos.forEach(item => {
							this.merchantInfo.push(env.filePublic + item + '?imageView2/2/w/750')
						})
					}
				}).catch(() => {
					uni.hideLoading();
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.company{
		margin: 20rpx 40rpx;
	}
	.detail-description {
		image {
			width: 100%;
		}
	}
</style>
