Files
JY1.0/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue
2018-11-26 15:21:25 +08:00

487 lines
17 KiB
Vue

<template>
<div class="app-container">
<el-card>
<el-row>
<span>表单号:</span>
<el-input v-model="FormNumber" placeholder="表单号" clearable size="small" style="width:190px;margin:10px;"/>
<span>任务下达时间段:</span>
<el-date-picker
v-model="date1"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<span>~</span>
<el-date-picker
v-model="date2"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
</el-row>
<el-row>
<span>厂家名:</span>
<el-select v-model="ManufacturerNameValue" placeholder="选择外协厂家" filterable clearable size="small" style="width:190px;margin:10px;">
<el-option
v-for="item in ManufacturerName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>实际付款时间段:</span>
<el-date-picker
v-model="date3"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<span>~</span>
<el-date-picker
v-model="date4"
style="width:190px;margin:10px;"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;total=null;pageCurrent2=1;pageSize2=10;total2=null;searchTable()">查询</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="getParts">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="付款状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.实际付款时间!==''" type="success" size="small">已付款</el-tag>
<el-tag v-else type="info" size="small">未付款</el-tag>
</template>
</el-table-column>
<el-table-column label="表单号" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.表单号 }}
</template>
</el-table-column>
<el-table-column label="外协厂家名称" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.外协厂家名称 }}
</template>
</el-table-column>
<el-table-column label="任务下达日期" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.任务下达日期 }}
</template>
</el-table-column>
<el-table-column label="外协员" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.外协员姓名 }}
</template>
</el-table-column>
<el-table-column label="加工价格" align="center">
<el-table-column label="预算总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.加工价格_预算_总价 }}
</template>
</el-table-column>
<el-table-column label="成交总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.加工价格_成交_总价 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="材料费" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.材料价格_价格_总价 }}
</template>
</el-table-column>
<el-table-column label="运费" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.运费 }}
</template>
</el-table-column>
<el-table-column label="其他费用" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.其他价格_总价 }}
</template>
</el-table-column>
<el-table-column label="总价" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.总价 }}
</template>
</el-table-column>
<el-table-column label="扣款" align="center">
<el-table-column label="质量" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_质量 }}
</template>
</el-table-column>
<el-table-column label="计划" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_计划 }}
</template>
</el-table-column>
<el-table-column label="其他" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.扣款_其他 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="应付金额" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.应付总额 }}
</template>
</el-table-column>
<el-table-column label="付款日期" align="center" width="240px">
<!--<template slot-scope="scope">-->
<!--{{scope.row.实际付款时间}}-->
<!--</template>-->
<el-table-column label="入库" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.入库时间 }}
</template>
</el-table-column>
<el-table-column label="计划" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.计划付款时间 }}
</template>
</el-table-column>
<el-table-column label="实际" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.实际付款时间 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="扣款说明" align="center" width="240px">
<template slot-scope="scope">
{{ scope.row.扣款说明 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button
:disabled="scope.row.实际付款时间!==''"
size="mini"
type="primary"
class="el-icon-edit"
@click="Withdrawing(scope.$index, scope.row, 'form')">扣款</el-button>
<el-button
:disabled="scope.row.实际付款时间!==''"
size="mini"
type="success"
class="el-icon-check"
@click="payment(scope.$index, scope.row)">付款</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card v-if="false">
<el-table v-loading="loading2" :data="tableData2" height="370" style="width: 100%;" border element-loading-text="拼命加载中">
<el-table-column
label=" "
type="index"
align="center"
width="50"/>
<el-table-column label="零件图号" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" width="220px">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" width="180px">
<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="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible2" title="扣款" center style="min-height: 300px" width="800px">
<el-form ref="form2" :model="form2" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="质量" style="margin-left: 200px">
<el-input v-model="form2.质量" placeholder="质量" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="计划" style="margin-left: 200px">
<el-input v-model="form2.计划" placeholder="计划" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="其他" style="margin-left: 200px">
<el-input v-model="form2.其他" placeholder="其他" size="small" style="width:200px"/>
</el-form-item>
<el-form-item label="扣款说明" prop="扣款说明" style="margin-left: 200px">
<el-input v-model="form2.扣款说明" placeholder="扣款说明" size="small" style="width:200px"/>
</el-form-item>
</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 { initOutHelp, searchtable, payTime, WithdrawingEdit, getParts } from '@/api/Outsourcing/OutsourcingPaymentPlanManagement'
export default {
data() {
return {
实际付款时间: '',
loading: false,
loading2: false,
zhongjianbianliang: '',
dialogFormVisible2: false,
form2: {
质量: '',
计划: '',
其他: '',
扣款说明: ''
},
rules: {
扣款说明: [{ required: true, message: '请输入扣款说明', trigger: 'blur' }]
},
date1: '',
date2: '',
date3: '',
date4: '',
FormNumber: '',
ManufacturerNameValue: '',
ManufacturerName: [], // 厂家名称
FormNumber_check: false,
ManufacturerNameValue_check: false,
date1_check: false,
date3_check: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1, // 后台获取页
tableData2: [], // 表格数据
total2: null, // 总条数
pageSize2: 10, // 每页显示条数
pageCurrent2: 1 // 后台获取页
}
},
created() {
this.fetchData()
},
methods: {
// 初始化外协厂家
fetchData() {
this.ManufacturerName = []
initOutHelp().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.ManufacturerName.push({
label: response.data[i].外协厂家名称,
value: response.data[i].外协厂家流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
if (this.FormNumber === '' || this.FormNumber === null) {
this.FormNumber_check = false
} else {
this.FormNumber_check = true
}
if (this.ManufacturerNameValue === '' || this.ManufacturerNameValue === null) {
this.ManufacturerNameValue_check = false
} else {
this.ManufacturerNameValue_check = true
}
if (this.date1 === '' || this.date1 === null) {
this.date1_check = false
} else {
this.date1_check = true
}
if (this.date3 === '' || this.date3 === null) {
this.date3_check = false
} else {
this.date3_check = true
}
this.tableData = []
this.tableData2 = []
searchtable(this.FormNumber_check, this.FormNumber, this.ManufacturerNameValue_check, this.ManufacturerNameValue, this.date1_check, this.date1, this.date2, this.date3_check, this.date3, this.date4, this.pageCurrent, this.pageSize).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].任务下达日期 = response.data.rows[i].任务下达日期.substring(0, response.data.rows[i].任务下达日期.indexOf(' '))
response.data.rows[i].实际付款时间 = response.data.rows[i].实际付款时间.substring(0, response.data.rows[i].实际付款时间.indexOf(' '))
}
this.tableData = response.data.rows
this.total = response.data.total
}).then(() => {
this.loading = false
})
},
// 付款
payment(index, row) {
this.$confirm('请仔细核对信息,确定后不可更改, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'success'
}).then(() => {
var time = new Date()
var month = time.getMonth() + 1
var day = time.getDate()
if (month >= 1 && month <= 9) {
month = '0' + month
}
if (day >= 1 && day <= 9) {
day = '0' + day
}
this.实际付款时间 = time.getFullYear() + '/' + month + '/' + day
// payment(row.外协加工任务单流水号).then(response => {
// }).then(() => {
payTime(row.外协加工任务单流水号, this.实际付款时间).then(response => {
if (response.data[0].result === '1') {
this.$message.success('付款成功')
this.searchTable()
} else {
this.$message.error('付款失败')
}
})
// })
}).catch(() => {
this.$message({
type: 'info',
message: '已取消付款'
})
})
},
// 打开扣款编辑
Withdrawing(index, row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.form2.质量 = row.扣款_质量
this.form2.计划 = row.扣款_计划
this.form2.其他 = row.扣款_其他
this.form2.扣款说明 = row.扣款说明
this.liushuihao = row.外协加工任务单流水号
this.dialogFormVisible2 = true
},
// 扣款编辑确定
submit2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.WithdrawingEdit()
}
})
},
// 扣款编辑
WithdrawingEdit() {
WithdrawingEdit(this.liushuihao, this.form2.质量, this.form2.计划, this.form2.其他, this.form2.扣款说明).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改成功')
this.searchTable()
} else {
this.$message.error('修改失败')
}
this.dialogFormVisible2 = false
})
},
// 关闭扣款编辑
callOff2(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
// 获取表格2数据
getParts(row) {
this.loading2 = true
this.tableData2 = []
this.zhongjianbianliang = row.外协加工任务单流水号
getParts(row.外协加工任务单流水号, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
}).then(() => {
this.loading2 = false
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
},
handleSizeChange2(val) {
this.pageCurrent2 = 1
this.pageSize2 = val
this.tableData2 = []
getParts(this.zhongjianbianliang, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.tableData2 = []
getParts(this.zhongjianbianliang, this.pageCurrent2, this.pageSize2).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
</style>
<style>
.el-table .fukuan {
background: #AEF199;
}
</style>