parent
1c27273fd8
commit
54b65a63e8
@ -0,0 +1,479 @@
|
||||
<template>
|
||||
<el-dialog :title="'认款'" :close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" v-if="visible" v-dialogDrag class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
|
||||
<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="24">
|
||||
<el-form-item label="单据编号" prop="documentNo">
|
||||
<el-input v-model="dataForm.documentNo" placeholder="系统自动生成" readonly>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="业务日期" prop="businessDate">
|
||||
<el-date-picker v-model="dataForm.businessDate" placeholder="请选择业务日期" clearable :style='{"width":"100%"}'
|
||||
type="date" format="yyyy-MM-dd" value-format="timestamp">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="24">-->
|
||||
<!-- <el-form-item label="备注信息" prop="remark">-->
|
||||
<!-- <el-input v-model="dataForm.remark" placeholder="请输入" clearable :style='{"width":"100%"}'>-->
|
||||
|
||||
<!-- </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>
|
||||
<CustomerBox v-if="formVisible2" ref="form2" @refreshDataList="initData2" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import CustomerBox from './CustomerBox'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {CustomerBox},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
formVisible2: false,
|
||||
submitDisabled: false,
|
||||
paymentType: "0",
|
||||
currency: "0",
|
||||
settlementType: "0",
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
code: '',
|
||||
customerCode: '',
|
||||
documentNo: '',
|
||||
customerName: '',
|
||||
customerId: '',
|
||||
contractId: '',
|
||||
amountCollected: '',
|
||||
collectionCount: '',
|
||||
collectionBank: '',
|
||||
paymentType: "0",
|
||||
currency: "0",
|
||||
settlementType: "0",
|
||||
remark: '',
|
||||
voucher: [],
|
||||
status: "0",
|
||||
creatorUserName: '',
|
||||
collection_item0List: [],
|
||||
},
|
||||
activeojnisi: '0',
|
||||
rules: {
|
||||
businessDate: [{
|
||||
required: true,
|
||||
message: '请选择业务日期',
|
||||
trigger: 'change'
|
||||
},],
|
||||
},
|
||||
customerNamecolumnOptions: [{
|
||||
"label": "客户编码",
|
||||
"value": "supplier_cd"
|
||||
}, {
|
||||
"label": "客户名称",
|
||||
"value": "supplier_nm"
|
||||
}, {
|
||||
"label": "客户地点名称",
|
||||
"value": "supplier_site_code"
|
||||
}, {
|
||||
"label": "客户等级",
|
||||
"value": "customer_level"
|
||||
}, {
|
||||
"label": "银行账号",
|
||||
"value": "bank_account"
|
||||
}, {
|
||||
"label": "开户行",
|
||||
"value": "bank"
|
||||
},],
|
||||
contractNamecolumnOptions: [{
|
||||
"label": "合同编码",
|
||||
"value": "contract_code"
|
||||
}, {
|
||||
"label": "合同名称",
|
||||
"value": "contract_name"
|
||||
} ],
|
||||
jg_collection_item0deleteTimecolumnOptions: [ {
|
||||
"label": "销售订单编号",
|
||||
"value": "document_no"
|
||||
}, {
|
||||
"label": "合同编号",
|
||||
"value": "contract_id"
|
||||
},
|
||||
{
|
||||
"label": "订单金额",
|
||||
"value": "price"
|
||||
}, {
|
||||
"label": "已收款金额",
|
||||
"value": "amount_collected"
|
||||
},
|
||||
{
|
||||
"label": "重量",
|
||||
"value": "num"
|
||||
}, {
|
||||
"label": "垫资金额",
|
||||
"value": "advance_amount"
|
||||
},
|
||||
{
|
||||
"label": "税额",
|
||||
"value": "rate"
|
||||
}, {
|
||||
"label": "不含税金额",
|
||||
"value": "not_price"
|
||||
}, {
|
||||
"label": "业务日期",
|
||||
"value": "creator_time"
|
||||
},
|
||||
],
|
||||
paymentTypeOptions: [{
|
||||
"fullName": "货款",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "运费",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "仓储",
|
||||
"id": "2"
|
||||
}],
|
||||
|
||||
|
||||
|
||||
taxRateOptions: [{
|
||||
"fullName": "13",
|
||||
"id": "0"
|
||||
}, {
|
||||
"fullName": "9",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "6",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "5",
|
||||
"id": "3"
|
||||
}, {
|
||||
"fullName": "3",
|
||||
"id": "4"
|
||||
}, {
|
||||
"fullName": "0",
|
||||
"id": "5"
|
||||
}],
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
paymentTypeChange(e){
|
||||
this.dataForm.paymentType = e;
|
||||
},
|
||||
currencyChange(e){
|
||||
this.dataForm.currency = e;
|
||||
},
|
||||
settlementTypeChange(e){
|
||||
this.dataForm.settlementType = e;
|
||||
},
|
||||
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 === 6 || index === 7 || index === 8 || index === 9)) {
|
||||
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;
|
||||
},
|
||||
amountSum(){
|
||||
let sum = 0;
|
||||
for (let i = 0; i<this.dataForm.collection_item0List.length;i++){
|
||||
sum = this.jnpf.floatAdd(sum,this.dataForm.collection_item0List[i].amount);
|
||||
}
|
||||
this.dataForm.amountCollected = sum;
|
||||
},
|
||||
choiceCustomerId(){
|
||||
this.formVisible2 = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.form2.init()
|
||||
})
|
||||
},
|
||||
initData2(custmer) {
|
||||
this.dataForm.code = custmer.id;
|
||||
this.dataForm.customerId = custmer.id;
|
||||
this.dataForm.customerName = custmer.supplierNm;
|
||||
this.dataForm.collectionCount = custmer.bankAccount;
|
||||
this.dataForm.collectionBank = custmer.bank;
|
||||
this.popupSelect();
|
||||
},
|
||||
popupSelect() {
|
||||
// this.dataForm.code = d.id;
|
||||
// this.dataForm.collectionCount = d.bank_account;
|
||||
// this.dataForm.collectionBank = d.bank;
|
||||
this.dataForm.collection_item0List = [];
|
||||
let params = {
|
||||
"param" : this.dataForm.customerId
|
||||
}
|
||||
request({
|
||||
url: '/api/collection/Collection/display',
|
||||
method: 'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
let data = res.data;
|
||||
let amountSum = 0;
|
||||
this.dataForm.contractId = data.id;
|
||||
for (let i = 0; i< data.saleorderitemList.length;i++){
|
||||
this.addcollection_item0List();
|
||||
this.dataForm.collection_item0List[i].salesorderId = data.saleorderitemList[i].id;
|
||||
this.dataForm.collection_item0List[i].price = data.saleorderitemList[i].price;
|
||||
this.dataForm.collection_item0List[i].amountCollected = data.saleorderitemList[i].amountCollected;
|
||||
this.dataForm.collection_item0List[i].contractId = data.saleorderitemList[i].contractId;
|
||||
this.dataForm.collection_item0List[i].num = data.saleorderitemList[i].num;
|
||||
this.dataForm.collection_item0List[i].advanceAmount = data.saleorderitemList[i].advanceAmount;
|
||||
this.dataForm.collection_item0List[i].rate = data.saleorderitemList[i].rate;
|
||||
this.dataForm.collection_item0List[i].notPrice = data.saleorderitemList[i].notPrice;
|
||||
this.dataForm.collection_item0List[i].amount = this.jnpf.floatSub(data.saleorderitemList[i].price,data.saleorderitemList[i].amountCollected);
|
||||
this.dataForm.collection_item0List[i].creatorTime = new Date().getTime();
|
||||
amountSum = this.jnpf.floatAdd(amountSum,this.dataForm.collection_item0List[i].amount);
|
||||
}
|
||||
this.dataForm.amountCollected = amountSum;
|
||||
this.loading = false
|
||||
});
|
||||
},
|
||||
contractSelect(){
|
||||
this.dataForm.collection_item0List = [];
|
||||
let params = {
|
||||
"param" : this.dataForm.contractId
|
||||
}
|
||||
request({
|
||||
url: '/api/collection/Collection/show',
|
||||
method: 'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
let data = res.data;
|
||||
let amountSum = 0;
|
||||
this.dataForm.contractId = data.id;
|
||||
for (let i = 0; i< data.saleorderitemList.length;i++){
|
||||
this.addcollection_item0List();
|
||||
this.dataForm.collection_item0List[i].salesorderId = data.saleorderitemList[i].id;
|
||||
this.dataForm.collection_item0List[i].price = data.saleorderitemList[i].price;
|
||||
this.dataForm.collection_item0List[i].amountCollected = data.saleorderitemList[i].amountCollected;
|
||||
this.dataForm.collection_item0List[i].contractId = data.saleorderitemList[i].contractId;
|
||||
this.dataForm.collection_item0List[i].num = data.saleorderitemList[i].num;
|
||||
this.dataForm.collection_item0List[i].advanceAmount = data.saleorderitemList[i].advanceAmount;
|
||||
this.dataForm.collection_item0List[i].rate = data.saleorderitemList[i].rate;
|
||||
this.dataForm.collection_item0List[i].notPrice = data.saleorderitemList[i].notPrice;
|
||||
this.dataForm.collection_item0List[i].amount = this.jnpf.floatSub(data.saleorderitemList[i].price,data.saleorderitemList[i].amountCollected);
|
||||
this.dataForm.collection_item0List[i].creatorTime = new Date().getTime();
|
||||
amountSum = this.jnpf.floatAdd(amountSum,this.dataForm.collection_item0List[i].amount);
|
||||
}
|
||||
this.dataForm.amountCollected = amountSum;
|
||||
this.loading = false
|
||||
});
|
||||
},
|
||||
popupSelect2(a, b) {
|
||||
let amountCollectedSum = 0;
|
||||
for (let i = 0; i < this.dataForm.collection_item0List.length; i++) {
|
||||
debugger
|
||||
if (a == this.dataForm.collection_item0List[i].salesorderId) {
|
||||
this.dataForm.collection_item0List[i].price = b.price;
|
||||
this.dataForm.collection_item0List[i].amountCollected = b.amount_collected;
|
||||
this.dataForm.collection_item0List[i].contractId = b.contract_id;
|
||||
this.dataForm.collection_item0List[i].num = b.num;
|
||||
this.dataForm.collection_item0List[i].advanceAmount = b.advance_amount;
|
||||
this.dataForm.collection_item0List[i].rate = b.rate;
|
||||
this.dataForm.collection_item0List[i].notPrice = b.not_price;
|
||||
this.dataForm.collection_item0List[i].amount = this.jnpf.floatSub(b.price,b.amount_collected);
|
||||
this.dataForm.collection_item0List[i].creatorTime = new Date().getTime();
|
||||
amountCollectedSum = this.jnpf.floatAdd(amountCollectedSum,this.dataForm.collection_item0List[i].amount);
|
||||
}
|
||||
}
|
||||
this.dataForm.amountCollected = amountCollectedSum;
|
||||
},
|
||||
collection_item0Exist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.collection_item0List.length; i++) {
|
||||
const e = this.dataForm.collection_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] = "";
|
||||
}
|
||||
}
|
||||
this.dataForm.paymentType = '0'
|
||||
this.dataForm.currency = '0'
|
||||
this.dataForm.settlementType = '0'
|
||||
let params = {
|
||||
"param" : 'collection'
|
||||
}
|
||||
request({
|
||||
url: '/api/collection/Collection/autoSerialNum',
|
||||
method: 'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
this.dataForm.documentNo = res.msg
|
||||
this.loading = false
|
||||
});
|
||||
},
|
||||
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/collection/Collection/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
debugger
|
||||
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.collection_item0Exist()) return
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
this.submitDisabled = true;
|
||||
var _data = this.dataList()
|
||||
// var saleFlag = false;
|
||||
// var amountFlag = false;
|
||||
// for (let i = 0; i < _data.collection_item0List.length; i++) {
|
||||
// var _list = _data.collection_item0List[i];
|
||||
// debugger
|
||||
// if (_list.salesorderId == null){
|
||||
// saleFlag = true;
|
||||
// }
|
||||
// if (_list.amount == null || _list.amount == 0 || _list.amount == ''){
|
||||
// amountFlag = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!this.dataForm.id) {
|
||||
let ids = this.dataForm.id;
|
||||
request({
|
||||
url: `/api/collection/Collection/confirmprice/${ids}`,
|
||||
method: "PUT",
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: res.msg,
|
||||
duration: 2500,
|
||||
onClose: () => {
|
||||
this.submitDisabled = false;
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
let ids = this.dataForm.id;
|
||||
request({
|
||||
url: `/api/collection/Collection/confirmprice/${ids}`,
|
||||
method: "PUT",
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: res.msg,
|
||||
duration: 2500,
|
||||
onClose: () => {
|
||||
this.submitDisabled = false;
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
addcollection_item0List() {
|
||||
let item = {
|
||||
amount: undefined,
|
||||
price: undefined,
|
||||
amountCollected: undefined,
|
||||
salesorderId: undefined,
|
||||
contractId: undefined,
|
||||
num: undefined,
|
||||
advanceAmount: undefined,
|
||||
rate: undefined,
|
||||
notPrice: undefined,
|
||||
}
|
||||
this.dataForm.collection_item0List.push(item)
|
||||
},
|
||||
delcollection_item0List(index) {
|
||||
this.dataForm.collection_item0List.splice(index, 1);
|
||||
this.amountSum();
|
||||
},
|
||||
dataList() {
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.voucher = JSON.stringify(_data.voucher)
|
||||
for (let i = 0; i < _data.collection_item0List.length; i++) {
|
||||
var _list = _data.collection_item0List[i];
|
||||
}
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
_dataAll.voucher = JSON.parse(_dataAll.voucher)
|
||||
for (let i = 0; i < _dataAll.collection_item0List.length; i++) {
|
||||
var _list = _dataAll.collection_item0List[i];
|
||||
}
|
||||
this.dataForm = _dataAll
|
||||
debugger
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue