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
linweijiong
jinfa-platform
Commits
e9a14ea1
Commit
e9a14ea1
authored
Sep 04, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:商品价格折扣的计算
parent
65fdba3d
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
226 additions
and
127 deletions
+226
-127
app.tsx
src/app.tsx
+2
-0
reset.less
src/global/styles/reset.less
+1
-0
list.tsx
src/pages/lxMall/commodity/list.tsx
+4
-3
index.tsx
src/pages/lxMall/commodityDetail/index.tsx
+26
-6
index.tsx
src/pages/lxMall/components/AboutUs/index.tsx
+1
-1
index.tsx
src/pages/lxMall/components/ShopHeader/index.tsx
+6
-4
LXShopLayout.tsx
src/pages/lxMall/layouts/LXShopLayout.tsx
+25
-4
index.less
src/pages/lxMall/order/address/index.less
+25
-0
index.tsx
src/pages/lxMall/order/address/index.tsx
+49
-51
index.tsx
src/pages/lxMall/order/components/addAddress/index.tsx
+18
-6
index.tsx
src/pages/lxMall/shop/index.tsx
+5
-15
index.tsx
src/pages/lxMall/shopAbout/index.tsx
+19
-36
numberFomat.ts
src/utils/numberFomat.ts
+43
-0
ytt.config.ts
ytt.config.ts
+2
-1
No files found.
src/app.tsx
View file @
e9a14ea1
...
...
@@ -99,6 +99,8 @@ export function render(oldRender: Function) {
}
oldRender
()
}).
catch
(()
=>
{
oldRender
()
})
}
else
{
oldRender
()
...
...
src/global/styles/reset.less
View file @
e9a14ea1
@import './mixins/layout.less';
#root {
// 去除input type为number时的箭头
.ant-input-number-handler-wrap {
display: none;
...
...
src/pages/lxMall/commodity/list.tsx
View file @
e9a14ea1
...
...
@@ -3,6 +3,7 @@ import cx from 'classnames'
import
{
Skeleton
}
from
'antd'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
GetSearchShopEnterpriseGetCommodityListResponseDetail
}
from
'@/services/SearchApi'
import
{
priceFormat
,
numFormat
}
from
'@/utils/numberFomat'
import
creditIcon
from
'@/assets/imgs/credit_icon.png'
import
styles
from
'./list.less'
...
...
@@ -21,7 +22,7 @@ const CommodityList: React.FC<CommodityListPropsType> = (props) => {
return
(
<
div
className=
{
styles
.
goods_price
}
>
<
span
>
¥
</
span
>
<
label
>
{
commodityItem
.
min
}
</
label
>
<
label
>
{
priceFormat
(
commodityItem
.
min
)
}
</
label
>
</
div
>
)
break
...
...
@@ -60,7 +61,7 @@ const CommodityList: React.FC<CommodityListPropsType> = (props) => {
renderPrice
(
item
)
}
<
div
className=
{
styles
.
goods_name
}
>
{
item
.
name
}
</
div
>
<
div
className=
{
styles
.
count
}
>
已售:
{
item
.
sold
||
0
}
</
div
>
<
div
className=
{
styles
.
count
}
>
已售:
{
numFormat
(
item
.
sold
)
||
0
}
</
div
>
<
div
className=
{
styles
.
company_info
}
>
<
div
className=
{
styles
.
goods_name
}
>
{
item
.
memberName
}
</
div
>
<
div
className=
{
styles
.
credit
}
>
...
...
@@ -92,7 +93,7 @@ const CommodityList: React.FC<CommodityListPropsType> = (props) => {
<
div
className=
{
styles
.
info_box_content
}
>
<
div
className=
{
styles
.
name
}
>
{
item
.
name
}
</
div
>
<
div
className=
{
styles
.
price
}
><
span
>
¥
</
span
>
{
item
.
min
}
</
div
>
<
div
className=
{
styles
.
count
}
>
已售:
{
item
.
sold
||
0
}
</
div
>
<
div
className=
{
styles
.
count
}
>
已售:
{
numFormat
(
item
.
sold
)
||
0
}
</
div
>
</
div
>
<
ul
className=
{
styles
.
tags_list
}
>
{
...
...
src/pages/lxMall/commodityDetail/index.tsx
View file @
e9a14ea1
...
...
@@ -13,6 +13,7 @@ import ProductDescription from './components/ProductDescription'
import
InputNumber
from
'@/components/InputNumber'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetSearchShopStoreGetCommodityDetailResponse
}
from
'@/services/SearchApi'
import
{
numFormat
,
priceFormat
}
from
'@/utils/numberFomat'
import
jinhuodanIcon
from
'@/assets/imgs/jinhuodan.png'
import
styles
from
'./index.less'
...
...
@@ -55,7 +56,8 @@ const CommodityDetail = (props) => {
const
[
selectAttrVal
,
setSelectAttrVal
]
=
useState
<
selectAttrValType
[]
>
([])
const
[
commodityImgList
,
setCommodityImgList
]
=
useState
<
imgItemType
[]
>
([])
const
[
commodityPriceInfo
,
setCommodityPriceInfo
]
=
useState
([])
const
[
parameter
,
setParameter
]
=
useState
<
number
>
()
// 权益参数
const
[
selectCommodityId
,
setSelectCommodityId
]
=
useState
<
number
>
()
const
[
buyCount
,
setBuyCount
]
=
useState
<
number
>
(
1
)
useEffect
(()
=>
{
...
...
@@ -67,6 +69,19 @@ const CommodityDetail = (props) => {
if
(
res
.
code
===
1000
)
{
setCommodityDetail
(
res
.
data
)
initAttributeAndValueList
(
res
.
data
?.
unitPriceAndPicList
)
res
.
data
?.
isMemberPrice
&&
getMemberCredit
(
res
.
data
?.
memberId
,
res
.
data
?.
memberRoleId
)
}
})
}
const
getMemberCredit
=
(
memberId
,
memberRoleId
)
=>
{
let
param
=
{
parentMemberId
:
memberId
,
parentMemberRoleId
:
memberRoleId
}
PublicApi
.
getMemberManageUpperCreditParamGet
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setParameter
(
res
.
data
?.
parameter
)
}
})
}
...
...
@@ -88,6 +103,7 @@ const CommodityDetail = (props) => {
}
})
if
(
JSON
.
stringify
(
temp
)
===
JSON
.
stringify
(
selectAttrVal
))
{
setSelectCommodityId
(
item
.
id
)
setCurrentPriceRange
(
item
.
unitPrice
)
}
}
...
...
@@ -231,7 +247,7 @@ const CommodityDetail = (props) => {
}
}
let
amount
=
unitPrice
*
(
Number
(
buyCount
)
||
0
)
return
amount
return
priceFormat
(
amount
)
}
return
(
...
...
@@ -263,15 +279,19 @@ const CommodityDetail = (props) => {
<
div
className=
{
styles
.
prompt_goods_price
}
>
<
div
className=
{
styles
.
prompt_goods_price_item
}
>
<
div
className=
{
cx
(
styles
.
label
,
styles
.
price
)
}
>
价格(CNY)
</
div
>
<
div
className=
{
cx
(
styles
.
label
,
styles
.
mprice
)
}
>
会员价格(CNY)
</
div
>
{
(
commodityDetail
?.
isMemberPrice
&&
parameter
)
&&
<
div
className=
{
cx
(
styles
.
label
,
styles
.
mprice
)
}
>
会员价格(CNY)
</
div
>
}
<
div
className=
{
cx
(
styles
.
label
,
styles
.
count
)
}
>
数量(
{
commodityDetail
?.
unitName
}
)
</
div
>
</
div
>
<
div
className=
{
styles
.
prompt_goods_price_list
}
>
{
commodityPriceInfo
&&
commodityPriceInfo
.
map
((
item
,
index
)
=>
(
<
div
className=
{
cx
(
styles
.
prompt_goods_price_list_item
,
(
commodityPriceInfo
.
length
>
1
&&
Number
(
buyCount
)
>=
item
.
min
&&
Number
(
buyCount
)
<
item
.
max
)
?
styles
.
active
:
""
)
}
key=
{
`prompt_goods_price_list_item_${index}`
}
>
<
div
className=
{
styles
.
price
}
>
{
item
.
price
}
</
div
>
<
div
className=
{
styles
.
member_price
}
>
{
item
.
price
}
</
div
>
<
div
className=
{
styles
.
price
}
>
{
priceFormat
(
item
.
price
)
}
</
div
>
{
(
commodityDetail
?.
isMemberPrice
&&
parameter
)
&&
<
div
className=
{
styles
.
member_price
}
>
{
priceFormat
(
item
.
price
*
parameter
)
}
</
div
>
}
<
div
className=
{
styles
.
count
}
>
{
item
.
range
===
'0-0'
?
'不限'
:
item
.
range
}
</
div
>
</
div
>
))
...
...
@@ -332,7 +352,7 @@ const CommodityDetail = (props) => {
<
div
className=
{
cx
(
styles
.
product_info_line_brief
,
styles
.
row
)
}
>
<
InputNumber
value=
{
buyCount
}
min=
{
commodityDetail
?.
priceType
===
COMMODITY_TYPE
.
prompt
?
commodityDetail
?.
minOrder
:
1
}
max=
{
20000
}
onChange=
{
(
value
)
=>
setBuyCount
(
value
)
}
/>
<
span
className=
{
cx
(
styles
.
text
,
styles
.
mar_left_10
)
}
>
{
commodityDetail
?.
unitName
}
</
span
>
<
span
className=
{
cx
(
styles
.
text
,
styles
.
mar_left_10
)
}
>
(库存
20,000
{
commodityDetail
?.
unitName
}
)
</
span
>
<
span
className=
{
cx
(
styles
.
text
,
styles
.
mar_left_10
)
}
>
(库存
{
numFormat
(
20000
)
}
{
commodityDetail
?.
unitName
}
)
</
span
>
</
div
>
</
div
>
)
...
...
src/pages/lxMall/components/AboutUs/index.tsx
View file @
e9a14ea1
...
...
@@ -52,7 +52,7 @@ const AboutUs: React.FC<AboutUsPropsType> = (props) => {
{
aboutTab
===
TAB_TYPE
.
introduction
?
(
<
div
className=
{
styles
.
channel_info_about_info_body
}
>
<
div
className=
{
styles
.
channel_info_about_info_title
}
>
温州市龙昌皮具有限公司
</
div
>
<
div
className=
{
styles
.
channel_info_about_info_title
}
>
{
shopInfo
?.
company
}
</
div
>
<
p
className=
{
styles
.
channel_info_about_info_brief
}
>
{
shopInfo
?.
describe
}
</
p
>
...
...
src/pages/lxMall/components/ShopHeader/index.tsx
View file @
e9a14ea1
...
...
@@ -7,15 +7,17 @@ import logo from '@/theme/imgs/logo_w.png'
import
shop_icon
from
'@/assets/imgs/shop_icon.png'
import
credit_icon
from
'@/assets/imgs/credit_icon.png'
import
shopLogo
from
'@/assets/imgs/shop_logo.png'
import
{
GetTemplateShopFindShopResponse
}
from
'@/services/TemplateApi'
import
styles
from
'./index.less'
interface
ShopHeaderPropsType
{
shopId
:
number
;
shopUrlParam
:
string
shopUrlParam
:
string
;
shopInfo
:
GetTemplateShopFindShopResponse
}
const
ShopHeader
:
React
.
FC
<
ShopHeaderPropsType
>
=
(
props
)
=>
{
const
{
shopId
,
shopUrlParam
}
=
props
const
{
shopId
,
shopUrlParam
,
shopInfo
}
=
props
const
[
searchValue
,
setSearchValue
]
=
useState
<
string
>
(
""
)
const
{
search
}
=
history
.
location
.
query
...
...
@@ -44,11 +46,11 @@ const ShopHeader: React.FC<ShopHeaderPropsType> = (props) => {
<
div
className=
{
styles
.
shop_header_split
}
></
div
>
<
div
className=
{
styles
.
shop_header_info
}
>
<
div
className=
{
styles
.
shop_header_info_logo
}
>
<
img
src=
{
shop
L
ogo
}
/>
<
img
src=
{
shop
Info
?.
l
ogo
}
/>
</
div
>
<
div
className=
{
styles
.
shop_header_info_content
}
>
<
div
className=
{
styles
.
shop_header_info_content_name
}
>
<
span
>
广州白马灯具有限公司
</
span
>
<
span
>
{
shopInfo
?.
company
}
</
span
>
<
CaretDownOutlined
className=
{
styles
.
shop_header_info_content_icon
}
/>
</
div
>
<
div
className=
{
styles
.
shop_header_info_content_about
}
>
...
...
src/pages/lxMall/layouts/LXShopLayout.tsx
View file @
e9a14ea1
...
...
@@ -10,8 +10,10 @@ import ShopHeader from '../components/ShopHeader'
import
MainNav
from
'../components/MainNav'
import
SideNav
from
'../components/SideNav'
import
Footer
from
'../components/Footer'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetTemplateShopFindShopResponse
}
from
'@/services/TemplateApi'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
styles
from
'./index.less'
import
{
LAYOUT_TYPE
}
from
'@/constants'
;
interface
LXMallLayoutPropsType
{
route
:
ProLayoutProps
[
'route'
]
&
{
...
...
@@ -32,6 +34,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const
{
children
,
location
}
=
props
const
[
templateName
]
=
useState
<
string
>
(
'theme-shop-science'
)
const
{
shopId
}
=
location
.
query
const
[
shopInfo
,
setShopInfo
]
=
useState
<
GetTemplateShopFindShopResponse
>
()
const
[
query
,
setQuery
]
=
useState
<
any
>
({})
useEffect
(()
=>
{
...
...
@@ -42,15 +45,32 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
body
.
className
=
templateName
;
},
[])
useEffect
(()
=>
{
if
(
query
.
memberId
)
{
console
.
log
()
fetchShopInfo
(
query
.
memberId
)
}
},
[
query
])
const
fetchShopInfo
=
(
memberId
)
=>
{
//@ts-ignore
PublicApi
.
getTemplateShopFindShop
({
memberId
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setShopInfo
(
res
.
data
)
}
})
}
const
{
formatMessage
}
=
useIntl
();
const
basicInfo
=
getMenuData
(
props
.
route
.
routes
,
{
locale
:
true
},
formatMessage
)
const
menuData
=
basicInfo
.
menuData
?
basicInfo
.
menuData
.
filter
(
item
=>
!
item
.
redirect
)
:
[]
console
.
log
(
query
.
shopId
,
"query.shopId"
,
shopId
,
"shopId"
)
return
(
<
div
className=
{
styles
.
lxmall_page
}
>
<
TopBar
/>
<
div
className=
{
styles
.
content
}
>
<
ShopHeader
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
/>
<
ShopHeader
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
shopInfo=
{
shopInfo
}
/>
<
MainNav
menuData=
{
menuData
}
pathname=
{
location
.
pathname
}
type=
{
LAYOUT_TYPE
.
shop
}
shopId=
{
query
.
shopId
}
shopUrlParam=
{
shopId
}
/>
{
children
&&
React
.
Children
.
map
(
children
,
(
child
:
any
)
=>
{
...
...
@@ -59,7 +79,8 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
layoutType
:
'shop'
,
shopId
:
query
.
shopId
,
memberId
:
query
.
memberId
,
shopUrlParam
:
shopId
shopUrlParam
:
shopId
,
shopInfo
},
);
})
...
...
src/pages/lxMall/order/address/index.less
View file @
e9a14ea1
...
...
@@ -105,4 +105,28 @@
}
}
}
}
.mallComfirm {
position: relative;
:global {
.ant-modal-confirm-btns {
.ant-btn {
&:hover {
color: var(--mall_main_color);
border-color: var(--mall_main_color);
}
}
.ant-btn-primary {
background-color: var(--mall_main_color);
border-color: var(--mall_main_color);
&:hover {
color: #ffffff;
}
}
}
}
}
\ No newline at end of file
src/pages/lxMall/order/address/index.tsx
View file @
e9a14ea1
import
React
,
{
useState
,
useEffect
}
from
'react'
import
{
Radio
}
from
'antd'
import
{
Radio
,
Modal
}
from
'antd'
import
{
DownOutlined
}
from
'@ant-design/icons'
import
AddAddress
from
'../components/addAddress'
import
{
PublicApi
}
from
'@/services/api'
...
...
@@ -11,51 +11,8 @@ const Address: React.FC = () => {
const
[
expand
,
setExpand
]
=
useState
<
boolean
>
(
false
)
const
[
addressFormVisible
,
setAddressFormVisible
]
=
useState
<
boolean
>
(
false
)
const
[
addressList
,
setAddressList
]
=
useState
<
GetLogisticsReceiverAddressPageResponseDetail
[]
>
([])
const
mock_data
=
[
{
id
:
1
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
1
,
},
{
id
:
2
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
0
,
},
{
id
:
3
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
0
,
},
{
id
:
4
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
0
,
},
{
id
:
5
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
0
,
},
{
id
:
6
,
name
:
'蒯美政'
,
address
:
'广东省广州市海珠区新港东路1068号中洲中心北塔6楼'
,
mobile
:
'185 2929 6758'
,
isDefault
:
0
,
}
]
const
[
editItem
,
setEditItem
]
=
useState
<
GetLogisticsReceiverAddressPageResponseDetail
>
()
const
[
type
,
setType
]
=
useState
<
'add'
|
'edit'
>
(
'add'
)
useEffect
(()
=>
{
fetchAddressList
()
...
...
@@ -78,11 +35,43 @@ const Address: React.FC = () => {
setSelectKey
(
e
.
target
.
value
)
}
/**
* 删除收货地址
*/
const
handleDelteAddress
=
(
id
:
number
)
=>
{
Modal
.
confirm
({
className
:
styles
.
mallComfirm
,
content
:
"是否确认删除该收货地址"
,
onOk
:
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
postLogisticsReceiverAddressDelete
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
()
fetchAddressList
()
}
}).
catch
(()
=>
{
reject
()
})
})
}
})
}
useEffect
(()
=>
{
if
(
!!
editItem
)
{
}
},
[
editItem
])
return
(
<
div
className=
{
styles
.
address
}
>
<
div
className=
{
styles
.
common_title
}
>
<
span
>
收货地址
</
span
>
<
div
className=
{
styles
.
common_title_btn
}
onClick=
{
()
=>
setAddressFormVisible
(
true
)
}
>
新增收货地址
</
div
>
<
div
className=
{
styles
.
common_title_btn
}
onClick=
{
()
=>
{
setAddressFormVisible
(
true
)
setType
(
'add'
)
}
}
>
新增收货地址
</
div
>
</
div
>
<
Radio
.
Group
className=
{
styles
.
address_raido_group
}
value=
{
selectKey
}
onChange=
{
handleSelect
}
>
<
div
className=
{
styles
.
address_list
}
>
...
...
@@ -100,8 +89,12 @@ const Address: React.FC = () => {
{
selectKey
===
item
.
id
&&
(
<
div
className=
{
styles
.
address_item_btn_group
}
>
<
div
className=
{
styles
.
address_item_btn
}
>
编辑
</
div
>
<
div
className=
{
styles
.
address_item_btn
}
>
删除
</
div
>
<
div
className=
{
styles
.
address_item_btn
}
onClick=
{
()
=>
{
setEditItem
(
item
)
setType
(
'edit'
)
setAddressFormVisible
(
true
)
}
}
>
编辑
</
div
>
<
div
className=
{
styles
.
address_item_btn
}
onClick=
{
()
=>
handleDelteAddress
(
item
.
id
)
}
>
删除
</
div
>
</
div
>
)
}
...
...
@@ -122,12 +115,17 @@ const Address: React.FC = () => {
)
}
<
AddAddress
title=
"新增收货地址"
title=
{
type
===
'add'
?
"新增收货地址"
:
"编辑收货地址"
}
type=
{
type
}
editItem=
{
editItem
}
visible=
{
addressFormVisible
}
onCancel=
{
()
=>
setAddressFormVisible
(
false
)
}
onCancel=
{
()
=>
{
setAddressFormVisible
(
false
)
}
}
onOk=
{
()
=>
{
setAddressFormVisible
(
false
)
fetchAddressList
()
setEditItem
(
null
)
}
}
/>
</
div
>
...
...
src/pages/lxMall/order/components/addAddress/index.tsx
View file @
e9a14ea1
...
...
@@ -10,7 +10,7 @@ import {
import
{
Input
,
Switch
,
Select
,
FormMegaLayout
}
from
'@formily/antd-components'
import
{
PublicApi
}
from
'@/services/api'
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
import
{
GetLogisticsReceiverAddressPageResponseDetail
}
from
'@/services/LogisticsApi'
import
ChinaImg
from
'../../../../../../mockStatic/china.png'
import
japenImg
from
'../../../../../../mockStatic/japen.png'
import
korenImg
from
'../../../../../../mockStatic/koren.png'
...
...
@@ -37,14 +37,17 @@ interface AddAddressPropsType {
onOk
?:
any
;
onCancel
?:
any
;
title
?:
string
;
editItem
?:
GetLogisticsReceiverAddressPageResponseDetail
;
type
:
'add'
|
'edit'
}
const
{
Option
}
=
ISelect
;
const
actions
=
createFormActions
()
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
AddAddress
:
React
.
FC
<
AddAddressPropsType
>
=
(
props
)
=>
{
const
{
visible
=
false
,
title
,
onOk
,
onCancel
}
=
props
const
actions
=
createFormActions
()
const
{
visible
=
false
,
title
,
onOk
,
onCancel
,
editItem
,
type
}
=
props
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
<
boolean
>
(
false
)
const
[
Options
,
setOptions
]
=
useState
([])
const
[
state
,
setState
]
=
useState
({
editable
:
true
})
...
...
@@ -55,6 +58,16 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
const
[
provinceList
,
setProvinceList
]
=
useState
([])
const
[
cityList
,
setCityList
]
=
useState
([])
useEffect
(()
=>
{
if
(
type
===
'edit'
&&
!!
editItem
)
{
// actions.setFieldValue('receiverName', editItem.receiverName)
// actions.setFieldValue('address', editItem.fullAddress)
// actions.setFieldValue('postalCode', editItem.postalCode)
// actions.setFieldValue('receiverName', editItem.receiverName)
// actions.setFieldValue('phone' editItem.phone)
}
},
[
editItem
,
type
])
const
selectList
:
any
=
[
{
label
:
<><
img
src=
{
ChinaImg
}
key=
'1'
style=
{
{
width
:
_width
,
height
:
_height
}
}
/>
+86
</>,
value
:
'1'
},
{
label
:
<><
img
src=
{
japenImg
}
key=
'3'
style=
{
{
width
:
_width
,
height
:
_height
}
}
/>
+86
</>,
value
:
'3'
},
...
...
@@ -97,8 +110,6 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
* @return:
*/
const
formSubmit
=
(
values
)
=>
{
let
id
=
0
//0新建
let
type
=
2
//'1' 发货 '2'收货
let
value
=
{
...
values
}
value
.
isDefault
=
values
.
isDefault
?
1
:
0
value
.
provinceCode
=
value
.
provinceCode
.
split
(
'-'
).
length
>
1
?
value
.
provinceCode
.
split
(
'-'
)[
0
]
:
value
.
provinceCode
...
...
@@ -183,7 +194,8 @@ const AddAddress: React.FC<AddAddressPropsType> = (props) => {
onCancel=
{
onCancel
}
maskClosable=
{
false
}
>
<
SchemaForm
editable=
{
state
.
editable
}
<
SchemaForm
// editable={state.editable}
actions=
{
actions
}
// 要传递
components=
{
{
Input
,
Select
,
TextArea
:
Input
.
TextArea
,
Switch
...
...
src/pages/lxMall/shop/index.tsx
View file @
e9a14ea1
...
...
@@ -8,8 +8,7 @@ import AboutUs from '../components/AboutUs'
import
{
inject
,
observer
}
from
'mobx-react'
import
{
PublicApi
}
from
'@/services/api'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
GetTemplatePlatformFindAllFirstCategoryResponse
}
from
'@/services'
import
{
GetTemplateShopFindShopResponse
}
from
'@/services/TemplateApi'
import
{
GetTemplateShopFindShopResponse
,
GetTemplatePlatformFindAllFirstCategoryResponse
}
from
'@/services/TemplateApi'
import
styles
from
'./index.less'
interface
ChannelIndexPropsType
{
...
...
@@ -17,34 +16,25 @@ interface ChannelIndexPropsType {
location
:
any
memberId
:
number
;
shopId
:
number
;
shopUrlParam
:
string
shopUrlParam
:
string
;
shopInfo
:
GetTemplateShopFindShopResponse
}
const
ShopIndex
:
React
.
FC
<
ChannelIndexPropsType
>
=
(
props
)
=>
{
const
{
shopTemplateId
}
=
props
.
SiteStore
const
{
shopId
,
memberId
,
shopUrlParam
}
=
props
const
{
shopId
,
memberId
,
shopUrlParam
,
shopInfo
}
=
props
const
[
categoryList
,
setCategoryList
]
=
useState
<
GetTemplatePlatformFindAllFirstCategoryResponse
>
([])
const
[
firstAdvertList
,
setFirstAdvertList
]
=
useState
([])
const
[
secondAdvertList
,
setSecondAdvertList
]
=
useState
([])
const
[
shopInfo
,
setShopInfo
]
=
useState
<
GetTemplateShopFindShopResponse
>
()
//
const [shopInfo, setShopInfo] = useState<GetTemplateShopFindShopResponse>()
const
[
categoryComponents
,
setCategoryComponents
]
=
useState
<
React
.
ReactNode
>
()
useEffect
(()
=>
{
fetchShopInfo
()
getCategoryComponents
()
findFirstAdvertsByType
()
findSecondAdvertsByType
()
},
[])
const
fetchShopInfo
=
()
=>
{
//@ts-ignore
PublicApi
.
getTemplateShopFindShop
({
memberId
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setShopInfo
(
res
.
data
)
}
})
}
const
findFirstAdvertsByType
=
()
=>
{
let
params
=
{
templateId
:
shopTemplateId
,
...
...
src/pages/lxMall/shopAbout/index.tsx
View file @
e9a14ea1
...
...
@@ -5,30 +5,15 @@ import cx from 'classnames'
import
shop_icon
from
'@/assets/imgs/shop_icon.png'
import
credit_icon
from
'@/assets/imgs/credit_icon.png'
import
companyImg
from
'@/assets/imgs/company_img.png'
import
{
GetTemplateShopFindShopResponse
}
from
'@/services/TemplateApi'
import
styles
from
'./index.less'
const
imgList
=
[
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg"
},
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-5.jpg"
},
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-3.jpg"
},
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-2.jpg"
},
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg"
},
{
url
:
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg"
}
]
interface
ShopAboutPropType
{
shopInfo
:
GetTemplateShopFindShopResponse
}
const
ShopAbout
:
React
.
FC
=
()
=>
{
const
ShopAbout
:
React
.
FC
<
ShopAboutPropType
>
=
(
props
)
=>
{
const
{
shopInfo
}
=
props
const
[
offSetLeft
,
setOffSetLeft
]
=
useState
<
number
>
(
0
)
const
unitDistance
=
406
...
...
@@ -39,7 +24,7 @@ const ShopAbout: React.FC = () => {
}
const
handleNext
=
()
=>
{
let
imgLength
=
imgList
.
length
let
imgLength
=
shopInfo
?.
honorPics
.
length
let
maxDistance
=
(
imgLength
-
3
)
*
unitDistance
if
(
maxDistance
>
Math
.
abs
(
offSetLeft
))
{
...
...
@@ -51,7 +36,7 @@ const ShopAbout: React.FC = () => {
<
div
className=
{
styles
.
shop_about_container
}
>
<
div
className=
{
styles
.
shop_about_info
}
>
<
div
className=
{
styles
.
shop_about_info_item
}
>
<
div
className=
{
styles
.
shop_about_info_title
}
>
广州白马灯具有限公司
</
div
>
<
div
className=
{
styles
.
shop_about_info_title
}
>
{
shopInfo
?.
company
}
</
div
>
<
div
className=
{
styles
.
shop_about_info_title_about
}
>
<
div
className=
{
styles
.
shop_about_info_title_about_item
}
>
<
i
className=
{
styles
.
icon
}
><
img
src=
{
shop_icon
}
/></
i
>
...
...
@@ -77,7 +62,7 @@ const ShopAbout: React.FC = () => {
</
div
>
<
div
className=
{
cx
(
styles
.
shop_about_info_item
,
styles
.
auto_width
)
}
>
<
i
className=
{
styles
.
shop_about_info_item_character
}
>
“
</
i
>
<
p
>
经营全粒面牛皮,修面皮,漆色皮,打腊皮,水腊皮,疯马皮,珠光变色,大小荔枝纹,打腊水腊皮生产销售
</
p
>
<
p
>
{
shopInfo
?.
describe
}
</
p
>
</
div
>
</
div
>
{
/* <div className={styles.channel_info_about}>
...
...
@@ -156,9 +141,9 @@ const ShopAbout: React.FC = () => {
<
div
className=
{
styles
.
exhibition_list_contaner
}
>
<
div
className=
{
styles
.
exhibition_list
}
style=
{
{
left
:
offSetLeft
}
}
>
{
imgList
.
map
((
item
,
index
)
=>
(
<
div
key=
{
index
}
className=
{
cx
(
styles
.
exhibition_list_item
)
}
>
<
img
src=
{
item
.
url
}
/>
shopInfo
?.
honorPics
&&
shopInfo
?.
honorPics
.
map
((
url
,
index
)
=>
(
<
div
key=
{
`exhibition_list_item_${index}`
}
className=
{
cx
(
styles
.
exhibition_list_item
)
}
>
<
img
src=
{
url
}
/>
</
div
>
))
}
...
...
@@ -172,17 +157,15 @@ const ShopAbout: React.FC = () => {
<
div
className=
{
styles
.
shop_about_split_line
}
></
div
>
</
div
>
<
div
className=
{
styles
.
shop_workshopimg_list
}
>
<
div
className=
{
styles
.
shop_workshopimg_list_item
}
>
<
img
src=
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg"
/>
</
div
>
<
div
className=
{
styles
.
shop_workshopimg_list_item
}
>
<
img
src=
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg"
/>
</
div
>
{
shopInfo
?.
workshopPics
&&
shopInfo
?.
workshopPics
.
map
((
url
,
index
)
=>
(
<
div
key=
{
`shop_workshopimg_list_item_${index}`
}
className=
{
styles
.
shop_workshopimg_list_item
}
>
<
img
src=
{
url
}
/>
</
div
>
))
}
</
div
>
</
div
>
</
div
>
)
}
...
...
src/utils/numberFomat.ts
0 → 100644
View file @
e9a14ea1
export
const
numFormat
=
(
num
:
number
)
=>
{
if
(
num
)
{
let
result
=
String
(
num
)
return
result
.
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
','
)
}
else
{
return
0
}
}
/**
* 价格格式化
* 参数说明:
* number:要格式化的数字
* decimals:保留几位小数
* dec_point:小数点符号
* thousands_sep:千分位符号
*/
export
const
priceFormat
=
(
number
,
decimals
=
2
,
dec_point
=
'.'
,
thousands_sep
=
','
)
=>
{
number
=
(
number
+
''
).
replace
(
/
[^
0-9+-Ee.
]
/g
,
''
);
let
s
:
string
[]
=
[]
let
n
=
!
isFinite
(
+
number
)
?
0
:
+
number
,
prec
=
!
isFinite
(
+
decimals
)
?
0
:
Math
.
abs
(
decimals
),
sep
=
(
typeof
thousands_sep
===
'undefined'
)
?
','
:
thousands_sep
,
dec
=
(
typeof
dec_point
===
'undefined'
)
?
'.'
:
dec_point
,
toFixedFix
=
function
(
n
,
prec
)
{
var
k
=
Math
.
pow
(
10
,
prec
);
return
''
+
Math
.
ceil
(
n
*
k
)
/
k
;
};
s
=
(
prec
?
toFixedFix
(
n
,
prec
)
:
''
+
Math
.
round
(
n
)).
split
(
'.'
);
let
re
=
/
(
-
?\d
+
)(\d{3})
/
;
while
(
re
.
test
(
s
[
0
]))
{
s
[
0
]
=
s
[
0
].
replace
(
re
,
"$1"
+
sep
+
"$2"
);
}
if
((
s
[
1
]
||
''
).
length
<
prec
)
{
s
[
1
]
=
s
[
1
]
||
''
;
s
[
1
]
+=
new
Array
(
prec
-
s
[
1
].
length
+
1
).
join
(
'0'
);
}
return
s
.
join
(
dec
);
}
\ No newline at end of file
ytt.config.ts
View file @
e9a14ea1
...
...
@@ -2,12 +2,13 @@ const tokenList = [
{
name
:
'Pass'
,
token
:
'b063a0a29fb1a570d9f00eaabbdd8ccfe8e6e10e24739441990cc1098e79b601'
},
// 业务中台管理平台
{
name
:
'Warehouse'
,
token
:
'7c8f235d95f6224ceb97c4d832b09658f9a75fb8721a95699b230af0733d7fa4'
},
// 仓库服务
{
name
:
'Logistics'
,
token
:
'8d14d945507d1f8cd89afe139ca6d111bbad25f702fafe0aec59d3c9cd2e0ffe'
},
// 物流服务
{
name
:
'Member'
,
token
:
'
3a46198c5b97ac7147e5b07ad2dff5ac5c93c1afed47e1911961db87149e6ebf
'
},
// 商户会员管理服务
{
name
:
'Member'
,
token
:
'
c0e920f071595a73ba234b6fa6cfe42192d3d740d59f030caa2c7f0f08777d78
'
},
// 商户会员管理服务
{
name
:
'Product'
,
token
:
'efe99e20ed1375dc0db3e809e4fc7692f42ecebaf60cd77e65c50ed65d6ba6c4'
},
// 商品服务
{
name
:
'Template'
,
token
:
'7ec923520215c7e2f771867cb4d29cafbf823daf0fb2d3d9fa70b57a523c8bfb'
},
// 店铺模板服务
{
name
:
'Pay'
,
token
:
'c789e0e56ee8a8cc2fbd85f930eb2928c58fc1014583c6643acf29cff954da49'
},
// 支付服务
{
name
:
'Search'
,
token
:
'ca19f532efba91f7773cbfbd526b798c6ac83df670071e97d72c50dca1d53a48'
},
// 搜索服务
{
name
:
'Order'
,
token
:
'5de0aaeaac12c8d911d86dada6cd128993e34cd6e13135fa79246aa5979a2bcd'
},
//订单服务
// { name: '', token: 'c0e920f071595a73ba234b6fa6cfe42192d3d740d59f030caa2c7f0f08777d78' } // 商户会员管理服务
]
const
getConfigMap
=
(
tokens
)
=>
tokens
.
map
(
v
=>
({
...
...
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