<!-- 退款详情 -->
<!--pages/DetailsOfRefund/DetailsOfRefund.wxml-->

<view class="page">
  <!-- 头部状态 -->
  <view class="describe-box">
    <!-- 申请行进流程 -->
    <view class="process">
      <!-- 提交申请 -->
      <view class="current-process" wx:if="{{returnMoneySts == 1}}">退款申请待商家处理</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 1}}">
        你已成功发起退款申请，等待商家处理
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 1}}">
        {{updateTime}}
      </view>
      <!-- 商家拒绝 -->
      <view class="current-process" wx:if="{{returnMoneySts == 7}}">商家不同意退款申请</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 7}}">
        你可以修改退款申请
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 7}}">
        {{updateTime}}
      </view>
      <!-- 商家同意退款 -->
      <view class="current-process" wx:if="{{returnMoneySts == 2}}">商家同意退款</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 2 && applyType == 1}}">
        商家已同意，等待系统退款
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 2 && applyType == 2}}">
        商家已同意，请按照商家给出的退货地址寄回商品
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 2}}">
        {{updateTime}}
      </view>
      <!-- 寄出商品（退货退款情况下） -->
      <view class="current-process" wx:if="{{returnMoneySts == 3}}">等待商家确认收货并退款</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 3}}">
        你已退货，商家将在收货后尽快处理
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 3}}">
        {{updateTime}}
      </view>
      <!-- 商家确认收货 -->
      <view class="current-process" wx:if="{{returnMoneySts == 4}}">商家确认收货</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 4}}">
        商家已确认收货，等待系统退款
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 4}}">
        {{updateTime}}
      </view>
      <!-- 退款成功 -->
      <view class="current-process" wx:if="{{returnMoneySts == 5}}">退款成功</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 5}}">
        {{refundTime}}
      </view>
      <!-- 退款申请关闭 -->
      <view class="current-process" wx:if="{{returnMoneySts == -1}}">退款申请关闭</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == -1}}">
        <!-- 由于你超时未处理，系统已关闭本次退款申请 -->
        {{rejectMessage?rejectMessage:''}}
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == -1}}">
        {{updateTime}}
      </view>
      <!-- 买家撤回申请 -->
      <view class="current-process" wx:if="{{returnMoneySts == 6}}">申请已撤回</view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 6}}">
        你已撤回本次退款申请
      </view>
      <view class="acount-for-process" wx:if="{{returnMoneySts == 6}}">
        {{updateTime}}
      </view>
      <!-- 隐藏内容（仅退款） -->
      <view class="{{showView?'display':'more-content'}}" wx:if="{{returnMoneySts == 1}}">
        <view class="cont">如果商家同意，申请将达成并退款给你</view>
        <view class="cont">如果商家拒绝，你可以修改退款申请重新尝试</view>
        <!-- <view class="cont">如果商家逾期未处理，退款申请将自动达成并退款给你</view> -->
      </view>
      <!-- 隐藏内容（退货退款申请商品未寄出） -->
      <view class="{{showView?'display':'more-content'}}" wx:if="{{returnMoneySts == 2}}">
        <view class="cont">如果商家同意，请按照给出的退货地址退货</view>
        <view class="cont">如果商家拒绝，你可以修改退款申请重新尝试</view>
        <!-- <view class="cont">如果商家逾期未处理，请按照系统给出的退货地址退货</view> -->
      </view>
      <!-- 隐藏内容（退货退款并已寄出货物） -->
      <view class="{{showView?'display':'more-content'}}" wx:if="{{returnMoneySts == 3}}">
        <view class="cont">如果商家确认收货，申请将达成并退款给你</view>
        <view class="cont">如果商家拒绝收货，你可以修改退货物流信息重新尝试</view>
        <!-- <view class="cont">如果商家逾期未处理，系统将自动确认收货并退款给你</view> -->
      </view>
    </view>
    <!-- 申请行进流程end -->

    <!-- 更多说明 -->
    <view class="{{showView?'more-instructions':'display'}}" bindtap="onChangeShowState" wx:if="{{returnMoneySts < 4 && returnMoneySts !== -1 && applyType == 2}}">
      <text class="more-txt">更多说明</text>
      <view class="down-arrow-icon">
        <image src="../../images/icon/down-arrow.png"></image>
      </view>
    </view>
    <!-- 收起 -->
    <view class="{{showView?'display':'more-instructions'}}" bindtap="onChangeShowState" wx:if="{{returnMoneySts < 4 && returnMoneySts !== -1 && applyType == 2}}">
      <text class="more-txt">收起</text>
      <view class="down-arrow-icon">
        <image src="../../images/icon/up-arrow.png"></image>
      </view>
    </view>
  </view>
  <!-- 头部状态end -->

  <!-- 【退款申请被拒绝时显示】拒绝理由 -->
  <view class="refuse-reason" wx:if="{{returnMoneySts == 7}}">
    拒绝理由：{{rejectMessage}}
  </view>
  <!-- 退货方式 -->
  <!-- wx:if="{{returnMoneySts == 2 && applyType == 2}}" -->
  <view class="return-address" wx:if="{{returnMoneySts == 3||returnMoneySts == 2 && applyType == 2}}">
    <view class="addr-tit">退货方式</view>
    <view class="address">
      <view class="return-shop-box">
        <view>
          <view class="shop-title">{{payer==1?'商家':'用户'}}承担运费</view>
          <view class="shop-text" wx:if="{{returnMoneySts==3}}">已发起配送</view>
          <view class="shop-text" wx:else>请在{{countdown_hours}}小时{{countdown_minutes}}分钟内，发起配送，将货品退回给商家。</view>
        </view>
        <view class="shop-btn" bindtap="sendDistribution" wx:if="{{sendPay==null}}">发起配送</view>
        <view class="shop-btn" bindtap="flowBution" wx:else>查看物流</view>
      </view>
    </view>
  </view>
  <!-- <view wx:if="{{cancelPay}}">
    <view class="pay-card">
      <view class="loading-time">等待支付，剩余<text style="color: #FF4D3A;">{{timeFormat}}</text></view>
      <view class="time-out">超过15分钟未支付，订单将自动取消。</view>
      <view class="pay-btn" bindtap="atoncePaySend">立即支付￥{{sendInfo.price}}</view>
    </view>
  </view> -->
  <van-popup show="{{ addCarshow }}" closeable round position="bottom" custom-style="height: 45%" bind:close="onClose">
    <view class="popup-box">
      <view class="popup-title">寄回商品</view>
      <view class="info-card-box">
        <view class="card-address">顾客地址</view>
        <view class="card-info">{{userAddrDto.address}}{{userAddrDto.addressName}}{{userAddrDto.addrDetail}}</view>
        <view class="card-user">{{userAddrDto.receiver}} {{userAddrDto.mobile}}</view>
        <view class="card-line"></view>
        <view class="card-time-box" bindtap="selectUpTime">
          <view class="card-time">*取件时间</view>
          <view class="up-time">{{combinedTextValue||'请选择上门时间'}}
            <van-icon name="arrow" />
          </view>
        </view>
      </view>
      <view class="costSide-card">
        <view>配送费支付方</view>
        <view>{{payer==1?'商家':'用户'}}</view>
      </view>
      <view class="bottom-button-box">
        <!-- 支付方:payer=1店铺，2买家 -->
        <view class="bottom-button" wx:if="{{payer==1}}" bindtap="submitBtn">提交</view>
        <view class="send-pay-box" wx:else>
          <view class="sendpay-text">配送费 <text style="color: #FF4D3A;">￥{{sendInfo.price||'0'}}</text></view>
          <view class="sendpay-btn" bindtap="toPaySend">支付</view>
        </view>
      </view>
    </view>
  </van-popup>
  <van-popup show="{{ selectTimeshow }}" overlay="{{false}}" round position="bottom" custom-style="height: 45%" bind:close="timeOnClose">
    <view class="popup-box">
      <view class="popup-title">选择上门时间</view>
      <van-picker columns="{{ columns }}" show-toolbar bind:cancel="onCancel" bind:confirm="onConfirm" bind:change="onChange" />
      <!-- <view class="popup-select-day">
        <view class="day-left">
          <view class="{{sts==0?'now-day':'tomorrow-day'}}" data-sts="0" data-time="{{nomDay}}" bindtap="selectday">{{nomDay+'(今天)'}}</view>
          <view style="margin-top: 28rpx;" class="{{sts==1?'now-day':'tomorrow-day'}}" data-sts="1" data-time="{{tomorrowDay}}" bindtap="selectday">{{tomorrowDay+'(明天)'}}</view>
        </view>
        <view class="time-right">
          <view class="sel-time{{currentSelectedIndex === index? 'selected' : ''}}" wx:for="{{timeIntervals}}" bindtap="selectTime" data-time="{{item}}" data-index="{{index}}">
          <text wx:if="{{!item.hidden}}">{{item.interval}}</text></view>
        </view>
      </view> -->
    </view>
  </van-popup>
  <van-popup show="{{ flowShow }}" closeable round position="bottom" custom-style="height: 45%" bind:close="flowOnClose">
    <van-steps custom-class="steps-style" steps="{{ steps }}" active="{{ active }}" direction="vertical" active-color="#006CE8" />
  </van-popup>
  <!-- 【退货退款状态下，买家同意后】退货地址 -->
  <view class="return-address" wx:if="{{returnMoneySts == 2 && applyType == 2}}">
    <view class="addr-tit">退货地址</view>
    <view class="address">
      <view class="recipient">
        <text class="addr-cont">收件人：{{refundDelivery.receiverName}}</text>
        <text class="mobile">{{refundDelivery.receiverMobile}}</text>
      </view>
      <view class="addr">详细地址：{{refundDelivery.receiverAddr}}</view>
    </view>
  </view>


  <!-- 退款信息 -->
  <view class="refund-message">
    <view class="refund-txt">退款信息</view>
    <view class="goods-msg-box">
      <!-- 店铺 -->
      <!-- <view class="shop-box">
        <view class="shop-img"><image src="../../images/icon/shop.png"></image></view>
        <view class="shopname">店铺：{{shopName}}</view>
      </view> -->
      <!-- 图片 -->
      <view class="img-box" wx:if="{{orderItems.length==1}}">
        <image src="{{orderItems[0].pic}}"></image>
      </view>
      <!-- 信息 -->
      <view class="goods-text" wx:if="{{orderItems.length==1}}">
        <view class="goods-title">{{orderItems[0].prodName}}</view>
        <view class="goods-quantity">数量：{{orderItems[0].prodCount}}件</view>
      </view>

      <block wx:if="{{orderItems.length>1}}">
        <view class="refund-goods-item" wx:for="{{orderItems}}" wx:key="*this">
          <!-- 图片 -->
          <view class="img-box">
            <image src="{{item.pic}}"></image>
          </view>
          <!-- 信息 -->
          <view class="goods-text">
            <view class="goods-title">{{item.prodName}}</view>
            <view class="goods-quantity">数量：{{item.prodCount}}件</view>
          </view>
        </view>
      </block>
    </view>
    <!-- 具体信息 -->
    <view class="refund-cont">退款方式：{{['','仅退款','退货退款'][applyType]}}</view>
    <view class="refund-cont">退款原因：{{buyerReason}}</view>
    <view class="refund-cont">退款金额：
      <text class="red" wx:if="{{refundAmount && refundAmount > 0}}">￥{{wxs.toPrice(refundAmount?refundAmount:0)}}</text>
      <text class="red" wx:if="{{(refundScore && refundScore > 0) && (refundAmount && refundAmount > 0)}}">+</text>
      <text class="red" wx:if="{{refundScore && refundScore > 0}}">{{refundScore}}积分</text>
    </view>
    <view class="refund-cont">退款编号：{{refundSn}}</view>
    <view class="refund-cont">申请时间：{{applyTime}}</view>
    <!-- 【退货申请显示】 -->
    <view class="refund-cont" wx:if="{{goodsNum>0}}">退货数量：{{goodsNum}}</view>
    <!-- 联系商家 -->
    <!-- <view class="contact-merchant">联系商家</view> -->
    <button class='contact-merchant' open-type="contact">联系客服</button>
  </view>


  <!-- 脚部撤销申请 -->
  <!-- applyType: 1,  //申请类型:1,仅退款,2退款退货 -->
  <!-- returnMoneySts： 处理退款状态:(1.买家申请 2.卖家接受 3.买家发货 4.卖家收货 5.退款成功 6.买家撤回申请 7.商家拒绝 -1.退款关闭) -->
  <view class="foot-box">
    <view class="footer">
      <!-- 【申请后-申请完成前】 -->
      <!-- <text class="undo-apply" bindtap="cancelApplication" wx:if="{{returnMoneySts ==1 || returnMoneySts == 7 || (returnMoneySts ==2 && applyType == 2)}}">撤销申请</text> -->
      <text class="undo-apply" bindtap="cancelApplication" >撤销申请</text>
      <!-- 【商家拒绝时显示】 -->
      <!-- <text class="undo-apply apply-current" bindtap="toAlterRefundApply" wx:if="{{returnMoneySts ==1 || returnMoneySts == 7}}" data-refundsn="{{refundSn}}">修改申请</text> -->
      <!-- 【商家同意后-货物寄出前】 -->
      <!-- <text class="undo-apply apply-current" bindtap="toLogisticsPage" wx:if="{{returnMoneySts == 2 && applyType == 2}}" data-refundsn="{{refundSn}}">填写退货物流</text> -->
    </view>
  </view>

</view>

<wxs module="wxs" src="../../wxs/number.wxs" />