<!--pages/searchResult/searchResult.wxml-->
<wxs src="../../utils/tools.wxs" module="tools" />
<view class="searchResult-page {{popup?'page-overflow-hidden':''}}">
  <guide title="查号码" realName="{{accountList.length>0}}"></guide>
  <userInfo phone="{{phone}}" realName="{{consumer.realName}}" />
  <!-- <view class="zhanwei"></view> -->

  <view class="overflowBox">
    <view wx:if="{{!consumer.evaluatedScore}}" class="noRatingValue">分数已隐藏</view>
    <view wx:elif="{{!consumer.totalSize>0}}" class="noRatingValue">暂无评价</view>
    <view wx:else class="ratingValue">{{tools.toFix(consumer.totalAverage)}}</view>

    <view>
      <star score="{{consumer.totalAverage}}" starKey="t" />
    </view>

    <view class="commentDataBox">
      <view class="date">
        <filter wx:if="{{consumer.firstEvaluateTime}}" type="parseTime" value="{{consumer.firstEvaluateTime}}" params="{{['{y}年{m}月{d}日']}}" />至今：
      </view>
      <view class="unRealName">已有 {{consumer.accessTimes}} 人次查看，共获得 {{consumer.totalSize}} 次评价</view>
      <view class="realName">其中实名认证用户 <text>{{consumer.realNameSize}}</text> 次 实名认证用户平均评价 <text>{{consumer.evaluatedScore?tools.toFix(consumer.realNameAverage):'**'}}</text></view>
      <btn wx:if="{{!consumer.evaluatedScore}}" type="info" plain width="271rpx" height="49rpx" style="display: flex;align-items: center;justify-content: center;margin-top:12rpx" bindtap="handleComment">评价对方可查看分数</btn>
      <view wx:elif="{{consumer.evaluatedScore!==null}}" class="detailText" bindtap="handleCommentRecord">详情记录></view>
      <btn wx:else type="default" width="156rpx" height="49rpx" fontSize="24rpx" style="margin-top:30rpx;" bindtap="handleCommentRecord">查看详情记录></btn>
    </view>
    <view style="margin-top: 20rpx;">
      <view class="layout">
        <view class="layout_top">
          <view class="layout_title">印象标签</view>
          <view wx:if="{{consumer.labelVoList&&consumer.evaluatedScore}}" class="layout_operation" bindtap="handleTagRecord">查看所有印象标签
            <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
          </view>
        </view>
        <view class="noTag" wx:if="{{!consumer.labelVoList}}">暂未收到任何印象标签</view>
        <view class="tagList" wx:else>
          <block wx:if="{{!consumer.evaluatedScore}}">
            
          </block>
          <block wx:else>
            <view plain class="tagItem " wx:for="{{consumer.labelVoList}}">
              <text class="{{index>0?'filter_blur':''}}">{{item.content}}</text>
              <view class="numTag">x{{item.contentCount}}</view>
            </view>
          </block>

        </view>
        <!-- !consumer.evaluatedScore -->
        <view class="count" wx:if="{{consumer.labelVoList}}">
          <!-- 共收到{{consumer.labelCount}}条印象标签，其中“{{consumer.labelVoList[0].content}}”获得了{{consumer.labelVoList[0].contentCount}}次点击 -->
          共收到{{consumer.labelCount}}条印象标签{{!consumer.evaluatedScore?'':'，其中“'+consumer.labelVoList[0].content+'”获得了'+consumer.labelVoList[0].contentCount+'次点击'}}
        </view>
      </view>

      <view class="layout" style="margin-bottom: 140rpx;">
        <view class="layout_top">
          <view class="layout_title">全国人力资源信息数据验证平台个人信息报告</view>
        </view>
        <view class="imgText">
          <image class="icon_report" src="/assets/images/searchResult/icon_report.png"></image>
          <view class="text" wx:if="{{!userInfo.realName}}">
            对方尚未进行全国人力资源信息数据验证平台实名认证，暂未提供个人信息报告，您可申请查验，邀请对方实名认证并授权报告
          </view>
          <view class="text" wx:elif="{{consumer.electronicCertificateId===null}}">
            对方已进行全国人力资源信息数据验证平台实名认证，暂未提供个人信息报告查询通道，您可以邀请对方授权报告
          </view>
          <view class="text" wx:else>
            对方已进行全国人力资源信息数据验证平台实名认证，并已授权个人信息报告
          </view>
        </view>

        <view class="align_center">
          <btn wx:if="{{consumer.realName===null}}" type="member" plain width="207rpx" height="51rpx" bindtap="showDialogInvite">邀请实名认证
            <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
          </btn>
          <btn wx:elif="{{consumer.electronicCertificateId===null}}" type="member" plain width="207rpx" height="51rpx" bindtap="showDialogInvite">邀请授权报告
            <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
          </btn>
          <btn wx:elif="{{!consumer.evaluatedScore}}" type="member" plain width="250rpx" height="51rpx" bindtap="handleComment">评价对方可查看报告
            <!-- <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image> -->
          </btn>
          <btn wx:else type="member" plain width="207rpx" height="51rpx" bindtap="goReport" data-id="{{consumer.electronicCertificateId}}">立即查看
            <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
          </btn>
        </view>
      </view>
    </view>
  </view>
  <view class="zhanwei"></view>
  <view class="btn_operation">
    <button class="btn_share" open-type="share">
      <image src="/assets/images/searchResult/fenxiang@2x.png"></image>分享
    </button>
    <view class="btn_comment" bindtap="handleComment">
      <view class="commented" wx:if="{{consumer.evaluatedScore}}">
        <view>我已评价</view>
        <view class="score">{{tools.toFix(consumer.evaluatedScore)}}</view>
      </view>
      <view class="unCommented" wx:else>
        <view>还未评价对方，快来评价吧~</view>
      </view>
      <image src="/assets/images/searchResult/dianping@2x.png"></image>{{consumer.evaluatedScore===null?'我要评价':'修改/更新评价'}}
    </view>
  </view>

  <!-- 评价提交 -->
  <shadow position="bottom" wx:if="{{dialogComment}}">
    <view class="dialog" style="max-height: 90%;">
      <btnClose bindtap="dialogCommentClose" />
      <view class="dialog_title">评价对方</view>
      <view class="dialog_subTitle" wx:if="{{!consumer.evaluatedScore}}">评价对方后，即可查看对方与评™数据</view>
      <star score="{{form.score}}" starKey="c" starType="cStars" bind:setScore="handleScore" />
      <view class="cStarScore">{{form.score}}</view>
      <view class="dialog_content" style="overflow: auto;height: 500rpx;">
        <view class="dialog_comment">
          <view class="choosed">
            <view class="label">印象标签：</view>
            <view class="c_tagList">
              <view class="c_tagItem tagActive" wx:for="{{tagList}}" wx:key="id" bindtap="deleteTag" data-id="{{item.id}}" data-item="{{item}}">
                {{item.content}}
                <view class="deleteTag">x</view>
              </view>
            </view>
          </view>
          <view class="line"></view>
          <view class="c_tagList">
            <view class="c_tagListGroup" wx:for="{{tagListOrigin}}">
              <!-- <view class="c_tagItem {{ item.checked?'tagActive':'' }}" wx:for="{{tagListOrigin}}" wx:key="id" bindtap="handleSelectedTag" data-item="{{item}}">
                {{item.content}}
              </view> -->
              <view class="c_tagItem {{ group.checked?'tagActive':'' }}" wx:for="{{item}}" wx:key="id" wx:for-item="group" bindtap="handleSelectedTag" data-item="{{group}}">
                {{group.content}}
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="align_center">
        <btn fontSize="34rpx" style="margin-bottom:20rpx;margin-top: 20rpx;" width="501rpx" height="88rpx" bindtap="submitComment">提交</btn>
      </view>
      <view class="align_center" wx:if="{{!consumer.evaluatedScore}}">
        <btn type="member" style="margin-bottom:20rpx" plain fontSize="34rpx" width="501rpx" height="88rpx" bindtap="submitAvgComment">不太了解，先评价一般</btn>
      </view>
      <view class="tip">提示：提交后可再次修改更新评价</view>
    </view>
  </shadow>
  <!-- 评价记录 -->
  <shadow position="bottom" wx:if="{{dialogCommentRecord}}">
    <view class="dialog" style="max-height: 90%;">
      <btnClose bindtap="dialogCommentRecordClose" />
      <view class="dialog_title">评价记录</view>
      <view class="dialog_content">
        <view class="recordList">
          <view class="recordItem" wx:for="{{commentRecordList}}" wx:key="{{item.id}}">
            <image src="/assets/images/searchResult/icon_avatar_{{item.realName?'primary':'default'}}.png" class="avatar"></image>
            <view class="detail">
              <view class="top">
                <view class="flex spaceBetween">
                  <view class="username">来自匿名用户<image wx:if="{{item.realName}}" class="icon_realName" src="/assets/images/searchResult/icon_rz.png"></image>
                  </view>
                  <star starType="stars_half" score="{{item.score}}" />
                </view>
                <view class="flex spaceBetween">
                  <view class="time">{{tools.dateFormat(now,item.createDate)}}</view>
                  <view class="score"><text class="score">{{tools.toFix(item.score)}}</text> 分</view>
                </view>
              </view>
              <view class="bottom">
                <view class="recordTagList">
                  <view class="recordTagItem" wx:for="{{item.evaluateLabelContent}}" wx:for-item="label" wx:for-index="idx">
                    {{label}}
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </shadow>
  <!-- 未登录提示 -->
  <shadow position="center" wx:if="{{dialogToLogin}}">
    <view class="dialog dialog_center">
      <btnClose bindtap="dialogToLoginClose" />
      <view class="dialog_title">提示</view>
      <view class="dialog_content">
        <view class="dialogToLogin">
          <text>当您被评价的人数达到{{checkCondition}}人后，可开通查看权限，{{accountList.length > 0?'当前评价人数'+ userInfo.evaluatedTimes+'人':'请先登录账号'}}</text>
          <btn fontSize="24rpx" width="374rpx" height="64rpx" wx:if="{{!accountList.length > 0}}" bindtap="goMy">去登录并查看我的评价信息</btn>
        </view>
      </view>
    </view>
  </shadow>
  <!-- 邀请实名认证提示框 -->
  <dialog visible="{{dialogInvite}}" bind:close="closeInvite" />
  
  <shadow position="bottom" wx:if="{{dialogTagRecord}}">
    <view class="dialog" style="max-height: 90%;">
      <btnClose bindtap="dialogTagRecordClose" />
      <view class="dialog_title" style="margin-bottom: 56rpx;">印象标签({{tagRecordTotal}})</view>
      <view class="dialog_content">
        <view class="tagList">
          <view plain class="tagItem" wx:for="{{tagRecordList}}">
            <text>{{item.content}}</text>
            <view class="numTag">x{{item.contentCount}}</view>
          </view>
        </view>
      </view>
    </view>
  </shadow>
</view>