管理后台增加分佣查询
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export async function pageCmmssn(params) {
|
||||
const res = await request.get('/cmmssn/cmmssn/page', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param params 查询条件
|
||||
*/
|
||||
export async function exportCmmssn(params) {
|
||||
const res = await request.get('/cmmssn/cmmssn/export', {
|
||||
params
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export async function updateCmmssnSend(data) {
|
||||
const res = await request.put('/cmmssn/cmmssn', data);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<el-form
|
||||
label-width="77px"
|
||||
class="ele-form-search"
|
||||
@keyup.enter.native="search"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<el-row :gutter="15">
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-form-item label="坐席:">
|
||||
<el-input clearable v-model="where.username" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-form-item label="类型:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.type"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="线索" :value="1"/>
|
||||
<el-option label="订单" :value="2"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<el-form-item label="是否发放:">
|
||||
<el-select
|
||||
clearable
|
||||
v-model="where.ifSend"
|
||||
placeholder="请选择"
|
||||
class="ele-fluid"
|
||||
>
|
||||
<el-option label="否" :value="0"/>
|
||||
<el-option label="是" :value="1"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
||||
<div class="ele-form-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
class="ele-btn-icon"
|
||||
@click="search"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button @click="reset">重置</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
username: '',
|
||||
type: '',
|
||||
ifSend: ''
|
||||
}
|
||||
return {
|
||||
// 表单数据
|
||||
where: { ...defaultWhere }
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where)
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere }
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,221 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<el-card shadow="never">
|
||||
<!-- 搜索表单 -->
|
||||
<cmmssn-search @search="reload"/>
|
||||
<!-- 数据表格 -->
|
||||
<ele-pro-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:selection.sync="selection"
|
||||
cache-key="systemUserTable"
|
||||
>
|
||||
<!-- 表头工具栏 -->
|
||||
<template v-slot:toolbar>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="el-icon-download"
|
||||
class="ele-btn-icon"
|
||||
@click="exportData"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 操作列 -->
|
||||
<template v-slot:action="{ row }">
|
||||
<el-link
|
||||
v-if="row.ifSend!=='1'"
|
||||
type="primary"
|
||||
:underline="false"
|
||||
@click="setSend(row)"
|
||||
>
|
||||
标记已发放
|
||||
</el-link>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CmmssnSearch from './components/cmmssn-search.vue'
|
||||
import { pageCmmssn, exportCmmssn, updateCmmssnSend } from '@/api/cmmssn/cmmssn'
|
||||
import { utils, writeFile } from 'xlsx'
|
||||
|
||||
export default {
|
||||
name: 'cmmssn',
|
||||
components: { CmmssnSearch },
|
||||
data() {
|
||||
return {
|
||||
// 表格列配置
|
||||
columns: [
|
||||
{
|
||||
prop: 'mobile',
|
||||
label: '线索',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
showOverflowTooltip: true,
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'bizName',
|
||||
label: '解锁门店',
|
||||
showOverflowTooltip: true,
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'centerName',
|
||||
label: '中心',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'orgName',
|
||||
label: '机构',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'userName',
|
||||
label: '坐席',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'userCode',
|
||||
label: '坐席工号',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'typeCn',
|
||||
label: '类型',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'unlockTime',
|
||||
label: '解锁时间',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
align: 'center',
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'orderTime',
|
||||
label: '订单时间',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 110,
|
||||
align: 'center',
|
||||
formatter: (_row, _column, cellValue) => {
|
||||
return this.$util.toDateString(cellValue)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'money',
|
||||
label: '佣金',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
resizable: false,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'sendCn',
|
||||
label: '是否发放',
|
||||
showOverflowTooltip: true,
|
||||
minWidth: 80,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
columnKey: 'action',
|
||||
label: '操作',
|
||||
width: 100,
|
||||
align: 'center',
|
||||
resizable: false,
|
||||
slot: 'action',
|
||||
showOverflowTooltip: true,
|
||||
fixed: 'right'
|
||||
}
|
||||
],
|
||||
// 表格选中数据
|
||||
selection: [],
|
||||
// 当前编辑数据
|
||||
current: null,
|
||||
// 是否显示编辑弹窗
|
||||
showEdit: false,
|
||||
// 是否显示导入弹窗
|
||||
showImport: false,
|
||||
title: '用户佣金'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 表格数据源 */
|
||||
datasource({ page, limit, where, order }) {
|
||||
return pageCmmssn({ ...where, ...order, page, limit })
|
||||
},
|
||||
/* 刷新表格 */
|
||||
reload(where) {
|
||||
this.$refs.table.reload({ page: 1, where: where })
|
||||
},
|
||||
/* 打开编辑弹窗 */
|
||||
openEdit(row) {
|
||||
this.current = row
|
||||
this.showEdit = true
|
||||
},
|
||||
exportData() {
|
||||
const loading = this.$loading({ lock: true })
|
||||
this.$refs.table.doRequest(({ where, order }) => {
|
||||
exportCmmssn({ ...where, ...order })
|
||||
.then((data) => {
|
||||
loading.close()
|
||||
const array = [data.columns]
|
||||
data.list.forEach((d) => {
|
||||
let arrayItem = []
|
||||
for (let key in d) {
|
||||
arrayItem.push(d[key])
|
||||
}
|
||||
array.push(arrayItem)
|
||||
})
|
||||
writeFile(
|
||||
{
|
||||
SheetNames: ['Sheet1'],
|
||||
Sheets: {
|
||||
Sheet1: utils.aoa_to_sheet(array)
|
||||
}
|
||||
},
|
||||
this.title + '.xlsx'
|
||||
)
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.close()
|
||||
this.$message.error(e.message)
|
||||
})
|
||||
})
|
||||
},
|
||||
setSend(row) {
|
||||
this.$confirm('确定要标记【' + row['mobile'] + '】已发放吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
updateCmmssnSend({ id: row.id }).then((res) => {
|
||||
this.$message.success(res)
|
||||
this.reload()
|
||||
}).catch((e) => {
|
||||
this.$message.error(e.message)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user