Commit 76b137af authored by GuanHua's avatar GuanHua

feat:渠道商品下单

parent f1839341
......@@ -81,6 +81,15 @@ const shopRoute = {
component: '@/pages/lxMall/purchaseOrder',
},
{
// 渠道订单
path: `/channelmall/order`,
name: 'order',
key: 'order',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/order',
},
{
path: '/noAuth',
component: '@/pages/403',
},
......
......@@ -55,7 +55,7 @@ interface imgItemType {
const CommodityDetail = (props) => {
const { query: { id } } = props.location
const { shopInfo = {}, layoutType, memberId } = props
const { shopInfo = {}, layoutType, memberId, shopUrlParam } = props
const OrderStore = useLocalStore(() => store.OrderStore)
const { updateOrderInfo } = OrderStore
const [addSuccessVisible, setAddSuccessVisible] = useState<boolean>(false)
......@@ -299,7 +299,7 @@ const CommodityDetail = (props) => {
}]
}
updateOrderInfo(buyOrderInfo, sessionKey).then(() => {
history.push(`/order?spam_id=${sessionKey}&scence=prompt`)
history.push(`${layoutType === LAYOUT_TYPE.channel ? '/channelmall' : ''}/order?spam_id=${sessionKey}&scence=prompt${layoutType === LAYOUT_TYPE.channel ? '&channelId=' + shopUrlParam : ''}`)
})
clickFlag = true
} else {
......@@ -514,7 +514,7 @@ const CommodityDetail = (props) => {
let result = true
let newSelectAttrVal = JSON.parse(JSON.stringify(selectAttrVal))
if (selectAttrVal.length > 0) {
newSelectAttrVal.pop()
// newSelectAttrVal.pop()
if (commodityDetail?.unitPriceAndPicList) {
let tempList = []
for (let item of commodityDetail?.unitPriceAndPicList) {
......@@ -726,7 +726,7 @@ const CommodityDetail = (props) => {
<span>种商品</span>
</div>
</div>
<div className={cx(styles.add_success_btn, styles.primary)} onClick={() => history.push('/purchaseOrder')}>去结算</div>
<div className={cx(styles.add_success_btn, styles.primary)} onClick={() => history.push(`${layoutType === LAYOUT_TYPE.channel ? '/channelmall' : ''}/purchaseOrder${layoutType === LAYOUT_TYPE.channel ? '?channelId=' + shopUrlParam : ''}`)}>去结算</div>
<div className={styles.add_success_btn} onClick={() => setAddSuccessVisible(false)}>继续购物</div>
</div>
<InterestedCommodity />
......
......@@ -5,7 +5,7 @@ import { LAYOUT_TYPE } from '@/constants'
interface ShopHeaderPropsType {
title?: string;
type: LAYOUT_TYPE;
type?: LAYOUT_TYPE;
logoUrl?: string;
shopUrlParam?: string;
}
......@@ -18,7 +18,7 @@ const CommonHeader: React.FC<ShopHeaderPropsType> = (props) => {
let link = '/'
switch (type) {
case LAYOUT_TYPE.channel:
link = `/channelmall?id=${shopUrlParam}`
link = `/channelmall?channelId=${shopUrlParam}`
break
case LAYOUT_TYPE.mall:
case LAYOUT_TYPE.shop:
......@@ -33,9 +33,9 @@ const CommonHeader: React.FC<ShopHeaderPropsType> = (props) => {
<div className={styles.common_header}>
<div className={styles.common_header_container}>
<div className={styles.logo}>
<Link to={getHomeLink()}>
<img src={logoUrl} />
</Link>
{/* <Link to={getHomeLink()}> */}
<img src={logoUrl} />
{/* </Link> */}
</div>
<div className={styles.common_header_split}></div>
<div className={styles.common_header_title}>{title}</div>
......
......@@ -26,7 +26,7 @@ const SideNav: React.FC<SideNavPropsType> = (props) => {
let link = '/purchaseOrder'
switch (type) {
case LAYOUT_TYPE.channel:
link = `/channelmall/purchaseOrder?id=${shopUrlParam}`
link = `/channelmall/purchaseOrder?channelId=${shopUrlParam}`
break
default:
link = '/purchaseOrder'
......
......@@ -15,12 +15,18 @@ import styles from './index.less'
import { PublicApi } from '@/services/api'
import { GetLogisticsReceiverAddressGetResponse } from '@/services/LogisticsApi'
import { isEmpty } from 'lodash'
import { LAYOUT_TYPE } from '@/constants'
interface OrderPropsType {
location: any
location: any;
shopInfo: any;
mallInfo: any;
layoutType: LAYOUT_TYPE;
}
const Order: React.FC<OrderPropsType> = (props) => {
const { shopInfo, mallInfo, layoutType } = props
console.log(shopInfo, "shopInfo")
const { spam_id } = props.location.query
const OrderStore = useLocalStore(() => store.OrderStore)
const { clearOrderInfo, getOrderInfo } = OrderStore
......@@ -53,7 +59,11 @@ const Order: React.FC<OrderPropsType> = (props) => {
for (let orderItem of item.orderList) {
let resData: any = {}
if (orderItem.logistics?.sendAddress) {
resData = await PublicApi.getLogisticsShipperAddressGet({ id: orderItem.logistics.sendAddress })
try {
resData = await PublicApi.getLogisticsShipperAddressGet({ id: orderItem.logistics.sendAddress })
} catch (error) {
console.log(error)
}
}
message.destroy()
orderItem.logisticsInfo = resData.data || {}
......@@ -62,7 +72,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
item.orderList = tempOrderList
result.push(item)
}
console.log(result, "result")
setOrderList(result)
setOrderInfo(sessionOrderInfo)
setSpinningState(false)
......@@ -131,7 +141,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
return
}
let params: any = {
orderModel: 5, // 下单模式
orderModel: layoutType === LAYOUT_TYPE.channel ? 12 : 5, // 下单模式
deliveryAddresId: selectAddressInfo.id,
addresName: selectAddressInfo.receiverName,
isDefault: selectAddressInfo.isDefault,
......@@ -184,7 +194,10 @@ const Order: React.FC<OrderPropsType> = (props) => {
return orderInfo && (
<Spin spinning={spinningState}>
<div className={styles.order}>
<CommonHeader title="订单结算" />
<CommonHeader
logoUrl={layoutType === LAYOUT_TYPE.channel ? shopInfo?.logo : mallInfo.logoUrl}
title="订单结算"
/>
<div className={styles.order_container}>
{
orderInfo.logistics.deliveryType === 1 && (
......
......@@ -19,11 +19,12 @@ import { isEmpty } from 'lodash'
interface PurchaseOrderPropsType {
layoutType: LAYOUT_TYPE,
shopInfo: GetTemplateChannelFindChannelResponse,
shopUrlParam: string
shopUrlParam: string,
mallInfo: any
}
const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const { layoutType, shopInfo, shopUrlParam } = props
const { layoutType, shopInfo, shopUrlParam, mallInfo } = props
const OrderStore = useLocalStore(() => store.OrderStore)
const { updateOrderInfo } = OrderStore
const [indeterminate, setIndeterminate] = useState<boolean>(false)
......@@ -511,7 +512,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
<CommonHeader
title="我的进货单"
type={layoutType}
logoUrl={layoutType === LAYOUT_TYPE.channel ? shopInfo?.logo : GlobalConfig.global.logo}
logoUrl={layoutType === LAYOUT_TYPE.channel ? shopInfo?.logo : mallInfo.logoUrl}
shopUrlParam={shopUrlParam}
/>
<div className={styles.purchase_order_title}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment