|
|
@@ -1,26 +1,51 @@
|
|
|
<template>
|
|
|
<div class="borderless">
|
|
|
- <div class="main-head">
|
|
|
- <div class="main-back">
|
|
|
+ <div class="customer-head">
|
|
|
+ <div class="customer-back">
|
|
|
<el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
|
|
|
@click="backToList">返回列表
|
|
|
</el-button>
|
|
|
- <el-button class="el-button--small-yh add-customer-btn" type="primary"
|
|
|
- @click.stop="editReceipt "
|
|
|
- >{{this.id?"确认修改" :"确认结算"}}
|
|
|
- </el-button>
|
|
|
+ <div class="upper_right_button">
|
|
|
+ <el-button type="warning"
|
|
|
+ class="el-button--small-yh"
|
|
|
+ :disabled="financeDisabled"
|
|
|
+ @click.stop="confirmSettlement"
|
|
|
+ >结算
|
|
|
+ </el-button>
|
|
|
+ <!-- <el-button class="el-button--small-yh"
|
|
|
+ type="primary"
|
|
|
+ :disabled="financeDisabled"
|
|
|
+ @click.stop="saveSettlement"
|
|
|
+ >{{form.id?"确认修改" :"确认新增"}}
|
|
|
+ </el-button>-->
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div style="margin-top: 60px">
|
|
|
+ <div class="customer-main">
|
|
|
<containerTitle title="基础信息"></containerTitle>
|
|
|
<basic-container>
|
|
|
<avue-form ref="form" v-model="form" :option="option">
|
|
|
<template slot="corpId">
|
|
|
<select-component
|
|
|
v-model="form.corpId"
|
|
|
+ @returnBack="returnBack"
|
|
|
:configuration="configuration"
|
|
|
></select-component>
|
|
|
</template>
|
|
|
+ <template slot="accountNo">
|
|
|
+ <el-select v-model="form.accountNo"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="accountNoChange"
|
|
|
+ clearable
|
|
|
+ filterable>
|
|
|
+ <el-option v-for="(item,index) in form.bankList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.accountNo"
|
|
|
+ :value="item.accountNo"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
</avue-form>
|
|
|
</basic-container>
|
|
|
<basic-container>
|
|
|
@@ -30,6 +55,7 @@
|
|
|
v-model="itemsForm"
|
|
|
:page.sync="page"
|
|
|
@search-reset="searchReset"
|
|
|
+ @row-update="rowUpdate"
|
|
|
@selection-change="selectionChange"
|
|
|
@current-change="currentChange"
|
|
|
@size-change="sizeChange"
|
|
|
@@ -38,24 +64,36 @@
|
|
|
<el-button type="primary"
|
|
|
size="small"
|
|
|
icon="el-icon-shopping-cart-2"
|
|
|
+ :disabled="financeDisabled"
|
|
|
@click="selectRecipt"
|
|
|
>选择销售合同
|
|
|
</el-button>
|
|
|
</template>
|
|
|
+ <template slot="thisAmount" slot-scope="{ row }">
|
|
|
+ <el-input
|
|
|
+ v-if="row.$cellEdit"
|
|
|
+ v-model="row.thisAmount"
|
|
|
+ placeholder="请输入"
|
|
|
+ size="small"
|
|
|
+ oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
|
|
|
+ @change="thisAmountChange(row)"
|
|
|
+ ></el-input>
|
|
|
+ <span v-else>{{ row.thisAmount }}</span>
|
|
|
+ </template>
|
|
|
<template slot-scope="scope" slot="menu">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
- icon="el-icon-view"
|
|
|
size="small"
|
|
|
- @click.stop=""
|
|
|
- >费用确认
|
|
|
+ :disabled="financeDisabled"
|
|
|
+ @click.stop="rowCell(scope.row,scope.index)"
|
|
|
+ > {{ scope.row.$cellEdit ? '修改完成' : '修改' }}
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
size="small"
|
|
|
- @click.stop=""
|
|
|
- >移除数据
|
|
|
+ :disabled="financeDisabled"
|
|
|
+ @click.stop="rowDel(scope.row,scope.index)"
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
@@ -72,8 +110,9 @@
|
|
|
top="10vh"
|
|
|
v-dialog-drag>
|
|
|
<bill-detail
|
|
|
+ :params="params"
|
|
|
:billType="billType"
|
|
|
- @closeFun="!billDetailDialog"
|
|
|
+ @closeFun="closeBillDetail"
|
|
|
@importProMent="importProMent"
|
|
|
>
|
|
|
</bill-detail>
|
|
|
@@ -84,9 +123,11 @@
|
|
|
|
|
|
<script>
|
|
|
import option from "./configuration/detailsPage.json";
|
|
|
- import { getDetail,editFinance } from "@/api/financialManagement/financialManagement"
|
|
|
- import { detailSaleList } from "@/api/importTrade/salesContract"
|
|
|
+ import { getDetail } from "@/api/financialManagement/financialManagement"
|
|
|
+ import { getDetails,modify,saveOrEdit } from "@/api/financialManagement/paymentRequest";
|
|
|
import billDetail from "@/components/bill/billDetailList";
|
|
|
+ import _ from "lodash";
|
|
|
+ import { getlistBankBy } from "@/api/financialManagement/paymentRequest";
|
|
|
|
|
|
export default {
|
|
|
name: "receiptDetailsPage",
|
|
|
@@ -102,6 +143,7 @@
|
|
|
return {
|
|
|
form: {},
|
|
|
itemsForm:{},
|
|
|
+ params:{},
|
|
|
itemsOption: option,
|
|
|
option: {
|
|
|
menuBtn: false,
|
|
|
@@ -130,24 +172,25 @@
|
|
|
span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
- label: '总金额',
|
|
|
- prop: 'amount',
|
|
|
+ label: '银行账号',
|
|
|
+ prop: 'accountNo',
|
|
|
span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
|
|
+ required: false,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
- },{
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '开户银行',
|
|
|
prop: 'accountBank',
|
|
|
span: 8,
|
|
|
@@ -169,13 +212,19 @@
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
- }, {
|
|
|
- label: '银行账号',
|
|
|
- prop: 'accountNo',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '总金额',
|
|
|
+ prop: 'amount',
|
|
|
span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
- required: false,
|
|
|
+ pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
@@ -231,10 +280,11 @@
|
|
|
total: 0,
|
|
|
},
|
|
|
billDetailDialog:false,
|
|
|
+ financeDisabled:false,
|
|
|
billType:"销售",
|
|
|
//新旧数据对比
|
|
|
oldForm:{},
|
|
|
- oldItemList:[],
|
|
|
+ oldDataList:[],
|
|
|
//客户组件配置控制
|
|
|
configuration:{
|
|
|
multipleChoices:false,
|
|
|
@@ -263,48 +313,89 @@
|
|
|
if (this.detailData.id) {
|
|
|
this.id = BigInt(this.detailData.id);//字符串转数字 超长用BigInt
|
|
|
getDetail(this.id).then(res => {
|
|
|
- this.form = res.data.data;
|
|
|
- this.oldForm = Object.assign({},res.data.data);
|
|
|
- this.configuration.dicData = res.data.data.customerModel;
|
|
|
- if(res.data.data.itemsList){
|
|
|
- this.dataList = res.data.data.itemsList
|
|
|
- this.oldItemList = this.deepClone(res.data.data.itemsList)
|
|
|
- }
|
|
|
+ this.afterEcho(res.data.data)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- if(this.detailData.params){
|
|
|
- detailSaleList(this.detailData.params).then(res =>{
|
|
|
- delete res.data.data.id;
|
|
|
- delete res.data.data.sysNo;
|
|
|
- delete res.data.data.billType;
|
|
|
-
|
|
|
- this.form = res.data.data;
|
|
|
- this.oldForm = Object.assign({},res.data.data);
|
|
|
- if(res.data.data.orderItemsList){
|
|
|
- this.dataList = res.data.data.orderItemsList
|
|
|
- this.oldDataList = this.deepClone(res.data.data.orderItemsList)
|
|
|
- }
|
|
|
- this.configuration.dicData = this.form.corpName
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
+ // if(this.detailData.params){
|
|
|
+ // getDetails(this.detailData.params).then(res =>{
|
|
|
+ // delete res.data.data.id;
|
|
|
+ // delete res.data.data.sysNo;
|
|
|
+ // delete res.data.data.billType;
|
|
|
+ // res.data.data.itemsList.map((items)=>{
|
|
|
+ // delete items.id ;
|
|
|
+ // items.thisAmount = items.amount
|
|
|
+ // })
|
|
|
+ // this.afterEcho(res.data.data)
|
|
|
+ // })
|
|
|
+ // }
|
|
|
},
|
|
|
mounted() {
|
|
|
option.height = window.innerHeight - 640 ;
|
|
|
},
|
|
|
methods: {
|
|
|
+ //选择客户
|
|
|
+ returnBack(corpValue){
|
|
|
+ this.corpId = corpValue
|
|
|
+ getlistBankBy(corpValue).then(res =>{
|
|
|
+ this.$set(this.form,"bankList",res.data)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //选择卡号
|
|
|
+ accountNoChange(value){
|
|
|
+ this.form.bankList.forEach(item =>{
|
|
|
+ if(item.accountNo == value){
|
|
|
+ this.$set(this.form,"accountBank",item.accountBank)
|
|
|
+ this.$set(this.form,"accountName",item.accountName)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
selectRecipt(){
|
|
|
+ if(!this.form.corpId){
|
|
|
+ this.$message.warning("请先选择客户!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.params = {
|
|
|
+ corpId: this.form.corpId
|
|
|
+ }
|
|
|
this.billDetailDialog = true;
|
|
|
},
|
|
|
+ closeBillDetail(){
|
|
|
+ this.billDetailDialog = false;
|
|
|
+ },
|
|
|
importProMent(list){
|
|
|
list.forEach((item,index) =>{
|
|
|
item.accId = item.id;
|
|
|
+ item.srcOrderno = item.accSysNo
|
|
|
+ item.billNo = item.srcBillNo
|
|
|
+ item.thisAmount = _.subtract(item.amount, item.settlementAmount)
|
|
|
+ item.maxThisAmount = item.thisAmount
|
|
|
delete item.id;
|
|
|
this.$refs.crud.rowCellAdd(item);
|
|
|
})
|
|
|
+
|
|
|
+ //明细列表金额总和等于form总金额
|
|
|
+ this.form.amount = _.sum(this.dataList.map(item =>{ return parseFloat(item.amount)}));
|
|
|
+ this.form.srcOrderno = this.dataList.map(item =>{return item.srcOrderno}).join(",")
|
|
|
this.billDetailDialog = false;
|
|
|
},
|
|
|
+ thisAmountChange(row){
|
|
|
+ console.log(row.thisAmount)
|
|
|
+ console.log(row.maxThisAmount)
|
|
|
+ if(row.thisAmount > row.maxThisAmount){
|
|
|
+ this.$message.error("本次结算金额不能大于剩余结算金额!")
|
|
|
+ row.thisAmount = 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
+ done(row);
|
|
|
+ },
|
|
|
+ rowCell(row,index){
|
|
|
+ this.$refs.crud.rowCell(row, index)
|
|
|
+ },
|
|
|
+ rowDel(row,index){
|
|
|
+ this.dataList.splice(index, 1);
|
|
|
+ },
|
|
|
searchReset() {
|
|
|
console.log('1')
|
|
|
},
|
|
|
@@ -320,18 +411,36 @@
|
|
|
refreshChange() {
|
|
|
console.log('1')
|
|
|
},
|
|
|
- editReceipt(status){
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
+ confirmSettlement(status){
|
|
|
+ this.$refs["form"].validate((valid,done) => {
|
|
|
+ done();
|
|
|
if(valid){
|
|
|
- const params = {
|
|
|
- ...this.form,
|
|
|
- billType:"收费",
|
|
|
- itemsList: this.dataList,
|
|
|
- }
|
|
|
- editFinance(params).then(res =>{
|
|
|
- if(res.data.success){
|
|
|
- this.$message.success("操作成功!")
|
|
|
+ this.$confirm("是否确认结算?", "提示", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(()=>{
|
|
|
+ for (let i = 0; i < this.dataList.length; i++) {
|
|
|
+ if (this.dataList[i].thisAmount == null) {
|
|
|
+ return this.$message.error(`第${i + 1}行的本次金额不能为空`);
|
|
|
+ }
|
|
|
+ if (this.dataList[i].thisAmount === 0) {
|
|
|
+ return this.$message.error(`第${i + 1}行的本次金额不能为0`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form.billNo = this.dataList.map(item =>{return item.billNo}).join(",")
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ ...this.form,
|
|
|
+ billType:"收费",
|
|
|
+ itemsList:this.dataList
|
|
|
}
|
|
|
+
|
|
|
+ modify(params).then(res =>{
|
|
|
+ this.$message.success("操作成功!")
|
|
|
+ this.afterEcho(res.data.data)
|
|
|
+ })
|
|
|
})
|
|
|
if(status === true){
|
|
|
this.$emit("goBack");
|
|
|
@@ -339,6 +448,36 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ saveSettlement(){
|
|
|
+ this.$refs["form"].validate((valid,done) => {
|
|
|
+ done();
|
|
|
+ if(valid){
|
|
|
+
|
|
|
+ this.form.billNo = this.dataList.map(item =>{return item.billNo}).join(",")
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ ...this.form,
|
|
|
+ billType:"收费",
|
|
|
+ itemsList:this.dataList
|
|
|
+ }
|
|
|
+ saveOrEdit(params).then(res=>{
|
|
|
+ this.$message.success("操作成功!")
|
|
|
+ this.afterEcho(res.data.data)
|
|
|
+ })
|
|
|
+ }})
|
|
|
+ },
|
|
|
+ afterEcho(data){
|
|
|
+ this.form = data;
|
|
|
+ this.oldForm = Object.assign({},data);
|
|
|
+
|
|
|
+ this.financeDisabled = data.financeStatus === "待结算"?false:true;
|
|
|
+ this.$set(this.option,"disabled",this.financeDisabled)
|
|
|
+
|
|
|
+ if(data.itemsList){
|
|
|
+ this.dataList = data.itemsList
|
|
|
+ this.oldDataList = this.deepClone(data.itemsList)
|
|
|
+ }
|
|
|
+ },
|
|
|
backToList(){
|
|
|
this.$confirm("是否保存当前页面?", "提示", {
|
|
|
confirmButtonText: "保存",
|
|
|
@@ -375,14 +514,10 @@
|
|
|
color: #323233;
|
|
|
font-weight: 400;
|
|
|
}
|
|
|
- .add-customer-btn-two {
|
|
|
- position: fixed;
|
|
|
- right: 150px;
|
|
|
- top: 115px;
|
|
|
- }
|
|
|
- .add-customer-btn {
|
|
|
+ .upper_right_button{
|
|
|
+ display: flex;
|
|
|
position: fixed;
|
|
|
- right: 36px;
|
|
|
- top: 115px;
|
|
|
+ right: 20px;
|
|
|
+ top: 43px;
|
|
|
}
|
|
|
</style>
|