新增:商户入驻申请

This commit is contained in:
2024-09-09 01:14:20 +08:00
parent a677b9b094
commit a1a0b360b0
4 changed files with 101 additions and 94 deletions

View File

@@ -14,6 +14,8 @@ export interface MerchantApply {
phone?: string;
// 商户姓名
realName?: string;
// 工作人员名称
name2?: string;
// 店铺类型
shopType?: string;
// 商户分类
@@ -32,6 +34,7 @@ export interface MerchantApply {
goodsReview?: number;
// 备注
comments?: string;
reason?: string;
// 状态
status?: number;
// 排序号

View File

@@ -26,9 +26,7 @@
v-model:value="form.merchantName"
/>
</a-form-item>
<a-form-item
label="商户图标"
name="image">
<a-form-item label="商户图标" name="image">
<SelectFile
:placeholder="`请选择图片`"
:limit="1"
@@ -51,63 +49,39 @@
v-model:value="form.realName"
/>
</a-form-item>
<a-form-item label="店铺类型" name="shopType">
<a-form-item label="工作负责人" name="name2">
<a-input
allow-clear
placeholder="请输入店铺类型"
placeholder="工作负责人名称"
v-model:value="form.name2"
/>
</a-form-item>
<a-form-item label="店铺类型" name="shopType">
<SelectMerchantType
:placeholder="`请选择店铺类型`"
v-model:value="form.shopType"
@done="chooseShopType"
/>
</a-form-item>
<a-form-item label="商户分类" name="category">
<a-input
allow-clear
placeholder="请输入商户分类"
<industry-select
v-model:value="form.category"
/>
</a-form-item>
<a-form-item label="手续费" name="commission">
<a-input
allow-clear
placeholder="请输入手续费"
v-model:value="form.commission"
/>
</a-form-item>
<a-form-item label="关键字" name="keywords">
<a-input
allow-clear
placeholder="请输入关键字"
v-model:value="form.keywords"
valueField="label"
placeholder="请选择所属行业"
class="ele-fluid"
@change="onIndustry"
/>
</a-form-item>
<a-form-item label="资质图片" name="files">
<a-input
allow-clear
placeholder="请输入资质图片"
v-model:value="form.files"
<SelectFile
:placeholder="`请选择图片`"
:limit="9"
:data="files"
@done="chooseFiles"
@del="onDeleteFiles"
/>
</a-form-item>
<a-form-item label="是否自营" name="ownStore">
<a-input
allow-clear
placeholder="请输入是否自营"
v-model:value="form.ownStore"
/>
</a-form-item>
<a-form-item label="是否推荐" name="recommend">
<a-input
allow-clear
placeholder="请输入是否推荐"
v-model:value="form.recommend"
/>
</a-form-item>
<a-form-item label="是否需要审核" name="goodsReview">
<a-input
allow-clear
placeholder="请输入是否需要审核"
v-model:value="form.goodsReview"
/>
</a-form-item>
<a-form-item label="备注" name="comments">
<a-form-item label="产品介绍" name="comments">
<a-textarea
:rows="4"
:maxlength="200"
@@ -115,19 +89,18 @@
v-model:value="form.comments"
/>
</a-form-item>
<a-form-item label="状态" name="status">
<a-form-item label="审核状态" name="status">
<a-radio-group v-model:value="form.status">
<a-radio :value="0">显示</a-radio>
<a-radio :value="1">隐藏</a-radio>
<a-radio :value="1">审核通过</a-radio>
<a-radio :value="2">驳回</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排序号" name="sortNumber">
<a-input-number
:min="0"
:max="9999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
<a-form-item v-if="form.status == 2" label="驳回原因" name="comments">
<a-textarea
:rows="4"
:maxlength="200"
placeholder="请输入驳回原因"
v-model:value="form.reason"
/>
</a-form-item>
</a-form>
@@ -138,13 +111,17 @@
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject, uuid } from 'ele-admin-pro';
import { addMerchantApply, updateMerchantApply } from '@/api/shop/merchantApply';
import {
addMerchantApply,
updateMerchantApply
} from '@/api/shop/merchantApply';
import { MerchantApply } from '@/api/shop/merchantApply/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance } from 'ant-design-vue/es/form';
import { FileRecord } from '@/api/system/file/model';
import { MerchantType } from '@/api/shop/merchantType/model';
// 是否是修改
const isUpdate = ref(false);
@@ -172,6 +149,7 @@
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]);
const files = ref<ItemType[]>([]);
// 用户信息
const form = reactive<MerchantApply>({
@@ -180,6 +158,7 @@
image: undefined,
phone: undefined,
realName: undefined,
name2: '',
shopType: undefined,
category: undefined,
commission: undefined,
@@ -189,15 +168,11 @@
recommend: undefined,
goodsReview: undefined,
comments: undefined,
reason: undefined,
status: undefined,
sortNumber: undefined,
tenantId: undefined,
createTime: undefined,
merchantApplyId: undefined,
merchantApplyName: '',
status: 0,
comments: '',
sortNumber: 100
createTime: undefined
});
/* 更新visible */
@@ -207,11 +182,11 @@
// 表单验证规则
const rules = reactive({
merchantApplyName: [
merchantName: [
{
required: true,
type: 'string',
message: '请填写商户入驻申请名称',
message: '请填写商户名称',
trigger: 'blur'
}
]
@@ -231,6 +206,26 @@
form.image = '';
};
const chooseShopType = (data: MerchantType) => {
form.shopType = data.name;
};
const onIndustry = (item: any) => {
form.category = item[0] + '/' + item[1];
};
const chooseFiles = (data: FileRecord) => {
files.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
};
const onDeleteFiles = (index: number) => {
files.value.splice(index, 1);
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
@@ -245,7 +240,9 @@
const formData = {
...form
};
const saveOrUpdate = isUpdate.value ? updateMerchantApply : addMerchantApply;
const saveOrUpdate = isUpdate.value
? updateMerchantApply
: addMerchantApply;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;
@@ -268,12 +265,13 @@
images.value = [];
if (props.data) {
assignObject(form, props.data);
if(props.data.image){
form.status = 1;
if (props.data.image) {
images.value.push({
uid: uuid(),
url: props.data.image,
status: 'done'
})
});
}
isUpdate.value = true;
} else {

View File

@@ -1,12 +1,12 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>
<span>添加</span>
</a-button>
<!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
<!-- <template #icon>-->
<!-- <PlusOutlined />-->
<!-- </template>-->
<!-- <span>添加</span>-->
<!-- </a-button>-->
</a-space>
</template>

View File

@@ -1,13 +1,18 @@
<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<a-card
title="商户申请列表"
:bordered="false"
:body-style="{ padding: '16px' }"
>
<ele-pro-table
ref="tableRef"
row-key="merchantApplyId"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
:toolbar="false"
tool-class="ele-toolbar-form"
class="sys-org-table"
>
@@ -25,8 +30,9 @@
<a-image :src="record.image" :width="50" />
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="orange">处理</a-tag>
<a-tag v-if="record.status === 1" color="green">通过</a-tag>
<a-tag v-if="record.status === 0" color="orange">审核</a-tag>
<a-tag v-if="record.status === 1" color="green">审核通过</a-tag>
<a-tag v-if="record.status === 2" color="green">驳回</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
@@ -67,7 +73,7 @@
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from '../merchant/components/search.vue';
import Search from './components/search.vue';
import MerchantApplyEdit from './components/merchantApplyEdit.vue';
import {
pageMerchantApply,
@@ -138,6 +144,12 @@
key: 'phone',
align: 'center'
},
{
title: '店铺类型',
dataIndex: 'shopType',
key: 'shopType',
align: 'center'
},
{
title: '申请时间',
dataIndex: 'createTime',
@@ -147,12 +159,6 @@
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:MM:ss')
},
{
title: '店铺类型',
dataIndex: 'shopType',
key: 'shopType',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',