index.vue 9.84 KB
<template>
  <div class="app-container">
    <div>
      <!-- 搜索区域 -->
      <div class="from-Card">
        <el-form ref="queryRef" size="small" :model="queryParams" :inline="true" label-position="top">
          <el-row style="width: 100%;">
            <el-col :span="4">
              <el-form-item label="缴费名称" prop="paymentName">
                <el-input
                  v-model.trim="queryParams.paymentName"
                  placeholder="缴费名称"
                  clearable
                  style="width: 100%"
                  @keyup.enter="searchFN"
                />
              </el-form-item>
            </el-col>

            <el-col :span="4">
              <el-form-item label="状态" prop="status">
                <el-select v-model="queryParams.status" style="width: 100%" @change="searchFN">
                  <el-option label="全部" value="" />
                  <el-option label="待提交" value="0" />
                  <el-option label="审核中" value="1" />
                  <el-option label="审核通过" value="2" />
                  <el-option label="审核拒绝" value="3" />
                  <el-option label="已撤回" value="4" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="缴费编号" prop="wfCode">
                <el-input
                  v-model.trim="queryParams.wfCode"
                  placeholder="缴费编号"
                  clearable
                  style="width: 100%"
                  @keyup.enter="searchFN"
                />
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item label="提交时间" prop="commitTime">
                <el-date-picker
                  v-model="commitTime"
                  type="datetimerange"
                  value-format="YYYY-MM-DD HH:mm:ss"
                  range-separator="至"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  style="width: 100%"
                  @change="searchFN"
                />
              </el-form-item>
            </el-col>
            <div class="po-r-btns">
              <el-button size="small" type="primary" icon="Search" @click="searchFN()">查询</el-button>
              <el-button size="small" icon="Refresh" @click="reset">重置</el-button>
            </div>

          </el-row>

        </el-form>
        <el-row justify="space-between">
          <div>
            <router-link class="router" to="/member/memberPay/addMemberPay"><el-button type="primary" :icon="Plus">新建缴费 </el-button></router-link>
          </div>
        </el-row>
      </div>
      <!-- 表格数据 -->
      <div class="table">
        <el-table :data="list" :row-class-name="tableRowClassName" border style="width: 100%" @sort-change="sortChange">
          <el-table-column label="序号" type="index" width="55" />
          <el-table-column
            label="缴费编号"
            align="center"
            prop="wfCode"
            min-width="140"
            :show-overflow-tooltip="true"
          />
          <!-- <el-table-column
            label="订单编号"
            align="center"
            prop="rangId"
            min-width="180"
            :show-overflow-tooltip="true"
          /> -->
          <el-table-column
            label="缴费名称"
            align="center"
            prop="paymentName"
            min-width="260"
            :show-overflow-tooltip="true"
          />
          
          <el-table-column
            label="人数合计"
            align="center"
            prop="personCount"
            min-width="90"
          />
          <el-table-column
            label="新会员合计"
            align="center"
            prop="newPersonCount"
            min-width="90"
          />
          <el-table-column
            label="年限合计"
            align="center"
            prop="totalYear"
            min-width="90"
          />

          <el-table-column
            label="状态"
            align="center"
            prop="status"
            min-width="100"
          >
            <template #default="props">
              <div v-if="props.row.status==0"> 待提交</div>
              <div v-if="props.row.status==1">审核中</div>
              <div v-if="props.row.status==2" class="text-success"> 审核通过</div>
              <div v-if="props.row.status==3" class="text-danger"> 审核拒绝</div>
              <div v-if="props.row.status==4" class="text-warning">已撤回</div>

            </template>
          </el-table-column>
          <el-table-column
            label="审核进度"
            align="center"
            prop=""
            min-width="120"
          >
            <template #default="props">
              <schedule v-if="props.row.status==0||props.row.status==1||props.row.status==2" :audit-process="props.row.auditProcess" />
            </template>
          </el-table-column>
          <el-table-column
            label="提交时间"
            align="center"
            prop="commitTime"
            min-width="100"
          >
            <template #default="scope">
              <span>{{ parseTime(scope.row.commitTime, '{y}-{m}-{d}') }}</span>
            </template>
          </el-table-column>

          <el-table-column
            label="操作"
            align="center"
            fixed="right"
            width="260"
          >
            <template #default="scope">
              <el-button type="primary" @click="handleInfo(scope.row)">查看</el-button>
              <el-button :disabled="!(scope.row.status==0||scope.row.status==3||scope.row.status==4)" color="#13B5B1" style="--el-color-black:#fff;" @click="commitFN(scope.row)">提交审核</el-button>
             
              <el-dropdown class="poptdmore">
                <el-button type="primary" plain :disabled="!(scope.row.status==0||scope.row.status==3||scope.row.status==4)">更多
                  <el-icon class="el-icon--right">
                    <arrow-down />
                  </el-icon>
                </el-button>
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item>
                      <el-button :disabled="!(scope.row.status==0||scope.row.status==3||scope.row.status==4)" type="warning" @click="handleUpdate(scope.row)">编辑</el-button>
                      <!-- <el-button :disabled="!(scope.row.status==0||scope.row.status==3||scope.row.status==4)" color="#13B5B1" style="--el-color-black:#fff;" @click="commitFN(scope.row)">提交审核</el-button> -->
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-button :disabled="!(scope.row.status==0||scope.row.status==3||scope.row.status==4)" type="danger" @click="handleDelete(scope.row)">删除</el-button>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total > 0"
          v-model:page="queryParams.pageNum"
          v-model:limit="queryParams.pageSize"
          :total="total"
          @pagination="initData"
        />
      </div>

    </div>
    <examView ref="examViewRef" :row-data="rowData" @close="initData" /></div>
</template>

<script setup>
import { useRouter, useRoute } from 'vue-router'
import { reactive } from '@vue/runtime-core'
import { ref, toRefs, onMounted, getCurrentInstance } from 'vue'
import { selectPageList, commit, paymentRange } from '@/api/member/memberPay.js'
import examView from './components/examView.vue'
import { Plus } from '@element-plus/icons-vue'
import schedule from '@/views/member/components/schedule.vue'
const { proxy } = getCurrentInstance()

const total = ref(0)
const list = ref([])
const loading = ref(false)
const router = useRouter()
const route = useRoute()
const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10
  },
  form: {}

})
const commitTime = ref([])
const rowData = ref()
const { queryParams } = toRefs(data)

onMounted(() => {
  initData()
  route
})

// // 背景色
const tableRowClassName = ({
  row,
  rowIndex
}) => {
  if (row.status == 2) {
    return 'success-row'
  } 
}

function searchFN() {
  queryParams.value.pageNum = 1
  initData()
}


// 获取赛会列表
async function initData() {
  if (commitTime.value) queryParams.value.commitTimeRange = commitTime.value.toString()
  const res = await selectPageList(queryParams.value)
  list.value = res.rows
  total.value = res.total
  console.log(res)
}

// 编辑
function handleUpdate(row) {
  router.push({
    path: '/member/memberPay/addMemberPay',
    query: {
      rangId: row.rangId
    }
  })
}

// 重置
function reset() {
  queryParams.value = {
    pageNum: 1,
    pageSize: 10
  }
  commitTime.value = []
  initData()
}

// 查看
function handleInfo(row) {
  rowData.value = row
  proxy.$refs['examViewRef'].open(row)
}

// // 弹窗关闭删除
// function close() {
//   initData()
// }

// 提交审核
async function commitFN(row) {
  const res = await commit(row.rangId)
  if (res.code == 200) {
    proxy.$modal.msgSuccess('提交成功!')
  } else {
    proxy.$modal.msgError('提交失败!')
  }
  initData()
}

/** 删除按钮操作 */
function handleDelete(row) {
  proxy.$modal.confirm('是否确认删除缴费名称为"' + row.paymentName + '"的数据项?').then(function() {
    loading.value = true
    return paymentRange(row.rangId)
  }).then(() => {
    loading.value = true
    initData()
    proxy.$modal.msgSuccess('删除成功')
  }).catch(() => {
  }).finally(() => {
    loading.value = false
  })
}


</script>

<style lang="scss" scoped>
.router {
  margin-right: 20px;
}
:deep(.el-button--info){
  background-color: #920f20;
  border:1px solid #920f20
}


</style>