<!--pages/order-detail/order-detail.wxml-->

<view class='container'>
  <!-- 地址 -->
  <view class='order-detail'>
    <view class='delivery-addr'>
      <view class='user-info'>
        <text class='item'>{{userAddrDto.receiver}}</text>
        <text class='item'>{{userAddrDto.mobile}}</text>
      </view>
      <view class='addr'>{{userAddrDto.address}}{{userAddrDto.addressName}}{{userAddrDto.addrDetail}}</view>
      <!-- <view class='addr'>{{userAddrDto.province}}{{userAddrDto.city}}{{userAddrDto.area}}{{userAddrDto.area}}{{userAddrDto.addr}}</view> -->
    </view>

    <!-- 商品信息 -->
    <view class='prod-item'>
      <view class="order-num">
        <view class='order-state clearfix'>
          <!-- 店铺 -->
          <view class="shop-box">
            <view class="shop-icon">
              <image src="../../images/icon/shop.png"></image>
            </view>
            <view class="shop-name">{{shopName}}</view>
          </view>
          <!-- /店铺 -->
          <text class="order-sts  gray">{{['','待支付','待发货','待收货','已完成','已完成','已取消','拼团中'][status]}}</text>
        </view>
      </view>
      <block wx:for="{{orderItemDtos}}" wx:key='prodId'>
        <view class='item-cont' bindtap='toProdPage' data-prodid="{{item.prodId}}">
          <view class='prod-pic'>
            <image src='{{item.pic}}'></image>
          </view>
          <!-- 拼团商品展示icon -->
          <view class="spell-group-icon">
            <text class="group-text" wx:if="{{item.orderType!=null}}">{{['','拼团','秒杀','积分'][orderType]}}</text>
          </view>
          <view class='prod-info'>
            <view class='prodname'>
              {{item.prodName}}
            </view>
            <view class='prod-info-cont'>
              <!-- 拼团icon -->
              <view class="spell-group-icon" wx:if="{{orderType}}">
                <!-- orderType 订单类型(0普通订单 1团购订单 2秒杀订单) -->
                <text class="group-text">{{['','拼团','秒杀','积分'][orderType]}}</text>
              </view>
              <!-- /拼团icon -->
              <view class='number'>{{item.skuName||''}} {{item.prodCount}} 件</view>
              <!-- <text class='info-item'>{{item.skuName}}</text> -->
            </view>
            <view class='price-nums clearfix'>
              <text class='prodprice'><text wx:if="{{item.price}}" class='symbol'>￥</text>
                <text wx:if="{{item.price}}" class='big-num'>{{wxs.parsePrice(item.price)[0]}}</text>
                <text wx:if="{{item.price}}" class='small-num'>.{{wxs.parsePrice(item.price)[1]}}</text>
                <text wx:if="{{item.price && orderType==3}}" class='small-num'>+</text>
                <text class='big-num' wx:if="{{orderType==3}}">{{item.useScore}} 积分</text>
              </text>
              <!-- <view class='btn-box'>
                <text class='btn'>申请售后</text>
                <text class='btn'>加购物车</text>
              </view> -->
            </view>
          </view>
          <!-- 申请退款btn -->
          <text class="apply-refund-btn" catchtap="applyRefund" data-itemactualtotal="{{item.actualTotal}}" data-item="{{item}}" wx:if="{{!item.refundSn && canRefund && orderType !=3||item.status==6}}" data-refundtype="2" data-type="{{status == 2?'1':'2'}}">申请退款</text>
          <text class="apply-refund-btn" catchtap="viewRefund" data-ordernumber='{{item.orderNumber}}' data-refundsn="{{item.refundSn}}" wx:if="{{item.refundSn}}">查看退款</text>
          <!-- 申请退款btn -->
        </view>
      </block>
      <view class='prod-foot'>
        <view class='btn'>
          <button wx:if="{{item.status==1}}" class="button" bindtap="onCancelOrder" data-ordernum="{{item.primaryOrderNo}}" hover-class='none'>取消订单</button>
          <!-- <button wx:if="{{item.status==1}}" class="button warn" bindtap="onConfirmReceive" data-ordernum="{{item.primaryOrderNo}}" hover-class='none'>再次购买</button> -->
          <button wx:if="{{item.status==1}}" class="button warn" bindtap="onPayAgain" data-ordernum="{{item.primaryOrderNo}}" hover-class='none'>付款</button>
          <button wx:if="{{item.status==3 || item.status==5}}" class="button" bindtap="toDeliveryPage" data-ordernum="{{item.primaryOrderNo}}" hover-class='none'>查看物流</button>
          <button wx:if="{{item.status==3}}" class="button warn" bindtap="onConfirmReceive" data-ordernum="{{item.primaryOrderNo}}" hover-class='none'>确认收货</button>
        </view>
      </view>
    </view>

    <!-- 订单信息 -->
    <view class='order-msg'>
      <view class='msg-item'>
        <view class='item'>
          <text class='item-tit'>订单编号：</text>
          <text class='item-txt'>{{orderNumber}}</text>
          <text class='copy-btn' bindtap='copyBtn'>复制</text>
        </view>
        <view class='item'>
          <text class='item-tit'>下单时间：</text>
          <text class='item-txt'>{{createTime}}</text>
        </view>
      </view>
      <view class='msg-item'>
        <view class='item'>
          <text class='item-tit'>支付方式：</text>
          <text class='item-txt'>微信支付</text>
        </view>
        <view class='item'>
          <text class='item-tit'>配送方式：</text>
          <text class='item-txt'>普通配送</text>
        </view>
        <view class='item'>
          <text class='item-tit'>订单备注：</text>
          <text class='item-txt'>{{remarks?remarks:''}}</text>
        </view>
      </view>
    </view>

    <view class='order-msg'>
      <view class='msg-item'>
        <view class='item'>
          <view class='item-tit'>商品总额：</view>
          <view class='item-txt price'>
            <text class='symbol'>￥</text>
            <text class='big-num'>{{wxs.parsePrice(productTotalAmount)[0]}}</text>
            <text class='small-num'>.{{wxs.parsePrice(productTotalAmount)[1]}}</text>
          </view>
        </view>
        <view class='item'>
          <view class='item-tit'>运费：</view>
          <view class='item-txt price'>
            <text class='symbol'>￥</text>
            <text class='big-num'>{{wxs.parsePrice(transfee)[0]}}</text>
            <text class='small-num'>.{{wxs.parsePrice(transfee)[1]}}</text>
          </view>
        </view>
        <view class='item'>
          <view class='item-tit'><text class="item-tit" wx:if="{{orderType && orderType!=3}}">{{orderType==1?'团购':'秒杀'}}</text>优惠：</view>
          <view class='item-txt price'>
            <text class='symbol'>-￥</text>
            <text class='big-num'>{{wxs.parsePrice(reduceAmount)[0]}}</text>
            <text class='small-num'>.{{wxs.parsePrice(reduceAmount)[1]}}</text>
          </view>
        </view>
        <view class='item payment'>
          <view class='item-txt price'>
            订单总额：
            <text class='symbol' wx:if="{{actualTotal && actualTotal > 0}}">￥</text>
            <text class='big-num' wx:if="{{actualTotal && actualTotal > 0}}">{{wxs.parsePrice(actualTotal)[0]}}</text>
            <text class='small-num' wx:if="{{actualTotal && actualTotal > 0}}">.{{wxs.parsePrice(actualTotal)[1]}}</text>
            <text class='small-num' wx:if="{{(actualTotal && actualTotal > 0) && (orderType==3 || orderScore > 0)}}">+</text>
            <text class='big-num' wx:if="{{orderType==3 || orderScore > 0}}">{{orderScore}} <text class='small-num'>积分</text></text>
          </view>
        </view>
      </view>
    </view>

    <!-- 底部栏 -->
    <view class='order-detail-footer'>
      <!-- <text class='dele-order' wx:if="{{status==5||status==6}}" bindtap='delOrderList' data-ordernum="{{orderNumber}}">删除订单</text> -->
      <view class='footer-box'>
        <text class="apply-refund-btn refund-full" data-refundtype="1" catchtap="applyRefund" wx:if="{{canAllRefund && orderType!=3}}" data-type="{{status == 2?'1':'2'}}">整单退款</text>
        <button class='apply-service foot-btn' open-type="contact">联系客服</button>
        <!-- <text class='buy-again'>再次购买</text> -->

        <!-- 【团购按钮】 -->
        <button class='apply-service foot-btn' bindtap="toGroupDetails" data-ordernumber='{{orderNumber}}' wx:if="{{orderType==1}}">查看团购详情</button>
        <!-- 【团购按钮】 -->
      </view>
    </view>

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