<template>
	<view>
		<view class="cart-list">
		   <view style="padding: 0 36upx;line-height: 70upx;border-bottom: 14upx solid #F5F5F5;">
			   <span>{{detail.statusremak}}</span>
		   </view>  
		   <view style="padding: 30upx 36upx 15upx 36upx;border-bottom: 1px solid #F5F5F5;">
			   <image :src="pictureUrl+'/uploads/home/store/'+detail.store_id+'/'+detail.store_avatar" style="border-radius: 50%;
			   width: 50upx;height: 50upx;vertical-align: middle;"></image>
			  <span style="padding-left: 16upx;">{{detail.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: 0upx 32upx;">
			 <TextArea ref="getValue" :tips="tips" @submitValue="submitValue"/>
			 <uploadImage @getImg="getImg" />	
			 <view style="margin-top: 20upx;" class="submitRemin" @click="submitRemin">提交</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,
				pictureUrl: this.pictureUrl,
				detail:　{},
				tips:"退款内容不能少于五个字",
				remark:'',
				images:''
			}
		},
		onLoad(e) {
			this.detail = JSON.parse(e.id);
		},
		methods: {
			submitValue(e) {
				this.remark = e.detail.value;
				
			},
			getImg(e) {
				this.images = e;
			},
			submitRemin() {
				if(this.remark == '') {
					this.$msg("退款内容不能为空");
					return;
					
				}else if(this.remark.length < 5) {
						this.$msg("退款理由不能少于5个字");
						return;
				}
				this.request({
					url: '/v3/Order/refund',
					method:'post',
					data: {
						images: this.images,
						remark:this.remark,
						order_id: this.detail.order_id,
						goods_id: this.detail.goods_id		
					},
					success: (res) => {
						if(res.data.data.code == 1000) {
							this.$msg("申请退款成功")
						}
						uni.$emit('refshlist'); // 刷新订单详情
						uni.navigateBack();
					}
				})
			}
		}
	}
</script>

<style>
	.topTip {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		padding: 20upx 36upx;
	}
	.van-card {
		background-color: #fff!important;
	}
</style>
