Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
singleStore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Max
singleStore
Commits
cb7ab5f6
Commit
cb7ab5f6
authored
Sep 28, 2021
by
DESKTOP-RL2O6OD\没有姓名的打工人
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:修改订单地址
parent
81de842e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
294 additions
and
13 deletions
+294
-13
App.vue
App.vue
+1
-1
apis/order.js
apis/order.js
+12
-0
pages.json
pages.json
+8
-0
pages/order/order-detail.vue
pages/order/order-detail.vue
+42
-5
pages/order/order-list.vue
pages/order/order-list.vue
+2
-2
static/images/common/icon-warning.png
static/images/common/icon-warning.png
+0
-0
subPages/address/changeAddress.vue
subPages/address/changeAddress.vue
+227
-0
subPages/address/edit.vue
subPages/address/edit.vue
+1
-3
subPages/address/index.vue
subPages/address/index.vue
+1
-2
No files found.
App.vue
View file @
cb7ab5f6
...
...
@@ -4,7 +4,7 @@ import { login_wx } from '@/utils/modules/login.js'
import
dayjs
from
'
dayjs
'
import
{
removeStorage
}
from
'
@/lib/storage/index.js
'
export
default
{
onLaunch
:
async
function
()
{
onLaunch
()
{
this
.
checkUpdate
()
// 检查更新
this
.
setMobileData
()
// 获取系统信息和胶囊信息
const
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
():
{}
...
...
apis/order.js
View file @
cb7ab5f6
...
...
@@ -171,4 +171,16 @@ export function orderNum() {
url
:
'
zsxcx/getOrderCount.htm
'
,
method
:
'
post
'
})
}
/**
* @desc 修改订单地址
*/
export
function
changeOrderAddr
(
params
)
{
return
request
({
url
:
'
zsxcx/editOrderAddress.htm
'
,
method
:
'
post
'
,
data
:
params
,
needMask
:
true
})
}
\ No newline at end of file
pages.json
View file @
cb7ab5f6
...
...
@@ -118,6 +118,14 @@
"navigationBarTitleText"
:
"添加地址"
}
},
{
"path"
:
"address/changeAddress"
,
"style"
:
{
"navigationBarTitleText"
:
"修改地址"
,
"enablePullDownRefresh"
:
true
,
"onReachBottomDistance"
:
50
}
},
{
"path"
:
"web-view/index"
,
"style"
:
{
...
...
pages/order/order-detail.vue
View file @
cb7ab5f6
...
...
@@ -54,8 +54,10 @@
<view
class=
"item mt-2 w-100 flex j-start a-start"
>
<view
class=
"hd"
>
配送地址:
</view>
<view
class=
"flex-1 flex flex-column j-start a-start"
>
<text
class=
"mb-2"
>
{{order_detail.order.address_json.address1 + order_detail.order.address_json.address2}}
</text>
<view
class=
"w-100 flex j-between a-start"
>
<text
class=
"flex-1 mb-2"
>
{{order_detail.order.address_json.address1 + order_detail.order.address_json.address2}}
</text>
<text
v-if=
"showEditAddr"
class=
"editAddr"
@
click=
"handleAddr"
>
修改
</text>
</view>
<view>
<text
class=
"mr-2"
>
{{order_detail.order.address_json.consignee}}
</text>
<text>
{{order_detail.order.address_json.mobile}}
</text>
...
...
@@ -69,7 +71,7 @@
<view
class=
"item mt-2 w-100 flex j-start a-start"
>
<view
class=
"hd"
>
自提地址:
</view>
<view
class=
"flex-1"
>
<text>
{{order_detail.order.pickup_address}}
</text>
<text
class=
"flex-1"
>
{{order_detail.order.pickup_address}}
</text>
</view>
</view>
...
...
@@ -179,10 +181,23 @@ export default {
computed
:
{
...
mapState
({
isIphoneX
:
state
=>
state
.
systemInfo
.
isIphoneX
})
}),
// 是否显示修改地址按钮
showEditAddr
()
{
const
{
order
}
=
this
.
order_detail
if
(
!
order
)
{
return
false
}
else
{
return
[
'
0
'
,
'
1
'
,
'
6
'
].
includes
(
order
.
order_status
)
&&
order
.
is_edit_address
===
'
0
'
}
}
},
onLoad
(
ops
)
{
order_sn
=
ops
.
order_sn
},
onShow
()
{
this
.
getDetail
()
},
...
...
@@ -240,6 +255,19 @@ export default {
this
.
$toast
({
title
:
'
复制成功
'
})
}
})
},
// 修改地址
handleAddr
()
{
const
{
order_sn
,
address_json
,
address_id
}
=
this
.
order_detail
.
order
const
params
=
{
order_sn
,
address_id
,
address_json
}
uni
.
navigateTo
({
url
:
`/subPages/address/changeAddress?params=
${
encodeURIComponent
(
JSON
.
stringify
(
params
))}
`
})
}
}
}
...
...
@@ -295,10 +323,19 @@ export default {
@include
borderBox
(
20rpx
,
30rpx
);
background-color
:
#fff
;
.item
{
.hd
{
flex
:
0
0
140rpx
;
}
.editAddr
{
flex
:
0
0
80rpx
;
width
:
80rpx
;
height
:
40rpx
;
line-height
:
40rpx
;
font-size
:
22rpx
;
text-align
:
center
;
border-radius
:
4rpx
;
border
:
1rpx
solid
$line
;
}
}
}
...
...
pages/order/order-list.vue
View file @
cb7ab5f6
...
...
@@ -36,8 +36,8 @@
:key=
"item.order_sn"
>
<view
class=
"w-100 item-inner"
>
<!--
<view>
orderStatus==
{{
item
.
order_status
}}
————orderStatusD==
{{
item
.
order_status_d
}}
</view>
<view>
{{
item
.
order_sn
}}
</view>
-->
<!--
<view>
orderStatus==
{{
item
.
order_status
}}
————orderStatusD==
{{
item
.
order_status_d
}}
</view>
-->
<view>
{{
item
.
order_sn
}}
</view>
<view
class=
"flex j-between a-center"
>
<text
class=
"order-item"
>
{{
item
.
add_time
|
parseTime
}}
</text>
<!--
<text
class=
"order-status"
>
{{
item
.
order_status
|
orderStatus
(
item
.
goods_before_pay
)
}}
</text>
-->
...
...
static/images/common/icon-warning.png
0 → 100644
View file @
cb7ab5f6
1.16 KB
subPages/address/changeAddress.vue
0 → 100644
View file @
cb7ab5f6
<
template
>
<view
class=
"changeAddr-wrap isIphoneX"
>
<view
class=
"warningBox flex j-star a-center"
>
<image
class=
"icon mx-2"
src=
"/static/images/common/icon-warning.png"
mode=
"aspectFit"
></image>
<text>
修改后会影响物流时效,只能修改一次。
</text>
</view>
<!-- origin address -->
<view
class=
"originAddr-box px-3 py-4 w-100"
>
<view
class=
"title mb-3"
>
原地址
</view>
<view
class=
"mb-3"
>
{{
originAddress
.
address1
+
originAddress
.
address2
}}
</view>
<view>
<text
class=
"mr-3"
>
{{
originAddress
.
consignee
}}
</text>
<text
class=
"mr-3"
>
{{
originAddress
.
mobile
}}
</text>
</view>
</view>
<!-- list -->
<view
class=
"list-wrap"
>
<view
class=
"list-hd w-100 flex j-between a-center my-4"
>
<text
class=
"title"
>
选择新的收获地址
</text>
<navigator
url=
"/subPages/address/index"
hover-class=
"none"
>
添加新地址
</navigator>
</view>
<view
class=
"list-hd_desc descColor font-24"
>
近期使用:
</view>
<template
v-if=
"list.length !== 0"
>
<view
class=
"list-item flex j-between a-center"
v-for=
"address in list"
:key=
"address.address_id"
@
click=
"handleAddr(address.address_id)"
>
<view
class=
"flex-1"
>
<view
class=
"mb-3"
>
{{
address
.
p_cn
+
address
.
c_cn
+
address
.
d_cn
}}{{
address
.
st_cn
||
''
}}{{
address
.
address
||
''
}}
</view>
<view>
<text
class=
"mr-3"
>
{{
address
.
consignee
}}
</text>
<text>
{{
address
.
mobile
}}
</text>
</view>
</view>
<view
class=
"selected-icon"
>
<icon
:class=
"select_address_id === address.address_id ? 'select' : 'unselect'"
></icon>
</view>
</view>
</
template
>
<
template
v-else
>
<empty-view
text=
"没有更多地址了"
/>
</
template
>
</view>
<!-- btn -->
<view
class=
"btn-wrap isIphoneX"
:class=
"{'btn-active': canSubmit}"
@
click=
"handleSubmit"
>
<view
class=
"btn"
>
提交修改
</view>
</view>
</view>
</template>
<
script
>
import
{
addressList
}
from
'
@/apis/address.js
'
import
{
changeOrderAddr
}
from
'
@/apis/order.js
'
import
{
debounce
}
from
'
@/utils/common.js
'
import
LoadMore
from
'
@/utils/load-more.js
'
export
default
{
data
()
{
return
{
originAddress
:
{},
select_address_id
:
'
-1
'
,
canSubmit
:
false
,
// 是否可以提交 未选择地址不能提交
list
:
[]
}
},
onLoad
(
ops
)
{
const
{
order_sn
,
address_json
,
address_id
}
=
JSON
.
parse
(
decodeURIComponent
(
ops
.
params
))
||
{}
if
(
order_sn
)
{
this
.
order_sn
=
order_sn
this
.
address_id
=
address_id
this
.
originAddress
=
address_json
}
this
.
loadmore
=
new
LoadMore
()
},
onShow
()
{
this
.
init
()
},
// 下拉刷新
onPullDownRefresh
()
{
uni
.
showLoading
({
title
:
'
加载中...
'
})
this
.
init
()
let
timer
=
setTimeout
(()
=>
{
clearTimeout
(
timer
)
timer
=
null
uni
.
hideLoading
()
uni
.
stopPullDownRefresh
()
},
800
)
},
// 上拉加载更多
onReachBottom
()
{
console
.
log
(
'
触底
'
)
this
.
getAddressList
()
},
methods
:
{
init
()
{
// 初始化s
this
.
list
=
[]
this
.
select_address_id
=
'
-1
'
this
.
loadmore
.
resetParams
()
this
.
getAddressList
()
},
// 获取地址
async
getAddressList
()
{
try
{
const
{
status
,
data
}
=
await
this
.
loadmore
.
getList
({
remove_address_id
:
this
.
address_id
},
addressList
)
if
(
status
)
{
this
.
list
=
[...
this
.
list
,
...
data
]
}
}
catch
(
e
){
this
.
$toast
({
title
:
e
.
msg
||
'
程序错误, 获取地址失败
'
})
}
},
handleAddr
(
id
)
{
if
(
this
.
select_address_id
===
id
)
{
this
.
select_address_id
=
'
-1
'
this
.
canSubmit
=
false
}
else
{
this
.
select_address_id
=
id
this
.
canSubmit
=
true
}
},
handleSubmit
:
debounce
(
function
()
{
const
{
select_address_id
,
address_id
,
order_sn
}
=
this
if
(
select_address_id
===
'
-1
'
)
return
this
.
$toast
({
title
:
'
请先选择地址
'
})
if
(
!
select_address_id
||
!
order_sn
)
return
changeOrderAddr
({
order_sn
,
address_id
:
select_address_id
})
.
then
(()
=>
{
this
.
$toast
({
title
:
'
修改成功
'
,
cb
:
()
=>
uni
.
navigateBack
()})
})
.
catch
(
err
=>
{
this
.
$toast
({
title
:
err
.
msg
||
'
操作失败,请重试
'
})
})
},
1000
)
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.changeAddr-wrap
{
width
:
100%
;
min-height
:
100vh
;
padding-bottom
:
98rpx
;
background-color
:
#fff
;
.title
{
font-weight
:
bold
;
font-size
:
30rpx
;
}
.warningBox
{
width
:
100%
;
height
:
88rpx
;
color
:
#E75D5D
;
font-size
:
22rpx
;
border-top
:
1rpx
solid
$line
;
.icon
{
display
:
inline-block
;
width
:
30rpx
;
height
:
30rpx
;
}
}
.originAddr-box
{
box-sizing
:
border-box
;
background-color
:
$mainBg
;
}
.list-wrap
{
.list-hd
{
@include
borderBox
(
0
,
30rpx
);
}
.list-hd_desc
{
@include
borderBox
(
0
,
30rpx
);
}
.list-item
{
@include
borderBox
(
40rpx
,
30rpx
);
border-bottom
:
1rpx
solid
$line
;
.selected-icon
{
flex
:
0
0
34rpx
;
.select
{
@include
selected
(
34rpx
,
34rpx
);
}
.unselect
{
@include
unSelected
(
34rpx
,
34rpx
);
}
}
}
}
.btn-wrap
{
position
:
fixed
;
left
:
0
;
right
:
0
;
bottom
:
0
;
width
:
100%
;
color
:
#ccc
;
font-size
:
30rpx
;
background-color
:
$mainBg
;
.btn
{
width
:
100%
;
line-height
:
98rpx
;
text-align
:
center
;
}
}
.btn-active
{
color
:
#fff
;
background-color
:
$primary
;
}
}
</
style
>
subPages/address/edit.vue
View file @
cb7ab5f6
...
...
@@ -155,7 +155,6 @@ export default {
},
confirmCity
(
e
)
{
console
.
log
(
e
)
const
form
=
this
.
form
form
.
province
=
e
.
province_code
form
.
city
=
e
.
city_code
...
...
@@ -192,7 +191,7 @@ export default {
border-bottom
:
none
;
}
.hd
{
flex
:
0
0
1
5
0rpx
flex
:
0
0
1
6
0rpx
}
}
}
...
...
@@ -206,7 +205,6 @@ export default {
background-color
:
#fff
;
.item
{
width
:
100%
;
height
:
30rpx
;
padding
:
30rpx
0
;
display
:
flex
;
justify-content
:
space-between
;
...
...
subPages/address/index.vue
View file @
cb7ab5f6
...
...
@@ -18,7 +18,7 @@
<text
class=
"default mr-1"
v-if=
"address.is_default === '1'"
>
寄
</text>
<text
class=
"default"
v-if=
"address.is_send_default === '1'"
>
收
</text>
</view>
<view>
{{
address
.
p_cn
+
address
.
c_cn
+
address
.
d_cn
+
address
.
st_cn
+
address
.
address
}}
</view>
<view>
{{
address
.
p_cn
+
address
.
c_cn
+
address
.
d_cn
}}{{
address
.
st_cn
||
''
}}{{
address
.
address
||
''
}}
</view>
</view>
<view
class=
"right-arrow"
/>
</view>
...
...
@@ -43,7 +43,6 @@ export default {
created
()
{
this
.
loadmore
=
new
LoadMore
()
console
.
log
(
getCurrentPages
())
const
pages
=
getCurrentPages
()
const
prePages
=
pages
[
pages
.
length
-
2
].
__route__
if
(
prePages
===
'
pages/order/confirm-order
'
)
{
...
...
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