Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈智峰
jinfa-platform
Commits
b1d55385
Commit
b1d55385
authored
Dec 03, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:下单接口添加shopId和memberRoleId参数
parent
ed5f0b49
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
11 deletions
+100
-11
index.ts
src/constants/index.ts
+14
-0
index.ts
src/global/config/index.ts
+6
-6
useStoreId.ts
src/hooks/useStoreId.ts
+43
-0
index.tsx
src/pages/lxMall/commodityDetail/index.tsx
+1
-1
index.tsx
src/pages/lxMall/order/index.tsx
+23
-2
index.tsx
src/pages/lxMall/purchaseOrder/index.tsx
+13
-2
No files found.
src/constants/index.ts
View file @
b1d55385
...
...
@@ -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
{
/**
* 企业商城
...
...
src/global/config/index.ts
View file @
b1d55385
/**
*
*
* **********
* 脚本注入全局配置
*
*
* **********
*/
import
SELF_CONFIG
from
'../../../config/base.config.json'
import
{
RootObject
}
from
'./global'
interface
n
ewRootObject
extends
RootObject
{
interface
N
ewRootObject
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
le
t
webChannelInfo
=
SELF_CONFIG
.
web
.
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
3
)[
0
]
// 渠道商城
le
t
webIChannelInfo
=
SELF_CONFIG
.
web
.
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
4
)[
0
]
// 渠道自有商城
cons
t
webChannelInfo
=
SELF_CONFIG
.
web
.
shopInfo
.
filter
(
item
=>
item
.
environment
===
1
&&
item
.
type
===
3
)[
0
]
// 渠道商城
cons
t
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
:
n
ewRootObject
=
SELF_CONFIG
export
const
GlobalConfig
:
N
ewRootObject
=
SELF_CONFIG
src/hooks/useStoreId.ts
0 → 100644
View file @
b1d55385
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
src/pages/lxMall/commodityDetail/index.tsx
View file @
b1d55385
...
...
@@ -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
,
...
...
src/pages/lxMall/order/index.tsx
View file @
b1d55385
...
...
@@ -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
)
{
...
...
src/pages/lxMall/purchaseOrder/index.tsx
View file @
b1d55385
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment