分销
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="880"
|
||||
:width="1000"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
@@ -14,7 +14,7 @@
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:label-col="{ md: { span: 8 }, sm: { span: 24 } }"
|
||||
:label-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||
layout="vertical"
|
||||
:model="form"
|
||||
@@ -195,6 +195,94 @@
|
||||
<a-form-item label="商品卖点" name="sellingPoint">
|
||||
<a-input v-model:value="form.sellingPoint" />
|
||||
</a-form-item>
|
||||
<a-row :gutter="16">
|
||||
<a-col>
|
||||
<a-form-item label="投资人收益" name="touziProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.touziProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-show="form.equipmentCategory == '20'">
|
||||
<a-form-item label="投资人首期收益" name="touziFirstProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.touziFirstProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col>
|
||||
<a-form-item label="推荐人收益" name="tuijianProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.tuijianProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-show="form.equipmentCategory == '20'">
|
||||
<a-form-item label="推荐人首期收益" name="tuijianFirstProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.tuijianFirstProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col>
|
||||
<a-form-item label="门店收益" name="mendianProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.mendianProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-show="form.equipmentCategory == '20'">
|
||||
<a-form-item label="门店首期收益" name="mendianFirstProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.mendianFirstProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="16">
|
||||
<a-col>
|
||||
<a-form-item label="区域经理收益" name="jingliProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.jingliProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-show="form.equipmentCategory == '20'">
|
||||
<a-form-item label="区域经理首期收益" name="jingliFirstProfit">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:precision="2"
|
||||
style="width: 220px"
|
||||
v-model:value="form.jingliFirstProfit"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item label="设备图片" name="images">
|
||||
|
||||
@@ -100,16 +100,24 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'batteryPrice'">
|
||||
<div class="ele-text-placeholder">
|
||||
价格:<span class="ele-text-heading">¥{{ record.batteryPrice }}</span>
|
||||
价格:<span class="ele-text-heading"
|
||||
>¥{{ record.batteryPrice }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
租金:<span class="ele-text-heading">¥{{ record.batteryRent }}</span>
|
||||
租金:<span class="ele-text-heading"
|
||||
>¥{{ record.batteryRent }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
押金:<span class="ele-text-heading">¥{{ record.batteryDeposit }}</span>
|
||||
押金:<span class="ele-text-heading"
|
||||
>¥{{ record.batteryDeposit }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder">
|
||||
保险:<span class="ele-text-heading">¥{{ record.batteryInsurance }}</span>
|
||||
保险:<span class="ele-text-heading"
|
||||
>¥{{ record.batteryInsurance }}</span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'more'">
|
||||
|
||||
243
src/views/yunxinwei/manager/components/clerk.vue
Normal file
243
src/views/yunxinwei/manager/components/clerk.vue
Normal file
@@ -0,0 +1,243 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
:width="700"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
:title="'成员管理'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
:footer="null"
|
||||
>
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="userId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:where="defaultWhere"
|
||||
cache-key="proSystemUserTable"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
<!-- <UserMerchantClerk @select="onSelect" />-->
|
||||
<a-input
|
||||
allow-clear
|
||||
v-model="userId"
|
||||
@change="getUserId"
|
||||
placeholder="请输入用户ID"
|
||||
/>
|
||||
<a-button type="primary" class="ele-btn-icon" @click="save">
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<a-tooltip :title="`ID:${record.userId}`">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.user?.avatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
{{ record.user?.nickname }}
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'username'">
|
||||
{{ record.user?.username }}
|
||||
</template>
|
||||
<template v-if="column.key === 'phone'">
|
||||
{{ record.user?.phone }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a class="ele-text-danger" @click="remove(record)">移除</a>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
MerchantClerk,
|
||||
MerchantClerkParam
|
||||
} from '@/api/merchant/clerk/model';
|
||||
import {
|
||||
ColumnItem,
|
||||
DatasourceFunction
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { UserOutlined } from '@ant-design/icons-vue';
|
||||
import {
|
||||
addMerchantClerk,
|
||||
pageMerchantClerks,
|
||||
removeMerchantClerk
|
||||
} from '@/api/merchant/clerk';
|
||||
// import UserMerchantClerk from '@/components/UserChoose/index.vue';
|
||||
|
||||
const useForm = Form.useForm;
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: MerchantClerk | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '姓名',
|
||||
key: 'nickname',
|
||||
dataIndex: 'nickname'
|
||||
},
|
||||
{
|
||||
title: '登录账号',
|
||||
key: 'username',
|
||||
dataIndex: 'username'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
key: 'phone',
|
||||
dataIndex: 'phone'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 默认搜索条件
|
||||
const defaultWhere = reactive({
|
||||
username: '',
|
||||
nickname: ''
|
||||
});
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where = {};
|
||||
where.merchantCode = props.data?.merchantCode;
|
||||
return pageMerchantClerks({ ...where, ...orders, page, limit });
|
||||
};
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
/* 搜索 */
|
||||
const reload = (where?: MerchantClerkParam) => {
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
// 用户信息
|
||||
const clerk = reactive<MerchantClerk>({
|
||||
clerkId: undefined,
|
||||
// 商户名称
|
||||
merchantName: '',
|
||||
// 商户编号
|
||||
merchantCode: '',
|
||||
// 店员真实姓名
|
||||
realName: '',
|
||||
// 用户id
|
||||
userId: undefined,
|
||||
// 昵称
|
||||
nickname: '',
|
||||
// 登录账号
|
||||
username: '',
|
||||
// 创建时间
|
||||
createTime: ''
|
||||
});
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(true);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
// 选项卡位置
|
||||
const { resetFields } = useForm(clerk);
|
||||
// 选中用户
|
||||
const userId = ref(undefined);
|
||||
|
||||
// const onSelect = (user) => {
|
||||
// userId.value = user.userId;
|
||||
// };
|
||||
const getUserId = (e) => {
|
||||
userId.value = e.target.value;
|
||||
};
|
||||
|
||||
// 添加门店成员
|
||||
const save = () => {
|
||||
const data = {
|
||||
merchantCode: props.data?.merchantCode,
|
||||
userId: userId.value
|
||||
};
|
||||
addMerchantClerk(data)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MerchantClerk) => {
|
||||
console.log(row);
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMerchantClerk(row.clerkId)
|
||||
.then(() => {
|
||||
hide();
|
||||
message.success('移除成功');
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignObject(clerk, props.data);
|
||||
reload();
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 100px;
|
||||
}
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
236
src/views/yunxinwei/manager/components/manager-edit.vue
Normal file
236
src/views/yunxinwei/manager/components/manager-edit.vue
Normal file
@@ -0,0 +1,236 @@
|
||||
<!-- 用户编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="750"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:maxable="maxAble"
|
||||
:title="isUpdate ? '编辑区域经理' : '添加区域经理'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
:maskClosable="false"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="{ md: { span: 8 }, sm: { span: 24 } }"
|
||||
:wrapper-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item
|
||||
label="区域经理"
|
||||
name="managerOwner"
|
||||
extra="请绑定区域经理,注意:超管和游客账号不要绑定"
|
||||
>
|
||||
<OwnerChoose :value="form.userId" @select="onSelect" />
|
||||
</a-form-item>
|
||||
<a-form-item label="所在地区" name="region">
|
||||
<div class="flex-sb">
|
||||
<regions-select
|
||||
v-model:value="city"
|
||||
valueField="label"
|
||||
placeholder="请选择省市区"
|
||||
class="ele-fluid"
|
||||
@change="onChangeRegion"
|
||||
/>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addManager, updateManager } from '@/api/merchant/manager';
|
||||
import { FormInstance, Rule, RuleObject } from 'ant-design-vue/es/form';
|
||||
import OwnerChoose from '@/components/UserChoose/index.vue';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import highlight from '@bytemd/plugin-highlight';
|
||||
|
||||
// // 链接、删除线、复选框、表格等的插件
|
||||
import gfm from '@bytemd/plugin-gfm';
|
||||
// // 插件的中文语言文件
|
||||
import zh_HansGfm from '@bytemd/plugin-gfm/locales/zh_Hans.json';
|
||||
// // 预览界面的样式,这里用的 github 的 markdown 主题
|
||||
import 'github-markdown-css/github-markdown-light.css';
|
||||
import { Manager } from '@/api/merchant/manager/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxAble = ref(true);
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Manager | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 已上传数据
|
||||
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
// 编辑器内容,双向绑定
|
||||
const content = ref<any>('');
|
||||
// 省市区
|
||||
const city = ref<string[]>([]);
|
||||
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 选择地区
|
||||
const onChangeRegion = (value) => {
|
||||
form.province = value[0];
|
||||
form.city = value[1];
|
||||
form.area = value[2];
|
||||
};
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Manager>({
|
||||
managerId: props.data?.managerId,
|
||||
userId: props.data?.userId,
|
||||
city: props.data?.city,
|
||||
area: props.data?.area,
|
||||
province: props.data?.province
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive<Record<string, Rule[]>>({
|
||||
managerName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商户名称',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
|
||||
managerOwner: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请绑定区域经理',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
console.log(value);
|
||||
if (form.userId == 0) {
|
||||
return Promise.reject('请绑定区域经理');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
],
|
||||
region: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请选择商户所在区域',
|
||||
trigger: 'blur',
|
||||
validator: async (_rule: RuleObject, value: string) => {
|
||||
if (city.value.length == 0) {
|
||||
return Promise.reject('请选择商户所在区域');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// 插件
|
||||
const plugins = ref([
|
||||
gfm({
|
||||
locale: zh_HansGfm
|
||||
}),
|
||||
highlight()
|
||||
]);
|
||||
|
||||
const onSelect = (item) => {
|
||||
form.userId = item.userId;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const managerForm = {
|
||||
...form,
|
||||
content: content.value
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateManager : addManager;
|
||||
saveOrUpdate(managerForm)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
form.city = '[]';
|
||||
resetFields();
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
loading.value = false;
|
||||
assignFields({
|
||||
...props.data
|
||||
});
|
||||
city.value = [
|
||||
`${props.data.province}`,
|
||||
`${props.data.city}`,
|
||||
`${props.data.area}`
|
||||
];
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
city.value = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tab-pane {
|
||||
min-height: 300px;
|
||||
}
|
||||
.ml-10 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.flex-sb {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
128
src/views/yunxinwei/manager/components/search.vue
Normal file
128
src/views/yunxinwei/manager/components/search.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
v-permission="'shop:merchant:save'"
|
||||
@click="add"
|
||||
>
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
:v-role="`dev`"
|
||||
@click="removeBatch"
|
||||
v-if="props.selection.length > 0"
|
||||
>
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
<span>批量删除</span>
|
||||
</a-button>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="searchText"
|
||||
placeholder="请输入搜索关键词"
|
||||
@search="search"
|
||||
@pressEnter="search"
|
||||
>
|
||||
<template #addonBefore>
|
||||
<a-select v-model:value="type" style="width: 120px; margin: -5px -12px">
|
||||
<a-select-option value="merchantName">商户名称</a-select-option>
|
||||
<a-select-option value="merchantCode">商户编号</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
</a-input-search>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import type { MerchantParam } from '@/api/merchant/model';
|
||||
// import CustomerSelect from '@/components/CustomerSelect/index.vue';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MerchantParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 勾选的项目
|
||||
selection?: [];
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<MerchantParam>({
|
||||
merchantId: undefined,
|
||||
merchantName: '',
|
||||
merchantCode: ''
|
||||
});
|
||||
|
||||
// 下来选项
|
||||
const type = ref('merchantName');
|
||||
// tabType
|
||||
const listType = ref('all');
|
||||
// 搜索内容
|
||||
const searchText = ref('');
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
if (type.value == 'merchantName') {
|
||||
where.merchantName = searchText.value;
|
||||
where.merchantCode = undefined;
|
||||
}
|
||||
if (type.value == 'merchantCode') {
|
||||
where.merchantCode = searchText.value;
|
||||
where.merchantName = undefined;
|
||||
}
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// const handleTabs = (e) => {
|
||||
// listType.value = e.target.value;
|
||||
// if (listType.value == 'all') {
|
||||
// resetFields();
|
||||
// }
|
||||
// if (listType.value == 'onSale') {
|
||||
// where.status = 0;
|
||||
// }
|
||||
// if (listType.value == 'offSale') {
|
||||
// where.status = 1;
|
||||
// }
|
||||
// if (listType.value == 'soldOut') {
|
||||
// where.stockTotal = 0;
|
||||
// }
|
||||
// emit('search', where);
|
||||
// };
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
// 批量删除
|
||||
const removeBatch = () => {
|
||||
emit('remove');
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
// const reset = () => {
|
||||
// resetFields();
|
||||
// search();
|
||||
// };
|
||||
|
||||
// 监听字典id变化
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
260
src/views/yunxinwei/manager/index.vue
Normal file
260
src/views/yunxinwei/manager/index.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="managerId"
|
||||
:columns="columns"
|
||||
:height="tableHeight"
|
||||
:customRow="customRow"
|
||||
:datasource="datasource"
|
||||
v-model:selection="selection"
|
||||
:scroll="{ x: 800 }"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
:selection="selection"
|
||||
@search="reload"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'user'">
|
||||
<a-tooltip :title="`用户ID:${record.userId}`">
|
||||
<a-avatar :src="record.avatar" size="small" />
|
||||
<span style="padding-left: 4px">{{ record.nickname }}</span>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'region'">
|
||||
{{record.province}} - {{record.city}} - {{record.area}}
|
||||
</template>
|
||||
<template v-if="column.key === 'comments'">
|
||||
<a-tooltip :title="record.comments" placement="topLeft">
|
||||
{{ record.comments }}
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'createTime'">
|
||||
<a-tooltip :title="`${toDateString(record.createTime)}`">
|
||||
{{ timeAgo(record.createTime) }}
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
|
||||
<manager-edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!--suppress TypeScriptValidateTypes -->
|
||||
<script lang="ts" setup>
|
||||
import { timeAgo } from 'ele-admin-pro';
|
||||
import { createVNode, computed, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import Search from './components/search.vue';
|
||||
import ManagerEdit from './components/manager-edit.vue';
|
||||
import {
|
||||
pageManager,
|
||||
removeManager,
|
||||
removeBatchManager
|
||||
} from '@/api/merchant/manager';
|
||||
import type { Manager, ManagerParam } from '@/api/merchant/manager/model';
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 当前用户信息
|
||||
// const brand = getDictionaryOptions('serverBrand');
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
key: 'index',
|
||||
width: 48,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
hideInSetting: true,
|
||||
customRender: ({ index }) => index + (tableRef.value?.tableIndex ?? 0)
|
||||
},
|
||||
{
|
||||
title: '区域',
|
||||
key: 'region',
|
||||
dataIndex: 'region'
|
||||
},
|
||||
{
|
||||
title: '经理',
|
||||
key: 'user',
|
||||
dataIndex: 'user'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
hideInTable: true,
|
||||
customRender: ({ text }) => toDateString(text)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 200,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Manager[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<Manager | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const showUser = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.brand = filters.brand;
|
||||
}
|
||||
return pageManager({ ...where, ...orders, page, limit });
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: ManagerParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
// 搜索是否展开
|
||||
const searchExpand = ref(false);
|
||||
|
||||
// 表格固定高度
|
||||
const fixedHeight = ref(false);
|
||||
|
||||
// 表格高度
|
||||
const tableHeight = computed(() => {
|
||||
return fixedHeight.value
|
||||
? searchExpand.value
|
||||
? 'calc(100vh - 618px)'
|
||||
: 'calc(100vh - 562px)'
|
||||
: void 0;
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: Manager) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Manager) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeManager(row.managerId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchManager(selection.value.map((d) => d.managerId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Manager) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'ManagerIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// 文字超出隐藏(两行)
|
||||
// 需要设置文字容器的宽度
|
||||
.twoline-hide {
|
||||
width: 320px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
white-space: normal;
|
||||
}
|
||||
</style>
|
||||
@@ -100,6 +100,18 @@
|
||||
>已退租</a-tag
|
||||
>
|
||||
</div>
|
||||
<div class="ele-text-placeholder" v-if="record.orderSource != 10">
|
||||
分期状态:
|
||||
<a-tag v-if="record.fenqiStatus == 1" color="success"
|
||||
>已完成</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.expirationDay < 0" color="error"
|
||||
>逾期{{ record.expirationDay }}天</a-tag
|
||||
>
|
||||
<a-tag v-else-if="record.expirationDay >= 0" color="warning"
|
||||
>剩余{{ record.expirationDay }}天</a-tag
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.key === 'comments'">
|
||||
<FormOutlined
|
||||
@@ -271,6 +283,11 @@
|
||||
filters: orderSource,
|
||||
filterMultiple: false
|
||||
},
|
||||
{
|
||||
title: '到期时间',
|
||||
dataIndex: 'expirationTime',
|
||||
key: 'expirationTime'
|
||||
},
|
||||
{
|
||||
title: '买家',
|
||||
dataIndex: 'nickname',
|
||||
|
||||
Reference in New Issue
Block a user