Commit c246af92 authored by 吴滔's avatar 吴滔

付款单

parent 3b15b096
......@@ -80,4 +80,72 @@ export function getPaymentList(query) {
method: 'get',
params: query
})
}
\ No newline at end of file
}
// 获取付款单详情
export function getPaymentInfoByIds(query) {
return request({
url: '/ecw/payment/get',
method: 'get',
params: query
})
}
// 获得付款单付款明细
export function getPaymentItem(query) {
return request({
url: '/ecw/payment/getPaymentItem',
method: 'get',
params: query
})
}
// 更新付款单
export function updatePayment(data) {
return request({
url: '/ecw/payment/update',
method: 'put',
data: data
})
}
// 删除付款单
export function deletePayment(id) {
return request({
url: '/ecw/payment/delete?id=' + id,
method: 'delete'
})
}
// 审核付款单
export function paymentVerify(query) {
return request({
url: '/ecw/payment/verify',
method: 'post',
data: query
})
}
// 核销付款单
export function paymentVerification(id) {
return request({
url: '/ecw/payment/verification/' + id,
method: 'GET'
})
}
// 反核销付款单
export function paymentVerificationCancel(id) {
return request({
url: '/ecw/payment/verificationCancel/' + id,
method: 'GET'
})
}
// 反审核付款单
export function paymentVerifyCancel(id) {
return request({
url: '/ecw/payment/verifyCancel/' + id,
method: 'GET'
})
}
......@@ -103,6 +103,7 @@ export const DICT_TYPE = {
ECW_BEGINTIME_TYPE_ENDTIME: 'begintime_type_endtime', // 时间筛选字段(订单)
ECW_CUSTOM_DRAWEE: 'custom_drawee', // 自定义付款人费用类型
ECW_IS_DRAFT: 'is_draft', // 草稿发布状态
ECW_PAYMENT_STATE: 'payment_state',//付款单状态
//--------ecw---------
CUSTOMER_STATUS: 'customer_status',
CUSTOMER_SOURCE: 'customer_source',
......
......@@ -404,7 +404,7 @@
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
<el-table-column label="订单号" align="center" prop="orderNo" />
<el-table-column label="唛头" align="center" prop="marks" />
<el-table-column label="品名" align="center" prop="title">
......
......@@ -162,7 +162,7 @@
size="mini"
@click="handleAdd"
style="padding: 10px; margin-bottom: 10px"
>添加供应商未付款项</el-button
>添加未付供应商款项</el-button
>
</el-col>
<el-table v-loading="loadings" :data="list" border :show-summary="!!list.length" :summary-method="getSummaries">
......@@ -175,15 +175,27 @@
></dict-tag>
</template>
</el-table-column>
<el-table-column label="发票号码" align="center" prop="invoiceNumber" />
<el-table-column label="发票号码" align="center" prop="invoiceNumber">
<template slot-scope="scope">
<el-input v-model="scope.row.invoiceNumber"></el-input>
</template>
</el-table-column>
<el-table-column label="应付金额" align="center" prop="totalAmount" />
<el-table-column label="币种" align="center" prop="currencyId">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="汇率" align="center" prop="exchangeRate" />
<el-table-column label="税率" align="center" prop="taxRate" />
<el-table-column label="汇率" align="center" prop="exchangeRate">
<template slot-scope="scope">
<el-input v-model="scope.row.exchangeRate"></el-input>
</template>
</el-table-column>
<el-table-column label="税率%" align="center" prop="taxRate" >
<template slot-scope="scope">
<el-input v-model="scope.row.taxRate" @keyup.native="scope.row.taxRate = oninput(scope.row.taxRate)"></el-input>
</template>
</el-table-column>
<el-table-column label="价税合计(RMB)" align="center" prop="total" />
</el-table>
......@@ -232,12 +244,12 @@
</el-form>
</el-card>
<div slot="footer" style="margin: 20px 0">
<el-button type="primary" @click="submitForm">保 存</el-button>
<el-button type="primary" @click="submitDraft">保 存</el-button>
<el-button type="primary" @click="submitForm">新 增</el-button>
</div>
<el-dialog
:visible.sync="open"
title="添加未收客户款项"
title="添加未付供应商款项"
width="80%"
append-to-body
@open="openDialog"
......@@ -356,7 +368,7 @@
@selection-change="handleSelectionChange"
row-key="id"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
<el-table-column label="自编号" align="center" prop="payableNo" />
<el-table-column label="货柜号" align="center" prop="containerNo" />
<el-table-column label="供应商" align="center" prop="supplierName" />
......@@ -383,7 +395,7 @@
@pagination="getList"
/>
<!-- </el-card> -->
<div slot="footer" class="dialog-footer">
<div slot="footer" style="margin: 20px 0; text-align: center;">
<el-button type="primary" @click="saveSelectList">确认添加</el-button>
<el-button @click="hiddenDialog">取 消</el-button>
</div>
......@@ -402,7 +414,7 @@ import { getBankAccountPage } from "@/api/ecw/bankAccount";
import { listSimpleDepts } from "@/api/system/dept";
import { getTradeCityList } from "@/api/ecw/region";
import { getSupplierPage } from "@/api/ecw/supplier";
import { getPayableList, getPayableInfoByIds, createPayment } from "@/api/ecw/financial"
import { getPayableList, getPayableInfoByIds, createPayment, getPaymentInfoByIds, getPaymentItem, updatePayment } from "@/api/ecw/financial"
export default {
name: "CreatPayment",
components: {
......@@ -411,6 +423,7 @@ export default {
data() {
return {
id: 0,
payableId: 0,
orderData: [],
total: 0,
loadings: false,
......@@ -418,6 +431,7 @@ export default {
form: {},
creatorData: [],
list: [],
defaultList: [],
channelList: [],
loading: "",
bankData: [],
......@@ -438,13 +452,29 @@ export default {
},
created() {
let that = this;
if (that.$route.query.id && that.$route.query.id !== '0') {
this.id = this.$route.query.id;
getPayableInfoByIds({ id: this.id }).then(res => {
if (that.$route.query.payableId && that.$route.query.payableId !== '0') {
this.payableId = this.$route.query.payableId;
getPayableInfoByIds({ id: this.payableId }).then(res => {
this.list = [{...res.data}]
this.$set(this.form, 'supplierId', res.data.supplierId)
})
}
if (that.$route.query.id && that.$route.query.id !== '0') {
this.id = this.$route.query.id;
getPaymentInfoByIds({ id: this.id }).then(res => {
this.form = {
...res.data,
latestPayAt: this.parseTime(res.data.latestPayAt, '{y}-{m}-{d}'),
applicationAt: this.parseTime(res.data.applicationAt, '{y}-{m}-{d}'),
supplierBankAccount: Number(res.data.supplierBankAccount),
invoiceStatus: String(res.data.invoiceStatus),
}
})
getPaymentItem({ id: this.id }).then(res => {
this.list = [...res.data]
this.defaultList = [...res.data]
})
}
userList("salesman").then((res) => (that.creatorData = res.data));
getChannelList().then((res) => (that.channelList = res.data));
getTradeCityList().then((res) => (that.tradeCityList = res.data));
......@@ -524,14 +554,41 @@ export default {
if (this.list && this.list.length > 0) {
params.payableReqVOList = [...this.list]
}
createPayment(params).then(res => {
this.$modal.msgSuccess("新增成功");
})
if (params.payableReqVOList.length === 0) {
this.$modal.msgError("请选择供应商未付款项");
return
}
if (this.id && this.id !== '0') {
updatePayment(params).then(res => {
this.$modal.msgSuccess("修改成功");
this.$router.back();
})
} else {
createPayment(params).then(res => {
this.$modal.msgSuccess("新增成功");
this.$router.back();
})
}
}
})
}
})
},
submitDraft() {
this.$refs.form.validate ((valid)=>{
if (valid) {
const params = {...this.form}
if (this.list && this.list.length > 0) {
params.payableReqVOList = [...this.list]
}
if (params.payableReqVOList.length === 0) {
this.$modal.msgError("请选择供应商未付款项");
return
}
// console.log(params, '-----params---------')
}
})
},
selectChange(val) {
const t = this.allSupplier.find(v => v.id == val)
t && (this.form.supplierName = t.companyZh)
......@@ -544,7 +601,11 @@ export default {
this.open = false;
},
saveSelectList() {
this.list = this.multipleSelection
if (this.id && this.id !== '0') {
this.list = [...this.defaultList, ...this.multipleSelection]
} else {
this.list = this.multipleSelection
}
this.open = false;
},
convertCurrency(money) {
......@@ -638,6 +699,34 @@ export default {
},
openDialog() {
this.getList()
},
oninput(num) {
let str = num
let len1 = str.substr(0, 1)
let len2 = str.substr(1, 1)
//如果第一位是0,第二位不是点,就用数字把点替换掉
if (str.length > 1 && len1 == 0 && len2 != '.') {
str = str.substr(1, 1)
}
//第一位不能是.
if (len1 == '.') {
str = ''
}
//限制只能输入一个小数点
if (str.indexOf('.') != -1) {
let str_ = str.substr(str.indexOf('.') + 1)
if (str_.indexOf('.') != -1) {
str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
} else {
// if (str_.length > 2) {
// str = str.substr(0, str.indexOf('.') + 1) + str_.substr(0, 2)
// }
}
}
//正则替换
str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
// str = str.replace(/\.\d\d\d$/,'') // 小数点后只能输两位
return str
}
},
};
......
......@@ -290,7 +290,7 @@ export default {
},
/** 新增按钮操作 */
handleAdd(id) {
return this.$router.push("creatPayment?id=" + id);
return this.$router.push("creatPayment?payableId=" + id);
},
submitEditForm() {
const params = {
......@@ -328,10 +328,6 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
// deletePayable({ id: row.id }).then(res => {
// this.getList()
// this.$modal.msgSuccess("删除成功");
// })
},
},
};
......
<template>
<div class="app-container examine-wrap">
<el-card>
<div slot="header" class="card-title">审核请款单</div>
<el-descriptions :column="3" class="card" border>
<el-descriptions-item label="供应商">
{{ detail.supplierName }}
</el-descriptions-item>
<el-descriptions-item label="部门">
{{ findDepartmentName(detail.departmentId) }}
</el-descriptions-item>
<el-descriptions-item label="业务员">
{{ detail.salesmanName }}
</el-descriptions-item>
<el-descriptions-item label="申请日期">
{{ detail.applicationAt }}
</el-descriptions-item>
<el-descriptions-item label="供应商银行账号" style="width: 50%">
{{ findBank(detail.supplierBankAccount) }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="3" class="card" border>
<el-descriptions-item label="最后付款日期">
{{ detail.latestPayAt }}
</el-descriptions-item>
<el-descriptions-item label="结算方式">
<!-- {{ detail.settlementType }} -->
<dict-tag :type="DICT_TYPE.CUSTOMER_BALANCE" :value="detail.settlementType"></dict-tag>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="card">
<div slot="header" class="card-title">费用信息</div>
<el-table v-loading="loadings" :data="list" border :show-summary="!!list.length" :summary-method="getSummaries">
<el-table-column label="自编号" align="center" prop="payableNo" />
<el-table-column label="费用类型" align="center" prop="feeType">
<template slot-scope="scope">
<dict-tag
:type="DICT_TYPE.FEE_TYPE"
:value="scope.row.feeType"
></dict-tag>
</template>
</el-table-column>
<el-table-column label="发票号码" align="center" prop="invoiceNumber">
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.invoiceNumber"></el-input>
</template> -->
</el-table-column>
<el-table-column label="应付金额" align="center" prop="totalAmount" />
<el-table-column label="币种" align="center" prop="currencyId">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="汇率" align="center" prop="exchangeRate">
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.exchangeRate"></el-input>
</template> -->
</el-table-column>
<el-table-column label="税率" align="center" prop="taxRate" >
<!-- <template slot-scope="scope">
<el-input v-model="scope.row.taxRate"></el-input>
</template> -->
</el-table-column>
<el-table-column label="价税合计(RMB)" align="center" prop="total" />
</el-table>
<el-descriptions :column="1" class="card" border>
<el-descriptions-item label="账单号">
{{ detail.accountNumber }}
</el-descriptions-item>
<el-descriptions-item label="发票">
{{ detail.invoiceStatus == 0 ? '未开票' : '已开票' }}
</el-descriptions-item>
<el-descriptions-item label="审核备注">
<el-input type="textarea" :rows="2" v-model="notes">
</el-input>
</el-descriptions-item>
</el-descriptions>
</el-card>
<div slot="footer" style="margin: 20px 0">
<el-button type="primary" @click="examine('y')">审核通过</el-button>
<el-button type="danger" @click="examine('n')">审核驳回</el-button>
</div>
</div>
</template>
<script>
import { getBankAccountPage } from "@/api/ecw/bankAccount";
import { listSimpleDepts } from "@/api/system/dept";
import { getPaymentInfoByIds, getPaymentItem, paymentVerify } from "@/api/ecw/financial"
export default {
name: "CreatPayment",
components: {
// CustomerSelector
},
data() {
return {
id: 0,
loadings: false,
detail: {},
list: [],
bankData: [],
params: {
page: 1,
rows: 20,
},
deptData: [],
deptArr: [],
notes: ''
};
},
created() {
let that = this;
if (that.$route.query.id && that.$route.query.id !== '0') {
this.id = this.$route.query.id;
getPaymentInfoByIds({ id: this.id }).then(res => {
this.detail = {
...res.data,
latestPayAt: this.parseTime(res.data.latestPayAt, '{y}-{m}-{d}'),
applicationAt: this.parseTime(res.data.applicationAt, '{y}-{m}-{d}'),
supplierBankAccount: Number(res.data.supplierBankAccount),
invoiceStatus: String(res.data.invoiceStatus),
}
})
getPaymentItem({ id: this.id }).then(res => {
this.list = [...res.data]
})
}
getBankAccountPage(that.params).then((res) => (that.bankData = res.data.list));
listSimpleDepts().then((res) => {
res.data.forEach((item) => {
if (item.parentId == 0) {
that.deptArr.push(item);
} else {
that.deptData.push(item);
}
});
that.deptData.forEach((value) => {
var dept = that.deptArr.filter((itt) => itt.id == value.parentId);
if (dept.length > 0) {
value.name = dept[0].name + " | " + value.name;
}
});
});
},
methods: {
getSummaries(param) {
const { columns, data } = param;
const sums = new Array(columns.length).map(v => '');
const index = sums.length - 1
sums[index - 1] = '价税合计大写'
const t = data.map(v => v.total).reduce((prev, curr) => {
return prev + curr;
}, 0)
sums[index] = this.convertCurrency(t)
return sums;
},
examine(status) {
const params = {
notes: this.notes,
paymentId: this.detail.id,
verifyStatus: status
}
paymentVerify(params).then(res => {
this.$modal.msgSuccess("操作成功");
this.$router.back();
})
},
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
},
findDepartmentName(val) {
return this.deptData.find(v => v.id == val) ? this.deptData.find(v => v.id == val).name : ''
},
findBank(val) {
const t = this.bankData.find(v => v.id == val)
return t ? t.baAccountName + '(' + t.baAccountNum + ')' : ''
}
},
};
</script>
<style lang="scss" scoped>
.examine-wrap {
::v-deep .is-bordered-label {
width: 200px;
}
}
.card {
margin-top: 20px;
}
.dialog-footer {
padding: 40px;
}
.card-title {
font-size: 18px;
font-weight: bold;
}
</style>
......@@ -53,7 +53,7 @@
</el-select>
</el-form-item>
<el-form-item label="状态:">
<dict-selector :type="DICT_TYPE.ECW_RECEIPT_STATE" v-model="queryParams.state" />
<dict-selector :type="DICT_TYPE.ECW_PAYMENT_STATE" v-model="queryParams.state" />
</el-form-item>
</el-row>
<el-row :span="24">
......@@ -101,12 +101,12 @@
<el-table-column label="供应商" align="center" prop="supplierName" />
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="最后付款时间" align="center" prop="latestPayAt">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.latestPayAt) }}</span>
<span>{{ parseTime(scope.row.latestPayAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="发票" align="center" prop="invoiceStatus">
......@@ -116,11 +116,10 @@
</el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<span>{{ stateMap(scope.row.state) }}</span>
<!-- <dict-tag
:type="DICT_TYPE.ECW_RECEIPT_STATE"
<dict-tag
:type="DICT_TYPE.ECW_PAYMENT_STATE"
:value="scope.row.state"
/> -->
/>
</template>
</el-table-column>
<el-table-column
......@@ -130,16 +129,16 @@
>
<template slot-scope="scope">
<el-button v-if="scope.row.state == 1 || scope.row.state == 3" size="mini" @click="handleAdd(scope.row.id)" type="text">编辑</el-button>
<el-button v-if="scope.row.state == 1 || scope.row.state == 3" size="mini" type="text">审核</el-button>
<el-button v-if="scope.row.state == 1 || scope.row.state == 3" size="mini" type="text" @click="examineClick(scope.row.id)">审核</el-button>
<el-button v-if="scope.row.state == 2" size="mini" type="text">反审核</el-button>
<el-button v-if="scope.row.state == 2" size="mini" type="text">核销</el-button>
<el-button v-if="scope.row.state == 2" size="mini" type="text" @click="verifyCancelClick(scope.row)">反审核</el-button>
<el-button v-if="scope.row.state == 2" size="mini" type="text" @click="verificationClick(scope.row)">核销</el-button>
<el-button v-if="scope.row.state == 4" size="mini" type="text">反核销</el-button>
<el-button v-if="scope.row.state == 4" size="mini" type="text" @click="verificationCancelClick(scope.row)">反核销</el-button>
<!-- <el-button v-if="scope.row.state == 3" size="mini" type="text">开票</el-button> -->
<el-button size="mini" type="text" @click="toprint(scope.row.id)">打印</el-button>
<el-button v-if="scope.row.state == 1 || scope.row.state == 3" size="mini" type="text">删除</el-button>
<el-button v-if="scope.row.state == 1 || scope.row.state == 3" size="mini" type="text" @click="deleteClick(scope.row)">删除</el-button>
<!-- <el-button size="mini" type="text" @click="open = true">导出订单</el-button> -->
</template>
</el-table-column>
......@@ -189,7 +188,7 @@ import { userList } from "@/api/system/user";
import { DICT_TYPE } from "@/utils/dict";
import CustomerSelector from "@/components/CustomerSelector";
import { getSupplierPage } from "@/api/ecw/supplier";
import { getPaymentList } from "@/api/ecw/financial"
import { getPaymentList, deletePayment, paymentVerification, paymentVerificationCancel, paymentVerifyCancel } from "@/api/ecw/financial"
export default {
name: "paymentVoucher",
......@@ -268,17 +267,56 @@ export default {
case 2:
return '已审核待核销'
case 3:
return '已核销'
case 4:
return '审批驳回'
case 4:
return '已核销'
}
},
/** 新增按钮操作 */
handleAdd(id) {
return this.$router.push("creatCollection?id=" + id);
return this.$router.push("creatPayment?id=" + id);
},
examineClick(id) {
return this.$router.push("paymentExamine?id=" + id);
},
deleteClick(row) {
const id = row.id;
this.$modal.confirm('是否确认删除该应付款?').then(function() {
return deletePayment(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
verificationClick(row) {
const id = row.id;
this.$modal.confirm('您确认要核销吗?').then(function() {
return paymentVerification(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("核销成功");
}).catch(() => {});
},
verificationCancelClick(row) {
const id = row.id;
this.$modal.confirm('您确认要反核销吗?').then(function() {
return paymentVerificationCancel(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("反核销成功");
}).catch(() => {});
},
verifyCancelClick(row) {
const id = row.id;
this.$modal.confirm('您确认要反审核吗?').then(function() {
return paymentVerifyCancel(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("反审核成功");
}).catch(() => {});
},
toprint(id) {
return this.$router.push("printVoucher?id=" + id);
return this.$router.push("printPaymentVoucher?id=" + id);
},
submitForm() {
this.open = false;
......
This diff is collapsed.
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