<template> <div style="height: 100%;"> <el-tabs v-model="activeName" @tab-click="handleClick"> <el-tab-pane v-if="PermissionState!=3&&PermissionState!=4" :label="$t('objFill.v101.FinancialModule.xianlujyqk')" name="1"></el-tab-pane> <el-tab-pane v-if="PermissionState!=3&&PermissionState!=4" :label="$t('objFill.v101.FinancialModule.gongsjyqk')" name="2"></el-tab-pane> <el-tab-pane v-if="PermissionState!=3&&PermissionState!=4" :label="$t('objFill.v101.FinancialModule.ribenxborcg')" name="3"></el-tab-pane> <el-tab-pane v-if="PermissionState!=2&&PermissionState!=4" :label="$t('objFill.v101.FinancialModule.gouwuyjqk')" name="4"></el-tab-pane> <el-tab-pane v-if="PermissionState!=3" :label="$t('objFill.v101.FinancialModule.yushiduibiqk')" name="5"></el-tab-pane> <!-- <el-tab-pane v-if="PermissionState!=3" :label="$t('objFill.v101.FinancialModule.cashqk')" name="6"></el-tab-pane> --> </el-tabs> <div class="query-box"> <el-form class="_info_box clearfix" label-width="90px"> <el-row style="padding: 15px 0px 0 0"> <el-col v-if="activeName!=4" :span="4"> <el-form-item :label="$t('system.table_company')"> <el-select filterable v-model="msg.OutBranchId" @change="getChange" :disabled="PermissionState==2" > <el-option :value="-1" :label="$t('pub.unlimitedSel')" ></el-option> <el-option v-for="item in CompanyList" :label="item.BName" :value="item.Id" :key="item.Id" ></el-option> </el-select> </el-form-item> </el-col> <template v-else> <el-col :span="4"> <el-form-item :label="$t('ground.gwd')"> <el-select filterable clearable v-model="shopMsg.PlaceId" @change="getStatement" > <!-- <el-option value="" :label="$t('pub.unlimitedSel')" ></el-option> --> <el-option v-for="item in ShoppingStores" :label="item.Name" :value="item.ID" :key="item.ID" ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="4"> <el-form-item :label="$t('system.query_type')"> <el-select filterable clearable v-model="shopMsg.Type" > <!-- <el-option value="" :label="$t('pub.unlimitedSel')" ></el-option> --> <el-option v-for="item in shopType" :label="item.Name" :value="item.Id" :key="item.Id" ></el-option> </el-select> </el-form-item> </el-col> </template> <el-col :span="4" v-if="activeName!=5"> <el-form-item :label="$t('fnc.bweibi')"> <el-select :disabled="coinGetShow" filterable v-model="msg.StandardCurrencyId" @change="getChange"> <el-option :value="-1" :label="$t('pub.unlimitedSel')"></el-option> <el-option v-for="item in coinGetList" :label="item.Name" :value="item.ID" :key="item.ID" ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="4" v-if="activeName==4 && msg.StandardCurrencyId ==1"> <el-form-item :label="$t('hotel.hotel_CurrentRate')"> <el-input v-model="shopMsg.MaoLiRate" type="number" @change="getMaoLiRate"></el-input> </el-form-item> </el-col> <el-col :span="4" v-if="activeName!=4 && activeName!=3"> <el-form-item :label="$t('advmanager.v_line')"> <el-select filterable v-model="msg.LineId" @change="getStatement" clearable> <el-option :value="0" :label="$t('pub.unlimitedSel')" ></el-option> <el-option v-for="item in LineList" :label="item.LineName" :value="item.LineID" :key="item.LineName" ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="6"> <el-form-item :label="$t('pub.date')"> <!-- <el-date-picker size="small" v-model="dateTime" type="monthrange" value-format="yyyy-MM" align="right" :range-separator="$t('OrderList.zhi')" start-placeholder="开始月份" end-placeholder="结束月份" :picker-options="pickerOptions" @change="getDateTime" :clearable="false"> </el-date-picker> --> <StartYMDateLimit :clearable="false" :dateTime="dateTime" @change="(startDate,endDate)=>{dateTime=[startDate,endDate],getDateTime(dateTime)}"></StartYMDateLimit> </el-form-item> </el-col> <el-col :span="4" v-if="msg.Type==2"> <el-form-item :label="$t('objFill.shujulb')"> <el-select v-model="msg.DataType" filterable class="w150" @change="getStatement"> <el-option value="-1" :label="$t('pub.unlimitedSel')"></el-option> <el-option value="1" :label="$t('objFill.tuanduiys')"></el-option> <el-option value="3" :label="$t('objFill.danbanqz')"></el-option> <el-option value="15" :label="$t('objFill.handdistributionfeeincome')"></el-option> <el-option value="16" :label="$t('objFill.danxiangjp')"></el-option> <el-option value="17" :label="$t('objFill.danxiangjd')"></el-option> <el-option value="18" :label="$t('objFill.danxiangbc')"></el-option> <el-option value="19" :label="$t('objFill.dangxiangmp')"></el-option> <el-option value="20" :label="$t('objFill.kaipiaosr')"></el-option> <el-option value="21" :label="$t('objFill.ribenspfsr')"></el-option> <el-option value="22" :label="$t('objFill.chehangsr')"></el-option> <el-option value="23" :label="$t('objFill.ouzhoudtfrsr')"></el-option> <el-option value="24" :label="$t('objFill.v101.FinancialModule.ouzhoussft')"></el-option> <el-option value="25" :label="$t('objFill.v101.FinancialModule.crmzkbwdt')"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="2" v-if="activeName!=3 && activeName!=5"> <el-form-item :label="$t('objFill.v101.FinancialModule.jiduhuiz')"> <el-checkbox v-model="msg.LossType" true-label="1" false-label="0" @change="getStatement"></el-checkbox> </el-form-item> </el-col> </el-row> </el-form> <ul class="clearfix"> <li class="hight_query"> <button class="hollowFixedBtn" @click="getStatement"> {{ $t("pub.searchBtn") }} </button> <button v-if="activeName!=4 && activeName!=5" class="normalBtn" @click="exportExcel"> {{$t('visa.v_daochu')}} </button> <button v-if="activeName==4" class="normalBtn" @click="exportExcel2"> {{$t('visa.v_daochu')}} </button> <button v-if="activeName==5" class="normalBtn" @click="exportExcel3"> {{$t('visa.v_daochu')}} </button> </li> </ul> </div> <div v-loading="loading" style="height: 78%;overflow: auto;"> <Lines v-if="activeName=='1'" :StatisticalData="StatisticalData"></Lines> <Corporations v-if="activeName=='2'" :StatisticalData="StatisticalData"></Corporations> <Packets v-if="activeName=='3'" :StatisticalData="StatisticalData"></Packets> <ShoppingCommission v-if="activeName=='4'" :StatisticalData="StatisticalData"></ShoppingCommission> <PrerealContrast v-if="activeName=='5'" :StatisticalData="StatisticalData"></PrerealContrast> <Cashflows v-if="activeName=='6'" :StatisticalData="StatisticalData"></Cashflows> </div> </div> </template> <script> import moment from 'moment'; import Lines from "./components/line.vue"; import Corporations from "./components/corporation.vue"; import Cashflows from "./components/cashflow.vue"; import Packets from "./components/packet.vue"; import ShoppingCommission from "./components/ShoppingCommission.vue"; import PrerealContrast from "./components/PrerealContrast.vue"; import StartYMDateLimit from '../../public/StartYMDateLimit.vue'; export default { components: {Lines,Corporations,Cashflows,Packets,ShoppingCommission,PrerealContrast,StartYMDateLimit}, data() { return { coinGetShow: false, loading: false, activeName: '1', PermissionState: '0',//权限状态 1管理员级 2各公司负责人 3地接OP查询佣金 4操作OP msg:{ startDate: '', endDate: '', OutBranchId: -1, StandardCurrencyId:0, LineId: 0, Type: '1', DataType:'-1', LossType:'0', IsLastData:0, }, shopMsg:{ startDate: '', endDate: '', PlaceId: '', Type: '', LossType: '0', IsLastData: '0', StandardCurrencyId: '1', MaoLiRate: 0.049 }, ShoppingStores: [], shopType: [ {Name: this.$t('pub.unlimitedSel'),Id:''}, {Name: this.$t('objFill.v101.FinancialModule.gouwdtj'),Id:1}, {Name: this.$t('objFill.v101.FinancialModule.lindudypm'),Id:2}, {Name: this.$t('objFill.v101.FinancialModule.yongjzbtj'),Id:3}, ], dateTime: [], CompanyList: [], getCompanyMsg: { // 公司 RB_Group_Id: "0", Status: "0", }, LineList: [], coinGetList: [], pickerOptions: { shortcuts: [{ text: this.$t('objFill.v101.FinancialModule.benyue'), onClick(picker) { picker.$emit('pick', [new Date(), new Date()]); } }, { text: this.$t('objFill.v101.FinancialModule.jinnianzj'), onClick(picker) { const end = new Date(); const start = new Date(new Date().getFullYear(), 0); picker.$emit('pick', [start, end]); } }, { text: this.$t('objFill.v101.FinancialModule.zuijinlgy'), onClick(picker) { const end = new Date(); const start = new Date(); start.setMonth(start.getMonth() - 6); picker.$emit('pick', [start, end]); } }] }, StatisticalData: {} ,//T统计数据 } }, mounted() { this.getCompanyMsg.RB_Group_Id = this.getLocalStorage().RB_Group_id let sDate = moment().subtract(7, 'months').format('YYYY-MM'); let eDate = moment().subtract(1, 'months').format('YYYY-MM'); this.dateTime = [sDate,eDate] this.msg.startDate = this.dateTime[0] this.msg.endDate = this.dateTime[1] let userInfo = this.getLocalStorage(); if(userInfo.RB_Group_id==2){ if(userInfo.RB_Branch_id==0||userInfo.RB_Branch_id==49){ this.PermissionState=1; if(userInfo.RB_Post_Id==171){ this.PermissionState=3;//地接OP this.activeName='4'; } if(userInfo.RB_Post_Id==270||userInfo.RB_Post_Id==263||userInfo.RB_Post_Id==9||userInfo.RB_Post_Id==271||userInfo.RB_Post_Id==103){ this.PermissionState=4;//操作OP this.activeName='5'; } } else{ //分公司的 看各自公司的数据 佣金暂时不开 this.PermissionState=2; this.msg.OutBranchId=userInfo.RB_Branch_id; } } this.financeinfo_post_GetList() this.getQueryData() this.getShops() this.getStatement() }, methods: { getShops() { this.apipost('Shopping_Post_GetList', {}, res => { if (res.data.resultCode === 1) { this.ShoppingStores = res.data.data; } else { this.$message.error(res.data.message); } }, null) }, getMaoLiRate(){ if(!this.shopMsg.MaoLiRate) this.shopMsg.MaoLiRate = 0.049 this.getStatement(); }, getChange(val){ if(this.msg.OutBranchId == -1){ this.coinGetShow = false this.msg.StandardCurrencyId = val>-1?val:this.coinGetList[0].ID }else{ this.coinGetShow = true this.msg.StandardCurrencyId = -1 } this.getStatement(); }, financeinfo_post_GetList(){ // 获取币种 this.apipost('financeinfo_post_GetAllStandardCurrencyList',{}, res => { if(res.data.resultCode == 1) { this.coinGetList = res.data.data; if(this.msg.OutBranchId == -1){ this.coinGetShow = false this.msg.StandardCurrencyId = this.coinGetList[0].ID this.msg.StandardCurrencyId=this.$route.query.StandardCurrencyId?Number(this.$route.query.StandardCurrencyId):this.msg.StandardCurrencyId; }else{ this.coinGetShow = true this.msg.StandardCurrencyId = -1 } this.getStatement(); } }) }, getStatement(){ this.msg.IsLastData = 0 let msg = this.msg let url ='financestatistics_post_GetDataAnalysisStat' if(this.activeName=='4') { this.shopMsg.startDate = this.msg.startDate this.shopMsg.endDate = this.msg.endDate this.shopMsg.LossType = this.msg.LossType this.shopMsg.StandardCurrencyId = this.msg.StandardCurrencyId msg = this.shopMsg url = 'financestatistics_post_GetCommissionAnalysisStat' } if(this.activeName=='5'){ url = 'financestatistics_post_GetExpectedCostAnalysisStat' } if(this.activeName=='6'){ url = 'financestatistics_post_GetCashFlowAnalysisStat' } this.loading = true this.apipost( url, msg, res => { if (res.data.resultCode == 1) { this.StatisticalData = res.data.data } else { this.Error(res.data.message); } this.loading = false; }, err => { this.loading = false } ); }, handleClick(e){ this.activeName = e._props.name if(e._props.name!='4')this.msg.Type = e._props.name if(!this.dateTime||this.dateTime.length==0){ let sDate = moment().subtract(7, 'months').format('YYYY-MM'); let eDate = moment().subtract(1, 'months').format('YYYY-MM'); this.dateTime = [sDate,eDate] this.msg.startDate = sDate this.msg.endDate = eDate } if(this.activeName=='5'){ let sDate = moment().subtract(2, 'months').format('YYYY-MM'); let eDate = moment().subtract(2, 'months').format('YYYY-MM'); this.dateTime = [sDate,eDate] this.msg.startDate = sDate this.msg.endDate = eDate this.msg.LineId =14; }else{ let eDate = moment().subtract(1, 'months').format('YYYY-MM'); if(this.msg.startDate == this.msg.endDate && this.msg.startDate== eDate){ let sDate = moment().subtract(7, 'months').format('YYYY-MM'); let eDate = moment().subtract(1, 'months').format('YYYY-MM'); this.dateTime = [sDate,eDate] this.msg.startDate = sDate this.msg.endDate = eDate } } this.getStatement() }, getDateTime(){ if(this.dateTime&&this.dateTime.length>0){ this.msg.startDate = this.dateTime[0] this.msg.endDate = this.dateTime[1] }else{ let sDate = moment().subtract(7, 'months').format('YYYY-MM'); let eDate = moment().subtract(1, 'months').format('YYYY-MM'); this.dateTime = [sDate,eDate] this.msg.startDate = sDate this.msg.endDate = eDate } this.getStatement() }, exportExcel(){//导出报表 let msg = { EmployeeId: this.getLocalStorage().EmployeeId, ...this.msg } this.GetLocalFile("financestatistics_post_GetDataAnalysisStatToExcel", msg, this.$t('commonPickUp.Pick_Data')+ this.$commonUtils.getCurrentDate() + ".xls"); }, exportExcel2(){//导出报表 if(this.activeName=='4') { this.shopMsg.startDate = this.msg.startDate this.shopMsg.endDate = this.msg.endDate this.shopMsg.LossType = this.msg.LossType this.shopMsg.StandardCurrencyId = this.msg.StandardCurrencyId } let msg = { EmployeeId: this.getLocalStorage().EmployeeId, ...this.shopMsg } this.GetLocalFile("financestatistics_post_GetCommissionAnalysisStatToExcel", msg, this.$t('objFill.v101.FinancialModule.yongjtj')+this.$commonUtils.getCurrentDate() + ".xls"); }, exportExcel3(){//导出报表 let msg = { EmployeeId: this.getLocalStorage().EmployeeId, ...this.msg } this.GetLocalFile("financestatistics_post_GetExpectedCostAnalysisStatToExcel", msg, '预实对比'+ this.$commonUtils.getCurrentDate() + ".xls"); }, getQueryData() { //获取公司列表 this.apipost( "admin_get_BranchGetList", this.getCompanyMsg, (res) => { if (res.data.resultCode == 1) { this.CompanyList = res.data.data; } else { } }, (err) => {} ); this.apipost( "line_post_GetList", { LineDirection: 2 }, res => { if (res.data.resultCode == 1) { this.LineList = res.data.data; } } ); }, } } </script> <style scoped> </style>