<!-- pages/goods/orderDetail/orderDetail.wxml -->
<wxs module="tool" src="../../../app.wxs" />

<view class="item margin item-radius current{{current}}">
  <view class="item-top flex-align-center">
    <text class="flex1 ellipsis" style="font-size: 36rpx;">{{detail.store_name}}</text>
    <text class="state">{{detail.status_text}}</text>
  </view>
  <view class="item-content flex" wx:for="{{detail.good}}" wx:key="index">
    <image class="img" src="{{item.cover_url}}"></image>
    <view class="content flex-column">
      <view class="content-text-box flex">
        <text class="good-name">{{item.goods_name}}</text>
      </view>
      <view class="content-num">
        <view wx:if="{{detail.seconds>0}}" class="countDown">剩余支付时间:
          <van-count-down format="mm:ss" bind:finish='finishTime' style="margin-left: 10rpx;" time="{{ detail.seconds }}" />
        </view>
        <view class="num">x{{item.num}}</view>
      </view>
    </view>
  </view>
  <view class="item-content flex" wx:for="{{detail.plus}}" wx:key="index">
    <image class="img" src="{{item.plus_url}}"></image>
    <view class="content flex-column">
      <view class="content-text-box flex">
        <text class="good-name">{{item.project_name}}</text>
      </view>
      <view class="content-num">
      <view class="num">x1</view>
      </view>
    </view>
  </view>
  <view class="item-btn flex-align-center">
    <view class="align-left">共{{productNum}}件</view>
    <view class="align-right">
      <!-- <text style="font-size: 28rpx;color: #999;">预约费用：</text> -->
      <text style="font-size: 36rpx;margin-right:28rpx;">¥{{detail.original_price}}</text>
    </view>

  </view>
</view>
<view class="margin item-radius coupon-code flex-column flex-align-center" style="padding: 20rpx 0;" wx:if="{{detail.status == 1 || detail.status == 2 }}">
  <view style="align-self: flex-start;padding: 0 24rpx 30rpx;font-size: 36rpx;font-family: PingFangSC-Semibold, PingFang SC;font-weight: 600;color: #333333;">
    券码信息
  </view>
  <!-- <image src=""></image> -->
  <!-- 二维码 -->
  <view wx:if="{{detail.status == 1}}" class="flex-column flex-align-center">
    <canvas class="qrcode" canvas-id="qrcode" />
    <text style="margin-top:20rpx;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">·{{detail.coupon_code}}</text>
  </view>
  <view wx:if="{{detail.status == 2}}" class="flex-align-center" style="width: 100%;">
    <text class="flex1" style="margin:0rpx 30rpx;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">·{{detail.coupon_code}}</text>
    <text wx:if="{{detail.status == 2}}" style="margin-right: 30rpx;color: #999999;font-size: 32rpx;">已使用</text>
  </view>
</view>
<view class="margin order-info flex-column flex-justify-center item-radius ">
  <view class="num flex">
    <text class="ellipsis" style="margin-right: 16px;">订单编号：{{detail.order_sn}}</text>
    <view class="copy flex-center" bindtap="onCopyOrderNum" data-num="{{detail.order_sn}}">复制</view>
  </view>
  <text class="time">下单时间：{{detail.create_time}}</text>
  <view wx:if="{{detail.status!=0}}" class="pay-time">
    <view class="time">支付时间：{{detail.pay_time}}</view>
    <view class="time">支付方式：{{detail.pay_way}}</view>
  </view>
</view>
<view class="margin order-sum item-radius ">
  <view class="top">
    <view class="text flex">
      <text class="flex1" style="font-size:28rpx;color:#999">商品总价：</text>
      <text style="font-size:28rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;color:#333">¥{{detail.original_price}}</text>
    </view>
    <view class="text flex">
      <view class="coupon flex flex1 flex-align-center">
        <text style="font-size:28rpx;color:#999">优惠券：</text>
        <view class="coupon-text flex-center" wx:if="{{detail.coupon_id!=0}}">已选推荐优惠</view>
      </view>
      <text style="font-size:28rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;color:#999" wx:if="{{detail.coupon_id==0}}">未选择</text>
      <text style="font-size:28rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;color:#333" wx:else="">-¥{{detail.discount}}</text>
    </view>
    <!-- <view class="text flex" wx:if="{{detail.discount_type==1}}"> -->
    <view class="text flex" hidden="{{true}}">
      <text class="flex1" style="font-size:28rpx;color:#999">会员抵扣：</text>
      <text style="font-size:28rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;color:#333">-¥{{detail.discount}}</text>
    </view>
  </view>
  <view class="bottom flex-align-center">
    <text style="font-size: 28rpx;color: #999">合计：</text>
    <text style="font-size: 36rpx;color: #E95564;margin-right:28rpx;">¥{{detail.price}}</text>
  </view>
</view>
<view style="height:170rpx;"></view>
<view class="buy flex-align-center" wx:if="{{ detail.status == 0 || detail.status == 1}}">
  <view class="btn cancel-btn flex-center" bindtap="onCancelOrder" wx:if="{{ detail.status == 0 }}">
    取消订单
  </view>
  <view class="btn cancel-btn flex-center" bindtap="onRefundOrder" wx:if="{{ detail.status == 1 }}">
    申请退款
  </view>
  <view class="btn use-btn flex-center" bindtap="onPay" wx:if="{{ detail.status == 0 }}">立即支付</view>
</view>

<wux-popup class="popup-radius" position="bottom" catchtouchmove="true" visible="{{ payNow }}" bind:close="onClosePay">
  <view class="coupon-popup payType">
    <view class="top flex-align-center">
      <text style="text-align: center;"></text>
      <image src="/images/icon_20.png" class="close-img" bindtap="onClosePay" />
    </view>

    <view class="moneyShow"><text>￥</text>{{ level?pay_methon==2?levelPrice:detail.price:detail.price }}</view>

    <view class="select-pay-methon" catchtap="pay_methonw">
      <image class="pay-img" src="/images/wx_pay.png"></image>
      <view class="pay-title">微信支付</view>
      <!-- <view class="pay-money"><text>￥</text>800</view> -->
      <image class="select-activity" src="{{pay_methon==1?'/images/icon_13.png':'/images/icon_12.png'}}"></image>
    </view>

    <view class="select-pay-methon" catchtap="pay_methonc" style="margin-bottom: 15rpx;">
      <image class="pay-img" src="/images/joli_pay.png"></image>
      <view class="pay-title">储值支付</view>
      <view class="pay-money"><text>￥</text>{{inserllAmount}}</view>
      <image class="select-activity" src="{{pay_methon==2?'/images/icon_13.png':'/images/icon_12.png'}}"></image>
    </view>
    <view wx:if="{{level!=0}}" class="coup-box-title" style="text-align: left; margin-left: 90rpx;">权益优惠减¥{{toLevelPrice}}</view>
    <view class="coupon-popup-btm flex-center">
      <view class="coupon-popup-btm-btn flex-center" bindtap="payNow">支付</view>
    </view>
  </view>
</wux-popup>