lilishop-ui/manager/src/views/distribution/distribution.vue

330 lines
8.6 KiB
Vue
Raw Normal View History

2021-05-13 10:56:04 +08:00
<template>
2021-05-27 16:37:00 +08:00
<div class="search">
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="状态">
<Select
v-model="searchForm.distributionStatus"
style="width: 200px"
>
<Option
v-for="item in distributionStatusList"
:value="item.value"
:key="item.value"
>{{ item.label }}</Option
>
</Select>
</Form-item>
<Button
@click="handleSearch"
type="primary"
icon="ios-search"
class="search-btn"
>搜索</Button
>
</Form>
</Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row>
</Card>
</div>
2021-05-13 10:56:04 +08:00
</template>
<script>
2021-05-27 16:37:00 +08:00
import {
getDistributionListData,
retreatDistribution,
resumeDistribution,
auditDistribution,
} from "@/api/distribution";
import { distributionStatusList } from "./dataJson.js";
export default {
name: "distribution",
components: {},
data() {
return {
distributionStatusList, // 分销状态
openSearch: true, // 显示搜索
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
{
title: "会员名称",
key: "memberName",
minWidth: 120,
tooltip: true,
},
{
title: "推广单数",
key: "orderNum",
minWidth: 120,
width: 150,
},
{
title: "分销金额",
key: "rebateTotal",
width: 150,
sortable: false,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.rebateTotal, "¥")
);
},
},
{
title: "可用金额",
key: "canRebate",
width: 150,
sortable: false,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.rebateTotal, "¥")
);
},
},
{
title: "冻结金额",
key: "commissionFrozen",
width: 150,
sortable: false,
render: (h, params) => {
return h(
"div",
this.$options.filters.unitPrice(params.row.rebateTotal, "¥")
);
},
},
{
title: "状态",
key: "distributionStatus",
width: 150,
sortable: false,
render: (h, params) => {
if (params.row.distributionStatus == "PASS") {
return h("Badge", {
props: { status: "success", text: "审核通过" },
});
} else if (params.row.distributionStatus == "APPLY") {
return h("Badge", {
props: { status: "processing", text: "申请中" },
});
} else if (params.row.distributionStatus == "RETREAT") {
return h("Badge", {
props: { status: "warning", text: "已清退" },
});
} else if (params.row.distributionStatus == "REFUSE") {
return h("Badge", {
props: { status: "error", text: "审核拒绝" },
});
}
},
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
{
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 140,
render: (h, params) => {
return h(
"div",
{
style: {
display: "flex",
justifyContent: "center",
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
},
[
h(
"Button",
{
props: {
type: "error",
size: "small",
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
style: {
marginRight: "5px",
display:
params.row.distributionStatus != "RETREAT"
? "block"
: "none",
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
on: {
click: () => {
this.retreat(params.row);
},
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
},
"清退"
),
h(
"Button",
{
props: {
type: "success",
size: "small",
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
style: {
marginRight: "5px",
display:
params.row.distributionStatus == "RETREAT"
? "block"
: "none",
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
on: {
click: () => {
this.resume(params.row);
},
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
},
"恢复"
),
]
);
},
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
],
data: [], // 表单数据
total: 0, // 表单数据总数
};
},
methods: {
init() {
this.getDataList();
},
see(v) {
this.$router.push({
name: "distributionOrder",
query: { id: v.memberId },
});
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
2021-05-13 10:56:04 +08:00
2021-05-27 16:37:00 +08:00
clearSelectAll() {
// 清空
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
2021-05-13 10:56:04 +08:00
2021-05-27 16:37:00 +08:00
getDataList() {
this.loading = true;
this.searchForm.status = "PASS";
// 带多条件搜索参数获取表单数据 请自行修改接口
getDistributionListData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
},
// 清退分销商
retreat(v) {
this.$Modal.confirm({
title: "提示",
// 记得确认修改此处
content: "您确认要清退 " + v.memberName + " ?",
loading: true,
onOk: () => {
// 删除
retreatDistribution(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
2021-05-13 10:56:04 +08:00
}
2021-05-27 16:37:00 +08:00
});
2021-05-13 10:56:04 +08:00
},
2021-05-27 16:37:00 +08:00
});
},
// 恢复分销商
resume(v) {
this.$Modal.confirm({
title: "提示",
// 记得确认修改此处
content: "您确认要恢复 " + v.memberName + " ?",
loading: true,
onOk: () => {
// 删除
resumeDistribution(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
},
mounted() {
this.init();
},
};
2021-05-13 10:56:04 +08:00
</script>
<style lang="scss">
2021-05-27 16:37:00 +08:00
@import "@/styles/table-common.scss";
2021-05-13 10:56:04 +08:00
</style>