smart-switch-ui/src/views/system/withdraw/index.vue
2024-08-05 15:42:58 +08:00

366 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="提现单号" prop="billNo">
<el-input
v-model="queryParams.billNo"
placeholder="请输入提现单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" clearable placeholder="请选择状态" @change="handleQuery">
<el-option v-for="dict in dict.type.withdraw_status" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="申请时间" prop="createDateRange">
<el-date-picker
v-model="queryParams.createDateRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleQuery"
/>
</el-form-item>
<el-form-item label="到账时间" prop="payDateRange">
<el-date-picker
v-model="queryParams.payDateRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleQuery"
/>
</el-form-item>
<el-form-item label="提现方式" prop="channelId">
<el-select v-model="queryParams.channelId" clearable placeholder="请选择提现方式" @change="handleQuery">
<el-option v-for="dict in dict.type.withdraw_channel" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="打款方式" prop="withdrawType">
<el-select v-model="queryParams.withdrawType" clearable placeholder="请选择打款方式" @change="handleQuery">
<el-option v-for="dict in dict.type.withdraw_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:bill:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="billList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="billId" width="80"/>
<el-table-column label="提现单号" align="center" prop="billNo" width="200">
<el-link slot-scope="d" @click="handleView(d.row)" type="primary">{{d.row.billNo}}</el-link>
</el-table-column>
<el-table-column label="申请时间" align="center" prop="createTime" width="180"/>
<el-table-column label="申请用户" align="center" prop="mchName" width="160">
<user-link slot-scope="d" :id="d.row.mchId" :name="d.row.mchName"/>
</el-table-column>
<el-table-column label="提现金额" align="center" min-width="100">
<template slot-scope="d">
{{d.row.money | money}} 元
</template>
</el-table-column>
<el-table-column label="到账金额" align="center" min-width="100">
<template slot-scope="d">
<span style="color: red">
{{d.row.arrivalAmount | money}} 元
</span>
</template>
</el-table-column>
<el-table-column label="服务费" align="center" min-width="100">
<template slot-scope="d">
{{d.row.serviceCharge | money}} 元
</template>
</el-table-column>
<el-table-column label="渠道成本" align="center" min-width="100">
<template slot-scope="d">
{{d.row.channelCost | money}} 元
</template>
</el-table-column>
<el-table-column label="到账时间" align="center" prop="payTime" width="180"/>
<el-table-column label="提现方式" align="center" prop="channelName">
<!-- <template slot-scope="d">-->
<!-- <dict-tag :value="d.row.channelId" :options="dict.type.channel_type"/>-->
<!-- </template>-->
</el-table-column>
<el-table-column label="打款方式" align="center">
<template slot-scope="d">
<dict-tag :value="d.row.withdrawType" :options="dict.type.withdraw_type"/>
</template>
</el-table-column>
<el-table-column label="交易状态" align="center">
<template slot-scope="d">
<dict-tag :value="d.row.status" :options="dict.type.withdraw_status"/>
</template>
</el-table-column>
<el-table-column label="审核意见" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="100">
<template slot-scope="scope">
<el-button
size="mini"
style="padding-left: 1em; padding-right: 1em;"
type="text"
icon="el-icon-view"
@click="handleView(scope.row)"
v-hasPermi="['system:bill:query']"
>详情</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- style="padding-left: 1em; padding-right: 1em;"-->
<!-- type="warning"-->
<!-- icon="el-icon-coin"-->
<!-- v-show="scope.row.status === '12'"-->
<!-- @click="handlePay(scope.row)"-->
<!-- v-hasPermi="['system:bill:pay']"-->
<!-- >打款</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-drawer
:with-header="false"
:visible.sync="showDetail"
direction="rtl"
size="800px"
destroy-on-close
>
<withdraw-detail :id="row.billId"/>
</el-drawer>
</div>
</template>
<script>
import {
listWithdraw,
getWithdraw,
delWithdraw,
addBill,
updateBill, payWithDrawBill
} from "@/api/system/withdraw";
import UserLink from '@/components/Business/SmUser/UserLink.vue'
import WithdrawDetail from '@/views/system/withdraw/detail.vue'
export default {
name: "Bill",
components: { WithdrawDetail, UserLink },
dicts: ['withdraw_status', 'withdraw_type', 'channel_type'],
data() {
return {
showDetail: false,
row: {},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 充值记录表格数据
billList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userName: null,
deviceName: null,
mchName: null,
type: "2", // 提现
orderByColumn: "createTime",
isAsc: "descending",
},
// 表单参数
form: {},
// 表单校验
rules: {
},
openApproval: false,
approvalForm: {
billId: null,
remark: null,
offlineImage: null
},
};
},
created() {
this.getList();
},
methods: {
// 查看详情
handleView(row) {
this.row = row;
this.showDetail = true;
},
// 处理打款
handlePay(row) {
if (row == null || row.billId == null) {
return this.$message.error("请选择一行后继续");
}
this.$confirm("确定打款吗", "打款", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
payWithDrawBill(row.billId).then(res => {
if (res.code !== 200) {
return this.$message.error(res.msg);
}
this.$message.success("操作成功正在打款");
this.getList();
})
})
},
// 处理审核
handleApproval(row) {
getWithdraw(row.billId).then(response => {
this.approvalForm = response.data;
this.openApproval = true;
});
},
/** 查询充值记录列表 */
getList() {
this.loading = true;
listWithdraw(this.queryParams).then(response => {
this.billList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
billId: null,
userId: null,
type: null,
deviceId: null,
landlordId: null,
money: null,
arrivalAmount: null,
serviceCharge: null,
createTime: null,
remark: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.billId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加充值记录";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const billId = row.billId || this.ids
getWithdraw(billId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改充值记录";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.billId != null) {
updateBill(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBill(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const billIds = row.billId || this.ids;
this.$modal.confirm('是否确认删除充值记录编号为"' + billIds + '"的数据项?').then(function() {
return delWithdraw(billIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/bill/export', {
...this.queryParams
}, `bill_${new Date().getTime()}.xlsx`)
}
}
};
</script>