|
@@ -1,6 +1,6 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { FormRules, ElForm } from "element-plus";
|
|
import { FormRules, ElForm } from "element-plus";
|
|
-import { reactive, ref, watchEffect } from "vue";
|
|
|
|
|
|
+import { reactive, ref, watchEffect, watch } from "vue";
|
|
import { httpAdd } from "/@/api/InvoiceSales/invoiceApply";
|
|
import { httpAdd } from "/@/api/InvoiceSales/invoiceApply";
|
|
import RemoteSelect from "/@/components/RemoteSelect";
|
|
import RemoteSelect from "/@/components/RemoteSelect";
|
|
import { httpInvoiceList } from "/@/api/InvoiceSales/invoiceApply";
|
|
import { httpInvoiceList } from "/@/api/InvoiceSales/invoiceApply";
|
|
@@ -9,10 +9,10 @@ import OrderDialog from "./order-dialog.vue";
|
|
import EditOrder from "./edit-order.vue";
|
|
import EditOrder from "./edit-order.vue";
|
|
import { useResponseHandle } from "/@/hooks";
|
|
import { useResponseHandle } from "/@/hooks";
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
-
|
|
|
|
|
|
+import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
|
|
import { inv_type_list } from "./../../status";
|
|
import { inv_type_list } from "./../../status";
|
|
import InvoiceTitle from "./invoice-title.vue";
|
|
import InvoiceTitle from "./invoice-title.vue";
|
|
-import { convertInvoiceTitle } from "./columns";
|
|
|
|
|
|
+import { convertInvoiceTitle, convertInvoiceTitleData } from "./columns";
|
|
import { ADD_EDIT_FORM_RULES, requriedEmail } from "./../../config/configs";
|
|
import { ADD_EDIT_FORM_RULES, requriedEmail } from "./../../config/configs";
|
|
|
|
|
|
enum FROM_TYPE {
|
|
enum FROM_TYPE {
|
|
@@ -36,7 +36,7 @@ const initform = {
|
|
buy_id: "", //购买方公司抬头
|
|
buy_id: "", //购买方公司抬头
|
|
invtype: "", //开票类型
|
|
invtype: "", //开票类型
|
|
email: "", //邮箱
|
|
email: "", //邮箱
|
|
- remark: "", //备注
|
|
|
|
|
|
+ remark: "", //发票备注
|
|
exam_remark: "", //申请备注
|
|
exam_remark: "", //申请备注
|
|
orderArr: [], //开票销售单明细 obj:sequenceNo//销售单编号 inv_fee//销售单开票金额,
|
|
orderArr: [], //开票销售单明细 obj:sequenceNo//销售单编号 inv_fee//销售单开票金额,
|
|
companyType: "01"
|
|
companyType: "01"
|
|
@@ -58,8 +58,23 @@ function handleEdit({ row, inv_fee, num }) {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const removeRemarkPo = (poCode: string, index: number) => {
|
|
|
|
+ const isLast = index === orderList.value.length - 1;
|
|
|
|
+ const isOnly = orderList.value.length === 1;
|
|
|
|
+
|
|
|
|
+ if (isOnly)
|
|
|
|
+ return (ruleForm.value.remark = ruleForm.value.remark
|
|
|
|
+ .split(poCode)
|
|
|
|
+ .join(""));
|
|
|
|
+
|
|
|
|
+ ruleForm.value.remark = ruleForm.value.remark
|
|
|
|
+ .split(isLast ? ";" + poCode : poCode + ";")
|
|
|
|
+ .join("");
|
|
|
|
+};
|
|
|
|
+
|
|
const handleDelete = (index: number) => {
|
|
const handleDelete = (index: number) => {
|
|
- const { sequenceNo } = orderList.value[index];
|
|
|
|
|
|
+ const { sequenceNo, poCode } = orderList.value[index];
|
|
|
|
+ removeRemarkPo(poCode, index);
|
|
delete mapSequenceNoToInvfee.value[sequenceNo];
|
|
delete mapSequenceNoToInvfee.value[sequenceNo];
|
|
orderList.value.splice(index, 1);
|
|
orderList.value.splice(index, 1);
|
|
};
|
|
};
|
|
@@ -102,11 +117,15 @@ function menu_type_change() {
|
|
|
|
|
|
function handleAddOrder(list) {
|
|
function handleAddOrder(list) {
|
|
orderList.value = list;
|
|
orderList.value = list;
|
|
- list.forEach(({ sequenceNo, winv_fee, goodNum }) => {
|
|
|
|
|
|
+ ruleForm.value.remark = "";
|
|
|
|
+
|
|
|
|
+ list.forEach(({ sequenceNo, winv_fee, wsendNum, poCode }, index) => {
|
|
mapSequenceNoToInvfee.value[sequenceNo] = {
|
|
mapSequenceNoToInvfee.value[sequenceNo] = {
|
|
inv_fee: winv_fee,
|
|
inv_fee: winv_fee,
|
|
- num: goodNum
|
|
|
|
|
|
+ num: wsendNum
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ ruleForm.value.remark += index === 0 ? poCode : ";" + poCode;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -125,20 +144,17 @@ function handleInvoiceTitle(
|
|
}
|
|
}
|
|
|
|
|
|
_isSeller
|
|
_isSeller
|
|
- ? (sellerInvoiceTitle.value = convertInvoiceTitle(invoiceTitle))
|
|
|
|
- : (purchaserInvoiceTitle.value = invoiceTitle);
|
|
|
|
|
|
+ ? (sellerInvoiceTitle.value = convertInvoiceTitleData(
|
|
|
|
+ convertInvoiceTitle(invoiceTitle)
|
|
|
|
+ ))
|
|
|
|
+ : (purchaserInvoiceTitle.value = convertInvoiceTitleData(invoiceTitle));
|
|
}
|
|
}
|
|
|
|
|
|
const setSellerInvoiceTitle = handleInvoiceTitle.bind(null, true);
|
|
const setSellerInvoiceTitle = handleInvoiceTitle.bind(null, true);
|
|
const setPurchaserInvoiceTitle = handleInvoiceTitle.bind(null, false);
|
|
const setPurchaserInvoiceTitle = handleInvoiceTitle.bind(null, false);
|
|
|
|
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
- const { companyNo, buy_id, invtype } = ruleForm.value;
|
|
|
|
- if (!companyNo || !buy_id) {
|
|
|
|
- orderList.value = [];
|
|
|
|
- mapSequenceNoToInvfee.value = {};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ const { invtype } = ruleForm.value;
|
|
if (["3", "4"].includes(invtype)) {
|
|
if (["3", "4"].includes(invtype)) {
|
|
rules.email[0].required = true;
|
|
rules.email[0].required = true;
|
|
rules.email[0].validator = requriedEmail;
|
|
rules.email[0].validator = requriedEmail;
|
|
@@ -147,6 +163,15 @@ watchEffect(() => {
|
|
rules.email[0].validator = () => true;
|
|
rules.email[0].validator = () => true;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+watch(
|
|
|
|
+ () => ruleForm.value.companyNo,
|
|
|
|
+ () => {
|
|
|
|
+ ruleForm.value.remark = "";
|
|
|
|
+ orderList.value = [];
|
|
|
|
+ mapSequenceNoToInvfee.value = {};
|
|
|
|
+ }
|
|
|
|
+);
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -221,14 +246,15 @@ watchEffect(() => {
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
- <el-form-item label="开票备注" prop="remark" label-width="135px">
|
|
|
|
|
|
+ <el-form-item label="发票备注" prop="remark" label-width="135px">
|
|
<el-input
|
|
<el-input
|
|
w-full
|
|
w-full
|
|
v-model="ruleForm.remark"
|
|
v-model="ruleForm.remark"
|
|
:rows="3"
|
|
:rows="3"
|
|
type="textarea"
|
|
type="textarea"
|
|
- maxlength="2000"
|
|
|
|
- placeholder="申请备注"
|
|
|
|
|
|
+ maxlength="184"
|
|
|
|
+ show-word-limit
|
|
|
|
+ placeholder="发票备注"
|
|
/> </el-form-item
|
|
/> </el-form-item
|
|
></el-col>
|
|
></el-col>
|
|
|
|
|
|
@@ -244,62 +270,77 @@ watchEffect(() => {
|
|
/> </el-form-item
|
|
/> </el-form-item
|
|
></el-col>
|
|
></el-col>
|
|
<el-col :span="24" v-show="TYPE === 'order'">
|
|
<el-col :span="24" v-show="TYPE === 'order'">
|
|
- <el-table :data="orderList" stripe border>
|
|
|
|
- <el-table-column
|
|
|
|
- prop="sequenceNo"
|
|
|
|
- label="销售订单编号"
|
|
|
|
- width="200"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="customerNo"
|
|
|
|
- label="购买方公司编号"
|
|
|
|
- width="200"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- prop="customerName"
|
|
|
|
- label="购买方公司名称"
|
|
|
|
- show-overflow-tooltip
|
|
|
|
- width="200"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-form-item label="订单列表">
|
|
|
|
+ <div flex justify-between w-full mb-2>
|
|
|
|
+ <el-tag>共计:{{ orderList.length }}个订单</el-tag>
|
|
|
|
+ <el-button type="primary" @click="() => modelRef.show()"
|
|
|
|
+ >添加销售订单</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <el-table :data="orderList" stripe border>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="sequenceNo"
|
|
|
|
+ label="销售订单编号"
|
|
|
|
+ width="200"
|
|
|
|
+ />
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="poCode"
|
|
|
|
+ label="po编号"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ width="200"
|
|
|
|
+ />
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="customerNo"
|
|
|
|
+ label="购买方公司编号"
|
|
|
|
+ width="200"
|
|
|
|
+ />
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="customerName"
|
|
|
|
+ label="购买方公司名称"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ width="200"
|
|
|
|
+ />
|
|
|
|
+
|
|
|
|
+ <el-table-column prop="winv_fee" label="未开票" width="120" />
|
|
|
|
+ <el-table-column prop="wsendNum" label="未发数量" width="120" />
|
|
|
|
+
|
|
|
|
+ <el-table-column label="开票金额" width="110">
|
|
|
|
+ <template #="{ row }">{{
|
|
|
|
+ mapSequenceNoToInvfee[row.sequenceNo].inv_fee
|
|
|
|
+ }}</template>
|
|
|
|
+ </el-table-column>
|
|
|
|
|
|
- <el-table-column prop="ainv_fee" label="已开票" width="120" />
|
|
|
|
- <el-table-column prop="inv_fee" label="开票中" width="120" />
|
|
|
|
- <el-table-column prop="winv_fee" label="未开票" width="120" />
|
|
|
|
-
|
|
|
|
- <el-table-column label="开票金额" width="110">
|
|
|
|
- <template #="{ row }">{{
|
|
|
|
- mapSequenceNoToInvfee[row.sequenceNo].inv_fee
|
|
|
|
- }}</template>
|
|
|
|
- </el-table-column>
|
|
|
|
-
|
|
|
|
- <el-table-column>
|
|
|
|
- <template #header>
|
|
|
|
- <span>操作</span>
|
|
|
|
- <el-button
|
|
|
|
- size="small"
|
|
|
|
- class="fr"
|
|
|
|
- @click="() => modelRef.show()"
|
|
|
|
- >添加订单</el-button
|
|
|
|
- >
|
|
|
|
- </template>
|
|
|
|
- <template #default="scope">
|
|
|
|
- <el-button
|
|
|
|
- size="small"
|
|
|
|
- type="primary"
|
|
|
|
- link
|
|
|
|
- @click="handleShowEditModal(scope.$index, scope.row)"
|
|
|
|
- >编辑</el-button
|
|
|
|
- >
|
|
|
|
- <el-button
|
|
|
|
- size="small"
|
|
|
|
- type="danger"
|
|
|
|
- link
|
|
|
|
- @click="handleDelete(scope.$index)"
|
|
|
|
- >删除</el-button
|
|
|
|
- >
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
|
|
+ <el-table-column label="开票数量" width="110">
|
|
|
|
+ <template #="{ row }">{{
|
|
|
|
+ mapSequenceNoToInvfee[row.sequenceNo].num
|
|
|
|
+ }}</template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+
|
|
|
|
+ <el-table-column label="业务员" prop="ownerName" width="80" />
|
|
|
|
+
|
|
|
|
+ <el-table-column fixed="right" width="70">
|
|
|
|
+ <template #header>
|
|
|
|
+ <span>操作</span>
|
|
|
|
+ </template>
|
|
|
|
+ <template #default="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ link
|
|
|
|
+ :icon="useRenderIcon('edits')"
|
|
|
|
+ @click="handleShowEditModal(scope.$index, scope.row)"
|
|
|
|
+ />
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="danger"
|
|
|
|
+ link
|
|
|
|
+ :icon="useRenderIcon('delete')"
|
|
|
|
+ @click="handleDelete(scope.$index)"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<div class="flex justify-end mt-2">
|
|
<div class="flex justify-end mt-2">
|