audit.vue 7.15 KB
<template>
  <view>
    <!--		<view class="text-center whitebg" v-if="userType=='2'">-->
    <!--			<view class="cardNav" v-if="userType=='2'">-->
    <!--				<view class="active">审核</view>-->
    <!--				<view @click="goMerge">合并</view>-->
    <!--				<view @click="goMergeUp">提交</view>-->
    <!--			</view>-->
    <!--		</view>-->
    <uni-segmented-control
      :current="current"
      :values="navs"
      activeColor="#AD181F"
      class="whitebg"
      styleType="text"
      @clickItem="onClickItem">
    </uni-segmented-control>
    
    <!-- 缴费审核 -->
    <view v-if="total>0" class="vipData" style="flex-wrap: wrap;">
      <view class="w50">费用合计
        <text>{{ statistical.totalCost?.toFixed(2) }}</text>
      </view>
      <view class="w50">人数合计
        <text>{{ statistical.personCount }}</text>
      </view>
      <view class="w50">新会员合计
        <text>{{ statistical.newPersonCount }}</text>
      </view>
      <view class="w50">续费合计
        <text>{{ statistical.oldPersonCount }}</text>
      </view>
      <view class="w50">年限合计
        <text>{{ statistical.totalYear }}</text>
      </view>
    </view>
    <view class="appList">
      <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" @click="goDetail(item)">
          <uni-icons color="#AD181F" size="16" type="calendar-filled"></uni-icons>
          {{ item.commitTime }} 提交
        </view>
        <view v-if="item?.wfCode" class="text-primary" @click="goDetail(item)">{{ item.wfCode }}
        </view>
        <view class="name" @click="goDetail(item)">{{ item.memName }}</view>
        <view class="flexbox" @click="goDetail(item)">
          <view>
            人数合计
            <view>{{ item.allCount }}</view>
          </view>
          <view>
            年限合计
            <view>{{ item.yearCount }}</view>
          </view>
          <view>
            新会员
            <view>{{ item.newCount }}</view>
          </view>
          <view>
            费用
            <view>{{ (item.price * 1).toFixed(2) }}</view>
          </view>
        </view>
        <view v-if="item.auditStatus==1" class="func">
          <button @click="audit(item,'2')">拒绝</button>
          <button @click="audit(item,'1')">同意</button>
        </view>
        <!--        <view v-if="item.auditStatus==1 && item.isView == 1" class="func">-->
        <!--          <button @click="handleDelete(item)">撤回</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 {ref} from 'vue'
import {onShow} from '@dcloudio/uni-app'

const app = getApp();
const queryParams = ref({
  // pageNum: 1,
  // pageSize: 10
  auditStatus: "1",
  auditFlag: "1"
  
})
const navs = ref(['待审核', '审核通过', '审核拒绝',])
const current = ref(0)
const list = ref([])
const statistical = ref({})
const total = ref(0)
const deptType = ref('')
const userType = ref('')
onShow(() => {
  if (app.globalData.isLogin) {
    init()
  } else {
    app.firstLoadCallback = () => {
      init()
    };
  }
})

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

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

async function getList() {
  uni.showLoading({
    title: `加载中`,
    mask: true
  })
  if (deptType.value == 2 || deptType.value == 3) {
    queryParams.value.mergeFlag = 0
  }
  const res = await api.auditList(queryParams.value)
  list.value = res.rows
  total.value = res.total
  statistical.value = {
    totalCost: 0,
    personCount: 0,
    newPersonCount: 0,
    oldPersonCount: 0,
    totalYear: 0
  }
  for (const val of list.value) {
    statistical.value.totalCost += val.price * 1
    statistical.value.personCount += val.allCount * 1
    statistical.value.newPersonCount += val.newCount * 1
    statistical.value.oldPersonCount += val.oldCount * 1
    statistical.value.totalYear += val.yearCount * 1
  }
  uni.hideLoading()
  
}

function handleDelete(row) {
  uni.showModal({
    title: '提示',
    content: `确定撤回 ${row.name}?`,
    success: function (res) {
      if (res.confirm) {
        api.withDraw({
          recordId: row.recordId,
          reason: row.reason
        }).then(res => {
          uni.showToast({
            title: `操作成功`
          })
          getList()
        })
      }
    }
  })
}

function audit(item, flag) {
  if (flag == '2') {
    // 拒绝
    // 弹出框填写理由
    uni.showModal({
      title: '请输入拒绝理由',
      editable: true,
      success: function (res) {
        if (res.confirm) {
          if (!res.content) {
            uni.showToast({
              title: '请输入拒绝理由',
              icon: 'none'
            })
            return
          } else {
            doApproval(item.rangId, flag, res.content)
          }
        }
      }
    })
  }
  if (flag == '1') {
    // 二次确认
    uni.showModal({
      title: '提示',
      content: `确定审批通过吗`,
      success: function (res) {
        if (res.confirm) {
          doApproval(item.rangId, 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.auditApi(obj).then((res) => {
    uni.hideLoading()
    uni.showToast({
      title: '操作成功',
      icon: 'none'
    })
    getList()
  })
}

function goDetail(item) {
  const form = encodeURIComponent(JSON.stringify(item))
  // console.log(userType.value)
  
  // let path =
  //   `/personalVip/auditDetail?form=${form}`
  // uni.navigateTo({
  //   url: path
  // });
  
  let path =
    `/personalVip/paymentDetail?form=${form}`
  uni.navigateTo({
    url: path
  });
  
  
}

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

function goMergeUp() {
  let path = `/personalVip/sheng/mergeUp`
  uni.redirectTo({
    url: path
  });
}
</script>

<style>

</style>