shuishen
2021-09-24 c2832e40f4b70ec7303a4e6fc673e93a61626d95
src/views/qualificationExamination/paymentInquiry.vue
@@ -1,63 +1,75 @@
/*
 * @Author: Morpheus
 * @Date: 2021-07-07 17:30:05
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-08-12 19:32:05
 * @Last Modified by: liu
 * @Last Modified time: 2021-09-23 08:32:06
 * menu-name 缴费查询
 */
<template>
    <basic-container>
        <avue-crud :option="option"
                   :table-loading="loading"
                   :data="data"
                   :page.sync="page"
                   :permission="permissionList"
                   v-model="form"
                   ref="crud"
                   @row-update="rowUpdates"
                   @row-save="rowSave"
                   @row-del="rowDel"
                   @search-change="searchChange"
                   @search-reset="searchReset"
                   @selection-change="selectionChange"
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   @refresh-change="refreshChange"
                   @on-load="onLoad">
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      :permission="permissionList"
      v-model="form"
      ref="crud"
      @row-update="rowUpdates"
      @row-save="rowSave"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot-scope="{ type, size, row }" slot="menu">
        <el-button
          icon="el-icon-edit"
          :size="size"
          :type="type"
          :disabled="row.paymentStatus == '3'"
          @click.stop="openDialog(row)"
          >缴费确认
        </el-button>
      </template>
            <template slot-scope="{ type, size, row }"
                      slot="menu">
      <template slot-scope="{ row }" slot="sex">
        {{ row.sex == 1 ? "男" : row.sex == 2 ? "女" : "" }}
      </template>
                <el-button icon="el-icon-edit"
                           :size="size"
                           :type="type"
                           @click.stop="payTheFees(row)">缴费确认
                </el-button>
            </template>
            <template slot-scope="{ row }"
                      slot="sex">
                {{row.sex==1?'男':row.sex==2?'女':''}}
            </template>
            <template class="tdtype"
                      slot-scope="{ row }"
                      slot="paymentStatus">
                <el-tag class="dtype">
                    {{ row.paymentStatus == "1" ? "已缴费" : row.paymentStatus == "2" ? "未缴费" : "部分缴费" }}
                    <i class="gz"
                       v-if="row.paymentStatus == '1'"></i>
                    <i class="yj"
                       v-if="row.paymentStatus == '2'"></i>
                    <i class="zc"
                       v-if="row.paymentStatus == '3'"></i>
                </el-tag>
            </template>
        </avue-crud>
    </basic-container>
      <template class="tdtype" slot-scope="{ row }" slot="paymentStatus">
        <el-tag class="dtype">
          {{
            row.paymentStatus == "1"
              ? "已缴费"
              : row.paymentStatus == "2"
              ? "未缴费"
              : "待确定"
          }}
          <i class="gz" v-if="row.paymentStatus == '1'"></i>
          <i class="yj" v-if="row.paymentStatus == '2'"></i>
          <i class="zc" v-if="row.paymentStatus == '3'"></i>
        </el-tag>
      </template>
    </avue-crud>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
      :modal-append-to-body="false"
    >
      <span>是否确认缴费</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="DoIt('1')"> 已缴费 </el-button>
        <el-button @click="DoIt('2')">未缴费</el-button>
      </span>
    </el-dialog>
  </basic-container>
</template>
<script>
@@ -71,410 +83,338 @@
import { mapGetters } from "vuex";
import { datasing } from "./dataqualificationExamination";
// import { getList } from "@/api/qualificationExamination/qualificationExamination";
import { getLispereexamPayment, update } from "@/api/qualificationExamination/scoreInquiry";
import {
  getLispereexamPayment,
  update,
} from "@/api/qualificationExamination/scoreInquiry";
export default {
    data () {
        var dic1 = [
            {
                label: "公司缴费",
  data() {
    var dic1 = [
      {
        label: "公司缴费",
        value: 1,
      },
      {
        label: "个人缴费",
        value: 2,
      },
    ];
    var dic2 = [
      {
        label: "已缴费",
        value: 1,
      },
      {
        label: "未缴费",
        value: 2,
      },
      {
        label: "部分缴费",
        value: 3,
      },
    ];
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      selectionList: [],
      option: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        addBtn: false,
        selection: true,
        menu: true,
        searchShowBtn: false,
        align: "center",
        height: "auto",
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        index: true,
        viewBtn: true,
        dialogClickModal: false,
        column: [
          // {
          //     label: "缴费类型",
          //     prop: "type",
          //     dicData:[
          //       {
          //         label:"公司缴费",
          //         value: 1
          //       },
          //       {
          //         label:"个人缴费",
          //         value: 2
          //       }
          //     ],
          //     searchSpan: 4,
          //     search: true,
          //     type: "select",
          // },
          {
            label: "缴费人",
            prop: "realName",
            search: true,
            searchSpan: 4,
          },
          {
            label: "身份证号",
            prop: "idCardNo",
            search: true,
            searchSpan: 4,
          },
          {
            label: "性别",
            prop: "sex",
            slot: true,
            dicData: [
              {
                label: "男",
                value: 1,
            },
            {
                label: "个人缴费",
              },
              {
                label: "女",
                value: 2,
            },
        ];
        var dic2 = [
            {
              },
            ],
          },
          {
            label: "联系方式",
            prop: "phone",
          },
          {
            label: "所在单位",
            prop: "deptName",
            search: true,
            searchSpan: 6,
          },
          {
            label: "缴费状态",
            prop: "paymentStatus",
            searchSpan: 4,
            search: true,
            dicData: [
              {
                label: "已缴费",
                value: 1,
            },
            {
              },
              {
                label: "未缴费",
                value: 2,
            },
            {
              },
              {
                label: "部分缴费",
                value: 3,
            },
        ];
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            selectionList: [],
            option: {
                // 操作栏多余按钮去除
                delBtn: false,
                editBtn: false,
                addBtn: false,
                selection: true,
                menu: true,
                searchShowBtn: false,
                align: "center",
                height: "auto",
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                index: true,
                viewBtn: true,
                dialogClickModal: false,
                column: [
                    // {
                    //     label: "缴费类型",
                    //     prop: "type",
                    //     dicData:[
                    //       {
                    //         label:"公司缴费",
                    //         value: 1
                    //       },
                    //       {
                    //         label:"个人缴费",
                    //         value: 2
                    //       }
                    //     ],
                    //     searchSpan: 4,
                    //     search: true,
                    //     type: "select",
                    // },
                    {
                        label: "缴费人",
                        prop: "realName",
                        search:true,
                        searchSpan:4,
                    },
                    {
                        label: "身份证号",
                        prop: "idCardNo",
                        search:true,
                        searchSpan:4,
                    },
                    {
                        label: "性别",
                        prop: "sex",
                        slot:true,
                        dicData: [
                            {
                            label:"男",
                            value:1
                            },
                            {
                            label:"女",
                            value:2
                            }
                        ],
                    },
                    {
                        label: "联系方式",
                        prop: "phone",
                    },
                    {
                        label: "所在单位",
                        prop: "deptName",
                        search:true,
                        searchSpan:6,
                    },
                    {
                        label: "缴费状态",
                        prop: "paymentStatus",
                        searchSpan: 4,
                        search: true,
                        dicData: [
                          {
                            label:"已缴费",
                            value:1
                          },
                          {
                            label:"未缴费",
                            value:2
                          },
                          {
                            label:"部分缴费",
                            value:3
                          },
                        ],
                        type: "select",
                    },
                    {
                        label: "缴费凭证",
                        prop: "certificateUrl",
                        overHidden: true,
                        type: "upload",
                        listType: "picture-img",
                    },
                    {
                        label: "缴费时间",
                        prop: "paymentTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        labelWidth: 120,
                        searchSpan: 4,
                        // search: true,
                        overHidden: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入时间",
                                trigger: "click",
                            },
                        ],
                    },
                ],
            },
            data: [
                // {
                //   deptid: "江西众泰保安公司",
                //   punishtype: 2,
                //   punishreason: "非法施工",
                //   punishresult: "没收全部非法所得财产,并罚款3W元",
                //   punishtime: "2021-01-01",
                //   punisnum: 110110110120,
                // },
              },
            ],
        };
            type: "select",
          },
          {
            label: "缴费凭证",
            prop: "certificateUrl",
            overHidden: true,
            type: "upload",
            listType: "picture-img",
          },
          {
            label: "缴费时间",
            prop: "paymentTime",
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            labelWidth: 120,
            searchSpan: 4,
            // search: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: "请输入时间",
                trigger: "click",
              },
            ],
          },
        ],
      },
      data: [],
      onceData: {},
      dialogVisible: false,
    };
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.post_add, false),
        viewBtn: this.vaildData(this.permission.post_view, false),
        delBtn: this.vaildData(this.permission.post_delete, false),
        editBtn: this.vaildData(this.permission.post_edit, false),
      };
    },
    computed: {
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.post_add, false),
                viewBtn: this.vaildData(this.permission.post_view, false),
                delBtn: this.vaildData(this.permission.post_delete, false),
                editBtn: this.vaildData(this.permission.post_edit, false),
            };
        },
        ids () {
            let ids = [];
            this.selectionList.forEach((ele) => {
                ids.push(ele.id);
            });
            return ids.join(",");
        },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    methods: {
        rowSave (row, done, loading) {
            adddata(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
  },
  methods: {
    rowSave(row, done, loading) {
      adddata(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        rowUpdates (row, index, done, loading) {
            // console.log(42342);
            update(row).then(
                () => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                    done();
                },
                (error) => {
                    window.console.log(error);
                    loading();
                }
            );
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id);
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    });
                });
        },
        payTheFees (row) {
            console.log(row)
            this.$confirm("请确认是否缴费?", {
                confirmButtonText: "已缴费",
                cancelButtonText: "未缴费",
                type: "warning",
            })
                .then(() => {
                    row.paymentStatus = "1";
                    return update(row).then(() => {
                        this.onLoad(this.page);
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                    });
                })
                .catch(() => {
                    row.paymentStatus = "2";
                    return update(row).then(() => {
                        this.onLoad(this.page);
                        this.$message({
                            type: "success",
                            message: "操作成功!",
                        });
                    });
                });
        },
        // beforeOpen(done, type) {
        //   if (["edit", "view"].includes(type)) {
        //     getDetail(this.form.id).then((res) => {
        //       this.form = res.data.data;
        //     });
        //   }
        //   done();
        // },
        searchReset () {
            this.query = {};
            this.onLoad(this.page);
        },
        searchChange (params, done) {
            this.query = params;
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        selectionChange (list) {
            this.selectionList = list;
        },
        selectionClear () {
            this.selectionList = [];
            this.$refs.crud.toggleSelection();
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange () {
            this.onLoad(this.page, this.query);
        },
        onLoad (page, params = {}) {
            // this.loading = false;
            this.loading = true;
            getLispereexamPayment(
                page.currentPage,
                page.pageSize,
                Object.assign(params, this.query)
            ).then((res) => {
                const data = res.data.data;
                this.page.total = data.total;
                this.data = data.records;
                console.log(this.data, "getLispereexamPayment");
                this.loading = false;
                // this.selectionClear();
            });
        },
        // onLoad(page, params = {}) {
        //   // this.loading = false;
        //   this.loading = true;
        //   //   getListJSON().then((res) => {
        //   //   axios
        //   //     .get(
        //   //       "../../api/qualificationExamination/signQualificationExamination.json"
        //   //     )
        //   //     .then((res) => {
        //   // page.currentPage,
        //   // page.pageSize,
        //   // Object.assign(params, this.query)
        //   if (datasing) {
        //     var res = datasing;
        //     console.log(res, "signQualificationExamination");
        //     const data = res.data;
        //     // this.page.total = data.total;
        //     var d = data.records;
        //     for (var k in d) {
        //       d[k].examination_mx = "正常";
        //       d[k].examination_type = "正常";
        //       d[k]["carid"] = "370111198807051124";
        //       d[k]["certificate"] = "拥有";
        //       d[k]["reviewTime"] = "2021-02-21";
        //       d[k]["results"] = "通过";
        //       d[k]["onjob"] = "是";
        //     }
        //     this.data = d;
        //     this.loading = false;
        //   }
        //   // this.selectionClear();
        //   // });
        // },
        // 行单击
        // handleRowClick(row) {
        //   // delete (row["name"]);
        //   var obj = row;
        //   obj["name"] = "保安公司详细资料";
        //   this.$router.push({
        //     path: `/securityCompany/index`,
        //     query: obj,
        //   });
        // },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdates(row, index, done, loading) {
      // console.log(42342);
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    openDialog(row) {
      this.dialogVisible = true;
      this.onceData = row;
    },
    DoIt(n) {
      this.onceData.paymentStatus = n;
      update(this.onceData).then(() => {
        this.$message({
          type: "success",
          message: "操作成功!",
        });
        this.onLoad(this.page);
        this.dialogVisible = false;
      });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      // this.loading = false;
      this.loading = true;
      getLispereexamPayment(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        console.log(this.data, "getLispereexamPayment");
        this.loading = false;
        // this.selectionClear();
      });
    },
  },
};
</script>
<style scoped>
.dtype {
    width: 80px;
  width: 80px;
}
.zc {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #29c093;
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #29c093;
}
.yj {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #f34a4a;
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f34a4a;
}
.gz {
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #f48f57;
  position: absolute;
  top: 50%;
  margin-top: -5px;
  margin-left: 6px;
  width: 10px;
  height: 10px;
  border-radius: 30%;
  background: #f48f57;
}
</style>