123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374 |
- <template>
- <div class="app-container">
- <div v-if="showReconciliation">
- <!-- 筛选条件 -->
- <div>
- <Collapse :screen-form="searchForm">
- <template #right_btn>
- <el-button size="mini" @click="clearFn">清空</el-button>
- <el-button size="mini" type="primary" @click="searchFn">搜索</el-button>
- </template>
- <template #search>
- <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
- <el-row :gutter="20">
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="经销商名称" prop="customerId">
- <el-select
- v-model="searchForm.customerId"
- class="selectStyle"
- placeholder="请选择"
- filterable
- @change="changeFn"
- >
- <el-option v-for="(v, i) in customerList" :key="i" :label="v.name" :value="v.id"> </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="钱包" prop="customerWalletId">
- <el-select
- v-model="searchForm.customerWalletId"
- class="selectStyle"
- placeholder="请选择"
- filterable
- >
- <el-option
- v-for="(v, i) in walletList"
- :key="i"
- :label="v.customerWalletName"
- :value="v.customerWalletId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="单据号" prop="billNo">
- <el-input v-model="searchForm.billNo" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="开始时间" prop="startTime">
- <el-date-picker
- class="selectStyle"
- v-model="searchForm.startTime"
- placeholder="选择日期"
- type="datetime"
- default-time="00:00:00"
- value-format="yyyy-MM-dd HH:mm:ss"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="6">
- <el-form-item label="结束时间" prop="endTime">
- <el-date-picker
- class="selectStyle"
- v-model="searchForm.endTime"
- placeholder="选择日期"
- type="datetime"
- default-time="23:59:59"
- value-format="yyyy-MM-dd HH:mm:ss"
- >
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </template>
- </Collapse>
- </div>
- <!-- 按钮 -->
- <div class="btn-group clearfix">
- <div class="fl">
- <el-button :disabled="dataList.length == 0" type="primary" size="mini" @click="reconciliationFn"
- >一键对账</el-button
- >
- <el-button type="primary" size="mini" @click="recordFn">记录</el-button>
- </div>
- <div class="fr">
- <ExportButton :exUrl="'finance/standing/book/export'" :exParams="exParams" />
- </div>
- </div>
- <!-- 列表 -->
- <div class="mymain-container">
- <div class="table">
- <el-table
- v-loading="listLoading"
- :data="dataList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- show-summary
- :summary-method="getSummaries"
- >
- <el-table-column align="left" label="序号" type="index" width="80" show-overflow-tooltip></el-table-column>
- <el-table-column
- align="left"
- label="月份"
- prop="month"
- min-width="100"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="left"
- label="对账状态"
- prop="isReconciliation"
- min-width="100"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- <el-tag size="mini" type="danger" v-if="scope.row.isReconciliation == false">未对账</el-tag>
- </template>
- </el-table-column>
- <el-table-column align="left" label="客户编码" prop="customerCode" min-width="100" show-overflow-tooltip>
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.customerCode" />
- <span>{{ scope.row.customerCode }}</span>
- </template>
- </el-table-column>
- <el-table-column align="left" label="客户名称" prop="customerName" min-width="260" show-overflow-tooltip>
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.customerName" />
- <span>{{ scope.row.customerName }}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column
- align="left"
- label="部门"
- prop=""
- min-width="160"
- show-overflow-tooltip
- ></el-table-column> -->
- <el-table-column
- align="left"
- label="现金钱包类型"
- prop="walletName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="left"
- label="单据类型"
- prop="billType"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column align="left" label="单据号" prop="billNo" min-width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <CopyButton :copyText="scope.row.billNo" />
- <span>{{ scope.row.billNo }}</span>
- </template>
- </el-table-column>
- <el-table-column
- align="left"
- label="单据日期"
- prop="theTime"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="left"
- label="备注"
- prop="remark"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column align="right" label="收付款金额" prop="amount" min-width="130" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ (scope.row.amountType == 'OUT' ? -scope.row.amount : scope.row.amount) | numToFixed }}
- </template>
- </el-table-column>
- <!-- <el-table-column
- align="center"
- label="发货金额"
- prop=""
- min-width="160"
- show-overflow-tooltip
- ></el-table-column> -->
- </el-table>
- </div>
- <!-- 分页 -->
- <div class="fr">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10, 20, 30, 50]"
- :page-size="10"
- layout="total, sizes, prev, pager, next, jumper"
- :total="listTotal"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- <AccountListDetail v-else />
- </div>
- </template>
- <script>
- import {
- getFinanceStandingBookList,
- getFinanceStandingBookCheck,
- getCustomerList,
- getWalletCustomerList
- } from '@/api/finance/account_list'
- import AccountListDetail from './components/account_list-detail'
- import { numToFixed } from '@/filters'
- export default {
- components: {
- AccountListDetail
- },
- data() {
- return {
- currentPage: 1, // 当前页码
- pageSize: 10, // 每页数量
- listTotal: 0, // 列表总数
- dataList: [], // 列表数据
- searchForm: {
- customerId: '',
- customerWalletId: '',
- billNo: '',
- startTime: '',
- endTime: ''
- }, //搜索表单
- listLoading: false, // 列表加载loading
- showReconciliation: true,
- customerList: [],
- walletList: [],
- isCollapse: true
- }
- },
- computed: {
- exParams() {
- return {
- ...this.searchForm,
- pageSize: this.pageSize,
- pageNum: this.currentPage,
- isReconciliation: false
- }
- }
- },
- created() {
- this.getDataList()
- this.getCustomerDataList({
- pageSize: -1,
- pageNum: 1
- })
- },
- methods: {
- //合计
- getSummaries(param) {
- const { columns, data } = param
- const sums = []
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '合计'
- }
- if (index === 10) {
- let arr = []
- data.forEach(v => {
- if (v.amountType == 'OUT') {
- arr.push(-v.amount)
- } else {
- arr.push(v.amount)
- }
- })
- let a = arr.reduce((prev, curr) => {
- const value = Number(curr)
- if (!isNaN(value)) {
- return prev + curr
- } else {
- return prev
- }
- }, 0)
- sums[index] = numToFixed(a)
- }
- })
- return sums
- },
- //清空
- clearFn() {
- this.$refs.searchForm.resetFields()
- },
- //搜索
- searchFn() {
- this.currentPage = 1
- this.getDataList()
- },
- //改变经销商
- async changeFn(v) {
- this.searchForm.customerWalletId = ''
- let res = await getWalletCustomerList({ customerId: v })
- this.walletList = res.data
- },
- //获取经销商数据
- async getCustomerDataList(data) {
- const res = await getCustomerList(data)
- this.customerList = res.data.records
- },
- //记录
- recordFn() {
- this.showReconciliation = false
- },
- // 更改每页数量
- handleSizeChange(val) {
- this.pageSize = val
- this.currentPage = 1
- this.getDataList()
- },
- // 更改当前页
- handleCurrentChange(val) {
- this.currentPage = val
- this.getDataList()
- },
- //获取列表
- async getDataList() {
- let params = {
- pageNum: this.currentPage,
- pageSize: this.pageSize,
- customerId: this.searchForm.customerId,
- customerWalletId: this.searchForm.customerWalletId,
- billNo: this.searchForm.billNo,
- startTime: this.searchForm.startTime,
- endTime: this.searchForm.endTime,
- isReconciliation: false
- }
- let res = await getFinanceStandingBookList(params)
- // res.data.records.forEach((item) => {
- // item.sums1 = [];
- // item.sums2 = ["amount"];
- // });
- this.dataList = res.data.records
- this.listTotal = res.data.total
- },
- //一键对账
- async reconciliationFn() {
- const res = await getFinanceStandingBookList({
- pageSize: -1,
- pageNum: 1
- })
- let arr = res.data.records
- let ids = arr.map(v => v.id)
- console.log(ids)
- await getFinanceStandingBookCheck({ ids: ids.toString() })
- this.$message.success('对账成功')
- },
- seeFN() {
- this.showDetail = false
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .selectStyle {
- width: 100%;
- }
- </style>
|