Browse Source

发票登记页面及相关接口

lph 11 months ago
parent
commit
fd588c80d9

+ 44 - 0
zkqy-ui/src/api/system/FinishedProductInvoice.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询成品发票列表
+export function listFinishedProductInvoice(query) {
+  return request({
+    url: '/system/FinishedProductInvoice/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询成品发票详细
+export function getFinishedProductInvoice(id) {
+  return request({
+    url: '/system/FinishedProductInvoice/' + id,
+    method: 'get'
+  })
+}
+
+// 新增成品发票
+export function addFinishedProductInvoice(data) {
+  return request({
+    url: '/system/FinishedProductInvoice',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改成品发票
+export function updateFinishedProductInvoice(data) {
+  return request({
+    url: '/system/FinishedProductInvoice',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除成品发票
+export function delFinishedProductInvoice(id) {
+  return request({
+    url: '/system/FinishedProductInvoice/' + id,
+    method: 'delete'
+  })
+}

+ 765 - 0
zkqy-ui/src/views/system/financialManage/finishedProductInvoice.vue

@@ -0,0 +1,765 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
+      <el-form-item label="发票日期" prop="invoiceDate">
+        <el-date-picker
+          clearable
+          v-model="queryParams.invoiceDate"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="请选择发票日期"
+        >
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="客户" prop="customerId">
+        <!-- <el-input
+          v-model="queryParams.customerId"
+          placeholder="请输入客户编号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        /> -->
+        <el-select
+          v-model="queryParams.customerId"
+          placeholder="请选择客户"
+          clearable
+          filterable
+          @change="queryCustomerIdChange"
+        >
+          <el-option
+            v-for="item in customSelectData"
+            :key="item.id"
+            :label="item.customName"
+            :value="item.id"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="结算单位" prop="settlementUnitId">
+        <!-- <el-input
+          v-model="queryParams.settlementUnitId"
+          placeholder="请输入结算单位"
+          clearable
+          @keyup.enter.native="handleQuery"
+        /> -->
+        <el-select
+          :disabled="!queryParams.customerId"
+          v-model="queryParams.settlementUnitId"
+          clearable
+          filterable
+          @change="handleQuery"
+        >
+          <el-option
+            v-for="item in queryUnitList"
+            :key="item.ids"
+            :label="item.customerName"
+            :value="item.id"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="发票号" prop="invoiceNumber">
+        <el-input
+          v-model="queryParams.invoiceNumber"
+          placeholder="请输入发票号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置</el-button
+        >
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['system:FinishedProductInvoice:add']"
+          >新增</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['system:FinishedProductInvoice:edit']"
+          >修改</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['system:FinishedProductInvoice:remove']"
+          >删除</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['system:FinishedProductInvoice:export']"
+          >导出</el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-loading="loading"
+      :data="FinishedProductInvoiceList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编号" align="center" prop="id" />
+      <el-table-column
+        label="发票日期"
+        align="center"
+        prop="invoiceDate"
+        width="180"
+      >
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.invoiceDate, "{y}-{m}-{d}") }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="客户编号" align="center" prop="customerId" />
+      <el-table-column
+        label="结算单位"
+        align="center"
+        prop="settlementUnitId"
+      />
+      <el-table-column label="发票号" align="center" prop="invoiceNumber" />
+      <el-table-column label="发票类型" align="center" prop="invoiceType" />
+      <el-table-column label="开票金额" align="center" prop="billingAmount" />
+      <el-table-column label="经手人" align="center" prop="personInCharge" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="scope">
+          <el-dropdown>
+            <el-button type="warning" plain size="small">
+              操作<i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item
+                ><el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit"
+                  @click="handleUpdate(scope.row)"
+                  v-hasPermi="['system:FinishedProductInvoice:edit']"
+                  >修改</el-button
+                ></el-dropdown-item
+              >
+              <el-dropdown-item
+                ><el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-delete"
+                  @click="handleDelete(scope.row)"
+                  v-hasPermi="['system:FinishedProductInvoice:remove']"
+                  >删除</el-button
+                ></el-dropdown-item
+              >
+            </el-dropdown-menu>
+          </el-dropdown>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改成品发票对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-row :gutter="20">
+        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+          <el-col :span="12">
+            <el-form-item label="客户名称" prop="customerId">
+              <el-select
+                v-model="form.customerId"
+                placeholder="请选择客户"
+                clearable
+                filterable
+                @change="getSettlementUnitList"
+              >
+                <el-option
+                  v-for="item in customSelectData"
+                  :key="item.id"
+                  :label="item.customName"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="发票号" prop="invoiceNumber">
+              <el-input
+                v-model="form.invoiceNumber"
+                placeholder="请输入发票号"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="发票日期" prop="invoiceDate">
+              <el-date-picker
+                clearable
+                v-model="form.invoiceDate"
+                type="date"
+                value-format="yyyy-MM-dd"
+                placeholder="请选择发票日期"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="发票类型" prop="invoiceType">
+              <el-select
+                v-model="form.invoiceType"
+                placeholder="请选择发票类型"
+                clearable
+                filterable
+              >
+                <el-option
+                  v-for="item in dict.type.finished_product_invoice_type"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <el-form-item label="开票金额" prop="billingAmount">
+              <el-input
+                v-model="form.billingAmount"
+                placeholder="请输入开票金额"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="经手人" prop="personInCharge">
+              <el-input
+                v-model="form.personInCharge"
+                placeholder="请输入经手人"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="结算单位" prop="settlementUnitId">
+              <el-select v-model="form.settlementUnitId" clearable filterable>
+                <el-option
+                  v-for="item in settlementUnitList"
+                  :key="item.ids"
+                  :label="item.customerName"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+
+              <el-button
+                class="ml10"
+                icon="el-icon-edit"
+                @click="editSettleUnit"
+              ></el-button>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remark">
+              <el-input v-model="form.remark" placeholder="请输入备注" />
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </el-row>
+      <el-dialog
+        width="600px"
+        :title="customName + '的结算单位'"
+        :visible.sync="innerVisible"
+        append-to-body
+      >
+        <el-button
+          type="primary"
+          size="small"
+          @click="addSettleUnit"
+          icon="el-icon-plus"
+          :disabled="adding"
+          >新增</el-button
+        >
+        <el-table :data="settleTableData" border stripe>
+          <el-table-column type="index" width="50" />
+          <el-table-column prop="customerName" label="单位名称">
+            <template slot-scope="scope">
+              <span v-if="!scope.row.isEdit">{{ scope.row.customerName }}</span>
+              <el-input
+                v-else
+                v-model="scope.row.customerName"
+                size="mini"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column prop="customerRegion" label="单位地区">
+            <template slot-scope="scope">
+              <span v-if="!scope.row.isEdit">{{
+                scope.row.customerRegion
+              }}</span>
+              <el-input
+                v-else
+                v-model="scope.row.customerRegion"
+                size="mini"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <!-- 编辑 -->
+              <div class="btn-wrap" v-show="scope.row.isEdit && scope.row.id">
+                <el-button
+                  type="success"
+                  size="small"
+                  @click="addSettleUnitConfirm(scope.row)"
+                  >保存</el-button
+                >
+                <el-button type="info" size="small" @click="initSettleTableData"
+                  >取消</el-button
+                >
+              </div>
+              <!-- 待编辑 -->
+              <div class="btn-wrap" v-show="!scope.row.isEdit && scope.row.id">
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="scope.row.isEdit = true"
+                  >编辑</el-button
+                >
+                <el-button
+                  type="danger"
+                  size="small"
+                  @click="deleteUnit(scope.row)"
+                  >删除</el-button
+                >
+              </div>
+              <!-- 待新增 -->
+              <div class="btn-wrap" v-show="!scope.row.id">
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="addSettleUnitConfirm(scope.row)"
+                  >新增</el-button
+                >
+                <el-button
+                  type="danger"
+                  size="small"
+                  @click="cancelAdd(scope.$index)"
+                  >取消</el-button
+                >
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="innerCancel">关 闭</el-button>
+        </div>
+      </el-dialog>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listFinishedProductInvoice,
+  getFinishedProductInvoice,
+  delFinishedProductInvoice,
+  addFinishedProductInvoice,
+  updateFinishedProductInvoice,
+} from "@/api/system/FinishedProductInvoice";
+import {
+  getCustomList,
+  customerSettlementUnit,
+  addSettlementUnit, //新增结算单位
+  updateSettlementUnit,
+  deleteSettlementUnit,
+} from "@/api/system/SaleRegistrationCollection";
+
+export default {
+  name: "finishedProductInvoice",
+  dicts: ["finished_product_invoice_type"],
+  data() {
+    return {
+      queryUnitList: [], //查询表单的结算单位列表
+      settleTableData: [], //结算单位列表
+      innerVisible: false, //结算单位弹窗
+      customName: "", //客户名称
+      customSelectData: [], //客户选择数据
+      settlementUnitList: [], //结算单位列表
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 成品发票表格数据
+      FinishedProductInvoiceList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        invoiceDate: null,
+        customerId: null,
+        settlementUnitId: null,
+        invoiceNumber: null,
+        invoiceType: null,
+        billingAmount: null,
+        personInCharge: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+    };
+  },
+  created() {
+    this.getList();
+  },
+  mounted() {
+    this.initSelectData();
+  },
+  computed: {
+    adding() {
+      if (!this.settleTableData.length) return false;
+      return this.settleTableData.some((item) => !item.id);
+    },
+  },
+  methods: {
+    async queryCustomerIdChange() {
+      if (!this.queryParams.customerId) {
+        this.queryUnitList = [];
+      } else {
+        let payload = {
+          customerId: this.queryParams.customerId,
+          isEnablePaging: false,
+        };
+        let res = await customerSettlementUnit(payload);
+        if (res.code == 200) {
+          this.queryUnitList = res.rows;
+        } else {
+          this.$message.error(res.msg);
+          // throw new Error(res.msg);
+        }
+      }
+    },
+    /* 内层弹窗关闭回调 */
+    innerCancel() {
+      this.innerVisible = false;
+      this.getSettlementUnitList();
+    },
+    /* 取消新增结算单位 */
+    cancelAdd(index) {
+      this.settleTableData.splice(index, 1);
+    },
+    /* 删除单位 */
+    async deleteUnit(row) {
+      this.$confirm("是否确认删除该单位?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          try {
+            let res = await deleteSettlementUnit(row.id);
+            if (res.code == 200) {
+              this.$message.success("删除成功!");
+              this.initSettleTableData();
+            } else {
+              throw new Error(res.msg);
+            }
+          } catch (error) {
+            this.$message.error(error);
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    /* 初始化结算单位表格数据 */
+    async initSettleTableData() {
+      await this.getSettlementUnitList();
+      this.settleTableData = this.settlementUnitList.map((item) => {
+        return {
+          ...item,
+          isEdit: false,
+        };
+      });
+    },
+    /* 新增一条结算单位 */
+    addSettleUnit() {
+      this.settleTableData.unshift({
+        customerName: "",
+        customerRegion: "",
+        isEdit: true,
+      });
+    },
+    /* 确认新增/修改一条结算单位 */
+    async addSettleUnitConfirm(row) {
+      let { customerName, customerRegion, id } = row;
+      if (!customerName || !customerRegion) {
+        this.$message.warning("请完善数据!");
+        return;
+      }
+      let customerId = this.form.customerId;
+      let fun = id ? updateSettlementUnit : addSettlementUnit;
+      let payload = {
+        customerId,
+        customerRegion,
+        customerName,
+      };
+      if (id) {
+        payload.id = id;
+      }
+      try {
+        let res = await fun(payload);
+        if (res.code == 200) {
+          this.$message.success("操作成功!");
+          this.initSettleTableData();
+        } else {
+          throw new Error(res.msg);
+        }
+      } catch (error) {
+        this.$message.error(error);
+      }
+    },
+    /* 新增一条结算单位 */
+    addSettleUnit() {
+      this.settleTableData.unshift({
+        customerName: "",
+        customerRegion: "",
+        isEdit: true,
+      });
+    },
+    // 开始编辑结算单位
+    async editSettleUnit() {
+      let customerId = this.form.customerId;
+      if (!customerId) {
+        this.$message.warning("请先选择客户名称");
+        return;
+      }
+      this.customName = this.customSelectData.find(
+        (item) => item.id == this.form.customerId
+      )?.customName;
+      await this.initSettleTableData();
+      console.log(111);
+      this.innerVisible = true;
+    },
+    // 获取结算单位下拉框数据
+    async getSettlementUnitList() {
+      let customerId = this.form.customerId;
+      if (!customerId) {
+        this.$message.warning("请先选择客户名称");
+        return;
+      }
+      try {
+        let payload = {
+          customerId,
+          isEnablePaging: false,
+        };
+        let res = await customerSettlementUnit(payload);
+        if (res.code == 200) {
+          this.settlementUnitList = res.rows;
+        } else {
+          throw new Error(res.msg);
+        }
+      } catch (error) {
+        this.$message.error(error);
+      }
+    },
+    // 初始化下拉框选择数据
+    async initSelectData() {
+      // 客户数据
+      try {
+        let res1 = await getCustomList({ isEnablePaging: false });
+        if (res1.code == 200) {
+          this.customSelectData = res1.rows;
+        } else {
+          throw new Error(res1.msg);
+        }
+      } catch (error) {
+        this.$message.error(error);
+      }
+    },
+    /** 查询成品发票列表 */
+    getList() {
+      this.loading = true;
+      listFinishedProductInvoice(this.queryParams).then((response) => {
+        this.FinishedProductInvoiceList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        invoiceDate: null,
+        customerId: null,
+        settlementUnitId: null,
+        invoiceNumber: null,
+        invoiceType: null,
+        billingAmount: null,
+        personInCharge: null,
+        remark: null,
+        createBy: null,
+        createById: null,
+        createTime: null,
+        updateBy: null,
+        updateById: null,
+        updateTime: null,
+        delFlag: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加成品发票";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids;
+      getFinishedProductInvoice(id).then((response) => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改成品发票";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateFinishedProductInvoice(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addFinishedProductInvoice(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal
+        .confirm('是否确认删除成品发票编号为"' + ids + '"的数据项?')
+        .then(function () {
+          return delFinishedProductInvoice(ids);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download(
+        "system/FinishedProductInvoice/export",
+        {
+          ...this.queryParams,
+        },
+        `FinishedProductInvoice_${new Date().getTime()}.xlsx`
+      );
+    },
+  },
+};
+</script>

+ 0 - 1
zkqy-ui/src/views/system/financialManage/receiveRecord.vue

@@ -483,7 +483,6 @@ import {
   updateSettlementUnit,
   deleteSettlementUnit,
 } from "@/api/system/SaleRegistrationCollection";
-import { async } from "@/components/updateModule/k-form-design/lib/k-form-design.common";
 
 export default {
   name: "SaleRegistrationCollection",

+ 1 - 0
zkqy-ui/src/views/system/financialManage/receiveRecordReview.vue

@@ -825,6 +825,7 @@ export default {
               amounts: this.currentRow.amounts,
               collectionMoneyType: this.currentRow.collectionMoneyType,
               remark: this.currentRow.remark,
+              collectionMoneyDate: this.currentRow.collectionMoneyDate,
             };
             reviewApprovedPass(payLoad).then((response) => {
               if (response.code == 200) {