<!--pages/my/my.wxml-->
<wxs src="../../utils/tools.wxs" module="tools" />
<view class="searchResult-page">
  <guide title="我的主页"></guide>
  <!-- <view style="margin:30rpx 0 0 31rpx">
    <userInfo phone="{{userInfo.phone}}" realName="{{true}}" />
  </view> -->
  <view class="userInfo_box">
    <image class="avatar" src="/assets/images/searchResult/a-ziyuan106@2x.png"></image>
    <view>
      <view bindtap="show" class="username">{{userInfo.phone}}<image class="icon_noCertificate" src="/assets/images/searchResult/{{userInfo.realName?'':'no'}}Certificate.png"></image>
      </view>
      <!-- <view class="checkInfo">已有{{consumer.accessTimes}}人次查看，{{consumer.totalSize===0?'暂无人评价':'共获得'+consumer.totalSize+'次评价'}}</view> -->
      <view class="btn_switch" bindtap="showDialogSwitchAccount">
        <image class="icon_switch" src="/assets/images/my/icon_switch.png"></image>切换号码
      </view>
    </view>
  </view>

  <shadow position="center" wx:if="{{visible}}">
    <view class="dialog dialog_center" style="height: initial;">
      <btnClose bindtap="close" />
      <view class="dialog_title">实名认证</view>
      <view class="dialog_content">
        <view class="dialogToLogin">
          <text>{{dialogCard?'创建口碑名片需先通过“全国人力资源信息数据验证平台”实名认证。':'手机号码已完成全国人力资源信息数据验证平台实名认证的用户，将通过“实名认证”标签展示，用户可前往“全国人力资源信息数据验证平台”小程序完成本人实名认证。'}}</text>
          <btn fontSize="24rpx" width="374rpx" height="64rpx" bindtap="goChrivc">前往认证</btn>
        </view>
      </view>
    </view>
  </shadow>

  <view class="layout_f">
    <view class="scoreLayout">
      <view style="display: flex;align-items: center;justify-content: center;">
        <view class="score" wx:if="{{consumer.totalSize>0}}">{{tools.toFix(consumer.totalAverage)}}</view>
        <star score="{{consumer.totalAverage}}" starType="stars_half" size="34rpx" />
      </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>{{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> -->
        <btn wx:if="{{!consumer.totalSize>0}}" style="display: flex;align-items: center;justify-content: center;" type="primary" plain fontSize="24rpx" width="207rpx" height="51rpx" bindtap="handleRecords" data-size="{{consumer.totalSize}}">
          邀请好友评价
          <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
        </btn>
        <btn wx:else style="display: flex;align-items: center;justify-content: center;" bindtap="handleComment" type="primary" plain fontSize="24rpx" width="207rpx" height="51rpx" bindtap="handleRecords" data-size="{{consumer.totalSize}}">查看详情记录
          <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png" />
        </btn>
      </view>

      <!-- <view class="commentText" wx:if="{{consumer.totalSize>0}}">其中实名认证用户<text>{{consumer.realNameSize}}</text>次，实名认证用户平均评价<text>{{tools.toFix(consumer.realNameAverage)}}</text></view>
      <view class="noComment" wx:else>暂无评价</view>
      <view style="display: flex;justify-content: center;">
        <btn wx:if="{{!consumer.totalSize>0}}" type="primary" plain fontSize="24rpx" width="207rpx" height="51rpx" bindtap="handleRecords" data-size="{{consumer.totalSize}}">
          邀请好友评价
          <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
        </btn>
        <btn wx:else type="primary" plain fontSize="24rpx" width="207rpx" height="51rpx" bindtap="handleRecords" data-size="{{consumer.totalSize}}">查看详情记录
          <image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png" />
        </btn>
      </view> -->
    </view>
    <!-- <view class="line"></view> -->
    <view class="container">
      <tagList consumer="{{consumer}}" bind:showTagList="handleTagRecord" isSelf="true" />
      <view class="reportLayout">
        <image src="/assets/images/searchResult/icon_report.png" class="icon_report_cover"></image>
        <view style="flex:1">
          <view class="title">全国人力资源信息数据验证平台个人信息报告</view>
          <view class="flex spaceBetween">
            <btn wx:if="{{consumer.electronicCertificateId===null}}" fontSize="24rpx" width="137rpx" height="51rpx" plain bindtap="dialogAddReportShow">去添加<image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
            </btn>
            <btn wx:else fontSize="24rpx" width="168rpx" height="51rpx" plain bindtap="goReports" data-id="{{consumer.electronicCertificateId}}">查看/修改<image class="icon_arrow_right" src="/assets/images/searchResult/icon_arrow_right.png"></image>
            </btn>
            <view>
              <image class="icon_question" src="/assets/images/my/icon_question.png"></image>
              <text class="questionText" bindtap="dialogInviteShow">这是什么？</text>
            </view>
          </view>
        </view>
      </view>
      <view class="btn_clear" bindtap="handleClear">
        <image class="icon_clear" src="/assets/images/my/icon_clear.png"></image>清空评价数据
      </view>
      <view class="btns_fixed_bottom" style="display: flex;justify-content: space-between;">
        <btn fontSize="28rpx" width="220rpx" height="88rpx" plain bindtap="handleSearchOther" type="default1" fontColor="#7A7A7A">查他人号码</btn>
        <btn fontSize="28rpx" width="220rpx" height="88rpx" plain bindtap="handleCard" style="margin-left: 14rpx;">口碑名片</btn>
        <btn fontSize="28rpx" width="220rpx" height="88rpx" bindtap="handleShare" style="margin-left: 14rpx;" bindtap="showDialogShare">邀请好友评价</btn>
      </view>
    </view>
  </view>

  <!-- 评价记录 -->
  <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" style="width: 100%;">
                  <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" style="width: 100%;align-items: center;">
                  <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" style="height: initial;">
      <btnClose bindtap="dialogToLoginClose" />
      <view class="dialog_title">标题</view>
      <view class="dialog_content">
        <view class="dialogToLogin">
          <text>全国人力资源信息数据验证平台是具有国家公信力的人力资源信息数据库，致力于为社会提供全链条人力资源信息溯源服务。个人信息报告是在当事人的授权或直接操作下，根据【全国人力资源信息数据验证平台】的国家人力资源信息数据库中留存的数据记录生成，所有数据项均可溯源防伪，报告记录和查验记录均永久保存留档。</text>
          <btn fontSize="24rpx" width="374rpx" height="64rpx">去添加个人信息报告</btn>
          <!-- <btn type="default" width="156rpx" height="49rpx" fontSize="24rpx" style="margin-top:30rpx;margin-bottom:50rpx">详情记录></btn> -->
        </view>
      </view>
    </view>
  </shadow>

  <shadow position="center" wx:if="{{dialogRecords}}">
    <view class="dialog dialog_center" style="height: initial;">
      <btnClose bindtap="dialogRecordsClose" />
      <view class="dialog_title">提示</view>
      <view class="dialog_content">
        <view class="dialogToLogin">
          <text>当您被评价的人数达到{{checkCondition}}人后，可开通查看权限，当前评价人数{{consumer.totalSize}}人</text>
          <btn fontSize="24rpx" width="295rpx" height="64rpx" bindtap="showDialogShare">邀请好友评价</btn>
        </view>
      </view>
    </view>
  </shadow>

  <shadow position="center" wx:if="{{dialogAddReport}}">
    <view class="dialog dialog_center" style="height: initial;">
      <btnClose bindtap="dialogAddReportClose" />
      <view class="dialog_title">提示</view>
      <view class="dialog_content">
        <view class="dialogToLogin">
          <text style="font-size: 24rpx;font-family: PingFang SC;font-weight: 500;color: #A1A1A1;">全国人力资源信息数据验证平台是具有国家公信力的人力资源信息数据库，致力于为社会提供全链条人力资源信息溯源服务。个人信息报告是在当事人的授权或直接操作下，根据【全国人力资源信息数据验证平台】的国家人力资源信息数据库中留存的数据记录生成，所有数据项均可溯源防伪，报告记录和查验记录均永久保存留档。</text>
          <btn fontSize="24rpx" width="295rpx" height="64rpx" bindtap="goReports">去添加个人信息报告</btn>
        </view>
      </view>
    </view>
  </shadow>

  <shadow position="center" wx:if="{{dialogClear}}">
    <view class="clearLayout">
      <view class="title">清空所有评价数据</view>
      <view class="content">为确保操作为用户本人，您需要进行一次实名认证，费用<text>￥{{money}}</text>。清空后所有的分数和印象标签将清零。</view>
      <view class="form">
        <view class="formItem">
          <input type="text" placeholder="真实姓名" model:value="{{form_name}}" />
        </view>
        <view class="formItem">
          <input type="text" placeholder="手机号码" model:value="{{form_phone}}" disabled="true" />
        </view>
      </view>
      <btn width="100%" height="80rpx" fontSize="28rpx" bindtap="handleConfirmPay">提交认证，确认支付</btn>
      <view class="exit" bindtap="handleCloseClear">退出</view>
    </view>
  </shadow>

  <shadow position="bottom" wx:if="{{dialogGoPay}}">
    <view class="payLayout">
      <btnClose bindtap="closeDialogGoPay" />
      <view class="payMoney">￥<text>{{money}}</text></view>
      <view class="payType">
        <view class="payName">
          <image class="icon_wxPay" src="/assets/images/pay/icon_wxPay.png"></image>微信支付
        </view>
        <image class="gou" src="/assets/images/pay/gougou@2x.png"></image>
      </view>
      <view class="btn_goPay">
        <btn height="80rpx" width="505rpx" fontSize="28rpx" bindtap="goPay">确认支付</btn>
      </view>
    </view>
  </shadow>

  <dialog visible="{{dialogInvite}}" position="my" isSelf="true" bind:close="closeInvite" />

  <shadow position="center" wx:if="{{dialogShare}}">
    <view class="shareLayout">
      <view class="shareBox">
        <image class="avatar" src="/assets/images/searchResult/a-ziyuan106@2x.png"></image>
        <view class="phone">{{userInfo.phone}}</view>
        <view class="contentText">“邀请您到【与评™】上对我做出印象评价，国家平台隐私保护，完全匿名”</view>
        <star score="0" starType="cStars" size="40rpx" />
        <image class="sharePic" src="https://chrivc.obs.cn-north-4.myhuaweicloud.com/4b02ae3ccca446df82aa7ba1d7fa591e:sharePic.png"></image>
      </view>
      <view class="shareOption">
        <view class="shareTitle">分享至</view>
        <view class="options">
          <!-- open-type="share" -->
          <button class="option" open-type="share">
            <image src="/assets/images/my/icon_wechat.png"></image>
            <view>微信好友</view>
          </button>
          <!--  open-type="share" -->
          <button class="option" bindtap="goShareTimeLine">
            <image src="/assets/images/my/icon_wxFriend.png"></image>
            <view>朋友圈</view>
          </button>
        </view>
      </view>
      <image class="icon_close" src="/assets/images/my/icon_close.png" bindtap="closeDialogShare"></image>
    </view>
  </shadow>

  <shadow position="center" wx:if="{{dialogSwitchAccount}}">
    <view class="swichAccountBox">
      <btnClose bindtap="closeDialogSwichAccount" />
      <view class="title">切换号码</view>
      <view class="phoneList">
        <view class="phoneItem" wx:for="{{accountList}}" bindtap="accountChange" data-id="{{item.id}}">
          <view class="left">
            <image src="/assets/images/my/icon_phone.png" class="icon_phone"></image>
            <text>{{item.phone}}</text>
          </view>
          <view class="current" wx:if="{{userInfo.phone===item.phone}}">当前号码</view>
          <view class="btn_switch" wx:else>切换</view>
        </view>
      </view>
      <btn width="295rpx" height="64rpx" class="flex flex_center" bindtap="goBind">绑定其他号码</btn>
    </view>
  </shadow>

  <shadow position="bottom" wx:if="{{dialogTagRecord}}">
    <view class="dialog" style="max-height: 90%;height:initial">
      <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>