Commit 8f9b3b7f by xuyl

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

1 parent 6c5b1c5c
......@@ -8,6 +8,10 @@ const profitApi = {
exportProfitList(data = {}) {
data.method = `${path}exportList`
return request(data)
},
verificationPoints(data = {}) {
data.method = `${path}exchange`
return request(data)
}
}
export { profitApi }
......@@ -94,7 +94,7 @@
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page[this.pageConf.pageNum]"
:page-sizes="[10,20,30,40]"
:page-sizes="pageSize"
:page-size="page[this.pageConf.pageSize]"
:total="getListApi ? total : tableTotal"
:layout="layout"
......@@ -125,6 +125,10 @@ export default {
type: Object,
default: () => {}
},
pageSize: {
type:Array,
default:()=>[10,20,30,40]
},
// 表格数据-外部传入
tableData: {
type: Array,
......@@ -220,7 +224,7 @@ export default {
},
mounted() {
this.page = {}
this.page[this.pageConf.pageSize] = 10
this.page[this.pageConf.pageSize] = this.pageSize[0]
this.page[this.pageConf.pageNum] = 1
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
......
......@@ -7,21 +7,21 @@
label-width="120px"
class="demo-form-inline"
>
<el-form-item label="员工名称">
<el-form-item label="员工名称:">
<el-input
clearable
v-model="profitSearchForm.staffName"
placeholder="请输入员工名称"
></el-input>
</el-form-item>
<el-form-item label="员工手机号">
<el-form-item label="员工手机号:">
<el-input
clearable
v-model="profitSearchForm.staffPhone"
placeholder="请输入员工手机号"
></el-input>
</el-form-item>
<el-form-item label="所属业务场景">
<el-form-item label="所属业务场景:">
<el-select
v-model="profitSearchForm.businessScene"
placeholder="所属业务场景"
......@@ -65,7 +65,38 @@
placeholder="请输入关联任务"
></el-input>
</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
value-format="yyyy-MM-dd"
v-model="profitSearchForm.rewardTime"
......@@ -76,6 +107,17 @@
>
</el-date-picker>
</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-button type="primary" @click="handleSearch">查询 </el-button>
<el-button @click="reset">重置</el-button>
......@@ -93,6 +135,8 @@ export default {
profitSearchForm: {
businessScene: '',
channel: '',
isWithdrawal:'',
exchangeStatus:''
},
}
},
......
<template>
<div style="margin: 16px">
<ProfitSearch @sendSearchForm="getSearchForm" />
<el-button type="primary" size="small" @click="handleOutput"
>导出</el-button
<div style='margin: 16px'>
<ProfitSearch @sendSearchForm='getSearchForm' />
<el-button type='primary' size='small' @click='handleOutput'
>导出
</el-button
>
<div class="cumulativeAward">累计发放奖励:{{ totalScore }}</div>
<el-button
size='small'
type='primary'
@click='handleWriteOff()'
>批量核销
</el-button
>
<div class='cumulativeAward'>累计发放奖励:{{ totalScore }}</div>
<d2-table
class="my-row-height"
ref="profitTable"
:hasNum="true"
@sendAlldata="getTotalScore"
:tableParams="profitTableParams"
:searchForm="profitSearchForm"
:getListApi="getListApi"
:pageConf="pageConf"
class='my-row-height'
ref='profitTable'
:hasNum='true'
@sendAlldata='getTotalScore'
:tableParams='profitTableParams'
:searchForm='profitSearchForm'
:getListApi='getListApi'
: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 == '1'">1.1 新车精品升级</span>
<span v-if="scope.scope.businessScene == '2'">1.2 新车膨胀金活动</span>
<span v-if="scope.scope.businessScene == '3'"
>1.3 售后直播众筹活动</span
>1.3 售后直播众筹活动</span
>
</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 == '2'">门店</span>
<span v-if="scope.scope.channel == '3'">服务商</span>
</div>
</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>
</template>
......@@ -36,74 +65,162 @@
import ProfitSearch from '@/views/profitManagement/profitList/cpns/ProfitSearch'
import { profitApi } from '@/api/profitManagement'
import { withdrawalApi } from '@/api/withdrawalManagement'
export default {
name: 'WithdrawalSearch',
components: {
ProfitSearch,
ProfitSearch
},
data() {
return {
processArray: [],
writeOffData: {
numberOfStores: '',
employeeCount: '',
totalPoints: ''
},
profitSearchForm: {},
dialogVisible: false,
totalScore: '',
choiceData: [],
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count',
totalCount: 'data.count'
},
getListApi: profitApi.searchProfitList,
profitTableParams: {
mutiSelectUniqueKey: 'id',
mutiSelectName: 'list',
listName: 'data.data',
tableColumns: [
{
label: '员工名称',
prop: 'staffName',
prop: 'staffName'
},
{
label: '员工手机号',
prop: 'staffPhone',
prop: 'staffPhone'
},
{
label: '奖励积分值',
prop: 'rewardScore',
prop: 'rewardScore'
},
{
label: '支持积分提现',
prop: 'isWithdrawal',
addHtml: 'isWithdrawal'
},
{
label: '核销状态',
prop: 'exchangeStatus',
addHtml: 'exchangeStatus'
},
{
label: '核销人',
prop: 'exchangeStaff'
},
{
label: '核销时间',
prop: 'exchangeTime'
},
{
label: '关联任务',
prop: 'missionName',
prop: 'missionName'
},
{
label: '发放渠道',
prop: 'channel',
addHtml: 'channel',
addHtml: 'channel'
},
{
label: '所属活动/产品',
prop: 'activityName',
prop: 'activityName'
},
{
label: '所属商户',
prop: 'merchantName',
prop: 'merchantName'
},
{
label: '所属业务场景',
prop: 'businessScene',
addHtml: 'businessScene',
addHtml: 'businessScene'
},
{
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
},
// 导出
handleOutput() {
let params = JSON.parse(JSON.stringify(this.profitSearchForm))
let pageConfig = {
pageSize: 9999,
pageNum: 1,
pageNum: 1
}
profitApi.exportProfitList({ ...params, ...pageConfig }).then((res) => {
if (res.code == 0) {
......@@ -111,7 +228,7 @@ export default {
} else {
this.$message({
type: 'error',
message: '导出失败!',
message: '导出失败!'
})
}
})
......@@ -124,6 +241,13 @@ export default {
}
if (params.rewardTime && params.rewardTime.length)
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
setTimeout(() => {
this.$refs.profitTable.refreshTable(false, true)
......@@ -132,8 +256,8 @@ export default {
getTotalScore(val) {
let { totalScore } = val
this.totalScore = totalScore
},
},
}
}
}
</script>
......@@ -141,6 +265,12 @@ export default {
.cumulativeAward {
margin: 16px 0;
}
.verificationPoints {
font-size: 16px;
font-weight: 600;
}
.my-row-height >>> .el-table__body-wrapper .el-table__row {
height: 48px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!