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
74b026d7
Commit
74b026d7
authored
Sep 07, 2021
by
shiyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决 生活圈C端项目SHQCLIENT-1539
parent
504959b0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
6 deletions
+30
-6
BaseViewComponent.kt
...rc/main/java/com/yidian/bcommon/mvvm/BaseViewComponent.kt
+1
-1
OrderRemoteDataSource.kt
...ian/shenghuoquan/buserorder/http/OrderRemoteDataSource.kt
+2
-2
ConfirmOrderActivity.kt
...yidian/shenghuoquan/buserorder/ui/ConfirmOrderActivity.kt
+6
-1
ConfirmOrderViewModel.kt
...henghuoquan/buserorder/viewmodel/ConfirmOrderViewModel.kt
+21
-2
No files found.
CommonLib/BCommon/src/main/java/com/yidian/bcommon/mvvm/BaseViewComponent.kt
View file @
74b026d7
...
@@ -17,7 +17,7 @@ interface BaseViewComponent<VM : BaseViewModel> {
...
@@ -17,7 +17,7 @@ interface BaseViewComponent<VM : BaseViewModel> {
val
loadingDialog
:
LoadingDialog
val
loadingDialog
:
LoadingDialog
fun
showLoading
()
{
fun
showLoading
()
{
loadingDialog
.
showDialog
(
"
努力
加载中..."
)
loadingDialog
.
showDialog
(
"加载中..."
)
}
}
fun
hideLoading
()
{
fun
hideLoading
()
{
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/buserorder/http/OrderRemoteDataSource.kt
View file @
74b026d7
...
@@ -97,7 +97,7 @@ object OrderRemoteDataSource {
...
@@ -97,7 +97,7 @@ object OrderRemoteDataSource {
}
}
override
fun
onFailure
(
result
:
HttpResult
<
CreateOrderResDto
?
>?)
{
override
fun
onFailure
(
result
:
HttpResult
<
CreateOrderResDto
?
>?)
{
callback
?.
invoke
(
null
)
}
}
})
})
}
}
...
@@ -118,7 +118,7 @@ object OrderRemoteDataSource {
...
@@ -118,7 +118,7 @@ object OrderRemoteDataSource {
}
}
override
fun
onFailure
(
result
:
HttpResult
<
List
<
PingPayResult
>?>?)
{
override
fun
onFailure
(
result
:
HttpResult
<
List
<
PingPayResult
>?>?)
{
callback
?.
invoke
(
null
)
}
}
})
})
}
}
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/buserorder/ui/ConfirmOrderActivity.kt
View file @
74b026d7
...
@@ -117,6 +117,10 @@ class ConfirmOrderActivity : BaseMvvmActivity<BorderActivityConfirmOrderBinding,
...
@@ -117,6 +117,10 @@ class ConfirmOrderActivity : BaseMvvmActivity<BorderActivityConfirmOrderBinding,
Pingpp
.
createPayment
(
this
,
it
)
Pingpp
.
createPayment
(
this
,
it
)
Timber
.
tag
(
"确认订单"
).
e
(
"支付charge:$it"
)
Timber
.
tag
(
"确认订单"
).
e
(
"支付charge:$it"
)
}
}
// 设置立即支付按钮是否可用,防止多次重复创建订单和打开支付页面
vm
.
payEnableEvent
.
observe
(
this
)
{
binding
.
tvPayNow
.
isEnabled
=
it
}
}
}
...
@@ -163,7 +167,8 @@ class ConfirmOrderActivity : BaseMvvmActivity<BorderActivityConfirmOrderBinding,
...
@@ -163,7 +167,8 @@ class ConfirmOrderActivity : BaseMvvmActivity<BorderActivityConfirmOrderBinding,
Timber
.
tag
(
"确认订单"
).
e
(
"支付失败,错误原因:$errorMsg \n $extraMsg"
)
Timber
.
tag
(
"确认订单"
).
e
(
"支付失败,错误原因:$errorMsg \n $extraMsg"
)
CommonHintDialog
(
this
,
"交易失败,是否继续支付?"
,
arrayListOf
(
"取消"
,
"确定"
),
object
:
CommonHintDialog
.
OnHintOptionCallback
{
CommonHintDialog
(
this
,
"交易失败,是否继续支付?"
,
arrayListOf
(
"取消"
,
"确定"
),
object
:
CommonHintDialog
.
OnHintOptionCallback
{
override
fun
onLeftOption
()
{
override
fun
onLeftOption
()
{
// 支付失败后,取消继续支付,这时允许再次创建订单并进行支付
vm
.
paymentEnable
(
true
)
}
}
override
fun
onRightOption
()
{
override
fun
onRightOption
()
{
...
...
Components/BUserOrder/src/main/java/com/yidian/shenghuoquan/buserorder/viewmodel/ConfirmOrderViewModel.kt
View file @
74b026d7
...
@@ -61,6 +61,12 @@ class ConfirmOrderViewModel : BaseViewModel() {
...
@@ -61,6 +61,12 @@ class ConfirmOrderViewModel : BaseViewModel() {
private
val
_toPaymentEvent
=
MutableLiveData
<
String
>()
private
val
_toPaymentEvent
=
MutableLiveData
<
String
>()
val
toPaymentEvent
:
LiveData
<
String
>
=
_toPaymentEvent
val
toPaymentEvent
:
LiveData
<
String
>
=
_toPaymentEvent
/**
* 立即支付按钮是否可用 Event
*/
private
val
_payEnableEvent
=
MutableLiveData
<
Boolean
>()
val
payEnableEvent
:
LiveData
<
Boolean
>
=
_payEnableEvent
/**
/**
* 请求订单信息
* 请求订单信息
*/
*/
...
@@ -182,6 +188,8 @@ class ConfirmOrderViewModel : BaseViewModel() {
...
@@ -182,6 +188,8 @@ class ConfirmOrderViewModel : BaseViewModel() {
postErrorEvent
(
ErrorInfo
(
message
=
"请输入11位手机号码"
))
postErrorEvent
(
ErrorInfo
(
message
=
"请输入11位手机号码"
))
return
return
}
}
// 防止重复多次点击立即支付按钮
paymentEnable
(
false
)
if
(!
selectedCouponList
.
value
.
isNullOrEmpty
())
{
// 添加上选中的优惠券
if
(!
selectedCouponList
.
value
.
isNullOrEmpty
())
{
// 添加上选中的优惠券
currentParamsJson
.
put
(
"coupon_list"
,
JSONArray
(
selectedCouponList
.
value
))
currentParamsJson
.
put
(
"coupon_list"
,
JSONArray
(
selectedCouponList
.
value
))
}
}
...
@@ -190,7 +198,9 @@ class ConfirmOrderViewModel : BaseViewModel() {
...
@@ -190,7 +198,9 @@ class ConfirmOrderViewModel : BaseViewModel() {
currentParamsJson
.
put
(
"receiver_mobile"
,
receivingPhone
.
value
)
currentParamsJson
.
put
(
"receiver_mobile"
,
receivingPhone
.
value
)
currentParamsJson
.
put
(
"comment"
,
remark
.
value
)
currentParamsJson
.
put
(
"comment"
,
remark
.
value
)
OrderRemoteDataSource
.
requestCreateOrder
(
currentParamsJson
)
{
OrderRemoteDataSource
.
requestCreateOrder
(
currentParamsJson
)
{
it
?.
let
{
if
(
it
==
null
)
{
paymentEnable
(
true
)
}
else
{
if
(
it
.
payment
==
0
)
{
// 0元单不用支付直接进订单详情
if
(
it
.
payment
==
0
)
{
// 0元单不用支付直接进订单详情
_toOrderDetailEvent
.
value
=
it
.
orderId
_toOrderDetailEvent
.
value
=
it
.
orderId
}
else
{
}
else
{
...
@@ -210,7 +220,9 @@ class ConfirmOrderViewModel : BaseViewModel() {
...
@@ -210,7 +220,9 @@ class ConfirmOrderViewModel : BaseViewModel() {
requestParams
[
"order_id"
]
=
orderId
requestParams
[
"order_id"
]
=
orderId
requestParams
[
"pay_method_id"
]
=
"105"
// 微信 App 支付
requestParams
[
"pay_method_id"
]
=
"105"
// 微信 App 支付
OrderRemoteDataSource
.
requestPayOrder
(
requestParams
)
{
OrderRemoteDataSource
.
requestPayOrder
(
requestParams
)
{
it
?.
let
{
if
(
it
==
null
)
{
paymentEnable
(
true
)
}
else
{
// 调起支付
// 调起支付
_toPaymentEvent
.
value
=
Gson
().
toJson
(
it
[
0
].
v
)
_toPaymentEvent
.
value
=
Gson
().
toJson
(
it
[
0
].
v
)
}
}
...
@@ -232,6 +244,13 @@ class ConfirmOrderViewModel : BaseViewModel() {
...
@@ -232,6 +244,13 @@ class ConfirmOrderViewModel : BaseViewModel() {
_toOrderDetailEvent
.
value
=
payOrderId
_toOrderDetailEvent
.
value
=
payOrderId
}
}
/**
* 立即支付按钮状态
*/
fun
paymentEnable
(
enable
:
Boolean
)
{
_payEnableEvent
.
value
=
enable
}
/**
/**
* 页面浏览的埋点
* 页面浏览的埋点
* 页面可见且有业务数据时上传
* 页面可见且有业务数据时上传
...
...
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