<!-- packageH/project_verification/MyProject/MyProject.wxml -->
<van-tabs active="{{ currentShowPageTab }}" bind:change="switchPageTabs">
  <van-tab title="可使用{{ projectNameLang }}" name="0">
    <location params="{{ { placeholder:'搜索',color:'transparent',color2:'#f14e4e' } }}" search="{{ false }}" tag="project_verification/MyProject" addressValue="{{addressValue}}" />
    <shortcut-menu />
  </van-tab>
  <van-tab title="已完成{{ projectNameLang }}" name="1"></van-tab>
</van-tabs>
<view wx:if="{{currentShowPageTab==0}}" class="time-sort">
  <view class="time-sort-item">
    <view bindtap="timeSort" data-val="{{false}}">购买时间</view>
    <view style="margin-left: 2px;" bindtap="timeSort" data-val="{{false}}">
      <view class="triangle {{timeStyle==1?'change-triangle':''}}"></view>
      <view class="triangle triangle-bottom {{timeStyle==0?'change-triangle-bottom':''}}"></view>
    </view>
  </view>
  <view class="time-sort-item">
    <view bindtap="timeSort" data-val="{{true}}">到期时间</view>
    <view style="margin-left: 2px;" bindtap="timeSort" data-val="{{true}}">
      <view class="triangle {{timeStyle==3?'change-triangle':''}}"></view>
      <view class="triangle triangle-bottom {{timeStyle==2?'change-triangle-bottom':''}}"></view>
    </view>
  </view>
</view>
<block wx:for="{{ projects }}" wx:for-item="projectPage" wx:key="index">
  <block wx:for="{{ projectPage }}" wx:for-item="projectItem" wx:key="idindex" >
    <view class="project-item">
      <panel class="project-panel">
        <project-lr data="{{ projectItem }}" showTimes="{{ currentShowPageTab=='0' }}">
          <view class="project-operate" hover-class="none" hover-stop-propagation="false" slot="footer">
            <navigator url="/packageH/project_verification/WriteOff/WriteOff?project_order_id={{ projectItem.id }}" hover-class="navigator-hover" open-type="navigate" wx:if="{{ currentShowPageTab=='0' }}">
              <operation-button type="primary" plain>核销使用</operation-button>
            </navigator>
            <view class="project_finished-status" type="primary" plain wx:else noBorder>已完成</view>
            <navigator hover-class="none" url="/packageH/project_verification/WriteOffRecord/WriteOffRecord?type=used&project_name={{ projectItem.project_title }}">
              <operation-button type="primary">使用记录</operation-button>
            </navigator>

            <navigator>
              <view class="give" bindtap="tapBtnGive" data-item="{{projectItem}}">转赠</view>
            </navigator>
          </view>
        </project-lr>
      </panel>
      <panel title="该{{ projectNameLang }}附近可核销商户" wx:if="{{ currentShowPageTab=='0' }}">
        <store-item data="{{ projectItem }}" toDetails="{{ false }}"></store-item>
        <navigator class="view-more-stores" hover-class="none" url="/packageH/project_verification/MoreStores/MoreStores?from=moreStore&project_id={{ projectItem.id }}" hover-stop-propagation="false" slot="footer">
          查看更多商户
          <text class="iconfont icon-advertise-next"></text>
        </navigator>
      </panel>
    </view>
  </block>
</block>
<van-empty wx:if="{{ projectCount===0 }}" image="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/blank.png" description="暂无记录~" />


<van-popup show="{{showGivePop}}" custom-style="width:70%;padding: 1rem 1rem 0 1rem;" round class="give-pop" bind:close="closeGivePop">
  <view class="frame-box">
    <view class="give-title">项目转赠</view>
    <view class="user-input">
      <van-field type="number" value="{{giveUserId}}" bind:change="throttleFn" label="用户id" placeholder="请输入赠送的用户id" required style="display: block" />
      <view class="{{errorFlag ? 'error' : 'other'}}">
        <text wx:if="{{errorFlag}}">{{ errorMsg }}</text>
        <text wx:if="{{!errorFlag && giveUserId}}">昵称：{{nickname}}</text>
      </view>
    </view>
    <view class="give-num-input">
      <van-field  model:value="{{giveNum}}" bind:change="changeNumInput" type="number" label="转赠次数" placeholder="请输入转赠次数" required  style="display: block" />
      <view class="error" >
        <span>{{ errorNum }}</span>
      </view>
    </view>
    <view class="line"></view>
    <view class="bottom-btns">
      <view class="btn cancel" bindtap="closeGivePop">取消</view>
      <view class="btn comfirm" bindtap="giveProject">确定</view>
    </view>
  </view>
</van-popup>


<shopfoot></shopfoot>
