提交 d854adce 作者: ZhangLingKun

Merge remote-tracking branch 'origin/develop' into develop

......@@ -14,4 +14,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: 8e162d9be47276998aa054b173a062ef1e4b785c
newTag: e93cd2127c17031785d384d0ca57c4cb67271978
......@@ -162,7 +162,7 @@ export type editMallGoodsType = InterFunction<goodsItemType & { id: number }, an
//商品-列表(新)
export type listPageGoodsInfoType = InterItemFunction<
{ categoryPrimaryId?: number; tradeName?: string; shelfStatus?: number },
goodsItemType & { id: number }[]
(goodsItemType & { id: number })[]
>;
//商城-详情(新)
export type mallGoodsDetailsType = InterFunction<{ id: number }, goodsItemType & { id: number }>;
......@@ -91,7 +91,13 @@ const EditableCell: React.FC<
return (
<td {...restProps}>
{editing ? (
<Form.Item name={dataIndex + record.id} style={{ margin: 0 }} rules={rules}>
<Form.Item
name={dataIndex + record.id}
style={{ margin: 0 }}
rules={rules}
//valuePropName:当 form setFieldsValue 设置switch不生效时
valuePropName={inputType === 'switch' ? 'checked' : ''}
>
{inputNode()}
</Form.Item>
) : (
......
......@@ -37,6 +37,7 @@ const AddressInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
useImperativeHandle(ref, () => ({
addressInfoFormSubmit,
getForm: () => addressInfoForm,
}));
//地址列表
......@@ -89,7 +90,7 @@ const AddressInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
?.districtCode,
});
})
.then((err) => {
.catch((err) => {
reject(err);
});
});
......
......@@ -3,6 +3,7 @@ import './index.scss';
import { forwardRef, useEffect, useImperativeHandle } from 'react';
import { InterDataType } from '~/api/interface';
import { leaseGoodsDetailsType } from '~/api/interface/rentManageType';
import { qualityList } from '~/utils/dictionary';
//租赁商品详情返回类型
type rentGoodsDetailType = InterDataType<leaseGoodsDetailsType>;
......@@ -18,32 +19,11 @@ interface selfProps {
}
const GoodsInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
const qualityList = [
{
label: '全新',
value: 0,
},
{
label: '99新',
value: 1,
},
{
label: '95新',
value: 2,
},
{
label: '90新',
value: 3,
},
{
label: '80新',
value: 4,
},
];
const [form] = Form.useForm<goodsInfoForm>();
useImperativeHandle(ref, () => ({
submitGoodsInfoForm,
getForm: () => form,
}));
const submitGoodsInfoForm = () => {
......@@ -54,6 +34,7 @@ const GoodsInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
resolve(value);
})
.catch((error) => {
console.log('商品信息错误--->', error);
reject(error);
});
});
......
......@@ -145,6 +145,7 @@ const RentAttr = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
useImperativeHandle(ref, () => ({
submitAttrForm,
getForm: () => rentAttrForm,
}));
//商品参数新增
......@@ -275,8 +276,8 @@ const RentAttr = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
...values[0],
productParam: values[1].length ? JSON.stringify(values[1]) : undefined,
});
} catch (e) {
return Promise.reject(e);
} catch (error: any) {
return Promise.reject(error);
}
};
......
......@@ -140,6 +140,8 @@ const SkuInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
useImperativeHandle(ref, () => ({
getForm: () => form,
skuFormSubmit,
getSpecificationValueForm: () => commonSkuInfoRef.current.getSpecificationValueForm(),
getSpecificationForm: () => commonSkuInfoRef.current.getSpecificationForm(),
}));
const updateTableData = (tableData: any) => {
......@@ -314,8 +316,8 @@ const SkuInfo = forwardRef<any, selfProps>(({ rentGoodsDetails }, ref) => {
showPrice: rentDateMinPrice,
});
}
} catch (e) {
return Promise.reject(e);
} catch (error: any) {
return Promise.reject(error);
}
};
//表头拆分及合并列
......
......@@ -38,31 +38,55 @@ const RentAddOrEdit = () => {
skuInfoRef.current.skuFormSubmit(),
accessoryListRef.current.accessoryTableFormSubmit(),
addressInfoRef.current.addressInfoFormSubmit(),
]).then((values) => {
const resourcesList = [
{ type: 0, url: values[1].mainImage },
...(values[1].subImage?.map((v: string) => ({ type: 1, url: v })) || []),
...(values[1].goodsVideo ? [{ type: 2, url: values[1].goodsVideo }] : []),
];
values[2].priceStock = values[2].priceStock.map((v: any) => ({
...v,
stockOut: v.stockOut ? 1 : 0,
}));
RentManageAPI[rentGoodsId ? 'editLeaseGoods' : 'addRentGoods']({
...values[0],
...filterObjAttr(values[1], ['goodsImage', 'goodsVideo']),
...values[2],
leasePartsList: values[3],
...values[4],
resourcesList,
id: rentGoodsId ? rentGoodsId : undefined,
}).then(({ code }) => {
if (code === '200') {
message.success(rentGoodsId ? '编辑成功' : '新增成功');
navigate(-1);
])
.then((values) => {
const resourcesList = [
{ type: 0, url: values[1].mainImage },
...(values[1].subImage?.map((v: string) => ({ type: 1, url: v })) || []),
...(values[1].goodsVideo ? [{ type: 2, url: values[1].goodsVideo }] : []),
];
values[2].priceStock = values[2].priceStock.map((v: any) => ({
...v,
stockOut: v.stockOut ? 1 : 0,
}));
RentManageAPI[rentGoodsId ? 'editLeaseGoods' : 'addRentGoods']({
...values[0],
...filterObjAttr(values[1], ['goodsImage', 'goodsVideo']),
...values[2],
leasePartsList: values[3],
...values[4],
resourcesList,
id: rentGoodsId ? rentGoodsId : undefined,
}).then(({ code }) => {
if (code === '200') {
message.success(rentGoodsId ? '编辑成功' : '新增成功');
navigate(-1);
}
});
})
.catch((error: any) => {
message.warning(error.errorFields[0].errors[0] || error);
if (error?.errorFields) {
goodsInfoRef.current
.getForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
rentAttrRef.current
.getForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
skuInfoRef.current
.getForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
skuInfoRef.current
.getSpecificationForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
skuInfoRef.current
.getSpecificationValueForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
addressInfoRef.current
.getForm()
.scrollToField(error.errorFields[0].name[0], { behavior: 'smooth' });
}
});
});
};
//获取租赁商品详情
......
import { useSearchParams, useNavigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
import { RentManageAPI } from '~/api';
import { RentManageAPI, SystemManageAPI } from '~/api';
import { InterDataType } from '~/api/interface';
import { leaseGoodsDetailsType } from '~/api/interface/rentManageType';
import { Badge, Button, Col, Descriptions, Image, Row, Switch, Table } from 'antd';
import { qualityList } from '~/utils/dictionary';
//租赁商品详情返回类型
type rentGoodsDetailType = InterDataType<leaseGoodsDetailsType>;
......@@ -57,6 +58,9 @@ const RentDetail = () => {
key: string;
}[]
>([]);
const [addressOptionList, setAddressOptionList] = useState<
{ label: string; value: number; districtCode: string }[]
>([]);
//获取租赁商品详情
const getRentGoodsDetail = (id: number) => {
......@@ -166,6 +170,20 @@ const RentDetail = () => {
}
});
};
//地址列表
const getAddressList = () => {
SystemManageAPI.getAddressList({}).then(({ result }) => {
if (result) {
const optionList = result.map((v) => ({
label: v.takeName + v.takePhone + `(${v.takeRegion.split('/').join('') + v.takeAddress})`,
value: v.id,
districtCode: v.districtCode,
}));
setAddressOptionList(optionList);
}
});
};
//返回
const backRoute = () => {
navigate(-1);
......@@ -173,6 +191,7 @@ const RentDetail = () => {
useEffect(() => {
getLeaseTermInfo();
getAddressList();
}, []);
useEffect(() => {
......@@ -195,7 +214,9 @@ const RentDetail = () => {
>
<Descriptions.Item label='商品标题'>{rentGoodsDetails?.tradeName}</Descriptions.Item>
<Descriptions.Item label='商品卖点'>{rentGoodsDetails?.sellingPoint}</Descriptions.Item>
<Descriptions.Item label='商品成新'>{rentGoodsDetails?.level}</Descriptions.Item>
<Descriptions.Item label='商品成新'>
{qualityList.find((v) => v.value === rentGoodsDetails?.level)?.label}
</Descriptions.Item>
<Descriptions.Item label='商品状态'>
<Badge
status={rentGoodsDetails?.shelfStatus ? 'processing' : 'default'}
......@@ -211,18 +232,26 @@ const RentDetail = () => {
<Image src={rentGoodsDetails?.resourcesList.find((v) => v.type === 0)?.url} width={50} />
</Descriptions.Item>
<Descriptions.Item label='商品副图' span={2}>
{rentGoodsDetails?.resourcesList.filter((v) => v.type === 1).length
? rentGoodsDetails?.resourcesList
{rentGoodsDetails?.resourcesList.filter((v) => v.type === 1).length ? (
<Row>
{rentGoodsDetails?.resourcesList
.filter((v) => v.type === 1)
.map((v) => <Image src={v.url} width={50} height={50} key={v.id} />)
: '暂无'}
.map((v) => (
<Col key={v.id} offset={1}>
<Image src={v.url} width={50} height={50} />
</Col>
))}
</Row>
) : (
'暂无'
)}
</Descriptions.Item>
<Descriptions.Item label='商品视频'>
{rentGoodsDetails?.resourcesList.find((v) => v.type === 2)?.url ? (
<video
src={rentGoodsDetails?.resourcesList.find((v) => v.type === 2)?.url}
controls
style={{ width: '100px', height: '100px' }}
style={{ width: '200px', height: '200px' }}
/>
) : (
'暂无'
......@@ -280,6 +309,16 @@ const RentDetail = () => {
/>
</Descriptions.Item>
</Descriptions>
<Descriptions title='物流信息' bordered column={2} style={{ marginTop: '10px' }}>
<Descriptions.Item label='发货地址'>
{addressOptionList.find((v) => v.value === rentGoodsDetails?.shipAddress)?.label}
</Descriptions.Item>
<Descriptions.Item label='归还地址'>
{addressOptionList.find((v) => v.value === rentGoodsDetails?.returnAddress)?.label}
</Descriptions.Item>
<Descriptions.Item label='寄出物流'>{rentGoodsDetails?.logisticsCompany}</Descriptions.Item>
<Descriptions.Item label='配送方式'>{rentGoodsDetails?.modeOfDelivery}</Descriptions.Item>
</Descriptions>
</div>
);
};
......
......@@ -6,13 +6,14 @@ import {
DeleteOutlined,
PlusOutlined,
} from '@ant-design/icons';
import { useEffect, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { ColumnsType } from 'antd/es/table';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { RentManageAPI } from '../../../../api';
import { InterDataType, InterReqListType, PaginationProps } from '../../../../api/interface';
import { leaseGoodsListType } from '../../../../api/interface/rentManageType';
import './index.scss';
import qs from 'query-string';
//租赁列表返回类型
type rentGoodsType = InterDataType<leaseGoodsListType>['list'];
......@@ -20,7 +21,10 @@ type rentGoodsType = InterDataType<leaseGoodsListType>['list'];
type rentGoodsParametersType = Exclude<InterReqListType<leaseGoodsListType>, undefined>;
const RentList = () => {
const searchRef = useRef<any>();
const navigate = useNavigate();
const [searchParams, setSearchParams] = useSearchParams();
//类型下拉列表
const [rentTypeSelectList, setRentTypeSelectList] = useState<{ label: string; value: number }[]>(
......@@ -169,6 +173,14 @@ const RentList = () => {
pagination.pageSize = 10;
setActiveTabKey(key);
query.shelfStatus = key === '1' ? undefined : key === '2' ? 1 : 0;
setSearchParams(
qs.stringify({
pageNo: 1,
pageSize: 10,
...query,
shelfStatus: query.shelfStatus === undefined ? 'all' : query.shelfStatus,
}),
);
setQuery(query);
getRentGoodsList(query);
};
......@@ -194,11 +206,27 @@ const RentList = () => {
pagination.pageNo = pageNo;
pagination.pageSize = pageSize;
getRentGoodsList(query);
setSearchParams(
qs.stringify({
pageNo,
pageSize,
...query,
shelfStatus: query.shelfStatus === undefined ? 'all' : query.shelfStatus,
}),
);
};
//筛选
const searchSuccess = (value: rentGoodsParametersType) => {
pagination.pageNo = 1;
pagination.pageSize = 10;
setSearchParams(
qs.stringify({
pageNo: 1,
pageSize: 10,
...value,
shelfStatus: query.shelfStatus === undefined ? 'all' : query.shelfStatus,
}),
);
setQuery(value);
getRentGoodsList(value);
};
......@@ -278,7 +306,34 @@ const RentList = () => {
};
useEffect(() => {
getRentGoodsList();
pagination.pageNo = Number(searchParams.get('pageNo')) || 1;
pagination.pageSize = Number(searchParams.get('pageSize')) || 10;
const searchData = {
tradeName: searchParams.get('tradeName') || undefined,
productTypeId: searchParams.get('productTypeId')
? Number(searchParams.get('productTypeId'))
: undefined,
brandInfoId: searchParams.get('brandInfoId')
? Number(searchParams.get('brandInfoId'))
: undefined,
shelfStatus: searchParams.get('shelfStatus')
? searchParams.get('shelfStatus') === 'all'
? undefined
: Number(searchParams.get('shelfStatus'))
: undefined,
};
searchRef.current.getForm().setFieldsValue(searchData);
setActiveTabKey(
searchParams.get('shelfStatus')
? searchParams.get('shelfStatus') === 'all'
? '1'
: Number(searchParams.get('shelfStatus')) === 1
? '2'
: '3'
: '1',
);
setQuery(searchData);
getRentGoodsList(searchData);
getRentTypeList();
getRentMakeList();
}, []);
......@@ -293,6 +348,7 @@ const RentList = () => {
</Button>
}
searchData={searchSuccess}
baseRef={searchRef}
/>
<Card tabList={tabList} activeTabKey={activeTabKey} onTabChange={onTabChange}>
<div className='table-operate' style={{ marginBottom: '10px' }}>
......
......@@ -37,3 +37,27 @@ export const splitCouponUseType = [
label: '店铺券',
},
];
//租赁-质量字典
export const qualityList = [
{
label: '全新',
value: 0,
},
{
label: '99新',
value: 1,
},
{
label: '95新',
value: 2,
},
{
label: '90新',
value: 3,
},
{
label: '80新',
value: 4,
},
];
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论