<template>
    <view class="">
        <!-- 使用标题栏 -->
        <status-nav :statusBackw="true" :statusTitle="true" :title-val="'申请售后'" :tabcolor="'#ffffff'"></status-nav>
        <view :style="{paddingTop:statusHNH+'px'}">
            <view class="bacb margin-s20 padding-s30 padding-zy20 padding-x40">
                <view class="margin-x20 fon24 color33">订单号：{{afterOrder.orderId}}</view>
                <view class="dis borbot padding-x30 ">
                    <image class="flexs goodsImg" :src="afterOrder.skuList[0].src" mode=""></image>
                    <view class="margin-z20 margin-y30 width100">
                        <view class="clips2 fon28">{{afterOrder.skuList[0].title}}</view>
                        <view class="fon24 color9 margin-s10">{{afterOrder.skuList[0].cate}}</view>
                    </view>
                    <view class="margin-z20 " style="text-align: right;">
                        <view class="fon24 bold">￥<text class="fon32">{{afterOrder.skuList[0].price}}</text>.0</view>
                        <view class="margin-s10" style="font-size: 30rpx;color: #6f6f6f;">共{{afterOrder.skuList[0].num}}件</view>
                    </view>
                </view>
                <view class="padding-s30 margin-x20">申请售后原因</view>
                <view style="background-color: #f6f6f6;padding: 20rpx;height: 230rpx;border-radius: 8rpx;">
                    <textarea v-model="content" style="background-color: #f6f6f6;width: 100%;font-size: 26rpx;height: 100%;" placeholder="请输入不想要的原因" />
                </view>
            </view>
            <view class="disbc">
                <button class="businessbtn" :disabled="disabled" @tap="submit">{{btncon}}</button>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                disabled:false,
                btncon:'提交',
                content:'',
				afterOrder:{},
				statusHNH:uni.getStorageSync('statusHNH')
            }
        },
		onUnload() {
			uni.removeStorageSync('afterOrder')
		},
        onLoad() {
			this.afterOrder = uni.getStorageSync('afterOrder')
        },
		onShow() {
			this.$toolAll.tools.guoq()
		},
        methods: {
			// 获取要申请售后的订单信息
			checkInfo(id){
				this.$requst.post('order/get-after-sale-list',{order_id:id}).then(res=>{
					// console.log('售后订单信息',res);
				},error=>{})
			},
            submit(){
                if(!this.content){
                    this.$toolAll.tools.showToast('请输入原因')
                } else {
					this.disabled = true
					this.btncon = '正在提交...'
					this.$requst.post('order/after-sale-apply',{order_id:this.afterOrder.id,description:this.content}).then(res=>{
						// console.log(res);
						if(res.code==0){
							this.btncon = '提交'
							this.$toolAll.tools.showToast('恭喜售后申请成功(*^▽^*)')
							setTimeout(function(){
								uni.navigateBack({delta:1})
							},1000)
						}
					},error=>{})
                }
            }
        }
    }
</script>

<style>
</style>
