Commit b1d55385 authored by GuanHua's avatar GuanHua

fix:下单接口添加shopId和memberRoleId参数

parent ed5f0b49
......@@ -12,6 +12,20 @@ export const MALL_TYPE = {
5: '渠道积分商城'
}
export enum SHOP_TYPE {
/** 企业商城 */
mall = 1,
/** 积分商城 */
scoreMall = 2,
/** 渠道商城 */
channel = 3,
/** 渠道自有商城 */
ichannel = 4,
/** 渠道积分商城 */
channelScoreMall = 5,
}
export enum LAYOUT_TYPE {
/**
* 企业商城
......
/**
*
*
* **********
* 脚本注入全局配置
*
*
* **********
*/
import SELF_CONFIG from '../../../config/base.config.json'
import { RootObject } from './global'
interface newRootObject extends RootObject {
interface NewRootObject extends RootObject {
channelRootRoute: string;
ichannelRootRoute: string;
}
......@@ -28,8 +28,8 @@ export const checkUrl = (url, defaultUrl) => {
const MALL_ROUTE_USE_CONFIG = process.env.USE_ROUTE_CONFIG || true
let webChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 3)[0] // 渠道商城
let webIChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 4)[0] // 渠道自有商城
const webChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 3)[0] // 渠道商城
const webIChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 4)[0] // 渠道自有商城
const defaultChannelRoute = '/channelmall' // 默认渠道商城根路径
const defaultIChannelRoute = '/ichannelmall' // 默认渠道自有商城根路径
......@@ -39,4 +39,4 @@ const ichannelRootRoute = MALL_ROUTE_USE_CONFIG === 'true' ? checkUrl(webIChanne
SELF_CONFIG.channelRootRoute = channelRootRoute // 渠道商城路由根路径
SELF_CONFIG.ichannelRootRoute = ichannelRootRoute // 渠道自有商城路由根路径
export const GlobalConfig: newRootObject = SELF_CONFIG
export const GlobalConfig: NewRootObject = SELF_CONFIG
import React, { useState, useEffect } from 'react'
import { LAYOUT_TYPE, SHOP_TYPE } from '@/constants'
import { GlobalConfig } from "@/global/config"
const useStoreId = (layoutType: LAYOUT_TYPE) => {
const [storeId, setStoreId] = useState<number>()
const getStoreIdByLayoutType = () => {
switch(layoutType) {
case LAYOUT_TYPE.mall:
setStoreId(getStoreId(SHOP_TYPE.mall))
break
case LAYOUT_TYPE.channel:
setStoreId(getStoreId(SHOP_TYPE.channel))
break
case LAYOUT_TYPE.ichannel:
setStoreId(getStoreId(SHOP_TYPE.ichannel))
break
case LAYOUT_TYPE.channelScoreMall:
setStoreId(getStoreId(SHOP_TYPE.channelScoreMall))
break
case LAYOUT_TYPE.scoreMall:
setStoreId(getStoreId(SHOP_TYPE.scoreMall))
break
}
}
useEffect(() => {
getStoreIdByLayoutType()
}, [layoutType])
const getStoreId = (mallType: number) => {
const shopList = GlobalConfig.web.shopInfo
const shopInfo:any = shopList.filter(item => item.environment === 1 && item.type === mallType)[0] || {}
return shopInfo.id
}
return {
storeId
}
}
export default useStoreId
......@@ -492,7 +492,6 @@ const CommodityDetail = (props) => {
const param: any = {
productId: selectCommodityId,
memberId,
shopId
}
PublicApi.postOrderDirectPayment(param).then(res => {
if (res.code === 1000) {
......@@ -524,6 +523,7 @@ const CommodityDetail = (props) => {
supplyMembersId: commodityDetail.memberId,
supplyMembersRoleId: commodityDetail.memberRoleId,
isInvoice: commodityDetail.isInvoice,
shopId: shopInfo.id,
orderList: [{
id: shopInfo.id,
shopname: shopInfo.company,
......
......@@ -17,7 +17,8 @@ import SignModal from '@/components/SignModal'
import { isEmpty } from 'lodash'
import { GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth'
import { LAYOUT_TYPE, OrderModalType, COMMODITY_TYPE, ORDER_TYPE2_POINTS, ORDER_TYPE2_CHANNEL_POINTS } from '@/constants'
import { LAYOUT_TYPE, OrderModalType, COMMODITY_TYPE } from '@/constants'
import useStoreId from '@/hooks/useStoreId'
interface OrderPropsType {
location: any;
......@@ -28,6 +29,24 @@ interface OrderPropsType {
shopId: number;
}
const getLayoutType = (layoutType: LAYOUT_TYPE, commodityType: COMMODITY_TYPE) => {
switch(layoutType) {
case LAYOUT_TYPE.mall:
if(commodityType === COMMODITY_TYPE.integral) {
return LAYOUT_TYPE.scoreMall
} else {
return layoutType
}
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
if(commodityType === COMMODITY_TYPE.integral) {
return LAYOUT_TYPE.channelScoreMall
} else {
return layoutType
}
}
}
const Order: React.FC<OrderPropsType> = (props) => {
let checkoutCount = 0
const userInfo = getAuth()
......@@ -52,6 +71,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
const [electronicContractId, setElectronicContractId] = useState<number>()
const [agreeSingLoading, setAgreeSignLoading] = useState<boolean>(false)
const [btnDisabled] = useState<boolean>(false)
const { storeId } = useStoreId(getLayoutType(layoutType, type))
useEffect(() => {
if (!userInfo) {
......@@ -267,7 +287,8 @@ const Order: React.FC<OrderPropsType> = (props) => {
const params: any = {
orderModel: getOrderMode(), // 下单模式
needTheInvoice: needTheInvoice ? 1 : 0,
shopId
memberRoleId: userInfo.memberRoleId,
shopId: storeId
}
if (orderInfo.logistics.deliveryType === 1 && !!selectAddressInfo) {
......
......@@ -15,7 +15,9 @@ import { LAYOUT_TYPE } from '@/constants'
import { GetSearchShopPurchaseGetPurchaseListResponse } from '@/services/SearchApi'
import { GetTemplateChannelFindChannelResponse } from '@/services/TemplateApi'
import { isEmpty } from 'lodash'
import { getAuth } from '@/utils/auth'
import { GlobalConfig } from '@/global/config'
import useStoreId from '@/hooks/useStoreId'
interface PurchaseOrderPropsType {
layoutType: LAYOUT_TYPE,
......@@ -27,6 +29,8 @@ interface PurchaseOrderPropsType {
const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const { layoutType, shopInfo, shopUrlParam, mallInfo } = props
const { storeId } = useStoreId(layoutType)
const userInfo = getAuth()
const OrderStore = useLocalStore(() => store.OrderStore)
const { updateOrderInfo } = OrderStore
const [indeterminate, setIndeterminate] = useState<boolean>(false)
......@@ -37,7 +41,6 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const [categoryIds, setCategoryIds] = useState<any>()
const [loading, setLoading] = useState<boolean>(false)
let countState = true
useEffect(() => {
fetchPurchaseList()
}, [])
......@@ -579,6 +582,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
supplyMembersName: selectItem.shopname,
supplyMembersId: selectItem.memberId,
supplyMembersRoleId: selectItem.memberRoleId,
// shopId: shopInfo.id,
orderList: [{
id: selectItem.id,
shopname: selectItem.shopname,
......@@ -587,7 +591,14 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
}
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
PublicApi.postOrderIsWorkFlow({ productIds, memberId: selectItem.memberId }).then(res => {
const param: any = {
productIds,
memberId: selectItem.memberId,
shopId: storeId,
memberRoleId: userInfo.memberRoleId
}
PublicApi.postOrderIsWorkFlow(param).then(res => {
setConfirmLoading(false)
if (res.code === 1000) {
message.destroy()
......
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