|
@@ -257,6 +257,16 @@
|
|
|
prop="settlementUnitName"
|
|
|
/>
|
|
|
<el-table-column label="通知单号" align="center" prop="noticeNumber" />
|
|
|
+ <el-table-column label="开票" align="center" prop="billingFlag">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-checkbox
|
|
|
+ true-label="1"
|
|
|
+ false-label="0"
|
|
|
+ v-model="scope.row.billingFlag"
|
|
|
+ @change="billingFlagChange(scope.row)"
|
|
|
+ ></el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="回单" align="center" prop="returnReceipt">
|
|
|
<template slot-scope="scope">
|
|
|
<el-checkbox
|
|
@@ -281,6 +291,7 @@
|
|
|
type="date"
|
|
|
size="mini"
|
|
|
placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
@change="returnReceiptChange(scope.row)"
|
|
|
>
|
|
|
</el-date-picker>
|
|
@@ -309,7 +320,7 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
+ <!-- <el-table-column
|
|
|
label="操作"
|
|
|
align="center"
|
|
|
class-name="small-padding fixed-width"
|
|
@@ -328,34 +339,10 @@
|
|
|
>回 单</el-button
|
|
|
></el-dropdown-item
|
|
|
>
|
|
|
- <!-- <el-dropdown-item>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- @click="passHandler(scope.row)"
|
|
|
- >通过</el-button
|
|
|
- >
|
|
|
- </el-dropdown-item> -->
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
- <!-- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['system:SaleAccountsReceivableDetail:edit']"
|
|
|
- >修改</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
- v-hasPermi="['system:SaleAccountsReceivableDetail:remove']"
|
|
|
- >删除</el-button
|
|
|
- > -->
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
@@ -558,6 +545,219 @@
|
|
|
<el-button type="primary" @click="submitReceiptForm">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 添加发票对话框 -->
|
|
|
+ <el-dialog
|
|
|
+ title="添加发票"
|
|
|
+ :visible.sync="billingVisible"
|
|
|
+ width="800px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-form
|
|
|
+ ref="billingForm"
|
|
|
+ :model="billingForm"
|
|
|
+ :rules="billingFormRules"
|
|
|
+ label-width="80px"
|
|
|
+ >
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="客户名称" prop="customerId">
|
|
|
+ <el-select
|
|
|
+ v-model="billingForm.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="billingForm.invoiceNumber"
|
|
|
+ placeholder="请输入发票号"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发票日期" prop="invoiceDate">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ v-model="billingForm.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="billingForm.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="billingForm.billingAmount"
|
|
|
+ placeholder="请输入开票金额"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="经手人" prop="personInCharge">
|
|
|
+ <el-input
|
|
|
+ v-model="billingForm.personInCharge"
|
|
|
+ placeholder="请输入经手人"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="结算单位" prop="settlementUnitId">
|
|
|
+ <el-select
|
|
|
+ v-model="billingForm.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="billingForm.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="submitBillingForm">确 定</el-button>
|
|
|
+ <el-button @click="billingCancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -568,8 +768,16 @@ import {
|
|
|
delSaleAccountsReceivableDetail,
|
|
|
addSaleAccountsReceivableDetail,
|
|
|
updateSaleAccountsReceivableDetail,
|
|
|
+ addBilling,
|
|
|
+ cancelBilling,
|
|
|
} from "@/api/system/SaleAccountsReceivableDetail";
|
|
|
-import { getCustomList } from "@/api/system/SaleRegistrationCollection";
|
|
|
+import {
|
|
|
+ getCustomList,
|
|
|
+ customerSettlementUnit,
|
|
|
+ addSettlementUnit, //新增结算单位
|
|
|
+ updateSettlementUnit,
|
|
|
+ deleteSettlementUnit,
|
|
|
+} from "@/api/system/SaleRegistrationCollection";
|
|
|
import moment from "moment";
|
|
|
|
|
|
export default {
|
|
@@ -578,6 +786,7 @@ export default {
|
|
|
"accounting_type",
|
|
|
"accounts_receivable_billing_type",
|
|
|
"collection_registration_payment_method",
|
|
|
+ "finished_product_invoice_type",
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
@@ -651,6 +860,37 @@ export default {
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {},
|
|
|
+ // 开票表单
|
|
|
+ innerVisible: false,
|
|
|
+ settleTableData: [],
|
|
|
+ customName: "",
|
|
|
+ settlementUnitList: [],
|
|
|
+ currentRow: {},
|
|
|
+ billingVisible: false,
|
|
|
+ billingForm: {},
|
|
|
+ billingFormRules: {
|
|
|
+ customerId: [
|
|
|
+ { required: true, message: "客户不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ invoiceNumber: [
|
|
|
+ { required: true, message: "发票号码不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ invoiceDate: [
|
|
|
+ { required: true, message: "发票日期不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ invoiceType: [
|
|
|
+ { required: true, message: "发票类型不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ billingAmount: [
|
|
|
+ { required: true, message: "开票金额不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ personInCharge: [
|
|
|
+ { required: true, message: "负责人不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ settlementUnitId: [
|
|
|
+ { required: true, message: "结算单位不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -659,7 +899,226 @@ export default {
|
|
|
mounted() {
|
|
|
this.initSelectData();
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ adding() {
|
|
|
+ if (!this.settleTableData.length) return false;
|
|
|
+ return this.settleTableData.some((item) => !item.id);
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 确认开票
|
|
|
+ submitBillingForm() {
|
|
|
+ this.$refs["billingForm"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.billingForm.id != null) {
|
|
|
+ updateFinishedProductInvoice(this.billingForm).then((response) => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.billingVisible = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.billingForm.accountsReceivableDetailId = this.currentRow.id;
|
|
|
+ this.billingForm.billingFlag = 1;
|
|
|
+
|
|
|
+ addBilling(this.billingForm).then((response) => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.billingVisible = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消开票
|
|
|
+ billingCancel() {
|
|
|
+ this.billingVisible = false;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /* 删除单位 */
|
|
|
+ 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 addSettleUnitConfirm(row) {
|
|
|
+ let { customerName, customerRegion, id } = row;
|
|
|
+ if (!customerName || !customerRegion) {
|
|
|
+ this.$message.warning("请完善数据!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let customerId = this.billingForm.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);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 内层弹窗关闭回调 */
|
|
|
+ innerCancel() {
|
|
|
+ this.innerVisible = false;
|
|
|
+ this.getSettlementUnitList();
|
|
|
+ },
|
|
|
+ /* 新增一条结算单位 */
|
|
|
+ addSettleUnit() {
|
|
|
+ this.settleTableData.unshift({
|
|
|
+ customerName: "",
|
|
|
+ customerRegion: "",
|
|
|
+ isEdit: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /* 初始化结算单位表格数据 */
|
|
|
+ async initSettleTableData() {
|
|
|
+ await this.getSettlementUnitList();
|
|
|
+ this.settleTableData = this.settlementUnitList.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isEdit: false,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 开始编辑结算单位
|
|
|
+ async editSettleUnit() {
|
|
|
+ let customerId = this.billingForm.customerId;
|
|
|
+ if (!customerId) {
|
|
|
+ this.$message.warning("请先选择客户名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.customName = this.customSelectData.find(
|
|
|
+ (item) => item.id == this.billingForm.customerId
|
|
|
+ )?.customName;
|
|
|
+ await this.initSettleTableData();
|
|
|
+ console.log(111);
|
|
|
+ this.innerVisible = true;
|
|
|
+ },
|
|
|
+ // 获取结算单位下拉框数据
|
|
|
+ async getSettlementUnitList() {
|
|
|
+ let customerId = this.billingForm.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);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 新增开票
|
|
|
+ addBilling() {
|
|
|
+ this.resetBillingForm();
|
|
|
+ this.billingVisible = true;
|
|
|
+ },
|
|
|
+ resetBillingForm() {
|
|
|
+ this.billingForm = {
|
|
|
+ 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("billingForm");
|
|
|
+ },
|
|
|
+ // 开票回调
|
|
|
+ async billingFlagChange(row) {
|
|
|
+ let billingFlag = row.billingFlag;
|
|
|
+ if (billingFlag == 1) {
|
|
|
+ //开票
|
|
|
+ this.currentRow = row;
|
|
|
+ this.addBilling();
|
|
|
+ } else {
|
|
|
+ this.$confirm("是否确认取消开票?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ // 取消开票
|
|
|
+ let payload = {
|
|
|
+ id: row.finishedProductInvoiceId,
|
|
|
+ accountsReceivableDetailId: row.id,
|
|
|
+ billingFlag: 0,
|
|
|
+ };
|
|
|
+ let res = await cancelBilling(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "取消开票成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消",
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
// 根据字典value获取字典label
|
|
|
getDictLabel(value, dict) {
|
|
|
return (
|
|
@@ -670,6 +1129,8 @@ export default {
|
|
|
},
|
|
|
// 修改回单数据
|
|
|
async returnReceiptChange(row) {
|
|
|
+ console.log(row.returnReceiptDate);
|
|
|
+ // return;
|
|
|
try {
|
|
|
let payLoad = {
|
|
|
id: row.id,
|