1253 lines
45 KiB
Vue
1253 lines
45 KiB
Vue
<template>
|
||
<div class="app-center">
|
||
<!-- 查询-->
|
||
<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>
|
||
<!-- 统计-->
|
||
<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>
|
||
</div>
|
||
|
||
</div>
|
||
</el-card>
|
||
<!-- 挂账列表-->
|
||
<el-card class="box-card">
|
||
<div class="wgang">
|
||
<div>列表</div>
|
||
<div style="display: flex ">
|
||
<el-button type="primary" size="mini" @click="addRecord">新增挂账记录</el-button>
|
||
<el-button type="success" size="mini" @click="batchReturn">批量挂账归还</el-button>
|
||
</div>
|
||
</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>
|
||
<el-table-column prop="orderNo" label="单据号" width="200"></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 label="记录明细">
|
||
<el-table-column prop="returnType" 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" label="金额"> </el-table-column>
|
||
<el-table-column prop="status" 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="outstandAmount" label="未归还金额"> </el-table-column>
|
||
</el-table-column>
|
||
<el-table-column prop="realName" label="操作人"> </el-table-column>
|
||
<el-table-column prop="createTime" 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"-->
|
||
<!-- icon="el-icon-edit"-->
|
||
<!-- >修改</el-button>-->
|
||
<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>
|
||
</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>
|
||
</el-card>
|
||
|
||
<!-- 归还记录信息-->
|
||
<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" 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>
|
||
|
||
<!-- 挂账归还-->
|
||
<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="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.repaidAmount"
|
||
@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>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
addHangBill,
|
||
batchHangBill,
|
||
editHangBill,
|
||
hangBillInfo,
|
||
hangBills,
|
||
listHangBill,
|
||
queryHangBill
|
||
} from "@/api/cashier/hangbill";
|
||
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
|
||
import {getDicts} from "@/api/dict/data";
|
||
import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/cashier/returnrecord";
|
||
|
||
export default {
|
||
name: "credit",
|
||
data(){
|
||
return{
|
||
// 挂账金额
|
||
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:0,
|
||
remark:'',
|
||
status:'qy',
|
||
},
|
||
form2:{payType:"WECHAT"},
|
||
form3:{},
|
||
form4:{payType:"WECHAT"},
|
||
// 挂账信息
|
||
record:{},
|
||
// 查询参数
|
||
queryParams: {
|
||
page: 1,
|
||
pageSize: 10,
|
||
},
|
||
queryParam: {
|
||
page: 1,
|
||
pageSize: 10,
|
||
},
|
||
queryParams1: {
|
||
page: 1,
|
||
pageSize: 10,
|
||
hangBillId:"",
|
||
},
|
||
// 日期范围
|
||
dateRange: [],
|
||
// 挂账记录列表
|
||
hangBillList:[],
|
||
// 归还记录列表
|
||
returnRecordList:[],
|
||
// 总条数
|
||
total: 0,
|
||
total1: 0,
|
||
total2: 0,
|
||
// 是否开启提示框
|
||
open:false,
|
||
open1:false,
|
||
open2:false,
|
||
open3:false,
|
||
open4:false,
|
||
dialogVisiblej: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" }, ],
|
||
},
|
||
|
||
// 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();
|
||
},
|
||
directives: {
|
||
// 注册一个局部的自定义指令 v-focus
|
||
focus: {
|
||
// 指令的定义
|
||
inserted: function (el) {
|
||
// 聚焦元素
|
||
el.querySelector('input').focus()
|
||
// this.$nextTick( () =>{
|
||
// this.$refs.getFocus.focus()
|
||
// })
|
||
},
|
||
},
|
||
},
|
||
methods:{
|
||
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.open4 = true;
|
||
},
|
||
batchReturn(){
|
||
this.open3 = true
|
||
this.repayList = [];
|
||
this.unitName = ""
|
||
this.getLists();
|
||
},
|
||
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(){
|
||
hangBills().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.isPay = true;
|
||
this.isPaySuccess = false;
|
||
this.dialogVisiblej = false;
|
||
this.open2 = false;
|
||
this.open4 = false;
|
||
this.getList();
|
||
},
|
||
// 收款
|
||
collection(){
|
||
if (this.payType=="CASH"){
|
||
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
|
||
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
|
||
batchHangBill(_this.form4).then(response => {
|
||
// 返回订单号信息
|
||
_this.orderNo = response.data
|
||
})
|
||
_this.loading = true;
|
||
_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)
|
||
this.open3 = false;
|
||
this.open4 = false;
|
||
this.getLists();
|
||
this.getList();
|
||
}else {
|
||
// 单个归还
|
||
_this.form2.repaidAmount = _this.payAmount;
|
||
_this.form2.authCode = _this.authCode;
|
||
_this.form2.seekZero = _this.seekZero
|
||
editHangBill(this.form2).then(response => {
|
||
// 返回订单号信息
|
||
_this.orderNo = response.data
|
||
})
|
||
_this.loading = true;
|
||
_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)
|
||
this.open2 = false;
|
||
this.getList();
|
||
}
|
||
},
|
||
// 查询支付状态
|
||
queryPayStatus(){
|
||
let _this = this;
|
||
_this.timer = setInterval(function (){
|
||
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;
|
||
}
|
||
})
|
||
})
|
||
},1001)
|
||
},
|
||
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"
|
||
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) {
|
||
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)
|
||
})
|
||
})
|
||
},
|
||
// 获取列表信息
|
||
getList(val){
|
||
if (val!=undefined){
|
||
this.queryParams.page = val
|
||
}
|
||
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();
|
||
},
|
||
}
|
||
}
|
||
</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>
|