挂账添加

This commit is contained in:
GaoHao 2024-11-25 16:23:03 +08:00
parent b9663206f3
commit d52a755338
6 changed files with 260 additions and 204 deletions

View File

@ -4,7 +4,7 @@ import request from '@/utils/request'
* 获取挂账列表 * 获取挂账列表
* @returns * @returns
*/ */
export function getTbShopCoupon(params) { export function getCreditBuyerList(params) {
return request({ return request({
url: '/api/credit/buyer/page', url: '/api/credit/buyer/page',
method: 'get', method: 'get',
@ -15,12 +15,12 @@ export function getTbShopCoupon(params) {
} }
/** /**
* 获取优惠券详情 * 获取挂账详情
* @returns * @returns
*/ */
export function getTbShopCouponInfo(id) { export function getCreditBuyerInfo(id) {
return request({ return request({
url: '/api/tbShopCoupon/' + id, url: '/api/credit/buyer/' + id,
method: 'get', method: 'get',
params: {} params: {}
}) })
@ -38,6 +38,30 @@ export function addCreditBuyer(data) {
}) })
} }
/**
* 还款
* @returns
*/
export function creditRePayment(data) {
return request({
url: '/api/credit/buyer/repayment',
method: 'post',
data
})
}
/**
* 获取还款记录
* @returns
*/
export function creditRePaymentRecord(params) {
return request({
url: '/api/credit/payment-record/page',
method: 'get',
params
})
}
/** /**
* 删除挂账人 * 删除挂账人
* @returns * @returns
@ -50,27 +74,37 @@ export function delCreditBuyer(id) {
} }
/** /**
* 获取领取列表 * 挂账人-查看明细
* @returns * @returns
*/ */
export function queryReceive(params) { export function creditBuyerOrderList(params) {
return request({ return request({
url: '/api/tbShopCoupon/queryReceive', url: '/api/credit/buyer-order/page',
method: 'post', method: 'get',
data: { params
...params
}
}) })
} }
/** /**
* 获取领取列表 * 挂账人-查看明细-统计
* @returns * @returns
*/ */
export function delReceive(params) { export function creditBuyerOrderSummary(params) {
return request({ return request({
url: '/api/tbShopCoupon/receive', url: '/api/credit/buyer-order/summary',
method: 'delete', method: 'get',
data: params params
})
}
/**
* 挂账人-查看明细-付款
* @returns
*/
export function creditPayment(data) {
return request({
url: '/api/credit/buyer-order/pay',
method: 'post',
data
}) })
} }

View File

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<el-dialog title="账单还款记录" :visible.sync="dialogVisible" width="70%" @close="reset"> <el-dialog title="账单还款记录" :visible.sync="dialogVisible" :close-on-click-modal="false" width="70%" @close="reset">
<div class="search"> <div class="search">
<el-form :model="query" inline label-position="left"> <el-form :model="query" inline label-position="left">
<el-form-item> <el-form-item>
<el-input v-model="query.value" placeholder="支付方式" style="" /> <el-input v-model="query.paymentMethod" placeholder="支付方式" style="" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="reset">重置</el-button> <el-button @click="reset">重置</el-button>
@ -14,17 +14,16 @@
</div> </div>
<div class="head-container"> <div class="head-container">
<el-table v-loading="tableData.loading" :data="tableData.data"> <el-table v-loading="tableData.loading" :data="tableData.data">
<el-table-column label="支付方式" prpo="paymentMethod">
<el-table-column label="支付方式" prpo="name"> <template v-slot="scope"> <div>{{ scope.row.paymentMethod ? scope.row.paymentMethod : '-' }}</div> </template>
<template v-slot="scope"> <div>{{ scope.row.name ? scope.row.name : '-' }}</div> </template>
</el-table-column> </el-table-column>
<el-table-column label="支付金额" prpo="name"> <el-table-column label="支付金额" prpo="repaymentAmount">
<template v-slot="scope"> <div>{{ scope.row.name ? scope.row.name : '-' }}</div> </template> <template v-slot="scope"> <div>{{ scope.row.repaymentAmount ? scope.row.repaymentAmount : '-' }}</div> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" prpo="name"> <el-table-column label="备注" prpo="remark">
<template v-slot="scope"> <div>{{ scope.row.name ? scope.row.name : '-' }}</div> </template> <template v-slot="scope"> <div>{{ scope.row.remark ? scope.row.remark : '-' }}</div> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作时间" prop="receiveTime" /> <el-table-column label="操作时间" prop="createTime" />
</el-table> </el-table>
</div> </div>
<div class="head-container"> <div class="head-container">
@ -42,20 +41,16 @@
</template> </template>
<script> <script>
import { queryReceive } from '@/api/coupon' import { creditRePaymentRecord } from '@/api/credit'
export default { export default {
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
stateList: [
{ label: '未使用', value: 0 },
{ label: '已使用', value: 1 }
],
query: { query: {
couponId: '', creditBuyerId: '',
value: '', paymentMethod: '',
status: 0, orderId: '',
page: 1, page: 1,
size: 10 size: 10
}, },
@ -76,12 +71,16 @@ export default {
*/ */
async getTableData() { async getTableData() {
// eslint-disable-next-line no-unused-vars, prefer-const // eslint-disable-next-line no-unused-vars, prefer-const
let res = await queryReceive({ let params = {
shopId: localStorage.getItem('shopId'), creditBuyerId: this.query.creditBuyerId,
value: this.query.value, value: this.query.value,
page: this.query.page, page: this.query.page,
size: this.query.size size: this.query.size,
}) paymentMethod: this.query.paymentMethod
}
if (this.query.orderId) { params.orderId = this.query.orderId }
// eslint-disable-next-line prefer-const
let res = await creditRePaymentRecord(params)
this.tableData.loading = false this.tableData.loading = false
this.tableData.data = res.content this.tableData.data = res.content
this.tableData.total = res.totalElements this.tableData.total = res.totalElements
@ -91,9 +90,11 @@ export default {
* 打开 * 打开
* @param row * @param row
*/ */
show(row) { show(row, orderId) {
this.query = { ...this.resetQuery }
this.dialogVisible = true this.dialogVisible = true
this.query.couponId = row.id this.query.creditBuyerId = row.id
this.query.orderId = orderId
this.getTableData() this.getTableData()
}, },

View File

@ -2,6 +2,7 @@
<div> <div>
<el-dialog <el-dialog
:show-close="false" :show-close="false"
:close-on-click-modal="false"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="30%"
center center

View File

@ -4,31 +4,32 @@
<el-dialog <el-dialog
:show-close="false" :show-close="false"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:close-on-click-modal="false"
width="30%" width="30%"
center center
> >
<div slot="title" class="dialog-title">挂账还款</div> <div slot="title" class="dialog-title">挂账还款</div>
<div class="content"> <div class="content">
<div class="credit_info"> <div v-if="form.repaymentMethod == 'total' && !form.creditBuyerId" class="credit_info">
<div>挂账人{{ form.debtor }}</div> <div>挂账人{{ form.debtor }}</div>
<div>挂账金额{{ form.owedAmount || 0 }}</div> <div>挂账金额{{ form.owedAmount || 0 }}</div>
<div>账户余额: {{ form.accountBalance || 0 }}</div> <div>账户余额: {{ form.accountBalance || 0 }}</div>
</div> </div>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left"> <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="还款方式" style="width: 100%;"> <el-form-item v-if="form.repaymentMethod == 'total' && !form.creditBuyerId" label="还款方式" style="width: 100%;">
<el-radio-group v-model="form.repaymentMethod"> <el-radio-group v-model="form.repaymentMethod">
<el-radio v-for="item in repaymentMethodList" v-if="form.repaymentMethod == item.value" :key="item.value" :label="item.value"> <el-radio v-for="item in repaymentMethodList" v-if="form.repaymentMethod == item.value" :key="item.value" :label="item.value">
{{ item.label }} {{ item.label }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="还款金额" prop="creditAmount" style="width: 100%;"> <el-form-item label="还款金额" prop="repaymentAmount" style="width: 100%;">
<el-input v-model="form.creditAmount" placeholder="" oninput="value= value.replace(/[^\d|\.]/g, '')"> <el-input v-model="form.repaymentAmount" placeholder="" oninput="value= value.replace(/[^\d|\.]/g, '')">
<template slot="prepend"></template> <template slot="prepend"></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="支付方式" prop="debtor" style="width: 100%;"> <el-form-item label="支付方式" prop="paymentMethod" style="width: 100%;">
<el-input v-model="form.debtor" placeholder="请输入支付方式" /> <el-input v-model="form.paymentMethod" placeholder="请输入支付方式" />
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark" style="width: 100%;"> <el-form-item label="备注" prop="remark" style="width: 100%;">
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-input v-model="form.remark" placeholder="请输入备注" />
@ -44,7 +45,7 @@
</template> </template>
<script> <script>
import { addCreditBuyer } from '@/api/coupon' import { creditRePayment, creditPayment } from '@/api/credit'
export default { export default {
// eslint-disable-next-line vue/require-prop-types // eslint-disable-next-line vue/require-prop-types
@ -59,46 +60,36 @@ export default {
], ],
form: { form: {
id: '', id: '',
shopId: '', creditBuyerId: '',
status: '1', orderId: '',
debtor: '', repaymentMethod: '',
mobile: '', repaymentAmount: '',
position: '', paymentMethod: '',
creditAmount: '', remark: ''
repaymentMethod: ''
}, },
rules: { rules: {
debtor: [ repaymentAmount: [
{ {
required: true, required: true,
message: '请输入还款金额', message: '请输入还款金额',
trigger: 'blur' trigger: 'blur'
} }
], ],
mobile: [ paymentMethod: [
{ {
required: true, required: true,
message: '请输入支付方式', message: '请输入支付方式',
trigger: 'blur' trigger: 'blur'
} }
] ]
} },
resetForm: null
} }
}, },
mounted() { mounted() {
this.resetForm = { ...this.form }
}, },
methods: { methods: {
/**
* 校验是否存在
*/
isExist(val) {
if (val) {
return true
} else {
return false
}
},
/** /**
* 确定 * 确定
@ -108,16 +99,21 @@ export default {
if (valid) { if (valid) {
try { try {
this.loading = true this.loading = true
if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') } // if (!this.form.shopId) { this.form.shopId = localStorage.getItem('shopId') }
// eslint-disable-next-line no-unused-vars, prefer-const let res
let res = await addCreditBuyer(this.form) if (this.form.repaymentMethod === 'total') {
res = await creditRePayment(this.form)
} else {
res = await creditPayment(this.form)
}
this.$notify({ this.$notify({
title: '成功', title: '成功',
message: `${this.form.id ? '编辑' : '添加'}成功`, message: res.repaymentMsg,
type: 'success' type: 'success'
}) })
this.dialogVisible = false this.dialogVisible = false
this.loading = false this.loading = false
this.$emit('success', res)
} catch (error) { } catch (error) {
this.loading = false this.loading = false
console.log(error) console.log(error)
@ -130,8 +126,15 @@ export default {
* 打开 * 打开
* @param row * @param row
*/ */
show(row) { show(row, order) {
this.form = row this.form = { ...this.resetForm }
if (row.creditBuyerId) {
this.form.creditBuyerId = row.creditBuyerId
this.form.orderId = order.id
} else {
this.form.id = row.id
}
this.form.repaymentMethod = row.repaymentMethod
this.dialogVisible = true this.dialogVisible = true
}, },

View File

@ -24,7 +24,7 @@
<div class="head-container content"> <div class="head-container content">
<el-table v-loading="tableData.loading" :data="tableData.data"> <el-table v-loading="tableData.loading" :data="tableData.data">
<el-table-column label="挂账编码" prop="id" /> <el-table-column label="挂账编码" prop="id" />
<el-table-column label="状态" width="90"> <el-table-column label="状态">
<template v-slot="scope"> <template v-slot="scope">
{{ scope.row.status == '1' ? '启用' : '停用' }} {{ scope.row.status == '1' ? '启用' : '停用' }}
</template> </template>
@ -36,17 +36,16 @@
<el-table-column label="剩余挂账额度(元)" prop="remainingAmount" /> <el-table-column label="剩余挂账额度(元)" prop="remainingAmount" />
<el-table-column label="账户余额" prop="accountBalance" /> <el-table-column label="账户余额" prop="accountBalance" />
<el-table-column label="适用门店" prop="shopName" /> <el-table-column label="适用门店" prop="shopName" />
<el-table-column label="操作" width="300"> <el-table-column label="操作" width="250">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" icon="el-icon-edit" @click="$router.push({name: 'data_creditDetail', query: {id: scope.row.id}} )">查看明细</el-button> <el-button type="text" @click="$router.push({name: 'data_creditDetail', query: {id: scope.row.id, repaymentMethod: scope.row.repaymentMethod}} )">查看明细</el-button>
<el-button type="text" icon="el-icon-edit" @click="openDialog(scope.row,'edit')">编辑</el-button> <el-button type="text" @click="openDialog(scope.row,'edit')">编辑</el-button>
<el-button type="text" icon="el-icon-edit" @click="openDialog(scope.row,'repayment')">还款</el-button> <el-button :style="{ color: scope.row.repaymentMethod == 'order' ? '#999' :''}" type="text" @click="openDialog(scope.row,'repayment')">还款</el-button>
<el-button type="text" icon="el-icon-edit" @click="openDialog(scope.row,'rePaymentRecord')">还款记录</el-button> <el-button type="text" @click="openDialog(scope.row,'rePaymentRecord')">还款记录</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])"> <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<el-button <el-button
slot="reference" slot="reference"
type="text" type="text"
icon="el-icon-delete"
>删除</el-button> >删除</el-button>
</el-popconfirm> </el-popconfirm>
</template> </template>
@ -80,7 +79,7 @@
import creditAdd from './components/credit_add.vue' import creditAdd from './components/credit_add.vue'
import creditRepayment from './components/credit_repayment.vue' import creditRepayment from './components/credit_repayment.vue'
import creditRepaymentRecord from './components/credit_RePaymentRecord.vue' import creditRepaymentRecord from './components/credit_RePaymentRecord.vue'
import { getTbShopCoupon, delCreditBuyer } from '@/api/credit' import { getCreditBuyerList, delCreditBuyer } from '@/api/credit'
export default { export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
components: { creditAdd, creditRepayment, creditRepaymentRecord }, components: { creditAdd, creditRepayment, creditRepaymentRecord },
@ -122,14 +121,14 @@ export default {
}, },
methods: { methods: {
/** /**
* 创建挂账人 * 操作
*/ */
openDialog(row, type) { openDialog(row, type) {
if (type === 'add') { if (type === 'add') {
this.$refs.creditAdd.show() this.$refs.creditAdd.show()
} else if (type === 'edit') { } else if (type === 'edit') {
this.$refs.creditAdd.show(row) this.$refs.creditAdd.show(row)
} else if (type === 'repayment') { } else if (type === 'repayment' && row.repaymentMethod === 'total') {
this.$refs.creditRepayment.show(row) this.$refs.creditRepayment.show(row)
} else if (type === 'rePaymentRecord') { } else if (type === 'rePaymentRecord') {
this.$refs.creditRepaymentRecord.show(row) this.$refs.creditRepaymentRecord.show(row)
@ -138,7 +137,6 @@ export default {
// //
resetHandle() { resetHandle() {
console.log(123123)
this.page = 1 this.page = 1
this.getTableData() this.getTableData()
}, },
@ -157,7 +155,7 @@ export default {
async getTableData() { async getTableData() {
this.tableData.loading = true this.tableData.loading = true
try { try {
const res = await getTbShopCoupon({ const res = await getCreditBuyerList({
page: this.tableData.page, page: this.tableData.page,
size: this.tableData.size, size: this.tableData.size,
keywords: this.tableData.keywords, keywords: this.tableData.keywords,

View File

@ -1,3 +1,4 @@
<!-- eslint-disable vue/valid-v-bind -->
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="head-container"> <div class="head-container">
@ -26,11 +27,8 @@
</el-form-item> </el-form-item>
<template> <template>
<el-form-item> <el-form-item>
<el-input v-model="query.proName" placeholder="商品名称" /> <el-select v-model="query.status" placeholder="全部状态" style="width: 140px;">
</el-form-item> <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item>
<el-select v-model="query.cateId" placeholder="全部状态" style="width: 140px;">
<el-option v-for="item in categorys" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
@ -42,49 +40,53 @@
</div> </div>
<div class="head-container"> <div class="head-container">
<div class="collect_wrap"> <div class="collect_wrap">
<div v-for="item in payCountList" :key="item.id" class="item"> <div v-for="(item,index) in payCountList" :key="index" class="item">
<div class="icon_wrap" style="--bg-color:#C978EE"> <div class="icon_wrap" :style="{ backgroundColor: `rgba(${item.color},0.5)` }">
<i class="icon" :class="item.icon" /> <div />
<i class="icon" :class="item.icon" :style="{ color: `rgba(${item.color},1)` }" />
</div> </div>
<div class="info"> <div class="info">
<div class="m"> <div class="m">
<template v-if="item.isAmount == 1"></template> {{ item.amount }}
{{ item.payAmount }}
</div> </div>
<div class="t">{{ item.payType }}</div> <div class="t">{{ item.label }}{{ index == 0 ? item.count+'笔' : '' }}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="head-container"> <div class="head-container">
<el-table v-loading="tableData.loading" :data="tableData.data"> <el-table v-loading="tableData.loading" :data="tableData.data">
<el-table-column label="创建日期" prop="name" /> <el-table-column label="创建日期" prop="createTime" />
<el-table-column label="订单号" prop="name" /> <el-table-column label="订单号" prop="orderId" />
<el-table-column label="应付金额" prop="salesAmount"> <el-table-column label="应付金额" prop="payAmount">
<template v-slot="scope"> {{ scope.row.salesAmount }} </template> <template v-slot="scope"> {{ ''+scope.row.payAmount || '-' }} </template>
</el-table-column> </el-table-column>
<el-table-column label="已付款金额" prop="salesAmount"> <el-table-column label="已付款金额" prop="paidAmount">
<template v-slot="scope"> {{ scope.row.salesAmount }} </template> <template v-slot="scope"> {{ ''+scope.row.paidAmount || '-' }} </template>
</el-table-column> </el-table-column>
<el-table-column label="待付款金额" prop="salesAmount"> <el-table-column label="待付款金额" prop="unpaidAmount">
<template v-slot="scope"> {{ scope.row.salesAmount }} </template> <template v-slot="scope"> {{ ''+scope.row.unpaidAmount || '-' }} </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="salesAmount"> <el-table-column label="状态" prop="salesAmount">
<template v-slot="scope"> <template v-slot="scope">
{{ scope.row.salesAmount }} {{
scope.row.status == 'unpaid' ? '未付款' :
scope.row.status == 'partial' ? '部分支付' :
scope.row.status == 'paid' ? '已付款' : ''
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="付款方式" prop="salesAmount"> <el-table-column label="付款方式" prop="lastPaymentMethod">
<template v-slot="scope"> {{ scope.row.salesAmount }} </template> <template v-slot="scope"> {{ scope.row.lastPaymentMethod }} </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" prop="salesAmount"> <el-table-column label="备注" prop="remark">
<template v-slot="scope"> {{ scope.row.salesAmount }} </template> <template v-slot="scope"> {{ scope.row.remark }} </template>
</el-table-column> </el-table-column>
<el-table-column label="付款时间" prop="name" /> <el-table-column label="付款时间" prop="lastPaymentTime" />
<el-table-column label="操作" width="350"> <el-table-column label="操作" width="200">
<template v-slot="scope"> <template v-slot="scope">
<el-button type="text" icon="el-icon-edit" @click="addCredit(scope.row,'repayment')">付款</el-button> <el-button type="text" :style="{ color: repaymentMethod == 'total' ? '#999' :''}" @click="openDialog(scope.row,'payment')">付款</el-button>
<el-button type="text" icon="el-icon-edit" @click="addCredit(scope.row,'edit')">账单付款记录</el-button> <el-button type="text" @click="openDialog(scope.row,'paymentRecord')">账单付款记录</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -92,50 +94,71 @@
<div class="head-container"> <div class="head-container">
<el-pagination <el-pagination
:total="tableData.total" :total="tableData.total"
:current-page="tableData.page" :current-page="query.page"
:page-size="tableData.size" :page-size="query.size"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@current-change="paginationChange" @current-change="paginationChange"
@size-change="sizeChange" @size-change="sizeChange"
/> />
</div> </div>
<!-- 还款 -->
<creditRepayment ref="creditRepayment" @success="resetHandle" />
<!-- 还款记录 -->
<creditRepaymentRecord ref="creditRepaymentRecord" @success="resetHandle" />
</div> </div>
</template> </template>
<script> <script>
import { daycount, summaryday } from '@/api/home' import creditRepayment from './components/credit_repayment.vue'
import { tbShopCategoryGet } from '@/api/shop' import creditRepaymentRecord from './components/credit_RePaymentRecord.vue'
import { creditBuyerOrderList, creditBuyerOrderSummary } from '@/api/credit'
import dayjs from 'dayjs' import dayjs from 'dayjs'
export default { export default {
components: { creditRepayment, creditRepaymentRecord },
filters: { filters: {
}, },
data() { data() {
return { return {
timeValue: '', timeValue: '',
resetQuery: null, resetQuery: null,
categorys: [], repaymentMethod: '',
statusList: [
{ label: '未付款', value: 'unpaid' },
{ label: '部分支付', value: 'partial' },
{ label: '已付款', value: 'paid' }
],
query: { query: {
page: 1,
size: 10,
creditBuyerId: '',
createdAt: [], createdAt: [],
proName: '', status: ''
cateId: ''
}, },
tableData: { tableData: {
data: [], data: [],
page: 1,
size: 10,
loading: false, loading: false,
total: 0 total: 0
}, },
downloadLoading: false, downloadLoading: false,
payCountList: '', payCountList: [
{ label: '总交易', icon: 'el-icon-info', color: '201, 120, 236', amount: 0, count: 0 },
{ label: '已支付金额', icon: 'el-icon-success', color: '70, 181, 24', amount: 0 },
{ label: '待支付金额', icon: 'el-icon-circle-plus', color: '248, 110, 16', amount: 0 },
{ label: '待支付笔数', icon: 'el-icon-warning', color: '254, 180, 38', amount: 0 }
],
payCountTotal: 0 payCountTotal: 0
} }
}, },
mounted() { mounted() {
this.query.creditBuyerId = this.$route.query.id
this.repaymentMethod = this.$route.query.repaymentMethod
this.resetQuery = { ...this.query } this.resetQuery = { ...this.query }
// repaymentMethod
this.getTableData() this.getTableData()
this.tbShopCategoryGet() // this.tbShopCategoryGet()
}, },
methods: { methods: {
/** /**
@ -144,15 +167,19 @@ export default {
async getTableData() { async getTableData() {
this.tableData.loading = true this.tableData.loading = true
try { try {
this.daycount() this.creditDetailSummary()
const res = await summaryday({ // eslint-disable-next-line prefer-const
page: this.tableData.page, let params = {
size: this.tableData.size, page: this.query.page,
startTime: this.query.createdAt[0], size: this.query.size,
endTime: this.query.createdAt[1], creditBuyerId: this.query.creditBuyerId
proName: this.query.proName, }
cateId: this.query.cateId if (this.query.createdAt.length > 0) {
}) params.beginDate = this.query.createdAt[0].substring(0, 10)
params.endDate = this.query.createdAt[1].substring(0, 10)
}
// eslint-disable-next-line prefer-const
let res = await creditBuyerOrderList(params)
this.tableData.loading = false this.tableData.loading = false
this.tableData.data = res.content this.tableData.data = res.content
this.tableData.total = res.totalElements this.tableData.total = res.totalElements
@ -161,6 +188,44 @@ export default {
} }
}, },
/**
* 获取明细统计
*/
async creditDetailSummary() {
try {
// eslint-disable-next-line prefer-const
let params = {
page: this.query.page,
size: this.query.size,
creditBuyerId: this.query.creditBuyerId
}
if (this.query.createdAt.length > 0) {
params.beginDate = this.query.createdAt[0].substring(0, 10)
params.endDate = this.query.createdAt[1].substring(0, 10)
}
// eslint-disable-next-line prefer-const
let res = await creditBuyerOrderSummary(params)
this.payCountList[0].amount = res.payAmountTotal
this.payCountList[0].count = res.count
this.payCountList[1].amount = res.paidAmountTotal
this.payCountList[2].amount = res.unpaidAmountTotal
this.payCountList[3].amount = res.unpaidCount
} catch (error) {
console.log(error)
}
},
/**
* 操作
*/
openDialog(row, type) {
if (type === 'payment' && this.repaymentMethod === 'order') {
this.$refs.creditRepayment.show({ creditBuyerId: this.query.creditBuyerId, repaymentMethod: this.repaymentMethod }, row)
} else if (type === 'paymentRecord') {
this.$refs.creditRepaymentRecord.show({ creditBuyerId: this.query.creditBuyerId, repaymentMethod: this.repaymentMethod }, row.id)
}
},
/** /**
* 切换时间 * 切换时间
* @param e * @param e
@ -246,7 +311,6 @@ export default {
resetHandle() { resetHandle() {
this.timeValue = '' this.timeValue = ''
this.query = { ...this.resetQuery } this.query = { ...this.resetQuery }
this.page = 1
this.getTableData() this.getTableData()
}, },
@ -264,58 +328,12 @@ export default {
* @param e * @param e
*/ */
paginationChange(e) { paginationChange(e) {
this.tableData.page = e this.query.page = e
this.getTableData() this.getTableData()
},
//
async tbShopCategoryGet() {
try {
const res = await tbShopCategoryGet({
page: 1,
size: 200,
sort: 'id,desc',
shopId: localStorage.getItem('shopId')
})
let categorys = []
for (let item of res.content) {
categorys.push({
name: `|----${item.name}`,
id: item.id
})
if (item.childrenList.length) {
for (let val of item.childrenList) {
categorys.push({
name: `|----|----${val.name}`,
id: val.id
})
}
}
}
this.categorys = categorys
} catch (error) {
console.log(error);
}
},
//
async daycount() {
try {
const res = await daycount({
startTime: this.query.createdAt[0],
endTime: this.query.createdAt[1],
cateId: this.query.cateId,
proName: this.query.proName,
type: this.orderType,
});
this.payCountList = res;
} catch (error) {
console.log(error);
}
} }
} }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -324,29 +342,14 @@ export default {
gap: 14px; gap: 14px;
justify-content: space-between; justify-content: space-between;
.item:nth-child(1) {
background-image: url(../../assets/images/home/data_forms4.png);
}
.item:nth-child(2) {
background-image: url(../../assets/images/home/data_forms3.png);
}
.item:nth-child(3) {
background-image: url(../../assets/images/home/data_forms2.png);
}
.item:nth-child(4) {
background-image: url(../../assets/images/home/data_forms1.png);
}
.item { .item {
background-size: 100% 100%; background-size: 100% 100%;
width: 255px; width: 255px;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #f5f5f5; background-color: #F7F7FA;
padding: 20px; padding: 20px;
border-radius: 7px 7px 7px 7px;
.icon_wrap { .icon_wrap {
$size: 34px; $size: 34px;
@ -359,7 +362,18 @@ export default {
background-color: var(--bg-color); background-color: var(--bg-color);
border-radius: 50%; border-radius: 50%;
position: relative; position: relative;
>div{
width: 24px;
height: 24px;
background-color: #fff;
border-radius: 50%;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
&::after { &::after {
content: ""; content: "";
width: $size + $border; width: $size + $border;
@ -374,8 +388,13 @@ export default {
} }
.icon { .icon {
font-size: 16px; font-size: 32px;
color: #fff; position: absolute;
left: 1px;
right: 0;
top: 1px;
bottom: 0;
margin: auto;
} }
.img { .img {