| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503 |
- <template>
- <div>
- <div class="royaltypg-all">
- <div class="royaltypg-hand">
- <el-form label-width="50px">
- <div class="royaltypg-hand-search">
- <el-form-item label="公司">
- <el-select disabled @change="Corporationchange" v-model="value" placeholder="请选择公司">
- <el-option v-for="(iten,index) in CorporationOption" :key="index" :label="iten.companyName" :value="iten.companyId"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="部门">
- <el-select style="width:120px" disabled @change="depchange" v-model="depvalue" placeholder="请选择部门">
- <el-option v-for="(item,index) in depOption" :key="index" :label="item.depName" :value="item.depId"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="人员">
- <el-select style="width:120px" disabled filterable v-model="uservalue" placeholder="请选择人员">
- <el-option v-for="(item,index) in userOption" :key="index" :label="item.cnName" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="日期">
- <el-date-picker
- style="width:250px"
- v-model="value2"
- type="daterange"
- align="right"
- unlink-panels
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :picker-options="pickerOptions">
- </el-date-picker>
- </el-form-item>
- <el-form-item label-width="80px" label="是否确认">
- <el-select style="width:120px" filterable v-model="countersign" placeholder="请选择人员">
- <el-option v-for="(item,index) in countersignarr" :key="index" :label="item.lable" :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label-width="80px" label="是否发放">
- <el-select style="width:120px" filterable v-model="grant" placeholder="请选择人员">
- <el-option v-for="(item,index) in grantarr" :key="index" :label="item.lable" :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- <div style="margin-left: 10px;">
- <el-button @click="ComputeRoyalties" type="primary">查 询</el-button>
- <!-- <el-button @click="derivelist" type="primary">导出提成列表</el-button> -->
- <el-button @click="RoyaltyConfirmByUser" type="primary">确认</el-button>
- </div>
- </div>
- </el-form>
- </div>
- <div class="royaltypg-table">
- <el-table
- height="750"
- :data="tableData"
- border
- @selection-change="handleSelectionChange"
- style="width: 100%">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- prop="date"
- label="序号"
- width="50">
- <template slot-scope="scope">
- {{ scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column
- prop="teamName"
- label="团名"
- width="400">
- </el-table-column>
- <el-table-column
- prop="visitDate"
- label="结束日期"
- width="100">
- <template slot-scope="scope">
- {{processingdate(scope.row.visitDate)}}
- </template>
- </el-table-column>
- <el-table-column
- prop="teamLvStr"
- label="级别"
- width="80">
- </el-table-column>
- <el-table-column
- prop="temp"
- label="提成明细">
- <template slot-scope="scope">
- <el-popover
- placement="top-start"
- title="明细"
- width="700"
- trigger="hover">
- <div class="temp-ul">
- <div class="temp-li" v-for="(item,index) in scope.row.chiArr" :key="index">
- {{ item }}
- </div>
- </div>
- <span slot="reference">{{scope.row.temp}}</span>
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column
- prop="price"
- label="提成金额 "
- width="180">
- <template slot-scope="scope">
- {{ processingprice(scope.row.price)+ ' 元' }}
- </template>
- </el-table-column>
- <el-table-column
- prop="price"
- label="是否确认"
- width="80">
- <template slot-scope="scope">
- {{ scope.row.isConfirm==1?'已确认':'未确认'}}
- </template>
- </el-table-column>
- <el-table-column
- prop="price"
- label="是否发放"
- width="80">
- <template slot-scope="scope">
- {{ scope.row.isSeed==1?'已发放':'未发放'}}
- </template>
- </el-table-column>
- </el-table>
- <div class="numpice">
- 该时间段提成总额: {{ numpices }} 元
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {debounce} from '../../store/statice'
- export default {
- data () {
- return {
- pickerOptions: {
- shortcuts: [{
- text: '最近一周',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
- picker.$emit('pick', [start, end]);
- }
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit('pick', [start, end]);
- }
- },{
- text: '最近一年',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
- picker.$emit('pick', [start, end]);
- }
- }]
- },
- cost:0,
- value:'',
- values:'',
- depvalue:'',
- depvalues:'',
- uservalue:'',
- uservalues:'',
- value2:[],
- CorporationOption:[],
- depOption:[],
- userOption:[],
- tableData: [],
- numpices:0,
- multipleSelection: [],
- countersign:-1,
- countersignarr:[
- {
- lable:'全部',
- value:-1
- },
- {
- lable:'未确认',
- value:0
- },
- {
- lable:'已确认',
- value:1
- },
- ],
- grant:-1,
- grantarr:[
- {
- lable:'全部',
- value:-1
- },
- {
- lable:'未发放',
- value:0
- },
- {
- lable:'已发放',
- value:1
- },
- ],
- }
- },
- methods:{
- //处理日期
- processingdate(vals){
- vals=vals+""
- return vals.split(' ')[0]
- },
- //处理金额
- processingprice(val){
- if(Number(val)){
- return val.toFixed(2);
- }else{
- return val
- }
- },
- handleSizeChange(val) {
- console.log(`每页 ${val} 条`);
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- },
- addcost:debounce(function(){
- this.cost++
- console.log(this.cost)
- },1000,true),
- //获取公司
- daraSource(){
- var url = "/api/register/daraSource"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.CorporationOption=res.data.data;
- for (let i = 0; i < that.CorporationOption.length; i++) {
- if(that.values==that.CorporationOption[i].companyName){
- that.value=that.CorporationOption[i].companyId
- }
- }
- that.Corporationchange(that.value);
- console.log(that.CorporationOption)
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- //导出
- derivelist(){
- if(this.uservalue==""||this.value2.length<=0){
- this.$message({
- message:"请选择查询条件",
- type: 'warning'
- });
- return
- }
- var url = "/api/Financial/ExportRoyaltyExcel"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- userId:that.uservalue,
- startDate:that.getdate(this.value2[0]),
- endDate:that.getdate(this.value2[1])
- }
- }).then(function (res) {
- if(res.data.code==200){
- window.open(res.data.data.url);
- that.$message({
- message: res.data.msg,
- type: 'success'
- });
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- //公司切换
- Corporationchange(val){
- this.depOption=[];
- this.depvalue='';
- this.userOption=[];
- this.uservalue='';
- for(let i=0;i<this.CorporationOption.length;i++){
- if(val==this.CorporationOption[i].companyId){
- this.depOption=this.CorporationOption[i].subDep;
- }
- }
- for(let j=0;j<this.depOption.length;j++){
- if(this.depvalues==this.depOption[j].depName){
- this.depvalue=this.depOption[j].depId
- }
- }
- this.depchange(this.depvalue)
- },
- //部门切换
- depchange(val){
- this.userOption=[];
- this.uservalue='';
- this.QueryUserByDepart(val)
- },
- //获取员工
- QueryUserByDepart(val){
- var url = "/api/System/QueryUserByDepart"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- departId:val,
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.userOption=res.data.data;
- that.uservalue=that.uservalues;
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- //table 多选
- handleSelectionChange(val) {
- console.log(val);
- this.multipleSelection = val;
- },
- //处理时间
- getdate(val){
- var date=new Date(val);
- var y=date.getFullYear();
- var m=date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1;
- var d=date.getDate()<10?'0'+date.getDate():date.getDate();
- return y+'-'+m+'-'+d
- },
- //查询
- ComputeRoyalties(){
- if(this.uservalue==""||this.value2.length<=0){
- this.$message({
- message:"请选择查询条件",
- type: 'warning'
- });
- return
- }
- this.tableData=[];
- var url = "/api/Financial/QueryRoyaltyInfo"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- userId:that.uservalue,
- startDate:that.getdate(this.value2[0]),
- endDate:that.getdate(this.value2[1]),
- confirm:that.countersign,
- send:that.grant
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.tableData=res.data.data.list;
- that.numpices=res.data.data.costPrice;
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- //提成确认
- RoyaltyConfirmByUser(){
- if (this.multipleSelection.length==0) {
- this.$message({
- message:"请选中数据",
- type: 'warning'
- });
- return
- }
- let dataarr=[];
- for(let i=0;i<this.multipleSelection.length;i++){
- dataarr.push(this.multipleSelection[i].id);
- }
- var url = "/api/Financial/RoyaltyConfirmByUser"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- data:dataarr,
- state:1,
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.$message({
- message: res.data.msg,
- type: 'success'
- });
- }else{
- that.$message({
- message: res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- },
- created(){
- },
- mounted(){
- this.uservalues = JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
- this.depvalues = JSON.parse(localStorage.getItem('userinif')).userInfo.depName;
- this.values = JSON.parse(localStorage.getItem('userinif')).userInfo.companyName;
- this.daraSource();
- }
- }
- </script>
- <style>
- .royaltypg-all{
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- height: 100%;
- min-height: 830px;
- }
- .royaltypg-hand-search{
- display: flex;
- flex-wrap: wrap;
- }
- .royaltypg-hand-search .el-form-item{
- margin-bottom: 0;
-
- }
- .royaltypg-table{
- margin-top: 20px;
- }
- .royaltypg-all .block{
- margin-top: 15px;
- text-align: center;
- }
- .temp-li{
- border-top: 1px solid #EBEEF5;
- border-right: 1px solid #EBEEF5;
- border-left: 1px solid #EBEEF5;
- padding: 10px;
- }
- .temp-li:nth-last-child(1){
- border-bottom: 1px solid #EBEEF5;
- }
- .numpice{
- text-align: right;
- font-size:14px ;
- color: #555;
- }
- </style>
|