提交 9ca00270 作者: 翁进城

商城接口更新1.0.1

上级 1ab84db7
import request, { Response } from '~/api/request'; import request, { Response } from '~/api/request';
export interface ListPageGoodsInfoParams { export interface DeviceListParams {
"brandId"?: number, categoryId?: any[];
"districtId"?: number, pageNo: number;
"modelId"?: number, pageSize: number;
"pageNo": number, provinceId?: number;
"pageSize": number, type: number;
"partsId"?: number,
"productCategoryId"?: number,
"qualityId"?: number
} }
export interface Goods { export interface Goods {
"createTime": string, id: number;
"directoryId": number, goodsName: string;
"directoryName": string, images: string;
"goodsName": string, price?: any;
"goodsOneLevelTypeName": string,
"goodsTwoLevelTypeName": string,
"id": number,
"imgUrl": string,
"isCoupons": number,
"status": number
} }
export interface ListPageGoodsInfoResp { export interface DeviceListResp {
"pageNo": 1, "pageNo": 1,
"pageSize": 10, "pageSize": 10,
"list": Array<Goods>, "list": Array<Goods>,
...@@ -39,8 +30,8 @@ export interface Ad { ...@@ -39,8 +30,8 @@ export interface Ad {
export default { export default {
//web-商品信息-分页 //web-商品信息-分页
listPageGoodsInfo: (params: ListPageGoodsInfoParams, options = {}): Promise<Response<ListPageGoodsInfoResp>> => { deviceList: (params: DeviceListParams, options = {}): Promise<Response<DeviceListResp>> => {
return request('/pms/webProductMall/listPageGoodsInfo', 'post', params, options) return request('/pms/product/mall/deviceList', 'post', params, options)
}, },
//产品商城广告位 //产品商城广告位
ad: (): Promise<Response<Array<Ad>>> => { ad: (): Promise<Response<Array<Ad>>> => {
......
...@@ -13,7 +13,7 @@ import { Navigation } from "swiper"; ...@@ -13,7 +13,7 @@ import { Navigation } from "swiper";
// Import Swiper styles // Import Swiper styles
import "swiper/css"; import "swiper/css";
import "swiper/css/navigation"; import "swiper/css/navigation";
import api, { GetAppGoodsInfoDetailResult } from "./api"; import api, { GetLeaseGoodsDetailResp } from "./api";
import IntentionModal from "./components/intentionModal"; import IntentionModal from "./components/intentionModal";
import { UserContext } from "~/lib/userProvider"; import { UserContext } from "~/lib/userProvider";
...@@ -22,7 +22,7 @@ export default function MallDetail() { ...@@ -22,7 +22,7 @@ export default function MallDetail() {
const [visible, setVisible] = useState(false); //商品图预览 const [visible, setVisible] = useState(false); //商品图预览
const router = useRouter(); const router = useRouter();
const [id, setId] = useState<number | null>(null); const [id, setId] = useState<number | null>(null);
const [detail, setDetail] = useState<GetAppGoodsInfoDetailResult | null>( const [detail, setDetail] = useState<GetLeaseGoodsDetailResp | null>(
null null
); //详情数据 ); //详情数据
const [intentionModalOpen, setIntentionModalOpen] = useState(false); //意向弹窗 const [intentionModalOpen, setIntentionModalOpen] = useState(false); //意向弹窗
...@@ -53,8 +53,8 @@ export default function MallDetail() { ...@@ -53,8 +53,8 @@ export default function MallDetail() {
useEffect(() => { useEffect(() => {
if (id) { if (id) {
api api
.getAppGoodsInfoDetail({ .getLeaseGoodsDetail({
id: id, goodsId: id,
}) })
.then((res) => { .then((res) => {
setDetail(res.result || null); setDetail(res.result || null);
...@@ -132,7 +132,7 @@ export default function MallDetail() { ...@@ -132,7 +132,7 @@ export default function MallDetail() {
className={`${styles.font2} ${styles.ellipsis}`} className={`${styles.font2} ${styles.ellipsis}`}
style={{ height: 22 }} style={{ height: 22 }}
> >
{detail?.goodsDesc} {detail?.goodsDetail?.goodsDesc}
</div> </div>
<Space <Space
size={24} size={24}
......
import request, { Response } from "~/api/request" import request, { Response } from "~/api/request"
export interface GetAppGoodsInfoDetailParams { export interface GetLeaseGoodsDetailParams {
id: number goodsId: number
} }
export interface GetAppGoodsInfoDetailResult { export interface GetLeaseGoodsDetailResp {
id: number; id: number;
pid?: number; images: Image[];
goodsName?: string; goodsVideo?: any;
shareFlyServiceId?: number; goodsVideoId?: any;
repoId?: number; goodsName: string;
goodsSpec?: GoodsSpec[]; goodsNo: string;
images?: Image[]; goodsDetail: GoodsDetail;
goodsVideo?: string; directoryId: number;
goodsVideoId?: number; categoryByOne: number;
goodsDetail?: GoodsDetail; categoryByTwo?: any;
sortTypeId?: number; tag?: any;
masterTypeId?: number; shelfStatus: number;
slaveTypeId?: number; goodsSpec: GoodsSpec[];
tag?: string; otherService: OtherService[];
shelfStatus?: number; price?: any;
otherService?: OtherService[];
question?: Question[];
goodsDesc?: string
} }
export interface GoodsDetail { export interface OtherService {
id: number;
goodsDesc: string;
content: string;
remark?: any;
}
export interface Image {
id: number; id: number;
imgUrl: string; saleServiceId: number;
imgType: number; serviceName: string;
} }
export interface GoodsSpec { export interface GoodsSpec {
id: number; id: number;
goodsSpecName: string; goodsSpecName: string;
goodsTypeId: number; categoryId: number;
typeName: string; typeName: string;
skuId: number; skuId: number;
brandInfoId: number; brandInfoId?: any;
skuName: string; skuName: string;
productSpecList: ProductSpec[]; productSpecList: ProductSpecList[];
industrySpecList?: any; industrySpecList?: any;
chooseType: number; chooseType: number;
skuUnitId: number; skuUnitId: number;
unitName: string; unitName: string;
must: number; must: number;
flag?: any; flag: number;
} }
export interface ProductSpec { export interface ProductSpecList {
id: number; id: number;
productSpec: number; productSpec: number;
productSkuId: number; productSkuId: number;
...@@ -64,26 +54,33 @@ export interface ProductSpec { ...@@ -64,26 +54,33 @@ export interface ProductSpec {
partNo: string; partNo: string;
versionDesc: string; versionDesc: string;
createTime?: any; createTime?: any;
productSpecCPQVO?: any; productSpecCPQVO: ProductSpecCPQVO;
} }
export interface Question { export interface ProductSpecCPQVO {
answer: string, productSpecId: number;
id: number, type: number;
question: string leaseTerm?: any;
specPrice: any[];
} }
//其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 export interface GoodsDetail {
export interface OtherService { id: number;
id: number, goodsDesc: string;
saleServiceId: number, content: string;
serviceName: string remark?: any;
}
export interface Image {
id: number;
imgUrl: string;
imgType: number;
} }
export default { export default {
//web-获取商品详细信息--共多少种选择 //web-获取商品详细信息--共多少种选择
getAppGoodsInfoDetail(params: GetAppGoodsInfoDetailParams): Promise<Response<GetAppGoodsInfoDetailResult>> { getLeaseGoodsDetail(params: GetLeaseGoodsDetailParams): Promise<Response<GetLeaseGoodsDetailResp>> {
return request('/pms/webProductMall/getAppGoodsInfoDetail', 'get', params) return request('/pms/product/mall/getLeaseGoodsDetail', 'get', params)
} }
} }
\ No newline at end of file
import { Button, Col, Image, Modal, Row, Space } from "antd"; import { Button, Col, Image, Modal, Row, Space } from "antd";
import { useState } from "react"; import { useState } from "react";
import errImg from "~/assets/errImg"; import errImg from "~/assets/errImg";
import { GetAppGoodsInfoDetailResult } from "../../api"; import { GetLeaseGoodsDetailResp } from "../../api";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
type Props = { type Props = {
open?: boolean; open?: boolean;
onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void; onOk?: (e: React.MouseEvent<HTMLButtonElement>) => void;
onCancel: (e: React.MouseEvent<HTMLButtonElement>) => void; onCancel: (e: React.MouseEvent<HTMLButtonElement>) => void;
detail: GetAppGoodsInfoDetailResult | null; detail: GetLeaseGoodsDetailResp | null;
}; };
export default function IntentionModal(props: Props) { export default function IntentionModal(props: Props) {
const [checkedMap, setCheckedMap] = useState<{ string?: boolean }>({}); //通过索引记录选中的产品规格 例: {'1,1': true|false} const [checkedMap, setCheckedMap] = useState<{ string?: boolean }>({}); //通过索引记录选中的产品规格 例: {'1,1': true|false}
......
...@@ -4,7 +4,7 @@ import Layout from "~/components/layout"; ...@@ -4,7 +4,7 @@ import Layout from "~/components/layout";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import Filter, { AdapterResult, FilterResult } from "~/components/filter"; import Filter, { AdapterResult, FilterResult } from "~/components/filter";
import api, { Ad, Goods, ListPageGoodsInfoParams } from "./api"; import api, { Ad, Goods } from "./api";
import errImg from "~/assets/errImg"; import errImg from "~/assets/errImg";
// 此函数在构建时被调用 // 此函数在构建时被调用
...@@ -35,16 +35,17 @@ export default function Mall(props: Props) { ...@@ -35,16 +35,17 @@ export default function Mall(props: Props) {
setAbort(new AbortController()); setAbort(new AbortController());
}, [filterResult, pageParams]); }, [filterResult, pageParams]);
//端口列表请求 //商品列表请求
useEffect(() => { useEffect(() => {
if (!abort) { if (!abort) {
return; return;
} }
setLoading(true); setLoading(true);
api api
.listPageGoodsInfo( .deviceList(
{ {
...filterResult, provinceId: filterResult.districtId,
type: 0,
...pageParams, ...pageParams,
}, },
{ {
...@@ -83,7 +84,7 @@ export default function Mall(props: Props) { ...@@ -83,7 +84,7 @@ export default function Mall(props: Props) {
<Layout> <Layout>
<div className="page" style={{ paddingTop: "18px" }}> <div className="page" style={{ paddingTop: "18px" }}>
<Filter <Filter
types={["类目", "地域", "品牌", "部件",/* "型号", "成色" */]} types={["类目", "地域", "品牌", "部件" /* "型号", "成色" */]}
showResultItem showResultItem
onChange={onFilterChange} onChange={onFilterChange}
></Filter> ></Filter>
...@@ -91,42 +92,45 @@ export default function Mall(props: Props) { ...@@ -91,42 +92,45 @@ export default function Mall(props: Props) {
<div className={styles.productList}> <div className={styles.productList}>
<div className={styles.main}> <div className={styles.main}>
<div className={styles.listContent}> <div className={styles.listContent}>
<ul className={styles.listWrap}> <Spin spinning={loading} delay={500}>
{productList.map((item, i) => { <ul className={styles.listWrap}>
return ( {productList.map((item, i) => {
<li return (
key={i} <li
className={styles.item} key={i}
onClick={() => router.push("/mall/detail/" + item.id)} className={styles.item}
> onClick={() => router.push("/mall/detail/" + item.id)}
<div className={styles.imgBox}> >
<Image <div className={styles.imgBox}>
alt="" <Image
src={item.imgUrl} alt=""
className={styles.img} src={item.images}
width={116} className={styles.img}
height={116} width={116}
preview={false} height={116}
></Image> preview={false}
</div> ></Image>
<div className={styles.title}>{item.goodsName}</div> </div>
<div className={styles.sellCount}> <div className={styles.title}>{item.goodsName}</div>
半年售 <div className={styles.sellCount}>
{(Math.floor(Math.random() * 901) + 100).toFixed(0)} 半年售
</div> {(Math.floor(Math.random() * 901) + 100).toFixed(0)}
</li> </div>
); </li>
})} );
{productList.length === 0 && ( })}
<Empty {productList.length === 0 && (
style={{ <Empty
paddingTop: 20, style={{
width: "100%", paddingTop: 20,
textAlign: "center", width: "100%",
}} textAlign: "center",
></Empty> }}
)} ></Empty>
</ul> )}
</ul>
</Spin>
<div className={styles.paginationPage}> <div className={styles.paginationPage}>
<Pagination <Pagination
current={pageParams.pageNo} current={pageParams.pageNo}
......
import request, { Response } from "~/api/request" import request, { Response } from "~/api/request"
export interface listPageParams { export interface ListPageParams {
keyword?: string, keyword?: string,
showType: number, showType: number,
pageNo: number; pageNo: number;
pageSize: number; pageSize: number;
} }
export interface listPageResp { export interface ListPageResp {
pageNo: number; pageNo: number;
pageSize: number; pageSize: number;
list: OrderList[]; list: OrderList[];
...@@ -78,21 +78,20 @@ interface OgSkuSpecDTOList { ...@@ -78,21 +78,20 @@ interface OgSkuSpecDTOList {
} }
export interface ListTranStatusResp { export interface ListStatusResp {
status: string; status: string;
doing: string; code: number;
waiting: string; nextCode: number;
leaseOrderStatus: string;
} }
export default { export default {
//v1.0.0订单列表-查询 //v1.0.0订单列表-查询
listPage(params: listPageParams, options: any): Promise<Response<listPageResp>> { listPage(params: ListPageParams, options: any): Promise<Response<ListPageResp>> {
return request('/oms/app-order/listPage', 'get', params, options) return request('/oms/app-order/listPage', 'get', params, options)
}, },
//订单状态-字典 //订单状态-字典
listTranStatus(): Promise<Response<ListTranStatusResp[]>> { listStatus(): Promise<Response<ListStatusResp[]>> {
return request('/oms/RentalOrders/listTranStatus', 'get'); return request('/oms/mallorder/listStatus', 'get');
} }
} }
\ No newline at end of file
...@@ -16,7 +16,7 @@ import errImg from "~/assets/errImg"; ...@@ -16,7 +16,7 @@ import errImg from "~/assets/errImg";
import Right from "~/components/contentBox/right"; import Right from "~/components/contentBox/right";
import LayoutView from "~/components/layout"; import LayoutView from "~/components/layout";
import Sider from "../components/sider"; import Sider from "../components/sider";
import api, { OrderList, ListTranStatusResp } from "./api"; import api, { OrderList, MallorderResp } from "./api";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
const items: TabsProps["items"] = [ const items: TabsProps["items"] = [
...@@ -54,6 +54,14 @@ export default function LeasingOrder() { ...@@ -54,6 +54,14 @@ export default function LeasingOrder() {
const [orderList, setOrderList] = useState<OrderList[]>([]); const [orderList, setOrderList] = useState<OrderList[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [orderNo, setOrderNo] = useState<string | undefined>(); const [orderNo, setOrderNo] = useState<string | undefined>();
const [tranStatusMap, setTranStatusMap] = useState<ListStatusResp[]>([]); //订单状态字典
//获取订单状态字典
useEffect(() => {
api.listStatus().then((res) => {
setTranStatusMap(res.result || []);
});
}, []);
useEffect(() => { useEffect(() => {
//中断前一次列表请求 //中断前一次列表请求
...@@ -134,7 +142,7 @@ export default function LeasingOrder() { ...@@ -134,7 +142,7 @@ export default function LeasingOrder() {
}} }}
> >
<div className={styles.font2}>{item.createTime}</div> <div className={styles.font2}>{item.createTime}</div>
<div className={styles.font3}>待分配运营</div> <div className={styles.font3}>{tranStatusMap.find(status => status.code === item.statusCode)?.status}</div>
</Row> </Row>
<Row <Row
style={{ minHeight: 100, border: "1px solid #D0EAF5" }} style={{ minHeight: 100, border: "1px solid #D0EAF5" }}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论