fix: 商品、订单部分相关代码生成,下一步先把商品搞完再搞订单
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-05-20 16:58:18 +08:00
parent 9a2e0fb626
commit 70f24e071c
6 changed files with 0 additions and 573 deletions

View File

@@ -1,42 +0,0 @@
import { requestClient } from '#/api/request';
const prefix = 'mall/';
/**
* 分页查询店铺管理列表
* @param data
*/
export async function getStoreListApi(data: any) {
return requestClient.get<any>(`${prefix}list`, { params: data });
}
/**
* 获取店铺管理详情
* @param id
*/
export async function getStoreInfoApi(id: number) {
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}
/**
* 新增店铺管理
* @param data
*/
export async function createStoreApi(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}create`, data);
}
/**
* 编辑店铺管理
* @param data
*/
export async function updateStoreApi(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}update`, data);
}
/**
* 删除店铺管理
* @param data
*/
export async function deleteStoreApi(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}delete`, data);
}

View File

@@ -1,66 +0,0 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { createStoreApi, updateStoreApi } from '../api';
import { modalFormProps } from '../config/form';
defineOptions({
name: 'StoreDemo',
});
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
const submitApi = isUpdate.value ? updateStoreApi : createStoreApi;
submitApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
formApi.setValues(values);
}
}
},
});
</script>
<template>
<Modal
:title="`${isUpdate === true ? '编辑' : '新增'}店铺管理`"
class="w-[30%]"
>
<Form />
</Modal>
</template>

View File

@@ -1,179 +0,0 @@
import type { VbenFormProps } from '#/adapter/form';
import { getStoreClassificationOptionApi } from '#/views/my-gen/mall-classification/api';
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
// handleSubmit: onSubmit,
layout: 'horizontal',
schema: [
{
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
formItemClass: 'col-span-6',
dependencies: {
show: false,
triggerFields: ['id'],
},
},
// 生成的表单字段
{
fieldName: 'name',
label: '店铺名称',
component: 'VbenInput',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'level',
label: '店铺等级',
component: 'InputNumber',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'introduction',
label: '店铺简介',
component: 'Textarea',
rules: 'required',
},
{
fieldName: 'description',
label: '详细介绍',
component: 'Textarea',
rules: 'required',
},
{
fieldName: 'phone',
label: '商家电话号码',
component: 'VbenInput',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'person',
label: '联系人名称',
component: 'VbenInput',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'id_card',
label: '身份证号码',
component: 'VbenInput',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'classification_id',
label: '行业',
component: 'ApiTreeSelect',
componentProps: {
childrenField: 'children',
labelField: 'name',
valueField: 'id',
api: getStoreClassificationOptionApi,
},
formItemClass: 'col-span-6',
defaultValue: 0,
rules: 'required',
},
{
fieldName: 'is_featured',
label: '推荐店铺',
component: 'RadioGroup',
componentProps: {
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 0,
},
],
},
formItemClass: 'col-span-6',
defaultValue: 0,
rules: 'required',
},
{
fieldName: 'chain',
label: '连锁',
component: 'RadioGroup',
componentProps: {
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 0,
},
],
},
formItemClass: 'col-span-6',
defaultValue: 0,
rules: 'required',
},
{
fieldName: 'business_suspended',
label: '暂停营业',
component: 'RadioGroup',
componentProps: {
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 0,
},
],
},
formItemClass: 'col-span-6',
defaultValue: 0,
rules: 'required',
},
{
fieldName: 'avatar',
label: '店铺头像',
component: 'Avatar',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'business_license',
label: '营业执照',
component: 'Avatar',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'id_card_portrait_side',
label: '身份证人面',
component: 'Avatar',
formItemClass: 'col-span-6',
rules: 'required',
},
{
fieldName: 'id_card_national_emblem_side',
label: '身份证国徽面',
component: 'Avatar',
formItemClass: 'col-span-6',
rules: 'required',
},
],
showDefaultActions: false,
};

View File

@@ -1,55 +0,0 @@
import type { VbenFormProps } from '#/adapter/form';
// import dayjs from 'dayjs';
export const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
schema: [
// 生成的搜索字段
{
fieldName: 'name',
label: '店铺名称',
component: 'VbenInput',
},
{
fieldName: 'level',
label: '店铺等级',
component: 'InputNumber',
},
{
fieldName: 'phone',
label: '商家电话号码',
component: 'VbenInput',
},
{
fieldName: 'person',
label: '联系人名称',
component: 'VbenInput',
},
{
fieldName: 'is_featured',
label: '是否为推荐店铺',
component: 'VbenSelect',
},
{
fieldName: 'chain',
label: '是否连锁',
component: 'VbenSelect',
},
{
fieldName: 'business_suspended',
label: '是否暂停营业',
component: 'VbenSelect',
},
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,
submitButtonOptions: {
content: '查询',
},
// 是否在字段值改变时提交表单
submitOnChange: true,
// 按下回车时是否提交表单
submitOnEnter: false,
};

View File

@@ -1,94 +0,0 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getStoreListApi } from '../api';
interface RowType {
id: string;
name: string;
logo: string;
introduce: string;
created_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
// 生成的列表字段
{ field: 'name', title: '店铺名称' },
{ field: 'level', title: '店铺等级' },
{ field: 'avatar', title: '店铺头像', slots: { default: 'avatar' } },
{ field: 'introduction', title: '店铺简介' },
// { field: 'description', title: '详细介绍' },
{ field: 'phone', title: '商家电话号码' },
{ field: 'person', title: '联系人名称' },
{ field: 'id_card', title: '身份证号码' },
{ field: 'qr_code', title: '店铺二维码' },
{ field: 'is_featured', title: '是否为推荐店铺' },
{
field: 'business_license',
title: '营业执照',
slots: { default: 'business_license' },
},
{
field: 'id_card_portrait_side',
title: '身份证人面',
slots: { default: 'id_card_portrait_side' },
},
{
field: 'id_card_national_emblem_side',
title: '身份证国徽面',
slots: { default: 'id_card_national_emblem_side' },
},
{ field: 'chain', title: '是否连锁' },
{ field: 'business_suspended', title: '是否暂停营业' },
{ field: 'created_at', title: '创建时间' },
{ field: 'updated_at', title: '编辑时间' },
{ type: 'html', title: '操作', slots: { default: 'action' } },
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getStoreListApi({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
custom: {
// 自定义列-图标
icon: 'vxe-icon-menu',
},
},
showOverflow: false,
};

View File

@@ -1,137 +0,0 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, Image, message } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import { deleteStoreApi } from './api';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents,
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: FormModalDemo,
});
const showModal = (data = {}, isUpdate = false) => {
formModalApi.setData({
// 表单值
values: data,
update: isUpdate,
gridApi,
});
formModalApi.open();
};
const hasDelete = (row: any) => {
let ids = [];
if (row) {
ids.push(row);
} else {
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
}
deleteStoreApi({ ids }).then(() => {
message.success('删除成功!');
gridApi.reload();
});
};
</script>
<template>
<Page auto-content-height title="店铺管理管理">
<FormModal />
<Grid>
<template #toolbar-buttons>
<TableAction
:actions="[
{
label: '新增',
type: 'primary',
icon: 'ant-design:plus-outlined',
onClick: showModal.bind(null),
},
]"
:drop-down-actions="[
{
label: '删除',
icon: 'ant-design:delete-outlined',
ifShow: hasTopTableDropDownActions,
popConfirm: {
title: '确定删除吗',
confirm: hasDelete.bind(null, false),
},
},
]"
>
<template #more>
<Button style="margin-left: 16px"> 批量操作 </Button>
</template>
</TableAction>
</template>
<template #avatar="{ row }">
<Image :src="row.avatar" height="30" width="30" />
</template>
<template #business_license="{ row }">
<Image :src="row.business_license" height="30" width="30" />
</template>
<template #id_card_portrait_side="{ row }">
<Image :src="row.id_card_portrait_side" height="30" width="30" />
</template>
<template #id_card_national_emblem_side="{ row }">
<Image :src="row.id_card_national_emblem_side" height="30" width="30" />
</template>
<template #toolbar-tools></template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '编辑',
type: 'link',
icon: 'uil:edit',
size: 'small',
// auth: ['admin', 'sys:role:detail'],
onClick: showModal.bind(null, row, true),
},
{
label: '删除',
type: 'link',
icon: 'ant-design:delete-outlined',
size: 'small',
// auth: ['admin', 'sys:role:detail'],
popConfirm: {
title: '确定删除吗?',
confirm: hasDelete.bind(null, row.id),
},
},
]"
:drop-down-actions="[]"
/>
</template>
</Grid>
</Page>
</template>