oil-station/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue

1253 lines
45 KiB
Vue
Raw Normal View History

2023-10-27 16:31:27 +08:00
<template>
2023-11-14 19:00:25 +08:00
<div class="app-center">
2023-11-22 18:10:36 +08:00
<!-- 查询-->
2023-11-14 19:00:25 +08:00
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>挂账</span>
</div>
<!-- <div style="display: flex;">-->
<!-- <div class="top-app-sou">-->
<!-- <el-form :label-position="labelPosition" label-width="40px" :model="formLabelAlign">-->
<!-- <el-form-item label="名称">-->
<!-- <el-input v-model="formLabelAlign.name" placeholder="请输入要搜索的内容"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- </div>-->
<!-- <div style="margin-left: 10px">-->
<!-- <el-button type="primary" icon="el-icon-search">搜索</el-button>-->
<!-- </div>-->
<!-- </div>-->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
<el-form-item label="归还状态" prop="returnType">
<el-select
v-model="queryParams.returnType"
clearable
placeholder="全部"
>
<el-option label="挂账" value="0"></el-option>
<el-option label="归还" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="订单状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="全部"
clearable
>
<el-option label="未归还" value="0"></el-option>
<el-option label="已归还" value="1"></el-option>
<el-option label="部分归还" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="单位名称" prop="unitName">
<el-input
v-model="queryParams.unitName"
placeholder="请输入挂账单位名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="挂账人" prop="personCredit">
<el-input
v-model="queryParams.personCredit"
placeholder="请输入挂账人名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系电话" prop="contactMobile">
<el-input
v-model="queryParams.contactMobile"
placeholder="请输入挂账人联系电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作人手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入操作人手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
size="medium"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
2023-11-22 18:10:36 +08:00
<!-- 统计-->
2023-11-14 19:00:25 +08:00
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>统计</span>
</div>
<div class="box-gang">
<div class="box" v-for="(item,index) in 7" :key="index">
<div class="size-hui">挂账笔数</div>
<div class="size-bole">55</div>
2023-10-27 16:31:27 +08:00
</div>
2023-11-14 19:00:25 +08:00
</div>
</el-card>
2023-11-22 18:10:36 +08:00
<!-- 挂账列表-->
2023-11-14 19:00:25 +08:00
<el-card class="box-card">
<div class="wgang">
<div>列表</div>
<div style="display: flex ">
<el-button type="primary" size="mini" @click="addRecord">新增挂账记录</el-button>
2023-11-15 18:48:07 +08:00
<el-button type="success" size="mini" @click="batchReturn">批量挂账归还</el-button>
2023-10-27 16:31:27 +08:00
</div>
2023-11-14 19:00:25 +08:00
</div>
<div class="table-box">
<el-table
:data="hangBillList"
style="width: 100%">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" style="margin-left: 20px" inline class="demo-table-expand">
<el-form-item label="操作人手机号">
<span>{{ props.row.mobile }}</span>
</el-form-item><br/>
<el-form-item label="更新时间">
<span>{{ props.row.updateTime ? props.row.updateTime:"--" }}</span>
</el-form-item><br/>
<el-form-item label="单据备注">
<span>{{ props.row.remark ? props.row.remark:"--" }}</span>
</el-form-item><br/>
<el-form-item label="单据金额">
<span>{{ props.row.amount ? props.row.amount:"--" }}</span>
</el-form-item>
<el-form-item label="已还金额">
<span>{{ props.row.repaidAmount ? props.row.repaidAmount:"--" }}</span>
</el-form-item>
<el-form-item label="未还金额">
<span>{{ props.row.outstandAmount ? props.row.outstandAmount:"--" }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
2023-11-23 18:37:40 +08:00
<el-table-column prop="orderNo" label="单据号" width="200"></el-table-column>
2023-11-14 19:00:25 +08:00
<el-table-column label="挂账单位">
2023-11-23 18:37:40 +08:00
<el-table-column prop="unitName" label="单位名称"> </el-table-column>
<el-table-column prop="personCredit" label="挂账人"> </el-table-column>
<el-table-column prop="contactMobile" label="联系电话"> </el-table-column>
2023-11-14 19:00:25 +08:00
</el-table-column>
<el-table-column label="记录明细">
2023-11-23 18:37:40 +08:00
<el-table-column prop="returnType" label="类型">
2023-11-14 19:00:25 +08:00
<template slot-scope="scope">
<el-tag v-if="scope.row.returnType == 0">挂账</el-tag>
<el-tag v-else type="success">归还</el-tag>
</template>
2023-10-27 16:31:27 +08:00
</el-table-column>
2023-11-23 18:37:40 +08:00
<el-table-column prop="amount" label="金额"> </el-table-column>
<el-table-column prop="status" label="状态">
2023-11-14 19:00:25 +08:00
<template slot-scope="scope">
<span v-if="scope.row.status == 0">未归还</span>
<span v-else-if="scope.row.status == 1" type="success">已归还</span>
<span v-else type="success">部分归还</span>
</template>
2023-10-27 16:31:27 +08:00
</el-table-column>
2023-11-23 18:37:40 +08:00
<el-table-column prop="outstandAmount" label="未归还金额"> </el-table-column>
2023-11-14 19:00:25 +08:00
</el-table-column>
2023-11-23 18:37:40 +08:00
<el-table-column prop="realName" label="操作人"> </el-table-column>
<el-table-column prop="createTime" label="创建时间" width="220">
2023-11-14 19:00:25 +08:00
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
:disabled="scope.row.status == 1"
@click="repay(scope.row.id)"
>归还</el-button>
2023-11-23 18:37:40 +08:00
<el-button
size="mini"
type="text"
@click="returnRecord(scope.row.id)"
>归还详情</el-button>
2023-11-14 19:00:25 +08:00
</template>
</el-table-column>
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
</el-table>
2023-10-27 16:31:27 +08:00
</div>
2023-11-14 19:00:25 +08:00
<div class="pagination-box">
<el-pagination
background
layout="prev, pager, next"
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@current-change="getList">
</el-pagination>
</div>
</el-card>
2023-11-23 18:37:40 +08:00
<!-- 归还记录信息-->
<el-drawer
title="归还详情"
:visible.sync="drawer"
direction="rtl"
size="55%"
:before-close="handleClose">
<div style="display: grid; place-items: center;">
<el-card style="background-color: #f5f5f5;width: 90%">
<div slot="header" class="clearfix">
<div style="position: relative;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<h2>单据号{{record.orderNo}}</h2>
</div>
</div>
<br>
<div style="display: flex; justify-content: space-between;">
<span>操作员工</span>
<span>{{ record.realName }}</span>
</div>
</div>
<div >
<div style="display: flex; justify-content: space-between;">
<span>挂账单位</span>
<span>{{record.unitName}}</span>
</div>
<div style="display: flex; justify-content: space-between;margin: 10px 0">
<span>挂账人</span>
<span>{{record.personCredit}}</span>
</div>
<div style="display: flex; justify-content: space-between;">
<span>联系电话</span>
<span>{{record.contactMobile}}</span>
</div>
</div>
</el-card>
<el-card style="margin-top: 15px;width: 90%">
<el-table ref="tables"
v-loading="loading"
:data="returnRecordList">
<el-table-column label="单据号" align="center" prop="orderNo" width="200"></el-table-column>
<el-table-column label="类型" align="center" prop="returnType">
<template slot-scope="scope">
<el-tag v-if="scope.row.returnType == 0">挂账</el-tag>
<el-tag v-else type="success">归还</el-tag>
</template>
</el-table-column>
<el-table-column label="归还金额" align="center" prop="amount" />
<el-table-column label="找零金额" align="center" prop="seekZero" />
<el-table-column label="归还方式" align="center" prop="status">
<template slot-scope="scope">
<span>{{ getPayMeth(payList,scope.row.status) }}</span>
</template>
</el-table-column>
<el-table-column label="支付状态" align="center" prop="payStatus">
<template slot-scope="scope">
<el-tag v-if="scope.row.payStatus == 'unpaid'">未支付</el-tag>
<el-tag type="success" v-else-if="scope.row.payStatus == 'paid'">已支付</el-tag>
<el-tag type="danger" v-else>支付失败</el-tag>
</template>
</el-table-column>
<el-table-column label="操作人" align="center" prop="realName" />
<el-table-column label="支付时间" align="center" prop="payTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.payTime) }}</span>
</template>
</el-table-column>
</el-table>
<div class="pagination-box">
<el-pagination
background
layout="prev, pager, next"
v-show="total2>0"
:total="total2"
:page.sync="queryParams1.page"
:limit.sync="queryParams1.pageSize"
@current-change="getRecordList">
</el-pagination>
</div>
</el-card>
</div>
</el-drawer>
2023-11-14 19:00:25 +08:00
<!-- 新增挂账记录-->
<el-dialog title="新增挂账记录" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="挂账单位" prop="unitName" style="width: 420px">
<el-autocomplete
popper-class="my-autocomplete"
v-model="form.unitName"
style="width: 180%"
:fetch-suggestions="querySearch"
placeholder="请选择挂账单位"
@select="changeUnit">
<template slot-scope="{ item }">
<div style="display: flex;justify-content: space-between">
{{item.unitName}}{{item.personCredit}} {{item.contactMobile}}
</div>
</template>
<el-button slot="append" @click="open1 = true">新增挂账单位</el-button>
</el-autocomplete>
<!-- <el-input placeholder="请选择挂账单位" v-model="form.unitName" class="input-with-select">-->
<!-- <el-button slot="append">新增挂账单位</el-button>-->
<!-- </el-input>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="挂账金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入挂账金额" maxlength="30" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
</el-form>
2023-11-20 19:53:05 +08:00
<div>
<el-tag style="width: 100%;height: 40px;line-height: 40px;padding-left: 30px" type="info">
当前挂账为普通挂账方式,如需挂账油品交易等信息的账目,请前往收银台挂账
</el-tag>
</div>
2023-11-14 19:00:25 +08:00
<span slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button>
<el-button type="primary" @click="addHangbill"> </el-button>
</span>
</el-dialog>
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
<!-- 新增挂账单位信息-->
<el-dialog title="新增挂账单位" :visible.sync="open1" width="700px" append-to-body>
<el-form ref="formName" :model="form1" :rules="rules1" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="挂账单位" prop="unitName">
<el-input v-model="form1.unitName" show-word-limit placeholder="请输入挂账单位名称" maxlength="50" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="负责人" prop="personCredit">
<el-input v-model="form1.personCredit" show-word-limit placeholder="请输入挂账单位负责人姓名" maxlength="10" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="联系电话" prop="contactMobile">
<el-input v-model="form1.contactMobile" show-word-limit placeholder="请输入挂账单位联系电话" maxlength="15" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="挂账额度" prop="creditLimit">
<el-input v-model="form1.creditLimit" placeholder="请输入挂账额度为0则不限额" maxlength="30">
<template slot="append"></template>
</el-input>
<span style="font-size: 12px;color: grey">
0为不限额,额度为当前单位最大可挂账金额,如已挂账金额归还,额度将也同步返还
</span>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form1.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="单位状态" prop="status">
<el-radio-group v-model="form1.status">
<el-radio label="qy" value="qy">启用</el-radio>
<el-radio label="jy" value="jy">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="open1 = false"> </el-button>
<el-button type="primary" @click="addCredit"> </el-button>
</span>
</el-dialog>
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
<!-- 挂账归还-->
<el-dialog title="挂账归还" :visible.sync="open2" width="700px" append-to-body>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item content-width="100%">
<template slot="label">
挂账单位
</template>
{{ form2.unitName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
挂账人
</template>
{{ form2.personCredit }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
联系电话
</template>
{{ form2.contactMobile }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
挂账金额
</template>
{{ form2.amount }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
未归还金额
</template>
{{ form2.outstandAmount }}
</el-descriptions-item>
</el-descriptions>
<el-form ref="formName" :model="form2" label-width="80px" style="margin-top: 30px">
<el-row>
<el-col :span="24">
<el-form-item label="归还金额" prop="creditLimit">
<el-input v-model="form2.repaidAmount" placeholder="请输入归还金额" maxlength="30">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form2.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="归还方式" prop="payType">
2023-11-22 18:10:36 +08:00
<!-- <el-radio-group v-model="form2.payType"-->
<!-- @click="returnMethod">-->
<!-- <el-radio v-for="item in payList"-->
<!-- :key="item.dictValue"-->
<!-- :value="item.dictValue"-->
<!-- :label="item.dictValue" border>{{ item.dictLabel }}</el-radio>-->
<!-- </el-radio-group>-->
<el-radio v-model="payType" v-for="item in payList"
:key="item.dictValue" :value="item.dictValue"
2023-12-28 17:31:50 +08:00
v-if="item.dictValue!='APPLET_CODE'"
2023-11-22 18:10:36 +08:00
:label="item.dictValue"
@input="returnMethod"
border>{{ item.dictLabel }}</el-radio>
2023-11-14 19:00:25 +08:00
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="open2 = false"> </el-button>
<el-button type="primary" @click="submitReturn">确认归还</el-button>
</span>
</el-dialog>
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
<!-- 立即结算-->
<el-dialog
:title="title"
:visible.sync="dialogVisiblej"
width="30%"
:close-on-click-modal="false">
<div v-if="isPay == true"
v-loading="loading">
<div style="text-align: center;font-size: 15px;font-weight: bold">付款金额</div>
<div style="text-align: center;font-size: 30px;font-weight: bold;color: red;margin: 10px 0">
2023-11-15 18:48:07 +08:00
{{ payAmount }}
2023-11-14 19:00:25 +08:00
</div>
<div style="text-align: center;color: grey;font-size: 14px;margin: 20px 0">请自行核实归还金额,提交完成后将自动处理</div>
2023-11-22 18:10:36 +08:00
<div v-if="payType != 'CASH'">
<div>
<el-input v-model="authCode"
2023-11-27 18:28:41 +08:00
v-focus
2023-11-22 18:10:36 +08:00
autofocus="autofocus"
@keydown.enter.native="collection"
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<i
slot="suffix">
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
</i>
</el-input>
</div>
<div class="demo-image">
<div class="block" style="text-align: center">
<el-image
style="width: 200px; height: 200px"
fit="cover"
src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image>
</div>
</div>
2023-11-14 19:00:25 +08:00
</div>
2023-11-22 18:10:36 +08:00
<div v-else>
<div>
<el-input v-model="authCode"
2023-11-27 18:28:41 +08:00
v-focus
2023-11-22 18:10:36 +08:00
autofocus="autofocus"
@input="changeSeekZero"
@keydown.enter.native="collection"
placeholder="请输入收款金额">
</el-input>
</div>
<div style="text-align: right;margin: 10px 0">
<span>应找零</span>
<span style="color: red;font-size: 18px"> {{ seekZero }}</span>
2023-11-14 19:00:25 +08:00
</div>
</div>
<el-divider></el-divider>
<span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around">
<el-button @click="dialogVisiblej = false" class="but"> </el-button>
<el-button type="primary" class="but" @click="collection"> </el-button>
</span>
</div>
<div v-else>
<div v-if="isPaySuccess">
<el-result icon="success" title="收款成功">
<template slot="extra">
<el-button type="primary" @click="handClose"> </el-button>
</template>
</el-result>
</div>
<div v-else>
<el-result icon="error" title="支付失败,请重新支付">
<template slot="extra">
<el-button type="primary" @click="handClose"> </el-button>
</template>
</el-result>
</div>
</div>
</el-dialog>
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
<!-- 批量挂账归还-->
<el-dialog title="批量挂账归还" :visible.sync="open3" append-to-body>
<el-form ref="form3" :model="form3">
<el-form-item>
2024-01-12 13:55:40 +08:00
<el-input placeholder="请输入挂账单位、挂账人、挂账人手机号检索"
v-model="unitName"
@keyup.enter.native="getRepayList"
clearable class="input-with-select">
2023-11-14 19:00:25 +08:00
<el-button slot="append" icon="el-icon-search" @click="getRepayList">查询</el-button>
</el-input>
</el-form-item>
</el-form>
<div>
<el-table
ref="multipleTable"
:data="repayList"
tooltip-effect="dark"
height="300"
style="width: 100%"
@selection-change="handleSelectionChange">
2024-01-12 13:55:40 +08:00
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="单据号" prop="orderNo" width="120"></el-table-column>
2023-11-14 19:00:25 +08:00
<el-table-column label="挂账方详情">
2024-01-12 13:55:40 +08:00
<el-table-column prop="unitName" label="单位"></el-table-column>
<el-table-column prop="personCredit" label="姓名"></el-table-column>
<el-table-column prop="contactMobile" label="电话"></el-table-column>
2023-11-14 19:00:25 +08:00
</el-table-column>
2024-01-12 13:55:40 +08:00
<el-table-column prop="amount" label="挂账金额"></el-table-column>
<el-table-column prop="outstandAmount" label="未归还金额"></el-table-column>
2023-11-14 19:00:25 +08:00
<el-table-column
prop="repaidAmount"
label="归还金额"
width="120">
<template slot-scope="scope">
<el-input-number size="mini" style="width: 100px"
2023-11-15 18:48:07 +08:00
v-model="scope.row.repaidAmount"
:min="0" :max="scope.row.repaidAmount"
@change="handleChange(scope.row)"></el-input-number>
2023-11-14 19:00:25 +08:00
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-box">
<el-pagination
background
layout="prev, pager, next"
:total="total1"
:page.sync="queryParam.page"
:limit.sync="queryParam.pageSize"
2024-01-12 13:55:40 +08:00
@current-change="getLists">
2023-11-14 19:00:25 +08:00
</el-pagination>
</div>
2023-11-15 18:48:07 +08:00
<div style="display: flex;height: 36px">
<span style="width: 35%;font-size: 17px;line-height: 36px">挂账金额{{ amount }}</span>
<span style="width: 35%;font-size: 17px;line-height: 36px">未归还金额{{ outstandAmount }}</span>
<el-input v-model="repaidAmount" readonly style="width: 55%">
<template slot="prepend">归还金额</template>
<template slot="append"></template>
</el-input>
</div>
2023-11-14 19:00:25 +08:00
<span slot="footer" class="dialog-footer">
<el-button @click="open3 = false"> </el-button>
2024-01-12 13:55:40 +08:00
<el-button :disabled="amount==0" type="primary" @click="batchSub"> </el-button>
2023-11-15 18:48:07 +08:00
</span>
</el-dialog>
<!-- 批量挂账归还-->
<el-dialog title="挂账归还" :visible.sync="open4" width="700px" append-to-body>
<el-form ref="formName" :model="form4" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="归还金额" prop="creditLimit">
<el-input v-model="form4.repaidAmount" placeholder="请输入归还金额" maxlength="30">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注信息" prop="remark">
<el-input v-model="form4.remark" type="textarea" placeholder="请输入内容"></el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item label="归还方式" prop="payType">
2023-11-22 18:10:36 +08:00
<el-radio-group v-model="form4.payType"
@input="changePayType">
2023-11-15 18:48:07 +08:00
<el-radio v-for="item in payList"
:key="item.dictValue"
2024-01-12 13:55:40 +08:00
v-if="item.dictValue!='APPLET_CODE'"
2023-11-15 18:48:07 +08:00
:value="item.dictValue"
:label="item.dictValue" border>{{ item.dictLabel }}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="open4 = false"> </el-button>
<el-button type="primary" @click="submitReturn1">确认归还</el-button>
2023-11-14 19:00:25 +08:00
</span>
</el-dialog>
</div>
2023-10-27 16:31:27 +08:00
</template>
<script>
2023-11-15 18:48:07 +08:00
import {
addHangBill,
batchHangBill,
editHangBill,
hangBillInfo,
hangBills,
listHangBill,
queryHangBill
} from "@/api/cashier/hangbill";
2023-11-14 19:00:25 +08:00
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
import {getDicts} from "@/api/dict/data";
2023-11-23 18:37:40 +08:00
import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/cashier/returnrecord";
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
export default {
name: "credit",
data(){
return{
2023-11-15 18:48:07 +08:00
// 挂账金额
amount:0,
// 未归还金额
outstandAmount:0,
// 归还金额
repaidAmount:0,
// 付款金额
payAmount:0,
2023-11-22 18:10:36 +08:00
// 找零金额
seekZero:0,
2023-11-15 18:48:07 +08:00
authCode:"",
2023-11-14 19:00:25 +08:00
list:[],
// 选中表格数据
repayList:[],
2023-11-15 18:48:07 +08:00
tableList:[],
2023-11-14 19:00:25 +08:00
isPay:true,
isPaySuccess:false,
loading: false,
2023-11-23 18:37:40 +08:00
drawer: false,
2023-11-14 19:00:25 +08:00
// 弹出框标题
title:'',
// 支付方式列表
payList:[],
unit:'',
// 挂账单位列表
unitList:[],
2023-11-22 18:10:36 +08:00
// 付款方式
payType:"WECHAT",
2023-11-14 19:00:25 +08:00
form:{},
form1:{
unitName:"",
personCredit:"",
contactMobile:"",
creditLimit:0,
remark:'',
status:'qy',
},
2023-11-15 18:48:07 +08:00
form2:{payType:"WECHAT"},
2023-11-14 19:00:25 +08:00
form3:{},
2023-11-15 18:48:07 +08:00
form4:{payType:"WECHAT"},
2023-11-23 18:37:40 +08:00
// 挂账信息
record:{},
2023-11-14 19:00:25 +08:00
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
},
queryParam: {
page: 1,
pageSize: 10,
},
2023-11-23 18:37:40 +08:00
queryParams1: {
page: 1,
pageSize: 10,
hangBillId:"",
},
2023-11-14 19:00:25 +08:00
// 日期范围
dateRange: [],
// 挂账记录列表
hangBillList:[],
2023-11-23 18:37:40 +08:00
// 归还记录列表
returnRecordList:[],
2023-11-14 19:00:25 +08:00
// 总条数
total: 0,
total1: 0,
2023-11-23 18:37:40 +08:00
total2: 0,
2023-11-14 19:00:25 +08:00
// 是否开启提示框
open:false,
open1:false,
open2:false,
open3:false,
2023-11-15 18:48:07 +08:00
open4:false,
2023-11-14 19:00:25 +08:00
dialogVisiblej:false,
2023-11-15 18:48:07 +08:00
// 是否查询支付成功信息
isQuery:true,
// 是否是批量归还
isBatch:false,
timer:"",
unitName:"",
2023-11-23 18:37:40 +08:00
orderNo:"",
2023-11-14 19:00:25 +08:00
// 表单校验
rules: {
unitName: [ { required: true, message: "请选择挂账单位", trigger: "blur" }, ],
amount: [{ required: true, message: "请输入挂账金额", trigger: "blur" }],
},
rules1: {
unitName: [ { required: true, message: "请填写挂账单位名称", trigger: "blur" }, ],
personCredit: [{ required: true, message: "请填写挂账单位负责人姓名", trigger: "blur" }],
contactMobile: [ { required: true, message: "请填写挂账单位联系电话", trigger: "blur" }, ],
creditLimit: [ { required: true, message: "请填写挂账额度", trigger: "blur" }, ],
status: [ { required: true, message: "请选择挂账单位状态", trigger: "blur" }, ],
},
2023-10-27 16:31:27 +08:00
2023-11-14 19:00:25 +08:00
// labelPosition: 'right',
// formLabelAlign: {
// name: '',
// },
// tableData: [{
// date: '2016-05-03',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-02',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-04',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-01',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-08',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-06',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }, {
// date: '2016-05-07',
// name: '王小虎',
// province: '上海',
// city: '普陀区',
// address: '上海市普陀区金沙江路 1518 弄',
// zip: 200333
// }]
}
},
created() {
this.getList();
this.getUnitList();
this.getPayList();
this.getLists();
},
2023-11-27 18:28:41 +08:00
directives: {
// 注册一个局部的自定义指令 v-focus
focus: {
// 指令的定义
inserted: function (el) {
// 聚焦元素
el.querySelector('input').focus()
// this.$nextTick( () =>{
// this.$refs.getFocus.focus()
// })
},
},
},
2023-11-14 19:00:25 +08:00
methods:{
2023-11-23 18:37:40 +08:00
getPayMeth(list,val){
let name = "";
if (list!=null && list!=""){
list.forEach(item => {
if (item.dictValue == val){
name = item.dictLabel
}
})
}
return name;
},
// 是否关闭弹框
handleClose(done) {
done();
},
// 归还记录详情弹框
returnRecord(id){
this.record = {}
this.drawer = true
hangBillInfo(id).then(response => {
this.record = response.data
})
this.getRecordList(id,1);
},
getRecordList(id,val){
if (val!=1){
this.queryParams1.page = id
this.queryParams1.hangBillId = this.record.id
}else {
this.queryParams1.hangBillId = id
}
listReturnRecord(this.queryParams1).then(response => {
this.returnRecordList = response.data.records
this.total2 = response.data.total
})
},
2023-11-22 18:10:36 +08:00
changePayType(val){
this.payType = val
},
// 归还方式
returnMethod(val){
this.form2.payType = val
},
// 计算找零金额
changeSeekZero(){
2023-11-23 18:37:40 +08:00
this.seekZero = (this.authCode - this.payAmount).toFixed(2)
2023-11-22 18:10:36 +08:00
},
2023-11-15 18:48:07 +08:00
batchSub(){
this.form4.list = JSON.stringify(this.tableList);
this.form4.repaidAmount = this.repaidAmount;
2023-11-23 18:37:40 +08:00
this.form4.payType = "WECHAT"
2023-11-15 18:48:07 +08:00
this.open4 = true;
},
batchReturn(){
this.open3 = true
this.repayList = [];
this.unitName = ""
2023-11-23 18:37:40 +08:00
this.getLists();
2023-11-15 18:48:07 +08:00
},
2023-11-14 19:00:25 +08:00
getRepayList(){
let result = [];
2023-11-15 18:48:07 +08:00
this.form3.unitName = this.unitName;
2024-01-12 13:55:40 +08:00
let str = this.unitName
2023-11-14 19:00:25 +08:00
this.list.forEach(item => {
2024-01-12 13:55:40 +08:00
if (item.unitName.includes(str)){
item.repaidAmount = item.outstandAmount
result.push(item)
return;
}
if (item.personCredit.includes(str)){
item.repaidAmount = item.outstandAmount
result.push(item)
return;
}
if (item.contactMobile.includes(str)){
item.repaidAmount = item.outstandAmount
result.push(item)
return;
2023-11-14 19:00:25 +08:00
}
})
this.repayList = result
},
getLists(){
hangBills().then(response => {
this.list = response.data;
2024-01-12 13:55:40 +08:00
this.repayList = response.data;
for (let i = 0; i<response.data.length;i++){
this.repayList[i].repaidAmount = response.data[i].outstandAmount
}
2023-11-14 19:00:25 +08:00
})
},
handleChange(value) {
2023-11-15 18:48:07 +08:00
let amount = 0;
let outstandAmount = 0;
let repaidAmount = 0;
this.tableList.forEach(item => {
amount += item.amount;
outstandAmount += item.outstandAmount;
repaidAmount += item.repaidAmount;
})
this.amount = amount
this.outstandAmount = outstandAmount
this.repaidAmount = repaidAmount
2023-11-14 19:00:25 +08:00
},
// 选择表格数据
handleSelectionChange(val) {
2023-11-15 18:48:07 +08:00
let amount = 0;
let outstandAmount = 0;
let repaidAmount = 0;
this.tableList = val;
val.forEach(item => {
amount += item.amount;
outstandAmount += item.outstandAmount;
repaidAmount += item.repaidAmount;
})
this.amount = amount
this.outstandAmount = outstandAmount
this.repaidAmount = repaidAmount
2023-11-14 19:00:25 +08:00
},
handClose(){
2023-11-15 18:48:07 +08:00
this.isPay = true;
this.isPaySuccess = false;
this.dialogVisiblej = false;
this.open2 = false;
this.open4 = false;
2023-11-21 18:18:35 +08:00
this.getList();
2023-11-14 19:00:25 +08:00
},
2023-11-15 18:48:07 +08:00
// 收款
2023-11-25 18:08:20 +08:00
collection(){
2023-11-23 18:37:40 +08:00
if (this.payType=="CASH"){
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
2023-11-25 18:08:20 +08:00
this.$modal.msgError("请输入正确的金额");
2023-11-23 18:37:40 +08:00
return;
}
}
2023-11-15 18:48:07 +08:00
let _this = this;
if (this.isBatch){
2023-11-22 18:10:36 +08:00
// 批量归还
2023-11-15 18:48:07 +08:00
_this.form4.repaidAmount = _this.payAmount;
_this.form4.authCode = _this.authCode;
2023-11-23 18:37:40 +08:00
_this.form4.seekZero = _this.seekZero
2023-11-15 18:48:07 +08:00
batchHangBill(_this.form4).then(response => {
2023-11-23 18:37:40 +08:00
// 返回订单号信息
_this.orderNo = response.data
2023-11-15 18:48:07 +08:00
})
_this.loading = true;
2023-11-23 18:37:40 +08:00
_this.queryPayStatus();
let timer = setInterval(function () {
if (_this.isQuery == false) {
_this.loading = false;
_this.isPay = false;
clearInterval(_this.timer);
}
},1000)
setTimeout(function (){
_this.loading = false;
clearInterval(timer);
},30000)
2023-11-15 18:48:07 +08:00
this.open3 = false;
this.open4 = false;
2023-11-23 18:37:40 +08:00
this.getLists();
this.getList();
2023-11-15 18:48:07 +08:00
}else {
2023-11-22 18:10:36 +08:00
// 单个归还
2023-11-15 18:48:07 +08:00
_this.form2.repaidAmount = _this.payAmount;
_this.form2.authCode = _this.authCode;
2023-11-23 18:37:40 +08:00
_this.form2.seekZero = _this.seekZero
2023-11-15 18:48:07 +08:00
editHangBill(this.form2).then(response => {
2023-11-23 18:37:40 +08:00
// 返回订单号信息
_this.orderNo = response.data
2023-11-15 18:48:07 +08:00
})
_this.loading = true;
_this.queryPayStatus();
let timer = setInterval(function () {
if (_this.isQuery == false) {
_this.loading = false;
_this.isPay = false;
clearInterval(_this.timer);
}
2023-11-22 18:10:36 +08:00
},1000)
2023-11-15 18:48:07 +08:00
setTimeout(function (){
_this.loading = false;
clearInterval(timer);
},30000)
this.open2 = false;
this.getList();
}
},
// 查询支付状态
queryPayStatus(){
let _this = this;
_this.timer = setInterval(function (){
2023-11-23 18:37:40 +08:00
returnRecordByOrderNo({orderNo:_this.orderNo}).then(response => {
response.data.forEach(item => {
if (item.payStatus == "unpaid"){
_this.isQuery = true;
}
if (item.payStatus == "paid"){
_this.isPaySuccess = true;
_this.isQuery = false;
}
if (item.payStatus == "payFail"){
_this.isPaySuccess = false;
_this.isQuery = false;
}
})
2023-11-15 18:48:07 +08:00
})
2023-11-23 18:37:40 +08:00
},1001)
2023-11-14 19:00:25 +08:00
},
submitReturn(){
2023-11-15 18:48:07 +08:00
this.isPay = true;
this.isBatch = false;
this.payAmount = this.form2.repaidAmount;
this.authCode = this.form2.authCode;
2023-11-14 19:00:25 +08:00
if (this.form2.payType!="CASH"){
this.title = "扫码付款";
}else {
this.title = "现金还款";
}
this.dialogVisiblej = true;
},
2023-11-15 18:48:07 +08:00
submitReturn1(){
this.isPay = true;
this.isBatch = true;
2023-11-23 18:37:40 +08:00
this.loading = false;
2023-11-15 18:48:07 +08:00
this.payAmount = this.form4.repaidAmount;
2023-11-23 18:37:40 +08:00
this.authCode = "";
// this.authCode = this.form4.authCode;
2023-11-15 18:48:07 +08:00
if (this.form4.payType!="CASH"){
this.title = "扫码付款";
}else {
this.title = "现金还款";
}
this.dialogVisiblej = true;
},
2023-11-14 19:00:25 +08:00
// 获取支付方式
getPayList() {
getDicts("payment_type").then(response => {
this.payList = response.data;
})
},
// 归还
repay(id){
2023-11-23 18:37:40 +08:00
this.payType = "WECHAT"
2023-11-14 19:00:25 +08:00
hangBillInfo(id).then( response => {
this.open2 = true;
this.form2 = response.data
this.form2.repaidAmount = this.form2.outstandAmount
2023-11-15 18:48:07 +08:00
this.form2.payType = "WECHAT"
2023-11-14 19:00:25 +08:00
})
},
// 显示添加挂账记录对话框
addRecord(){
this.open = true;
// 重置
this.form = {};
this.form1 = {
unitName:"",
personCredit:"",
contactMobile:"",
creditLimit:0,
remark:'',
status:'qy',
}
},
// 添加挂账记录
addHangbill(){
this.$refs["form"].validate((valid) => {
if (valid) {
addHangBill(this.form).then( response => {
this.$modal.msgSuccess("挂账记录添加成功");
this.open = false;
this.getList();
})
}else {
return false;
}
})
},
// 添加挂账单位信息
addCredit(){
this.$refs["formName"].validate((valid) => {
if (valid) {
addCreditUnit(this.form1).then( response => {
this.$modal.msgSuccess("挂账单位信息创建成功");
this.open1 = false;
this.getUnitList();
})
}else {
return false;
}
})
},
// 选择挂账单位
changeUnit(val){
this.form.creditUnitId = val.id;
return val.id
},
querySearch(queryString, cb) {
let _this = this;
let obj = {};
let results = _this.unitList
if (queryString != "" && queryString!=undefined){
results = [];
_this.unitList.forEach(item => {
if (item.unitName.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
if (item.personCredit.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
if (item.contactMobile.includes(queryString)){
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
results.push(obj)
}
})
}
cb(results);
},
// 获取挂账单位列表
getUnitList(){
let obj = {};
let _this = this;
listCreditUnit().then( response => {
response.data.forEach(item => {
obj = item;
obj.value = `${item.unitName}${item.personCredit} ${item.contactMobile}`
_this.unitList.push(obj)
})
})
},
// 获取列表信息
2023-11-23 18:37:40 +08:00
getList(val){
if (val!=undefined){
this.queryParams.page = val
}
2023-11-14 19:00:25 +08:00
listHangBill(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.hangBillList = response.data.records
this.total = response.data.total;
})
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.queryParams.page = 1;
this.resetForm("queryForm");
this.handleQuery();
},
2023-10-27 16:31:27 +08:00
}
2023-11-14 19:00:25 +08:00
}
2023-10-27 16:31:27 +08:00
</script>
<style scoped>
.app-center{
width: 100%;
box-sizing: border-box;
padding: 10px;
}
.clearfix{
width: 100%;
}
.box-card{
width: 100%;
margin-bottom: 15px;
}
.box-gang{
width: 100%;
display: flex;
align-items: center;
}
.box{
width: 200px;
box-sizing: border-box;
padding: 10px;
background: #f9f9f9;
height: 86px;
margin-right: 10px;
}
.size-hui{
font-size: 14px;
margin-bottom: 10px;
margin-top: 10px;
}
.size-bole{
font-weight: bold;
}
.wgang{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.table-box{
width: 100%;
}
.pagination-box{
width: 100%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: center;
}
.top-app-sou{
width: 20%;
}
</style>