Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
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
bp
ShenghuoquanBusiness
Commits
da07a994
Commit
da07a994
authored
Aug 31, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 选择自提点页面调用C端客户端信息服务获取经纬度
parent
6e2b5c44
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
20 deletions
+52
-20
IntentConstants.kt
.../main/java/com/yidian/bcommon/constant/IntentConstants.kt
+0
-6
ZapServiceActionConstants.kt
.../com/yidian/bcommon/services/ZapServiceActionConstants.kt
+3
-0
ClientInfoService.kt
...om/yidian/shenghuoquan/bdemo/service/ClientInfoService.kt
+10
-1
PickupPointListAdapter.kt
...ian/shenghuoquan/border/adapter/PickupPointListAdapter.kt
+9
-0
SelectPickupPointActivity.kt
...idian/shenghuoquan/border/ui/SelectPickupPointActivity.kt
+22
-9
border_item_pickup_point_list.xml
...der/src/main/res/layout/border_item_pickup_point_list.xml
+7
-3
strings.xml
Components/BUserOrder/src/main/res/values/strings.xml
+1
-1
No files found.
CommonLib/BCommon/src/main/java/com/yidian/bcommon/constant/IntentConstants.kt
View file @
da07a994
...
...
@@ -19,12 +19,6 @@ object IntentConstants {
// 活动id
const
val
KEY_EXTRA_MARKETING_ID
=
"marketingId"
// 经度
const
val
KEY_EXTRA_LONGITUDE
=
"longitude"
// 纬度
const
val
KEY_EXTRA_LATITUDE
=
"latitude"
// 自提点id
const
val
KEY_EXTRA_PICKUP_POINT_ID
=
"pickupPointId"
...
...
CommonLib/BCommon/src/main/java/com/yidian/bcommon/services/ZapServiceActionConstants.kt
View file @
da07a994
...
...
@@ -63,5 +63,8 @@ class ZapServiceActionConstants {
// 清空生活号id
const
val
ActionDeleteLifeAccountId
=
"deleteLifeAccountId"
// 获取当前位置信息
const
val
ActionGetCurrentLocation
=
"getCurrentLocation"
}
}
Components/BDemo/src/main/java/com/yidian/shenghuoquan/bdemo/service/ClientInfoService.kt
View file @
da07a994
...
...
@@ -15,8 +15,8 @@ class ClientInfoService : ZapService() {
override
fun
onAction
(
path
:
String
,
action
:
String
,
params
:
Any
,
options
:
Any
,
resolver
:
ResultResolver
)
{
when
(
action
)
{
// 获取C端userId、userName、userPhone
ZapServiceActionConstants
.
ActionGetUserInfo
->
{
// 获取C端userId、userName、userPhone
resolver
.
success
(
JSONObject
()
.
put
(
"userId"
,
"510227073302"
)
...
...
@@ -46,6 +46,15 @@ class ClientInfoService : ZapService() {
)
)
}
// 获取C端经纬度
ZapServiceActionConstants
.
ActionGetCurrentLocation
->
{
resolver
.
success
(
JSONObject
()
.
put
(
"longitude"
,
116.4955500
)
.
put
(
"latitude"
,
39.9885500
)
.
put
(
"address"
,
"北京市朝阳区酒仙桥"
)
)
}
}
}
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/adapter/PickupPointListAdapter.kt
View file @
da07a994
...
...
@@ -21,6 +21,7 @@ class PickupPointListAdapter(data: List<PickupPoint>?) : RecyclerView.Adapter<Pi
private
val
data
by
lazy
{
ArrayList
<
PickupPoint
>()
}
private
var
curSelectId
=
0L
private
var
location
=
false
init
{
data
?.
let
{
...
...
@@ -47,6 +48,13 @@ class PickupPointListAdapter(data: List<PickupPoint>?) : RecyclerView.Adapter<Pi
curSelectId
=
id
?:
0
}
/**
* 设置是否有位置信息
*/
fun
setLocation
(
location
:
Boolean
)
{
this
.
location
=
location
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
PickupPointListViewHolder
{
val
binding
=
DataBindingUtil
.
inflate
<
BorderItemPickupPointListBinding
>(
LayoutInflater
.
from
(
parent
.
context
),
...
...
@@ -61,6 +69,7 @@ class PickupPointListAdapter(data: List<PickupPoint>?) : RecyclerView.Adapter<Pi
holder
.
binding
.
vm
=
PickupPointListItemViewModel
()
holder
.
binding
.
data
=
data
[
position
]
holder
.
binding
.
selectedId
=
curSelectId
holder
.
binding
.
location
=
location
}
override
fun
getItemCount
():
Int
{
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/border/ui/SelectPickupPointActivity.kt
View file @
da07a994
...
...
@@ -7,6 +7,8 @@ import com.yidian.bcommon.constant.IntentConstants
import
com.yidian.bcommon.constant.XEventConfig
import
com.yidian.bcommon.constant.XRouterPathConstants
import
com.yidian.bcommon.mvvm.BaseMvvmActivity
import
com.yidian.bcommon.services.ZapServiceActionConstants
import
com.yidian.bcommon.services.ZapServiceNameConstants
import
com.yidian.shenghuoquan.border.R
import
com.yidian.shenghuoquan.border.adapter.PickupPointListAdapter
import
com.yidian.shenghuoquan.border.databinding.BorderActivitySelectPickupPointBinding
...
...
@@ -15,8 +17,10 @@ import com.yidian.shenghuoquan.border.viewmodel.SelectPickupPointViewModel
import
com.yidian.xarc.xevent.XBaseEvent
import
com.yidian.xarc.xevent.XEventManager
import
com.yidian.xpage.XPageViewProtocol
import
com.yidian.yac.core.zap.ZapTicket
import
org.greenrobot.eventbus.Subscribe
import
org.greenrobot.eventbus.ThreadMode
import
org.json.JSONObject
/**
* author: yinjiacheng
...
...
@@ -34,6 +38,7 @@ class SelectPickupPointActivity : BaseMvvmActivity<BorderActivitySelectPickupPoi
it
as
HashMap
<*,
*>
}
}
private
var
location
=
false
/**
* 搜索关键字
...
...
@@ -47,8 +52,6 @@ class SelectPickupPointActivity : BaseMvvmActivity<BorderActivitySelectPickupPoi
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
XEventManager
.
register
(
this
)
// 标记是否有当前位置
binding
.
location
=
params
?.
get
(
IntentConstants
.
KEY_EXTRA_LONGITUDE
)
!=
null
&&
params
?.
get
(
IntentConstants
.
KEY_EXTRA_LATITUDE
)
!=
null
}
override
fun
onDestroy
()
{
...
...
@@ -97,19 +100,29 @@ class SelectPickupPointActivity : BaseMvvmActivity<BorderActivitySelectPickupPoi
if
(
data
==
null
)
return
// 标记当前选中的自提点
adapter
.
setSelectedId
(
params
?.
get
(
IntentConstants
.
KEY_EXTRA_PICKUP_POINT_ID
)
?.
let
{
id
->
id
as
Long
})
// 是否有位置信息 控制距离显示
adapter
.
setLocation
(
location
)
adapter
.
updateData
(
data
.
list
)
}
/**
* 请求自提点列表
* 请求自提点列表
先调用C端客户端信息服务获取经纬度
*/
private
fun
requestPickupPoint
(
type
:
SelectPickupPointViewModel
.
LoadType
)
{
vm
.
requestPickupPointList
(
params
?.
get
(
IntentConstants
.
KEY_EXTRA_MARKETING_ID
)
as
String
,
params
?.
get
(
IntentConstants
.
KEY_EXTRA_LONGITUDE
)
?.
let
{
it
as
Double
},
params
?.
get
(
IntentConstants
.
KEY_EXTRA_LATITUDE
)
?.
let
{
it
as
Double
},
keyWords
,
type
)
var
longitude
:
Double
?
=
null
var
latitude
:
Double
?
=
null
// 获取C端经纬度信息
ZapTicket
(
ZapServiceNameConstants
.
ClientInfoService
)
.
withAction
(
ZapServiceActionConstants
.
ActionGetCurrentLocation
)
.
onResult
{
xResult
->
val
result
=
xResult
.
result
as
JSONObject
longitude
=
result
.
opt
(
"longitude"
)
?.
let
{
it
as
Double
}
latitude
=
result
.
opt
(
"latitude"
)
?.
let
{
it
as
Double
}
}.
ship
()
location
=
longitude
!=
null
&&
latitude
!=
null
// 是否有位置信息 控制附近自提点显示
binding
.
location
=
location
vm
.
requestPickupPointList
(
params
?.
get
(
IntentConstants
.
KEY_EXTRA_MARKETING_ID
)
as
String
,
longitude
,
latitude
,
keyWords
,
type
)
}
@Subscribe
(
sticky
=
false
,
threadMode
=
ThreadMode
.
MAIN
)
...
...
Components/BUserOrder/src/main/res/layout/border_item_pickup_point_list.xml
View file @
da07a994
...
...
@@ -19,6 +19,10 @@
name=
"selectedId"
type=
"Long"
/>
<variable
name=
"location"
type=
"Boolean"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
...
...
@@ -46,7 +50,7 @@
android:text=
"@{@string/pickup_point_distance(data.distance)}"
android:textColor=
"@color/color_FD7823"
android:textSize=
"@dimen/sp14"
android:visibility=
"@{
data.distance != 0
? View.VISIBLE : View.GONE}"
android:visibility=
"@{
location
? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/tv_pickup_point_address"
tools:text=
"距您:2.7km"
/>
...
...
@@ -55,7 +59,7 @@
android:layout_width=
"@dimen/dp1"
android:layout_height=
"@dimen/dp8"
android:background=
"@color/color_999999"
android:visibility=
"@{
data.distance != 0
? View.VISIBLE : View.GONE}"
android:visibility=
"@{
location
? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf=
"@id/tv_pickup_point_distance"
app:layout_constraintEnd_toStartOf=
"@id/tv_pickup_point_address"
app:layout_constraintStart_toEndOf=
"@id/tv_pickup_point_distance"
...
...
@@ -75,7 +79,7 @@
app:layout_constraintEnd_toStartOf=
"@id/cb_pickup_point_select"
app:layout_constraintStart_toEndOf=
"@id/tv_pickup_point_distance"
app:layout_constraintTop_toBottomOf=
"@id/tv_pickup_point_name"
app:layout_marginStart=
"@{
data.distance != 0
? 17 : 0}"
app:layout_marginStart=
"@{
location
? 17 : 0}"
tools:text=
"经济技术开发区燕顺路123号经济技术开发区燕顺路123号"
/>
<TextView
...
...
Components/BUserOrder/src/main/res/values/strings.xml
View file @
da07a994
...
...
@@ -28,7 +28,7 @@
<string
name=
"search_pickup_point"
>
搜索自提点名称/地址
</string>
<string
name=
"cancel"
>
取消
</string>
<string
name=
"nearby_pickup_point"
>
附近自提点
</string>
<string
name=
"pickup_point_distance"
>
距您: %fkm
</string>
<string
name=
"pickup_point_distance"
>
距您: %
.1
fkm
</string>
<string
name=
"commodity_count"
>
共%d件
</string>
<string
name=
"amount"
>
¥%.2f
</string>
<string
name=
"pickup_point_contract_name"
>
提货点联系人: %s
</string>
...
...
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