|
@@ -3,25 +3,20 @@
|
|
|
<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(0)">返回列表
|
|
|
+ @click="backToList(0)">返回列表
|
|
|
</el-button>
|
|
|
</div>
|
|
|
<div class="add-customer-btn">
|
|
|
<!-- <el-button class="el-button--small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
|
|
|
<!-- @click="confirmEditing">编辑-->
|
|
|
<!-- </el-button>-->
|
|
|
- <el-button
|
|
|
- class="el-button--small-yh"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="editCustomer">保存数据
|
|
|
+ <el-button class="el-button--small-yh" type="primary" size="small" :disabled="form.financeStatus == '已付款' " @click="editCustomer">保存数据
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- class="el-button--small-yh"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- v-if="form.id">启用
|
|
|
+ <el-button class="el-button--small-yh" type="warning" size="small" @click="collection">{{ form.financeStatus ==
|
|
|
+ '已付款' ? '撤销收款' : '收款' }}
|
|
|
</el-button>
|
|
|
+ <!-- <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.id">启用
|
|
|
+ </el-button> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="margin-top: 50px">
|
|
@@ -29,44 +24,67 @@
|
|
|
<avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
|
|
|
</trade-card>
|
|
|
<trade-card title="明细信息">
|
|
|
- <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.contactsList"
|
|
|
- @row-save="rowSave"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @resetColumn="resetColumnTwo('formContacts','optionContacts','optionContactsBack',267.1)"
|
|
|
- @saveColumn="saveColumnTwo('formContacts','optionContacts','optionContactsBack',267.1)">
|
|
|
+ <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.settlementItemsList"
|
|
|
+ @row-save="rowSave" @row-update="rowUpdate"
|
|
|
+ @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 267.1)"
|
|
|
+ @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 267.1)">
|
|
|
+ <template slot-scope="scope" slot="menuLeft">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" :disabled="form.financeStatus == '已付款' " size="small" @click="rowAdd()">选择订单</el-button>
|
|
|
+ </template>
|
|
|
<template slot-scope="{type,size,row,index,disabled}" slot="menu">
|
|
|
- <el-button
|
|
|
- :size="size" :disabled="disabled" :type="type"
|
|
|
- :icon="row.$cellEdit?'el-icon-plus':'el-icon-edit'"
|
|
|
- @click="$refs.formContacts.rowCell(row,index)"
|
|
|
- >{{ row.$cellEdit ? '确认' : '修改' }}
|
|
|
+ <el-button :size="size" :disabled="form.financeStatus == '已付款' " :type="type"
|
|
|
+ :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formContacts.rowCell(row, index)">{{
|
|
|
+ row.$cellEdit ? '确认' : '修改' }}
|
|
|
</el-button>
|
|
|
- <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
|
|
|
- @click="rowDelBox(row,index)">删除
|
|
|
+ <el-button icon="el-icon-delete" :size="size" :disabled="form.financeStatus == '已付款' " :type="type"
|
|
|
+ @click="rowDelBox(row, index)">删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</trade-card>
|
|
|
</div>
|
|
|
+ <el-dialog title="导入销售" append-to-body class="el-dialogDeep" :visible.sync="billDetailDialog" width="80%"
|
|
|
+ :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" top="10vh" v-dialog-drag>
|
|
|
+ <bill-detail :params="params" :billType="billType" :flag="1" @closeFun="closeBillDetail"
|
|
|
+ @importProMent="importProMent">
|
|
|
+ </bill-detail>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import billDetail from "@/components/bill/selectOrderDetailList";
|
|
|
+import { saveSubmit, collectionAndPayment, revokeCollectionAndPayment, detail,removeItems,remove } from '@/api/accountingManagement/index.js';
|
|
|
+import { getList } from "@/api/collectionSettlement/index.js";
|
|
|
+
|
|
|
|
|
|
export default {
|
|
|
name: "detailsPage",
|
|
|
+ components: {
|
|
|
+ billDetail
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
disabled: false,
|
|
|
+ billDetailDialog: false,
|
|
|
+ params: {},
|
|
|
form: {
|
|
|
- contactsList: []
|
|
|
+ settlementItemsList: []
|
|
|
},
|
|
|
optionForm: {
|
|
|
+ disabled:false,
|
|
|
menuBtn: false,
|
|
|
span: 8,
|
|
|
column: [{
|
|
|
label: '客户',
|
|
|
prop: "corpId",
|
|
|
+ type: 'select',
|
|
|
+ remote: true,
|
|
|
+ props: {
|
|
|
+ label: 'cname',
|
|
|
+ value: 'id'
|
|
|
+ },
|
|
|
+ dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=0',
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
@@ -74,7 +92,23 @@ export default {
|
|
|
}]
|
|
|
}, {
|
|
|
label: '收款账户',
|
|
|
- prop: "accountId",
|
|
|
+ prop: "accountName",
|
|
|
+ remote: true,
|
|
|
+ type: 'select',
|
|
|
+ props: {
|
|
|
+ label: 'cname',
|
|
|
+ value: 'cname'
|
|
|
+ },
|
|
|
+ dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
|
|
|
+ dicFormatter: (res => {
|
|
|
+ return res.data.records
|
|
|
+ }),
|
|
|
+ change: (data => {
|
|
|
+ console.log(data);
|
|
|
+ console.log(this.$refs.form.DIC.accountName);
|
|
|
+ const targetObject = this.$refs.form.DIC.accountName.find(obj => obj.cname == data.value);
|
|
|
+ this.form.accountId = targetObject.id
|
|
|
+ }),
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
@@ -83,6 +117,7 @@ export default {
|
|
|
}, {
|
|
|
label: '金额',
|
|
|
prop: "amount",
|
|
|
+ disabled: true,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
@@ -90,11 +125,11 @@ export default {
|
|
|
}]
|
|
|
}, {
|
|
|
label: "经办人",
|
|
|
- prop: "handledById",
|
|
|
+ prop: "handledByName",
|
|
|
type: "select",
|
|
|
props: {
|
|
|
label: "name",
|
|
|
- value: "id"
|
|
|
+ value: "name"
|
|
|
},
|
|
|
dicUrl: "/api/blade-user/client/gainUser",
|
|
|
filterable: true,
|
|
@@ -106,6 +141,17 @@ export default {
|
|
|
}, {
|
|
|
label: '收款日期',
|
|
|
prop: "settlementDate",
|
|
|
+ type: "date",
|
|
|
+ overHidden: true,
|
|
|
+ width: 100,
|
|
|
+ searchRange: true,
|
|
|
+ searchDefaultTime: ["00:00:00", "23:59:59"],
|
|
|
+ format: "yyyy-MM-dd",
|
|
|
+ valueFormat: "yyyy-MM-dd HH:mm:ss"
|
|
|
+ }, {
|
|
|
+ label: '单据编号',
|
|
|
+ prop: "sysNo",
|
|
|
+ disabled: true
|
|
|
}, {
|
|
|
label: '备注',
|
|
|
prop: "remarks",
|
|
@@ -117,50 +163,93 @@ export default {
|
|
|
formContacts: {},
|
|
|
optionContacts: {},
|
|
|
optionContactsBack: {
|
|
|
+ disabled:false,
|
|
|
align: 'center',
|
|
|
index: true,
|
|
|
- addBtnText: "录入明细",
|
|
|
+ // addBtnText: "录入明细",
|
|
|
refreshBtn: false,
|
|
|
dialogDrag: true,
|
|
|
addBtn: false,
|
|
|
span: 8,
|
|
|
height: 600,
|
|
|
- addRowBtn: true,
|
|
|
+ // addRowBtn: true,
|
|
|
editBtn: false,
|
|
|
delBtn: false,
|
|
|
menuWidth: 140,
|
|
|
dialogTop: 25,
|
|
|
dialogWidth: "80%",
|
|
|
- column: [{
|
|
|
- label: '单据编号',
|
|
|
- prop: 'attn',
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '合同号',
|
|
|
- prop: 'contractNumber',
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '应收金额',
|
|
|
- prop: 'accountsAmount',
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '结算金额',
|
|
|
- prop: 'settlmentAmount',
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '本次金额',
|
|
|
- prop: 'thisAmount',
|
|
|
- cell: true
|
|
|
- }, {
|
|
|
- label: '备注',
|
|
|
- prop: 'remarks',
|
|
|
- cell: true
|
|
|
- }]
|
|
|
+ column: [
|
|
|
+ // {
|
|
|
+ // label: '单据编号',
|
|
|
+ // prop: 'attn',
|
|
|
+ // cell: true
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ label: '合同号',
|
|
|
+ prop: 'contractNumber',
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '应收金额',
|
|
|
+ prop: 'accountsAmount',
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '结算金额',
|
|
|
+ prop: 'settlmentAmount',
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '本次金额',
|
|
|
+ prop: 'thisAmount',
|
|
|
+ cell: true
|
|
|
+ }, {
|
|
|
+ label: '来源主表id',
|
|
|
+ hide: true,
|
|
|
+ showColumn: false,
|
|
|
+ prop: 'srcParentId',
|
|
|
+ cell: true
|
|
|
+ }, {
|
|
|
+ label: '来源单据编号',
|
|
|
+ prop: 'srcBillNo',
|
|
|
+ hide: true,
|
|
|
+ showColumn: false,
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '所属公司id',
|
|
|
+ prop: 'salesCompanyId',
|
|
|
+ hide: true,
|
|
|
+ showColumn: false,
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '所属公司名称',
|
|
|
+ prop: 'salesCompanyName',
|
|
|
+ hide: true,
|
|
|
+ showColumn: false,
|
|
|
+ cell: false
|
|
|
+ }, {
|
|
|
+ label: '备注',
|
|
|
+ prop: 'remarks',
|
|
|
+ cell: true
|
|
|
+ }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ props: {
|
|
|
+ onLoad: Object,
|
|
|
+ detailData: Object
|
|
|
+ },
|
|
|
async created() {
|
|
|
+ let thisAmountSum = 0
|
|
|
this.optionContacts = await this.getColumnData(this.getColumnName(267.1), this.optionContactsBack);
|
|
|
+ this.findObject(this.optionContacts.column, "thisAmount").change = ({ value, column }) => {
|
|
|
+ thisAmountSum = 0
|
|
|
+ for (let item of this.form.settlementItemsList) {
|
|
|
+ thisAmountSum += item.thisAmount;
|
|
|
+ }
|
|
|
+ this.form.amount = thisAmountSum
|
|
|
+ }
|
|
|
+ console.log(this.onLoad.id);
|
|
|
+ if (this.onLoad.id) {
|
|
|
+ this.refresh(this.onLoad.id)
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
rowDelBox(row, index) {
|
|
@@ -169,18 +258,19 @@ export default {
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
- if (row.id) {
|
|
|
- // tradingBox(row.id).then(res => {
|
|
|
- // this.form.contactsList.splice(index, 1);
|
|
|
- // this.$message.success("操作成功!");
|
|
|
- // });
|
|
|
- } else {
|
|
|
- this.form.contactsList.splice(index, 1);
|
|
|
+ if (row.id) {
|
|
|
+ console.log(this.form);
|
|
|
+ removeItems({ids:row.id}).then(res => {
|
|
|
+ this.form.settlementItemsList.splice(index, 1);
|
|
|
this.$message.success("操作成功!");
|
|
|
- }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.settlementItemsList.splice(index, 1);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
}
|
|
|
+ }
|
|
|
)
|
|
|
- ;
|
|
|
+ ;
|
|
|
},
|
|
|
rowSave(form, done, loading) {
|
|
|
done(form)
|
|
@@ -188,6 +278,161 @@ export default {
|
|
|
rowUpdate(form, index, done, loading) {
|
|
|
done(form)
|
|
|
},
|
|
|
+ refresh(id, type) {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '加载中',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(255,255,255,0.7)'
|
|
|
+ })
|
|
|
+ detail({ id: id }).then(res => {
|
|
|
+ this.form = res.data.data
|
|
|
+ if(res.data.data.financeStatus == '已付款'){
|
|
|
+ console.log('已付款');
|
|
|
+ this.$set(this.optionForm,'disabled',true)
|
|
|
+ this.$set(this.optionContactsBack,'disabled',true)
|
|
|
+ }else{
|
|
|
+ this.$set(this.optionForm,'disabled',false)
|
|
|
+
|
|
|
+ }
|
|
|
+ loading.close();
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //新增
|
|
|
+ rowAdd() {
|
|
|
+ if (!this.form.corpId) {
|
|
|
+ this.$message.warning("请先选择客户!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.params = {
|
|
|
+ customerId: this.form.corpId,
|
|
|
+ generateTask: '已生成',
|
|
|
+ bsType: 'XS',
|
|
|
+ actualPaymentStatus: '2'
|
|
|
+ }
|
|
|
+ this.billDetailDialog = true;
|
|
|
+
|
|
|
+ // this.$refs.formContacts.rowAdd()
|
|
|
+ },
|
|
|
+ //导入
|
|
|
+ importProMent(list) {
|
|
|
+ console.log(list);
|
|
|
+ // return
|
|
|
+ // for (let item of this.dataList){
|
|
|
+ // for (let li of list){
|
|
|
+ // if (item.srcSysno == li.srcSysno && item.srcRefno == li.srcRefno && new Date(item.rentEndDate) == new Date(li.rentEndDate)){
|
|
|
+ // return this.$message.error(`合同号${item.accSysNo}已存在`)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ list.forEach((item, index) => {
|
|
|
+ item.contractNumber = item.ordNo;
|
|
|
+ item.accountsAmount = item.totalMoney
|
|
|
+ item.settlmentAmount = item.paymentAmountTl
|
|
|
+ item.thisAmount = (Number(item.totalMoney) - Number(item.paymentAmountTl))
|
|
|
+ item.srcParentId = item.id
|
|
|
+ item.srcBillNo = item.ordNo
|
|
|
+ item.salesCompanyId = item.salesCompanyId
|
|
|
+ item.salesCompanyName = item.salesCompanyName
|
|
|
+ item.id = null
|
|
|
+ delete item.ordNo;
|
|
|
+ this.$refs.formContacts.rowCellAdd(item);
|
|
|
+ })
|
|
|
+ //明细列表所有合同号 去重 加, 为主表合同号
|
|
|
+ // this.$set(this.form,'srcOrderno',Array.from(new Set(this.dataList.map(item =>{ return item.srcOrderno}))).join(','))
|
|
|
+
|
|
|
+ this.billDetailDialog = false;
|
|
|
+ },
|
|
|
+ //保存数据
|
|
|
+ editCustomer() {
|
|
|
+ this.$refs["form"].validate((valid, done) => {
|
|
|
+ done()
|
|
|
+ if (valid) {
|
|
|
+ let data = {
|
|
|
+ ...this.form,
|
|
|
+ dc: 'd',
|
|
|
+ billType: 'SK'
|
|
|
+ }
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '加载中',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(255,255,255,0.7)'
|
|
|
+ });
|
|
|
+ saveSubmit(data).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.$message.success('保存成功')
|
|
|
+ loading.close();
|
|
|
+ }).catch(() => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ //收款
|
|
|
+ collection() {
|
|
|
+ this.$refs["form"].validate((valid, done) => {
|
|
|
+ done()
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.financeStatus !== '已付款') {
|
|
|
+ console.log('this.form.financeStatus',this.form.financeStatus );
|
|
|
+ this.$confirm("确认收款?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '加载中',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(255,255,255,0.7)'
|
|
|
+ });
|
|
|
+ let data = {
|
|
|
+ ...this.form,
|
|
|
+ dc: 'd',
|
|
|
+ billType: 'SK'
|
|
|
+ }
|
|
|
+ collectionAndPayment(data).then((res => {
|
|
|
+ this.refresh(res.data.data.id)
|
|
|
+ this.$message.success('收款成功')
|
|
|
+ loading.close()
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$confirm("确认撤销退款?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '加载中',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(255,255,255,0.7)'
|
|
|
+ });
|
|
|
+ let data = {
|
|
|
+ ...this.form,
|
|
|
+ dc: 'd',
|
|
|
+ billType: 'SK'
|
|
|
+ }
|
|
|
+ revokeCollectionAndPayment(data).then((res => {
|
|
|
+ this.refresh(res.data.data.id)
|
|
|
+ this.$message.success('撤销收款成功')
|
|
|
+ loading.close()
|
|
|
+ }))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ //关闭
|
|
|
+ closeBillDetail() {
|
|
|
+ this.billDetailDialog = false;
|
|
|
+ },
|
|
|
//自定义列保存
|
|
|
async saveColumnTwo(ref, option, optionBack, code) {
|
|
|
/**
|