applyList.vue 8.66 KB
<template>
  <view>
    <!--  团队会员审核 -->
    <uni-segmented-control :current="current" :values="navs" activeColor="#AD181F" class="whitebg" styleType="text"
                           @clickItem="onClickItem"></uni-segmented-control>
    <view class="appList">
      <view v-show="statistical.totalCost>0" class="vipData">
        <view>费用合计:
          <text>¥{{ statistical.totalCost.toFixed(2) }}</text>
        </view>
      </view>
      
      <view v-for="(item,index) in list" :key="index" class="appItem">
        <view class="status" @click="goDetail(item)">
          <text v-if="item.auditStatus == 1" class="text-primary">审核中</text>
          <text v-if="item.auditStatus == 2" class="text-success">审核通过</text>
          <text v-if="item.auditStatus == 3" class="text-danger">审核拒绝</text>
        </view>
        <view class="date">
          <uni-icons color="#AD181F" size="16" type="calendar-filled"></uni-icons>
          {{ item.commitTime }} 提交
        </view>
        <view v-if="item.wfCode">{{ item?.wfCode }}
        </view>
        <view class="name w100 mt0" @click="goDetail(item)">
          {{ item.memName }}
        </view>
        <view class="text" @click="goDetail(item)">
          {{ item.shenMemName }}
        </view>
        <view class="flexbox" @click="goDetail(item)">
          <view>
            新会员/年限
            <view>{{ item.isNew == 1 ? '是' : "否" }}
              /{{ item.renewYear }}
            </view>
          </view>
          <view>
            费用合计
            <view> {{ (item.allPrice * 1).toFixed(2) }}</view>
          </view>
          <view>
            政策优惠
            <view>
              <text class="text-danger"> {{ item.discount ? item.discount : '--' }}</text>
            </view>
          </view>
          <view>
            付款费用
            <view>
              <text class="text-warning"> ¥{{ item.finalPrice }}</text>
            </view>
          </view>
          <view>
            协会信息
            <view>
              <text :class="{'text-danger':item.checkPass == 0 }"> {{ item.checkPass == 0 ? '异常' : '正常' }}</text>
            </view>
          </view>
        </view>
        <view class="func">
          <button @click="goGroupInfo(item)">机构资料</button>
          <button v-if="queryParams.auditStatus==1" @click="audit(item.id,'0')">拒绝</button>
          <button v-if="queryParams.auditStatus==1" @click="audit(item.id,'1')">同意</button>
        </view>
        <!-- 省 -->
      </view>
    </view>
    
    <view v-if="list.length==0" class="nodata">
      <image :src="config.baseUrl_api + '/fs/static/nodata.png'" mode="aspectFit"></image>
      <text>暂无数据</text>
    </view>
    <!-- 		<view v-if="userType=='2'" class="block-btn-box">
      <button @click="goMerge" class="btn-red-kx">前往合并 > </button>
    </view> -->
  </view>
</template>

<script setup>
import * as api from '@/common/api.js'
import config from '@/config.js'
import {
  onMounted,
  ref
} from 'vue'
import {
  onLoad
} from '@dcloudio/uni-app'

const app = getApp();
const queryParams = ref({
  auditStatus: '1'
})
const navs = ref(['审核中', '审核通过', '审核拒绝'])
const current = ref()
const list = ref([])
const total = ref(0)
const deptType = ref('')
const userType = ref('')
const totalCost = ref(0)
const statistical = ref({})
onLoad(() => {
  if (app.globalData.isLogin) {
    init()
  } else {
    
    app.firstLoadCallback = () => {
      init()
    };
  }
})

function init() {
  deptType.value = app.globalData.deptType
  userType.value = app.globalData.userType
  // console.log(userType.value)
  getList()
}

function onClickItem(e) {
  queryParams.value.auditStatus = e.currentIndex + 1
  getList()
}

async function getList() {
  uni.showLoading({
    title: '加载中',
    mask: true
  })
  statistical.value = {
    allCount: 0,
    totalCost: 0,
    renewYear: 0,
    newCount: 0
  }
  const res = await api.listNewAPI(queryParams.value)
  list.value = res.rows
  for (const val of list.value) {
    statistical.value.renewYear += val.renewYear
    statistical.value.totalCost += val.finalPrice * 1
    if (val.isNew == 1) {
      statistical.value.newCount += 1
    }
    statistical.value.allCount += 1
  }
  total.value = res.total
}

function audit(recordId, flag) {
  if (flag == '0') {
    // 拒绝
    // 弹出框填写理由
    uni.showModal({
      title: '请输入拒绝理由',
      editable: true,
      success: function (res) {
        if (res.confirm) {
          if (!res.content) {
            uni.showToast({
              title: '请输入拒绝理由',
              icon: 'none'
            })
          } else {
            doApproval(recordId, flag, res.content)
          }
        }
      }
    })
  } else if (flag == '1') {
    // 二次确认
    uni.showModal({
      title: '提示',
      content: `确定审批通过吗`,
      success: function (res) {
        if (res.confirm) {
          doApproval(recordId, flag)
        }
      }
    })
  }
}

function doApproval(recordId, flag, reason) {
  let obj = {
    flag: flag,
    reason: reason || '',
    ids: []
  }
  obj.ids.push(recordId)
  console.log(obj)
  uni.showLoading({
    title: '加载中',
    mask: true
  })
  api.ztxAudit(obj).then((res) => {
    uni.hideLoading()
    uni.showToast({
      title: '操作成功',
      icon: 'none'
    })
    getList()
  })
}

function goDetail(item) {
  const form = encodeURIComponent(JSON.stringify(item))
  if (userType.value == '1') {
    // 查看
    let path = `/group/apply/mergeUpDetail?form=${form}`
    uni.navigateTo({
      url: path
    });
  }
  
  if (userType.value == '2' || userType.value == '3') {
    // 审核记录
    let path = `/group/apply/record?certId=${item.content.certId}`
    uni.navigateTo({
      url: path
    });
  }
}

function goMerge() {
  let path = `/group/apply/merge`
  uni.redirectTo({
    url: path
  });
}

function goMergeUp() {
  let path = `/group/apply/mergeUp`
  uni.redirectTo({
    url: path
  });
}

function sendBack(row) {
  uni.showModal({
    title: '提示',
    content: `确定撤回${row.content.certName}吗`,
    success: function (res) {
      if (res.confirm) {
        api.certifiedwithDraw({
          recordId: row.recordId,
          reason: row.reason
        }).then(res => {
          uni.showToast({
            title: '操作成功',
            icon: 'none'
          })
          getList()
        })
        
      }
    }
  })
}

function goGroupInfo(row) {
  uni.navigateTo({
    url: `/group/groupInfo?memId=${row.memId}`
  })
}

function viewSettleFile(doc) {
  let url
  if (doc.payEvidence) {
    url = JSON.parse(doc.payEvidence)[0].url || null
    console.log(url)
    if (url) {
      showImg(url)
    }
  }
}

function showImg(n) {
  var str = ''
  if (n.indexOf('http') == -1) {
    str = config.baseUrl_api + n
  } else {
    str = n
  }
  
  if (n.indexOf('png') > -1 || n.indexOf('jpg') > -1 || n.indexOf(
    'jpeg') > -1) {
    uni.previewImage({
      urls: [str],
      success: function (res) {
        console.log('success', res)
      },
      fail: function (res) {
        console.log('fail', res)
      },
      complete: function (res) {
        console.log('complete', res)
      }
    })
  } else {
    goWebView(str)
  }
}

function goWebView(url) {
  url = url.replace("http://", "https://")
  uni.showLoading({
    title: '下载中'
  });
  uni.downloadFile({
    url: url,
    success: function (res) {
      uni.hideLoading();
      var filePath = res.tempFilePath;
      uni.showLoading({
        title: '正在打开'
      });
      uni.openDocument({
        filePath: filePath,
        showMenu: true,
        success: function (res) {
          uni.hideLoading();
        },
        fail: function (err) {
          uni.hideLoading();
          uni.showToast({
            title: err,
            icon: 'none',
            duration: 2000
          });
        }
      });
    },
    fail: function (error) {
      uni.hideLoading();
      uni.showToast({
        title: `下载失败`,
        icon: 'none',
        duration: 2000
      });
    }
  });
}
</script>

<style scoped>
.mt0 {
  margin-top: 0 !important;
}

.appList .appItem .name {
  width: 80%;
  word-break: break-all;
}

.name {
  margin-bottom: 10rpx !important;
}

.text {
  font-size: 26rpx;
  color: #999;
  margin-bottom: 10rpx;
}
</style>