777 lines
28 KiB
Vue
777 lines
28 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-card>
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
<el-tab-pane label="油品提成方案" name="oil"></el-tab-pane>
|
|
<el-tab-pane label="非油品提成方案" name="nonOil"></el-tab-pane>
|
|
<el-tab-pane label="员工提成记录" name="staffCommission">
|
|
<div>
|
|
<el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" label-width="68px">
|
|
<el-form-item label="交易员工" prop="staffId">
|
|
<el-select
|
|
v-model="queryParams1.staffId"
|
|
clearable
|
|
placeholder="全部"
|
|
>
|
|
<el-option v-for="item in staffList" :key="item.id" :label="item.realName" :value="item.id+''">
|
|
<span style="float: left">{{ item.realName }}</span>
|
|
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.mobile }}</span>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="创建时间">
|
|
<el-date-picker
|
|
v-model="dateRange"
|
|
style="width: 240px"
|
|
size="medium"
|
|
value-format="yyyy-MM-dd"
|
|
type="daterange"
|
|
range-separator="-"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
></el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
|
|
<!-- <el-card class="box-card">-->
|
|
<!-- <div slot="header" class="clearfix">-->
|
|
<!-- <span>会员充值统计</span>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="box-gang">-->
|
|
<!-- <div class="box">-->
|
|
<!-- <div class="size-hui">提成笔数</div>-->
|
|
<!-- <div class="size-bole">{{ total1 }}</div>-->
|
|
<!-- </div>-->
|
|
<!-- <div class="box">-->
|
|
<!-- <div class="size-hui">提成金额</div>-->
|
|
<!-- <div class="size-bole">{{ allAmount }}</div>-->
|
|
<!-- </div>-->
|
|
<!-- </div>-->
|
|
<!-- </el-card>-->
|
|
|
|
<div style="margin-top: 20px" v-if="activeName=='staffCommission'">
|
|
<el-table ref="tables" v-loading="loading" :data="staffCommissionList">
|
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
|
<el-table-column label="员工信息" align="center">
|
|
<el-table-column label="姓名" prop="staffName" align="center"/>
|
|
<el-table-column label="手机号" prop="staffMobile" align="center"/>
|
|
</el-table-column>
|
|
<el-table-column label="提成类型" align="center" >
|
|
<el-table-column label="油卡充值" prop="oilCardRecharge" align="center">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.oilCardRecharge || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="囤油卡充值" prop="oilStorageRecharge" align="center">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.oilCardRecharge || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="车主加油" prop="oilSale" align="center">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.oilSale || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="非油品" prop="goodsCommission" align="center">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.goodsCommission || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="汇总" prop="summary" align="center" width="260">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.summary || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="详情" align="center" width="160">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" icon="el-icon-document" @click="lookDetail(scope.row.staffId)">查看详情</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total1>0"
|
|
:total="total1"
|
|
:page.sync="queryParams1.page"
|
|
:limit.sync="queryParams1.pageSize"
|
|
@pagination="getStaffCommissionList"
|
|
/>
|
|
</div>
|
|
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
|
|
<el-alert
|
|
title="方案说明"
|
|
type="info"
|
|
v-if="activeName=='oil' || activeName=='nonOil'"
|
|
description="同一角色组、同一参与油品只能设置一种启用的提成方案,挂账订单不参与提成">
|
|
</el-alert>
|
|
|
|
<div style="margin-top: 20px" v-if="activeName=='oil' || activeName=='nonOil'">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="handleAdd"
|
|
>新增提成方案</el-button>
|
|
<el-table ref="tables" v-loading="loading" :data="list"
|
|
@selection-change="handleSelectionChange" :default-sort="defaultSort"
|
|
@sort-change="handleSortChange">
|
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
|
<el-table-column label="方案名称" prop="name" align="center"/>
|
|
<el-table-column label="员工角色" prop="dutyName" align="center">
|
|
<!-- <template slot-scope="scope">-->
|
|
<!-- <span>{{scope.row.staffRoleGroup ? getStaffDuty(roleList,scope.row.staffRoleGroup) : "--"}}</span>-->
|
|
<!-- </template>-->
|
|
</el-table-column>
|
|
<el-table-column label="提成来源" prop="commissionSource" align="center" />
|
|
<el-table-column label="满足条件" prop="meetCondition" align="center" width="260">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.type == 'orderAmount'">
|
|
订单金额消费满{{scope.row.meetCondition}}元
|
|
</span>
|
|
<span v-if="scope.row.type == 'payAmount'">
|
|
实际金额消费满{{scope.row.meetCondition}}元
|
|
</span>
|
|
<span v-if="scope.row.type == 'refuleNum'">
|
|
加油数量消费满{{scope.row.meetCondition}}单位(升/立方)
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="油品提成" prop="royaltyRate" align="center"/>
|
|
<!-- <el-table-column label="生效时间" prop="takeEffect" align="center">-->
|
|
<!-- <template slot-scope="scope">-->
|
|
<!-- <span>-->
|
|
<!-- {{JSON.parse(scope.row.takeEffect)[0]}}至{{JSON.parse(scope.row.takeEffect)[1]}}-->
|
|
<!-- </span>-->
|
|
<!-- </template>-->
|
|
<!-- </el-table-column>-->
|
|
<el-table-column label="方案状态" align="center" prop="status">
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
|
|
<el-tag type="info" v-if="scope.row.status=='jy'">禁用</el-tag>
|
|
<!-- <dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>-->
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="创建时间" align="center" width="160" prop="updateTime">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" width="120" fixed='right'>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate(scope.row)"
|
|
>修改</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
>删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total>0"
|
|
:total="total"
|
|
:page.sync="queryParams.page"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
<!-- 添加或修改提成方案对话框 -->
|
|
<el-dialog :close-on-click-modal="false" :title="title" width="40%" :visible.sync="open" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="方案名称" prop="name" style="width: 420px">
|
|
<el-input v-model="form.name" placeholder="请输入方案名称" maxlength="30" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24" style="display: flex;margin-bottom: 10px">
|
|
<el-form-item label="提成来源" prop="commissionSource" style="width: 420px">
|
|
<el-radio-group v-model="form.commissionSource" v-if="form.commissionSource == '非油品'">
|
|
<!-- <el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>-->
|
|
<el-radio v-if="form.commissionSource == '非油品'" @change="isChange" label="非油品" value="非油品"></el-radio>
|
|
</el-radio-group>
|
|
<el-radio-group v-model="form.commissionSource" v-else>
|
|
<!-- <el-radio v-for="dict in dict.type.source" @change="isChange" :label="dict.value">{{ dict.label }}</el-radio>-->
|
|
<el-radio @change="isChange" label="储值卡充值" value="储值卡充值"></el-radio>
|
|
<el-radio @change="isChange" label="囤油卡充值" value="囤油卡充值"></el-radio>
|
|
<el-radio @change="isChange" label="车主加油" value="车主加油"></el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="角色组" prop="staffRoleGroup">
|
|
<el-select v-model="staffRoleGroup"
|
|
multiple
|
|
placeholder="请选择所属角色"
|
|
@change="getCheckbox">
|
|
<!-- <el-option-->
|
|
<!-- v-for="(item,index) in roleList"-->
|
|
<!-- :key="index"-->
|
|
<!-- :label="item.dutyName"-->
|
|
<!-- :value="item.dutyId"-->
|
|
<!-- ></el-option>-->
|
|
<el-option label="加油员" :value="15+''" ></el-option>
|
|
<el-option label="收银员" :value="16+''" ></el-option>
|
|
<!-- :value="item.dutyId"-->
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="提成类型" prop="type">
|
|
<el-radio-group v-model="form.type" v-if="form.commissionSource == '车主加油'">
|
|
<el-radio v-for="dict in dict.type.comissionType" :label="dict.value">{{ dict.label }}</el-radio>
|
|
</el-radio-group>
|
|
<el-radio-group v-model="form.type" v-else>
|
|
<el-radio v-for="dict in dict.type.comissionType" v-if="dict.value!='payAmount'" :label="dict.value">{{ dict.label }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="消费条件" prop="meetCondition">
|
|
<el-input v-if="form.type == 'orderAmount'" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="form.meetCondition">
|
|
<template slot="prepend">订单金额消费满</template>
|
|
<template slot="append">元</template>
|
|
</el-input>
|
|
<el-input v-if="form.type == 'payAmount'" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="form.meetCondition">
|
|
<template slot="prepend">实际金额消费满</template>
|
|
<template slot="append">元</template>
|
|
</el-input>
|
|
<el-input v-if="form.type == 'refuleNum'" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" v-model="form.meetCondition">
|
|
<template slot="prepend">加油数量消费满</template>
|
|
<template slot="append">单位(升/立方)</template>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="提成金额" prop="royaltyRate">
|
|
<el-input v-model="form.royaltyRate" placeholder="请输入提成">
|
|
<el-select v-model="select" maxlength="10" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" style="width: 70px" slot="append" placeholder="请选择">
|
|
<el-option label="元" value="元"></el-option>
|
|
<el-option label="%" value="%"></el-option>
|
|
</el-select>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="方案状态" prop="status">
|
|
<el-radio-group v-model="form.status">
|
|
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
|
|
<el-drawer
|
|
title="库存跟踪"
|
|
:visible.sync="drawer"
|
|
direction="rtl"
|
|
size="60%"
|
|
:before-close="handleClose">
|
|
<div style="display: grid; place-items: center;">
|
|
<el-card class="box-card">
|
|
<el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" label-width="68px">
|
|
<el-form-item label="订单类型">
|
|
<el-select
|
|
v-model="queryParams2.type"
|
|
clearable
|
|
placeholder="全部"
|
|
>
|
|
<el-option label="油品订单提成" :value="1"></el-option>
|
|
<el-option label="商品订单提成" :value="2"></el-option>
|
|
<el-option label="储值卡充值提成" :value="3"></el-option>
|
|
<el-option label="油品退款" :value="4"></el-option>
|
|
<el-option label="商品退款" :value="5"></el-option>
|
|
<el-option label="囤油卡充值提成" :value="6"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="订单号">
|
|
<el-input v-model="queryParams2.orderNo" placeholder="请输入订单号"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="创建时间">
|
|
<el-date-picker
|
|
v-model="dateRange"
|
|
style="width: 240px"
|
|
size="medium"
|
|
value-format="yyyy-MM-dd"
|
|
type="daterange"
|
|
range-separator="-"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
></el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery1">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" @click="resetQuery1">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-card>
|
|
<el-card class="box-card" style="margin-top: 15px">
|
|
<div style="margin-top: 20px" v-if="activeName=='staffCommission'">
|
|
<el-table ref="tables" v-loading="loading" :data="commissionList">
|
|
<el-table-column type="index" width="80" align="center" label="序号"/>
|
|
<!-- <el-table-column label="员工信息" align="center">-->
|
|
<!-- <el-table-column label="姓名" prop="realName" align="center"/>-->
|
|
<!-- <el-table-column label="手机号" prop="mobile" align="center"/>-->
|
|
<!-- </el-table-column>-->
|
|
<el-table-column label="类型" prop="type" align="center" >
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.type==1">油品订单提成</span>
|
|
<span v-if="scope.row.type==2">商品订单提成</span>
|
|
<span v-if="scope.row.type==3">储值卡充值提成</span>
|
|
<span v-if="scope.row.type==4">油品退款</span>
|
|
<span v-if="scope.row.type==5">商品退款</span>
|
|
<span v-if="scope.row.type==6">囤油卡充值提成</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="提成金额(元)" prop="amount" align="center">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.amount || 0 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="关联订单号" prop="orderNo" align="center" width="260"/>
|
|
<el-table-column label="描述" prop="description" align="center"/>
|
|
<el-table-column label="创建时间" prop="createTime" align="center" width="160">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total2>0"
|
|
:total="total2"
|
|
:page.sync="queryParams2.page"
|
|
:limit.sync="queryParams2.pageSize"
|
|
@pagination="getCommissionList"
|
|
/>
|
|
</div>
|
|
</el-card>
|
|
</div>
|
|
</el-drawer>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
|
|
import {
|
|
addCommission, allAmountCommissionRecord, delCommission,
|
|
getCommission,
|
|
listCommission, listCommissionRecord, listStaffCommissionRecord,
|
|
queryCommission,
|
|
updateCommission
|
|
} from "@/api/staffCommission/staffcommission";
|
|
import {listDuty} from "@/api/staff/duty";
|
|
import {queryStaffs} from "@/api/order/staff";
|
|
|
|
export default {
|
|
dicts: ['source','role','zhzt','comissionType'],
|
|
data(){
|
|
return {
|
|
// 提成总额
|
|
allAmount:0,
|
|
changeCom:false,
|
|
activeName: 'oil',
|
|
select:"元",
|
|
commissionSource:[],
|
|
// 遮罩层
|
|
loading: true,
|
|
// 标题
|
|
title: "",
|
|
// 总条数
|
|
total: 0,
|
|
total1: 0,
|
|
total2: 0,
|
|
// 表格数据
|
|
list: [],
|
|
commissionList: [],
|
|
staffCommissionList: [],
|
|
// 是否显示修改对话框
|
|
open: false,
|
|
// 默认排序
|
|
defaultSort: {prop: 'updateTime', order: 'descending'},
|
|
// 查询参数
|
|
queryParams: {
|
|
page: 1,
|
|
pageSize: 10,
|
|
id: '',
|
|
name: '',
|
|
commissionSource:'油品'
|
|
},
|
|
queryParams1: {
|
|
page: 1,
|
|
pageSize: 10,
|
|
},
|
|
queryParams2: {
|
|
page: 1,
|
|
pageSize: 10,
|
|
},
|
|
// 弹出层
|
|
drawer: false,
|
|
staffList:[],
|
|
// 日期范围
|
|
dateRange: [],
|
|
// 表单参数
|
|
form: {
|
|
type:'orderAmount',
|
|
status:'qy'
|
|
},
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
roleList:[],
|
|
staffRoleGroup:[],
|
|
// 表单校验
|
|
rules: {
|
|
name: [
|
|
{ required: true, message: "提成方案名称不能为空", trigger: "blur" },
|
|
],
|
|
commissionSource: [
|
|
{ required: true, message: "请选择提成来源", trigger: "blur" },
|
|
],
|
|
staffRoleGroup: [
|
|
{ required: true, message: "请选择角色组", trigger: "blur" },
|
|
],
|
|
type: [
|
|
{ required: true, message: "请选择提成类型", trigger: "blur" },
|
|
],
|
|
meetCondition: [
|
|
{ required: true, message: "请填写提成消费条件", trigger: "blur" },
|
|
],
|
|
royaltyRate: [
|
|
{ required: true, message: "请填写提成金额/提成比例", trigger: "blur" },
|
|
],
|
|
// takeEffect: [
|
|
// { required: true, message: "请选择方案生效时间", trigger: "change" },
|
|
// ],
|
|
status: [
|
|
{ required: true, message: "请选择方案状态", trigger: "blur" },
|
|
],
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.getList();
|
|
this.getStaffList();
|
|
this.getDuty();
|
|
},
|
|
methods:{
|
|
getStaffCommissionList(){
|
|
this.loading = true
|
|
listStaffCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
|
|
this.staffCommissionList = res.data.records;
|
|
this.total1 = res.data.total;
|
|
this.loading = false
|
|
})
|
|
},
|
|
getStaffDuty(list,ids){
|
|
let id = ids.split(",")
|
|
let name = ""
|
|
let dutyName = ""
|
|
list.forEach(item => {
|
|
id.forEach(i => {
|
|
if (item.dutyId=i){
|
|
name = item.dutyName
|
|
dutyName += name +","
|
|
}
|
|
})
|
|
})
|
|
return name
|
|
},
|
|
getStaffList(){
|
|
queryStaffs().then( response => {
|
|
this.staffList = response.data;
|
|
})
|
|
},
|
|
// 查询角色列表
|
|
getDuty(){
|
|
listDuty().then(response => {
|
|
this.roleList = response.data
|
|
})
|
|
},
|
|
// 是否关闭弹框
|
|
handleClose(done) {
|
|
done();
|
|
},
|
|
// 点击标签页
|
|
handleClick(tab, event) {
|
|
if (this.activeName == 'oil'){
|
|
this.queryParams = {
|
|
page: 1,
|
|
pageSize: 10,
|
|
id: '',
|
|
name: '',
|
|
commissionSource:'油品'
|
|
};
|
|
this.getList();
|
|
}
|
|
if (this.activeName == 'nonOil') {
|
|
this.queryParams = {
|
|
page: 1,
|
|
pageSize: 10,
|
|
id: '',
|
|
name: '',
|
|
commissionSource:'非油品'
|
|
};
|
|
this.getList();
|
|
}
|
|
if (this.activeName == 'staffCommission') {
|
|
this.queryParams1 = {
|
|
page: 1,
|
|
pageSize: 10,
|
|
};
|
|
this.getStaffCommissionList();
|
|
}
|
|
},
|
|
// 查看详情
|
|
lookDetail(staffId){
|
|
this.drawer = true
|
|
this.queryParams2.staffId = staffId
|
|
this.getCommissionList()
|
|
},
|
|
getCheckbox(){
|
|
console.log(this.staffRoleGroup)
|
|
// this.form.commissionSource = this.commissionSource.toString()
|
|
this.form.staffRoleGroup = this.staffRoleGroup.toString()
|
|
},
|
|
// 查询列表
|
|
getList() {
|
|
this.loading = true;
|
|
listCommission(this.queryParams).then(response => {
|
|
this.list = response.data.records;
|
|
this.total = response.data.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
// 查询员工提成记录信息
|
|
getCommissionList(){
|
|
this.loading = true;
|
|
listCommissionRecord(this.addDateRange(this.queryParams2, this.dateRange)).then(res => {
|
|
this.commissionList = res.data.records;
|
|
this.total2 = res.data.total;
|
|
this.loading = false;
|
|
})
|
|
// allAmountCommissionRecord(this.addDateRange(this.queryParams1, this.dateRange)).then(res => {
|
|
// if (res.data){
|
|
// this.allAmount = res.data
|
|
// }
|
|
// })
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.resetForm("form");
|
|
this.staffRoleGroup = []
|
|
if (this.activeName == 'oil'){
|
|
this.form = {
|
|
type:'orderAmount',
|
|
status:'qy',
|
|
commissionSource:'储值卡充值'
|
|
};
|
|
}else {
|
|
this.form = {
|
|
type:'orderAmount',
|
|
status:'qy',
|
|
commissionSource:'非油品'
|
|
};
|
|
}
|
|
},
|
|
// 新增按钮操作
|
|
handleAdd() {
|
|
this.reset();
|
|
this.open = true;
|
|
this.title = "新增提成方案";
|
|
},
|
|
// 修改按钮操作
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
const id = row.id || this.ids;
|
|
getCommission(id).then(response => {
|
|
this.form = response.data;
|
|
// this.commissionSource = this.form.commissionSource.split(",")
|
|
// this.form.takeEffect = JSON.parse(this.form.takeEffect)
|
|
this.form.royaltyRate = this.form.royaltyRate.slice(0,this.form.royaltyRate.length-1)
|
|
this.open = true;
|
|
this.title = "编辑提成方案";
|
|
if (response.data.staffRoleGroup){
|
|
this.staffRoleGroup = response.data.staffRoleGroup.split(",");
|
|
}
|
|
});
|
|
},
|
|
|
|
// 搜索按钮操作
|
|
handleQuery() {
|
|
this.queryParams1.page = 1;
|
|
this.getStaffCommissionList();
|
|
},
|
|
// 搜索按钮操作
|
|
handleQuery1() {
|
|
this.queryParams1.page = 1;
|
|
this.getCommissionList();
|
|
},
|
|
// 重置按钮操作
|
|
resetQuery() {
|
|
this.dateRange = [];
|
|
this.queryParams1 = {
|
|
page: 1,
|
|
pageSize: 10,
|
|
}
|
|
// this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 重置按钮操作
|
|
resetQuery1() {
|
|
this.dateRange = [];
|
|
this.queryParams2 = {
|
|
page: 1,
|
|
pageSize: 10,
|
|
}
|
|
// this.resetForm("queryForm");
|
|
this.handleQuery1();
|
|
},
|
|
// 删除按钮操作
|
|
handleDelete(row) {
|
|
const name = row.name
|
|
this.$modal.confirm('确定删除"' + name + '"的提成方案信息?').then(function() {
|
|
return delCommission(row.id);
|
|
}).then(() => {
|
|
this.queryParams.page = 1
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {});
|
|
},
|
|
// 判断提成来源是否改变
|
|
isChange(){
|
|
this.changeCom = true;
|
|
},
|
|
add0(m){
|
|
return m<10?'0'+m:m
|
|
},
|
|
// 提交按钮
|
|
submitForm: function() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (/^\d+$/.test(this.form.royaltyRate)){
|
|
this.form.royaltyRate = this.form.royaltyRate + this.select
|
|
}
|
|
this.form.staffRoleGroup = this.staffRoleGroup.toString()
|
|
if (this.form.id) {
|
|
updateCommission(this.form).then(response => {
|
|
if (response.data==1){
|
|
this.$modal.msgSuccess("提成方案更新成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}else {
|
|
this.$modal.msgError("同一个角色组只能对应一个" + this.form.commissionSource + "提成方案")
|
|
}
|
|
});
|
|
} else {
|
|
addCommission(this.form).then(response => {
|
|
if (response.data==1) {
|
|
this.$modal.msgSuccess("提成方案新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
}else {
|
|
this.$modal.msgError("同一个角色组只能对应一个"+this.form.commissionSource+"提成方案")
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.id)
|
|
this.multiple = !selection.length
|
|
},
|
|
// 排序触发事件
|
|
handleSortChange(column, prop, order) {
|
|
this.queryParams.orderByColumn = column.prop;
|
|
this.queryParams.isAsc = column.order;
|
|
this.getList();
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.app-container{
|
|
width: 100%;
|
|
height: 100%;
|
|
background: #f6f8f9;
|
|
}
|
|
.clearfix{
|
|
width: 100%;
|
|
|
|
}
|
|
.box-card{
|
|
width: 100%;
|
|
margin-bottom: 15px;
|
|
}
|
|
.box-gang{
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.box{
|
|
width: 200px;
|
|
box-sizing: border-box;
|
|
padding: 10px;
|
|
background: #f9f9f9;
|
|
height: 86px;
|
|
margin-right: 10px;
|
|
}
|
|
.size-hui{
|
|
font-size: 14px;
|
|
margin-bottom: 10px;
|
|
margin-top: 10px;
|
|
}
|
|
.size-bole{
|
|
font-weight: bold;
|
|
}
|
|
</style>
|