From 509f1d71c91242b11fd287cfcdeafe3d19b2d807 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 04 三月 2025 11:11:46 +0800
Subject: [PATCH] 新增

---
 src/views/specialOperationsPay/notCoalPay/components/studentDialog.vue |   93 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 79 insertions(+), 14 deletions(-)

diff --git a/src/views/specialOperationsPay/notCoalPay/components/studentDialog.vue b/src/views/specialOperationsPay/notCoalPay/components/studentDialog.vue
index d9872de..fff6fdf 100644
--- a/src/views/specialOperationsPay/notCoalPay/components/studentDialog.vue
+++ b/src/views/specialOperationsPay/notCoalPay/components/studentDialog.vue
@@ -26,12 +26,12 @@
         <el-row :gutter="24">
           <el-col :span="12" v-if="stuInfo.payType === 1 || stuInfo.payType === 3 || stuInfo.payType === 4">
             <el-form-item label="理论类别:">
-              <span>{{stuInfo.nonCoalPayCategoryList.find(i=>i.categoryType == 1).subjectName}}</span>
+              <span>{{stuInfo.nonCoalPayCategoryList.find(i => i.categoryType == 1) && stuInfo.nonCoalPayCategoryList.find(i => i.categoryType == 1).subjectName }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="12" v-if="stuInfo.payType === 2 || stuInfo.payType === 3">
             <el-form-item label="实操类别:">
-              <span>{{stuInfo.nonCoalPayCategoryList.find(i=>i.categoryType == 2).subjectName}}</span>
+              <span>{{stuInfo.nonCoalPayCategoryList.find(i => i.categoryType == 2) && stuInfo.nonCoalPayCategoryList.find(i => i.categoryType == 2).subjectName }}</span>
             </el-form-item>
           </el-col>
         </el-row>
@@ -77,18 +77,21 @@
       </el-form>
 
   <!--    表格-->
-      <div style="margin: 20px 15px;display: flex">
-        <el-button size="small"  type="primary" @click="handleAddStu('add',{})">添加学员</el-button>
-        <el-button size="small"  type="primary" @click="importDialog = true">批量导入</el-button>
+      <div style="margin: 20px 15px;display: flex;justify-content: space-between">
+        <div>
+          <el-button size="small" type="primary" @click="handleAddStu('add',{})">添加学员</el-button>
+          <el-button size="small" type="primary" @click="importDialog = true">批量导入</el-button>
+        </div>
+        <el-button type="text" @click="exportExcel">导出清单</el-button>
       </div>
-      <el-table v-loading="loading" :data="stuList">
+      <el-table v-loading="loading" :data="stuList" id="table_excel">
         <el-table-column label="序号" align="center" type="index" />
         <el-table-column label="姓名" align="center" prop="name" />
         <el-table-column label="身份证号" align="center" prop="idCard" />
         <el-table-column label="手机号" align="center" prop="phone" />
         <el-table-column label="性别" align="center" prop="sex">
           <template #default="scope">
-            {{scope.row.sex == 0?'男':scope.row.sex == 1?'女':'未知'}}
+            {{(parseInt(scope.row.idCard.substr(16, 1))) % 2 === 0 ? "女" : "男"}}
           </template>
         </el-table-column>
         <el-table-column label="财政缴款码" align="center" prop="payCode">
@@ -98,9 +101,11 @@
         </el-table-column>
         <el-table-column label="是否已缴" align="center" prop="payStatus">
           <template #default="scope">
-            {{scope.row.payStatus == 0?'未缴':scope.row.payStatus == 1?'已缴':''}}
+            <span v-if="scope.row.payStatus == 1" style="color: green">已缴</span>
+            <span v-else style="color: red">未缴</span>
           </template>
         </el-table-column>
+        <el-table-column label="培训机构" align="center" prop="train" />
         <el-table-column label="类别" align="center" prop="payType">
           <template #default="scope">
             {{scope.row.payType == 1?'个人':scope.row.payType == 2?'集体':''}}
@@ -108,9 +113,10 @@
         </el-table-column>
         <el-table-column label="操作" align="center">
           <template #default="scope">
-            <el-button size="mini" type="text" v-if="scope.row.payStatus == 1" style="color: #1890ff">查看票据</el-button>
-            <el-button size="mini" type="text" style="color: #1890ff" @click="handleAddStu('edit',scope.row)">修改</el-button>
-            <el-button size="mini" type="text" style="color:lightcoral" @click="handleDelete(scope.row)">删除</el-button>
+            <el-button size="mini" type="text" v-if="scope.row.payStatus == 1" style="color: #1890ff" @click="checkTicket">查看票据</el-button>
+            <el-button size="mini" type="text" v-if="scope.row.payStatus == 0" style="color: #1890ff" @click="goPay(scope.row)">去缴费</el-button>
+            <el-button size="mini" type="text" style="color: #1890ff" v-if="!(scope.row.payCode && scope.row.payCode!=='')" @click="handleAddStu('edit',scope.row)">修改</el-button>
+            <el-button size="mini" type="text" style="color:lightcoral" v-if="!(scope.row.payCode && scope.row.payCode!=='')" @click="handleDelete(scope.row)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -139,6 +145,9 @@
             <el-radio :label="0">男</el-radio>
             <el-radio :label="1">女</el-radio>
           </el-radio-group>
+        </el-form-item>
+        <el-form-item label="培训机构:">
+          <el-input v-model.trim="dataForm.train"/>
         </el-form-item>
         <el-form-item label="身份证号:" prop="idCard">
           <el-input v-model.trim="dataForm.idCard"/>
@@ -205,15 +214,18 @@
 <script>
 
 
-import {verifyIdCard, verifySimplePhone} from "@/utils/validate";
+import {verifyIdCard, verifySimplePhone} from "@/utils/validate"
+import * as XLSX from 'xlsx';
+import { saveAs } from 'file-saver';
 import {
   addNonCoalStu, delNonCalStu, delNonCoalPay,
   editNonCoalStu,
   getNonCoalPayStudents,
-  getPayTypeInfo
+  getPayTypeInfo, nonCoalPersonPay
 } from "@/api/specialOperationsPay/notCoalPay";
 import exampleFile from '@/assets/studentInfo.xlsx'
 import {getToken} from "@/utils/auth";
+import {coalPersonPay} from "@/api/specialOperationsPay/coalPay";
 export default {
   name: 'addStu',
   components: {},
@@ -270,6 +282,38 @@
     };
   },
   methods: {
+    exportExcel() {
+      var xlsxParam = { raw: true }
+      let tables = document.getElementById('table_excel')
+      let clonedTable = tables.cloneNode(true); // 深度克隆
+      // 删除克隆表格中的最后一列
+      const allRows = clonedTable.querySelectorAll('tr');
+      allRows.forEach((row,index) => {
+        const cells = row.querySelectorAll('th,td');
+        if (cells.length > 0) {
+          if(index == 0){
+            row.removeChild(cells[cells.length - 2]); // 表头行要特殊处理
+          }else{
+            row.removeChild(cells[cells.length - 1]); // 移除最后一个单元格
+          }
+        }
+      })
+      let table_book = this.$XLSX.utils.table_to_book(clonedTable, xlsxParam);
+      const table_write = this.$XLSX.write(table_book, {
+        bookType: 'xlsx',
+        bookSST: true,
+        type: 'array'
+      });
+      try {
+        this.$FileSaver.saveAs(
+          new Blob([table_write], { type: 'application/octet-stream' }),
+          `${this.stuInfo.batchName}批次学员缴费清单.xlsx`
+        );
+      } catch (e) {
+        if (typeof console !== 'undefined') console.log(e, table_write);
+      }
+      return table_write
+    },
     openDialog(id) {
       this.getStuList(id)
       this.id = id
@@ -292,7 +336,6 @@
         const {id,nonCoalPayId,name,idCard,sex,phone} = data
         this.dataForm = {id,nonCoalPayId,name,idCard,sex,phone}
       }
-      console.log(this.dataForm,'form')
       this.dialogStatus = type
     },
 
@@ -395,6 +438,28 @@
         }
       })
     },
+    checkTicket(){
+      window.open('http://finpt.xjcz.gov.cn/fs-public/index.do')
+    },
+    async goPay(item){
+      if(item.payCode && item.payCode !== ''){
+        window.open(`http://finpt.xjcz.gov.cn/fs-public/billQuery/findByOrderId.do?orderId=${item.orderId}&deviceType=1`)
+      }else{
+        const query = {
+          id: item.id,
+          payType: 1
+        }
+        const res = await nonCoalPersonPay(query)
+        if(res.code == 200) {
+          window.open(`http://finpt.xjcz.gov.cn/fs-public/billQuery/findByOrderId.do?orderId=${res.msg}&deviceType=1`)
+        }else{
+          this.$message({
+            type:'warning',
+            message: res.msg
+          })
+        }
+      }
+    },
     handleDelete(row){
       this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
         confirmButtonText: '确定',

--
Gitblit v1.9.2