分销
This commit is contained in:
@@ -51,44 +51,14 @@ export interface EquipmentGoods {
|
|||||||
serviceCharges?: number;
|
serviceCharges?: number;
|
||||||
// 分期方式
|
// 分期方式
|
||||||
periodsType?: number;
|
periodsType?: number;
|
||||||
/* 投资人 */
|
touziProfit?: number;
|
||||||
// 一次性购买
|
touziFirstProfit?: number;
|
||||||
touziCustomerProfit10?: number;
|
tuijianProfit?: number;
|
||||||
// 分期购买首期
|
tuijianFirstProfit?: number;
|
||||||
touziCustomerProfit20First?: number;
|
mendianProfit?: number;
|
||||||
// 分期购买每期
|
mendianFirstProfit?: number;
|
||||||
touziCustomerProfit20?: number;
|
jingliProfit?: number;
|
||||||
// 以租代购
|
jingliFirstProfit?: number;
|
||||||
touziCustomerProfit30?: number;
|
|
||||||
// 租赁
|
|
||||||
touziCustomerProfit40?: number;
|
|
||||||
|
|
||||||
/* 服务门店 */
|
|
||||||
// 直推用户一次性购买
|
|
||||||
storeCustomerProfit10?: number;
|
|
||||||
// 直推用户 分期购买首期
|
|
||||||
storeCustomerProfit20First?: number;
|
|
||||||
// 直推用户 分期购买每期
|
|
||||||
storeCustomerProfit20?: number;
|
|
||||||
// 直推用户 以租代购
|
|
||||||
storeCustomerProfit30?: number;
|
|
||||||
// 直推用户 租赁
|
|
||||||
storeCustomerProfit40?: number;
|
|
||||||
|
|
||||||
//直推门店 直推用户 一次性购买
|
|
||||||
storeStoreCustomerProfit10?: number;
|
|
||||||
//直推门店 直推用户 分期购买首期
|
|
||||||
storeStoreCustomerProfit20First?: number;
|
|
||||||
//直推门店 直推用户 分期购买每期
|
|
||||||
storeStoreCustomerProfit20?: number;
|
|
||||||
//直推门店 直推用户 以租代购
|
|
||||||
storeStoreCustomerProfit30?: number;
|
|
||||||
//直推门店 直推用户 租赁
|
|
||||||
storeStoreCustomerProfit40?: number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
87
src/api/merchant/manager/index.ts
Normal file
87
src/api/merchant/manager/index.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { Manager, ManagerParam } from './model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询会员
|
||||||
|
*/
|
||||||
|
export async function pageManager(params: ManagerParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<Manager>>>(
|
||||||
|
'/shop/manager/page',
|
||||||
|
{ params }
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询会员
|
||||||
|
*/
|
||||||
|
export async function getManager(id: number) {
|
||||||
|
const res = await request.get<ApiResult<Manager>>('/shop/manager/' + id);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询会员列表
|
||||||
|
*/
|
||||||
|
export async function listManager(params?: ManagerParam) {
|
||||||
|
const res = await request.get<ApiResult<Manager[]>>('/shop/manager', {
|
||||||
|
params
|
||||||
|
});
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加会员
|
||||||
|
*/
|
||||||
|
export async function addManager(data: Manager) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>('/shop/manager', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改会员
|
||||||
|
*/
|
||||||
|
export async function updateManager(data: Manager) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>('/shop/manager', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除会员
|
||||||
|
*/
|
||||||
|
export async function removeManager(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>('/shop/manager/' + id);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除会员
|
||||||
|
*/
|
||||||
|
export async function removeBatchManager(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>('/shop/manager/batch', {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
30
src/api/merchant/manager/model/index.ts
Normal file
30
src/api/merchant/manager/model/index.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
import { User } from '@/api/system/user/model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员
|
||||||
|
*/
|
||||||
|
export interface Manager {
|
||||||
|
// 会员id
|
||||||
|
managerId?: number;
|
||||||
|
// 用户id
|
||||||
|
userId?: number;
|
||||||
|
area?: string;
|
||||||
|
city?: string;
|
||||||
|
province?: string;
|
||||||
|
// 用户信息
|
||||||
|
user?: User;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员搜索条件
|
||||||
|
*/
|
||||||
|
export interface ManagerParam extends PageParam {
|
||||||
|
userId?: string;
|
||||||
|
area?: string;
|
||||||
|
city?: string;
|
||||||
|
province?: string;
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@ export interface Merchant {
|
|||||||
userId?: number;
|
userId?: number;
|
||||||
nickname?: string;
|
nickname?: string;
|
||||||
merchantOwner?: number;
|
merchantOwner?: number;
|
||||||
|
managerId?: number;
|
||||||
merchantPhone?: string;
|
merchantPhone?: string;
|
||||||
firstRatio?: number;
|
firstRatio?: number;
|
||||||
secondRatio?: number;
|
secondRatio?: number;
|
||||||
|
|||||||
37
src/components/ManagerChoose/choose-search.vue
Normal file
37
src/components/ManagerChoose/choose-search.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div style="max-width: 240px">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
v-model:value="where.phone"
|
||||||
|
placeholder="输入手机号码搜素"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
@change="search"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<SearchOutlined class="ele-text-placeholder" />
|
||||||
|
</template>
|
||||||
|
</a-input>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
import { SearchOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { WhereType } from './types';
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where: WhereType): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const where = reactive<WhereType>({
|
||||||
|
keywords: '',
|
||||||
|
nickname: '',
|
||||||
|
phone: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const search = () => {
|
||||||
|
emit('search', where);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
128
src/components/ManagerChoose/index.vue
Normal file
128
src/components/ManagerChoose/index.vue
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<template>
|
||||||
|
<ele-table-select
|
||||||
|
ref="selectRef"
|
||||||
|
:allow-clear="true"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
v-model:value="selectedValue"
|
||||||
|
value-key="managerId"
|
||||||
|
label-key="nickname"
|
||||||
|
:table-config="tableConfig"
|
||||||
|
:overlay-style="{ width: '520px', maxWidth: '80%' }"
|
||||||
|
:init-value="initValue"
|
||||||
|
@select="onSelect"
|
||||||
|
@clear="onClear"
|
||||||
|
>
|
||||||
|
<!-- 角色列 -->
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'manager'">
|
||||||
|
<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>
|
||||||
|
<!-- 表头工具栏 -->
|
||||||
|
<template #toolbar>
|
||||||
|
<ChooseSearch @search="search" />
|
||||||
|
</template>
|
||||||
|
</ele-table-select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import ChooseSearch from './choose-search.vue';
|
||||||
|
import type { EleTableSelect } from 'ele-admin-pro/es';
|
||||||
|
import type { ProTableProps } from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import type { WhereType } from './types';
|
||||||
|
import { pageManager, getManager } from '@/api/merchant/manager';
|
||||||
|
import { Manager } from '@/api/merchant/manager/model';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
value?: number | 0;
|
||||||
|
placeholder?: string;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
placeholder: '请选择区域经理'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'select', where?: Manager): void;
|
||||||
|
(e: 'clear'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const selectedValue = ref<number>();
|
||||||
|
// 回显值
|
||||||
|
const initValue = ref<Manager | null>(null);
|
||||||
|
// 选择框实例
|
||||||
|
const selectRef = ref<InstanceType<typeof EleTableSelect> | null>(null);
|
||||||
|
|
||||||
|
// 表格配置
|
||||||
|
const tableConfig = reactive<ProTableProps>({
|
||||||
|
datasource: ({ page, limit, where, orders }) => {
|
||||||
|
return pageManager({ ...where, ...orders, page, limit });
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '区域',
|
||||||
|
key: 'region',
|
||||||
|
dataIndex: 'region'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '经理',
|
||||||
|
key: 'manager',
|
||||||
|
dataIndex: 'manager'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
toolkit: ['reload', 'columns'],
|
||||||
|
size: 'small',
|
||||||
|
pageSize: 6,
|
||||||
|
toolStyle: {
|
||||||
|
padding: '0 8px'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const search = (where: WhereType) => {
|
||||||
|
selectRef.value?.reload({
|
||||||
|
where,
|
||||||
|
page: 1
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClear = () => {
|
||||||
|
emit('clear');
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSelect = (item) => {
|
||||||
|
emit('select', item);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 回显数据 */
|
||||||
|
const setInitValue = () => {
|
||||||
|
const managerId = Number(props.value);
|
||||||
|
if (!managerId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getManager(managerId).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
initValue.value = res;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
setInitValue();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
setInitValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
9
src/components/ManagerChoose/types/index.ts
Normal file
9
src/components/ManagerChoose/types/index.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* 搜索表单类型
|
||||||
|
*/
|
||||||
|
export interface WhereType {
|
||||||
|
keywords?: string;
|
||||||
|
nickname?: string;
|
||||||
|
userId?: number;
|
||||||
|
phone?: string;
|
||||||
|
}
|
||||||
@@ -34,6 +34,20 @@
|
|||||||
v-model:value="form.merchantName"
|
v-model:value="form.merchantName"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
label="负责人"
|
||||||
|
name="merchantOwner"
|
||||||
|
extra="请绑定负责人,注意:超管和游客账号不要绑定"
|
||||||
|
>
|
||||||
|
<OwnerChoose :value="form.merchantOwner" @select="onSelect" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
label="区域经理"
|
||||||
|
name="managerId"
|
||||||
|
extra="请绑定负责人,注意:超管和游客账号不要绑定"
|
||||||
|
>
|
||||||
|
<ManagerChoose :value="form.managerId" @select="onSelectManager" />
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label="商户简介" name="comments">
|
<a-form-item label="商户简介" name="comments">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
:rows="4"
|
:rows="4"
|
||||||
@@ -62,13 +76,7 @@
|
|||||||
@upload="onUploadBackground"
|
@upload="onUploadBackground"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<!-- <a-form-item-->
|
|
||||||
<!-- label="负责人"-->
|
|
||||||
<!-- name="merchantOwner"-->
|
|
||||||
<!-- extra="请绑定负责人,注意:超管和游客账号不要绑定"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <OwnerChoose :value="form.merchantOwner" @select="onSelect" />-->
|
|
||||||
<!-- </a-form-item>-->
|
|
||||||
<a-form-item label="营业时间" name="merchantHours">
|
<a-form-item label="营业时间" name="merchantHours">
|
||||||
<a-input
|
<a-input
|
||||||
allow-clear
|
allow-clear
|
||||||
@@ -164,7 +172,8 @@
|
|||||||
import { FormInstance, Rule, RuleObject } from 'ant-design-vue/es/form';
|
import { FormInstance, Rule, RuleObject } from 'ant-design-vue/es/form';
|
||||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
import { uploadFile } from '@/api/system/file';
|
import { uploadFile } from '@/api/system/file';
|
||||||
// import OwnerChoose from '@/components/UserChoose/index.vue';
|
import OwnerChoose from '@/components/UserChoose/index.vue';
|
||||||
|
import ManagerChoose from '@/components/ManagerChoose/index.vue';
|
||||||
import { FILE_SERVER, FILE_THUMBNAIL } from '@/config/setting';
|
import { FILE_SERVER, FILE_THUMBNAIL } from '@/config/setting';
|
||||||
import useFormData from '@/utils/use-form-data';
|
import useFormData from '@/utils/use-form-data';
|
||||||
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
import RegionsSelect from '@/components/RegionsSelect/index.vue';
|
||||||
@@ -245,6 +254,7 @@
|
|||||||
merchantId: 0,
|
merchantId: 0,
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
merchantOwner: 0,
|
merchantOwner: 0,
|
||||||
|
managerId: undefined,
|
||||||
merchantPhone: undefined,
|
merchantPhone: undefined,
|
||||||
content: '',
|
content: '',
|
||||||
merchantHours: '8:30 - 22:30',
|
merchantHours: '8:30 - 22:30',
|
||||||
@@ -487,9 +497,12 @@
|
|||||||
showMap.value = false;
|
showMap.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const onSelect = (item) => {
|
const onSelect = (item) => {
|
||||||
// form.merchantOwner = item.userId;
|
form.merchantOwner = item.userId;
|
||||||
// };
|
};
|
||||||
|
const onSelectManager = (item) => {
|
||||||
|
form.managerId = item.managerId;
|
||||||
|
};
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
const save = () => {
|
const save = () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!-- 用户编辑弹窗 -->
|
<!-- 用户编辑弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<ele-modal
|
<ele-modal
|
||||||
:width="880"
|
:width="1000"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirm-loading="loading"
|
:confirm-loading="loading"
|
||||||
:maxable="maxAble"
|
:maxable="maxAble"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
>
|
>
|
||||||
<a-form
|
<a-form
|
||||||
ref="formRef"
|
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 } }"
|
:wrapper-col="{ md: { span: 24 }, sm: { span: 24 } }"
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
:model="form"
|
:model="form"
|
||||||
@@ -195,6 +195,94 @@
|
|||||||
<a-form-item label="商品卖点" name="sellingPoint">
|
<a-form-item label="商品卖点" name="sellingPoint">
|
||||||
<a-input v-model:value="form.sellingPoint" />
|
<a-input v-model:value="form.sellingPoint" />
|
||||||
</a-form-item>
|
</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-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-form-item label="设备图片" name="images">
|
<a-form-item label="设备图片" name="images">
|
||||||
|
|||||||
@@ -100,16 +100,24 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'batteryPrice'">
|
<template v-if="column.key === 'batteryPrice'">
|
||||||
<div class="ele-text-placeholder">
|
<div class="ele-text-placeholder">
|
||||||
价格:<span class="ele-text-heading">¥{{ record.batteryPrice }}</span>
|
价格:<span class="ele-text-heading"
|
||||||
|
>¥{{ record.batteryPrice }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="ele-text-placeholder">
|
<div class="ele-text-placeholder">
|
||||||
租金:<span class="ele-text-heading">¥{{ record.batteryRent }}</span>
|
租金:<span class="ele-text-heading"
|
||||||
|
>¥{{ record.batteryRent }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="ele-text-placeholder">
|
<div class="ele-text-placeholder">
|
||||||
押金:<span class="ele-text-heading">¥{{ record.batteryDeposit }}</span>
|
押金:<span class="ele-text-heading"
|
||||||
|
>¥{{ record.batteryDeposit }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="ele-text-placeholder">
|
<div class="ele-text-placeholder">
|
||||||
保险:<span class="ele-text-heading">¥{{ record.batteryInsurance }}</span>
|
保险:<span class="ele-text-heading"
|
||||||
|
>¥{{ record.batteryInsurance }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'more'">
|
<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
|
>已退租</a-tag
|
||||||
>
|
>
|
||||||
</div>
|
</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>
|
||||||
<template v-if="column.key === 'comments'">
|
<template v-if="column.key === 'comments'">
|
||||||
<FormOutlined
|
<FormOutlined
|
||||||
@@ -271,6 +283,11 @@
|
|||||||
filters: orderSource,
|
filters: orderSource,
|
||||||
filterMultiple: false
|
filterMultiple: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '到期时间',
|
||||||
|
dataIndex: 'expirationTime',
|
||||||
|
key: 'expirationTime'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '买家',
|
title: '买家',
|
||||||
dataIndex: 'nickname',
|
dataIndex: 'nickname',
|
||||||
|
|||||||
Reference in New Issue
Block a user