oil-station/fuintCashierWeb/src/views/cashier/NewComponents/credit.vue
DESKTOP-369JRHT\12997 467fb91019 9.27
2024-09-29 15:30:09 +08:00

1706 lines
59 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-center">
<!-- 查询-->
<div class="top_new">
<el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" label-width="80px">
<el-form-item label="" prop="unitName">
<el-input
v-model="queryParams2.unitName"
placeholder="单位名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="personCredit">
<el-input
v-model="queryParams2.personCredit"
placeholder="挂账人"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="contactMobile">
<el-input
v-model="queryParams2.contactMobile"
placeholder="联系电话"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="status">
<el-select
v-model="queryParams2.status"
placeholder="状态"
clearable
style="width: 240px"
>
<el-option label="启用" value="qy"/>
<el-option label="禁用" value="jy"/>
</el-select>
</el-form-item>
<el-form-item label="">
<el-date-picker
v-model="beginTime"
style="width: 160px"
type="date"
placeholder="挂账开始日期">
</el-date-picker>
<el-date-picker
v-model="endTime"
style="width: 160px"
type="date"
placeholder="挂账结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery1">重置</el-button>
<el-button type="primary" size="mini" @click="addUnit">新增挂账单位</el-button>
</el-form-item>
</el-form>
</div>
<!-- 统计-->
<div class="top_news">
<div class="box-gang">
<div class="box">
<div class="size-bole">{{ total3 }}</div>
<div class="size-hui">
<div class="nei">挂账单位总数</div>
<div class="icon-img">
<img src="../../../assets/images/cut/组 4666@2x.png" alt="">
</div>
</div>
</div>
<div class="box">
<div class="size-hui"></div>
<div class="size-bole">{{ allCreditLimit || 0 }}</div>
<div class="size-hui">
<div class="nei">预设挂账总额</div>
<div class="icon-img">
<img src="../../../assets/images/cut/组 4666@2x.png" alt="">
</div>
</div>
</div>
<div class="box1">
<div class="size-bole">{{ allUsedCreditLimit || 0 }}</div>
<div class="size-hui">
<div class="nei">已使用挂账总额</div>
<div class="icon-img">
<img src="../../../assets/images/cut/组 5017@2x.png" alt="">
</div>
</div>
</div>
<div class="box1">
<div class="size-bole">{{ allResidueCreditLimit || 0 }}</div>
<div class="size-hui">
<div class="nei">剩余可挂账总额</div>
<div class="icon-img">
<img src="../../../assets/images/cut/组 5017@2x.png" alt="">
</div>
</div>
</div>
</div>
<!-- <div class="box-gang">-->
<!-- <div class="box">-->
<!-- <div class="size-hui">挂账笔数</div>-->
<!-- <div class="size-bole">{{ total3 }}</div>-->
<!-- </div>-->
<!-- <div class="box">-->
<!-- <div class="size-hui">挂账总额</div>-->
<!-- <div class="size-bole">{{ allAmount }}</div>-->
<!-- </div>-->
<!-- <div class="box">-->
<!-- <div class="size-hui">归还笔数</div>-->
<!-- <div class="size-bole">{{ returnTotal }}</div>-->
<!-- </div>-->
<!-- <div class="box">-->
<!-- <div class="size-hui">归还总额</div>-->
<!-- <div class="size-bole">{{ returnAllAmount }}</div>-->
<!-- </div>-->
<!-- <div class="box">-->
<!-- <div class="size-hui">未还金额</div>-->
<!-- <div class="size-bole">{{ noReturnAllAmount }}</div>-->
<!-- </div>-->
<!-- </div>-->
<div class="table-box">
<el-table
:data="creditUnitList"
style="width: 100%">
<el-table-column type="expand" >
<template slot-scope="props">
<el-table ref="tables" :data="props.row.hangBillVos">
<el-table-column type="index" width="80" align="center" label="序号"/>
<el-table-column prop="orderNo" align="center" label="单据号" width="220"></el-table-column>
<el-table-column prop="returnType" align="center" label="类型">
<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 prop="amount" align="center" label="金额"> </el-table-column>
<el-table-column prop="status" align="center" label="状态">
<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>
</el-table-column>
<el-table-column prop="repaidAmount" align="center" label="已归还金额"> </el-table-column>
<el-table-column prop="outstandAmount" align="center" label="未归还金额"> </el-table-column>
<el-table-column prop="realName" align="center" label="操作人"> </el-table-column>
<el-table-column prop="createTime" align="center" label="创建时间" width="220">
<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"
:disabled="scope.row.status == 1"
@click="repay(scope.row.id)"
>归还</el-button>
<el-button
size="mini"
type="text"
@click="returnRecord(scope.row.id)"
>归还详情</el-button>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="单位名称" prop="unitName" align="center"/>
<el-table-column label="挂账人" prop="personCredit" align="center"/>
<el-table-column label="联系电话" prop="contactMobile" align="center" width="110"/>
<el-table-column label="预设挂账额度" prop="creditLimit" align="center" width="100"/>
<el-table-column label="已使用挂账额度" prop="usedCreditLimit" align="center" width="115"/>
<el-table-column label="剩余可挂账额度" prop="residueCreditLimit" align="center" width="115"/>
<el-table-column label="操作人" prop="staffName" align="center"/>
<el-table-column label="挂账订单总数" prop="hangBillTotal" align="center" width="110"/>
<el-table-column label="挂账总金额" prop="hangBillAmount" align="center"/>
<el-table-column label="归还笔数" prop="returnTotal" align="center"/>
<el-table-column label="归还总金额" prop="returnAmount" align="center"/>
<el-table-column label="未归还笔数" prop="noReturnTotal" align="center"/>
<el-table-column label="未归还总额" prop="noReturnAmount" align="center"/>
<el-table-column label="备注" prop="remark" align="center">
<template slot-scope="scope">
<span>{{scope.row.remark || "--"}}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
<el-tag type="info" v-if="scope.row.status=='jy'">禁用</el-tag>
<!-- <dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>-->
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" width="150" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160" fixed='right'>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="batchReturn(scope.row)"
>归还</el-button>
</template>
</el-table-column>
</el-table>
</div>
<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>
</div>
<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>
<!-- 新增挂账记录-->
<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>
<div>
<el-tag style="width: 100%;height: 40px;line-height: 40px;padding-left: 30px" type="info">
当前挂账为普通挂账方式,如需挂账油品交易等信息的账目,请前往收银台挂账
</el-tag>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="open = false">取 消</el-button>
<el-button type="primary" @click="addHangbill">确 定</el-button>
</span>
</el-dialog>
<!-- 新增挂账单位信息-->
<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" @input="changeCreditAmount" placeholder="请输入预设挂账额度" maxlength="10">
<template slot="append">元</template>
</el-input>
<span style="font-size: 12px;color: grey">
额度为当前单位最大可挂账金额,如已挂账金额归还,额度将也同步返还
</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="已使用挂账额度" prop="creditLimit">
<el-input v-model="form1.usedCreditLimit" disabled placeholder="0" maxlength="10">
<template slot="append">元</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="剩余挂账额度" prop="creditLimit">
<el-input v-model="form1.residueCreditLimit" disabled placeholder="0" maxlength="10">
<template slot="append">元</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="挂账负责人" prop="staffId">
<el-select v-model="form1.staffId" filterable placeholder="请选择油站挂账负责人">
<el-option
v-for="item in staffList"
:key="item.id"
:label="item.realName"
:value="item.id">
</el-option>
</el-select>
</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>
<!-- 挂账归还-->
<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">
<!-- <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"
v-if="item.dictValue!='APPLET_CODE'"
:label="item.dictValue"
@input="returnMethod"
border>{{ item.dictLabel }}</el-radio>
</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>
<!-- 立即结算-->
<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">
¥{{ payAmount }}
</div>
<div style="text-align: center;color: grey;font-size: 14px;margin: 20px 0">请自行核实归还金额,提交完成后将自动处理</div>
<div v-if="payType != 'CASH'">
<div>
<el-input v-model="authCode"
v-focus
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>
</div>
<div v-else>
<div>
<el-input v-model="authCode"
v-focus
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>
</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>
<!-- 立即结算-->
<el-dialog
title="扫码支付"
:visible.sync="dialogVisiblejLoading"
width="30%"
:close-on-click-modal="false">
<div>
<el-result icon="info" title="支付状态未查询成功,请移至订单查看">
<template slot="extra">
<el-button type="primary" @click="handClose">关 闭</el-button>
</template>
</el-result>
</div>
</el-dialog>
<!-- 批量挂账归还-->
<el-dialog title="批量挂账归还" :visible.sync="open3" append-to-body>
<!-- <el-form ref="form3" :model="form3">-->
<!-- <el-form-item>-->
<!-- <el-input placeholder="请输入挂账单位、挂账人、挂账人手机号检索"-->
<!-- v-model="unitName"-->
<!-- @keyup.enter.native="getRepayList"-->
<!-- clearable class="input-with-select">-->
<!-- <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">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="单据号" prop="orderNo" width="120"></el-table-column>
<el-table-column label="挂账方详情">
<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>
</el-table-column>
<el-table-column prop="amount" label="挂账金额"></el-table-column>
<el-table-column prop="outstandAmount" label="未归还金额"></el-table-column>
<el-table-column
prop="repaidAmount"
label="归还金额"
width="120">
<template slot-scope="scope">
<el-input-number size="mini" style="width: 100px"
v-model="scope.row.repaidAmount"
:min="0" :max="scope.row.amount"
@change="handleChange(scope.row)">
</el-input-number>
</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">
<!-- @current-change="getLists">-->
</el-pagination>
</div>
<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>
<span slot="footer" class="dialog-footer">
<el-button @click="open3 = false">取 消</el-button>
<el-button :disabled="amount==0" type="primary" @click="batchSub">确 定</el-button>
</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">
<el-radio-group v-model="form4.payType"
@input="changePayType">
<el-radio v-for="item in payList"
:key="item.dictValue"
v-if="item.dictValue!='APPLET_CODE'"
: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>
</span>
</el-dialog>
<!-- 支付成功后小票打印内容-->
<div id="reportSuccess" ref="report" class="box-center" v-show="false">
<div class="box-title">订单统计</div>
<div class="box-ge" v-if="isBatch">
<div class="input-box">
<div>挂账单位</div>
<div>{{ repayList[0].unitName }}</div>
</div>
<div class="input-box">
<div>挂账金额</div>
<div>¥{{ amount }}</div>
</div>
<div class="input-box">
<div>归还金额</div>
<div>¥{{ repaidAmount }}</div>
</div>
<!-- <div class="input-box">-->
<!-- <div>未归还金额</div>-->
<!-- <div>¥{{ outstandAmount }}</div>-->
<!-- </div>-->
<div class="input-box">
<div>支付方式</div>
<div v-if="payType == 'CASH'">现金</div>
<div v-else-if="payType == 'WECHAT'">微信</div>
<div v-else-if="payType == 'ALIPAY'">支付宝</div>
<div v-else-if="payType == 'UNIONPAY'">银联二维码</div>
</div>
<div class="input-box" v-if="seekZero>0">
<div>找零金额</div>
<div>¥{{ seekZero }}</div>
</div>
</div>
<div class="box-ge" v-else>
<div class="input-box">
<div>挂账单位</div>
<div>{{ form2.unitName }}</div>
</div>
<div class="input-box">
<div>挂账金额</div>
<div>¥{{ form2.amount }}</div>
</div>
<div class="input-box">
<div>归还金额</div>
<div>¥{{ form2.repaidAmount }}</div>
</div>
<!-- <div class="input-box">-->
<!-- <div>未归还金额</div>-->
<!-- <div>¥{{ form2.outstandAmount }}</div>-->
<!-- </div>-->
<div class="input-box">
<div>支付方式</div>
<div v-if="payType == 'CASH'">现金</div>
<div v-else-if="payType == 'WECHAT'">微信</div>
<div v-else-if="payType == 'ALIPAY'">支付宝</div>
<div v-else-if="payType == 'UNIONPAY'">银联二维码</div>
</div>
<div class="input-box" v-if="seekZero>0">
<div>找零金额</div>
<div>{{ seekZero }}</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {
addHangBill,
batchHangBill,
editHangBill, hangBillAllAmount, hangBillAllNoReturnAmount, hangBillAllReturnAmount,
hangBillInfo, hangBillReturnTotal,
hangBills,
listHangBill,
queryHangBill
} from "@/api/cashier/hangbill";
import {
addCreditUnit,
creditUnitInfo,
creditUnits, creditUnitsStatistic,
deleteCreditUnit,
editCreditUnit,
listCreditUnit
} from "@/api/cashier/creditunit";
import {getDicts} from "@/api/dict/data";
import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/cashier/returnrecord";
import {queryStaffs} from "@/api/staff/staff";
import {getLodop} from "@/api/LodopFuncs";
export default {
name: "credit",
data(){
return{
staffList:[],
// 归还账单总数
returnTotal:0,
// 预设挂账总额
allCreditLimit:0,
// 已使用挂账总额
allUsedCreditLimit:0,
// 剩余可挂账总额
allResidueCreditLimit:0,
// 挂账总额
allAmount:0,
// 归还总额
returnAllAmount:0,
// 未归还总额
noReturnAllAmount:0,
// 挂账金额
amount:0,
// 未归还金额
outstandAmount:0,
// 归还金额
repaidAmount:0,
// 付款金额
payAmount:0,
// 找零金额
seekZero:0,
authCode:"",
list:[],
// 选中表格数据
repayList:[],
tableList:[],
isPay:true,
isPaySuccess:false,
loading: false,
drawer: false,
// 弹出框标题
title:'',
// 支付方式列表
payList:[],
unit:'',
// 挂账单位列表
unitList:[],
// 付款方式
payType:"WECHAT",
form:{},
form1:{
unitName:"",
personCredit:"",
contactMobile:"",
creditLimit:"",
usedCreditLimit:0,
residueCreditLimit:0,
remark:'',
status:'qy',
},
form2:{payType:"WECHAT"},
form3:{},
form4:{payType:"WECHAT"},
// 挂账信息
record:{},
// 查询参数
queryParams2:{
page:1,
pageSize: 10,
unitName:"",
personCredit:"",
contactMobile:"",
status:"",
},
queryParams: {
page: 1,
pageSize: 10,
},
queryParam: {
page: 1,
pageSize: 10,
},
queryParams1: {
page: 1,
pageSize: 10,
hangBillId:"",
},
// 日期范围
dateRange: [],
beginTime:"",
endTime:"",
// 挂账记录列表
hangBillList:[],
// 归还记录列表
returnRecordList:[],
// 挂账单位列表
creditUnitList:[],
// 总条数
total: 0,
total1: 0,
total2: 0,
total3: 0,
// 是否开启提示框
open:false,
open1:false,
open2:false,
open3:false,
open4:false,
dialogVisiblej:false,
dialogVisiblejLoading: false,
// 是否查询支付成功信息
isQuery:true,
// 是否是批量归还
isBatch:false,
timer:"",
unitName:"",
orderNo:"",
// 表单校验
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" }, ],
},
}
},
created() {
// this.getList();
// this.getUnitList();
this.getPayList();
// this.getLists();
this.getCreditUnits();
this.getStaffList();
},
directives: {
// 注册一个局部的自定义指令 v-focus
focus: {
// 指令的定义
inserted: function (el) {
// 聚焦元素
el.querySelector('input').focus()
// this.$nextTick( () =>{
// this.$refs.getFocus.focus()
// })
},
},
},
methods:{
async printLocally() {
//初始化打印函数
let LODOP = getLodop(); // 初始化打印
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.box-ge{
border-bottom: 1px solid #000000 ;
box-sizing: border-box;
padding: 10px;
}
.box-title{
font-size: 18px;
text-align: center;
align-items: center;
margin-top: 15px;
}
.input-hui{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
}
.input-hui-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.input-box-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.box-center{
height: 500px;
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
},
getStaffList(){
queryStaffs().then(res => {
this.staffList = res.data
})
},
// 搜索按钮操作
handleQuery1() {
this.queryParams.page = 1;
this.getCreditUnits();
},
// 重置按钮操作
resetQuery1() {
this.resetForm("queryForm");
this.dateRange = []
this.beginTime = ""
this.endTime = ""
this.handleQuery1();
},
changeCreditAmount(){
if (!this.form1.id) {
this.form1.usedCreditLimit = 0
this.form1.residueCreditLimit = this.form1.creditLimit
}else {
this.form1.residueCreditLimit = this.form1.creditLimit - this.form1.usedCreditLimit
}
},
addUnit(){
this.form1 = {}
this.title = "新增挂账单位"
this.open1 = true
},
handleUpdate(data){
creditUnitInfo(data.id).then(res => {
this.form1 = res.data
this.title = "修改挂账单位"
this.open1 = true
})
},
handleDelete(row){
const name = row.unitName
this.$modal.confirm('确定删除"' + name + '"的挂账单位信息?').then(function() {
// return deleteMember(row.id);
return deleteCreditUnit(row.id);
}).then(() => {
this.queryParams.page = 1
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
getCreditUnits(val){
if (val!=undefined){
this.queryParams2.page = val
}
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
creditUnits(this.addDateRange(this.queryParams2, dateRange)).then(res => {
this.creditUnitList = res.data.records
this.total3 = res.data.total;
})
this.getUnitStatistic(val)
},
getUnitStatistic(val){
if (val!=undefined){
this.queryParams2.page = val
}
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
creditUnitsStatistic(this.addDateRange(this.queryParams2, dateRange)).then(res => {
this.allCreditLimit = res.data.allCreditLimit
this.allUsedCreditLimit = res.data.allUsedCreditLimit
this.allResidueCreditLimit = res.data.allResidueCreditLimit
})
},
// 获取挂账统计信息
getStatistic(){
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
hangBillReturnTotal(this.addDateRange(this.queryParams, dateRange)).then(res => {
this.returnTotal = res.data
})
hangBillAllAmount(this.addDateRange(this.queryParams, dateRange)).then(res => {
if (res.data) {
this.allAmount = res.data
}
})
hangBillAllReturnAmount(this.addDateRange(this.queryParams, dateRange)).then(res => {
if (res.data) {
this.returnAllAmount = res.data
}
})
hangBillAllNoReturnAmount(this.addDateRange(this.queryParams, dateRange)).then(res => {
if (res.data) {
this.noReturnAllAmount = res.data
}
})
},
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
})
},
changePayType(val){
this.payType = val
},
// 归还方式
returnMethod(val){
this.form2.payType = val
},
// 计算找零金额
changeSeekZero(){
this.seekZero = (this.authCode - this.payAmount).toFixed(2)
},
batchSub(){
this.form4.list = JSON.stringify(this.tableList);
this.form4.repaidAmount = this.repaidAmount;
this.form4.payType = "WECHAT"
this.payType = "WECHAT"
this.seekZero = 0
this.open4 = true;
},
batchReturn(data){
this.open3 = true
this.repayList = [];
this.unitName = ""
this.getLists(data.id);
},
getRepayList(){
let result = [];
this.form3.unitName = this.unitName;
let str = this.unitName
this.list.forEach(item => {
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;
}
})
this.repayList = result
},
getLists(id){
hangBills({creditUnitId:id}).then(response => {
this.list = response.data;
this.repayList = response.data;
for (let i = 0; i<response.data.length;i++){
this.repayList[i].repaidAmount = response.data[i].outstandAmount
}
})
},
handleChange(value) {
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
},
// 选择表格数据
handleSelectionChange(val) {
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
},
handClose(){
this.dialogVisiblejLoading = false
this.isPay = true;
this.isPaySuccess = false;
this.dialogVisiblej = false;
this.open2 = false;
this.open4 = false;
this.getList();
},
// 收款
async collection(){
if (this.payType=="CASH"){
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
this.$modal.msgError("请输入正确的金额");
return;
}
}
if (!this.authCode){
this.$modal.msgError("请先扫码");
return;
}
let _this = this;
if (this.isBatch){
// 批量归还
_this.form4.repaidAmount = _this.payAmount;
_this.form4.authCode = _this.authCode;
_this.form4.seekZero = _this.seekZero
await batchHangBill(_this.form4).then(response => {
// 返回订单号信息
_this.orderNo = response.data
})
_this.loading = true;
_this.queryPayStatus();
this.open3 = false;
this.open4 = false;
// this.getLists();
// this.getList();
this.getCreditUnits();
}else {
// 单个归还
_this.form2.repaidAmount = _this.payAmount;
_this.form2.authCode = _this.authCode;
_this.form2.seekZero = _this.seekZero
await editHangBill(this.form2).then(response => {
// 返回订单号信息
_this.orderNo = response.data
})
_this.loading = true;
_this.queryPayStatus();
this.open2 = false;
// this.getList();
this.getCreditUnits();
}
},
// 查询支付状态
queryPayStatus(){
let _this = this;
_this.loading = true;
let timer = setInterval(function (){
returnRecordByOrderNo({orderNo:_this.orderNo}).then(response => {
response.data.forEach(item => {
if (item.payStatus == "unpaid"){
_this.isQuery = true;
_this.dialogVisiblejLoading = true
}
if (item.payStatus == "paid"){
_this.isPaySuccess = true;
_this.isPay = false;
_this.isQuery = false;
_this.loading = false;
_this.printLocally()
clearInterval(timer);
}
if (item.payStatus == "payFail"){
_this.isPaySuccess = false;
_this.isPay = false;
_this.isQuery = false;
_this.loading = false;
clearInterval(timer);
}
})
})
},500)
let timer2 = setInterval(function () {
if (_this.isBatch) {
if (_this.isQuery || !_this.open3 || !_this.open4){
// _this.loading = false;
// _this.isPay = false;
clearInterval(timer);
clearTimeout(timer3);
}
}else {
if (_this.isQuery || !_this.open2) {
// _this.loading = false;
// _this.isPay = false;
clearInterval(timer);
clearTimeout(timer3);
}
}
}, 500)
var timer3 = setTimeout(function () {
clearInterval(timer2);
clearInterval(timer);
_this.loading = false;
_this.isPay = false;
this.isPaySuccess = false;
}, 10000)
},
submitReturn(){
this.isPay = true;
this.isBatch = false;
this.payAmount = this.form2.repaidAmount;
this.authCode = this.form2.authCode;
if (this.form2.payType!="CASH"){
this.title = "扫码付款";
}else {
this.title = "现金还款";
}
this.dialogVisiblej = true;
},
submitReturn1(){
this.isPay = true;
this.isBatch = true;
this.loading = false;
this.payAmount = this.form4.repaidAmount;
this.authCode = "";
// this.authCode = this.form4.authCode;
if (this.form4.payType!="CASH"){
this.title = "扫码付款";
}else {
this.title = "现金还款";
}
this.dialogVisiblej = true;
},
// 获取支付方式
getPayList() {
getDicts("payment_type").then(response => {
this.payList = response.data;
})
},
// 归还
repay(id){
this.payType = "WECHAT"
this.seekZero = 0
hangBillInfo(id).then( response => {
this.open2 = true;
this.form2 = response.data
this.form2.repaidAmount = this.form2.outstandAmount
this.form2.payType = "WECHAT"
})
},
// 显示添加挂账记录对话框
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) {
if (this.form1.id){
if (this.form1.creditLimit < this.form1.usedCreditLimit || this.form1.residueCreditLimit < 0){
this.$modal.msgError("请确保预设挂账额度大于已使用挂账额度");
return ;
}
editCreditUnit(this.form1).then(res => {
if (res.data==1) {
this.$modal.msgSuccess("挂账单位信息修改成功");
this.open1 = false;
this.getCreditUnits();
}else {
this.$modal.msgError("挂账单位信息修改失败");
}
})
}else {
addCreditUnit(this.form1).then( response => {
if (response.data==1) {
this.$modal.msgSuccess("挂账单位信息创建成功");
this.open1 = false;
this.getCreditUnits();
}else {
this.$modal.msgError("挂账单位信息创建失败,挂站单位名称不可重复");
}
})
}
}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)
})
})
},
// 获取列表信息
getList(val){
if (val!=undefined){
this.queryParams.page = val
}
let dateRange = []
if (this.beginTime && this.endTime) {
dateRange.push(this.beginTime.toLocaleDateString())
dateRange.push(this.endTime.toLocaleDateString())
}
listHangBill(this.addDateRange(this.queryParams, dateRange)).then( response => {
this.hangBillList = response.data.records
this.total = response.data.total;
})
this.getStatistic();
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.queryParams.page = 1;
this.beginTime = ""
this.endTime = ""
this.resetForm("queryForm");
this.handleQuery();
},
}
}
</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{
//box-sizing: border-box;
padding: 5px;
//background: #f9f9f9;
margin-right: 20px;
margin-bottom: 20px;
padding-left: 20px;
width: 211px;
height: 60px;
background: rgba(64,158,255,0.05);
border-radius: 6px 6px 6px 6px;
border: 1px solid #fe8c4a;
}
.el-form--inline .el-form-item {
margin-right: 25px !important;
}
.size-hui{
display: flex;
align-items: center;
//width: 200px;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 13px;
color: #888888;
//line-height: 0px;
text-align: left;
font-style: normal;
text-transform: none;
.nei {
width: 200px;
}
}
.size-bole{
//font-weight: bold;
//width: 53px;
height: 31px;
font-family: YouSheBiaoTiHei;
font-weight: 400;
font-size: 24px;
color: #555555;
//line-height: 0px;
text-align: left;
font-style: normal;
text-transform: none;
}
.icon-img{
//margin-left: 110px;
width: 100%;
height: 20px;
margin-right: 5px;
img{
float: right;
//width: 100%;
width: 20px;
height: 100%;
}
}
.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%;
}
.box1{
padding: 5px;
margin-right: 20px;
margin-bottom: 20px;
padding-left: 20px;
width: 211px;
height: 60px;
background: rgba(255,150,85,0.05);
border-radius: 6px 6px 6px 6px;
border: 1px solid #FF9655;
}
.top_new{
display: flex;
justify-content: space-between;
background: #fff;
width: 98%;
margin: 10px auto;
border-radius: 8px;
box-sizing: border-box;
padding: 15px;
margin-bottom: 10px;
}
.top_news{
background: #fff;
width: 98%;
margin: 10px auto;
border-radius: 8px;
box-sizing: border-box;
padding: 15px;
margin-bottom: 10px;
}
</style>