parent
8369c7620e
commit
188bca2a77
@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'认款'" :close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="500px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-col :span="16">
|
||||
<el-form-item label="账期(日)" prop="accountingPeriod">
|
||||
<el-input-number v-model="dataForm.accountingPeriod" :min="0" @change="toInteger"></el-input-number>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail" :disabled="submitDisabled"> 确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
submitDisabled: false,
|
||||
excludeFields: [],
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
documentno: '',
|
||||
suppliername: '',
|
||||
paymenttype: "0",
|
||||
paymentaccount: '',
|
||||
paymentbank: '',
|
||||
paymentamount: '',
|
||||
collectionaccount: '',
|
||||
collectionbank: '',
|
||||
requestedamount: '',
|
||||
accountingPeriod: 0,
|
||||
duedate: '',
|
||||
businessdate: '',
|
||||
currency: "0",
|
||||
settlementtype: "0",
|
||||
paymentno: '',
|
||||
remark: '',
|
||||
status: "0",
|
||||
payment_item0List: [],
|
||||
voucher : [],
|
||||
},
|
||||
activeivpzpd: '0',
|
||||
rules: {
|
||||
suppliername: [],
|
||||
paymentaccount: [],
|
||||
paymentamount: [{
|
||||
required: true,
|
||||
message: '请输入付款金额',
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
businessdate: [{
|
||||
required: true,
|
||||
message: '请选择实付日期',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
},
|
||||
paymenttypeOptions: [{
|
||||
"fullName": "货款",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "运费",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "仓储",
|
||||
"id": "2"
|
||||
}],
|
||||
currencyOptions: [{
|
||||
"fullName": "人民币",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "美元",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "英镑",
|
||||
"id": "2"
|
||||
}],
|
||||
settlementtypeOptions: [{
|
||||
"fullName": "现金",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "赊购",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "网银",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "银企直连",
|
||||
"id": "3"
|
||||
}, {
|
||||
"fullName": "银票",
|
||||
"id": "4"
|
||||
}, {
|
||||
"fullName": "商票",
|
||||
"id": "5"
|
||||
}],
|
||||
statusOptions: [{
|
||||
"fullName": "已保存",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "审批中",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "已审批",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "已付款",
|
||||
"id": "3"
|
||||
}],
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
dataForm: {
|
||||
deep: true,
|
||||
handler: function() {
|
||||
|
||||
this.popupSelect()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
toInteger() {
|
||||
let reg = /^[0-9]+$/
|
||||
if(!reg.test(this.dataForm.accountingPeriod)){
|
||||
this.$message.warning("只能输入整数")
|
||||
// 用以在dom渲染挂载后重新触发dom渲染挂载
|
||||
this.$nextTick(() => {
|
||||
this.dataForm.accountingPeriod = parseInt(this.dataForm.accountingPeriod)
|
||||
})
|
||||
}
|
||||
},
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param;
|
||||
const sums = [];
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计';
|
||||
return;
|
||||
}
|
||||
const values = data.map(item => Number(item[column.property]));
|
||||
if (!values.every(value => isNaN(value)) && (index === 1 || index === 2 || index === 3 || index === 4|| index === 5|| index === 8|| index === 9|| index === 10|| index === 11 )) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return this.jnpf.floatAdd(prev,curr);
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
} else {
|
||||
sums[index] = '';
|
||||
}
|
||||
});
|
||||
|
||||
return sums;
|
||||
},
|
||||
|
||||
popupSelect() {
|
||||
let amount = 0
|
||||
for (let i = 0; i < this.dataForm.payment_item0List.length; i++) {
|
||||
amount = amount + parseFloat(this.dataForm.payment_item0List[i].amount);
|
||||
}
|
||||
parseFloat(this.dataForm.paymentamount = amount)
|
||||
},
|
||||
|
||||
payment_item0Exist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.payment_item0List.length; i++) {
|
||||
const e = this.dataForm.payment_item0List[i];
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
clearData(data) {
|
||||
for (let key in data) {
|
||||
if (data[key] instanceof Array) {
|
||||
data[key] = [];
|
||||
} else if (data[key] instanceof Object) {
|
||||
this.clearData(data[key]);
|
||||
} else {
|
||||
data[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
init(id, isDetail) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.isDetail = isDetail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['elForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/payment/Payment/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
} else {
|
||||
this.clearData(this.dataForm)
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['elForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.payment_item0Exist()) return
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
this.submitDisabled = true;
|
||||
var _data = this.dataList()
|
||||
request({
|
||||
url: `/api/payment/Payment/confirmprice`,
|
||||
method: 'POST',
|
||||
data: _data
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.submitDisabled = false;
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.submitDisabled = false
|
||||
})
|
||||
},
|
||||
addpayment_item0List() {
|
||||
let item = {
|
||||
amount: undefined,
|
||||
creatorUserId: undefined,
|
||||
creatorUserName: undefined,
|
||||
lastModifyUserId: undefined,
|
||||
lastModifyUserName: undefined,
|
||||
lastModifyTime: undefined,
|
||||
deleteUserId: undefined,
|
||||
deleteTime: undefined,
|
||||
orgnizeId: undefined,
|
||||
departmentId: undefined,
|
||||
creatorTime: undefined,
|
||||
}
|
||||
this.dataForm.payment_item0List.push(item)
|
||||
},
|
||||
delpayment_item0List(index) {
|
||||
this.dataForm.payment_item0List.splice(index, 1);
|
||||
},
|
||||
dataList() {
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.voucher = JSON.stringify(_data.voucher)
|
||||
for (let i = 0; i < _data.payment_item0List.length; i++) {
|
||||
var _list = _data.payment_item0List[i];
|
||||
}
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
_dataAll.voucher = JSON.parse( _dataAll.voucher)
|
||||
for (let i = 0; i < _dataAll.payment_item0List.length; i++) {
|
||||
var _list = _dataAll.payment_item0List[i];
|
||||
}
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue