diff --git a/src/api/interceptor.ts b/src/api/interceptor.ts index d0caade..6fa2e5d 100644 --- a/src/api/interceptor.ts +++ b/src/api/interceptor.ts @@ -43,7 +43,7 @@ axios.interceptors.response.use( // if the custom code is not 20000, it is judged as an error. if (res.code !== 200) { Message.error({ - content: res.message || 'Error', + content: res.msg || res.message || 'Error', duration: 5 * 1000, }); // console.log(response.status) diff --git a/src/views/withdraw/index.vue b/src/views/withdraw/index.vue index 169b039..53129d1 100644 --- a/src/views/withdraw/index.vue +++ b/src/views/withdraw/index.vue @@ -75,7 +75,8 @@ <a-table-column title="订单编号" data-index="order_number"></a-table-column> <a-table-column title="操作"> <template #cell="{ record }"> - <a-button v-if="record.status == '1'" @click="showConfirm(record)">审批</a-button> + <a-button @click="handleNotBlock(record)">拒绝</a-button> + <a-button @click="handleBlock(record)">同意</a-button> </template> </a-table-column> </template> @@ -154,51 +155,54 @@ const handleTableChange = (page:number) => { queryParams.value.current = page; getAll(); }; -// const handleTableChange = (current) => { - // const pager = { ...pagination }; - // pager.current = pag.current; - // pagination.current = pager.current; - // console.log(current) - // queryParams.value.current = pagination.current; - // queryParams.value.pageSize = pagination.pageSize; - // getAll(); -// } -const showConfirm = (record) => { - Modal.confirm({ - title: '操作提醒', - content: '是否同意该用户的提现申请', - okText: '同意', - cancelText: '拒绝', - onOk: () => handleBlock(record), - onCancel: () => handleNotBlock(record), - }); -}; - //同意提现 const handleBlock = async(record:any) => { - record.type = 0; - const res = await pushMoney(record); - if(res.code === 200 ){ - reset(); - - Message.success(res.data.message) - }else{ - Message.success(res.data.message) - } - getAll(); + Modal.confirm({ + title: '操作提醒', + content: '是否确认该选择', + okText: '确认', + cancelText: '取消', + onOk: async () => { + record.type = 0; + const res = await pushMoney(record); + if (res.code === 200) { + reset(); + Message.success('操作成功'); + } else { + reset(); + Message.error('操作失败'); + } + }, + onCancel: () => { + // 用户点击取消按钮时的操作(可选) + Message.info('操作已取消'); + } + }); }; //不同意提现 const handleNotBlock = async(record:any) => { - record.type = 1; - const res = await pushMoney(record); - if(res.code === 200 ){ - reset(); - - Message.success(res.data.message) - } - Message.error(res.data.message) - getAll(); + Modal.confirm({ + title: '操作提醒', + content: '是否确认该选择', + okText: '确认', + cancelText: '取消', + onOk: async () => { + record.type = 1; + const res = await pushMoney(record); + if (res.code === 200) { + reset(); + Message.success('操作成功'); + } else { + reset(); + Message.error('操作失败'); + } + }, + onCancel: () => { + // 用户点击取消按钮时的操作(可选) + Message.info('操作已取消'); + } + }); }; //显示合计