<template>
<!--mine/refundType/refundType.wxml-->
<!-- <view class="list"> -->
	<!-- <view class="li" wx:for="{{products}}" wx:key="item" bindtap="toDetail" data-id="{{item.id}}">
		<view class="cimgs">
			<image src="{{item.pic}}" mode="aspectFit" class="cimg"></image>
			<image src="/pages/images/jishida.png" mode="aspectFit" class="type" wx:if="{{orderType == 5}}"></image>
			<image src="/pages/images/tuangou.png" mode="aspectFit" class="type" wx:if="{{orderType == 2}}"></image>
		</view>
		<view class="zhinfo">
			<view class="zhtit">{{item.title}}</view>
				<view wx:if="{{item.propertiesList}}" class="guigecontent">规格：
					<text wx:for="{{item.propertiesList}}" wx:for-item="itemGuige" class="guige" decode="{{true}}">{{itemGuige.value}}&nbsp;
					</text>
				</view>
			<view class="jiage">
				<view class="zhjia"><text class="money">￥</text><text class="size">{{item.salePrice}}</text></view>
				<view class="num">×{{item.quantity}}</view>
			</view>
		</view>
	</view>
</view> -->
  <view class="list1">
  	<view class="dpname">
		请选择售后类型
	  </view>
    <view class="li" @tap="state>=30?mes():toreturngoods()" 
	>
	<!-- v-if="(state>1&&state<=4&&canRefund)||(state >=20&&state <30&&isOtc=='1'&&canRefund) " -->
      <image src="/mine/static/mine/images/tui.png" class="image"></image>
      <view class="cont">
        <text>仅退款</text>
        <view class="color">未收到货，或已与卖家协商一致，仅退款无需退货</view>
      </view>
      <image src="/static/pages/images/more.png" class="right"></image>
	  </view>
    <view class="li" @tap="state>=30?mes():torefund()" v-if="(state>2&&state<=7)||stateName=='部分发货'">
      <image src="/mine/static/mine/images/tuihuo.png" class="image"></image>
      <view class="cont">
        <text>退货退款</text>
        <view class="color">已收到货，需要退换收到的货物</view>
      </view>
      <image src="/static/pages/images/more.png" class="right"></image>
	  </view>
    <!-- <view class="li">
      <image src="/mine/images/huan.png" class="image"></image>
      <view class="cont">
        <text>我要换货</text>
        <view class="color">已收到货，需要更换已收到的货物</view>
      </view>
      <image src="/pages/images/more.png" class="right"></image>
	  </view> -->
  </view>
</template>

<script>
// mine/refundType/refundType.js
const app = getApp();
const req = require("../../../utils/request.js");
// state : 1 未付款 2 待确认 3 待发货 4 待提货 5 配送中 6 已签收 7 订单完成 
//         8 订单取消 9 退货中 10 完成退货 11 支付失败 15 进行中
// 		售后状态 
// 	    30 售后待审核 32 售后审核失败 35 商品待退回 36 商品退回中 
// 		39 退款申请 40 退款待支付 41 退款中 42 退款失败 
// 		43 退款成功 
// 		处方订单 
// 		20 未开方 21 开方中 22 开方失败 25 待审方 
// 		26 审方中 27 审方失败,  
// 		49 用户取消售后
export default {
  data() {
    return {
      ids: '',
      pageList: [],
      count: 0,
      money: 0,
      isRx: true
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let id = options.id;
    let that = this;
    that.query = options.id;
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    req.getRequest('/api/order/detail', {
      id: this.query
    }, data => {
      this.setData(data);

      // if (data.canRefund==false) {
      //   uni.navigateBack({
      //     delta: 1
      //   });
      // }
    });
  },
  methods: {
    torefund() {
      uni.redirectTo({
        url: '/mine/refund/applyRefund/applyRefund?id=' + this.query + '&isrefund=' + 2
      });
    },

    toreturngoods() {
		if(this.state == 5 || (this.stateName&&this.stateName.indexOf('部分发货') > -1)){
			req.msgConfirmText('快递已发出，如需退货请拒收，或申请退货退款','继续退款',res=>{
				this.toApplyRefund();
			})
		}else{
			this.toApplyRefund();
		}
    },
	
	toApplyRefund(){
		uni.redirectTo({
		  url: '/mine/refund/applyRefund/applyRefund?id=' + this.query + '&isrefund=' + 1
		});
	},

    mes() {
      req.msg("订单正在退款中");
    }

  }
};
</script>
<style>
@import "./refundType.css";
</style>