dev-v2
parent
3872f1fbdf
commit
f2ec57601c
@ -0,0 +1,450 @@
|
||||
import Constants from '@/constants';
|
||||
import { getPbcBusinessListUsingPost } from '@/services/pop-b2b2c/pbcBusinessController';
|
||||
import { listAdminTreeUsingGet } from '@/services/pop-b2b2c/pbcCategoryController';
|
||||
import { getRecordByL3CategoryIdUsingGet } from '@/services/pop-b2b2c/pbcCommonDataController';
|
||||
import { addOrUpdateProductForAdminUsingPost } from '@/services/pop-b2b2c/pbcProductController';
|
||||
import { getCities } from '@/utils/cities';
|
||||
import {
|
||||
ProCard,
|
||||
ProForm,
|
||||
ProFormCascader,
|
||||
ProFormDigit,
|
||||
ProFormInstance,
|
||||
ProFormList,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
ProFormUploadButton,
|
||||
} from '@ant-design/pro-components';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { DndContext, DragEndEvent, PointerSensor, useSensor } from '@dnd-kit/core';
|
||||
import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
||||
import { Button, Col, message, Row } from 'antd';
|
||||
import Upload, { RcFile, UploadFile } from 'antd/es/upload';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { CSS } from '@dnd-kit/utilities';
|
||||
|
||||
interface DraggableUploadListItemProps {
|
||||
originNode: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
||||
file: UploadFile<any>;
|
||||
}
|
||||
|
||||
const DraggableUploadListItem = ({ originNode, file }: DraggableUploadListItemProps) => {
|
||||
let { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
||||
id: file.uid,
|
||||
});
|
||||
|
||||
const style: React.CSSProperties = {
|
||||
transform: CSS.Translate.toString(transform),
|
||||
transition,
|
||||
cursor: 'move',
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={setNodeRef}
|
||||
style={style}
|
||||
// prevent preview event when drag end
|
||||
className={isDragging ? 'is-dragging' : ''}
|
||||
{...attributes}
|
||||
{...listeners}
|
||||
>
|
||||
{/* hide error tooltip when dragging */}
|
||||
{file.status === 'error' && isDragging ? originNode.props.children : originNode}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const Detail: React.FC<any> = () => {
|
||||
const [cities] = useState(() => getCities())
|
||||
|
||||
const [colorData, setColorData] = useState<API.PbcCommonData[]>()
|
||||
const [commonDataList, setCommonDataList] = useState<API.PbcCommonData[]>()
|
||||
|
||||
const formRef = useRef<ProFormInstance>();
|
||||
|
||||
const onSave = () => {
|
||||
formRef.current?.submit()
|
||||
const values = formRef.current?.getFieldsValue()
|
||||
console.log(values.colorItems)
|
||||
console.log(values.specItems)
|
||||
}
|
||||
|
||||
const handleCategoryChange = (value: any[], items: API.PbcCategory[]) => {
|
||||
const [c1, c2, c3] = items
|
||||
formRef.current?.setFieldsValue({
|
||||
pbcProductTopCategoryName: c1?.pbcCategoryName,
|
||||
pbcProductParentCategoryName: c2?.pbcCategoryName,
|
||||
pbcProductCategoryName: c3?.pbcCategoryName,
|
||||
})
|
||||
if (value.length === 3) {
|
||||
getRecordByL3CategoryIdUsingGet({ l3CategoryId: value[2] }).then(res => {
|
||||
if (res.retcode && res.data) {
|
||||
setColorData(res.data.colorData)
|
||||
setCommonDataList(res.data.commonDataList)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const onSubmit = async (values: any) => {
|
||||
let pbcProductOriginalProvince = undefined, pbcProductOriginalCity = undefined;
|
||||
if (values?.pbcZone?.length) {
|
||||
([pbcProductOriginalProvince, pbcProductOriginalCity] = values.pbcZone);
|
||||
}
|
||||
const [pbcProductTopCategoryId, pbcProductParentCategoryId, pbcProductCategoryId] = values.pbcProductCategoryIdList
|
||||
console.log(values.colorItems)
|
||||
console.log(values.specItems)
|
||||
const specItems: API.PbcProductCommonData[] = []
|
||||
if (colorData && values.colorItems && values.colorItems.length > 0) {
|
||||
for (let i = 0; i < values.colorItems.length; i++) {
|
||||
const element = values.colorItems[i];
|
||||
specItems.push({
|
||||
pbcCommonDataId: colorData.length > 0 ? colorData[0].pbcId : undefined,
|
||||
pbcSystemName: '颜色',
|
||||
pbcSystemInputType: 'text',
|
||||
pbcCommonDataSystem: element.name,
|
||||
pbcColorImageUrl: element.value.length > 0 ? element.value[0].response.data : ''
|
||||
})
|
||||
}
|
||||
}
|
||||
if (commonDataList) {
|
||||
for (let i = 0; i < commonDataList.length; i++) {
|
||||
const element = commonDataList[i];
|
||||
console.log(values[`value${i}`])
|
||||
let name = ''
|
||||
if (element.pbcSystemInputType === 'select' && element.commonDataValueList) {
|
||||
name = element.commonDataValueList.find(e => e.pbcId === values[`value${i}`])?.pbcSystemValue || ''
|
||||
}
|
||||
specItems.push({
|
||||
pbcCommonDataId: element.pbcId,
|
||||
pbcSystemName: element.pbcSystemName,
|
||||
pbcSystemInputType: element.pbcSystemInputType,
|
||||
pbcCommonDataValueId: element.pbcSystemInputType === 'select' ? values[`value${i}`] : undefined,
|
||||
pbcCommonDataSystemValue: element.pbcSystemInputType === 'select' ? name : undefined,
|
||||
pbcCommonDataSystem: element.pbcSystemInputType === 'select' ? undefined : values[`value${i}`]
|
||||
})
|
||||
}
|
||||
}
|
||||
const params: API.PbcProductDTO = {
|
||||
...values,
|
||||
pbcProductOriginalProvince,
|
||||
pbcProductOriginalCity,
|
||||
pbcProductTopCategoryId,
|
||||
pbcProductParentCategoryId,
|
||||
pbcProductCategoryId,
|
||||
productCommonDataList: specItems,
|
||||
pbcProductImages: values.pbcProductImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
|
||||
pbcProductDetailImages: values.pbcProductDetailImages.filter((e: any) => e.response && e.response.data).map((e: any) => e.response.data).join(','),
|
||||
pbcZone: undefined,
|
||||
colorItems: undefined,
|
||||
specItems: undefined,
|
||||
pbcProductCategoryIdList: undefined,
|
||||
}
|
||||
const msg = await addOrUpdateProductForAdminUsingPost(params)
|
||||
if (msg.retcode) {
|
||||
message.success("创建成功!")
|
||||
history.back();
|
||||
return true
|
||||
} else {
|
||||
message.error(msg.retmsg)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const sensor = useSensor(PointerSensor, {
|
||||
activationConstraint: { distance: 10 },
|
||||
});
|
||||
|
||||
const onDragEnd = ({ active, over }: DragEndEvent, fieldName: string) => {
|
||||
if (active.id !== over?.id) {
|
||||
const arr = formRef.current?.getFieldValue(fieldName) || []
|
||||
const activeIndex = arr.findIndex((i: any) => i.uid === active.id);
|
||||
const overIndex = arr.findIndex((i: any) => i.uid === over?.id);
|
||||
const newArr = arrayMove(arr, activeIndex, overIndex)
|
||||
formRef.current?.setFieldValue(fieldName, newArr)
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
}}
|
||||
footer={[
|
||||
<Button
|
||||
key="back"
|
||||
onClick={() => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
返回
|
||||
</Button>,
|
||||
<Button type="primary" key="submit" onClick={onSave}>
|
||||
保存
|
||||
</Button>
|
||||
]}
|
||||
>
|
||||
<ProForm layout="horizontal" labelAlign="left" requiredMark={false} formRef={formRef} onFinish={onSubmit} submitter={false}>
|
||||
<ProFormText name="pbcProductTopCategoryName" hidden />
|
||||
<ProFormText name="pbcProductParentCategoryName" hidden />
|
||||
<ProFormText name="pbcProductCategoryName" hidden />
|
||||
<ProCard title="基本信息" style={{ marginBottom: 12 }}>
|
||||
<Row gutter={20}>
|
||||
<Col span={8}>
|
||||
<ProFormSelect
|
||||
label="所属商户"
|
||||
name="pbcBusinessId"
|
||||
rules={[
|
||||
{ required: true, message: '请选择所属商户' }
|
||||
]}
|
||||
request={ async () => {
|
||||
const msg = await getPbcBusinessListUsingPost();
|
||||
if (msg.retcode && msg.data) {
|
||||
return msg.data;
|
||||
}
|
||||
return [];
|
||||
}}
|
||||
fieldProps={{
|
||||
showSearch: true,
|
||||
fieldNames: { label: 'pbcBusinessName', value: 'pbcId' }
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText label="编号" name="pbcProductCode" rules={[
|
||||
{ required: true, message: '请输入商品编号' },
|
||||
]} />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText label="名称" name="pbcProductTitle" rules={[
|
||||
{ required: true, message: '请输入商品名称' },
|
||||
]} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={20}>
|
||||
<Col span={8}>
|
||||
<ProFormCascader label="产地" name="pbcZone" fieldProps={{ options: cities }} />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormText label="价格" name="pbcProductPrice" rules={[
|
||||
{ required: true, message: '请输入商品价格' },
|
||||
]} fieldProps={{ prefix: '¥' }} />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormDigit label="库存" name="pbcProductStock" min={0} fieldProps={{ precision: 0 }} rules={[
|
||||
{ required: true, message: '请输入商品库存' },
|
||||
]} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={20}>
|
||||
<Col span={8}>
|
||||
<ProFormText label="货架号" name="pbcProductShelfNumber" rules={[
|
||||
{ required: true, message: '请输入货架号' }
|
||||
]} />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormCascader label="类目" name="pbcProductCategoryIdList"
|
||||
request={ async () => {
|
||||
const msg = await listAdminTreeUsingGet({ type: 2 });
|
||||
if (msg.retcode && msg.data) {
|
||||
return msg.data;
|
||||
}
|
||||
return [];
|
||||
}}
|
||||
fieldProps={{fieldNames: { label: 'pbcCategoryName', value: 'pbcId', children: 'children' }, onChange: handleCategoryChange}}
|
||||
rules={[
|
||||
{ required: true, message: '请选择类目' },
|
||||
]} />
|
||||
</Col>
|
||||
</Row>
|
||||
{colorData ? <ProForm.Item isListField style={{ marginBlockEnd: 0 }} label="颜色" required>
|
||||
<ProFormList
|
||||
name="colorItems"
|
||||
creatorButtonProps={{
|
||||
creatorButtonText: '新增',
|
||||
icon: false,
|
||||
type: 'link',
|
||||
style: { width: 'unset' },
|
||||
}}
|
||||
copyIconProps={false}
|
||||
deleteIconProps={{ tooltipText: '删除' }}
|
||||
itemRender={({ listDom, action }) => (
|
||||
<div
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
marginInlineEnd: 25,
|
||||
}}
|
||||
>
|
||||
{listDom}
|
||||
{action}
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<Row align="middle" gutter={20}>
|
||||
<Col span={12}>
|
||||
<ProFormText width="sm" name={['name']} placeholder="请输入颜色名" rules={[
|
||||
{ required: true, message: '请输入颜色名' }
|
||||
]} />
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<ProFormUploadButton
|
||||
name={['value']}
|
||||
fieldProps={{
|
||||
name: 'file',
|
||||
accept: 'image/*',
|
||||
headers: {
|
||||
authorization: localStorage.getItem('token') ?? '',
|
||||
},
|
||||
action: process.env.BASE_URL + '/oss/imgUpload',
|
||||
beforeUpload(file: RcFile) {
|
||||
const isLt2M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不能超过10MB!');
|
||||
}
|
||||
return isLt2M || Upload.LIST_IGNORE;
|
||||
},
|
||||
onPreview: async (file) => {
|
||||
|
||||
if (file.uid === '-1') {
|
||||
window.open(file.url);
|
||||
}
|
||||
if (file.response && file.response.retcode) {
|
||||
window.open(file.response.data);
|
||||
}
|
||||
},
|
||||
listType: 'picture-card',
|
||||
}}
|
||||
rules={[
|
||||
{ required: true, message: '请上传颜色图片' },
|
||||
]}
|
||||
max={1}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ProFormList>
|
||||
</ProForm.Item> : null}
|
||||
<Row gutter={20}>
|
||||
<Col span={24}>
|
||||
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, "pbcProductImages")}>
|
||||
<SortableContext items={formRef.current?.getFieldValue("pbcProductImages") ? formRef.current?.getFieldValue("pbcProductImages").map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
|
||||
<ProFormUploadButton
|
||||
label="相册图"
|
||||
name="pbcProductImages"
|
||||
fieldProps={{
|
||||
name: 'file',
|
||||
accept: 'image/*',
|
||||
multiple: true,
|
||||
headers: {
|
||||
authorization: localStorage.getItem('token') ?? '',
|
||||
},
|
||||
itemRender: (originNode, file) => <DraggableUploadListItem originNode={originNode} file={file} />,
|
||||
action: process.env.BASE_URL + '/oss/imgUpload',
|
||||
beforeUpload(file: RcFile) {
|
||||
const isLt2M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不能超过10MB!');
|
||||
}
|
||||
return isLt2M || Upload.LIST_IGNORE;
|
||||
},
|
||||
onPreview: async (file) => {
|
||||
|
||||
if (file.uid === '-1') {
|
||||
window.open(file.url);
|
||||
}
|
||||
if (file.response && file.response.retcode) {
|
||||
window.open(file.response.data);
|
||||
}
|
||||
},
|
||||
listType: 'picture-card',
|
||||
}}
|
||||
rules={[
|
||||
{ required: true, message: '请上传相册图' },
|
||||
]}
|
||||
/>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={20}>
|
||||
<Col span={24}>
|
||||
<DndContext sensors={[sensor]} onDragEnd={(event) => onDragEnd(event, "pbcProductDetailImages")}>
|
||||
<SortableContext items={formRef.current?.getFieldValue("pbcProductDetailImages") ? formRef.current?.getFieldValue("pbcProductDetailImages").map((i: any) => i.uid) : []} strategy={verticalListSortingStrategy}>
|
||||
<ProFormUploadButton
|
||||
label="详情图"
|
||||
name="pbcProductDetailImages"
|
||||
fieldProps={{
|
||||
name: 'file',
|
||||
accept: 'image/*',
|
||||
multiple: true,
|
||||
headers: {
|
||||
authorization: localStorage.getItem('token') ?? '',
|
||||
},
|
||||
itemRender: (originNode, file) => <DraggableUploadListItem originNode={originNode} file={file} />,
|
||||
action: process.env.BASE_URL + '/oss/imgUpload',
|
||||
beforeUpload(file: RcFile) {
|
||||
const isLt2M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不能超过10MB!');
|
||||
}
|
||||
return isLt2M || Upload.LIST_IGNORE;
|
||||
},
|
||||
onPreview: async (file) => {
|
||||
|
||||
if (file.uid === '-1') {
|
||||
window.open(file.url);
|
||||
}
|
||||
if (file.response && file.response.retcode) {
|
||||
window.open(file.response.data);
|
||||
}
|
||||
},
|
||||
listType: 'picture-card',
|
||||
}}
|
||||
rules={[
|
||||
{ required: true, message: '请上传详情图' },
|
||||
]}
|
||||
/>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
</Col>
|
||||
</Row>
|
||||
{commonDataList ? commonDataList.map((e, index) => <Row key={e.pbcId} align="middle" gutter={20}>
|
||||
<Col span={6}>
|
||||
<ProFormText width="sm" disabled name={`name${index}`} initialValue={e.pbcSystemName} placeholder="请输入规格名称" rules={[
|
||||
{ required: true, message: '请输入规格名称' }
|
||||
]} />
|
||||
</Col>
|
||||
<Col span={6}>
|
||||
{e.pbcSystemInputType === 'select' ? <ProFormSelect name={`value${index}`} options={e.commonDataValueList?.map(item => {
|
||||
return {
|
||||
label: item.pbcSystemValue || '',
|
||||
value: item.pbcId
|
||||
}
|
||||
})} /> : <ProFormText width="sm" name={`value${index}`} placeholder="请输入规格描述" />
|
||||
}
|
||||
</Col>
|
||||
</Row>) : null}
|
||||
<Row gutter={20}>
|
||||
<Col span={24}>
|
||||
<ProFormTextArea label="详情描述" name="pbcProductDetail" />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={20}>
|
||||
<Col span={8}>
|
||||
<ProFormSelect label="可见范围" name="pbcProductType" valueEnum={Constants.pbcProductType} rules={[
|
||||
{ required: true, message: '请选择可见范围' },
|
||||
]} />
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<ProFormSelect label="状态" name="pbcState" valueEnum={Constants.pbcState} rules={[
|
||||
{ required: true, message: '请选择上下架状态' },
|
||||
]} />
|
||||
</Col>
|
||||
</Row>
|
||||
</ProCard>
|
||||
</ProForm>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Detail;
|
||||
@ -0,0 +1,198 @@
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Button, message, Popconfirm } from 'antd';
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { Access, useAccess } from 'umi';
|
||||
import UpdateForm from './components/UpdateForm';
|
||||
import { addOrUpdateClassesTypeUsingPost, getClassesTypePageUsingPost, removeTrainingClassesTypeUsingGet } from '@/services/pop-b2b2c/pbcTrainingClassesTypeController';
|
||||
|
||||
/**
|
||||
* 查询表格
|
||||
* @param param0
|
||||
*/
|
||||
const fetchData = async (params: any) => {
|
||||
const msg = await getClassesTypePageUsingPost({ pbcType: params.pbcType || '' });
|
||||
return {
|
||||
data: msg.data?.records || [],
|
||||
total: msg.data?.total,
|
||||
success: msg.retcode,
|
||||
} as any;
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
* @param fields
|
||||
*/
|
||||
const handleUpdate = async (fields: API.PbcTrainingClassesType_) => {
|
||||
const hide = message.loading('正在保存');
|
||||
|
||||
try {
|
||||
const msg = await addOrUpdateClassesTypeUsingPost({ ...fields });
|
||||
hide();
|
||||
if (msg.retcode) {
|
||||
message.success(!fields.pbcId ? '添加成功' : '保存成功');
|
||||
return true;
|
||||
}
|
||||
message.error(msg.retmsg);
|
||||
return false;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error(!fields.pbcId ? '添加失败请重试!' : '保存失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
* @param id
|
||||
*/
|
||||
const handleRemove = async (fields: API.PbcTrainingClassesType_) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!fields.pbcId) return false;
|
||||
|
||||
try {
|
||||
const msg = await removeTrainingClassesTypeUsingGet({ pbcId: fields.pbcId });
|
||||
hide();
|
||||
if (msg.retcode) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(msg.retmsg ?? '删除失败,请重试');
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const TableList: React.FC<any> = () => {
|
||||
const access: any = useAccess();
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [stepFormValues, setStepFormValues] = useState<API.PbcTrainingClassesType_>({});
|
||||
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
||||
|
||||
const columns: ProColumns<API.PbcTrainingClassesType_>[] = [
|
||||
{
|
||||
title: '课程类型',
|
||||
dataIndex: 'PbcTrainingClassesType_Name',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'pbcCreateAt',
|
||||
valueType: 'date',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
valueType: 'option',
|
||||
width: 180,
|
||||
render: (text, record) => (
|
||||
<span>
|
||||
<Access key="config" accessible={access.productCategorySave}>
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
onClick={() => {
|
||||
handleUpdateModalVisible(true);
|
||||
setStepFormValues(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
</Access>
|
||||
<Access key="remove" accessible={access.productCategoryDelete}>
|
||||
<Popconfirm
|
||||
title={`确定需要删除该课程类型?`}
|
||||
onConfirm={async () => {
|
||||
const success = await handleRemove(record);
|
||||
if (success) actionRef.current?.reload();
|
||||
}}
|
||||
>
|
||||
<Button size="small" type="link" danger>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Access>
|
||||
</span>
|
||||
),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
breadcrumb: {},
|
||||
}}
|
||||
>
|
||||
<ProTable<API.PbcTrainingClassesType_>
|
||||
columns={columns}
|
||||
actionRef={actionRef}
|
||||
request={fetchData}
|
||||
rowKey="pbcId"
|
||||
size="small"
|
||||
bordered
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
span: 6,
|
||||
optionRender: ({ searchText }, { form }) => {
|
||||
return [
|
||||
<Button
|
||||
key="button"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
form?.submit();
|
||||
}}
|
||||
>
|
||||
{searchText}
|
||||
</Button>,
|
||||
<Access key="primary" accessible={access.productCategorySave}>
|
||||
<Button
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
handleUpdateModalVisible(true);
|
||||
setStepFormValues({
|
||||
pbcId: undefined,
|
||||
});
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
</Access>,
|
||||
];
|
||||
},
|
||||
}}
|
||||
pagination={false}
|
||||
scroll={{
|
||||
y: 'calc(100vh - 320px)',
|
||||
}}
|
||||
dateFormatter="string"
|
||||
options={false}
|
||||
toolBarRender={() => []}
|
||||
/>
|
||||
{stepFormValues && Object.keys(stepFormValues).length ? (
|
||||
<UpdateForm
|
||||
onSubmit={async (value: any) => {
|
||||
const success = await handleUpdate(value);
|
||||
|
||||
if (success) {
|
||||
handleUpdateModalVisible(false);
|
||||
setStepFormValues({});
|
||||
actionRef.current?.reload();
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
message.destroy();
|
||||
handleUpdateModalVisible(false);
|
||||
}}
|
||||
updateModalVisible={updateModalVisible}
|
||||
values={stepFormValues}
|
||||
/>
|
||||
) : null}
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
||||
@ -0,0 +1,59 @@
|
||||
import React, { useRef } from 'react';
|
||||
import { DrawerForm, ProFormInstance, ProFormText } from '@ant-design/pro-components';
|
||||
export type FormValueType = {
|
||||
target?: string;
|
||||
template?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
frequency?: string;
|
||||
} & Partial<API.PbcTrainingClassesType_>;
|
||||
export type UpdateFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: FormValueType) => void;
|
||||
onSubmit: (values: FormValueType) => Promise<void>;
|
||||
updateModalVisible: boolean;
|
||||
values: Partial<API.PbcTrainingClassesType_>;
|
||||
};
|
||||
|
||||
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
|
||||
const formRef = useRef<ProFormInstance>();
|
||||
|
||||
return (
|
||||
<DrawerForm
|
||||
width={640}
|
||||
requiredMark={false}
|
||||
title={props.values.pbcId ? '编辑' : '新增'}
|
||||
open={props.updateModalVisible}
|
||||
formRef={formRef}
|
||||
onFinish={(value) => {
|
||||
return props.onSubmit({ ...props.values, ...value })
|
||||
}}
|
||||
drawerProps={{
|
||||
destroyOnClose: true,
|
||||
}}
|
||||
initialValues={{
|
||||
pbcType: props.values.pbcType
|
||||
}}
|
||||
onOpenChange={(visible) => {
|
||||
formRef.current?.resetFields();
|
||||
if (!visible) {
|
||||
props.onCancel();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
placeholder={'请输入课程名称'}
|
||||
label="课程名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '课程名称为必填项',
|
||||
},
|
||||
]}
|
||||
width="md"
|
||||
name="pbcType"
|
||||
/>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default UpdateForm;
|
||||
@ -0,0 +1,184 @@
|
||||
import {
|
||||
changeProductStateForAdminUsingGet,
|
||||
productDetailForAdminUsingGet,
|
||||
} from '@/services/pop-b2b2c/pbcProductController';
|
||||
import { CheckCircleOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
||||
import { ProCard } from '@ant-design/pro-components';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Access, useAccess, useParams } from '@umijs/max';
|
||||
import { Button, Col, Descriptions, Image, message, Row, Tag } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
const Detail: React.FC<any> = () => {
|
||||
const params = useParams();
|
||||
const access: any = useAccess();
|
||||
|
||||
const [info, setInfo] = useState<API.PbcProductVO>({});
|
||||
const [images, setImages] = useState<string[]>([]);
|
||||
const [detailImages, setDetailImages] = useState<string[]>([]);
|
||||
|
||||
const getInfo = () => {
|
||||
if (params.id) {
|
||||
productDetailForAdminUsingGet({ productId: parseInt(params.id) }).then((res) => {
|
||||
if (res.retcode && res.data) {
|
||||
setInfo(res.data);
|
||||
if (res.data.pbcProductImages) {
|
||||
const arr = res.data.pbcProductImages.split(',');
|
||||
setImages(arr);
|
||||
}
|
||||
if (res.data.pbcProductDetailImages) {
|
||||
const arr = res.data.pbcProductDetailImages.split(',');
|
||||
setDetailImages(arr);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getInfo();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
}}
|
||||
footer={
|
||||
info.pbcState !== 3
|
||||
? [
|
||||
<Button
|
||||
key="back"
|
||||
onClick={() => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
返回
|
||||
</Button>,
|
||||
<Access key="no" accessible={access.productUpdateState}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
changeProductStateForAdminUsingGet({
|
||||
pcbId: info.pbcId || 0,
|
||||
state: info.pbcState === 1 ? 2 : 1,
|
||||
}).then((res) => {
|
||||
if (res.retcode) {
|
||||
message.success(info.pbcState === 1 ? '已下架' : '已上架');
|
||||
getInfo();
|
||||
} else {
|
||||
message.error(res.retmsg);
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
{info.pbcState === 1 ? '下架' : '上架'}
|
||||
</Button>
|
||||
</Access>,
|
||||
]
|
||||
: [
|
||||
<Button
|
||||
key="back"
|
||||
onClick={() => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
返回
|
||||
</Button>,
|
||||
]
|
||||
}
|
||||
>
|
||||
<ProCard style={{ marginBottom: 12 }}>
|
||||
<Descriptions
|
||||
bordered
|
||||
title={
|
||||
<>
|
||||
<span style={{ marginRight: 20 }}>基本信息</span>
|
||||
{info.pbcState === 1 ? (
|
||||
<Tag icon={<CheckCircleOutlined />} color="success">
|
||||
上架中
|
||||
</Tag>
|
||||
) : (
|
||||
<Tag icon={<InfoCircleOutlined />} color="default">
|
||||
已下架
|
||||
</Tag>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
column={3}
|
||||
>
|
||||
<Descriptions.Item label="名称">{info.pbcProductTitle}</Descriptions.Item>
|
||||
<Descriptions.Item label="商品类目">
|
||||
{info.pbcProductTopCategoryName}/{info.pbcProductParentCategoryName}/
|
||||
{info.pbcProductCategoryName}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="价格">¥{info.pbcProductPrice}</Descriptions.Item>
|
||||
<Descriptions.Item label="颜色" span={3}>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', width: 1000 }}>
|
||||
{info.colorDataList?.map((e) => (
|
||||
<Row
|
||||
key={e.pbcId}
|
||||
style={{ width: 200, marginBottom: 10, marginRight: 20, alignItems: 'center' }}
|
||||
justify="space-evenly"
|
||||
>
|
||||
<Col span={8}>{e.pbcCommonDataSystem}</Col>
|
||||
<Col span={8}>
|
||||
<Image width={100} src={e.pbcColorImageUrl} />
|
||||
</Col>
|
||||
</Row>
|
||||
))}
|
||||
</div>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="相册图片" span={3}>
|
||||
<div style={{ display: 'flex', width: '100%', flexWrap: 'wrap' }}>
|
||||
<Image.PreviewGroup>
|
||||
{images.map((e) => (
|
||||
<div key={e} style={{ marginBottom: 10, marginRight: 20 }}>
|
||||
<Image width={100} src={e} />
|
||||
</div>
|
||||
))}
|
||||
</Image.PreviewGroup>
|
||||
</div>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="详情图" span={3}>
|
||||
<div style={{ display: 'flex', width: '100%', flexWrap: 'wrap' }}>
|
||||
<Image.PreviewGroup>
|
||||
{detailImages.map((e) => (
|
||||
<div key={e} style={{ marginBottom: 10, marginRight: 20 }}>
|
||||
<Image width={100} src={e} />
|
||||
</div>
|
||||
))}
|
||||
</Image.PreviewGroup>
|
||||
</div>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="规格" span={3}>
|
||||
{info.productCommonDataList?.map((e) => (
|
||||
<Row
|
||||
key={e.pbcId}
|
||||
style={{ width: 150, marginBottom: 10, marginRight: 20, alignItems: 'center' }}
|
||||
justify="space-evenly"
|
||||
>
|
||||
<Col style={{ color: 'rgb(170, 170, 170)' }} span={8}>
|
||||
{e.pbcSystemName}
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
{e.pbcSystemInputType === 'select'
|
||||
? e.pbcCommonDataSystemValue
|
||||
: e.pbcCommonDataSystem}
|
||||
</Col>
|
||||
</Row>
|
||||
))}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="详情描述" span={3}>
|
||||
{info.pbcProductDetail}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="可见范围" span={3}>
|
||||
{info.pbcProductVipLevels}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</ProCard>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default Detail;
|
||||
@ -0,0 +1,223 @@
|
||||
import Constants from '@/constants';
|
||||
import { getPbcBusinessListUsingPost } from '@/services/pop-b2b2c/pbcBusinessController';
|
||||
import { listAdminTreeUsingGet } from '@/services/pop-b2b2c/pbcCategoryController';
|
||||
import {
|
||||
changeProductStateForAdminUsingGet,
|
||||
getProductPageForAdminUsingPost,
|
||||
} from '@/services/pop-b2b2c/pbcProductController';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { Access, Link, useAccess, history } from '@umijs/max';
|
||||
import { Button, message } from 'antd';
|
||||
import moment from 'moment';
|
||||
import React, { useRef } from 'react';
|
||||
|
||||
/**
|
||||
* 查询表格
|
||||
* @param param0
|
||||
*/
|
||||
const fetchData = async (params: any) => {
|
||||
if (params.pbcProductCategoryId && params.pbcProductCategoryId.length === 3) {
|
||||
params.pbcProductCategoryId = params.pbcProductCategoryId[2];
|
||||
}
|
||||
params.pbcUserType = 2
|
||||
const msg = await getProductPageForAdminUsingPost(params);
|
||||
return {
|
||||
data: msg.data?.records,
|
||||
total: msg.data?.total,
|
||||
success: msg.retcode,
|
||||
} as any;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const TableList: React.FC<{}> = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const access: any = useAccess();
|
||||
|
||||
const columns: ProColumns<API.PbcProduct>[] = [
|
||||
{
|
||||
title: '商品类目',
|
||||
dataIndex: 'pbcProductCategoryId',
|
||||
hideInTable: true,
|
||||
valueType: 'cascader',
|
||||
fieldProps: {
|
||||
fieldNames: { label: 'pbcCategoryName', value: 'pbcId', children: 'children' },
|
||||
},
|
||||
request: async () => {
|
||||
const msg = await listAdminTreeUsingGet({ type: 2 });
|
||||
if (msg.retcode && msg.data) {
|
||||
return msg.data;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '商品大类',
|
||||
dataIndex: 'pbcProductTopCategoryName',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '商品中类',
|
||||
dataIndex: 'pbcProductParentCategoryName',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '商品小类',
|
||||
dataIndex: 'pbcProductCategoryName',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '商品名称',
|
||||
dataIndex: 'pbcProductTitle',
|
||||
},
|
||||
{
|
||||
title: '款号',
|
||||
dataIndex: 'pbcProductCode',
|
||||
},
|
||||
{
|
||||
title: '价格',
|
||||
dataIndex: 'pbcProductPrice',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: 'pbcBusinessName',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '所属商户',
|
||||
dataIndex: 'pbcBusinessId',
|
||||
hideInTable: true,
|
||||
valueType: 'select',
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: { label: 'pbcBusinessName', value: 'pbcId' },
|
||||
},
|
||||
request: async () => {
|
||||
const msg = await getPbcBusinessListUsingPost();
|
||||
if (msg.retcode && msg.data) {
|
||||
return msg.data;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'pbcCreateAt',
|
||||
hideInTable: true,
|
||||
fieldProps:{
|
||||
maxDate: moment()
|
||||
},
|
||||
valueType: 'dateRange'
|
||||
},
|
||||
{
|
||||
title: '产品类型',
|
||||
dataIndex: 'pbcProductType',
|
||||
valueType: 'select',
|
||||
valueEnum: Constants.pbcProductTypeList,
|
||||
search: false
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'pbcState',
|
||||
valueType: 'select',
|
||||
valueEnum: Constants.pbcProductState,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
valueType: 'option',
|
||||
render: (text, record) => (
|
||||
<span>
|
||||
<Link to={'/product/detail/' + record.pbcId}>详情</Link>
|
||||
<Access key="config" accessible={access.productUpdateState}>
|
||||
{record.pbcState === 1 ? (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
changeProductStateForAdminUsingGet({ pcbId: record.pbcId || 0, state: 2 }).then(
|
||||
(res) => {
|
||||
if (res.retcode) {
|
||||
message.success('已下架');
|
||||
actionRef.current?.reload();
|
||||
} else {
|
||||
message.error(res.retmsg);
|
||||
}
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
下架
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
changeProductStateForAdminUsingGet({ pcbId: record.pbcId || 0, state: 1 }).then(
|
||||
(res) => {
|
||||
if (res.retcode) {
|
||||
message.success('已上架');
|
||||
actionRef.current?.reload();
|
||||
} else {
|
||||
message.error(res.retmsg);
|
||||
}
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
上架
|
||||
</Button>
|
||||
)}
|
||||
</Access>
|
||||
</span>
|
||||
),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '',
|
||||
breadcrumb: {},
|
||||
}}
|
||||
>
|
||||
<ProTable<API.PbcProduct>
|
||||
columns={columns}
|
||||
actionRef={actionRef}
|
||||
request={(param: any) => {
|
||||
const queryParam = {
|
||||
...param,
|
||||
startDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[0] : undefined,
|
||||
endDate: param.pbcCreateAt && param.pbcCreateAt.length > 1 ? param.pbcCreateAt[1] + ' 23:59:59' : undefined
|
||||
}
|
||||
return fetchData(queryParam);
|
||||
}}
|
||||
rowKey="pbcId"
|
||||
size="small"
|
||||
bordered
|
||||
search={{
|
||||
labelWidth: 'auto',
|
||||
span: 6,
|
||||
}}
|
||||
pagination={{
|
||||
defaultPageSize: 20,
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
toolbar={{
|
||||
actions: [
|
||||
<Access key="add" accessible={access.productAdd}>
|
||||
<Button type="primary" onClick={() => history.push('/product/add')}>新增商品</Button>
|
||||
</Access>
|
||||
]
|
||||
}}
|
||||
scroll={{
|
||||
y: 'calc(100vh - 320px)',
|
||||
}}
|
||||
dateFormatter="string"
|
||||
options={false}
|
||||
toolBarRender={() => []}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default TableList;
|
||||
@ -0,0 +1,48 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 地址解析 地址解析:通过详细地址返回省市区 GET /b2b2c/pbcLogistics/addressAnalysis */
|
||||
export async function addressAnalysisUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.addressAnalysisUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResult>('/b2b2c/pbcLogistics/addressAnalysis', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 通过快递单号查询物流公司 通过快递单号查询物流公司 GET /b2b2c/pbcLogistics/queryCompany */
|
||||
export async function queryCompanyUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.queryCompanyUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResult>('/b2b2c/pbcLogistics/queryCompany', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 通过快递单号查询快递轨迹 通过快递单号查询快递轨迹 GET /b2b2c/pbcLogistics/queryTrack */
|
||||
export async function queryTrackUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.queryTrackUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResult>('/b2b2c/pbcLogistics/queryTrack', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 买家新增或者修改需求 POST /b2b2c/pbcRequirement/addOrUpdateRequirement */
|
||||
export async function addOrUpdateRequirementUsingPost(
|
||||
body: API.PbcRequirement_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResult>('/b2b2c/pbcRequirement/addOrUpdateRequirement', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 后台审核需求 后台 GET /b2b2c/pbcRequirement/admin/approvalRequirement/${param0} */
|
||||
export async function approvalRequirementForAdminUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.approvalRequirementForAdminUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.AjaxResultString_>(
|
||||
`/b2b2c/pbcRequirement/admin/approvalRequirement/${param0}`,
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...queryParams,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 后台获取需求分页 分页 POST /b2b2c/pbcRequirement/admin/getRequirementPage */
|
||||
export async function getRequirementPageForAdminUsingPost(
|
||||
body: API.PbcRequirement_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcRequirement_>(
|
||||
'/b2b2c/pbcRequirement/admin/getRequirementPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 后台根据id获取需求详情 前端 GET /b2b2c/pbcRequirement/admin/requirementDetail */
|
||||
export async function requirementDetailForAdminUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.requirementDetailForAdminUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcRequirement_>('/b2b2c/pbcRequirement/admin/requirementDetail', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 卖家更改审核需求状态 买家 GET /b2b2c/pbcRequirement/buyer/changeRequirementState/${param0} */
|
||||
export async function changeRequirementStateForBuyerUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.changeRequirementStateForBuyerUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.AjaxResultString_>(
|
||||
`/b2b2c/pbcRequirement/buyer/changeRequirementState/${param0}`,
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...queryParams,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 买家获取我的需求分页 分页 POST /b2b2c/pbcRequirement/buyer/getRequirementPage */
|
||||
export async function getRequirementPageForBuyerUsingPost(
|
||||
body: API.PbcRequirement_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcRequirement_>(
|
||||
'/b2b2c/pbcRequirement/buyer/getRequirementPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 前端根据id获取需求详情 前端 GET /b2b2c/pbcRequirement/front/requirementDetail */
|
||||
export async function requirementDetailForFrontUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.requirementDetailForFrontUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcRequirement_>('/b2b2c/pbcRequirement/front/requirementDetail', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 卖家获取需求大厅分页 分页 POST /b2b2c/pbcRequirement/seller/getRequirementPage */
|
||||
export async function getRequirementPageForSellerUsingPost(
|
||||
body: API.PbcRequirement_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcRequirement_>(
|
||||
'/b2b2c/pbcRequirement/seller/getRequirementPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 新增回复 POST /b2b2c/pbcRequirementReply/addRequirementReply */
|
||||
export async function addRequirementReplyUsingPost(
|
||||
body: API.PbcRequirementReply_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcRequirementReply/addRequirementReply', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据id删除单个回复 GET /b2b2c/pbcRequirementReply/removeRequirementReply */
|
||||
export async function removeRequirementReplyUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.removeRequirementReplyUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcRequirementReply/removeRequirementReply', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 后台新增或者修改章节 POST /b2b2c/pbcTrainingClassesChapter/addOrUpdateChapter */
|
||||
export async function addOrUpdateChapterUsingPost(
|
||||
body: API.PbcTrainingClassesChapter_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcTrainingClassesChapter/addOrUpdateChapter', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据id获取章节信息 后台 GET /b2b2c/pbcTrainingClassesChapter/chapterDetail */
|
||||
export async function chapterDetailUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.chapterDetailUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcTrainingClassesChapter_>(
|
||||
'/b2b2c/pbcTrainingClassesChapter/chapterDetail',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据id删除单个章节 GET /b2b2c/pbcTrainingClassesChapter/removeChapter */
|
||||
export async function removeChapterUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.removeChapterUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcTrainingClassesChapter/removeChapter', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 后台新增或者修改课程 POST /b2b2c/pbcTrainingClasses/addOrUpdateClass */
|
||||
export async function addOrUpdateClassUsingPost(
|
||||
body: API.PbcTrainingClasses_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcTrainingClasses_>('/b2b2c/pbcTrainingClasses/addOrUpdateClass', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 后台根据id获取课程信息 后台 GET /b2b2c/pbcTrainingClasses/admin/classDetail */
|
||||
export async function classDetailForAdminUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.classDetailForAdminUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcTrainingClassesPageDTO_>(
|
||||
'/b2b2c/pbcTrainingClasses/admin/classDetail',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 后台获取课程分页 分页 POST /b2b2c/pbcTrainingClasses/admin/getClassPage */
|
||||
export async function getClassPageForAdminUsingPost(
|
||||
body: API.PbcTrainingClasses_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcTrainingClasses_>(
|
||||
'/b2b2c/pbcTrainingClasses/admin/getClassPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 前端根据id获取课程信息 前端 GET /b2b2c/pbcTrainingClasses/front/classDetail */
|
||||
export async function classDetailForFrontUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.classDetailForFrontUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcTrainingClassesPageDTO_>(
|
||||
'/b2b2c/pbcTrainingClasses/front/classDetail',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 前端获取课程分页 分页 POST /b2b2c/pbcTrainingClasses/front/getClassPage */
|
||||
export async function getClassPageForFrontUsingPost(
|
||||
body: API.PbcTrainingClasses_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcTrainingClasses_>(
|
||||
'/b2b2c/pbcTrainingClasses/front/getClassPage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据id删除单个课程 GET /b2b2c/pbcTrainingClasses/removeClass */
|
||||
export async function removeClassUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.removeClassUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcTrainingClasses/removeClass', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 后台新增或者修改课程类型 POST /b2b2c/pbcTrainingClassesType/addOrUpdateClassesType */
|
||||
export async function addOrUpdateClassesTypeUsingPost(
|
||||
body: API.PbcTrainingClassesType_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcTrainingClassesType/addOrUpdateClassesType', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 后台获取课程类型列表 POST /b2b2c/pbcTrainingClassesType/admin/getClassesTypeList */
|
||||
export async function getClassesTypeListForAdminUsingPost(options?: { [key: string]: any }) {
|
||||
return request<API.AjaxResultListPbcTrainingClassesType_>(
|
||||
'/b2b2c/pbcTrainingClassesType/admin/getClassesTypeList',
|
||||
{
|
||||
method: 'POST',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据id获取课程类型信息 后台 GET /b2b2c/pbcTrainingClassesType/classesTypeDetail */
|
||||
export async function classesTypeDetailUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.classesTypeDetailUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultPbcTrainingClassesType_>(
|
||||
'/b2b2c/pbcTrainingClassesType/classesTypeDetail',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 前端获取课程类型列表 POST /b2b2c/pbcTrainingClassesType/front/getClassesTypeList */
|
||||
export async function getClassesTypeListForFrontUsingPost(options?: { [key: string]: any }) {
|
||||
return request<API.AjaxResultListPbcTrainingClassesType_>(
|
||||
'/b2b2c/pbcTrainingClassesType/front/getClassesTypeList',
|
||||
{
|
||||
method: 'POST',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取课程类型分页 分页 POST /b2b2c/pbcTrainingClassesType/getClassesTypePage */
|
||||
export async function getClassesTypePageUsingPost(
|
||||
body: API.PbcTrainingClassesType_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultIPagePbcTrainingClassesType_>(
|
||||
'/b2b2c/pbcTrainingClassesType/getClassesTypePage',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 根据id删除单个课程类型 GET /b2b2c/pbcTrainingClassesType/removeTrainingClassesType */
|
||||
export async function removeTrainingClassesTypeUsingGet(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.removeTrainingClassesTypeUsingGETParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResultString_>('/b2b2c/pbcTrainingClassesType/removeTrainingClassesType', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 前端新增或者修改用户视频观看记录 POST /b2b2c/pbcTrainingClassesVideoRecord/addOrUpdateUserVideoRecord */
|
||||
export async function addOrUpdateUserVideoRecordUsingPost(
|
||||
body: API.PbcTrainingClassesVideoRecord_,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.AjaxResult>(
|
||||
'/b2b2c/pbcTrainingClassesVideoRecord/addOrUpdateUserVideoRecord',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 根据video id删除视频,后端自用 DELETE /vodFile/deleteAliyunVideo/${param0} */
|
||||
export async function deleteAliyunVideoUsingDelete(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.deleteAliyunVideoUsingDELETEParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.AjaxResult>(`/vodFile/deleteAliyunVideo/${param0}`, {
|
||||
method: 'DELETE',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据video id获取播放凭证,后端自用 DELETE /vodFile/getVideoAuthByVideoId/${param0} */
|
||||
export async function getVideoAuthByVideoIdUsingDelete(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.getVideoAuthByVideoIdUsingDELETEParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const { id: param0, ...queryParams } = params;
|
||||
return request<API.AjaxResultGetVideoPlayAuthResponse_>(
|
||||
`/vodFile/getVideoAuthByVideoId/${param0}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
params: { ...queryParams },
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 上传视频到vod,测试用 POST /vodFile/upload */
|
||||
export async function uploadVideoUsingPost(
|
||||
body: {},
|
||||
file?: File,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
const formData = new FormData();
|
||||
|
||||
if (file) {
|
||||
formData.append('file', file);
|
||||
}
|
||||
|
||||
Object.keys(body).forEach((ele) => {
|
||||
const item = (body as any)[ele];
|
||||
|
||||
if (item !== undefined && item !== null) {
|
||||
if (typeof item === 'object' && !(item instanceof File)) {
|
||||
if (item instanceof Array) {
|
||||
item.forEach((f) => formData.append(ele, f || ''));
|
||||
} else {
|
||||
formData.append(ele, JSON.stringify(item));
|
||||
}
|
||||
} else {
|
||||
formData.append(ele, item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return request<API.AjaxResultString_>('/vodFile/upload', {
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
requestType: 'form',
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue