<!--pages/member/refund/refund.wxml-->
<view class="refund">

	<view class="return-goods" wx:if="{{returnGoolsList && returnGoolsList.length > 0}}">
      <view class="return-goods-item" wx:for="{{returnGoolsList}}" wx:key="id">
        <view class="goods-img">
          <image src="{{item.goods_thumb}}" />
        </view>
        <view class="goods-content">
          <view class="goods-title">
            {{item.goods_title}}
          </view>
          <view class="goods-options">{{item.goods_option_title}} x{{item.refund_total}}</view>
          <view class="goods-price">￥{{item.refund_price}}</view>
        </view>
      </view>
    </view>

		<view class="info">
		<view class="ul mode" style='position:relative'>
			<van-cell title="申请类型：" value="{{returnTypeItem.name ? returnTypeItem.name : '请选择' }}" is-link bind:click="openComponentsPop" data-name="returnType"/>
		</view>
	</view>
	<view class="info"  wx:if="{{order_status>=2 && returnTypeItem.value==0}}">
		<view class="ul mode" style='position:relative'>
			<van-cell title="收货状态：" value="{{receivingStatus=='not_received' ? '未收到货' : '已收到货'}}" is-link bind:click="openComponentsPop" data-name="receivingStatus" />
		</view>
	</view>
	<view class="info" wx:if="{{returnTypeItem.value!=2}}">
		<view class="ul cause" style='position:relative'>
			<van-cell title="申请原因：" value="{{returnReasons ? returnReasons : '请选择'}}" is-link bind:click="openComponentsPop" data-name="returnReason" />
		</view>
		<view class="ul sum">
			<van-cell title="退款商品金额：{{money}}{{language['元']}}" value="" />
		</view>
	</view>
	<view class="prompt" wx:if="{{returnTypeItem.value!=2}}">提示：您的退款最大金额为{{money}}{{language['元']}}</view>

  <van-cell-group class="w-7">
    <van-field wx:if="{{refundable_freight}}" value="{{ freight_price }}" type="number" label="退款运费金额：" placeholder="不超过{{refundable_freight}}元" right-icon="warning-o" bind:change="onChangeFreightPrice" bind:click-icon='showInstructionsFn'/>
    <van-field wx:if="{{refundable_other}}" value="{{ other_price }}" type="number" label="退款其他金额：" placeholder="不超过{{refundable_other}}元"  bind:change="onChangeOtherPrice" error-message="包含手续费、服务费"/>
  </van-cell-group>

	<view class="info" wx:if="{{returnTypeItem.value!=0 && receivingStatus!='not_received'}}">
		<view class="ul mode" style='position:relative'>
			<van-cell title="返回方式：" value="{{tool.returnMethodsName(send_back_way,returnMethods)}}" is-link bind:click="openComponentsPop" data-name="returnMethods" />
		</view>
	</view>
	<!-- wx:if="{{returnTypeItem.value!=0 && returnMethods==1}}" -->
	<view class="recovery-info" wx:if="{{returnTypeItem.value!=0 && returnMethods==1 && jdTakeParts!=null}}">
      <view class="recovery-itme" bindtap="openComponentsPop" data-name="editAddress">
        <view class="recovery-text">
          取件地址：
        </view>
        <view class="recovery-content" wx:if="{{jd_address.pick_up_name}}">
          <view class="recovery-desc">
            {{jd_address.pick_up_name}}/{{jd_address.pick_up_tel}}
          </view>
          <view class="recovery-desc">
            {{jd_address.addressName}} {{jd_address.street}} {{jd_address.pick_up_address}}
          </view>
        </view>
        <view class="next-icon">
           <i class="iconfont icon-advertise-next"></i>
        </view>
      </view>
      <view class="recovery-itme" bindtap="openComponentsPop" data-name="pickUpTime">
        <view class="recovery-text">
          取件时间：
        </view>
        <view class="recovery-content">
          <view class="icon_time" style="text-align:right;">
					<text wx:if="{{start_time}}">{{tool.substring(start_time,5)}} - {{tool.substring(end_time,5)}}</text>
					<i wx:if="{{!start_time}}" class="iconfont icon-record_time"></i></view>
        </view>
        <view class="next-icon">
           <i class="iconfont icon-advertise-next"></i>
        </view>
      </view>
			<view class="recovery-itme">
        <view class="recovery-text">
          重量：
        </view>
        <view class="recovery-content">
          <view class="inputs">
            <view class="input-item">
              <input type="text" model:value="{{jd_weight}}" />
              <text class="unit">kg</text>
            </view>
          </view>
        </view>
      </view>
      <view class="recovery-itme">
        <view class="recovery-text">
          体积：
        </view>
        <view class="recovery-content">
          <view class="inputs">
            <view class="input-item">
              <input type="text" placeholder="长" model:value="{{jd_length}}" />
              <text class="unit">cm</text>
            </view>
            <text class="ride">*</text>
            <view class="input-item">
              <input type="text" placeholder="宽" model:value="{{jd_width}}" />
              <text class="unit">cm</text>
            </view>
            <text class="ride">*</text>
            <view class="input-item">
              <input type="text" placeholder="高" model:value="{{jd_height}}" />
              <text class="unit">cm</text>
            </view>
          </view>
        </view>
      </view>
    </view>

	<view class="explain">
		<view class="span">申请说明：</view>
		<van-field model:value="{{returnExplain}}" placeholder="请输入申请售后服务的原因" border="{{ false }}" maxlength="{{100}}"
		 type='textarea' />
	</view>
	<view class="explain">
		<view class="span">上传图片凭证：</view>
		<yz_uploader bind:updateImages="updateImages" fileSrc="{{fileList1}}"></yz_uploader>
	</view>
	<view class="button" catchtap="confirmRefund">提交申请<!-- <catchform></catchform> --></view>
</view>



<!-- 收货状态 -->
<receivingStatusPop class="receivingStatus" bind:confirm="confirmReceivingStatus" />

<!-- 退货方式 -->
<returnMethodsPop class="returnMethods" bind:confirm="confirmReturnMethods" send_back_way="{{send_back_way}}" />

<!-- 退款方式 -->
<returnTypePop class="returnType" refundTypes="{{refundTypes}}" bind:confirm="confrimReturnType" />

<!-- 取件时间 -->
<pickUpTimePop class="pickUpTime" bind:confirm="confirmPickUpTime" />

<!-- 退款商品 -->
<returnGoodsPop class="returnGoods" goodsList="{{returnAllGoodsList}}" bind:confirm="confrimReturnGoods" />

<!-- 退款原因 -->
<returnReasonPop class="returnReason" wx:if="{{returnTypeItem && returnTypeItem.reasons}}" reasonList="{{returnTypeItem.reasons[receivingStatus]}}" bind:confirm="confirmReturnReason" />

<editAddressPop class="editAddress" bind:confirm="confirmEditAddress" />

<van-popup show="{{showInstructions}}" round bind:close="onCloseInstructions" position="bottom" closeable custom-style="height: 30% ">
  <van-nav-bar title="退款运费说明" />
  <text style="padding: 32rpx;line-height: 48rpx;display: block;font-size: 14px;">由卖家承担：货品质量问题，假货等
  由买家承担：个人原因不喜欢，不想要等</text>
</van-popup>

<wxs module="tool">

	function returnMethodsName(arr,value){
		var name="";
		for(var i=0;i<arr.length;i++){
			if(arr[i].value == value){
				name = arr[i].name;
			}
		}
		return name;
  }
  
  function substring(value,start){
    return value.substring(start);
  }

	module.exports.returnMethodsName = returnMethodsName;
	module.exports.substring = substring;

</wxs>