123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736 |
- <template>
- <div class="borderless">
- <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>
- <div class="upper_right_button">
- <el-button type="primary"
- size="small"
- :disabled="!form.id"
- @click="postMessage"
- >发送消息</el-button>
- <el-button type="warning"
- size="small"
- class="el-button--small-yh"
- :buttonLoading="buttonLoading"
- :disabled="!form.id"
- @click.stop="confirmSettlement"
- >{{financeDisabled?"收费":"撤销收费"}}
- </el-button>
- <el-button class="el-button--small-yh"
- type="primary"
- size="small"
- :buttonLoading="buttonLoading"
- :disabled="!financeDisabled"
- @click.stop="saveSettlement"
- >保存数据
- </el-button>
- </div>
- </div>
- </div>
- <div class="customer-main">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container>
- <avue-form class="trading-form" ref="form" v-model="form" :option="option">
- <template slot="corpId">
- <crop-select
- v-model="form.corpId"
- corpType="KG"
- :disabled="!financeDisabled"
- @getCorpData="returnBack"
- style="width: 100%"
- ></crop-select>
- </template>
- <template slot="accountNo">
- <el-select v-model="form.accountNo"
- placeholder="请选择"
- :disabled="!financeDisabled"
- @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>
- <template slot="caseOverPayment">
- <el-input
- placeholder="请输入"
- clearable
- v-model="form.caseOverPayment"
- @change="caseOverPaymentChange"
- v-input-limit="2"
- :disabled="dataList.length == 0"
- ></el-input>
- </template>
- <template slot="remark">
- <el-input type="textarea"
- v-model="form.remark"
- size="small"
- rows="2"
- autocomplete="off"
- placeholder="">
- </el-input>
- </template>
- </avue-form>
- </basic-container>
- <containerTitle title="明细列表"></containerTitle>
- <basic-container>
- <avue-crud :option="itemsOption"
- :data="dataList"
- ref="crud"
- v-model="itemsForm"
- :page.sync="page"
- @search-reset="searchReset"
- @row-update="rowUpdate"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange">
- <template slot="menuLeft">
- <el-button type="primary"
- size="small"
- icon="el-icon-shopping-cart-2"
- :disabled="!financeDisabled"
- :buttonLoading="buttonLoading"
- @click="selectRecipt"
- >选择销售合同
- </el-button>
- </template>
- <template slot-scope="{ row }" slot="currency">
- <el-select v-if="row.$cellEdit" v-model="row.currency" size="small" placeholder="请选择 币别" clearable filterable>
- <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
- </el-select>
- <span v-else>{{ row.currency }}</span>
- </template>
- <template slot="thisAmount" slot-scope="{ row }">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <el-input
- v-if="row.$cellEdit"
- v-model="row.thisAmount"
- style="width: 90%"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- ></el-input>
- <span v-else>{{ row.thisAmount }}</span>
- </template>
- <template slot-scope="scope" slot="menu">
- <el-button
- type="text"
- size="small"
- icon="el-icon-edit"
- :disabled="!financeDisabled"
- @click.stop="rowCell(scope.row,scope.index)"
- > {{ scope.row.$cellEdit ? '修改完成' : '修改' }}
- </el-button>
- <el-button
- type="text"
- size="small"
- icon="el-icon-delete"
- :disabled="!financeDisabled"
- @click.stop="rowDel(scope.row,scope.index)"
- >删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <el-dialog
- title="导入销售"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="billDetailDialog"
- width="60%"
- :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"
- @closeFun="closeBillDetail"
- @importProMent="importProMent"
- >
- </bill-detail>
- </el-dialog>
- </div>
- <messagePost
- v-if="messageVisble"
- ref="messagePost"
- @closeDialog="closeDialog"
- ></messagePost>
- </div>
- </template>
- <script>
- import option from "./configuration/detailsPage.json";
- import { getDetail } from "@/api/financialManagement/financialManagement"
- import { getDetails,modify,cancelModify,saveOrEdit } from "@/api/financialManagement/paymentRequest";
- import billDetail from "@/components/bill/billDetailList";
- import _ from "lodash";
- import { getlistBankBy,deleteDetail } from "@/api/financialManagement/paymentRequest";
- import { contrastObj,contrastList } from "@/util/contrastData";
- import {getUserInfo} from "@/api/system/user";
- import {getCorpDetail} from "@/api/maintenance/overpayment";
- import messagePost from "@/components/messageSend/main"
- export default {
- name: "receiptDetailsPage",
- props: {
- detailData: {
- type: Object
- }
- },
- components:{
- billDetail,
- messagePost
- },
- data() {
- return {
- category: '',
- form: {},
- itemsForm:{},
- params:{},
- buttonLoading:false,
- itemsOption: option,
- option: {
- menuBtn: false,
- labelWidth: 100,
- column: [
- {
- label: '系统号',
- prop: 'sysNo',
- span: 8,
- disabled: true
- },{
- label: '合同号',
- prop: 'srcOrderno',
- span: 8,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '往来单位',
- prop: 'corpId',
- sort:true,
- span: 8,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '银行账号',
- prop: 'accountNo',
- span: 8,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '开户银行',
- prop: 'accountBank',
- span: 8,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '银行户头',
- prop: 'accountName',
- span: 8,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '人民币金额',
- prop: 'amount',
- span: 8,
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- },
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '外币金额',
- prop: 'foreignAmount',
- display: true,
- span: 8,
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '使用溢付款',
- prop: 'caseOverPayment',
- display: false,
- span: 8,
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '溢付款余额',
- prop: 'overPayment',
- display: false,
- disabled: true,
- span: 8,
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '收款日期',
- prop: 'time',
- span: 8,
- type:"date",
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '制单人',
- prop: 'createUserName',
- span: 8,
- disabled:true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '制单日期',
- prop: 'createTime',
- span: 8,
- type:"date",
- disabled:true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '备注',
- prop: 'remark',
- span:24,
- row:2,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- ],
- },
- id:'',
- dataList: [],
- currencyDic:[],
- page: {
- pageSize: 10,
- pagerCount: 5,
- total: 0,
- },
- billDetailDialog:false,
- financeDisabled:true,
- billType:"收费",
- // 明细本次金额总计
- allAmount: 0,
- // 消息弹窗
- messageVisble: false,
- //新旧数据对比
- oldForm:{},
- oldDataList:[],
- financeStatusDic:[{
- value: '正常',
- label: '正常'
- },
- {
- value: '停用',
- label: '停用'
- }],
- }
- },
- created() {
- // 人民币金额默认为0
- this.$set(this.form,"amount", 0)
- getUserInfo().then(res=>{
- this.category = res.data.data.billType
- if (this.category == 2) {
- this.$set(this.form,"overPayment", 0)
- this.$set(this.form,"caseOverPayment", 0)
- this.option.column.forEach(item => {
- if (item.prop == 'caseOverPayment' || item.prop == 'overPayment') {
- item.display = true
- }
- if (item.prop == 'foreignAmount') {
- item.display = false
- }
- })
- }
- })
- //币别
- this.getWorkDicts("currency").then(res =>{
- this.currencyDic = res.data.data
- })
- if (this.detailData.id) {
- this.buttonLoading = true
- this.id = this.detailData.id;//字符串转数字 超长用BigInt
- getDetail(this.id).then(res => {
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }else{
- this.form.financeStatus = "待结算"
- this.oldForm.financeStatus = "待结算"
- }
- },
- mounted() {
- },
- methods: {
- //选择客户
- returnBack(corpValue){
- this.corpId = corpValue.id
- getlistBankBy(corpValue.id).then(res =>{
- this.$set(this.form,"bankList",res.data)
- })
- // 溢付款余额获取
- if (this.category == 2) {
- getCorpDetail({corpId:corpValue.id}).then(res => {
- this.form.overPayment = res.data.data? res.data.data.balanceOverpaymen: 0
- })
- }
- },
- //选择卡号
- 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
- delete item.id;
- this.$refs.crud.rowCellAdd(item);
- })
- //明细列表所有合同号 去重 加, 为主表合同号
- this.$set(this.form,'srcOrderno',Array.from(new Set(this.dataList.map(item =>{ return item.srcOrderno}))).join(','))
- this.billDetailDialog = false;
- },
- rowUpdate(row, index, done) {
- done(row);
- },
- rowCell(row,index){
- // row.$cellEdit = !row.$cellEdit
- this.$refs.crud.rowCell(row, index)
- },
- rowDel(row,index){
- if (row.id) {
- deleteDetail({ids: row.id}).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.dataList.splice(index, 1);
- })
- } else {
- this.dataList.splice(index, 1);
- }
- },
- searchReset() {
- console.log('1')
- },
- selectionChange() {
- console.log('1')
- },
- currentChange() {
- console.log('1')
- },
- sizeChange() {
- console.log('1')
- },
- refreshChange() {
- console.log('1')
- },
- confirmSettlement(status){
- if (!this.form.corpId) return this.$message.error('往来单位不能为空')
- this.$refs["form"].validate((valid,done) => {
- done();
- if(valid && this.verificationData()){
- this.$confirm("是否确认收费?", "提示", {
- confirmButtonText: "确认",
- cancelButtonText: "取消",
- type: "warning",
- }).then(()=>{
- for (let i = 0; i < this.dataList.length; i++) {
- if (this.dataList[i].thisAmount == null || this.dataList[i].thisAmount == 0 ) {
- return this.$message.error(`第${i + 1}行的本次金额不能为空`);
- }
- }
- this.buttonLoading = true
- this.form.billNo = this.dataList.map(item =>{return item.billNo}).join(",")
- if (this.category == 2 && this.financeDisabled) {
- this.allAmount = 0;
- this.form.amount = this.form.amount? this.form.amount: 0
- this.dataList.forEach(e => {
- this.allAmount = Number(this.allAmount) + Number(e.thisAmount)
- })
- if (this.allAmount == 0 && this.form.amount == 0) {
- return this.$message.error('人民币金额不能为空')
- } else if (Number(this.allAmount) > 0 && (Number(this.form.amount) > Number(this.allAmount))) {
- this.form.caseOverPayment = 0;
- } else if (Number(this.allAmount) > 0 && (Number(this.form.amount) < Number(this.allAmount))) {
- this.form.caseOverPayment = Number(this.allAmount) - Number(this.form.amount)
- if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
- return this.$message.error('溢付款余额不足,无法收费')
- }
- }
- }
- const params = {
- ...this.form,
- billType:"收费",
- itemsList:this.dataList
- }
- if(this.financeDisabled){
- modify(params).then(res =>{
- this.$message.success("操作成功!")
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }else{
- cancelModify(params).then(res =>{
- this.$message.success("操作成功!")
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }
- })
- if(status === true){
- this.$emit("goBack");
- }
- }
- })
- },
- saveSettlement(){
- this.$refs["form"].validate((valid,done) => {
- done();
- if(valid){
- for (let i = 0; i < this.dataList.length; i++) {
- if (this.dataList[i].thisAmount === (null || "")) {
- return this.$message.error(`第${i + 1}行的本次金额不能为空`);
- }
- }
- this.buttonLoading = true
- 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)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }})
- },
- async afterEcho(data){
- this.form = data;
- // 溢付款余额获取
- if (this.category == 2) {
- await getCorpDetail({corpId: this.form.corpId}).then(res => {
- if (Number(this.form.overPayment) != (res.data.data? res.data.data.balanceOverpaymen: '0.00')) {
- this.form.overPayment = res.data.data? res.data.data.balanceOverpaymen: '0.00'
- }
- })
- }
- this.oldForm = Object.assign({},this.form);
- this.financeDisabled = this.form.financeStatus === "待结算"?true:false;
- if(this.financeDisabled){
- this.option.column.forEach(item =>{
- if( item.prop === "remark"){
- this.$set(item,"disabled",false)
- }else if( item.prop === "createUserName" || item.prop === "createTime" || item.prop === "sysNo" || item.prop === "overPayment"){
- this.$set(item,"disabled",true)
- }else{
- this.$set(item,"disabled",false)
- }
- })
- }
- if(this.financeDisabled === false){
- this.option.column.forEach(item =>{
- if( item.prop === "remark"){
- this.$set(item,"disabled",false)
- }else if( item.prop === "createUserName" || item.prop === "createTime" || item.prop === "sysNo"){
- this.$set(item,"disabled",true)
- }else{
- this.$set(item,"disabled",true)
- }
- })
- }
- if(data.itemsList){
- this.dataList = data.itemsList
- this.oldDataList = this.deepClone(data.itemsList)
- }
- },
- verificationData(){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
- ){
- this.$confirm("数据发生变化,请先提交保存!", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.saveSettlement()
- }).catch(()=>{
- return false
- })
- }else{
- return true
- }
- },
- backToList(){
- if(contrastObj(this.form,this.oldForm) || contrastList(this.dataList,this.oldDataList)
- ){
- this.$confirm("是否保存当前页面?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.saveSettlement()
- }).catch(()=>{
- this.$emit("goBack");
- })
- }else{
- this.$emit("goBack");
- }
- },
- // 溢付款更改时
- caseOverPaymentChange() {
- if (!this.form.caseOverPayment) this.form.caseOverPayment = 0;
- if (Number(this.form.caseOverPayment) > Number(this.form.overPayment)) {
- this.form.caseOverPayment = 0;
- return this.$message.error('本次使用的溢付款不能超过总溢付款')
- }
- },
- // 发送消息
- postMessage() {
- this.messageVisble = true
- this.$nextTick(() => {
- this.$refs.messagePost.init()
- })
- },
- closeDialog() {
- this.messageVisble = false
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- .required_fields{
- color: #F56C6C;
- display:inline-block;
- width: 7%
- }
- .upper_right_button{
- display: flex;
- position: fixed;
- right: 12px;
- top: 47px;
- }
- </style>
|