|
@@ -178,6 +178,28 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item
|
|
|
+ label="购买方开票信息"
|
|
|
+ label-width="125px"
|
|
|
+ prop="inv_out"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm1.inv_out"
|
|
|
+ :disabled="disableds"
|
|
|
+ placeholder="请选择购买方开票信息"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in invoiceList"
|
|
|
+ :key="item.companyNo"
|
|
|
+ :label="item.company_name"
|
|
|
+ :value="item.companyNo"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
<el-col :span="12" v-if="ruleForm1.type === '2'">
|
|
|
<el-form-item label="开票总金额" prop="total">
|
|
@@ -353,7 +375,7 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tooltip
|
|
|
- class="item"
|
|
|
+
|
|
|
effect="dark"
|
|
|
v-if="isDetail === '003' || isDetail === '005'"
|
|
|
content="编辑"
|
|
@@ -366,7 +388,7 @@
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
<el-tooltip
|
|
|
- class="item"
|
|
|
+
|
|
|
effect="dark"
|
|
|
content="删除"
|
|
|
v-if="isDetail === '003'"
|
|
@@ -596,7 +618,7 @@
|
|
|
>
|
|
|
<template>
|
|
|
<el-tooltip
|
|
|
- class="item"
|
|
|
+
|
|
|
effect="dark"
|
|
|
content="删除"
|
|
|
v-if="isDetail === '003'"
|
|
@@ -706,6 +728,7 @@ export default {
|
|
|
showOrderModel: false,
|
|
|
showCapitalModel: false,
|
|
|
cwRes: null,
|
|
|
+ invoiceList: [],
|
|
|
tableData: [],
|
|
|
capitalTableData: [],
|
|
|
activeIndex: 0,
|
|
@@ -769,6 +792,7 @@ export default {
|
|
|
invoice_bank: "",
|
|
|
invoice_bankNo: "",
|
|
|
invoice_addr: "",
|
|
|
+ inv_out: "",
|
|
|
invoice_mobile: "",
|
|
|
type: "",
|
|
|
total: 0,
|
|
@@ -780,6 +804,13 @@ export default {
|
|
|
companyNo: [
|
|
|
{ required: true, message: "请选择申请企业", trigger: "change" },
|
|
|
],
|
|
|
+ inv_out: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择购买方开票信息",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
inv_add: [
|
|
|
{ required: true, message: "请选择发票抬头类型", trigger: "change" },
|
|
|
],
|
|
@@ -821,10 +852,7 @@ export default {
|
|
|
|
|
|
dataForm: {
|
|
|
name: "", // 业务员名字
|
|
|
- // username: "", //账号
|
|
|
status: "", //
|
|
|
- // page: 1, // 页码
|
|
|
- // size: 5, // 每页显示条数
|
|
|
},
|
|
|
activeOptions: [],
|
|
|
groupallList: [],
|
|
@@ -866,32 +894,7 @@ export default {
|
|
|
this.setform1();
|
|
|
}
|
|
|
},
|
|
|
- text_fun(e, index, key) {
|
|
|
- let p = e.target.parentElement;
|
|
|
- // console.log(index, key);
|
|
|
- this.tableData.map((v2) => {
|
|
|
- v2.remark_type = "text";
|
|
|
- v2.good_num_type = "text";
|
|
|
- v2.total_fee_type = "text";
|
|
|
- return v2;
|
|
|
- });
|
|
|
- this.tableData[index][key] = "input";
|
|
|
- this.$nextTick((v) => {
|
|
|
- if (p && p.firstElementChild && p.firstElementChild.firstElementChild) {
|
|
|
- p.firstElementChild.firstElementChild.focus();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- input_fun(index, key) {
|
|
|
- // console.log(index, key);
|
|
|
- this.tableData.map((v2) => {
|
|
|
- v2.remark_type = "text";
|
|
|
- v2.good_num_type = "text";
|
|
|
- v2.total_fee_type = "text";
|
|
|
- return v2;
|
|
|
- });
|
|
|
- this.tableData[index][key] = "text";
|
|
|
- },
|
|
|
+
|
|
|
orderRefresh(e) {
|
|
|
let arr = JSON.parse(JSON.stringify(this.tableData));
|
|
|
e.forEach((v1) => {
|
|
@@ -943,9 +946,9 @@ export default {
|
|
|
this.exam_remark = "";
|
|
|
this.loading = true;
|
|
|
this.cwRes = null;
|
|
|
- console.log(this.status);
|
|
|
this.disableds = this.isDetail !== "003" && this.isDetail !== "005";
|
|
|
this.tableData = [];
|
|
|
+ await this.getCompanylist();
|
|
|
if (this.isDetail === "003") {
|
|
|
this.title = "添加发票申请";
|
|
|
this.rulesThis = this.rules1;
|
|
@@ -965,6 +968,21 @@ export default {
|
|
|
}
|
|
|
this.loading = false;
|
|
|
},
|
|
|
+
|
|
|
+ async getCompanylist() {
|
|
|
+ this.invoiceList = [];
|
|
|
+ const res = await asyncRequest.companylist({
|
|
|
+ page: 1,
|
|
|
+ size: 30,
|
|
|
+ });
|
|
|
+ if (res && res.code === 0 && res.data && res.data.list) {
|
|
|
+ this.invoiceList = res.data.list;
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.invoiceList = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
async selectChange() {
|
|
|
let arr = JSON.parse(JSON.stringify(this.ruleForm1.companyNo));
|
|
|
|
|
@@ -1059,9 +1077,6 @@ export default {
|
|
|
}
|
|
|
this.validateFormField();
|
|
|
}
|
|
|
- console.log(this.cwRes);
|
|
|
- console.log(this.ruleForm1);
|
|
|
-
|
|
|
this.activeOptions2 = [data];
|
|
|
this.ruleForm1.invoice_title = [data.id];
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
@@ -1088,7 +1103,6 @@ export default {
|
|
|
}
|
|
|
this.validateFormField();
|
|
|
}
|
|
|
- console.log(data);
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -1121,9 +1135,7 @@ export default {
|
|
|
this.selectLoading2 = true;
|
|
|
if (query !== "") {
|
|
|
this.activeOptions2 = [];
|
|
|
- // this.formValue.company = query;
|
|
|
const res = await asyncRequest.invoicelist({ name: query });
|
|
|
- console.log(res);
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
this.activeOptions2 = res.data;
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
@@ -1137,9 +1149,7 @@ export default {
|
|
|
this.selectLoading2 = false;
|
|
|
},
|
|
|
async initData() {
|
|
|
- // this.loading = true;
|
|
|
const res = await asyncRequest.detail({ id: this.id });
|
|
|
- // this.loading = false;
|
|
|
if (
|
|
|
res &&
|
|
|
res.code === 0 &&
|
|
@@ -1147,48 +1157,65 @@ export default {
|
|
|
res.data.customer &&
|
|
|
res.data.customer.companyNo
|
|
|
) {
|
|
|
- const data = res.data;
|
|
|
- const customer = res.data.customer;
|
|
|
+ const {
|
|
|
+ invoice_title,
|
|
|
+ invoice_code,
|
|
|
+ invoice_bank,
|
|
|
+ invoice_bankNo,
|
|
|
+ invoice_addr,
|
|
|
+ invoice_mobile,
|
|
|
+ inv_type,
|
|
|
+ type_check,
|
|
|
+ customer,
|
|
|
+ inv_value,
|
|
|
+ remark,
|
|
|
+ inv_add,
|
|
|
+ exam_remark,
|
|
|
+ order,
|
|
|
+ trade,
|
|
|
+ inv_out,
|
|
|
+ } = res.data;
|
|
|
+ const { companyNo } = customer;
|
|
|
+ // const data = res.data;
|
|
|
+ // const customer = res.data.customer;
|
|
|
|
|
|
this.cwRes = {
|
|
|
id: "0",
|
|
|
companyNo: "0",
|
|
|
companyName: "0",
|
|
|
- invoice_title: data.invoice_title,
|
|
|
- invoice_code: data.invoice_code,
|
|
|
- invoice_bank: data.invoice_bank,
|
|
|
- invoice_bankNo: data.invoice_bankNo,
|
|
|
- invoice_addr: data.invoice_addr,
|
|
|
- invoice_mobile: data.invoice_mobile,
|
|
|
+ invoice_title: invoice_title,
|
|
|
+ invoice_code: invoice_code,
|
|
|
+ invoice_bank: invoice_bank,
|
|
|
+ invoice_bankNo: invoice_bankNo,
|
|
|
+ invoice_addr: invoice_addr,
|
|
|
+ invoice_mobile: invoice_mobile,
|
|
|
};
|
|
|
this.ruleForm1 = {
|
|
|
- companyNo: [customer.companyNo],
|
|
|
+ companyNo: [companyNo],
|
|
|
|
|
|
- inv_type: data.inv_type ? parseInt(data.inv_type) + "" : "",
|
|
|
- type: data.type_check ? parseInt(data.type_check) + "" : "",
|
|
|
- total: data.inv_value,
|
|
|
- remark: data.remark,
|
|
|
- inv_add: data.inv_add,
|
|
|
- invoice_title: [data.invoice_title],
|
|
|
- invoice_code: data.invoice_code,
|
|
|
- invoice_bank: data.invoice_bank,
|
|
|
- invoice_bankNo: data.invoice_bankNo,
|
|
|
- invoice_addr: data.invoice_addr,
|
|
|
- invoice_mobile: data.invoice_mobile,
|
|
|
+ inv_type: inv_type ? parseInt(inv_type) + "" : "",
|
|
|
+ type: type_check ? parseInt(type_check) + "" : "",
|
|
|
+ total: inv_value,
|
|
|
+ remark: remark,
|
|
|
+ inv_add: inv_add,
|
|
|
+ inv_out: inv_out,
|
|
|
+ invoice_title: [invoice_title],
|
|
|
+ invoice_code: invoice_code,
|
|
|
+ invoice_bank: invoice_bank,
|
|
|
+ invoice_bankNo: invoice_bankNo,
|
|
|
+ invoice_addr: invoice_addr,
|
|
|
+ invoice_mobile: invoice_mobile,
|
|
|
};
|
|
|
this.activeOptions = [customer];
|
|
|
- this.remark = data.remark;
|
|
|
- this.exam_remark = data.exam_remark;
|
|
|
+ this.remark = remark;
|
|
|
+ this.exam_remark = exam_remark;
|
|
|
console.log(this.ruleForm1);
|
|
|
if (!this.disableds) {
|
|
|
this.changetype(this.ruleForm1.type);
|
|
|
}
|
|
|
- console.log(res.data.order.good);
|
|
|
let good =
|
|
|
- res.data.order &&
|
|
|
- res.data.order.good &&
|
|
|
- res.data.order.good.length > 0
|
|
|
- ? JSON.parse(JSON.stringify(res.data.order.good))
|
|
|
+ order && order.good && order.good.length > 0
|
|
|
+ ? JSON.parse(JSON.stringify(order.good))
|
|
|
: [];
|
|
|
good.map((v1) => {
|
|
|
v1.sequenceNo = v1.goodNo;
|
|
@@ -1197,7 +1224,7 @@ export default {
|
|
|
return v1;
|
|
|
});
|
|
|
this.tableData = good;
|
|
|
- this.capitalTableData = data.trade;
|
|
|
+ this.capitalTableData = trade;
|
|
|
this.capitalTableData.forEach((v1, i1) => {
|
|
|
v1.customer = v1.companyName;
|
|
|
this.$set(this.capitalTableData, i1, v1);
|
|
@@ -1210,7 +1237,6 @@ export default {
|
|
|
console.log(this.ruleForm1);
|
|
|
},
|
|
|
changetype(val) {
|
|
|
- console.log(val, "1234");
|
|
|
if (this.rulesThis && this.rulesThis.total && this.rulesThis.remark) {
|
|
|
if (val === 1) {
|
|
|
this.rulesThis.total[0].required = false;
|
|
@@ -1259,7 +1285,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ //认领资金开票
|
|
|
async submitForm2() {
|
|
|
if (!this.loading) {
|
|
|
// remark;
|
|
@@ -1268,27 +1294,16 @@ export default {
|
|
|
this.$message.warning("请选择资金!");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- const obj = JSON.parse(JSON.stringify(this.ruleForm1));
|
|
|
const list = [];
|
|
|
this.capitalTableData.forEach((v1) => {
|
|
|
list.push(v1.traNo);
|
|
|
});
|
|
|
- const model = {
|
|
|
- invNo: this.invNo,
|
|
|
- traNo: list,
|
|
|
- inv_add: obj.inv_add,
|
|
|
- companyNo: obj.companyNo.join(), //企业
|
|
|
- inv_type: obj.inv_type + "", //发票类型
|
|
|
- invoice_title:
|
|
|
- obj.inv_add == "0" ? this.cwRes.invoice_title : obj.invoice_title,
|
|
|
- invoice_code: obj.invoice_code,
|
|
|
- invoice_bank: obj.invoice_bank,
|
|
|
- invoice_bankNo: obj.invoice_bankNo,
|
|
|
- invoice_addr: obj.invoice_addr,
|
|
|
- invoice_mobile: obj.invoice_mobile,
|
|
|
- remark: this.remark,
|
|
|
- };
|
|
|
+ const model = await this.setInputForm(1);
|
|
|
+ model.traNo = list;
|
|
|
+ delete model["total"];
|
|
|
+ delete model["good"];
|
|
|
+
|
|
|
+ console.log(model);
|
|
|
this.loading = true;
|
|
|
let res = {};
|
|
|
if (this.id === "add") {
|
|
@@ -1318,22 +1333,10 @@ export default {
|
|
|
async mAddOrUpdate() {
|
|
|
if (!this.loading) {
|
|
|
this.loading = true;
|
|
|
- const obj = JSON.parse(JSON.stringify(this.ruleForm1));
|
|
|
- const model = {
|
|
|
- invNo: this.invNo,
|
|
|
- companyNo: obj.companyNo.join(), //企业
|
|
|
- inv_type: obj.inv_type + "", //发票类型
|
|
|
- total: obj.total + "", //金额
|
|
|
- remark: obj.remark + "",
|
|
|
- inv_add: obj.inv_add,
|
|
|
- invoice_title:
|
|
|
- obj.inv_add == "0" ? this.cwRes.invoice_title : obj.invoice_title,
|
|
|
- invoice_code: obj.invoice_code,
|
|
|
- invoice_bank: obj.invoice_bank,
|
|
|
- invoice_bankNo: obj.invoice_bankNo,
|
|
|
- invoice_addr: obj.invoice_addr,
|
|
|
- invoice_mobile: obj.invoice_mobile,
|
|
|
- };
|
|
|
+ const model = await this.setInputForm();
|
|
|
+ delete model["traNo"];
|
|
|
+ delete model["good"];
|
|
|
+ console.log(model);
|
|
|
let res = {};
|
|
|
if (this.id === "add") {
|
|
|
delete model["invNo"];
|
|
@@ -1360,33 +1363,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ //订单开票
|
|
|
async submitForm() {
|
|
|
if (!this.loading) {
|
|
|
- // remark;
|
|
|
-
|
|
|
if (this.tableData.length === 0) {
|
|
|
this.$message.warning("请选择确认单商品");
|
|
|
return;
|
|
|
}
|
|
|
- const obj = JSON.parse(JSON.stringify(this.ruleForm1));
|
|
|
const list = JSON.parse(JSON.stringify(this.tableData));
|
|
|
let isok = true;
|
|
|
- let remark = true;
|
|
|
- const model = {
|
|
|
- invNo: this.invNo,
|
|
|
- companyNo: obj.companyNo.join(), //企业
|
|
|
- inv_type: obj.inv_type + "", //发票类型
|
|
|
- inv_add: obj.inv_add,
|
|
|
- invoice_title:
|
|
|
- obj.inv_add == "0" ? this.cwRes.invoice_title : obj.invoice_title,
|
|
|
- invoice_code: obj.invoice_code,
|
|
|
- invoice_bank: obj.invoice_bank,
|
|
|
- invoice_bankNo: obj.invoice_bankNo,
|
|
|
- invoice_addr: obj.invoice_addr,
|
|
|
- invoice_mobile: obj.invoice_mobile,
|
|
|
- good: [],
|
|
|
- remark: this.remark,
|
|
|
- };
|
|
|
+ let isremark = true;
|
|
|
+ const model = await this.setInputForm(1);
|
|
|
+ delete model["traNo"];
|
|
|
+ delete model["total"];
|
|
|
+ console.log(model);
|
|
|
list.forEach((v1) => {
|
|
|
if (v1.good_num === 0) {
|
|
|
isok = false;
|
|
@@ -1400,7 +1390,7 @@ export default {
|
|
|
}
|
|
|
let str = v1.remark.replace(/\s*/g, "");
|
|
|
if (str === "") {
|
|
|
- remark = false;
|
|
|
+ isremark = false;
|
|
|
}
|
|
|
let item = {
|
|
|
sequenceNo: v1.sequenceNo,
|
|
@@ -1415,7 +1405,7 @@ export default {
|
|
|
this.$message.error("商品数量/商品总额不能为0,商品单位不能为空!");
|
|
|
return;
|
|
|
}
|
|
|
- if (!remark) {
|
|
|
+ if (!isremark) {
|
|
|
this.$message.error("开票商品名不能为空!");
|
|
|
return;
|
|
|
}
|
|
@@ -1442,6 +1432,43 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ //解构接口入参字段重新组合
|
|
|
+ async setInputForm(type) {
|
|
|
+ const {
|
|
|
+ inv_add,
|
|
|
+ companyNo,
|
|
|
+ inv_type,
|
|
|
+ inv_out,
|
|
|
+ total,
|
|
|
+ remark,
|
|
|
+ invoice_title,
|
|
|
+ invoice_code,
|
|
|
+ invoice_bank,
|
|
|
+ invoice_bankNo,
|
|
|
+ invoice_addr,
|
|
|
+ invoice_mobile,
|
|
|
+ } = JSON.parse(JSON.stringify(this.ruleForm1));
|
|
|
+
|
|
|
+ const model = {
|
|
|
+ invNo: this.invNo,
|
|
|
+ traNo: [],
|
|
|
+ inv_add: inv_add,
|
|
|
+ companyNo: companyNo.join(), //企业
|
|
|
+ inv_type: inv_type + "", //发票类型
|
|
|
+ inv_out: inv_out,
|
|
|
+ total: total + "", //金额
|
|
|
+ remark: type ? this.remark : remark + "",
|
|
|
+ invoice_title:
|
|
|
+ inv_add == "0" ? this.cwRes.invoice_title : invoice_title,
|
|
|
+ invoice_code: invoice_code,
|
|
|
+ good: [],
|
|
|
+ invoice_bank: invoice_bank,
|
|
|
+ invoice_bankNo: invoice_bankNo,
|
|
|
+ invoice_addr: invoice_addr,
|
|
|
+ invoice_mobile: invoice_mobile,
|
|
|
+ };
|
|
|
+ return model;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|