Commit 8f9b3b7f by xuyl

收益管理核销积分开发,修改table组件

1 parent 6c5b1c5c
...@@ -8,6 +8,10 @@ const profitApi = { ...@@ -8,6 +8,10 @@ const profitApi = {
exportProfitList(data = {}) { exportProfitList(data = {}) {
data.method = `${path}exportList` data.method = `${path}exportList`
return request(data) return request(data)
},
verificationPoints(data = {}) {
data.method = `${path}exchange`
return request(data)
} }
} }
export { profitApi } export { profitApi }
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="page[this.pageConf.pageNum]" :current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]" :page-sizes="pageSize"
:page-size="page[this.pageConf.pageSize]" :page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal" :total="getListApi ? total : tableTotal"
:layout="layout" :layout="layout"
...@@ -125,6 +125,10 @@ export default { ...@@ -125,6 +125,10 @@ export default {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
pageSize: {
type:Array,
default:()=>[10,20,30,40]
},
// 表格数据-外部传入 // 表格数据-外部传入
tableData: { tableData: {
type: Array, type: Array,
...@@ -220,7 +224,7 @@ export default { ...@@ -220,7 +224,7 @@ export default {
}, },
mounted() { mounted() {
this.page = {} this.page = {}
this.page[this.pageConf.pageSize] = 10 this.page[this.pageConf.pageSize] = this.pageSize[0]
this.page[this.pageConf.pageNum] = 1 this.page[this.pageConf.pageNum] = 1
const btn = document.getElementById(this.tableParams.btnId) const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit) btn && btn.addEventListener('click', this.refreshEmit)
......
...@@ -7,21 +7,21 @@ ...@@ -7,21 +7,21 @@
label-width="120px" label-width="120px"
class="demo-form-inline" class="demo-form-inline"
> >
<el-form-item label="员工名称"> <el-form-item label="员工名称:">
<el-input <el-input
clearable clearable
v-model="profitSearchForm.staffName" v-model="profitSearchForm.staffName"
placeholder="请输入员工名称" placeholder="请输入员工名称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="员工手机号"> <el-form-item label="员工手机号:">
<el-input <el-input
clearable clearable
v-model="profitSearchForm.staffPhone" v-model="profitSearchForm.staffPhone"
placeholder="请输入员工手机号" placeholder="请输入员工手机号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="所属业务场景"> <el-form-item label="所属业务场景:">
<el-select <el-select
v-model="profitSearchForm.businessScene" v-model="profitSearchForm.businessScene"
placeholder="所属业务场景" placeholder="所属业务场景"
...@@ -65,7 +65,38 @@ ...@@ -65,7 +65,38 @@
placeholder="请输入关联任务" placeholder="请输入关联任务"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="奖励时间"> <el-form-item label="发放渠道:">
<el-select
v-model="profitSearchForm.channel"
placeholder="请选择发放渠道"
>
<el-option label="全部" value=""></el-option>
<el-option label="广联" value="1"></el-option>
<el-option label="门店" value="2"></el-option>
<el-option label="服务商" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="支持积分提现:">
<el-select
v-model="profitSearchForm.isWithdrawal"
placeholder="请选择是否支持积分提现"
>
<el-option label="全部" value=""></el-option>
<el-option label="是" value="1"></el-option>
<el-option label="否" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="核销状态:">
<el-select
v-model="profitSearchForm.exchangeStatus"
placeholder="请选择核销状态"
>
<el-option label="全部" value=""></el-option>
<el-option label="是" value="1"></el-option>
<el-option label="否" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="奖励时间:">
<el-date-picker <el-date-picker
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
v-model="profitSearchForm.rewardTime" v-model="profitSearchForm.rewardTime"
...@@ -76,6 +107,17 @@ ...@@ -76,6 +107,17 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="核销时间:">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="profitSearchForm.exchangeTime"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">查询 </el-button> <el-button type="primary" @click="handleSearch">查询 </el-button>
<el-button @click="reset">重置</el-button> <el-button @click="reset">重置</el-button>
...@@ -93,6 +135,8 @@ export default { ...@@ -93,6 +135,8 @@ export default {
profitSearchForm: { profitSearchForm: {
businessScene: '', businessScene: '',
channel: '', channel: '',
isWithdrawal:'',
exchangeStatus:''
}, },
} }
}, },
......
<template> <template>
<div style="margin: 16px"> <div style='margin: 16px'>
<ProfitSearch @sendSearchForm="getSearchForm" /> <ProfitSearch @sendSearchForm='getSearchForm' />
<el-button type="primary" size="small" @click="handleOutput" <el-button type='primary' size='small' @click='handleOutput'
>导出</el-button >导出
</el-button
> >
<div class="cumulativeAward">累计发放奖励:{{ totalScore }}</div> <el-button
size='small'
type='primary'
@click='handleWriteOff()'
>批量核销
</el-button
>
<div class='cumulativeAward'>累计发放奖励:{{ totalScore }}</div>
<d2-table <d2-table
class="my-row-height" class='my-row-height'
ref="profitTable" ref='profitTable'
:hasNum="true" :hasNum='true'
@sendAlldata="getTotalScore" @sendAlldata='getTotalScore'
:tableParams="profitTableParams" :tableParams='profitTableParams'
:searchForm="profitSearchForm" :searchForm='profitSearchForm'
:getListApi="getListApi" :getListApi='getListApi'
:pageConf="pageConf" :pageConf='pageConf'
:pageSize='[20,50,100,200,500]'
> >
<div slot="businessScene" slot-scope="scope"> <div slot='isWithdrawal' slot-scope='scope'>
{{ scope.scope.isWithdrawal == '1' ? '否' : scope.scope.isWithdrawal == '2' ? '是' : '' }}
</div>
<div slot='exchangeStatus' slot-scope='scope'>
{{ scope.scope.exchangeStatus == '1' ? '未核销' : scope.scope.exchangeStatus == '2' ? '已核销' : '' }}
</div>
<div slot='businessScene' slot-scope='scope'>
<span v-if="scope.scope.businessScene == '0'">1.0 新车权益升级</span> <span v-if="scope.scope.businessScene == '0'">1.0 新车权益升级</span>
<span v-if="scope.scope.businessScene == '1'">1.1 新车精品升级</span> <span v-if="scope.scope.businessScene == '1'">1.1 新车精品升级</span>
<span v-if="scope.scope.businessScene == '2'">1.2 新车膨胀金活动</span> <span v-if="scope.scope.businessScene == '2'">1.2 新车膨胀金活动</span>
...@@ -23,12 +38,26 @@ ...@@ -23,12 +38,26 @@
>1.3 售后直播众筹活动</span >1.3 售后直播众筹活动</span
> >
</div> </div>
<div slot="channel" slot-scope="scope"> <div slot='channel' slot-scope='scope'>
<span v-if="scope.scope.channel == '1'">广联</span> <span v-if="scope.scope.channel == '1'">广联</span>
<span v-if="scope.scope.channel == '2'">门店</span> <span v-if="scope.scope.channel == '2'">门店</span>
<span v-if="scope.scope.channel == '3'">服务商</span> <span v-if="scope.scope.channel == '3'">服务商</span>
</div> </div>
</d2-table> </d2-table>
<el-dialog title='提示' :visible.sync='dialogVisible' width='30%'>
<div class='verificationPoints'>核销积分确认,核销后积分不可恢复</div>
<div>
<p>涉及门店:{{ writeOffData.numberOfStores }}家</p>
<p>涉及员工数:{{ writeOffData.employeeCount }}人</p>
<p>核销积分总分:{{ writeOffData.totalPoints }}</p>
</div>
<span slot='footer' class='dialog-footer'>
<el-button @click='dialogVisible = false'>取 消</el-button>
<el-button type='primary' @click='comfirmDialog'
>确 定</el-button
>
</span>
</el-dialog>
</div> </div>
</template> </template>
...@@ -36,74 +65,162 @@ ...@@ -36,74 +65,162 @@
import ProfitSearch from '@/views/profitManagement/profitList/cpns/ProfitSearch' import ProfitSearch from '@/views/profitManagement/profitList/cpns/ProfitSearch'
import { profitApi } from '@/api/profitManagement' import { profitApi } from '@/api/profitManagement'
import { withdrawalApi } from '@/api/withdrawalManagement'
export default { export default {
name: 'WithdrawalSearch', name: 'WithdrawalSearch',
components: { components: {
ProfitSearch, ProfitSearch
}, },
data() { data() {
return { return {
processArray: [],
writeOffData: {
numberOfStores: '',
employeeCount: '',
totalPoints: ''
},
profitSearchForm: {}, profitSearchForm: {},
dialogVisible: false,
totalScore: '', totalScore: '',
choiceData: [],
pageConf: { pageConf: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageNum: 'pageNum', pageNum: 'pageNum',
totalCount: 'data.count', totalCount: 'data.count'
}, },
getListApi: profitApi.searchProfitList, getListApi: profitApi.searchProfitList,
profitTableParams: { profitTableParams: {
mutiSelectUniqueKey: 'id',
mutiSelectName: 'list',
listName: 'data.data', listName: 'data.data',
tableColumns: [ tableColumns: [
{ {
label: '员工名称', label: '员工名称',
prop: 'staffName', prop: 'staffName'
}, },
{ {
label: '员工手机号', label: '员工手机号',
prop: 'staffPhone', prop: 'staffPhone'
}, },
{ {
label: '奖励积分值', label: '奖励积分值',
prop: 'rewardScore', prop: 'rewardScore'
},
{
label: '支持积分提现',
prop: 'isWithdrawal',
addHtml: 'isWithdrawal'
},
{
label: '核销状态',
prop: 'exchangeStatus',
addHtml: 'exchangeStatus'
},
{
label: '核销人',
prop: 'exchangeStaff'
},
{
label: '核销时间',
prop: 'exchangeTime'
}, },
{ {
label: '关联任务', label: '关联任务',
prop: 'missionName', prop: 'missionName'
}, },
{ {
label: '发放渠道', label: '发放渠道',
prop: 'channel', prop: 'channel',
addHtml: 'channel', addHtml: 'channel'
}, },
{ {
label: '所属活动/产品', label: '所属活动/产品',
prop: 'activityName', prop: 'activityName'
}, },
{ {
label: '所属商户', label: '所属商户',
prop: 'merchantName', prop: 'merchantName'
}, },
{ {
label: '所属业务场景', label: '所属业务场景',
prop: 'businessScene', prop: 'businessScene',
addHtml: 'businessScene', addHtml: 'businessScene'
}, },
{ {
label: '奖励时间', label: '奖励时间',
prop: 'rewardTime', prop: 'rewardTime'
}
]
}
}
},
methods: {
handleWriteOff() {
this.getSeletedData()
if (this.choiceData && this.choiceData.length == '0') {
this.$message({
type: 'error',
message: '请勾选需要核销的积分记录!'
})
return
}
this.choiceData.forEach(item => {
if (item.isWithdrawal == '2' || item.exchangeStatus == '2') {
this.$message({
type: 'error',
message: '所选中的积分记录包含「是否积分提现=否」或「核销状态=已核销」,请剔除后再进行操作!'
})
return
}
})
this.processSelectedData()
this.dialogVisible = true
},
processSelectedData() {
let obj = {}
let numberOfStoresArr = []
let totalPoints = 0
this.processArray = this.choiceData.reduce((curr, next) => {
obj[next.staffPhone] ? '' : obj[next.staffPhone] = curr.push(next)
numberOfStoresArr.includes(next.merchantName) ? '' : numberOfStoresArr.push((next.merchantName))
console.log(totalPoints)
next.rewardScore ? totalPoints += next.rewardScore : totalPoints += 0
return curr
}, [])
this.$set(this.writeOffData, 'numberOfStores', numberOfStoresArr.length)
this.$set(this.writeOffData, 'totalPoints', totalPoints.toFixed(2))
this.$set(this.writeOffData, 'employeeCount', this.processArray.length)
}, },
], getSeletedData() {
this.choiceData = this.$refs.profitTable.mutiSelectArr.list &&
this.$refs.profitTable.mutiSelectArr.list.map(item => {
let { exchangeStatus, staffPhone, merchantName, isWithdrawal, rewardScore, id } = item
return { exchangeStatus, staffPhone, merchantName, isWithdrawal, rewardScore, id }
})
}, },
async comfirmDialog() {
let arr = []
this.processArray && this.processArray.forEach(item => arr.push(item.id))
const params = { idList: arr }
await profitApi.verificationPoints({ params }).then(res => {
if (res.code == '0') {
this.$message.success('积分核销成功')
this.dialogVisible = false
} else {
this.$message.error('积分核销失败')
} }
}).catch(err => {
this.$message.error('积分核销失败')
})
this.dialogVisible = false
}, },
methods: {
// 导出 // 导出
handleOutput() { handleOutput() {
let params = JSON.parse(JSON.stringify(this.profitSearchForm)) let params = JSON.parse(JSON.stringify(this.profitSearchForm))
let pageConfig = { let pageConfig = {
pageSize: 9999, pageSize: 9999,
pageNum: 1, pageNum: 1
} }
profitApi.exportProfitList({ ...params, ...pageConfig }).then((res) => { profitApi.exportProfitList({ ...params, ...pageConfig }).then((res) => {
if (res.code == 0) { if (res.code == 0) {
...@@ -111,7 +228,7 @@ export default { ...@@ -111,7 +228,7 @@ export default {
} else { } else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '导出失败!', message: '导出失败!'
}) })
} }
}) })
...@@ -124,6 +241,13 @@ export default { ...@@ -124,6 +241,13 @@ export default {
} }
if (params.rewardTime && params.rewardTime.length) if (params.rewardTime && params.rewardTime.length)
delete params.rewardTime delete params.rewardTime
if (params && params.exchangeTime) {
params.exchangeBeginTime = params.exchangeTime[0]
params.exchangeEndTime = params.exchangeTime[1]
}
if (params.exchangeTime && params.exchangeTime.length)
delete params.exchangeTime
this.profitSearchForm = params this.profitSearchForm = params
setTimeout(() => { setTimeout(() => {
this.$refs.profitTable.refreshTable(false, true) this.$refs.profitTable.refreshTable(false, true)
...@@ -132,8 +256,8 @@ export default { ...@@ -132,8 +256,8 @@ export default {
getTotalScore(val) { getTotalScore(val) {
let { totalScore } = val let { totalScore } = val
this.totalScore = totalScore this.totalScore = totalScore
}, }
}, }
} }
</script> </script>
...@@ -141,6 +265,12 @@ export default { ...@@ -141,6 +265,12 @@ export default {
.cumulativeAward { .cumulativeAward {
margin: 16px 0; margin: 16px 0;
} }
.verificationPoints {
font-size: 16px;
font-weight: 600;
}
.my-row-height >>> .el-table__body-wrapper .el-table__row { .my-row-height >>> .el-table__body-wrapper .el-table__row {
height: 48px; height: 48px;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!