增加合计功能

This commit is contained in:
huangdeliang
2020-10-17 17:53:00 +08:00
parent 93bb576331
commit 72a3837804
2 changed files with 110 additions and 102 deletions

View File

@ -1,101 +1,103 @@
<template> <template>
<div :class="{'hidden':hidden}" class="pagination-container"> <div :class="{'hidden':hidden}" class="pagination-container">
<el-pagination <el-pagination
:background="background" :background="background"
:current-page.sync="currentPage" :current-page.sync="currentPage"
:page-size.sync="pageSize" :page-size.sync="pageSize"
:layout="layout" :layout="layout"
:page-sizes="pageSizes" :page-sizes="pageSizes"
:total="total" :total="total"
v-bind="$attrs" v-bind="$attrs"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
/> >
</div> <slot></slot>
</template> </el-pagination>
</div>
<script> </template>
import { scrollTo } from '@/utils/scroll-to'
<script>
export default { import { scrollTo } from '@/utils/scroll-to'
name: 'Pagination',
props: { export default {
total: { name: 'Pagination',
required: true, props: {
type: Number total: {
}, required: true,
page: { type: Number
type: Number, },
default: 1 page: {
}, type: Number,
limit: { default: 1
type: Number, },
default: 20 limit: {
}, type: Number,
pageSizes: { default: 20
type: Array, },
default() { pageSizes: {
return [10, 20, 30, 50] type: Array,
} default() {
}, return [10, 20, 30, 50]
layout: { }
type: String, },
default: 'total, sizes, prev, pager, next, jumper' layout: {
}, type: String,
background: { default: 'total, sizes, prev, pager, next, jumper'
type: Boolean, },
default: true background: {
}, type: Boolean,
autoScroll: { default: true
type: Boolean, },
default: true autoScroll: {
}, type: Boolean,
hidden: { default: true
type: Boolean, },
default: false hidden: {
} type: Boolean,
}, default: false
computed: { }
currentPage: { },
get() { computed: {
return this.page currentPage: {
}, get() {
set(val) { return this.page
this.$emit('update:page', val) },
} set(val) {
}, this.$emit('update:page', val)
pageSize: { }
get() { },
return this.limit pageSize: {
}, get() {
set(val) { return this.limit
this.$emit('update:limit', val) },
} set(val) {
} this.$emit('update:limit', val)
}, }
methods: { }
handleSizeChange(val) { },
this.$emit('pagination', { page: this.currentPage, limit: val }) methods: {
if (this.autoScroll) { handleSizeChange(val) {
scrollTo(0, 800) this.$emit('pagination', { page: this.currentPage, limit: val })
} if (this.autoScroll) {
}, scrollTo(0, 800)
handleCurrentChange(val) { }
this.$emit('pagination', { page: val, limit: this.pageSize }) },
if (this.autoScroll) { handleCurrentChange(val) {
scrollTo(0, 800) this.$emit('pagination', { page: val, limit: this.pageSize })
} if (this.autoScroll) {
} scrollTo(0, 800)
} }
} }
</script> }
}
<style scoped> </script>
.pagination-container {
background: #fff; <style scoped>
padding: 32px 16px; .pagination-container {
} background: #fff;
.pagination-container.hidden { padding: 32px 16px;
display: none; }
} .pagination-container.hidden {
</style> display: none;
}
</style>

View File

@ -259,8 +259,11 @@
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
layout="total, slot, sizes, prev, pager, next, jumper"
@pagination="getList" @pagination="getList"
/> >
<span style="margin-right: 12px;">总计{{toThousands(this.totalAmount)}} </span>
</pagination>
<!-- 添加或修改销售订单对话框 --> <!-- 添加或修改销售订单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
@ -451,6 +454,8 @@
const beginTime = dayjs().startOf('month').format('YYYY-MM-DD'); const beginTime = dayjs().startOf('month').format('YYYY-MM-DD');
const endTime = dayjs().format('YYYY-MM-DD'); const endTime = dayjs().format('YYYY-MM-DD');
// const beginTime = dayjs().format('YYYY-MM-DD');
// const endTime = dayjs().format('YYYY-MM-DD');
export default { export default {
name: "Order", name: "Order",
@ -612,6 +617,7 @@
this.orderList = response.rows; this.orderList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
this.totalAmount = response.rows.reduce((acc, cur) => cur.amount + acc, 0);
}); });
},// 收款方式字典翻译 },// 收款方式字典翻译
payTypeIdFormat(row, column) { payTypeIdFormat(row, column) {