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
shenshaokai
jinfa-platform
Commits
5a3d043c
Commit
5a3d043c
authored
Dec 14, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
e98846d9
583c7861
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
261 additions
and
251 deletions
+261
-251
index.tsx
src/pages/channel/channelTemplate/index.tsx
+3
-3
index.tsx
src/pages/channel/templateDetail/index.tsx
+7
-6
index.tsx
src/pages/lxMall/order/index.tsx
+1
-1
index.tsx
src/pages/lxMall/order/payway/index.tsx
+11
-4
index.tsx
src/pages/shop/shopTemplate/index.tsx
+49
-49
index.tsx
src/pages/shop/templateDetail/index.tsx
+128
-126
index.ts
src/store/site/index.ts
+62
-62
No files found.
src/pages/channel/channelTemplate/index.tsx
View file @
5a3d043c
...
...
@@ -4,19 +4,19 @@ import { history } from 'umi'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
TemplateItem
from
'../components/templateItem'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetTemplate
ShopFindAllShelfShopTemplateResponse
}
from
'@/services
'
import
{
GetTemplate
WebPageTemplateWebFindAllShelfChannelTemplateResponse
}
from
'@/services/TemplateApi
'
import
styles
from
'./index.less'
const
ShopTemplate
:
React
.
FC
=
()
=>
{
const
[
templateList
,
setTemplateList
]
=
useState
<
GetTemplate
ShopFindAllShelfShop
TemplateResponse
>
([])
const
[
templateList
,
setTemplateList
]
=
useState
<
GetTemplate
WebPageTemplateWebFindAllShelfChannel
TemplateResponse
>
([])
useEffect
(()
=>
{
fetchAllShelfShopTemplate
()
},
[])
const
fetchAllShelfShopTemplate
=
()
=>
{
PublicApi
.
getTemplate
Channel
FindAllShelfChannelTemplate
().
then
(
res
=>
{
PublicApi
.
getTemplate
WebPageTemplateWeb
FindAllShelfChannelTemplate
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTemplateList
(
res
.
data
)
}
else
if
(
res
.
code
===
47001
)
{
...
...
src/pages/channel/templateDetail/index.tsx
View file @
5a3d043c
...
...
@@ -6,7 +6,7 @@ import DetailPage from '@/components/DetailPage'
import
UseModal
from
'../components/useModal'
import
{
PublicApi
}
from
'@/services/api'
import
{
Environment_Status
}
from
'@/constants'
import
{
GetTemplate
ShopFindShopTemplateDetailsResponse
}
from
'@/services
'
import
{
GetTemplate
WebPageTemplateWebFindChannelTemplateDetailsResponse
}
from
'@/services/TemplateApi
'
import
default_img
from
'@/assets/imgs/template_default_img.png'
import
styles
from
'./index.less'
...
...
@@ -21,7 +21,7 @@ interface TemplateDetailPropsType {
const
TemplateDetail
:
React
.
FC
<
TemplateDetailPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
type
,
id
}
}
=
props
.
location
const
[
detailInfo
,
setDetailInfo
]
=
useState
<
GetTemplate
ShopFindShop
TemplateDetailsResponse
>
()
const
[
detailInfo
,
setDetailInfo
]
=
useState
<
GetTemplate
WebPageTemplateWebFindChannel
TemplateDetailsResponse
>
()
const
[
useModalVisible
,
setUseModalVisible
]
=
useState
<
boolean
>
(
false
)
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
)
...
...
@@ -30,8 +30,10 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
},
[])
const
fetchDetail
=
()
=>
{
//@ts-ignore
PublicApi
.
getTemplateChannelFindChannelTemplateDetails
({
id
}).
then
(
res
=>
{
const
param
:
any
=
{
id
}
PublicApi
.
getTemplateWebPageTemplateWebFindChannelTemplateDetails
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setDetailInfo
(
res
.
data
)
}
...
...
@@ -43,8 +45,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
*/
const
handleConfirmUse
=
()
=>
{
setConfirmLoading
(
true
)
//@ts-ignore
PublicApi
.
postTemplateChannelUseChannelTemplate
({
id
}).
then
(
res
=>
{
PublicApi
.
postTemplateWebPageTemplateWebUseChannelTemplate
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUseModalVisible
(
false
)
fetchDetail
()
...
...
src/pages/lxMall/order/index.tsx
View file @
5a3d043c
...
...
@@ -486,7 +486,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
}
/>
)
}
<
PayWay
supplyMembersId=
{
orderInfo
.
supplyMembersId
}
supplyMembersRoleId=
{
orderInfo
.
supplyMembersRoleId
}
selectItem=
{
selectPayWay
}
payWayList=
{
orderInfo
.
payWayList
}
onChange=
{
(
val
)
=>
setSelectPayWay
(
val
)
}
/>
<
PayWay
supplyMembersId=
{
orderInfo
.
supplyMembersId
}
deliveryType=
{
orderInfo
.
logistics
.
deliveryType
}
supplyMembersRoleId=
{
orderInfo
.
supplyMembersRoleId
}
selectItem=
{
selectPayWay
}
payWayList=
{
orderInfo
.
payWayList
}
onChange=
{
(
val
)
=>
setSelectPayWay
(
val
)
}
/>
{
/* <Delivery /> */
}
{
orderInfo
.
isInvoice
&&
<
Invoice
state=
{
needTheInvoice
}
onChange=
{
(
val
)
=>
setNeedTheInvoice
(
val
)
}
onSelect=
{
(
val
)
=>
setSelectInvoiceInfo
(
val
)
}
/>
...
...
src/pages/lxMall/order/payway/index.tsx
View file @
5a3d043c
...
...
@@ -14,15 +14,16 @@ interface PayWayProps {
selectItem
:
any
;
supplyMembersId
:
number
;
supplyMembersRoleId
:
number
;
deliveryType
?:
number
;
}
const
PayWay
:
React
.
FC
<
PayWayProps
>
=
(
props
)
=>
{
const
{
payWayList
=
[],
onChange
,
selectItem
=
{},
supplyMembersId
,
supplyMembersRoleId
}
=
props
const
{
payWayList
=
[],
onChange
,
selectItem
=
{},
supplyMembersId
,
deliveryType
=
1
,
supplyMembersRoleId
}
=
props
const
[
expand
,
setExpand
]
=
useState
<
boolean
>
(
false
)
const
[
creditInfo
,
setCreditInfo
]
=
useState
<
GetPayCreditGetCreditResponse
>
()
const
handleSelectWay
=
(
item
)
=>
{
if
(
item
.
payType
===
3
)
{
if
(
item
.
payType
===
3
||
item
.
payType
===
4
)
{
if
(
!
getCreditState
(
item
))
{
return
}
...
...
@@ -41,11 +42,11 @@ const PayWay: React.FC<PayWayProps> = (props) => {
},
[
payWayList
])
const
fetchCreditInfo
=
()
=>
{
let
param
=
{
const
param
:
any
=
{
parentMemberId
:
supplyMembersId
,
parentMemberRoleId
:
supplyMembersRoleId
}
//@ts-ignore
PublicApi
.
getPayCreditGetCredit
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setCreditInfo
(
res
.
data
)
...
...
@@ -62,6 +63,12 @@ const PayWay: React.FC<PayWayProps> = (props) => {
}
else
if
(
creditInfo
.
isUsable
===
0
)
{
result
=
false
}
}
else
if
(
info
.
payType
===
4
)
{
if
(
deliveryType
!==
1
)
{
result
=
false
}
else
{
result
=
true
}
}
return
result
}
...
...
src/pages/shop/shopTemplate/index.tsx
View file @
5a3d043c
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
Row
,
Col
,
message
}
from
'antd'
import
{
history
}
from
'umi'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
TemplateItem
from
'../components/templateItem'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetTemplate
ShopFindAllShelfShopTemplateResponse
}
from
'@/services'
import
styles
from
'./index.less'
const
ShopTemplate
:
React
.
FC
=
()
=>
{
const
[
templateList
,
setTemplateList
]
=
useState
<
GetTemplate
ShopFindAllShelfShopTemplateResponse
>
([])
useEffect
(()
=>
{
fetchAllShelfShopTemplate
()
},
[])
const
fetchAllShelfShopTemplate
=
()
=>
{
PublicApi
.
getTemplate
ShopFindAllShelfShopTemplate
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTemplateList
(
res
.
data
)
}
else
if
(
res
.
code
===
47001
)
{
message
.
destroy
()
message
.
info
(
"您还未创建店铺,请先创建店铺"
)
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/shopAbility/infoManage'
)
},
2000
);
}
})
}
return
(
<
PageHeaderWrapper
>
<
div
className=
{
styles
.
shop_center_template
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
template_list
}
>
{
templateList
.
map
(
item
=>
(
<
Col
xxl=
{
6
}
xl=
{
8
}
lg=
{
12
}
key=
{
item
.
id
}
>
<
TemplateItem
templateInfo=
{
item
}
type=
"shop"
/>
</
Col
>
))
}
</
Row
>
</
div
>
</
PageHeaderWrapper
>
)
}
export
default
ShopTemplate
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
Row
,
Col
,
message
}
from
'antd'
import
{
history
}
from
'umi'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
TemplateItem
from
'../components/templateItem'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetTemplate
WebPageTemplateWebFindAllShelfShopTemplateResponse
}
from
'@/services/TemplateApi'
import
styles
from
'./index.less'
const
ShopTemplate
:
React
.
FC
=
()
=>
{
const
[
templateList
,
setTemplateList
]
=
useState
<
GetTemplate
WebPageTemplateWebFindAllShelfShopTemplateResponse
>
([])
useEffect
(()
=>
{
fetchAllShelfShopTemplate
()
},
[])
const
fetchAllShelfShopTemplate
=
()
=>
{
PublicApi
.
getTemplate
WebPageTemplateWebFindAllShelfShopTemplate
().
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setTemplateList
(
res
.
data
)
}
else
if
(
res
.
code
===
47001
)
{
message
.
destroy
()
message
.
info
(
"您还未创建店铺,请先创建店铺"
)
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/shopAbility/infoManage'
)
},
2000
);
}
})
}
return
(
<
PageHeaderWrapper
>
<
div
className=
{
styles
.
shop_center_template
}
>
<
Row
gutter=
{
24
}
className=
{
styles
.
template_list
}
>
{
templateList
.
map
(
item
=>
(
<
Col
xxl=
{
6
}
xl=
{
8
}
lg=
{
12
}
key=
{
item
.
id
}
>
<
TemplateItem
templateInfo=
{
item
}
type=
"shop"
/>
</
Col
>
))
}
</
Row
>
</
div
>
</
PageHeaderWrapper
>
)
}
export
default
ShopTemplate
src/pages/shop/templateDetail/index.tsx
View file @
5a3d043c
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
LayoutOutlined
,
EyeOutlined
,
PushpinOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
DetailPage
from
'@/components/DetailPage'
import
UseModal
from
'../components/useModal'
import
{
PublicApi
}
from
'@/services/api'
import
{
Environment_Status
}
from
'@/constants'
import
{
GetTemplateShopFindShopTemplateDetailsResponse
}
from
'@/services'
import
default_img
from
'@/assets/imgs/template_default_img.png'
import
styles
from
'./index.less'
interface
TemplateDetailPropsType
{
location
:
{
query
:
{
id
:
number
;
type
:
string
;
// 商城模板:shopCenter ;店铺模板:shop; 商品描述模板: goods
}
}
}
const
TemplateDetail
:
React
.
FC
<
TemplateDetailPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
type
,
id
}
}
=
props
.
location
const
[
detailInfo
,
setDetailInfo
]
=
useState
<
GetTemplateShopFindShopTemplateDetailsResponse
>
()
const
[
useModalVisible
,
setUseModalVisible
]
=
useState
<
boolean
>
(
false
)
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
)
useEffect
(()
=>
{
fetchDetail
()
},
[])
const
fetchDetail
=
()
=>
{
//@ts-ignore
PublicApi
.
getTemplateShopFindShopTemplateDetails
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setDetailInfo
(
res
.
data
)
}
})
}
/**
* 使用模板
*/
const
handleConfirmUse
=
()
=>
{
setConfirmLoading
(
true
)
//@ts-ignore
PublicApi
.
postTemplateShopUseShopTemplate
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUseModalVisible
(
false
)
fetchDetail
()
}
setConfirmLoading
(
false
)
}).
catch
(()
=>
{
setConfirmLoading
(
false
)
})
}
const
handleLinkEdit
=
()
=>
{
window
.
location
.
href
=
`/shop/template/edit?id=
${
detailInfo
.
id
}
&template=
${
detailInfo
.
fileName
}
`
// history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
const
handleLinkPreview
=
()
=>
{
window
.
location
.
href
=
`/shop/template/preview?id=
${
detailInfo
.
id
}
&template=
${
detailInfo
.
fileName
}
`
}
return
(
<
DetailPage
title=
"查看模板"
>
<
div
className=
{
styles
.
template_detail
}
>
<
div
className=
{
styles
.
template_info_wrap
}
>
<
div
className=
{
styles
.
template_img_box
}
>
<
div
className=
{
cx
(
styles
.
type_tag
)
}
>
{
Environment_Status
[
detailInfo
?.
environment
]
}
</
div
>
<
img
src=
{
default_img
}
/>
</
div
>
<
div
className=
{
styles
.
template_info
}
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
模板名称:
</
label
>
<
span
>
{
detailInfo
?.
templateName
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
适用环境:
</
label
>
<
span
>
{
Environment_Status
[
detailInfo
?.
environment
]
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
模板描述:
</
label
>
<
span
>
{
detailInfo
?.
templateDescribe
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
使用站点:
</
label
>
<
span
>
{
detailInfo
?.
siteName
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
使用商城:
</
label
>
<
span
>
{
detailInfo
?.
shopName
}
</
span
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
btn
}
onClick=
{
()
=>
handleLinkPreview
()
}
>
<
EyeOutlined
/>
<
label
>
预览
</
label
>
</
div
>
<
div
className=
{
cx
(
styles
.
btn
,
styles
.
fit
)
}
onClick=
{
()
=>
handleLinkEdit
()
}
>
<
LayoutOutlined
/>
<
label
>
店铺装修
</
label
>
</
div
>
<
div
className=
{
cx
(
styles
.
btn
,
detailInfo
?.
use
===
1
?
styles
.
use
:
''
)
}
onClick=
{
()
=>
detailInfo
?.
use
!==
1
?
setUseModalVisible
(
true
)
:
{}
}
>
<
PushpinOutlined
/>
<
label
>
{
detailInfo
?.
use
===
1
?
'使用中'
:
'使用'
}
</
label
>
</
div
>
<
UseModal
title=
"使用店铺模板"
visible=
{
useModalVisible
}
dataInfo=
{
detailInfo
}
confirmLoading=
{
confirmLoading
}
onOk=
{
()
=>
handleConfirmUse
()
}
onCancel=
{
()
=>
setUseModalVisible
(
false
)
}
/>
</
div
>
</
DetailPage
>
)
}
export
default
TemplateDetail
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
LayoutOutlined
,
EyeOutlined
,
PushpinOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
DetailPage
from
'@/components/DetailPage'
import
UseModal
from
'../components/useModal'
import
{
PublicApi
}
from
'@/services/api'
import
{
Environment_Status
}
from
'@/constants'
import
{
GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse
}
from
'@/services/TemplateApi'
import
default_img
from
'@/assets/imgs/template_default_img.png'
import
styles
from
'./index.less'
interface
TemplateDetailPropsType
{
location
:
{
query
:
{
id
:
number
;
type
:
string
;
// 商城模板:shopCenter ;店铺模板:shop; 商品描述模板: goods
}
}
}
const
TemplateDetail
:
React
.
FC
<
TemplateDetailPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
type
,
id
}
}
=
props
.
location
const
[
detailInfo
,
setDetailInfo
]
=
useState
<
GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse
>
()
const
[
useModalVisible
,
setUseModalVisible
]
=
useState
<
boolean
>
(
false
)
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
)
useEffect
(()
=>
{
fetchDetail
()
},
[])
const
fetchDetail
=
()
=>
{
const
param
:
any
=
{
id
}
PublicApi
.
getTemplateWebPageTemplateWebFindShopTemplateDetails
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setDetailInfo
(
res
.
data
)
}
})
}
/**
* 使用模板
*/
const
handleConfirmUse
=
()
=>
{
setConfirmLoading
(
true
)
PublicApi
.
postTemplateWebPageTemplateWebUseShopTemplate
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setUseModalVisible
(
false
)
fetchDetail
()
}
setConfirmLoading
(
false
)
}).
catch
(()
=>
{
setConfirmLoading
(
false
)
})
}
const
handleLinkEdit
=
()
=>
{
window
.
location
.
href
=
`/shop/template/edit?id=
${
detailInfo
.
id
}
&template=
${
detailInfo
.
fileName
}
`
// history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
const
handleLinkPreview
=
()
=>
{
window
.
location
.
href
=
`/shop/template/preview?id=
${
detailInfo
.
id
}
&template=
${
detailInfo
.
fileName
}
`
}
return
(
<
DetailPage
title=
"查看模板"
>
<
div
className=
{
styles
.
template_detail
}
>
<
div
className=
{
styles
.
template_info_wrap
}
>
<
div
className=
{
styles
.
template_img_box
}
>
<
div
className=
{
cx
(
styles
.
type_tag
)
}
>
{
Environment_Status
[
detailInfo
?.
environment
]
}
</
div
>
<
img
src=
{
default_img
}
/>
</
div
>
<
div
className=
{
styles
.
template_info
}
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
模板名称:
</
label
>
<
span
>
{
detailInfo
?.
templateName
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
适用环境:
</
label
>
<
span
>
{
Environment_Status
[
detailInfo
?.
environment
]
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
模板描述:
</
label
>
<
span
>
{
detailInfo
?.
templateDescribe
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
使用站点:
</
label
>
<
span
>
{
detailInfo
?.
siteName
}
</
span
>
</
div
>
<
div
className=
{
styles
.
template_info_line
}
>
<
label
>
使用商城:
</
label
>
<
span
>
{
detailInfo
?.
shopName
}
</
span
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
btn
}
onClick=
{
()
=>
handleLinkPreview
()
}
>
<
EyeOutlined
/>
<
label
>
预览
</
label
>
</
div
>
<
div
className=
{
cx
(
styles
.
btn
,
styles
.
fit
)
}
onClick=
{
()
=>
handleLinkEdit
()
}
>
<
LayoutOutlined
/>
<
label
>
店铺装修
</
label
>
</
div
>
<
div
className=
{
cx
(
styles
.
btn
,
detailInfo
?.
use
===
1
?
styles
.
use
:
''
)
}
onClick=
{
()
=>
detailInfo
?.
use
!==
1
?
setUseModalVisible
(
true
)
:
{}
}
>
<
PushpinOutlined
/>
<
label
>
{
detailInfo
?.
use
===
1
?
'使用中'
:
'使用'
}
</
label
>
</
div
>
<
UseModal
title=
"使用店铺模板"
visible=
{
useModalVisible
}
dataInfo=
{
detailInfo
}
confirmLoading=
{
confirmLoading
}
onOk=
{
()
=>
handleConfirmUse
()
}
onCancel=
{
()
=>
setUseModalVisible
(
false
)
}
/>
</
div
>
</
DetailPage
>
)
}
export
default
TemplateDetail
src/store/site/index.ts
View file @
5a3d043c
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
ISiteModule
}
from
'@/module/siteModule'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
PublicApi
}
from
'@/services/api'
class
SiteStore
implements
ISiteModule
{
// 可在根目录下的demo.js修改数据
@
observable
public
siteId
:
number
=
GlobalConfig
.
global
.
siteInfo
.
id
;
// 站点id
@
observable
public
siteUrl
:
string
=
GlobalConfig
.
global
.
siteInfo
.
siteUrl
;
// 站点域名
@
observable
public
mallTemplateId
:
number
=
null
;
// 企业商城模板id
@
observable
public
mallTemplateInfo
:
any
=
{};
// 企业商城模板id
@
observable
public
shopTemplateId
:
number
=
null
;
// 店铺模板id
@
observable
public
channelTemplateId
:
number
=
null
;
// 渠道模板id
@
observable
public
commodityTemplateInfo
:
any
=
{}
/**
* 根据站点查询正在使用的商城模板
*/
@
action
.
bound
public
findUseMallTemplate
=
async
()
=>
{
const
tempMallTemplateInfo
=
sessionStorage
.
getItem
(
"mallTemplateInfo"
)
if
(
tempMallTemplateInfo
)
{
this
.
mallTemplateInfo
=
JSON
.
parse
(
tempMallTemplateInfo
)
this
.
mallTemplateId
=
this
.
mallTemplateInfo
.
id
return
}
const
param
:
any
=
{
siteId
:
this
.
siteId
}
const
res
=
await
PublicApi
.
getTemplatePlatformFindUseTemplateBySite
(
param
)
runInAction
(()
=>
{
this
.
mallTemplateInfo
=
res
.
data
||
{}
this
.
mallTemplateId
=
this
.
mallTemplateInfo
.
id
sessionStorage
.
setItem
(
"mallTemplateInfo"
,
JSON
.
stringify
(
this
.
mallTemplateInfo
))
})
}
/**
* 根据站点查询正在使用的商品描述模板
*/
@
action
.
bound
public
findUseGoodsTemplate
=
async
()
=>
{
const
tempCommodityTemplateInfo
=
sessionStorage
.
getItem
(
"commodityTemplateInfo"
)
if
(
tempCommodityTemplateInfo
)
{
this
.
commodityTemplateInfo
=
JSON
.
parse
(
tempCommodityTemplateInfo
)
return
}
const
param
:
any
=
{
siteId
:
this
.
siteId
}
const
res
=
await
PublicApi
.
getTemplate
GoodsFindUseGoodsTemplate
(
param
)
runInAction
(()
=>
{
if
(
res
.
code
===
1000
)
{
this
.
commodityTemplateInfo
=
res
.
data
sessionStorage
.
setItem
(
"commodityTemplateInfo"
,
JSON
.
stringify
(
this
.
commodityTemplateInfo
))
}
})
}
}
export
default
SiteStore
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
ISiteModule
}
from
'@/module/siteModule'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
PublicApi
}
from
'@/services/api'
class
SiteStore
implements
ISiteModule
{
// 可在根目录下的demo.js修改数据
@
observable
public
siteId
:
number
=
GlobalConfig
.
global
.
siteInfo
.
id
;
// 站点id
@
observable
public
siteUrl
:
string
=
GlobalConfig
.
global
.
siteInfo
.
siteUrl
;
// 站点域名
@
observable
public
mallTemplateId
:
number
=
null
;
// 企业商城模板id
@
observable
public
mallTemplateInfo
:
any
=
{};
// 企业商城模板id
@
observable
public
shopTemplateId
:
number
=
null
;
// 店铺模板id
@
observable
public
channelTemplateId
:
number
=
null
;
// 渠道模板id
@
observable
public
commodityTemplateInfo
:
any
=
{}
/**
* 根据站点查询正在使用的商城模板
*/
@
action
.
bound
public
findUseMallTemplate
=
async
()
=>
{
const
tempMallTemplateInfo
=
sessionStorage
.
getItem
(
"mallTemplateInfo"
)
if
(
tempMallTemplateInfo
)
{
this
.
mallTemplateInfo
=
JSON
.
parse
(
tempMallTemplateInfo
)
this
.
mallTemplateId
=
this
.
mallTemplateInfo
.
id
return
}
const
param
:
any
=
{
siteId
:
this
.
siteId
}
const
res
=
await
PublicApi
.
getTemplatePlatformFindUseTemplateBySite
(
param
)
runInAction
(()
=>
{
this
.
mallTemplateInfo
=
res
.
data
||
{}
this
.
mallTemplateId
=
this
.
mallTemplateInfo
.
id
sessionStorage
.
setItem
(
"mallTemplateInfo"
,
JSON
.
stringify
(
this
.
mallTemplateInfo
))
})
}
/**
* 根据站点查询正在使用的商品描述模板
*/
@
action
.
bound
public
findUseGoodsTemplate
=
async
()
=>
{
const
tempCommodityTemplateInfo
=
sessionStorage
.
getItem
(
"commodityTemplateInfo"
)
if
(
tempCommodityTemplateInfo
)
{
this
.
commodityTemplateInfo
=
JSON
.
parse
(
tempCommodityTemplateInfo
)
return
}
const
param
:
any
=
{
siteId
:
this
.
siteId
}
const
res
=
await
PublicApi
.
getTemplate
WebPageTemplateWebFindGoodsDescribeTemplate
(
param
)
runInAction
(()
=>
{
if
(
res
.
code
===
1000
)
{
this
.
commodityTemplateInfo
=
res
.
data
sessionStorage
.
setItem
(
"commodityTemplateInfo"
,
JSON
.
stringify
(
this
.
commodityTemplateInfo
))
}
})
}
}
export
default
SiteStore
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