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