Files
JY1.0/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue
Vergil d1e4a8b647 a
2020-02-12 08:40:57 +08:00

497 lines
17 KiB
Vue

<template>
<div class="app-container">
<el-card>
<el-col :span="8">
<el-row>
<span>外协厂家:</span>
<el-input v-model="ManufacturerName" size="small" placeholder="外协厂家" clearable style="width:200px"/>
<el-button type="primary" class="el-icon-search" size="small" plain @click="pageCurrent=1;pageSize=50;getParts()">查询</el-button>
</el-row>
<el-table v-loading="loading" :data="tableData" size="mini" highlight-current-row height="500" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="rowClick">
<el-table-column label="厂家" prop="外协厂家名称" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="外协金额(元)" prop="总价" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.总价 }}
</template>
</el-table-column>
<el-table-column label="到票金额(元)" align="center" width="110px" prop="开票金额">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
<el-table-column label="付款金额(元)" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.付款金额 }}
</template>
</el-table-column>
<el-table-column label="未付金额(元)" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.应付金额 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[50, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-col>
<el-col :span="8">
<el-row>
<span style="margin-top: 10px">开票明细:</span>
<el-button class="button111" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="handleAdd1('form1')">新增</el-button>
</el-row>
<el-table v-loading="loading2" :data="tableData2" size="mini" stripe height="500" style="width: 100%" border element-loading-text="拼命加载中">
<el-table-column label="发票号" prop="发票号" align="center" width="180px">
<template slot-scope="scope">
{{ scope.row.发票号 }}
</template>
</el-table-column>
<el-table-column label="开票金额(元)" prop="开票金额" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
<el-table-column label="开票日期" align="center" width="100px" prop="开票日期">
<template slot-scope="scope">
{{ scope.row.开票时间 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading2"
:current-page="pageCurrent2"
:page-sizes="[50, 100]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-col>
<el-col :span="8">
<el-row>
<span style="margin-top: 10px">付款明细:</span>
<el-button class="button111" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="handleAdd2('form2')">新增</el-button>
</el-row>
<el-table v-loading="loading3" :data="tableData3" size="mini" stripe height="500" style="width: 100%" border element-loading-text="拼命加载中">
<el-table-column label="付款金额(元)" prop="付款金额" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.付款金额 }}
</template>
</el-table-column>
<el-table-column label="付款日期" prop="总价" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.付款日期 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading3"
:current-page="pageCurrent3"
:page-sizes="[50, 100]"
:page-size="pageSize3"
:total="total3"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</el-col>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" :title="title1" center style="min-height: 300px" width="400px">
<el-form ref="form1" :model="form1" :rules="rules" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-form-item label="发票号" prop="发票号" >
<el-input v-model="form1.发票号" placeholder="发票号" style="width:200px" clearable size="small"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票金额(元)" prop="开票金额">
<el-input v-model="form1.开票金额" placeholder="开票金额" style="width:200px" clearable size="small"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票时间" prop="开票时间">
<el-date-picker
v-model="form1.开票时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="开票时间"/>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff1('form1')">取消</el-button>
<el-button type="primary" @click="submit1('form1')" >确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible2" :title="title2" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules" label-position="left" label-width="120px" class="demo-ruleForm">
<el-row>
<el-form-item label="付款金额(元)" prop="付款金额">
<el-input v-model="form2.付款金额" placeholder="开票金额" style="width:200px" clearable size="small"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="付款时间" prop="付款时间">
<el-date-picker
v-model="form2.付款时间"
style="width:200px"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
clearable
placeholder="付款时间"/>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff2('form2')">取消</el-button>
<el-button type="primary" @click="submit2('form2')" >确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchtable, getInvoice, getPayment, AddType1, AddType2, handlechange, handledelete } from '@/api/Outsourcing/OutsourcingPaymentPlanManagement'
export default {
data() {
return {
ManufacturerName: '', // 外协厂家
外协厂家流水号: '',
外协厂家流水号_Select: '',
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 50, // 每页显示条数
pageCurrent: 1, // 后台获取页
loading2: false,
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 50, // 每页显示条数
pageCurrent2: 1, // 后台获取页
loading3: false,
tableData3: [], // 表格数据
total3: null, // 总条数
pageSize3: 50, // 每页显示条数
pageCurrent3: 1, // 后台获取页
param1: 0,
title1: '',
dialogFormVisible1: false,
form1: {
发票号: '',
开票时间: '',
开票金额: ''
},
param2: 0,
title2: '',
dialogFormVisible2: false,
form2: {
付款金额: '',
付款时间: ''
},
rules: {
发票号: [{ required: true, message: '请输入发票号', trigger: 'blur' }],
开票时间: [{ required: true, message: '请选择开票时间', trigger: 'change' }],
开票金额: [{ required: true, message: '请输入开票金额', trigger: 'blur' }],
付款时间: [{ required: true, message: '请选择开票时间', trigger: 'change' }],
付款金额: [{ required: true, message: '请输入开票金额', trigger: 'blur' }]
}
}
},
created() {
this.getParts()
},
methods: {
// 获取表格1数据
getParts() {
this.外协厂家流水号 = ''
this.loading = true
this.tableData = []
var check
var check2 = 0
this.ManufacturerName ? check = 1 : check = 0
searchtable(check, this.ManufacturerName, check2, '', '', this.pageCurrent, this.pageSize).then(response => {
this.loading = false
if (response.data.rows.length !== 0) {
this.tableData = response.data.rows
this.total = response.data.total
}
})
},
rowClick(row) {
this.外协厂家流水号 = row.外协厂家流水号
this.外协厂家流水号_Select = row.外协厂家流水号
this.loading2 = true
this.tableData2 = []
this.loading3 = true
this.tableData3 = []
getInvoice(row.外协厂家流水号, this.pageCurrent2, this.pageSize2).then(response => {
this.loading2 = false
if (response.data.rows.length !== 0) {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}
})
getPayment(row.外协厂家流水号, this.pageCurrent2, this.pageSize2).then(response => {
this.loading3 = false
if (response.data.rows.length !== 0) {
this.tableData3 = response.data.rows
this.total3 = response.data.total
}
})
},
// 发票
getInvoice() {
this.loading2 = true
this.tableData2 = []
getInvoice(this.外协厂家流水号_Select, this.pageCurrent2, this.pageSize2).then(response => {
this.loading2 = false
if (response.data.rows.length !== 0) {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}
})
},
// 付款
getPayment() {
this.loading3 = true
this.tableData3 = []
getPayment(this.外协厂家流水号_Select, this.pageCurrent2, this.pageSize2).then(response => {
this.loading3 = false
if (response.data.rows.length !== 0) {
this.tableData3 = response.data.rows
this.total3 = response.data.total
}
})
},
// 点击增加
handleAdd1(formName) {
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields()
}
if (this.外协厂家流水号) {
this.param1 = 1
this.title1 = '新增发票'
this.form1.发票号 = ''
this.form1.开票时间 = ''
this.form1.开票金额 = ''
this.form1.外协厂家 = ''
this.dialogFormVisible1 = true
} else {
this.$message.error('请先选择外协厂家')
}
},
// 增加确定
AddType1() {
AddType1(this.外协厂家流水号, this.form1.发票号, this.form1.开票时间, this.form1.开票金额).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息增加成功')
this.getParts()
this.getInvoice()
this.getPayment()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible1 = false
},
// 编辑打开
ChangeOpen1(row, formName) {
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields()
}
this.param1 = 0
this.title1 = '编辑发票'
this.form1.发票号 = row.发票号
this.form1.开票时间 = row.开票时间
this.form1.开票金额 = row.开票金额
this.form1.外协厂家 = row.外协厂家
this.dialogFormVisible1 = true
},
// 编辑确定
handleChange1() {
handlechange(this.CoManufacturerFlowNumber1, this.form.发票号, this.form.开户行, this.form.开票时间, this.form.开票金额, this.form.接收人, this.form.接收时间, this.form.备注).then(response => {
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.getParts()
} else {
this.$message.error('信息修改失败')
}
})
this.dialogFormVisible1 = false
},
// 提交添加或者修改
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param1 === 0) {
this.handleChange1()
} else {
this.AddType1()
}
} else {
return false
}
})
},
// 重置表单
callOff1(formName) {
this.dialogFormVisible1 = false
this.$refs[formName].resetFields()
},
// 删除
handleDelete(index, row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
handledelete(row.id).then(response => {
if (this.tableData && this.tableData.length === 1 && this.pageCurrent > 1) {
this.pageCurrent--
}
if (response.data[0].result === '1') {
this.$notify({
title: '成功',
message: '信息删除成功',
type: 'success'
})
this.getParts()
} else {
this.$message.error('信息删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleAdd2(formName) {
if (this.外协厂家流水号) {
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields()
}
this.param2 = 1
this.title2 = '新增付款'
this.form2.付款时间 = ''
this.form2.付款金额 = ''
this.dialogFormVisible2 = true
} else {
this.$message.error('请先选择外协厂家')
}
},
AddType2() {
AddType2(this.外协厂家流水号, this.form2.付款金额, this.form2.付款时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息增加成功')
this.getParts()
this.getInvoice()
this.getPayment()
} else {
this.$message.error('信息增加失败')
}
})
this.dialogFormVisible2 = false
},
submit2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.param2 === 0) {
this.handleChange2()
} else {
this.AddType2()
}
} else {
return false
}
})
},
callOff2(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.getParts()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getParts()
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.getInvoice()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.getInvoice()
},
handleSizeChange3(val) {
this.pageCurrent3 = 1
this.pageSize3 = val
this.getPayment()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.getPayment()
}
}
}
</script>
<style scoped>
.el-card{
margin: 0px;
}
.el-table .fukuan {
background: #AEF199;
}
</style>
<style lang="scss">
.button111{
background:rgb(253,246,236);
border-color: #ff9759;
color: #ff9759;
&:hover{
background: #ff9759;
border-color: #ff9759;
color: white;
}
&:focus{
background: #ff9759;
border-color: #ff9759;
color: white;
}
}
</style>