Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
web-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
web-ci-test
Commits
822ac16e
提交
822ac16e
authored
6月 12, 2023
作者:
曹云
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添-产品商城-提交意向后确认订单
改-作业服务-详情-立即预约弹框-选择地点:显示地址为详细地址,添加修改位置按钮 删-作业服务-详情-立即预约弹框-详细地址
上级
d9226c99
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
742 行增加
和
141 行删除
+742
-141
[id].page.tsx
pages/equipmentLeasing/detail/[id].page.tsx
+3
-3
index.tsx
...quipmentLeasing/detail/components/orderForGoods/index.tsx
+10
-5
[id].page.tsx
pages/jobServices/detail/[id].page.tsx
+13
-56
index.tsx
pages/jobServices/detail/components/map/index.tsx
+16
-3
styled.tsx
pages/jobServices/detail/styled.tsx
+9
-0
[id].page.tsx
pages/mall/detail/[id].page.tsx
+0
-0
index.ts
pages/mall/detail/components/intentionModal/api/index.ts
+10
-11
index.module.scss
...s/mall/detail/components/intentionModal/index.module.scss
+18
-1
index.tsx
pages/mall/detail/components/intentionModal/index.tsx
+101
-62
index.tsx
pages/mall/detail/components/orderForGoods/api/index.tsx
+49
-0
index.tsx
pages/mall/detail/components/orderForGoods/index.tsx
+238
-0
styled.tsx
pages/mall/detail/components/orderForGoods/styled.tsx
+275
-0
没有找到文件。
pages/equipmentLeasing/detail/[id].page.tsx
浏览文件 @
822ac16e
...
...
@@ -64,8 +64,8 @@ export default function EquipmentLeasingDetail() {
(
item
)
=>
item
.
productSpecList
)
if
(
wareList
)
{
const
wareSku
List
:
GetWebDeviceWareSkuById
[]
=
wareList
.
flat
()
setWareSkuList
(
wareSku
List
)
const
List
:
GetWebDeviceWareSkuById
[]
=
wareList
.
flat
()
setWareSkuList
(
List
)
}
})
}
...
...
@@ -391,7 +391,7 @@ export default function EquipmentLeasingDetail() {
</
div
>
<
div
className=
"num-right"
>
<
Form
.
Item
style=
{
{
flex
:
1
,
marginRight
:
16
}
}
name=
"num"
>
<
InputNumber
min=
{
1
}
max=
{
10
}
onChange=
{
onChangeNum
}
/>
<
InputNumber
min=
{
1
}
max=
{
10
0
}
onChange=
{
onChangeNum
}
/>
</
Form
.
Item
>
</
div
>
</
div
>
...
...
pages/equipmentLeasing/detail/components/orderForGoods/index.tsx
浏览文件 @
822ac16e
...
...
@@ -125,7 +125,6 @@ export default function OrderForGoods(props: PropsBox) {
const
handleOkPayment
=
()
=>
{
setLoading
(
true
)
if
(
paymentDetail
?.
orderNo
)
{
const
date
=
new
FormData
()
api
.
OrderPayment
({
orderNo
:
paymentDetail
?.
orderNo
}).
then
((
res
)
=>
{
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'付款成功'
)
...
...
@@ -208,7 +207,7 @@ export default function OrderForGoods(props: PropsBox) {
<
div
className=
"image"
>
<
Image
preview=
{
{
visible
:
false
}
}
src=
{
wareSkuList
!
[
0
].
specImage
}
src=
{
(
wareSkuList
&&
wareSkuList
!
[
0
].
specImage
)
||
''
}
onClick=
{
()
=>
setVisible
(
true
)
}
/>
<
div
style=
{
{
display
:
'none'
}
}
>
...
...
@@ -218,13 +217,19 @@ export default function OrderForGoods(props: PropsBox) {
onVisibleChange
:
(
vis
)
=>
setVisible
(
vis
),
}
}
>
<
Image
src=
{
wareSkuList
!
[
0
].
specImage
}
/>
<
Image
src=
{
(
wareSkuList
&&
wareSkuList
!
[
0
].
specImage
)
||
''
}
/>
</
Image
.
PreviewGroup
>
</
div
>
</
div
>
<
div
className=
"right"
>
<
div
className=
"top"
>
{
wareSkuList
!
[
0
].
specName
}
</
div
>
<
div
className=
"bottom"
>
{
wareSkuList
!
[
0
].
versionDesc
}
</
div
>
<
div
className=
"top"
>
{
(
wareSkuList
&&
wareSkuList
!
[
0
].
specName
)
||
''
}
</
div
>
<
div
className=
"bottom"
>
{
(
wareSkuList
&&
wareSkuList
!
[
0
].
versionDesc
)
||
''
}
</
div
>
</
div
>
</
div
>
<
div
className=
"body-item"
style=
{
{
width
:
130
}
}
>
...
...
pages/jobServices/detail/[id].page.tsx
浏览文件 @
822ac16e
...
...
@@ -78,7 +78,6 @@ export default function JobServicesDetail() {
const
[
formDate
]
=
Form
.
useForm
()
const
[
isModalOpen
,
setIsModalOpen
]
=
useState
(
false
)
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
areaValue
,
setAreaValue
]
=
useState
<
string
>
()
const
[
provinceList
,
setProvinceList
]
=
useState
<
RegionResp
[]
>
([])
const
[
isAddressMapShow
,
setIsAddressMapShow
]
=
useState
(
false
)
const
[
addressContent
,
setAddressContent
]
=
useState
<
any
>
()
...
...
@@ -109,7 +108,8 @@ export default function JobServicesDetail() {
return
message
.
warning
(
'请选择地点'
)
}
const
res
=
await
api
.
insertOrderTask
({
address
:
values
.
address
,
address
:
addressContent
.
addressDteail
,
taskDescription
:
values
.
taskDescription
,
city
:
addressContent
.
city
,
inspectionId
:
detail
?.
id
||
1
,
lat
:
addressContent
.
lat
,
...
...
@@ -144,6 +144,7 @@ export default function JobServicesDetail() {
})
}
const
handleCancel
=
()
=>
{
setAddressContent
(
undefined
)
setIsModalOpen
(
false
)
formDate
.
resetFields
()
}
...
...
@@ -256,42 +257,6 @@ export default function JobServicesDetail() {
showTime
/>
</
Form
.
Item
>
{
/* <Form.Item
label="经度"
style={{ flex: 1, marginRight: 16 }}
name="lon"
rules={[{ required: true, message: '请输入经度' }]}
>
<Input placeholder="请输入经度" />
</Form.Item>
<Form.Item
label="纬度"
style={{ flex: 1, marginRight: 16 }}
name="lat"
rules={[{ required: true, message: '请输入纬度' }]}
>
<Input placeholder="请输入纬度" />
</Form.Item>
<Form.Item
label="选择省市"
style={{ flex: 1, marginRight: 16 }}
name="province"
rules={[{ required: true, message: '请选择省市' }]}
>
<Cascader
allowClear
placeholder="选择省市"
className="selectItem"
size="large"
fieldNames={{
label: 'name',
value: 'name',
children: 'childInfo',
}}
options={provinceList}
changeOnSelect
/>
</Form.Item> */
}
<
Form
.
Item
label=
"选择地点"
style=
{
{
flex
:
1
,
marginRight
:
16
}
}
...
...
@@ -299,8 +264,16 @@ export default function JobServicesDetail() {
rules=
{
[{
required
:
true
,
message
:
'请选择地点'
}]
}
>
{
addressContent
?
(
<
div
>
已选择:
{
addressContent
.
province
+
addressContent
.
city
}
<
div
className=
"address-map"
>
<
div
className=
"value"
>
已选择:
{
addressContent
.
addressDteail
}
</
div
>
<
Button
onClick=
{
()
=>
setIsAddressMapShow
(
true
)
}
type=
"primary"
>
修改位置
</
Button
>
</
div
>
)
:
(
<
Button
onClick=
{
()
=>
setIsAddressMapShow
(
true
)
}
type=
"text"
>
...
...
@@ -308,20 +281,6 @@ export default function JobServicesDetail() {
</
Button
>
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"详细地址"
style=
{
{
flex
:
1
,
marginRight
:
16
}
}
name=
"address"
rules=
{
[{
required
:
true
,
message
:
'请输入详情地址'
}]
}
>
<
TextArea
value=
{
areaValue
}
onChange=
{
(
e
)
=>
setAreaValue
(
e
.
target
.
value
)
}
placeholder=
"请输入详情地址"
autoSize=
{
{
minRows
:
3
,
maxRows
:
5
}
}
style=
{
{
width
:
385
,
height
:
72
}
}
/>
</
Form
.
Item
>
<
div
>
任务描述(选填) 项目号、 业务负责人、
客户名称、演示设备(注明飞机、挂载、地面站)、现场联系人及电话
...
...
@@ -331,8 +290,6 @@ export default function JobServicesDetail() {
name=
"taskDescription"
>
<
TextArea
value=
{
areaValue
}
onChange=
{
(
e
)
=>
setAreaValue
(
e
.
target
.
value
)
}
placeholder=
"补充描述有助于方案沟通更高效哦~"
autoSize=
{
{
minRows
:
3
,
maxRows
:
5
}
}
style=
{
{
width
:
385
,
height
:
72
}
}
...
...
pages/jobServices/detail/components/map/index.tsx
浏览文件 @
822ac16e
...
...
@@ -109,16 +109,29 @@ export default function MapComponent(props: BoxProps) {
geocoder
.
getAddress
(
lnglat
,
function
(
status
:
any
,
result
:
any
)
{
if
(
status
===
'complete'
&&
result
.
regeocode
)
{
const
address
=
result
.
regeocode
.
addressComponent
console
.
log
(
address
.
province
)
console
.
log
(
address
.
city
)
const
addressDteail
=
address
.
province
+
address
.
city
+
address
.
district
+
address
.
township
+
address
.
street
+
address
.
streetNumber
setAddressContent
({
province
:
address
.
province
,
city
:
address
.
city
,
lon
:
lnglat
.
lng
,
lat
:
lnglat
.
lat
,
addressDteail
,
})
setIsAddressMapShow
(
false
)
// console.log(address.province + address.city + address.district) // 打印省市区信息
// console.log(
// address.province +
// address.city +
// address.district +
// address.township +
// address.street +
// address.streetNumber
// ) // 打印省市区信息
}
})
// MAP.off('click', mapGet); // 移除click事件
...
...
pages/jobServices/detail/styled.tsx
浏览文件 @
822ac16e
...
...
@@ -129,4 +129,13 @@ export const Box = styled.div`
}
}
}
.form-data {
.address-map {
display: flex;
align-items: center;
.value {
margin-right: 20px;
}
}
}
`
pages/mall/detail/[id].page.tsx
浏览文件 @
822ac16e
差异被折叠。
点击展开。
pages/mall/detail/components/intentionModal/api/index.ts
浏览文件 @
822ac16e
import
request
from
"~/api/request"
import
request
from
'~/api/request'
interface
CommitMallOrderParams
{
buyNum
:
number
;
directoryId
:
number
;
goodsInfoId
:
number
;
mallSpecIds
:
any
[]
;
remark
?:
string
;
userAddressId
:
number
;
buyNum
:
number
directoryId
:
number
goodsInfoId
:
number
mallSpecIds
:
any
[]
remark
?:
string
userAddressId
:
number
}
export
default
{
//提交订单V1.0.0
commitMallOrder
(
params
:
CommitMallOrderParams
)
{
return
request
(
"/oms/app-order/commitMallOrder"
,
'post'
,
params
);
}
}
\ No newline at end of file
return
request
(
'/oms/app-order/confirmMallOrder'
,
'post'
,
params
)
},
}
pages/mall/detail/components/intentionModal/index.module.scss
浏览文件 @
822ac16e
...
...
@@ -59,6 +59,23 @@
padding
:
0
39px
0
38px
;
height
:
364px
;
overflow-y
:
auto
;
.numBox
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin-top
:
10px
;
.numLeft
{
display
:
flex
;
align-items
:
center
;
.label
{
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#121212
;
margin-right
:
5px
;
}
}
}
@include
scrollbar
();
}
pages/mall/detail/components/intentionModal/index.tsx
浏览文件 @
822ac16e
import
{
Button
,
Col
,
Image
,
message
,
Modal
,
Row
,
Space
}
from
"antd"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
errImg
from
"~/assets/errImg"
;
import
{
GetLeaseGoodsDetailResp
,
ProductSpecList
}
from
"../../api"
;
import
styles
from
"./index.module.scss"
;
import
api
from
"./api"
;
import
Item
from
"antd/es/list/Item"
;
import
{
Button
,
Col
,
Image
,
message
,
Modal
,
Row
,
Space
,
InputNumber
,
}
from
'antd'
import
{
Dispatch
,
SetStateAction
,
useEffect
,
useState
}
from
'react'
import
errImg
from
'~/assets/errImg'
import
{
GetLeaseGoodsDetailResp
,
ProductSpecList
}
from
'../../api'
import
styles
from
'./index.module.scss'
import
api
from
'./api'
import
Item
from
'antd/es/list/Item'
type
Props
=
{
open
?:
boolean
;
onOk
?:
()
=>
void
;
onCancel
:
()
=>
void
;
detail
:
GetLeaseGoodsDetailResp
|
null
;
};
open
?:
boolean
onOk
?:
()
=>
void
onCancel
:
()
=>
void
detail
:
GetLeaseGoodsDetailResp
|
null
setIsorderForGoods
:
Dispatch
<
SetStateAction
<
boolean
>>
setMallDetail
:
Dispatch
<
SetStateAction
<
any
>>
}
export
default
function
IntentionModal
(
props
:
Props
)
{
const
[
checkedMap
,
setCheckedMap
]
=
useState
<
{
string
?:
boolean
}
>
({});
//通过索引记录选中的产品规格 例: {'1,1': true|false} props.detail?.goodsSpec[1].productSpecList[1]
const
[
checkItems
,
setCheckItems
]
=
useState
<
ProductSpecList
[]
>
([]);
//选中的规格
const
[
loading
,
setLoading
]
=
useState
(
false
);
//下单中
const
[
checkedMap
,
setCheckedMap
]
=
useState
<
{
string
?:
boolean
}
>
({})
//通过索引记录选中的产品规格 例: {'1,1': true|false} props.detail?.goodsSpec[1].productSpecList[1]
const
[
checkItems
,
setCheckItems
]
=
useState
<
ProductSpecList
[]
>
([])
//选中的规格
const
[
loading
,
setLoading
]
=
useState
(
false
)
//下单中
const
[
numValue
,
setNumValue
]
=
useState
<
number
|
null
>
(
1
)
//数量
useEffect
(()
=>
{
let
list
:
ProductSpecList
[]
=
[]
;
let
list
:
ProductSpecList
[]
=
[]
Object
.
keys
(
checkedMap
).
forEach
((
key
)
=>
{
if
(
checkedMap
[
key
as
keyof
typeof
checkedMap
])
{
let
arr
=
key
.
split
(
","
);
let
arr
=
key
.
split
(
','
)
let
item
=
props
.
detail
?.
goodsSpec
[
Number
(
arr
[
0
])].
productSpecList
[
Number
(
arr
[
1
])
]
;
]
if
(
item
)
{
list
.
push
(
item
)
;
list
.
push
(
item
)
}
}
});
setCheckItems
(
list
);
},
[
checkedMap
]);
})
setCheckItems
(
list
)
setNumValue
(
1
)
},
[
checkedMap
])
//添加规格到购物车
function
addProductSpec
(
goodsSpecIndex
:
number
,
productSpecIndex
:
number
)
{
let
temp
=
{}
;
let
temp
=
{}
//@ts-ignore
temp
[
`
${
goodsSpecIndex
}
,
${
productSpecIndex
}
`
]
=
//@ts-ignore
!
checkedMap
[
`
${
goodsSpecIndex
}
,
${
productSpecIndex
}
`
]
;
!
checkedMap
[
`
${
goodsSpecIndex
}
,
${
productSpecIndex
}
`
]
setCheckedMap
({
...
checkedMap
,
...
temp
,
});
})
}
//数量
const
onChangeNum
=
(
value
:
number
|
null
)
=>
{
console
.
log
(
'changed'
,
value
)
setNumValue
(
value
)
}
//提交
function
onSubmit
()
{
let
buyNum
=
0
;
let
mallSpecIds
:
number
[]
=
[]
;
let
buyNum
=
0
let
mallSpecIds
:
number
[]
=
[]
Object
.
keys
(
checkedMap
).
forEach
((
key
)
=>
{
if
(
checkedMap
[
key
as
keyof
typeof
checkedMap
])
{
buyNum
++
;
let
arr
=
key
.
split
(
","
);
buyNum
++
let
arr
=
key
.
split
(
','
)
let
specId
=
props
.
detail
?.
goodsSpec
[
Number
(
arr
[
0
])].
productSpecList
[
Number
(
arr
[
1
])
].
id
;
].
id
if
(
specId
)
{
mallSpecIds
.
push
(
specId
)
;
mallSpecIds
.
push
(
specId
)
}
}
})
;
})
if
(
buyNum
>
0
)
{
setLoading
(
true
)
;
setLoading
(
true
)
api
.
commitMallOrder
({
buyNum
,
buyNum
:
numValue
||
1
,
directoryId
:
1
,
goodsInfoId
:
props
.
detail
!
.
id
,
mallSpecIds
,
userAddressId
:
1
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
==
"200"
)
{
message
.
success
(
"提交意向成功"
);
if
(
res
.
code
==
'200'
)
{
message
.
success
(
'提交意向成功'
)
//重置为未选中
let
temp
=
{
...
checkedMap
}
;
...
checkedMap
,
}
Object
.
keys
(
temp
).
forEach
((
key
)
=>
{
temp
[
key
as
keyof
typeof
temp
]
=
false
;
});
setCheckedMap
(
temp
);
props
.
onCancel
();
}
else
{
temp
[
key
as
keyof
typeof
temp
]
=
false
})
setCheckedMap
(
temp
)
props
.
onCancel
()
props
.
setIsorderForGoods
(
true
)
props
.
setMallDetail
({
...
res
.
result
,
buyNum
:
numValue
||
1
,
directoryId
:
1
,
goodsInfoId
:
props
.
detail
!
.
id
,
mallSpecIds
,
userAddressId
:
1
,
})
}
else
{
}
setLoading
(
false
)
;
setLoading
(
false
)
})
.
catch
((
err
)
=>
{
message
.
error
(
"提交意向失败"
);
console
.
log
(
"err"
,
err
);
setLoading
(
false
)
;
})
;
message
.
error
(
'提交意向失败'
)
console
.
log
(
'err'
,
err
)
setLoading
(
false
)
})
}
}
...
...
@@ -110,11 +136,11 @@ export default function IntentionModal(props: Props) {
style=
{
{
padding
:
0
}
}
className=
{
styles
.
model
}
footer=
{
<
div
style=
{
{
padding
:
"13px 36px"
}
}
>
<
div
style=
{
{
padding
:
'13px 36px'
}
}
>
<
Button
type=
"primary"
className=
{
styles
.
font5
}
style=
{
{
width
:
"100%"
,
height
:
44
}
}
style=
{
{
width
:
'100%'
,
height
:
44
}
}
onClick=
{
onSubmit
}
loading=
{
loading
}
>
...
...
@@ -123,7 +149,7 @@ export default function IntentionModal(props: Props) {
</
div
>
}
>
<
Row
style=
{
{
padding
:
"22px 39px 12px 39px"
}
}
wrap=
{
false
}
>
<
Row
style=
{
{
padding
:
'22px 39px 12px 39px'
}
}
wrap=
{
false
}
>
<
Col
>
<
Image
width=
{
100
}
...
...
@@ -144,12 +170,12 @@ export default function IntentionModal(props: Props) {
className=
{
`${styles.font2} ${styles.ellipsis2}`
}
style=
{
{
marginTop
:
7
}
}
>
已选:
{
" "
}
已选:
{
' '
}
{
checkItems
.
map
((
item
)
=>
{
return
item
.
specName
;
return
item
.
specName
})
.
join
(
"+"
)
}
.
join
(
'+'
)
}
</
div
>
</
Col
>
</
Row
>
...
...
@@ -167,7 +193,7 @@ export default function IntentionModal(props: Props) {
>
{
item
.
goodsSpecName
}
</
div
>
<
Space
size=
{
10
}
direction=
"vertical"
style=
{
{
width
:
"100%"
}
}
>
<
Space
size=
{
10
}
direction=
"vertical"
style=
{
{
width
:
'100%'
}
}
>
{
item
.
productSpecList
?.
map
((
product
,
productSpecIndex
)
=>
{
return
(
<
Row
...
...
@@ -180,10 +206,10 @@ export default function IntentionModal(props: Props) {
border
:
checkedMap
[
`${goodsSpecIndex},${productSpecIndex}`
]
?
"1px solid #FF552D"
:
"1px solid #d6d6d6"
,
?
'1px solid #FF552D'
:
'1px solid #d6d6d6'
,
height
:
50
,
cursor
:
"pointer"
,
cursor
:
'pointer'
,
}
}
onClick=
{
()
=>
addProductSpec
(
goodsSpecIndex
,
productSpecIndex
)
...
...
@@ -205,14 +231,27 @@ export default function IntentionModal(props: Props) {
{
product
.
specName
}
</
Col
>
</
Row
>
)
;
)
})
}
</
Space
>
</
div
>
)
;
)
})
}
<
div
className=
{
styles
.
numBox
}
>
<
div
className=
{
styles
.
numLeft
}
>
<
div
className=
{
styles
.
label
}
>
租赁数量
</
div
>
</
div
>
<
div
className=
{
styles
.
numRight
}
>
<
InputNumber
min=
{
1
}
max=
{
100
}
value=
{
numValue
}
onChange=
{
onChangeNum
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
</
Modal
>
)
;
)
}
pages/mall/detail/components/orderForGoods/api/index.tsx
0 → 100644
浏览文件 @
822ac16e
import
request
,
{
Response
}
from
'~/api/request'
export
interface
GetWebDeviceDetailParams
{
buyNum
:
number
directoryId
:
number
goodsInfoId
:
number
mallSpecIds
:
number
[]
remark
?:
string
userAddressId
:
number
}
export
interface
WareImgsType
{
id
:
number
imgUrl
:
string
imgType
:
number
}
export
interface
UserAddress
{
id
:
number
takeName
:
string
takePhone
:
string
takeRegion
:
string
takeAddress
:
string
type
:
number
}
export
interface
GetOrderForGoods
{
realityAmount
:
number
orderNo
:
string
}
export
default
{
//web-地址管理-查询用户地址列表-条件查询
listUserAddress
:
(
params
:
{}):
Promise
<
Response
<
UserAddress
[]
>>
=>
{
return
request
(
'/oms/user-address/selectList'
,
'POST'
,
params
)
},
//web-产品商城-下单
FeignAddLease
:
(
params
:
GetWebDeviceDetailParams
):
Promise
<
Response
<
GetOrderForGoods
>>
=>
{
return
request
(
'/oms/app-order/commitMallOrder'
,
'post'
,
params
)
},
//web-产品商城-订单支付
OrderPayment
:
(
params
:
{
orderNo
:
string
}):
Promise
<
Response
<
GetOrderForGoods
>>
=>
{
return
request
(
`/payment/repocash/orderPayment`
,
'get'
,
params
)
},
}
pages/mall/detail/components/orderForGoods/index.tsx
0 → 100644
浏览文件 @
822ac16e
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'react'
import
{
OrderForGoodsBox
}
from
'./styled'
import
type
{
FormInstance
,
RadioChangeEvent
}
from
'antd'
import
{
Button
,
Radio
,
Space
,
Input
,
message
,
Modal
,
Image
}
from
'antd'
import
api
,
{
UserAddress
,
GetOrderForGoods
}
from
'./api'
import
moment
from
'moment'
// import { ShopDetail } from '../../[id].page'
// import {
// GetWebDeviceDetailResult,
// GetWebDeviceWareSkuById,
// GetLeaseGoodsResult,
// } from '../../api'
import
{
UserContext
}
from
'~/lib/userProvider'
const
{
TextArea
}
=
Input
interface
PropsBox
{
setIsorderForGoods
:
(
boolean
:
boolean
)
=>
void
mallDetail
?:
any
detailData
?:
any
shopDetail
?:
any
wareSkuList
?:
any
discount
?:
any
}
export
default
function
OrderForGoods
(
props
:
PropsBox
)
{
const
{
setIsorderForGoods
,
shopDetail
,
detailData
,
wareSkuList
,
discount
,
mallDetail
,
}
=
props
const
[
value
,
setValue
]
=
useState
(
1
)
const
[
areaValue
,
setAreaValue
]
=
useState
<
string
>
()
const
[
list
,
setList
]
=
useState
<
Array
<
UserAddress
>
|
null
>
()
const
onChange
=
(
e
:
RadioChangeEvent
)
=>
{
console
.
log
(
'radio checked'
,
e
.
target
.
value
)
setValue
(
e
.
target
.
value
)
}
const
onChangeValue
=
(
index
:
number
)
=>
{
setValue
(
index
)
}
const
detailSumbit
=
()
=>
{
if
(
!
list
?.
length
&&
!
value
)
return
message
.
warning
(
'暂无地址信息'
)
if
(
list
?.
length
&&
!
value
)
return
message
.
warning
(
'请选择地址'
)
if
(
detailData
&&
list
&&
mallDetail
)
{
const
pushList
=
{
buyNum
:
mallDetail
.
buyNum
,
directoryId
:
mallDetail
.
directoryId
,
goodsInfoId
:
mallDetail
.
goodsInfoId
,
mallSpecIds
:
mallDetail
.
mallSpecIds
,
userAddressId
:
value
,
remark
:
areaValue
,
}
api
.
FeignAddLease
(
pushList
).
then
((
res
)
=>
{
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'提交成功'
)
setIsorderForGoods
(
false
)
}
else
{
message
.
error
(
res
.
message
)
}
})
}
}
useEffect
(()
=>
{
api
.
listUserAddress
({})
.
then
((
res
)
=>
{
console
.
log
(
res
)
setList
(
res
.
result
)
res
.
result
?.
map
((
item
,
index
)
=>
{
if
(
item
.
type
===
0
)
{
setValue
(
item
.
id
)
}
})
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
},
[])
//图片预览
const
[
visible
,
setVisible
]
=
useState
(
false
)
return
(
<
OrderForGoodsBox
>
<
div
className=
"address"
>
<
div
className=
"top"
>
<
div
className=
"left"
>
确认收货地址
</
div
>
<
div
className=
"right"
>
<
Button
type=
"link"
style=
{
{
color
:
'#007aff'
}
}
>
管理收货地址
</
Button
>
</
div
>
</
div
>
<
div
className=
"bottom"
>
{
list
?.
map
((
item
,
index
)
=>
(
<
div
key=
{
item
.
id
}
className=
{
`item ${value === item.id ? 'active' : ''}`
}
onClick=
{
()
=>
onChangeValue
(
item
.
id
)
}
>
<
div
className=
"left"
>
<
div
className=
"active"
>
<
div
className=
"icon"
></
div
>
<
div
className=
"label"
>
寄送至
</
div
>
</
div
>
<
Radio
.
Group
onChange=
{
onChange
}
value=
{
value
}
>
<
Space
direction=
"vertical"
>
<
Radio
value=
{
item
.
id
}
>
{
item
.
takeAddress
}
</
Radio
>
</
Space
>
</
Radio
.
Group
>
</
div
>
{
value
===
item
.
id
?
(
<
div
className=
"right"
>
<
Button
type=
"link"
style=
{
{
color
:
'#007aff'
}
}
>
修改地址
</
Button
>
</
div
>
)
:
null
}
</
div
>
))
}
</
div
>
</
div
>
<
div
className=
"info"
>
<
div
className=
"title"
>
确认订单信息
</
div
>
<
div
className=
"table"
>
<
div
className=
"table-title"
>
<
div
className=
"table-item"
style=
{
{
width
:
290
}
}
>
宝贝
</
div
>
<
div
className=
"table-item"
style=
{
{
width
:
130
}
}
>
单价
</
div
>
<
div
className=
"table-item"
style=
{
{
width
:
130
}
}
>
数量
</
div
>
<
div
className=
"table-item"
style=
{
{
width
:
435
}
}
>
合计
</
div
>
</
div
>
{
mallDetail
.
orderGoodsProdDetailDTOS
.
map
((
item
:
any
)
=>
(
<
div
className=
"table-body"
>
<
div
className=
"body-item article"
style=
{
{
width
:
290
}
}
>
<
div
className=
"image"
>
<
Image
preview=
{
{
visible
:
false
}
}
src=
{
item
.
prodSkuSpecImage
||
''
}
onClick=
{
()
=>
setVisible
(
true
)
}
/>
<
div
style=
{
{
display
:
'none'
}
}
>
<
Image
.
PreviewGroup
preview=
{
{
visible
,
onVisibleChange
:
(
vis
)
=>
setVisible
(
vis
),
}
}
>
<
Image
src=
{
item
.
prodSkuSpecImage
||
''
}
/>
</
Image
.
PreviewGroup
>
</
div
>
</
div
>
<
div
className=
"right"
>
<
div
className=
"top"
>
{
`【${item.productName}】${item.specName}`
||
''
}
</
div
>
<
div
className=
"bottom"
>
版本:
{
item
.
versionDesc
||
''
}
</
div
>
<
div
className=
"bottom"
>
料号:
{
item
.
partNo
||
''
}
</
div
>
</
div
>
</
div
>
<
div
className=
"body-item"
style=
{
{
width
:
130
}
}
>
{
item
.
unitPrice
||
0
}
</
div
>
<
div
className=
"body-item"
style=
{
{
width
:
130
}
}
>
{
item
.
buyNum
||
1
}
</
div
>
<
div
className=
"body-item total-price"
style=
{
{
width
:
435
}
}
>
{
item
.
skuSpecAmount
}
</
div
>
</
div
>
))
}
</
div
>
</
div
>
<
div
className=
"notes"
>
<
div
className=
"left"
>
<
div
className=
"label"
>
备注:
</
div
>
<
TextArea
value=
{
areaValue
}
onChange=
{
(
e
)
=>
setAreaValue
(
e
.
target
.
value
)
}
placeholder=
"请输入备注"
autoSize=
{
{
minRows
:
3
,
maxRows
:
5
}
}
style=
{
{
width
:
385
,
height
:
72
}
}
/>
</
div
>
<
div
className=
"right"
>
<
div
className=
"top"
>
<
div
className=
"font"
>
<
div
className=
"label"
>
运费:
</
div
>
<
div
className=
"value"
>
邮寄到付,由客户自己承担
</
div
>
</
div
>
<
div
className=
"price"
>
0.00
</
div
>
</
div
>
<
div
className=
"bottom"
>
<
div
className=
"font"
>
<
div
className=
"label"
>
押金:
</
div
>
<
div
className=
"value"
>
渠道商可免押金
</
div
>
</
div
>
<
div
className=
"price"
>
0.00
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
"detail-box"
>
<
div
className=
"right-box"
>
<
div
className=
"detail"
>
<
div
className=
"top"
>
<
div
className=
"label"
>
实付款
</
div
>
<
div
className=
"price"
>
¥
{
mallDetail
.
orderAmount
}
</
div
>
</
div
>
<
div
className=
"bottom"
>
<
div
className=
"value"
>
寄送至
</
div
>
{
list
?
(
<
div
className=
"value-content"
>
{
list
!
[
value
]?.
takeAddress
}
</
div
>
)
:
null
}
</
div
>
</
div
>
<
div
className=
"detail-sumbit"
>
<
Button
className=
"btn"
onClick=
{
detailSumbit
}
>
提交订单
</
Button
>
</
div
>
</
div
>
</
div
>
</
OrderForGoodsBox
>
)
}
pages/mall/detail/components/orderForGoods/styled.tsx
0 → 100644
浏览文件 @
822ac16e
import
styled
from
'styled-components'
export
const
OrderForGoodsBox
=
styled
.
div
`
box-sizing: border-box;
width: 1000px;
.address {
.top {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #e6e6e6;
height: 30px;
line-height: 30px;
margin-top: 30px;
.left {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #333333;
line-height: 18px;
}
.right {
.btn {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #007aff;
line-height: 19px;
}
}
}
.bottom {
.item {
display: flex;
justify-content: space-between;
align-items: center;
width: 1000px;
height: 48px;
border: 1px solid transparent;
margin-top: 8px;
&.active {
background: #fff1e8;
border-radius: 6px;
border: 1px solid #ff552d;
}
.left {
display: flex;
align-items: center;
justify-content: space-around;
.active {
margin-right: 18px;
display: flex;
.icon {
width: 15px;
height: 22px;
background: #ff552d;
margin-left: 17px;
}
.label {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #000000;
line-height: 19px;
margin-left: 18px;
}
}
}
.right {
margin-right: 22px;
}
}
}
}
.info {
margin-top: 30px;
.title {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #333333;
line-height: 18px;
}
.table {
.table-title {
display: flex;
align-items: center;
width: 1000px;
border-bottom: 1px solid #e6e6e6;
padding: 10px 0;
margin-top: 20px;
.table-item {
text-align: center;
font-size: 14px;
font-family: MicrosoftYaHei;
color: #000000;
line-height: 19px;
}
}
.table-body {
display: flex;
align-items: center;
height: 100px;
margin-top: 10px;
.body-item {
text-align: center;
&.article {
display: flex;
justify-content: space-between;
.image {
width: 80px;
height: 80px;
background-color: pink;
margin-right: 10px;
}
.right {
.top {
width: 171px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #141414;
line-height: 20px;
}
.bottom {
width: 171px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #929295;
line-height: 17px;
}
}
}
&.total-price {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #ff3100;
line-height: 18px;
}
}
}
}
}
.notes {
display: flex;
align-items: center;
justify-content: space-between;
width: 1000px;
height: 110px;
background: #e1efff;
border: 1px solid #d0eaf5;
padding: 0 22px 0 16px;
.left {
display: flex;
align-items: top;
.label {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #000000;
margin-top: 4px;
}
}
.right {
width: 430px;
.top {
display: flex;
align-items: center;
justify-content: space-between;
}
.font {
display: flex;
}
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 18px;
}
.label {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #000000;
line-height: 19px;
margin-right: 12px;
}
.value {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #2b2b2b;
line-height: 20px;
}
.price {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #ff3100;
line-height: 18px;
}
}
}
.detail-box {
display: flex;
justify-content: flex-end;
margin-top: 26px;
.right-box {
.detail {
width: 477px;
height: 110px;
border: 1px solid #ff5001;
padding: 16px 19px 19px 19px;
.top {
display: flex;
justify-content: flex-end;
align-items: center;
.label {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #474747;
line-height: 19px;
margin-right: 10px;
}
.price {
font-size: 26px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #ff552d;
line-height: 33px;
}
}
.bottom {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 15px;
.value {
font-size: 12px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #000000;
line-height: 15px;
margin-right: 10px;
}
.value-content {
font-size: 12px;
font-family: MicrosoftYaHei;
color: #333333;
line-height: 16px;
}
}
}
.detail-sumbit {
display: flex;
justify-content: flex-end;
.btn {
width: 182px;
height: 39px;
background: #ff552d;
border: 1px solid #ff5001;
border-radius: 0;
color: #ffffff;
}
}
}
}
.Payment {
.title {
text-align: center;
font-size: 26px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #ff552d;
}
}
`
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论