| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <!--
- * @Description:
- * 月报表统计 功能开发
- -->
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="60px">
- <el-form-item label="日期" required prop="performDate">
- <el-date-picker
- v-model="queryParams.performDate"
- type="month"
- value-format="yyyy-MM"
- placeholder="日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-download"
- :disabled="dataList.length === 0"
- v-hasPermi="['month:month:export']"
- @click="handleExport"
- v-loading.fullscreen.lock="handleExportLoading"
- element-loading-text="正在拼命生成数据中..."
- element-loading-spinner="el-icon-loading"
- element-loading-background="rgba(0, 0, 0, 0.5)"
- >导出excel</el-button>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
-
- <el-table ref="tables" v-loading="loading" :data="dataList" max-height="650px" border>
- <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
- <el-table-column label="渠道" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.channelTypeName?scope.row.channelTypeName: '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="时间" align="center" prop="month"></el-table-column>
- <el-table-column label="人次" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.personNum }}</span>
- </template>
- </el-table-column>
- <el-table-column label="收入" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.salePrice }}</span>
- </template>
- </el-table-column>
- <el-table-column label="客单" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.avgPrice }}</span>
- </template>
- </el-table-column>
- <el-table-column label="人次占比" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.personRate?scope.row.personRate+'%' : '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="收入占比" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.salePriceRatio?scope.row.salePriceRatio+'%' : '-' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="销售上座率" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.saleSeatRate?scope.row.saleSeatRate+'%' : '-' }}</span>
- </template>
- </el-table-column>
- </el-table>
-
- </div>
- </template>
-
- <script>
-
- import { monthReportCount, monthReportExport } from '@/api/statisticalReport/statistics'
- import { exportExcel } from '@/utils/exportexcel'
- import moment from "moment"
- export default {
- name: "Month",
- dicts: [],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 用户表格数据
- dataList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 日期范围
- // dateRange: [],
- // 查询参数
- queryParams: {
- performDate:'',
- // pageNum: 1,
- // pageSize: 10,
- },
- handleExportLoading: false,
- };
- },
- created() {
- this.$set(this.queryParams,'performDate',moment().format("yyyy-MM"));
- this.getList();
- },
- methods: {
- /** 查询列表 */
- getList() {
- this.loading = true;
- monthReportCount(this.queryParams).then(response => {
- this.dataList = response.data.rows||[];
- this.total = response.data.total||0;
- this.loading = false;
- }
- ).catch(()=>{
- this.loading = false;
- });
- },
-
- // 取消按钮
- cancel() {
- this.open = false;
- },
-
- /** 搜索按钮操作 */
- handleQuery() {
- // this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.$set(this.queryParams, 'time', '');
- // this.queryParams.pageNum = 1;
- this.$set(this.queryParams,'performDate',moment().format("yyyy-MM"));
- this.handleQuery();
- },
-
- /**
- * 导出报表
- * @date 2022-10-24
- * @returns {any}
- */
- handleExport() {
- this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
- confirmButtonText: '确定 ',
- cancelButtonText: '取消 ',
- type: 'warning'
- })
- .then(() => {
- this.handleExportLoading = true;
- monthReportExport(this.queryParams)
- .then((res) => {
- exportExcel(res, '月报表', '.xlsx');
- this.handleExportLoading = false;
- })
- .catch(() => {
- this.handleExportLoading = false;
- });
- })
- .catch(() => {
- this.$message.info('您已取消导出!');
- });
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|