<template>
	<view v-if="isrefash">
		<view class="cart-list">
		   <view style="padding: 0 36upx;line-height: 70upx;border-bottom: 14upx solid #F5F5F5;">
			   <span v-if="detail.status == 1">待处理</span>
			   <span v-if="detail.status == 2">已退款 </span>
			   <span v-if="detail.status == 3">退款失败</span>
		   </view>  
		   <view style="padding: 30upx 36upx 15upx 36upx;border-bottom: 1px solid #F5F5F5;">
			   <image :src="pictureUrl+'/uploads/home/store/'+store.store_id+'/'+store.store_avatar" style="border-radius: 50%;
			   width: 50upx;height: 50upx;vertical-align: middle;"></image>
			  <span style="padding-left: 16upx;">{{store.store_name}}</span>
		   </view>
				  <view>
					  <van-card
						title-class="changewidth"
						price-class ="priceClass"
						:price="detail.goods_price"
						:desc="detail.descire"
						:title="detail.desarray"
						:thumb="pictureUrl + '/uploads/home/store/goods/'+detail.goods_image.substr(0, detail.goods_image.indexOf('\_')) + '/' + detail.goods_image"
					  >
					  </van-card>
				  </view>
		 <view class="topTip">
			  <view style="font-size: 28upx;">合计：{{detail.goods_price}}</view>
		 </view>
		 <view style="padding: 15upx 36upx;">订单编号:<text class="orderCode">{{detail.order_sn}}</text></view>
		 <view style="padding: 15upx 36upx;">快递单号:<text class="orderCode">{{detail.goods_price}}</text></view>
		 <view class="adressbottom">
		 	<view>申请时间: <text  style="font-weight: bold;" class="time">{{detail.create_time}}</text></view>
			<view>原因: <text  style="font-weight: bold;" class="time">{{detail.refund_remark}}</text></view> 
		 </view>   
	</view>
	</view>
</template>

<script>
	import TextArea from '@/component/textarea.vue'
	import uploadImage from '@/component/uploadImage.vue'
	export default {
		components: {
			TextArea,
			uploadImage
		},
		data() {
			return {
				id: 0,
				isrefash: false,
				detail: null,
				store: null,
				store_id:　1,
				pictureUrl: this.pictureUrl,
			}
		},
		onLoad(e) {
			console.log(this.detail);
			this.id = e.id;
			this.submitRemin();
		},
		methods: {
		
			submitRemin() {
				this.request({
					url: '/v3/order/refund_info',
					method: 'get',
					data: {
						id: this.id
					},
					success: (res) => {
						let { data } = res.data;
						let arr = data.goods_name.split(' ');
						data.desarray = arr[0];
						data.descire = data.goods_name.replace(arr[0], '');
						this.detail = data;
						this.store_id = data.store_id;
						this.getstore();
					}
				})
			},
			getstore() {
				this.request({
					url: '/v1/store/info',
					method: 'post',
					data: {
						store_id:　this.store_id
					},
					success: (res) => {
						let { data } = res.data;
						this.store = data;
						this.isrefash = true;
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.topTip {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		padding: 20upx 36upx;
	}
	.van-card {
		background-color: #fff!important;
	}
	.adressbottom {
		padding: 0 36upx;
		color: #606266;
		border-top: 16upx solid #F5F5F5;
		padding-bottom: 32upx;
		margin-bottom: 100upx;
		view {
			padding: 32upx 0 0 0;
		}
			
		.time {
			padding-left: 16upx;
		}
	}
</style>
