ll
liukangdong
2024-09-11 de0e3ab6247895cb9a375fb3c37e659b2297151c
h5/pages/staff/task/visitorApprove.vue
@@ -1,351 +1,576 @@
<template>
   <view class="main_app">
      <view class="status_wrap">
         <view class="name">丁恩凯的访客申请</view>
         <view class="desc">等待我处理</view>
         <view class="box_list_status">审批中</view>
      </view>
      <!--  -->
      <view class="emyty"></view>
      <view class="module_list">
         <view class="item">
            <text class="label">拜访人</text>
            <text class="value">廖成瑶</text>
         </view>
         <view class="item">
            <text class="label">预计入/离厂时间</text>
            <text class="value">05/01 8:00 - 05/01 18:00</text>
         </view>
         <view class="emyty"></view>
         <view class="item">
            <text class="label">访客信息</text>
            <text class="value">
               <image class="avatar" src="@/static/logo@2x.png" mode="widthFix"></image>
               <view class="info">
                  <text class="name">孙志 18177665678</text>
                  <text>身份证号:3309****2910</text>
                  <text>入园车辆:皖A88789</text>
               </view>
            </text>
         </view>
         <view class="item">
            <text class="label">公司名称</text>
            <text class="value">中国移动</text>
         </view>
         <view class="item">
            <text class="label">施工人员</text>
            <text class="value">否</text>
         </view>
         <view class="item">
            <text class="label">来访事由</text>
            <text class="value">业务洽谈</text>
         </view>
      </view>
      <view class="box_list">
         <view class="box_list_title">流程</view>
         <view class="box_list_list">
            <view class="box_list_list_item">
               <view class="left">
                  <view class="left_d"></view>
                  <view class="left_x"></view>
               </view>
               <view class="right">
                  <view class="right_top">
                     <text>栓子哥提交的申请</text>
                     <text>2023-05-01 08:00</text>
                  </view>
                  <view class="right_bottom">
                     <text>安徽豆米科技有限公司</text>
                  </view>
               </view>
            </view>
            <view class="box_list_list_item">
               <view class="left">
                  <view class="left_d"></view>
                  <view class="left_x"></view>
               </view>
               <view class="right">
                  <view class="right_top">
                     <text>拜访员工</text>
                     <text>2023-05-01 08:00</text>
                  </view>
                  <view class="right_bottom">
                     <text>王亚蓝(<text class="blue">审核通过</text>)</text>
                  </view>
               </view>
            </view>
            <view class="box_list_list_item">
               <view class="left">
                  <view class="left_d"></view>
                  <view class="left_x"></view>
               </view>
               <view class="right">
                  <view class="right_top">
                     <text>审批人</text>
                     <text>2023-05-01 08:00</text>
                  </view>
                  <view class="right_bottom">
                     <text>马总(<text class="blue">待审核</text>)</text>
                  </view>
               </view>
            </view>
         </view>
      </view>
   </view>
  <view class="main_app">
    <view class="status_wrap">
      <view class="name">{{ info.name }}提交的{{ cateList[type].name }}</view>
      <view
        class="desc"
        :class="{
          gray: info.businessStatus == '2' || info.businessStatus == '3' || info.businessStatus == '4',
        }"
        >{{ infoStatus }}</view
      >
      <view v-if="info.businessStatus == '0' || info.businessStatus == '1'" class="status">{{
        statusMap[info.businessStatus]
      }}</view>
      <image
        v-if="info.businessStatus == '2'"
        src="@/static/ic_passed@2x.png"
        mode="widthFix"
        class="status_img"
      ></image>
      <image
        v-if="info.businessStatus == '3'"
        src="@/static/ic_refused@2x.png"
        mode="widthFix"
        class="status_img"
      ></image>
    </view>
    <!--  -->
    <view class="emyty"></view>
    <view class="module_list">
      <view class="item">
        <view class="label">被访人</view>
        <view class="value">{{ info.visitUserName }}</view>
      </view>
      <view class="item">
        <view class="label">预计入/离园时间</view>
        <view class="value" v-if="info.visitTime">{{ info.visitTime }}</view>
      </view>
      <view class="emyty"></view>
      <view class="item">
        <view class="label">访客信息</view>
        <view class="value">
          <image
            class="avatar"
            :src="
              info.prefix
                ? info.prefix + info.faceImg
                : require('@/static/meeting/common/default_user@2x.png')
            "
            mode="widthFix"
          ></image>
          <view class="info">
            <text class="name">{{ info.name }} {{ info.phone }}</text>
            <text>身份证号:{{ info.idCardDecode }}</text>
            <text>入园车辆:{{ info.carNos }}</text>
          </view>
        </view>
      </view>
      <view class="item">
        <view class="label">公司名称</view>
        <view class="value">{{ info.companyName }}</view>
      </view>
      <view class="item">
        <view class="label">施工人员</view>
        <view class="value">{{ info.type == 0 ? "否" : "是" }}</view>
      </view>
      <view class="item">
        <view class="label">来访事由</view>
        <view class="value">{{ info.visitReason }}</view>
      </view>
    </view>
    <!-- 流程 -->
    <view class="flow_wrap">
      <view class="flow_title">流程</view>
      <view
        class="list"
        v-if="
          info.approveDateVO != null && info.approveDateVO.approveList != null
        "
      >
        <view
          class="item"
          v-for="(item, index) in info.approveDateVO.approveList"
          :key="item.id"
        >
          <view class="separate"></view>
          <view class="avatar">
                  <image
                     v-if="item.type == 1"
                    class="img"
                    src="@/static/staff/ic_chaosong@2x.png"
                  />
            <image
               v-else-if="item.approveType == 1 || item.approveType == 0"
              class="img"
              src="@/static/staff/ic_shenpiren@2x.png"
            />
                  <span v-else class="img_name">{{item.memberName && item.memberName.slice(0,1)}}</span>
            <image
               v-if="item.status == 2"
              class="status"
              src="@/static/staff/liucheng_success@2x.png"
              mode="widthFix"
            />
            <image
               v-if="item.status == 3"
              class="status"
              src="@/static/staff/liucheng_fail@2x.png"
              mode="widthFix"
            />
          </view>
          <view class="content">
            <view class="head">
              <view class="event">{{ item.title }}</view>
              <view class="time">{{ item.checkDate }}</view>
            </view>
            <view class="name_wrap">
              <text
                >{{ item.memberName
                }}<text :class="{ status: item.statusInfo == '处理中' || item.status == '1'  }" v-if="item.statusInfo"
                  >({{ item.statusInfo }})</text
                ></text
              >
            </view>
            <view v-if="item.checkInfo" class="remark">{{
              item.checkInfo
            }}</view>
            <!-- 抄送人 -->
            <view v-if="item.approveType == 0 || item.type == 1 || item.approveType == 1" class="children">
              <view
                class="child"
                v-for="child in item.approveList"
                :key="child.id"
              >
                <image
                           v-if="child.faceImg"
                  class="child_img"
                  :src="child.faceImg"
                />
                        <view v-else class="child_name">{{ child.memberName && child.memberName.slice(0,1) }}</view>
                <view>{{ child.memberName }}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
    <view class="emyty"></view>
    <view
      v-if="
        info.approveDateVO != null &&
        info.approveDateVO.canBeApproved != null &&
        info.approveDateVO.canBeApproved == 1
      "
      class="main_footer"
    >
      <view class="btn" @click="handleSub(3)">拒绝</view>
      <view class="btn agree" @click="handleSub(2)">同意</view>
    </view>
    <u-popup
      :show="showApprModal"
      :round="10"
      :safeAreaInsetBottom="true"
      mode="bottom"
      @close="showApprModal = false"
    >
      <view class="appr_modal">
        <view class="title">{{ param.status == 2 ? "同意" : "拒绝" }}</view>
        <textarea
          v-model="param.checkInfo"
          :placeholder="
            param.status == 2 ? '同意说明,非必填' : '拒绝说明,必填'
          "
          placeholder-class="placeholder9"
        />
        <view class="main_footer">
          <view class="btn" @click="showApprModal = false">取消</view>
          <view class="btn agree" @click="onSubmit">提交</view>
        </view>
      </view>
    </u-popup>
  </view>
</template>
<script>
   export default {
      data() {
         return {
         };
      }
   }
import {
  getVisitedDetail, // 访客预约详情
  carUseBookAppr
} from '@/api'
export default {
  data() {
    return {
      showApprModal: false,
      param: {},
      info: {},
      id: '',
      type: '',
         infoStatus: '',
      cateList: [
        { name: '访客申请', id: 0 },
        { name: '访客报备', id: 1 },
        { name: '用车申请', id: 2 },
        { name: '隐患随手拍', id: 3 },
        { name: '物流车申请', id: 4 },
      ],
      statusMap: {
        0: '待审批',
        1: '审批中',
        2: '已通过',
        3: '已拒绝',
        4: '已取消',
      }
    }
  },
  onLoad(op) {
    this.id = op.id
    this.type = op.objType
    this.infoStatus = op.info
    this.getDetail()
  },
  methods: {
    getDetail() {
      const { id } = this
      getVisitedDetail({ id }).then(res => {
        this.info = res.data
            if(this.info.approveDateVO && this.info.approveDateVO.approveList.length > 0 ){
               this.info.approveDateVO.approveList.forEach(item => {
                  if(item.approveList && item.approveList.length == 1 && item.type !== 1){
                     item.title = item.approveList[0].title
                     item.faceImg = item.approveList[0].faceImg
                     item.memberName = item.approveList[0].memberName
                     item.statusInfo = item.approveList[0].statusInfo
                     item.status = item.approveList[0].status
                     item.approveList = []
                  }
               })
            }
      })
    },
    onSubmit() {
      const { param, info } = this
         if(param.status == '3' && !param.checkInfo){
            return uni.showToast({
              title: '请输入拒绝说明',
              icon: 'none'
            })
         }
      carUseBookAppr({
        status: param.status,
        objType: info.type,
        objId: this.id,
        // driverId: param.driverId,
        checkInfo: param.checkInfo
      }).then(res => {
        if (res.code === 200) {
          this.showApprModal = false
          setTimeout(() => {
            uni.showToast({
              title: '操作成功',
              icon: 'success'
            })
          })
          uni.navigateBack()
        }
      })
    },
    handleSub(status) {
      // this.param.flag =
      this.param = {
        status
      }
      this.showApprModal = true
    },
  },
}
</script>
<style>
   page {
      background-color: #F7F7F7;
   }
page {
  background-color: #f7f7f7;
}
</style>
<style lang="scss" scoped>
   .box {
      width: 100%;
      .p {
         padding: 0 30rpx !important;
      }
      .box_list {
         width: 100%;
         padding: 30rpx;
         box-sizing: border-box;
         background-color: #ffffff;
         display: flex;
         flex-direction: column;
         margin-bottom: 20rpx;
         position: relative;
         .box_list_title {
            font-size: 32rpx;
            font-weight: 500;
            color: #222222;
            margin-bottom: 24rpx;
         }
         .box_list_list {
            width: 100%;
            display: flex;
            flex-direction: column;
            .box_list_list_item {
               width: 100%;
               display: flex;
               align-items: flex-start;
               margin-bottom: 36rpx;
               &:last-child {
                  margin: 0;
               }
               .left {
                  flex-shrink: 0;
                  height: 100%;
                  position: relative;
                  .left_d {
                     width: 16rpx;
                     height: 16rpx;
                     background: #81AFF7;
                     border-radius: 50%;
                     position: relative;
                     z-index: 2;
                  }
                  .left_x {
                     position: absolute;
                     top: 0;
                     left: 8rpx;
                     width: 1rpx;
                     height: 130rpx;
                     background-color: #EEEEEE;
                  }
               }
               .right {
                  flex: 1;
                  display: flex;
                  flex-direction: column;
                  margin-left: 30rpx;
                  .right_top {
                     width: 100%;
                     display: flex;
                     align-items: center;
                     justify-content: space-between;
                     text {
                        &:first-child {
                           font-size: 30rpx;
                           font-family: PingFangSC, PingFang SC;
                           font-weight: 400;
                           color: #333333;
                        }
                        &:last-child {
                           font-size: 24rpx;
                           font-family: PingFangSC, PingFang SC;
                           font-weight: 400;
                           color: #999999;
                        }
                     }
                  }
                  .right_bottom {
                     width: 100%;
                     margin-top: 10rpx;
                     text {
                        font-size: 26rpx;
                        font-weight: 400;
                        color: #777777;
                     }
                     .blue {
                        color: #025EEF !important;
                     }
                  }
               }
            }
         }
         .box_list_item1 {
            width: 100%;
            padding: 30rpx 0;
            box-sizing: border-box;
            display: flex;
            align-items: flex-start;
            flex-wrap: wrap;
            justify-content: space-between;
            border-bottom: 1rpx solid #E5E5E5;
            .box_list_item1_head {
               width: 100%;
               font-size: 26rpx;
               font-weight: 400;
               color: #777777;
               margin-bottom: 24rpx;
            }
            .box_list_item_img {
               width: 100rpx;
               height: 100rpx;
               flex-shrink: 0;
               border-radius: 8rpx;
<style lang="scss">
.main_app {
  background-color: #fff;
  padding-bottom: 0;
  .flow_wrap {
    padding: 30rpx 0;
    .flow_title {
      font-weight: 600;
      font-size: 32rpx;
      color: #222222;
      margin-bottom: 24rpx;
    }
    .list {
      .item {
        display: flex;
        margin-bottom: 48rpx;
        position: relative;
        .separate {
          position: absolute;
          width: 4rpx;
          height: 100%;
          background-color: #eeeeee;
          left: 40rpx;
          transform: translate(-50%, 0);
          top: 80rpx;
        }
        .avatar {
          width: 80rpx;
          height: 80rpx;
          position: relative;
          margin-right: 20rpx;
               display: flex;
               align-items: center;
               justify-content: center;
               overflow: hidden;
               border: 1rpx solid #EEEEEE;
               margin-right: 20rpx;
               image {
                  width: 100%;
                  height: 100%;
               }
            }
            .box_list_item_info {
               flex: 1;
               display: flex;
               flex-direction: column;
               text {
                  &:nth-child(1) {
                     font-size: 28rpx;
                     font-weight: 400;
                     color: #222222;
                  }
                  &:nth-child(2) {
                     font-size: 28rpx;
                     font-weight: 400;
                     color: #222222;
                     margin-top: 20rpx;
                  }
                  &:nth-child(3) {
                     font-size: 28rpx;
                     font-weight: 400;
                     color: #222222;
                     margin-top: 20rpx;
                  }
          .img {
            width: 80rpx;
            height: 80rpx;
            border-radius: 50%;
          }
               .img_name{
                  font-size: 32rpx;
                  color: #FFFFFF;
               }
            }
         }
         .box_list_item {
            width: 100%;
            padding: 30rpx 0;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            border-bottom: 1rpx solid #E5E5E5;
            .box_list_item_img {
               width: 100rpx;
               height: 100rpx;
               border-radius: 8rpx;
               display: flex;
               align-items: center;
               justify-content: center;
               overflow: hidden;
               border: 1rpx solid #EEEEEE;
               margin-top: 24rpx;
               image {
                  width: 100%;
                  height: 100%;
               }
            }
            text {
               &:nth-child(1) {
                  font-size: 26rpx;
                  font-weight: 400;
                  color: #777777;
               }
               &:nth-child(2) {
                  font-size: 28rpx;
                  font-weight: 400;
                  color: #222222;
                  margin-top: 20rpx;
               }
               &:nth-child(3) {
                  font-size: 28rpx;
                  font-weight: 400;
                  color: #222222;
                  margin-top: 20rpx;
               }
               &:nth-child(4) {
                  font-size: 28rpx;
                  font-weight: 400;
                  color: #222222;
                  margin-top: 20rpx;
               }
            }
         }
         .box_list_name {
            font-size: 32rpx;
            font-weight: 500;
            color: #222222;
         }
         .box_list_job {
            font-size: 26rpx;
            font-weight: 400;
            color: #666666;
            margin-top: 20rpx;
         }
         .box_list_status1 {
            position: absolute;
            right: 30rpx;
            top: 50%;
            transform: translate(0, -50%);
            width: 120rpx;
            height: 120rpx;
            image {
               width: 100%;
               height: 100%;
            }
         }
         .box_list_status {
            position: absolute;
            right: 0;
            top: 0;
            width: 140rpx;
            height: 60rpx;
            line-height: 60rpx;
            text-align: center;
            font-size: 26rpx;
            font-weight: 400;
            color: #025EEF;
            background: rgba(66,117,252,0.12);
            border-radius: 0rpx 0rpx 0rpx 30rpx;
         }
      }
   }
          .status {
            width: 28rpx;
            height: 28rpx;
            border-radius: 50%;
            position: absolute;
            right: 0;
            bottom: 0;
          }
        }
        .content {
          flex: 1;
          .head {
            display: flex;
            justify-content: space-between;
            margin-bottom: 4rpx;
            .event {
              font-size: 30rpx;
            }
            .time {
              font-size: 26rpx;
              color: #999999;
            }
          }
          .name_wrap {
            font-size: 26rpx;
            color: #777777;
            .status {
              color: $uni-color-primary;
            }
          }
          .children {
            display: flex;
            flex-wrap: wrap;
            margin-top: 12rpx;
            .child {
              display: flex;
              flex-direction: column;
              justify-content: center;
              align-items: center;
              margin-right: 12rpx;
                     font-size: 26rpx;
                     color: #777777;
              .child_img {
                width: 48rpx;
                height: 48rpx;
                border-radius: 50%;
                        margin-bottom: 2rpx;
              }
                     .child_name{
                        margin-bottom: 2rpx;
                        width: 48rpx;
                        height: 48rpx;
                        text-align: center;
                        justify-content: center;
                        padding-top: 4rpx;
                        font-size: 28rpx;
                        border-radius: 50%;
                        color: #FFFFFF;
                        background-color: $uni-color-primary;
                     }
            }
          }
          .remark {
            margin-top: 12rpx;
            background-color: #f7f7f7;
            padding: 14rpx 20rpx;
            border-radius: 8rpx;
            font-size: 26rpx;
            color: #666666;
            line-height: 36rpx;
          }
        }
        .carbon {
          display: flex;
          width: 590rpx;
          overflow-x: auto;
          margin-top: 12rpx;
          .carbon_item {
            text-align: center;
            flex-shrink: 0;
            width: 100rpx;
            image {
              width: 60rpx;
              height: 60rpx;
              margin: 0 auto;
            }
            view {
              font-size: 26rpx;
              color: #777777;
            }
          }
        }
        &:nth-last-child(1) {
          .separate {
            height: 0;
          }
        }
      }
    }
  }
  .module_list {
    .item {
      padding: 30rpx 0;
      border-bottom: 1rpx solid #e5e5e5;
      .label {
        font-size: 26rpx;
        color: #666666;
        margin-bottom: 20rpx;
      }
      .value {
        font-size: 30rpx;
        display: flex;
        align-items: center;
        .avatar {
          margin-right: 20rpx;
          width: 120rpx;
          height: 120rpx;
          border-radius: 8rpx;
          border: 2rpx solid #e5e5e5;
        }
        .info {
          flex: 1;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          font-size: 26rpx;
          color: #666666;
          .name {
            font-size: 30rpx;
            color: #333333;
          }
        }
      }
    }
  }
  .status_wrap {
    position: relative;
    padding: 30rpx 0;
    .name {
      font-weight: 600;
      font-size: 32rpx;
      margin-bottom: 20rpx;
      color: #222222;
    }
    .desc {
      font-size: 26rpx;
      color: #ed4545;
    }
    .gray {
      color: #999999;
    }
    .status {
      position: absolute;
      right: -30rpx;
      top: 0;
      height: 60rpx;
      line-height: 60rpx;
      padding: 0 32rpx;
      border-radius: 0rpx 0rpx 0rpx 30rpx;
      background-color: #e9edff;
      color: $uni-color-primary;
    }
    .status_img {
      position: absolute;
      right: 0rpx;
      top: 20rpx;
      width: 120rpx;
    }
  }
  .main_footer {
    padding-bottom: 64rpx;
    display: flex;
    justify-content: space-between;
    width: 100%;
    left: 0;
    // padding: 30rpx 10rpx 60rpx;
    display: flex;
    justify-content: space-between;
    background: #ffffff;
    .btn {
      width: 336rpx;
      height: 88rpx;
      line-height: 88rpx;
      background: #ffffff;
      border-radius: 44rpx;
      border: 1rpx solid #999999;
      font-size: 32rpx;
      text-align: center;
      margin: 16rpx 0;
    }
    .agree {
      background: $uni-color-primary;
      color: #fff;
      border: 1rpx solid $uni-color-primary;
    }
  }
  .appr_modal {
    padding: 36rpx 30rpx 0;
    .title {
      font-weight: 600;
      font-size: 32rpx;
      color: #222222;
      margin-bottom: 40rpx;
      text-align: center;
    }
    textarea {
      box-sizing: border-box;
      width: 690rpx;
      background-color: #f7f7f7;
      font-size: 28rpx;
      color: #333333;
      padding: 24rpx;
      border-radius: 8rpx;
      margin-bottom: 30rpx;
    }
  }
  .emyty {
    width: 750rpx;
    height: 20rpx;
    background-color: #f7f7f7;
    margin: 0 -30rpx;
  }
}
</style>