diff --git a/src/models/platform.data.ts b/src/models/platform.data.ts index 7e6f066..25474c5 100644 --- a/src/models/platform.data.ts +++ b/src/models/platform.data.ts @@ -5,7 +5,7 @@ export interface PlatformShop { /** * 授权过期时间 */ - expiresTime?: Date; + expiresTime?: number; /** * 调用参数_动态_空值 */ diff --git a/src/pages/custom/product/sample/components/attr-editor.tsx b/src/pages/custom/product/sample/components/attr-editor.tsx index fe0e67f..b1cdaee 100644 --- a/src/pages/custom/product/sample/components/attr-editor.tsx +++ b/src/pages/custom/product/sample/components/attr-editor.tsx @@ -206,7 +206,7 @@ const SampleAttrEditor: React.FC = (props) => { <> { onCancel() }} extra={ diff --git a/src/pages/custom/template/dict/dict-detail-editor.tsx b/src/pages/custom/template/dict/dict-detail-editor.tsx index 588c804..79ac4d7 100644 --- a/src/pages/custom/template/dict/dict-detail-editor.tsx +++ b/src/pages/custom/template/dict/dict-detail-editor.tsx @@ -58,7 +58,7 @@ export default (props: { <> onCancel()} diff --git a/src/pages/custom/template/dict/dict-editor.tsx b/src/pages/custom/template/dict/dict-editor.tsx index 96b6baa..782e929 100644 --- a/src/pages/custom/template/dict/dict-editor.tsx +++ b/src/pages/custom/template/dict/dict-editor.tsx @@ -58,7 +58,7 @@ export default (props: { <> onCancel()} diff --git a/src/pages/system/dept/create-department.tsx b/src/pages/system/dept/create-department.tsx index a96d115..7adf340 100644 --- a/src/pages/system/dept/create-department.tsx +++ b/src/pages/system/dept/create-department.tsx @@ -61,7 +61,7 @@ const DepartmentEditor: React.FC = (props) => { <> onCancel()} diff --git a/src/pages/system/post/create-position.tsx b/src/pages/system/post/create-position.tsx index 201e272..f6e65f3 100644 --- a/src/pages/system/post/create-position.tsx +++ b/src/pages/system/post/create-position.tsx @@ -61,7 +61,7 @@ const PositionEditor: React.FC = (props) => { <> onCancel()} diff --git a/src/pages/system/shop/manage/index.tsx b/src/pages/system/shop/manage/index.tsx index 9369c0e..ff3bb6c 100644 --- a/src/pages/system/shop/manage/index.tsx +++ b/src/pages/system/shop/manage/index.tsx @@ -217,14 +217,14 @@ export default () => { pagination={false} /> - {/* { load(); seEditorVisable(false); }} onCancel={() => { seEditorVisable(false) }} visible={editorVisable} - data={editData} /> */} + data={editData} /> ); }; diff --git a/src/pages/system/shop/manage/shop-editor.tsx b/src/pages/system/shop/manage/shop-editor.tsx index ea8b813..a035124 100644 --- a/src/pages/system/shop/manage/shop-editor.tsx +++ b/src/pages/system/shop/manage/shop-editor.tsx @@ -1,9 +1,8 @@ -import React, { useEffect, useState } from 'react' -import { Form, Input, InputNumber, Radio, Modal, Select, DatePicker } from 'antd'; -import tenantService from '@/request/service/tenant'; -import tenantPkgService from '@/request/service/tenant-package'; +import React, { useEffect, useState } from 'react'; +import { Form, Input, InputNumber, Radio, Modal, Steps, DatePicker, Button } from 'antd'; +import platformShopService from '@/request/service/platform-shop'; import { useRequest } from '@/hooks/use-request'; -import type { TenantVO } from '@/models' +import type { PlatformShop } from '@/models' import { antdUtils } from '@/utils/antd'; import customParseFormat from 'dayjs/plugin/customParseFormat'; @@ -19,45 +18,56 @@ const layout = { interface EditorProps { visible: boolean; onCancel: (flag?: boolean) => void; - onSave: (role: TenantVO) => void; - data?: TenantVO | null; + onSave: (role: PlatformShop) => void; + data?: PlatformShop | null; } - const TenantEditor: React.FC = (props) => { const { visible, onCancel, onSave, data } = props; - const { runAsync: updateApi } = useRequest(tenantService.updateTenantApi, { manual: true }); - const { runAsync: createApi } = useRequest(tenantService.createTenantApi, { manual: true }); - const { data: tenanPackages, run: getTenantPackageList } = useRequest(tenantPkgService.getTenantPackageList, { manual: true }); + const { runAsync: updateApi } = useRequest(platformShopService.updatePlatformShop, { manual: true }); + const { runAsync: createApi } = useRequest(platformShopService.createPlatformShop, { manual: true }); const isEdit = !!data; + const [current, setCurrent] = useState(0); + + const next = async () => { + const isValidate = await form.validateFields(); + console.log(isValidate) + setCurrent(current + 1); + }; + const prev = () => { + setCurrent(current - 1); + }; const [saveLoading, setSaveLoading] = useState(false); const [form] = Form.useForm(); + const [shopForm] = Form.useForm(); useEffect(() => { if (visible) { if (data) { form.setFieldsValue(data); - form.setFieldValue('expireTime', dayjs(data.expireTime)) + form.setFieldValue('expiresTime', dayjs(data.expiresTime)); + shopForm.setFieldsValue(data.shopConfig); + } else { + form.setFieldValue("shopStatus", 0); } } else { form.resetFields(); + shopForm.resetFields(); } }, [visible]); - useEffect(() => { - getTenantPackageList() - }, [getTenantPackageList]) - const save = async () => { + await shopForm.validateFields(); setSaveLoading(true); const fieldValues = form.getFieldsValue(); - const expireTime = dayjs(form.getFieldValue('expireTime')).toDate().getTime() - const newValue = isEdit ? { ...data, ...fieldValues, expireTime } : {...fieldValues, expireTime}; + const expireTime = dayjs(form.getFieldValue('expiresTime')).toDate().getTime(); + const shopFieldValues = shopForm.getFieldsValue(); + const newValue = isEdit ? { ...data, ...fieldValues, expireTime, shopConfig: { ...shopFieldValues } } : { ...fieldValues, expireTime, shopConfig: { ...shopFieldValues } }; const [error, { msg, code }] = isEdit ? await updateApi(newValue) : await createApi(newValue); if (!error && code === 0) { onSave(newValue); @@ -74,85 +84,63 @@ const TenantEditor: React.FC = (props) => { <> onCancel()} - confirmLoading= {saveLoading} + footer={null} + confirmLoading={saveLoading} destroyOnClose > + +
- - - - - - - + hidden={current === 1} - - + - - - + - + - - - - - = (props) => { - - + + + + -
) diff --git a/src/pages/system/tenant/list/tenant-editor.tsx b/src/pages/system/tenant/list/tenant-editor.tsx index ea8b813..8f9aeaf 100644 --- a/src/pages/system/tenant/list/tenant-editor.tsx +++ b/src/pages/system/tenant/list/tenant-editor.tsx @@ -74,7 +74,7 @@ const TenantEditor: React.FC = (props) => { <> onCancel()} diff --git a/src/pages/system/tenant/package/tenant-pkg-editor.tsx b/src/pages/system/tenant/package/tenant-pkg-editor.tsx index 4e3c931..3459adb 100644 --- a/src/pages/system/tenant/package/tenant-pkg-editor.tsx +++ b/src/pages/system/tenant/package/tenant-pkg-editor.tsx @@ -89,7 +89,7 @@ const TenantPackageEditor: React.FC = (props) => { <> { - return request.put(`${BASE_URL}/update`, data); + return request.post(`${BASE_URL}/update`, data); }, // 删除平台店铺