Commit 7fcbd165 authored by 吴滔's avatar 吴滔

编辑/新增收款单联调/详情微调/开票税价计算

parent 41b58be7
......@@ -46,20 +46,20 @@ export function getReceiptList(query) {
}
// 核销收款单
export function receiptVerification(id) {
return request({
url: '/ecw/receipt/verification/' + id,
method: 'GET'
})
}
// export function receiptVerification(id) {
// return request({
// url: '/ecw/receipt/verification/' + id,
// method: 'GET'
// })
// }
// 反核销收款单
export function receiptVerificationCancel(id) {
return request({
url: '/ecw/receipt/verificationCancel/' + id,
method: 'GET'
})
}
// export function receiptVerificationCancel(id) {
// return request({
// url: '/ecw/receipt/verificationCancel/' + id,
// method: 'GET'
// })
// }
// 获取收款单详情
export function getReceiptInfoByIds(query) {
......
<template>
<div class="dict-selector">
<el-select v-if="formType == 'select'" v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple" :disabled="disabled">
<el-select v-if="formType == 'select'" v-model="valueSync" :placeholder="placeholder" clearable :multiple="multiple" :disabled="disabled" @change="val => $emit('change', val)">
<el-option v-for="dict in formattedList"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
<el-descriptions-item label="纳税人识别号">{{ invoiceData.taxpayer }}</el-descriptions-item>
<el-descriptions-item label="地址">{{ invoiceData.addressPhone }}</el-descriptions-item>
<el-descriptions-item label="开户行">{{ invoiceData.accountBank }}</el-descriptions-item>
<el-descriptions-item label="税率">
<el-descriptions-item label="税率%">
<el-form-item label="">
<el-input v-model="invoiceData.taxRate"></el-input>
</el-form-item>
......@@ -57,24 +57,36 @@
</el-table-column>
<el-table-column label="箱数" align="center" prop="num" />
<el-table-column label="体积/重量" align="center" prop="weight"></el-table-column>
<el-table-column label="费用类型" align="center" prop="feeType">
<el-table-column label="收入类型" align="center" prop="feeType">
<template slot-scope="scope">
<dict-tag
:type="DICT_TYPE.ECW_TRANSPORT_TYPE"
:type="DICT_TYPE.FEE_TYPE"
:value="scope.row.feeType"
></dict-tag>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="unitPrice" />
<el-table-column label="总金额" align="center" prop="totalAmount" />
<el-table-column label="税额" align="center">
<el-table-column label="单价金额" align="center" prop="unitPrice">
<template slot-scope="scope">
<span>{{ scope.row.unitPrice }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="总金额" align="center" prop="totalAmount">
<template slot-scope="scope">
<span>{{ scope.row.totalAmount }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="税额" align="center" prop="tax">
<template slot-scope="scope">
<span>{{ scope.row.tax }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="价税合计" align="center">
<el-table-column label="价税合计" align="center" prop="taxAndTotalAmount">
<template slot-scope="scope">
<span>{{ scope.row.taxAndTotalAmount }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
</el-table>
......@@ -99,6 +111,7 @@
<script>
import { DICT_TYPE } from "@/utils/dict";
import { getReceiptInvoicing, getInvoicingItem, updateReceiptInvoicing } from "@/api/ecw/financial";
import NP from 'number-precision'
export default {
name: "OpenInvoice",
......@@ -118,9 +131,9 @@ export default {
}
},
methods: {
getData() {
async getData() {
this.loading = true;
getReceiptInvoicing(this.id).then((res) => {
await getReceiptInvoicing(this.id).then((res) => {
this.invoiceData = res.data;
this.invoiceData.invoicingTypeId = this.invoiceData.invoicingTypeId || ''
// if (!this.invoiceData.info || this.invoiceData.info.length == 0) {
......@@ -129,9 +142,15 @@ export default {
this.loading = false;
});
getInvoicingItem({ id: this.id }).then(res => {
res.data.map(v => {
v.tax = NP.times(v.totalAmount, this.invoiceData.taxRate/100)
v.taxAndTotalAmount = NP.plus(v.totalAmount, NP.times(v.totalAmount, this.invoiceData.taxRate/100))
})
const t = {
orderNo: '合计',
totalAmount: res.data.reduce((total, curr) => total + curr.totalAmount, 0)
totalAmount: res.data.reduce((total, curr) => NP.plus(total, curr.totalAmount), 0),
tax: res.data.reduce((total, curr) => NP.plus(total, curr.tax), 0),
taxAndTotalAmount: res.data.reduce((total, curr) => NP.plus(total, curr.taxAndTotalAmount), 0)
}
this.list = [...res.data, t]
})
......@@ -148,8 +167,98 @@ export default {
})
},
getSummaries(param) {
return ['收款人', this.invoiceData.payeeName, '核销人', this.invoiceData.writeOffName, '开票人', this.invoiceData.issuerName, '', '价税合计大写', 444];
const t = this.list[this.list.length - 1].taxAndTotalAmount
return ['收款人', this.invoiceData.payeeName, '核销人', this.invoiceData.writeOffName, '开票人', this.invoiceData.issuerName, '', '价税合计大写', this.convertCurrency(t)];
},
convertCurrency(money) {
//汉字的数字
var cnNums = new Array('', '', '', '', '', '', '', '', '', '');
//基本单位
var cnIntRadice = new Array('', '', '', '');
//对应整数部分扩展单位
var cnIntUnits = new Array('', '', '亿', '');
//对应小数部分单位
var cnDecUnits = new Array('', '', '', '');
//整数金额时后面跟的字符
var cnInteger = '';
//整型完以后的单位
var cnIntLast = '';
//最大处理的数字
var maxNum = 999999999999999.9999;
//金额整数部分
var integerNum;
//金额小数部分
var decimalNum;
//输出的中文金额字符串
var chineseStr = '';
//分离金额后用的数组,预定义
var parts;
// 传入的参数为空情况
if(money === '') {
return '';
}
money = parseFloat(money)
if(money >= maxNum){
return ''
}
// 传入的参数为0情况
if (money === 0) {
chineseStr = cnNums[0] + cnIntLast + cnInteger;
return chineseStr
}
// 转为字符串
money = money.toString();
// indexOf 检测某字符在字符串中首次出现的位置 返回索引值(从0 开始) -1 代表无
if (money.indexOf('.') == -1) {
integerNum = money;
decimalNum = ''
}else{
parts = money.split('.');
integerNum = parts[0];
decimalNum = parts[1].substr(0,4);
}
//转换整数部分
if(parseInt(integerNum,10) > 0){
let zeroCount = 0;
let IntLen = integerNum.length
for(let i = 0; i < IntLen; i++){
let n = integerNum.substr(i,1);
let p = IntLen - i - 1;
let q = p / 4;
let m = p % 4;
if( n == '0'){
zeroCount ++ ;
}else{
if(zeroCount > 0){
chineseStr += cnNums[0]
}
zeroCount = 0;
chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
}
if(m == 0 && zeroCount < 4){
chineseStr += cnIntUnits[q];
}
}
// 最后+ 元
chineseStr += cnIntLast;
}
// 转换小数部分
if(decimalNum != ''){
let decLen = decimalNum.length;
for(let i = 0; i <decLen; i++){
let n = decimalNum.substr(i,1);
if(n != '0'){
chineseStr += cnNums[Number(n)] + cnDecUnits[i]
}
}
}
if(chineseStr == ''){
chineseStr += cnNums[0] + cnIntLast + cnInteger;
}else if(decimalNum == ''){
chineseStr += cnInteger;
}
return chineseStr
}
},
};
</script>
......
......@@ -100,18 +100,11 @@
id:0
}
},
created() {
async created() {
let that = this
if(that.$route.query.id){
that.id = that.$route.query.id
that.getCollectionData()
getInvoicingItem({id: this.id}).then(res => {
this.list = res.data
})
}
listSimpleUsers().then(res =>that.creatorData = res.data)
getBankAccountPage(that.params).then(res =>that.bankData = res.data.list)
listSimpleDepts().then(res =>{
await listSimpleDepts().then(res =>{
res.data.forEach((item)=>{
if(item.parentId==0){
......@@ -130,12 +123,20 @@
})
})
if(that.$route.query.id){
that.id = that.$route.query.id
that.getCollectionData()
getInvoicingItem({id: this.id}).then(res => {
this.list = res.data
})
}
},
methods: {
getCollectionData(){
let that = this
getReceiptInfoByIds({id:that.id}).then(res =>{
that.form = res.data
that.form.departmentName = that.deptData.find(v => v.id == that.form.departmentId).name
})
},
print(){
......
This diff is collapsed.
......@@ -154,43 +154,44 @@
>
<template slot-scope="scope">
<el-button
v-if="scope.row.state === 0 || scope.row.state == 1 || scope.row.state == 5"
v-if="scope.row.state === 0 || scope.row.state == 1 || scope.row.state == 2 || scope.row.state == 3"
size="mini"
type="text"
@click="handleAdd(scope.row.id)"
>编辑</el-button
>
<el-button
v-if="scope.row.state == 1"
<!-- <el-button
v-if="scope.row.state == "
size="mini"
type="text"
@click="verificationClick(scope.row)"
>核销</el-button
>
> -->
<el-button
v-if="scope.row.state != 1 && scope.row.state != 5"
v-if="scope.row.state == 4 || scope.row.state == 5 || scope.row.state == 6"
size="mini"
type="text"
@click="verificationCancelClick(scope.row)"
>反核销</el-button
>
<el-button
v-if="scope.row.state == 3"
v-if="scope.row.state == 5"
size="mini"
type="text"
@click="openInvoice(scope.row.id)"
>开票</el-button
>
<el-button v-if="scope.row.state === 0" size="mini" type="text" @click="deleteClick(scope.row)">删除</el-button>
<el-button v-if="scope.row.state == 1 || scope.row.state == 2 || scope.row.state == 3" size="mini" type="text" @click="verificationCancelClick(scope.row)">收款</el-button>
<el-button v-if="scope.row.state == 0 || scope.row.state == 1" size="mini" type="text" @click="deleteClick(scope.row)">删除</el-button>
<el-button
v-if="scope.row.state != 5"
v-if="scope.row.state != 0"
size="mini"
type="text"
@click="toprint(scope.row.id)"
>打印</el-button
>
<el-button
v-if="scope.row.state != 5"
v-if="scope.row.state != 0"
size="mini"
type="text"
@click="exportReceipt(scope.row.id)"
......@@ -241,8 +242,8 @@ import { DICT_TYPE } from "@/utils/dict";
import CustomerSelector from "@/components/CustomerSelector";
import {
getReceiptList,
receiptVerification,
receiptVerificationCancel,
// receiptVerification,
// receiptVerificationCancel,
receiptExportExcel,
deleteReceipt
} from "@/api/ecw/financial";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment