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

301 lines
7.9 KiB
Vue
Raw Normal View History

2021-05-13 10:56:04 +08:00
<template>
<div>
2021-05-27 16:37:00 +08:00
<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"
class="mt_10"
2021-05-27 16:37:00 +08:00
></Table>
<Row type="flex" justify="end" class="mt_10">
2021-05-27 16:37:00 +08:00
<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, // 分销状态
loading: true, // 表单加载状态
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
},
columns: [
{
title: "会员名称",
key: "memberName",
minWidth: 120,
tooltip: true,
},
{
title: "推广单数",
2021-06-30 15:51:14 +08:00
key: "distributionOrderCount",
2021-05-27 16:37:00 +08:00
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",
2021-06-30 15:51:14 +08:00
this.$options.filters.unitPrice(params.row.canRebate, "¥")
2021-05-27 16:37:00 +08:00
);
},
},
{
title: "冻结金额",
key: "commissionFrozen",
width: 150,
sortable: false,
render: (h, params) => {
return h(
"div",
2021-06-30 15:51:14 +08:00
this.$options.filters.unitPrice(params.row.commissionFrozen, "¥")
2021-05-27 16:37:00 +08:00
);
},
},
{
title: "状态",
key: "distributionStatus",
width: 150,
sortable: false,
render: (h, params) => {
if (params.row.distributionStatus == "PASS") {
2021-06-23 00:21:17 +08:00
return h("Tag", {props: {color: "green",},},"通过");
2021-05-27 16:37:00 +08:00
} else if (params.row.distributionStatus == "APPLY") {
2021-06-23 00:21:17 +08:00
return h("Tag", {props: {color: "geekblue",},},"待审核");
2021-05-27 16:37:00 +08:00
} else if (params.row.distributionStatus == "RETREAT") {
2021-06-23 00:21:17 +08:00
return h("Tag", {props: {color: "volcano",},},"清退");
2021-05-27 16:37:00 +08:00
} else if (params.row.distributionStatus == "REFUSE") {
2021-06-23 00:21:17 +08:00
return h("Tag", {props: {color: "red",},},"拒绝");
2021-05-27 16:37:00 +08:00
}
},
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: {
// 初始化数据
2021-05-27 16:37:00 +08:00
init() {
this.getDataList();
},
// 分页 改变页码
2021-05-27 16:37:00 +08:00
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
},
// 分页 改变页数
2021-05-27 16:37:00 +08:00
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
// 搜索
2021-05-27 16:37:00 +08:00
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
// 获取列表数据
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>