Merge branch 'develop_temp' of gitee.com:L-Shilin/go-fly-platform-services into feature_dzc
# Conflicts: # zlt-business/order-center/src/main/java/com/central/order/service/impl/OrderServiceImpl.java
This commit is contained in:
Binary file not shown.
+31
-1
@@ -238,8 +238,38 @@ const CreateForm: React.FC<CreateFormProps> = ({
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
{/* 套餐配置 */}
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="vlogCount"
|
||||
label="Vlog数量"
|
||||
min={0}
|
||||
initialValue={0}
|
||||
placeholder="请输入Vlog数量"
|
||||
/>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="videoCount"
|
||||
label="视频数量"
|
||||
min={0}
|
||||
initialValue={0}
|
||||
placeholder="请输入视频数量"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="photoCount"
|
||||
label="照片数量"
|
||||
min={0}
|
||||
initialValue={0}
|
||||
placeholder="请输入照片数量"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateForm;
|
||||
export default CreateForm;
|
||||
|
||||
@@ -245,6 +245,33 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
{/* 套餐配置 */}
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="vlogCount"
|
||||
label="Vlog数量"
|
||||
min={0}
|
||||
placeholder="请输入Vlog数量"
|
||||
/>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="videoCount"
|
||||
label="视频数量"
|
||||
min={0}
|
||||
placeholder="请输入视频数量"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
width="md"
|
||||
name="photoCount"
|
||||
label="照片数量"
|
||||
min={0}
|
||||
placeholder="请输入照片数量"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { deleteQrcode, qrcode, saveOrUpdateQrcode, getTourismList, getVideoTemplateList, getTenantList } from '@/services/orders/api';
|
||||
import { deleteQrcode, qrcode, saveOrUpdateQrcodeWithPlan, getTourismList, getVideoTemplateList, getTenantList, getPackageByCode } from '@/services/orders/api';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import {
|
||||
@@ -121,29 +121,55 @@ const TableList: React.FC = () => {
|
||||
return <Tag color={statusInfo.color}>{statusInfo.text}</Tag>;
|
||||
};
|
||||
|
||||
// 处理添加
|
||||
// 处理添加(先创建二维码,再创建套餐)
|
||||
const handleAdd = async (fields: Partial<ORDERS.Qrcode>) => {
|
||||
const template = templateOptions.find(item => item.value === fields.templateId);
|
||||
return handleApiRequest(
|
||||
() => saveOrUpdateQrcode({
|
||||
...fields,
|
||||
} as ORDERS.Qrcode),
|
||||
'正在添加',
|
||||
'添加成功'
|
||||
);
|
||||
const hide = message.loading('正在添加');
|
||||
try {
|
||||
const { vlogCount, videoCount, photoCount, ...qrcodePayload } = (fields || {}) as any;
|
||||
const res = await saveOrUpdateQrcodeWithPlan({
|
||||
qrCode: qrcodePayload as ORDERS.Qrcode,
|
||||
vlogCount: Number(vlogCount ?? 0),
|
||||
videoCount: Number(videoCount ?? 0),
|
||||
photoCount: Number(photoCount ?? 0),
|
||||
});
|
||||
if (res.resp_code !== 0) {
|
||||
message.error(res.resp_msg || '创建失败');
|
||||
return false;
|
||||
}
|
||||
message.success('添加成功');
|
||||
return true;
|
||||
} catch (e) {
|
||||
message.error('添加失败');
|
||||
return false;
|
||||
} finally {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理编辑
|
||||
// 处理编辑(更新二维码,同时新增/更新套餐)
|
||||
const handleEdit = async (original: ORDERS.Qrcode, fields: Partial<ORDERS.Qrcode>) => {
|
||||
const template = templateOptions.find(item => item.value === fields.templateId);
|
||||
return handleApiRequest(
|
||||
() => saveOrUpdateQrcode({
|
||||
id: original.id,
|
||||
...fields
|
||||
}),
|
||||
'正在更新',
|
||||
'修改成功'
|
||||
);
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const { vlogCount, videoCount, photoCount, ...qrcodePayload } = (fields || {}) as any;
|
||||
const qrPayload = { id: original.id, codeId: original.codeId, ...(qrcodePayload as any) } as ORDERS.Qrcode;
|
||||
const res = await saveOrUpdateQrcodeWithPlan({
|
||||
qrCode: qrPayload,
|
||||
vlogCount: vlogCount as number | undefined,
|
||||
videoCount: videoCount as number | undefined,
|
||||
photoCount: photoCount as number | undefined,
|
||||
});
|
||||
if (res.resp_code !== 0) {
|
||||
message.error(res.resp_msg || '更新失败');
|
||||
return false;
|
||||
}
|
||||
message.success('修改成功');
|
||||
return true;
|
||||
} catch (e) {
|
||||
message.error('修改失败');
|
||||
return false;
|
||||
} finally {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理删除
|
||||
@@ -525,8 +551,19 @@ const TableList: React.FC = () => {
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Link
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
setCurrentRow(record);
|
||||
try {
|
||||
if (record?.codeId) {
|
||||
const planRes = await getPackageByCode(record.codeId);
|
||||
const plan = (planRes.resp_code === 0 && Array.isArray(planRes.data) && planRes.data.length > 0) ? planRes.data[0] : undefined;
|
||||
if (plan) {
|
||||
setCurrentRow(prev => ({ ...(prev as any), vlogCount: plan.vlogCount, videoCount: plan.videoCount, photoCount: plan.photoCount } as any));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore preload error
|
||||
}
|
||||
handleUpdateModalVisible(true);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -112,6 +112,34 @@ export async function saveOrUpdateQrcode(data: ORDERS.Qrcode): Promise<API.Resul
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 根据二维码编码获取套餐列表 */
|
||||
export async function getPackageByCode(codeId: string): Promise<API.Result<ORDERS.PackagePlan[]>> {
|
||||
return request<API.Result<ORDERS.PackagePlan[]>>(`/api-order/package/byCode/${codeId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
/** 新增或更新套餐 */
|
||||
export async function saveOrUpdatePackagePlan(data: ORDERS.PackagePlan): Promise<API.Result<ORDERS.PackagePlan>> {
|
||||
return request<API.Result<ORDERS.PackagePlan>>('/api-order/package', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 一次性创建/修改二维码及套餐 */
|
||||
export async function saveOrUpdateQrcodeWithPlan(payload: {
|
||||
qrCode: ORDERS.Qrcode;
|
||||
vlogCount?: number;
|
||||
videoCount?: number;
|
||||
photoCount?: number;
|
||||
}): Promise<API.Result<ORDERS.Qrcode>> {
|
||||
return request<API.Result<ORDERS.Qrcode>>('/api-order/qrcode/withPlan', {
|
||||
method: 'POST',
|
||||
data: payload,
|
||||
});
|
||||
}
|
||||
|
||||
export async function homeCarousel(params?: { [key: string]: string | number }) {
|
||||
const { current, pageSize, ...rest } = params ?? {};
|
||||
const result = await request<SYSTEM.Page<ORDERS.HomeCarousel>>('/api-order/home/carousel', {
|
||||
@@ -480,4 +508,4 @@ export async function getTenantList(params: {
|
||||
return request('/api-uaa/clients/all', {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,6 +248,18 @@ declare namespace ORDERS {
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
}
|
||||
|
||||
/** 套餐定义 */
|
||||
type PackagePlan = {
|
||||
id?: number;
|
||||
codeId: string;
|
||||
vlogCount?: number;
|
||||
videoCount?: number;
|
||||
photoCount?: number;
|
||||
tenantId?: string;
|
||||
createTime?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace API {
|
||||
@@ -292,4 +304,4 @@ declare namespace API {
|
||||
queueCount?: number;
|
||||
estimatedTime?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user