Commit 5c778d43 authored by pengyunqian's avatar pengyunqian

update:转换配送工具

parent fae1369a
......@@ -60,7 +60,7 @@
<el-dialog
title="添加配送员"
v-model="dialogFormAdd"
width="40%"
width="70%"
:show-close="false"
>
<el-form class="dioFor" :model="addDeliverer" :rules="rules">
......@@ -130,7 +130,7 @@
<el-dialog
title="分配配送员"
v-model="dialogFormAssign"
width="40%"
width="70%"
:show-close="false"
>
<el-form class="dioFor">
......@@ -150,14 +150,14 @@
class="diotab"
align="center"
:data="deliverer"
max-height="200"
max-height="300"
border
size="small"
style="width: 100%"
@selection-change="selectGoodsChange"
>
<el-table-column
width="80"
width="60"
align="center"
type="selection"
>
......@@ -166,29 +166,29 @@
align="center"
prop="deliverer_name"
label="配送员姓名"
width="100"
>
</el-table-column>
<el-table-column
align="center"
prop="deliverer_max_capacity"
label="配送上限"
width="100"
width="130"
>
</el-table-column>
<el-table-column
align="center"
prop="deliverer_min_capacity"
label="最少配送量"
width="100"
>
</el-table-column>
<el-table-column
align="center"
prop="deliverer_tool_type"
label="配送工具"
width="100"
>
<template #default="scope">
{{scope.row.deliverer_tool_type==0 ? "电动车" : "摩托车"}}
</template>
</el-table-column>
</el-table>
</el-form>
......@@ -252,8 +252,8 @@ export default {
};
},
created() {
this.getDelivererList();
this.getList();
this.getDelivererList();
this.getMarketingList()
},
methods: {
......@@ -272,7 +272,6 @@ export default {
},
// 清空
resetDate() {
this.distribList = [];
// 添加配送员弹框
(this.addDeliverer = {
name: "",
......@@ -371,6 +370,7 @@ export default {
async save() {
const { selectActivity, multipleSelection } = this;
const uids = multipleSelection.map((item) => item.deliverer_id);
if (!selectActivity) return ElMessage("请选择活动姓名");
try {
await getSaveDeliverer({ code: selectActivity, uids: uids.join(",") });
ElMessage("分配配送员成功");
......@@ -384,9 +384,9 @@ export default {
},
// 分配取消
assignCancel(){
this.getList()
this.dialogFormAssign = false
this.getDelivererList()
this.getList()
this.resetDate()
},
// 活动名称列表
......
<template>
<layout>
<div class="tab-show">
<!-- 审核状态 -->
<el-tabs
class="tab_list"
@tab-click="handleTabChange"
v-model="searchProps.status"
>
<el-tab-pane
label="待审核"
:name="TABS.pending"
@tab-click="handleTabChange"
></el-tab-pane>
<el-tab-pane
label="审核通过"
:name="TABS.passed"
@tab-click="handleTabChange"
></el-tab-pane>
<el-tab-pane
label="审核驳回"
:name="TABS.rejected"
@tab-click="handleTabChange"
></el-tab-pane>
<el-tab-pane
label="提现失败"
:name="TABS.failed"
@tab-click="handleTabChange"
>
</el-tab-pane>
</el-tabs>
</div>
<!-- 提现失败页 -->
<!-- <auditTab v-if="status_text == 'fourth'"></auditTab> -->
<el-card class="goods">
<!-- 筛选区 -->
<el-form inline class="search_condition">
<!-- 用户id -->
<el-form-item label="用户id">
<el-input v-model="searchProps.user_id" @input="
searchProps.user_id = $event
.replace(/\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g, '')
"
></el-input>
</el-form-item>
<el-button
type="primary"
style="margin-left: 30px; margin-bottom: 22px"
@click="findProducts"
>查询</el-button
>
</el-form>
<!-- 列表区 -->
<el-table class="goods_list" :data="goodsList" border stripe>
<el-table-column
label="提现用户"
prop="user_id"
align="center"
></el-table-column>
<el-table-column
label="所在圈"
prop="city_name"
align="center"
></el-table-column>
<el-table-column
label="提现金额"
prop="amount"
align="center"
></el-table-column>
<el-table-column
label="最近24小时收入"
prop="lately_amount"
align="center"
></el-table-column>
<el-table-column
label="近两天分享增长"
prop="lately_share"
align="center"
></el-table-column>
<el-table-column
label="近两天分享下载量"
prop="lately_download"
align="center"
></el-table-column>
<el-table-column
label="历史分享增长"
prop="history_share"
align="center"
></el-table-column>
<el-table-column
label="历史分享下载量"
prop="history_download"
align="center"
></el-table-column>
<el-table-column
label="历史下载留存"
prop="history_download_keep"
align="center"
></el-table-column>
<el-table-column
label="申请时间"
prop="create_time"
align="center"
></el-table-column>
<el-table-column label="状态" prop="status_text" align="center">
</el-table-column>
<el-table-column
label="审核时间"
prop="withdraw_audit_time"
align="center"
></el-table-column>
<el-table-column
label="审核人"
prop="audit_user_name"
align="center"
></el-table-column>
<!-- 操作快捷键 -->
<el-table-column label="操作" align="center" fixed="right" width="200">
<template v-slot:default="scope">
<el-button
type="text"
@click="handleDetail('look', scope.row.id)"
v-show="searchProps.status !== '3'"
>查看</el-button
>
<el-button
type="text"
v-show="searchProps.status == '0' && isAllowedToAudit"
@click="handleDetail('audit', scope.row.id)"
>审核</el-button
>
<el-popconfirm
title="确定解冻吗?"
@confirm="handleFinzingFind(scope.row.id)"
>
<template #reference>
<el-button
type="text"
v-show="searchProps.status == '3' && isAllowedToAudit"
>解冻</el-button
>
</template>
</el-popconfirm>
<!-- <el-button
type="text"
v-if="searchProps.withdraw_apply_status == '3'"
>重新发起</el-button
> -->
</template>
</el-table-column>
</el-table>
<!-- 页码区 -->
<el-pagination
class="pagination"
@current-change="handleCurrentChange"
v-model:currentPage="searchProps.page"
:page-size="searchProps.page_size"
layout="total,prev, pager, next, jumper"
:total="searchProps.count"
>
</el-pagination>
</el-card>
</layout>
<!-- 提现申请审核 -->
<!-- Form -->
<el-dialog
title="提现申请审核"
:show-close="false"
:close-on-click-modal="false"
v-model="outerVisible"
width="50%"
>
<el-form inline :model="form">
<el-form-item label="提现用户" label-width="120px">
<span style="display: inline-block; min-width: 200px">{{
dialogData.showData.user_id
}}</span>
</el-form-item>
<el-button
type="primary"
@click="handleBlackList('黑名单')"
v-show="dialogData.showMode === 'audit'"
>黑名单</el-button
>
<!-- <el-button
@click="handleButtonlist('白名单')"
v-show="dialogData.showMode === 'audit'"
>白名单</el-button
> -->
<ul class="listShow">
<li>
<span class="list-left">提现金额 :</span>
<span class="list-right">{{ dialogData.showData.amount }}</span>
</li>
<li>
<span class="list-left">最近24小时收入 :</span
><span class="list-right">{{
dialogData.showData.lately_amount
}}</span>
</li>
<li>
<span class="list-left">近两天分享增长 :</span
><span class="list-right">{{
dialogData.showData.lately_share
}}</span>
</li>
<li>
<span class="list-left">近两天分享下载量 :</span
><span class="list-right">{{
dialogData.showData.lately_download
}}</span>
</li>
<li>
<span class="list-left">历史分享增长 :</span
><span class="list-right">{{
dialogData.showData.history_share
}}</span>
</li>
</ul>
<el-form-item class="text-area" label="奖励明细:">
<el-table
:data="dialogData.showData.record_list || []"
border
align="center"
style="width: 100%"
max-height="200"
size="small"
>
<el-table-column
align="center"
prop="create_time"
label="流水时间"
width="120"
>
</el-table-column>
<el-table-column
align="center"
prop="amount"
label="分享用户量"
width="120"
>
<template v-slot:default="scope">
<span>{{ scope ? "+" + scope.row.amount : null }}</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="third_order_desc"
label="分享额外奖励x.xx元"
width="150"
>
</el-table-column>
</el-table>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button
type="primary"
@click="handleAdoptRefuse('通过')"
v-show="dialogData.showMode === 'audit'"
>通过</el-button
>
<el-button
type="danger"
@click="handleAdoptRefuse('拒绝')"
v-show="dialogData.showMode === 'audit'"
>拒绝</el-button
>
<el-button @click="outerVisible = false">{{
dialogData.showMode === "audit" ? "取消" : "返回"
}}</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import Layout from "../layout/index.vue";
import {
getApplyList,
getBlackList,
getWithdrawAudit,
getApplyDetail,
getFreezingFund,
getRolesForUser,
} from "@/service/Withdrawal/withdrawal";
import { ElMessage } from "element-plus";
import { fetchCurrentUser } from "../../../service/user";
const TABS = {
pending: "0",
passed: "1",
rejected: "2",
failed: "3",
};
export default {
name: "Examine",
components: { Layout },
data() {
return {
goodsList: [
// {
// user_id: "对的", //提现用户
// city_name: "北京", //所在圈
// amount: "45", ///提现金额
// lately_amount: "11", //最近24小时收入
// lately_share: "23", //近两天分享增长
// lately_download: "4", //近两天分享下载量
// history_share: "8", //历史分享增长
// history_download: "7", //历史分享下载量
// history_download_keep: "4", //历史分享留存
// create_time: "2021-5-4", //申请时间
// status_text: "待审核", //状态
// withdraw_audit_time: "", //审核时间
// audit_user_name: "我", //审核人
// },
],
// 查询参数
searchProps: {
user_id: "", //用户id
page: 1,
count: 0,
page_size: 20, //每页条数
status: TABS.pending, //状态
},
// 弹框
dialogData: {
showData: {}, //弹框展示
showMode: "audit", //判断是审核还是查看
},
// 黑名单
// blackList: {
// user_id: "",
// wallet_id: "",
// is_freezing: 0,
// opt_desc: "",
// },
award: "", //奖励明细
outerVisible: false, //外层弹框
permissions: [],
// constants
TABS,
};
},
created() {
this.getApplyList();
},
async mounted() {
const res = await this.getPermissionsAll();
if (!res) {
this.$router.push({ name: "Forbidden" });
return;
}
let withdrawlPermission = res.filter(
({ name }) => name === "withdrawal_audit"
);
if (withdrawlPermission.length === 0) {
// push to forbidden
this.$router.push({ name: "Forbidden" });
return;
}
console.log("withdrawlPermission", withdrawlPermission);
withdrawlPermission = withdrawlPermission[0];
// judge subpermission
let subpermissions = withdrawlPermission.sub_permissions.filter(
({ name }) => name === "show"
);
if (subpermissions.length === 0) {
this.$router.push({ name: "Forbidden" });
}
},
methods: {
async getPermissionsAll() {
// 不能够信赖 store 中的 email,无法知道全局中的 fetchCurrentUser 处理完毕
// 是一个重构的点
const { user } = await fetchCurrentUser();
const res = await getRolesForUser(user.email);
this.permissions = res;
return res;
},
// tab切换
handleTabChange() {
this.searchProps.page = 0;
this.getApplyList();
},
// 分页
handleCurrentChange(e) {
this.searchProps.page = e;
this.getApplyList();
},
// 提现申请审核详情
async handleDetail(showMode, id) {
try {
const res = await getApplyDetail({ id });
const showData = res.info || {};
this.dialogData = { ...this.dialogData, showMode, showData };
this.outerVisible = true;
} catch (error) {
ElMessage.error("请求获取信息失败");
}
},
// 二次确认弹框
handleConfirm(action, params) {
const urlObj = {
黑名单: getBlackList,
通过: getWithdrawAudit,
拒绝: getWithdrawAudit,
};
this.$confirm(`<p>你确定此操作吗</p><p>${action}</p>`, "再次确认", {
confirmButtonText: "取消",
cancelButtonText: "确定",
cancelButtonClass: "cancel",
confirmButtonClass: "confirm",
closeOnClickModal: false,
dangerouslyUseHTMLString: true,
center: true,
showClose: false,
type: "warning",
})
.then(() => {
this.$message({
type: "info",
message: "已取消操作",
});
})
.catch(async () => {
try {
const res = await urlObj[action](params);
this.getApplyList();
this.outerVisible = false;
this.$message({
type: "success",
message: "操作成功",
});
console.log(res);
} catch (error) {
this.$message({
type: "error",
message: "请求操作失败",
});
}
});
},
//获取黑名单
handleBlackList(action) {
const { id, user_id, wallet_id } = this.dialogData.showData;
const params = {
id,
user_id,
wallet_id,
is_freezing: action === "黑名单" ? 1 : 0,
opt_desc: "",
};
this.handleConfirm(action, params);
},
// 通过 & 拒绝
handleAdoptRefuse(action) {
const { withdraw_apply_id: id } = this.dialogData.showData;
const params = {
id,
withdraw_apply_status: action === "通过" ? 1 : 2,
};
this.handleConfirm(action, params);
},
// 获取提现审核列表
async getApplyList() {
const { user_id, page, page_size, status } = this.searchProps;
// 整理参数
const searchProps = {
user_id: user_id || undefined,
page,
page_size,
status,
};
console.log(this.searchProps);
try {
const res = await getApplyList(searchProps);
if (res.code !== 0) return this.$message.error(res.reason);
this.goodsList = res.result.list;
this.searchProps.count = res.result.count;
} catch (error) {
ElMessage.error("请求查询列表失败");
}
},
// 查询
findProducts() {
this.getApplyList();
},
// 解冻
async handleFinzingFind(id) {
try {
await getFreezingFund({ id });
this.getApplyList();
ElMessage.success("解冻成功");
} catch (error) {
ElMessage.error("请求解冻失败");
}
},
// 清空
resetDate() {
(this.goodsList = []),
// 查询参数
(this.searchProps = {
user_id: "", //用户id
page_size: 2, //页码
status: "0", //状态
page: 1,
count: 0, //总条数
}),
// 弹框
(this.dialogData = {
showData: {}, //弹框展示
showMode: "audit", //判断是审核还是查看
}),
(this.award = ""), //奖励明细
(this.outerVisible = false); //外层弹框
},
},
computed: {
isAllowedToAudit() {
// 用户不存在
if (!this.permissions) {
return false;
}
const WITHDRAWAL_PERMISSION_ID = 10;
let withdrawlPermission = this.permissions.filter(
(item) => item.id === WITHDRAWAL_PERMISSION_ID
);
// 无此模块权限
if (withdrawlPermission.length === 0) {
return false;
}
const AUDIT_PERMSSION_ID = 14;
const auditPermission = withdrawlPermission[0].sub_permissions.filter(
(item) => item.id === AUDIT_PERMSSION_ID
);
return auditPermission.length !== 0;
},
},
};
</script>
<style lang="less" src="./index.less" scope></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment