Commit 745b8482 by 前端

Merge branch 'xuyl_dev_v3.2.0' into 'v3.2.0'

防抖

See merge request !81
2 parents 9f0e2d27 9bb7c329
export default function debounce(fn, delay) {
var t = null
return function() {
if (t) {
clearTimeout(t)
}
t = setTimeout(() => {
fn.apply(this, arguments)
}, delay)
}
}
......@@ -53,7 +53,7 @@
</div>
<span slot='footer' class='dialog-footer'>
<el-button @click='dialogVisible = false'>取 消</el-button>
<el-button type='primary' @click='comfirmDialog'
<el-button type='primary' @click='handleDebounce'
>确 定</el-button
>
</span>
......@@ -63,9 +63,9 @@
<script>
import ProfitSearch from '@/views/profitManagement/profitList/cpns/ProfitSearch'
import debounce from '@/utils/debounce'
import { profitApi } from '@/api/profitManagement'
import { withdrawalApi } from '@/api/withdrawalManagement'
export default {
name: 'WithdrawalSearch',
......@@ -85,7 +85,7 @@ export default {
dialogVisible: false,
totalScore: '',
choiceData: [],
choiceDataBack:[],
choiceDataBack: [],
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
......@@ -154,7 +154,8 @@ export default {
prop: 'exchangeStaff'
}
]
}
},
timeout:null
}
},
methods: {
......@@ -169,7 +170,7 @@ export default {
}
this.verificationWriteOff = this.choiceData.every(item => {
if (!item.isWithdrawal || item.isWithdrawal == '1' || item.exchangeStatus == '1') {
return false
return false
} else {
return true
}
......@@ -206,23 +207,26 @@ export default {
return { exchangeStatus, staffPhone, merchantName, isWithdrawal, rewardScore, id }
})
},
async comfirmDialog() {
let arr = []
this.choiceDataBack && this.choiceDataBack.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
this.$refs.profitSearch.reset()
} else {
this.$message.error('积分核销失败')
}
}).catch(err => {
this.$message.error(err)
})
this.dialogVisible = false
},
handleDebounce:debounce(
async function(){
let arr = []
this.choiceDataBack && this.choiceDataBack.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
this.$refs.profitSearch.reset()
} else {
this.$message.error('积分核销失败')
}
}).catch(err => {
this.$message.error(err)
})
this.dialogVisible = false
},
1000
),
// 导出
handleOutput() {
let params = JSON.parse(JSON.stringify(this.profitSearchForm))
......@@ -262,7 +266,7 @@ export default {
}, 500)
},
reset() {
if (this.choiceData){
if (this.choiceData) {
this.$refs.profitTable.mutiSelectArr.list = []
this.$refs.profitTable.$children[0].clearSelection()
}
......
......@@ -3,7 +3,7 @@
<div v-html='textTooltip'></div>
<span slot='footer' class='dialog-footer'>
<el-button @click='dialogVisible = false'>取 消</el-button>
<el-button type='primary' @click='comfirmDialog()'
<el-button type='primary' @click='handleDebounce'
>确 定</el-button
>
</span>
......@@ -12,6 +12,8 @@
<script>
import { withdrawalApi } from '@/api/withdrawalManagement'
import debounce from '@/utils/debounce'
import { profitApi } from '@/api/profitManagement'
export default {
name: 'WithdrawalDialog',
......@@ -22,24 +24,27 @@ export default {
}
},
methods: {
async comfirmDialog() {
const params = {
...JSON.parse(JSON.stringify(
{ idList: this.auditId }
))
}
await withdrawalApi.batchWithdrawal(params).then(res => {
if (res.code !== '0'){
this.$message.error('审核失败')
}else{
this.$message.success('审核成功')
handleDebounce:debounce(
async function(){
const params = {
...JSON.parse(JSON.stringify(
{ idList: this.auditId }
))
}
}).catch(err=>{
this.$message.error(err)
}
)
this.dialogVisible = false
}
await withdrawalApi.batchWithdrawal(params).then(res => {
if (res.code !== '0'){
this.$message.error('审核失败')
}else{
this.$message.success('审核成功')
}
}).catch(err=>{
this.$message.error(err)
}
)
this.dialogVisible = false
},
1000
),
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!