<wxs module="util">
  var getDays = function (strDateStart, strDateEnd) {
    let start = strDateStart.split(' ')
    let end = strDateEnd.split(' ')
    let strSeparator = '-' //日期分隔符
    let oDate1, oDate2, iDays
    oDate1 = start[0].split(strSeparator)
    oDate2 = end[0].split(strSeparator)
    let strDateS = new Date(oDate1[0], oDate1[1] - 1, oDate1[2])
    let strDateE = new Date(oDate2[0], oDate2[1] - 1, oDate2[2])
    iDays = parseInt(Math.abs(strDateS - strDateE) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数
    console.log(iDays)
    return iDays
  };
  module.exports.inOf = getDays;

</wxs>
<block wx:if="{{datasource.length>0}}">
  <van-checkbox-group value="{{checkList}}" bind:change="multiplePayChange">
    <view class="shop" wx:for="{{datasource}}" wx:for-index="orderidx" wx:for-item="order" wx:key="orderidx">
      <view class="title">
        <van-checkbox wx:if="{{status == 1 && consolidated }}" checked-color="#f15353" name="{{order.id}}"></van-checkbox>
        <view class="h4" catchlongpress="copyorderbtn" data-copydata="{{order.order_sn}}">
          <text style="font-size: 13px;">订单号：{{order.order_sn}}</text>
          <text class="tags-box" wx:if="{{order.dispatch_type_name}}">
            <text class="tags">{{order.dispatch_type_name}}</text>
          </text>
        </view>
        <view class="span">{{order.status_name}}</view>
      </view>
      <view class="shop-box" data-order="{{order}}" wx:if="{{order.shop_name && (order.plugin_id == 0 || order.plugin_id == 92 || order.plugin_id == 31 || order.plugin_id == 32)&&!order.has_one_team_member.store_id}}" catchtap="toStore">
        <view class="shop-box-left">
          <icon class="iconfont icon-fontclass-dianpu"></icon>
          <text class="p">{{order.shop_name}}</text>
        </view>
        <icon class="iconfont icon-advertise-next"></icon>
      </view>
      <!-- 门店拼团门店信息显示 start -->
      <view class="shop-box" data-order="{{order}}" wx:if="{{order.has_one_team_member.store_id && order.plugin_id == 54 }}" catchtap="toStore">
        <view class="shop-box-left">
          <icon class="iconfont icon-fontclass-dianpu"></icon>
          <text class="p">{{order.has_one_team_member.has_one_store.store_name}}</text>
        </view>
        <icon class="iconfont icon-advertise-next"></icon>
      </view>
      <!-- 门店拼团门店信息显示 end -->
      <block wx:for="{{order.has_many_order_goods}}" wx:for-index="goodsidx" wx:for-item="good" wx:key="goodsidx">
        <view class="goods" data-orderid="{{order.id}}" bindtap="goOrderdetail">
          <view class="goods-box">
            <view class="img">
              <image src="{{good.thumb}}" mode='widthFix' />
            </view>
            <view class="warp">
              <view class="inner">
                <view class="name" wx:if="{{!order.deposit_ladder}}">{{good.title}}</view>
                <view class="name" wx:if="{{order.deposit_ladder}}"><!--判断定金活动尾款-->{{ order.deposit_ladder.activity_name }}</view>
                <view class="option">
                  <text wx:if="{{good.goods_option_title}}">规格: {{good.goods_option_title}}</text>
                  <text class="num" wx:if="{{detailUrl != 'HotelOrderDetail'}}">×{{good.total}}</text>
                  <text class="num" wx:if="{{detailUrl == 'HotelOrderDetail'}}">{{ util.getDays(order.hotel_order.enter_at, order.hotel_order.leave_at) }}晚{{ good.total }}间</text>
                </view>
              </view>
            </view>
          </view>
          <view class="price">
            <view class="money">
              <text class="deposit-tips" wx:if="{{order.plugin_id == 108}}"><!--判断定金活动-->定金</text>
              <text class="deposit-tips" wx:if="{{order.deposit_ladder }}"><!--判断定金活动尾款-->尾款</text>
              <text class="small">{{language['money']}}</text>
              {{orderType=='lease_toy'?good.price/order.has_one_lease_toy_order.return_days/good.total:good.price}}
              <text class="span" wx:if="{{order.plugin_id == 40?true:false}}">/天</text>
            </view>
          </view>
        </view>
      </block>
      <view class="address-box" wx:if="{{order.address && order.address.address}}">
        <view>{{order.address.realname}} （{{order.address.mobile}}）</view>
        <view>{{order.address.address}}</view>
      </view>
      <view class="title">
        <view class="h4 textright">
          共 {{order.goods_total}} {{ detailUrl == 'HotelOrderDetail' ? '个房间' : '件商品' }} 实付：{{language['money']}}
          <text class="b">{{order.price}}</text>
        </view>
      </view>
      <view class="CharitableFund" wx:if="{{order.charity_fund_money && order.charity_fund_money!=0}}" style="color:red;padding-left:25rpx;padding-bottom:20rpx;background:#fff;">
        慈善基金捐赠总额{{order.charity_fund_money}}元
      </view>
      <view class="allbt" wx:if="{{order.button_models.length > 0}}">
        <block wx:for="{{order.button_models}}" wx:for-index="butidx" wx:key="butidx" wx:for-item="item">
          <view wx:if="{{butidx < 2}}" data-orderidx="{{orderidx}}" data-item="{{item}}" data-order="{{order}}" catchtap="operation" style="position: relative;" class="span {{!item.api ? 'noClickBG' : ''}} {{item.value == 1 ? 'red-button' : ''}}">
            {{item.name}}
            <button wx:if="{{item.value==41}}" style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="contact" session-from="weapp"></button>
          </view>
          <view wx:if="{{butidx == 2 && order.button_models.length > 2}}" data-orderidx="{{orderidx}}" data-order="{{order}}" catchtap="showMore" style="position: relative;" class="span red-button">
            更多
          </view>
          <view class="trans" wx:if="{{butidx == 2 && showID == order.order_sn}}"></view>
          <view class="more-button" wx:if="{{butidx == 2 && showID == order.order_sn}}">
            <view wx:for="{{order.button_models}}" wx:for-item="btn" wx:if="{{i >= 2}}" wx:for-index="i" wx:key="i" data-orderidx="{{orderidx}}" data-item="{{btn}}" data-order="{{order}}" catchtap="operation" class="p {{!item.api ? 'noClickBG' : ''}}" style="position: relative;">
              {{btn.name}}
              <button wx:if="{{btn.value==41}}" style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="contact" session-from="weapp"></button>
            </view>
          </view>
        </block>
      </view>
    </view>
  </van-checkbox-group>
  <!-- 确认发货弹出的dialog -->
  <van-dialog use-slot async-close show="{{dialogVisible}}" show-cancel-button bind:close="sendGoogs">
    <view catchtouchmove="noop" class="sendgood">
      <view class="h4">确认发货</view>
      <view class="addmessage" wx:if="{{addresseeInfo && jurisdiction_set != 1}}">
        <view class="title">收件人信息:</view>
        <view class="content">
          <view class="top">
            <text class="span">收件人:{{addresseeInfo.realname}}</text>
            <text class="span">({{addresseeInfo.mobile}})</text>
          </view>
          <view class="bottom">收货地址:{{addresseeInfo.address}}</view>
        </view>
      </view>
      <view class="delivery">
        <view class="left">快递公司:</view>
        <view class="right">
          <view class="button" catchtap="seleRegional">{{regional}}</view>
        </view>
      </view>
      <view class="deliveryinp">
        <view class="left">快递单号:</view>
        <view class="right">
          <van-field value="{{numberName}}" placeholder="请输入快递单号" border="{{false}}" bind:inp="numberNamebtn" />
        </view>
      </view>
    </view>
  </van-dialog>
  <!-- 选择快递 -->
  <van-popup show="{{dateshow_1}}" position="bottom" z-index='{{2000}}'>
    <view>
      <van-search placeholder="请输入快递公司名称" input-align="center" bind:change="filterExpressCompany" value="{{ inputExpressCompanyName }}" />
      <van-picker default-index="expressCompanyDefaultIndex" show-toolbar="{{true}}" columns="{{ filterExpressCompanys.length>0?filterExpressCompanys:columns }}" bind:cancel="onCancelbtn" bind:confirm="onConfirmbtn" />
    </view>
  </van-popup>
  <!-- 发货失败上拉弹出 -->
  <van-popup show="{{ sendGoogsFail.show }}" position="bottom" z-index='{{ 2000 }}' bind:click-overlay="colseSendGoogsFailPopup">
    <view class="send-googs-fail">
      <view class="title">提示</view>
      <view class="msg">{{ sendGoogsFail.msg }}</view>
      <view class="confirm" bindtap="colseSendGoogsFailPopup">确认</view>
    </view>
  </van-popup>
  <!--  -->
  <van-popup show="{{showQrcode}}" position="bottom" z-index='{{2000}}' bind:click-overlay="onClose">
    <view class="qrcodeClass">
      <image src="{{qrcode_url}}" mode='widthFix'></image>
      <text>请核销员扫码核销</text>
    </view>
  </van-popup>
</block>
<block wx:else>
  <view class="nomessage">没有更多了</view>
</block>
<van-dialog use-slot title="易货兑换" show="{{ showBarter }}" show-cancel-button bind:confirm='confirmBarter' bind:close="cancelBarter" confirm-button-text='兑换' class="barter_dialog">
  <view class="barter_dialog_1">是否确认易货兑换</view>
  <view class="barter_dialog_2">该商品可兑换易货值为{{ showBarter_value }}</view>
</van-dialog>

<van-overlay show="{{blindBoxInfo.show}}" bind:click="blindBoxInfoTap">
  <view style="display: flex; align-items: center; justify-content: center; height: 100%;">
      <view class="blindBoxInfo" wx:if="{{blindBoxInfo.show}}">
        <view class="multipleWrapper">
          <view class="desc">盲盒商品</view>
          <view class="goodsWrapper">
            <block wx:for="{{blindBoxInfo.goods}}" wx:key="index" >
              <view class="goodsItem">
                <view class="goodInfo">
                  <view class="c1">{{item.order_sn}}</view>
                  <view class="c2">{{item.status_name}}</view>
                </view>
                <view class="goodContent" wx:for="{{item.has_many_order_goods}}" wx:key="ind" wx:for-item='item1' catchtap="goOrderList" data-item="{{item}}">
                  <view class="goods_img">
                    <image src="{{item1.thumb}}" alt="" />
                  </view>
                  <view class="content">
                    <view class="name">{{item1.title}}</view>
                    <view class="price">{{item1.goods_option_title}}</view>
                  </view>
                </view>
              </view>
            </block>
          </view>
        </view>

        <view class="close" catchtap="blindBoxInfoTap">
          <icon class="iconfont icon-adsystem_icon_cancle" ></icon>
        </view>
      </view>
  </view>
</van-overlay>
<van-popup show="{{refundShow}}" position="bottom" custom-style="height: 50%;" round closeable bind:close="onCloseRefundShow">
  <view class="refundShow-box">
    <view class="popup-title">关闭原因</view>
    <view class="popup-context">{{ refundText }}</view>
  </view>
</van-popup>


<view catchtouchmove>
  <van-dialog
  use-slot
  title="{{custom_receipt_confirmation_btn.name}}"
  show="{{ custom_receipt_confirmation_show }}"
  show-cancel-button
  bind:confirm="CustomReceiptConfirmationSend"
  bind:close="onClose">
<view class="custom_receipt_confirmation_html">
  <scroll-view style="max-height:640rpx" scroll-y="{{true}}">
    <mp-html content="{{custom_receipt_confirmation_html}}"></mp-html>
  </scroll-view>
</view>  
</van-dialog>
</view>

