Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
王海
TangKuPos
Commits
dab555f3
Commit
dab555f3
authored
Dec 22, 2017
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收款完成;
parent
8fe481e3
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
524 additions
and
58 deletions
+524
-58
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+11
-8
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
+34
-35
app/src/main/java/com/xingdata/zzdpos/api/ApiService.java
app/src/main/java/com/xingdata/zzdpos/api/ApiService.java
+1
-1
app/src/main/java/com/xingdata/zzdpos/model/Saleorder.java
app/src/main/java/com/xingdata/zzdpos/model/Saleorder.java
+18
-4
app/src/main/java/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
...a/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
+0
-1
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
...in/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
+39
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
...in/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
+49
-1
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
...n/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
+75
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/CashPayFragment.java
...m/xingdata/zzdpos/ui/settle/fragment/CashPayFragment.java
+45
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/PayResultFragment.java
...xingdata/zzdpos/ui/settle/fragment/PayResultFragment.java
+56
-0
app/src/main/java/com/xingdata/zzdpos/ui/settle/view/InputerView.java
.../java/com/xingdata/zzdpos/ui/settle/view/InputerView.java
+16
-2
app/src/main/res/layout/fragment_pay_cash.xml
app/src/main/res/layout/fragment_pay_cash.xml
+5
-5
app/src/main/res/layout/fragment_pay_result.xml
app/src/main/res/layout/fragment_pay_result.xml
+166
-0
app/src/main/res/mipmap-xhdpi/ic_fail.png
app/src/main/res/mipmap-xhdpi/ic_fail.png
+0
-0
app/src/main/res/mipmap-xhdpi/ic_succeed.png
app/src/main/res/mipmap-xhdpi/ic_succeed.png
+0
-0
app/src/main/res/mipmap-xxhdpi/ic_fail.png
app/src/main/res/mipmap-xxhdpi/ic_fail.png
+0
-0
app/src/main/res/mipmap-xxhdpi/ic_succeed.png
app/src/main/res/mipmap-xxhdpi/ic_succeed.png
+0
-0
app/src/main/res/mipmap-xxxhdpi/ic_fail.png
app/src/main/res/mipmap-xxxhdpi/ic_fail.png
+0
-0
app/src/main/res/mipmap-xxxhdpi/ic_succeed.png
app/src/main/res/mipmap-xxxhdpi/ic_succeed.png
+0
-0
app/src/main/res/values/strings.xml
app/src/main/res/values/strings.xml
+9
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
dab555f3
...
@@ -20,20 +20,17 @@
...
@@ -20,20 +20,17 @@
android:label=
"@string/main_title"
android:label=
"@string/main_title"
android:launchMode=
"singleTask"
android:launchMode=
"singleTask"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
></activity>
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
></activity>
<activity
<activity
android:name=
".ui.splash.SplashActivity"
android:name=
".ui.splash.SplashActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
></activity>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".ui.login.LoginActivity"
android:name=
".ui.login.LoginActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
<activity
<activity
android:name=
".ui.exception.ErrorDialogActivity"
android:name=
".ui.exception.ErrorDialogActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
...
@@ -45,7 +42,14 @@
...
@@ -45,7 +42,14 @@
<activity
<activity
android:name=
".ui.payment.PaymentActivity"
android:name=
".ui.payment.PaymentActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".ui.marketing.integral.IntegralActivity"
android:name=
".ui.marketing.integral.IntegralActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
...
@@ -66,7 +70,6 @@
...
@@ -66,7 +70,6 @@
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
android:theme=
"@style/AppTheme"
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
<activity
android:name=
".ui.help.HelpActivity"
></activity>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/xingdata/zzdpos/api/ApiFactory.java
View file @
dab555f3
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xingdata/zzdpos/api/ApiService.java
View file @
dab555f3
...
@@ -194,7 +194,7 @@ interface ApiService {
...
@@ -194,7 +194,7 @@ interface ApiService {
Observable
<
HttpMessage
<
String
>>
addOrderMis
(
@Body
Saleorder
.
Param
saleorderParam
);
Observable
<
HttpMessage
<
String
>>
addOrderMis
(
@Body
Saleorder
.
Param
saleorderParam
);
@POST
(
C
.
URL
.
SALEORDER
.
addOrderPayMis
)
@POST
(
C
.
URL
.
SALEORDER
.
addOrderPayMis
)
Observable
<
HttpMessage
<
S
tring
>>
addOrderPayMis
(
@Body
Saleorder
.
Pay
saleorderPay
);
Observable
<
HttpMessage
<
S
aleorder
>>
addOrderPayMis
(
@Body
Saleorder
.
Pay
saleorderPay
);
@POST
(
C
.
URL
.
USER
.
query
)
@POST
(
C
.
URL
.
USER
.
query
)
Observable
<
HttpMessage
<
Pager
<
Vip
>>>
queryDetailByWD
(
@Query
(
"wd"
)
String
keyword
,
@Query
Observable
<
HttpMessage
<
Pager
<
Vip
>>>
queryDetailByWD
(
@Query
(
"wd"
)
String
keyword
,
@Query
...
...
app/src/main/java/com/xingdata/zzdpos/model/Saleorder.java
View file @
dab555f3
...
@@ -255,6 +255,12 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
...
@@ -255,6 +255,12 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
private
long
msDisAmt
;
private
long
msDisAmt
;
/**
* 支付方式
*/
@JSONField
(
serialize
=
false
)
private
int
payType
;
/**
/**
* 设置订单的商品详情
* 设置订单的商品详情
*
*
...
@@ -983,7 +989,6 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
...
@@ -983,7 +989,6 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
}
}
@Override
@Override
public
String
getPayChange
()
{
public
String
getPayChange
()
{
return
null
;
return
null
;
...
@@ -996,7 +1001,7 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
...
@@ -996,7 +1001,7 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
@Override
@Override
public
String
getGoodsAmtSum
()
{
public
String
getGoodsAmtSum
()
{
return
ConvertUtil
.
fenToYuan
(
orderAuthAmt
,
true
);
return
ConvertUtil
.
fenToYuan
(
orderAuthAmt
,
true
);
}
}
@Override
@Override
...
@@ -1011,8 +1016,8 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
...
@@ -1011,8 +1016,8 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
@Override
@Override
public
List
<
BaseGoodPrint
>
getGoodList
()
{
public
List
<
BaseGoodPrint
>
getGoodList
()
{
List
<
BaseGoodPrint
>
baseGoodPrints
=
new
ArrayList
<>();
List
<
BaseGoodPrint
>
baseGoodPrints
=
new
ArrayList
<>();
for
(
Saledetail
saledetail
:
saledetailList
)
{
for
(
Saledetail
saledetail
:
saledetailList
)
{
baseGoodPrints
.
add
(
saledetail
);
baseGoodPrints
.
add
(
saledetail
);
}
}
return
baseGoodPrints
;
return
baseGoodPrints
;
...
@@ -1063,6 +1068,15 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
...
@@ -1063,6 +1068,15 @@ public class Saleorder implements BaseModel, BaseBean, BaseOrderPrint {
return
shopNameabcn
;
return
shopNameabcn
;
}
}
public
int
getPayType
()
{
return
payType
;
}
public
void
setPayType
(
int
payType
)
{
this
.
payType
=
payType
;
}
/**
/**
* 优惠项目实体类
* 优惠项目实体类
*/
*/
...
...
app/src/main/java/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
View file @
dab555f3
...
@@ -63,7 +63,6 @@ public class CalculatorView<P extends BasePresenter> extends BaseFragment<P, Vie
...
@@ -63,7 +63,6 @@ public class CalculatorView<P extends BasePresenter> extends BaseFragment<P, Vie
String
str
=
((
TextView
)
view
).
getText
().
toString
();
String
str
=
((
TextView
)
view
).
getText
().
toString
();
String
[]
mExps
=
mExp
.
split
(
"[+\\-×÷]"
);
String
[]
mExps
=
mExp
.
split
(
"[+\\-×÷]"
);
if
(
mLast
.
matches
(
"[+\\-×÷]"
))
mValue
=
""
;
if
(
mLast
.
matches
(
"[+\\-×÷]"
))
mValue
=
""
;
else
if
(
mExps
.
length
>
1
)
mValue
=
mExps
[
mExps
.
length
-
1
];
else
if
(
mExps
.
length
>
1
)
mValue
=
mExps
[
mExps
.
length
-
1
];
else
mValue
=
mExp
.
replaceAll
(
"[+\\-×÷]"
,
""
);
else
mValue
=
mExp
.
replaceAll
(
"[+\\-×÷]"
,
""
);
...
...
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleActivity.java
View file @
dab555f3
...
@@ -8,7 +8,9 @@ import com.xingdata.zzdpos.model.Pay;
...
@@ -8,7 +8,9 @@ import com.xingdata.zzdpos.model.Pay;
import
com.xingdata.zzdpos.model.Saleorder
;
import
com.xingdata.zzdpos.model.Saleorder
;
import
com.xingdata.zzdpos.model.Ticket
;
import
com.xingdata.zzdpos.model.Ticket
;
import
com.xingdata.zzdpos.model.Vip
;
import
com.xingdata.zzdpos.model.Vip
;
import
com.xingdata.zzdpos.ui.dialog.LoadingDialog
;
import
com.xingdata.zzdpos.ui.settle.fragment.CashPayFragment
;
import
com.xingdata.zzdpos.ui.settle.fragment.CashPayFragment
;
import
com.xingdata.zzdpos.ui.settle.fragment.PayResultFragment
;
import
com.xingdata.zzdpos.ui.settle.fragment.SettleFragment
;
import
com.xingdata.zzdpos.ui.settle.fragment.SettleFragment
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,6 +21,10 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
...
@@ -19,6 +21,10 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
private
SettleFragment
mSettleFragment
=
new
SettleFragment
();
private
SettleFragment
mSettleFragment
=
new
SettleFragment
();
private
CashPayFragment
mCashPayFragment
=
new
CashPayFragment
();
private
CashPayFragment
mCashPayFragment
=
new
CashPayFragment
();
private
PayResultFragment
mPayResultFragment
=
new
PayResultFragment
();
private
LoadingDialog
mLoadingDialog
=
new
LoadingDialog
();
@Override
@Override
public
int
getLayoutId
()
{
public
int
getLayoutId
()
{
return
R
.
layout
.
activity_settle
;
return
R
.
layout
.
activity_settle
;
...
@@ -35,6 +41,7 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
...
@@ -35,6 +41,7 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
@Override
@Override
public
void
showSettleFragment
()
{
public
void
showSettleFragment
()
{
this
.
popTo
(
mSettleFragment
.
getClass
(),
false
);
}
}
@Override
@Override
...
@@ -74,6 +81,7 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
...
@@ -74,6 +81,7 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
@Override
@Override
public
void
loadSaleorder
(
Saleorder
saleorder
)
{
public
void
loadSaleorder
(
Saleorder
saleorder
)
{
mSettleFragment
.
loadSaleorder
(
saleorder
);
mSettleFragment
.
loadSaleorder
(
saleorder
);
mCashPayFragment
.
loadSaleorder
(
saleorder
);
}
}
@Override
@Override
...
@@ -85,4 +93,35 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
...
@@ -85,4 +93,35 @@ public class SettleActivity extends BaseActivity<SettlePresenter, ActivitySettle
}
}
}
}
@Override
public
void
changeLockState
(
boolean
isLock
)
{
}
@Override
public
void
showLoadingDialog
()
{
mLoadingDialog
.
show
(
this
);
}
@Override
public
void
dismissLoadingDialog
()
{
mLoadingDialog
.
dismiss
();
}
@Override
public
void
showPaySuccFragment
(
Saleorder
saleorder
)
{
this
.
start
(
mPayResultFragment
.
setResult
(
true
).
setSaleorder
(
saleorder
));
}
@Override
public
void
showPayFailFragment
(
Throwable
throwable
,
Saleorder
saleorder
)
{
this
.
start
(
mPayResultFragment
.
setResult
(
false
).
setSaleorder
(
saleorder
));
}
@Override
public
void
backToMainActivity
()
{
//TODO 返回主页面
}
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettleContract.java
View file @
dab555f3
...
@@ -70,7 +70,6 @@ interface SettleContract {
...
@@ -70,7 +70,6 @@ interface SettleContract {
*/
*/
void
loadPays
(
List
<
Pay
>
pays
);
void
loadPays
(
List
<
Pay
>
pays
);
/**
/**
* 加载订单信息
* 加载订单信息
*
*
...
@@ -84,6 +83,45 @@ interface SettleContract {
...
@@ -84,6 +83,45 @@ interface SettleContract {
* @param payChannel 支付渠道
* @param payChannel 支付渠道
*/
*/
void
showPayFragment
(
int
payChannel
);
void
showPayFragment
(
int
payChannel
);
/**
* 改变锁定状态
*
* @param isLock 是否锁定
*/
void
changeLockState
(
boolean
isLock
);
/**
* 显示读取对话框
*/
void
showLoadingDialog
();
/**
* 隐藏读取对话框
*/
void
dismissLoadingDialog
();
/**
* 显示支付成功界面
*
* @param saleorder 订单信息
*/
void
showPaySuccFragment
(
Saleorder
saleorder
);
/**
* 显示支付失败界面
*
* @param throwable 错误信息
* @param saleorder 订单信息
*/
void
showPayFailFragment
(
Throwable
throwable
,
Saleorder
saleorder
);
/**
* 返回主页面
*/
void
backToMainActivity
();
}
}
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
abstract
class
Presenter
extends
BasePresenter
<
View
>
{
...
@@ -183,6 +221,16 @@ interface SettleContract {
...
@@ -183,6 +221,16 @@ interface SettleContract {
*/
*/
public
abstract
void
payInTally
();
public
abstract
void
payInTally
();
/**
* 支付结果页面 - 完成订单
*/
public
abstract
void
clickComplete
();
/**
* 支付结果页面 - 重试
*/
public
abstract
void
clickRetry
();
}
}
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/SettlePresenter.java
View file @
dab555f3
package
com
.
xingdata
.
zzdpos
.
ui
.
settle
;
package
com
.
xingdata
.
zzdpos
.
ui
.
settle
;
import
com.blankj.utilcode.util.StringUtils
;
import
com.xingdata.zzdpos.C
;
import
com.xingdata.zzdpos.C
;
import
com.xingdata.zzdpos.api.ApiFactory
;
import
com.xingdata.zzdpos.api.ApiFactory
;
import
com.xingdata.zzdpos.model.Ms
;
import
com.xingdata.zzdpos.model.Ms
;
...
@@ -13,6 +14,8 @@ import com.xingdata.zzdpos.model.Vip;
...
@@ -13,6 +14,8 @@ import com.xingdata.zzdpos.model.Vip;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
io.reactivex.Observable
;
public
class
SettlePresenter
extends
SettleContract
.
Presenter
{
public
class
SettlePresenter
extends
SettleContract
.
Presenter
{
/**
/**
...
@@ -140,11 +143,16 @@ public class SettlePresenter extends SettleContract.Presenter {
...
@@ -140,11 +143,16 @@ public class SettlePresenter extends SettleContract.Presenter {
@Override
@Override
public
void
clickPayChannelView
(
int
payChannel
)
{
public
void
clickPayChannelView
(
int
payChannel
)
{
mSaleorder
.
setPayType
(
payChannel
);
mView
.
showPayFragment
(
payChannel
);
mView
.
showPayFragment
(
payChannel
);
}
}
@Override
@Override
public
void
payInCash
(
Long
inputAmt
,
Long
changeAmt
)
{
public
void
payInCash
(
Long
inputAmt
,
Long
changeAmt
)
{
subscribePay
(
commitOrder
()
.
flatMap
(
orderNo
->
ApiFactory
.
Saleorder
.
addOrderPayMis
(
mSaleorder
.
pay
(
orderNo
,
C
.
PAY_CHANNEL
.
CASH
)))
);
}
}
@Override
@Override
...
@@ -166,4 +174,71 @@ public class SettlePresenter extends SettleContract.Presenter {
...
@@ -166,4 +174,71 @@ public class SettlePresenter extends SettleContract.Presenter {
@Override
@Override
public
void
payInTally
()
{
public
void
payInTally
()
{
}
}
@Override
public
void
clickComplete
()
{
mView
.
backToMainActivity
();
}
@Override
public
void
clickRetry
()
{
mView
.
showSettleFragment
();
}
/**
* 订阅支付
*
* @param observable 数据源
*/
private
void
subscribePay
(
Observable
<
Saleorder
>
observable
)
{
mView
.
showLoadingDialog
();
observable
.
doFinally
(()
->
mView
.
dismissLoadingDialog
()).
subscribe
(
this
::
paySucc
,
this
::
payFail
);
}
/**
* 提交订单
*/
private
Observable
<
String
>
commitOrder
()
{
if
(
StringUtils
.
isEmpty
(
mSaleorder
.
getOrderNo
()))
{
return
ApiFactory
.
Saleorder
.
addOrderMis
(
createSaleorderParam
())
.
doAfterNext
(
s
->
{
mSaleorder
.
setOrderNo
(
s
);
mView
.
changeLockState
(
true
);
});
}
else
{
return
Observable
.
just
(
mSaleorder
.
getOrderNo
());
}
}
/**
* 获取参数形式的订单信息
*
* @return 参数形式的订单信息
*/
private
Saleorder
.
Param
createSaleorderParam
()
{
Saleorder
.
Param
saleorderParam
=
mSaleorder
.
setVip
(
mVip
).
param
();
for
(
int
i
=
0
;
i
<
mSaledetails
.
size
();
i
++)
{
saleorderParam
.
saleOrderParamDetailList
.
add
(
mSaledetails
.
get
(
i
).
param
());
}
return
saleorderParam
;
}
/**
* 支付成功
*/
private
void
paySucc
(
Saleorder
saleorder
)
{
mView
.
showPaySuccFragment
(
saleorder
);
}
/**
* 支付失败
*/
private
void
payFail
(
Throwable
throwable
)
{
mView
.
showPayFailFragment
(
throwable
,
mSaleorder
);
}
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/CashPayFragment.java
View file @
dab555f3
...
@@ -3,13 +3,17 @@ package com.xingdata.zzdpos.ui.settle.fragment;
...
@@ -3,13 +3,17 @@ package com.xingdata.zzdpos.ui.settle.fragment;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseFragment
;
import
com.xingdata.zzdpos.base.BaseFragment
;
import
com.xingdata.zzdpos.databinding.FragmentPayCashBinding
;
import
com.xingdata.zzdpos.databinding.FragmentPayCashBinding
;
import
com.xingdata.zzdpos.model.Saleorder
;
import
com.xingdata.zzdpos.ui.settle.SettlePresenter
;
import
com.xingdata.zzdpos.ui.settle.SettlePresenter
;
import
com.xingdata.zzdpos.ui.settle.view.InputerView
;
import
com.xingdata.zzdpos.ui.settle.view.InputerView
;
import
com.xingdata.zzdpos.util.ConvertUtil
;
public
class
CashPayFragment
extends
BaseFragment
<
SettlePresenter
,
FragmentPayCashBinding
>
{
public
class
CashPayFragment
extends
BaseFragment
<
SettlePresenter
,
FragmentPayCashBinding
>
{
private
InputerView
<
SettlePresenter
>
mInputerView
=
new
InputerView
<>();
private
InputerView
<
SettlePresenter
>
mInputerView
=
new
InputerView
<>();
private
Long
mOrderAmt
;
@Override
@Override
public
int
getLayoutId
()
{
public
int
getLayoutId
()
{
return
R
.
layout
.
fragment_pay_cash
;
return
R
.
layout
.
fragment_pay_cash
;
...
@@ -18,5 +22,46 @@ public class CashPayFragment extends BaseFragment<SettlePresenter, FragmentPayCa
...
@@ -18,5 +22,46 @@ public class CashPayFragment extends BaseFragment<SettlePresenter, FragmentPayCa
@Override
@Override
public
void
initView
()
{
public
void
initView
()
{
this
.
loadRootFragment
(
R
.
id
.
f_inputer
,
mInputerView
);
this
.
loadRootFragment
(
R
.
id
.
f_inputer
,
mInputerView
);
mInputerView
.
setOnResultChangeListener
(
this
::
setOrderInfo
);
mInputerView
.
setOnSettleClickListener
(
this
::
clickSettle
);
mViewBinding
.
tvOrderAmt
.
setText
(
ConvertUtil
.
fenToYuan
(
mOrderAmt
));
mViewBinding
.
tvPayAmt
.
setText
(
ConvertUtil
.
fenToYuan
(
mOrderAmt
));
mViewBinding
.
tvChange
.
setText
(
"---"
);
}
}
/**
* 加载订单信息
*
* @param saleorder 订单信息
*/
public
void
loadSaleorder
(
Saleorder
saleorder
)
{
this
.
mOrderAmt
=
saleorder
.
getOrderPayAmt
();
}
/**
* 界面设置
*
* @param payAmt 实付价格
*/
private
void
setOrderInfo
(
Long
payAmt
)
{
mViewBinding
.
tvPayAmt
.
setText
(
ConvertUtil
.
fenToYuan
(
payAmt
));
if
(
payAmt
-
mOrderAmt
>
0
)
{
mViewBinding
.
tvChange
.
setText
(
ConvertUtil
.
fenToYuan
(
payAmt
-
mOrderAmt
));
}
else
{
mViewBinding
.
tvChange
.
setText
(
"---"
);
}
}
/**
* 点击结算
*
* @param payAmt 实付价格
*/
private
void
clickSettle
(
Long
payAmt
)
{
if
(
payAmt
-
mOrderAmt
>
0
)
{
mPresenter
.
payInCash
(
payAmt
,
payAmt
-
mOrderAmt
);
}
}
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/fragment/PayResultFragment.java
0 → 100644
View file @
dab555f3
package
com
.
xingdata
.
zzdpos
.
ui
.
settle
.
fragment
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseFragment
;
import
com.xingdata.zzdpos.databinding.FragmentPayResultBinding
;
import
com.xingdata.zzdpos.model.Saleorder
;
import
com.xingdata.zzdpos.ui.settle.SettlePresenter
;
public
class
PayResultFragment
extends
BaseFragment
<
SettlePresenter
,
FragmentPayResultBinding
>
{
private
boolean
mResult
;
private
Saleorder
mSaleorder
;
@Override
public
int
getLayoutId
()
{
return
R
.
layout
.
fragment_pay_result
;
}
@Override
public
void
initView
()
{
mViewBinding
.
setPayResult
(
mResult
);
mViewBinding
.
tvCount
.
setText
(
mSaleorder
.
getGoodsCnt
());
mViewBinding
.
tvOrderAmt
.
setText
(
mSaleorder
.
getPayAmt
());
mViewBinding
.
tvType
.
setText
(
mSaleorder
.
getPayChannel
());
mViewBinding
.
tvTime
.
setText
(
mSaleorder
.
getOrderTime
());
mViewBinding
.
ivResult
.
setImageResource
(
mResult
?
R
.
mipmap
.
ic_succeed
:
R
.
mipmap
.
ic_fail
);
mViewBinding
.
btnConfirm
.
setOnClickListener
(
view
->
{
if
(
mResult
)
mPresenter
.
clickComplete
();
else
mPresenter
.
clickRetry
();
});
}
/**
* 设置订单信息
*
* @param saleorder 订单信息
* @return this
*/
public
PayResultFragment
setSaleorder
(
Saleorder
saleorder
)
{
this
.
mSaleorder
=
saleorder
;
return
this
;
}
/**
* 设置结果
*
* @param isSucc 是否成功
* @return this
*/
public
PayResultFragment
setResult
(
boolean
isSucc
)
{
this
.
mResult
=
isSucc
;
return
this
;
}
}
app/src/main/java/com/xingdata/zzdpos/ui/settle/view/InputerView.java
View file @
dab555f3
...
@@ -2,6 +2,7 @@ package com.xingdata.zzdpos.ui.settle.view;
...
@@ -2,6 +2,7 @@ package com.xingdata.zzdpos.ui.settle.view;
import
android.view.View
;
import
android.view.View
;
import
android.widget.TextView
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseFragment
;
import
com.xingdata.zzdpos.base.BaseFragment
;
...
@@ -16,6 +17,10 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
...
@@ -16,6 +17,10 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
private
OnResultChangeListener
mOnResultChangeListener
;
private
OnResultChangeListener
mOnResultChangeListener
;
private
onSettleClickListener
mOnSettleClickListener
;
private
onSettleClickListener
mOnSettleClickListener
;
public
InputerView
()
{
mValue
=
""
;
}
public
interface
OnResultChangeListener
{
public
interface
OnResultChangeListener
{
void
onResultChange
(
Long
result
);
void
onResultChange
(
Long
result
);
}
}
...
@@ -43,7 +48,16 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
...
@@ -43,7 +48,16 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
settle
();
settle
();
break
;
break
;
default
:
default
:
if
(
view
instanceof
TextView
)
{
String
str
=
((
TextView
)
view
).
getText
().
toString
();
//限制位数
if
(
str
.
matches
(
"[0-9]+"
)
&&
mValue
.
split
(
"[.]"
).
length
>
1
&&
mValue
.
split
(
"[.]"
)[
1
].
length
()
==
2
)
return
;
//限制小数点
if
((
mValue
.
length
()
==
0
||
mValue
.
contains
(
"."
))
&&
str
.
matches
(
"[.]"
))
return
;
mValue
+=
str
;
}
break
;
break
;
}
}
if
(
mOnResultChangeListener
!=
null
)
{
if
(
mOnResultChangeListener
!=
null
)
{
...
@@ -84,7 +98,7 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
...
@@ -84,7 +98,7 @@ public class InputerView<P extends BasePresenter> extends BaseFragment<P, ViewIn
public
void
setOnResultChangeListener
(
OnResultChangeListener
onResultChangeListener
)
{
public
void
setOnResultChangeListener
(
OnResultChangeListener
onResultChangeListener
)
{
this
.
mOnResultChangeListener
=
onResultChangeListener
;
this
.
mOnResultChangeListener
=
onResultChangeListener
;
mOnResultChangeListener
.
onResultChange
(
ConvertUtil
.
yuanToFen
(
mValue
)
);
this
.
clear
(
);
}
}
public
void
setOnSettleClickListener
(
onSettleClickListener
onSettleClickListener
)
{
public
void
setOnSettleClickListener
(
onSettleClickListener
onSettleClickListener
)
{
...
...
app/src/main/res/layout/fragment_pay_cash.xml
View file @
dab555f3
...
@@ -35,11 +35,11 @@
...
@@ -35,11 +35,11 @@
app:layout_constraintRight_toLeftOf=
"parent"
/>
app:layout_constraintRight_toLeftOf=
"parent"
/>
<TextView
<TextView
android:id=
"@+id/tv_order_amt"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"¥50.00"
android:textColor=
"@color/black_baozheng"
android:textColor=
"@color/black_baozheng"
android:textSize=
"@dimen/fragment_settle_bigtextsize"
android:textSize=
"@dimen/fragment_settle_bigtextsize"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
...
@@ -65,13 +65,13 @@
...
@@ -65,13 +65,13 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_amt"
android:text=
"@string/settle_pay_amt"
android:textColor=
"@color/black_zhangfei"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_
sub_title
_size"
/>
android:textSize=
"@dimen/all_
text
_size"
/>
<TextView
<TextView
android:id=
"@+id/tv_pay_amt"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:gravity=
"end"
android:text=
"¥40.00"
android:textColor=
"@color/black_zhangfei"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_sub_title_size"
/>
android:textSize=
"@dimen/all_sub_title_size"
/>
</LinearLayout>
</LinearLayout>
...
@@ -97,13 +97,13 @@
...
@@ -97,13 +97,13 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_change"
android:text=
"@string/settle_pay_change"
android:textColor=
"@color/black_zhangfei"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_
sub_title
_size"
/>
android:textSize=
"@dimen/all_
text
_size"
/>
<TextView
<TextView
android:id=
"@+id/tv_change"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:gravity=
"end"
android:text=
"¥10.00"
android:textColor=
"@color/black_zhangfei"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_sub_title_size"
/>
android:textSize=
"@dimen/all_sub_title_size"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/fragment_pay_result.xml
0 → 100644
View file @
dab555f3
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"payResult"
type=
"boolean"
/>
</data>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/gray_zhouyu"
android:orientation=
"vertical"
>
<android.support.v7.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"@dimen/all_margin"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/iv_result"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/all_margin"
android:contentDescription=
"@string/settle_pay_result"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/all_margin"
android:gravity=
"center"
android:text=
"@{payResult?@string/settle_pay_succ:@string/settle_pay_fail}"
android:textColor=
"@color/black_likui"
android:textSize=
"@dimen/all_sub_title_size"
android:textStyle=
"bold"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/all_line_width"
android:layout_marginEnd=
"@dimen/all_spacing"
android:layout_marginStart=
"@dimen/all_spacing"
android:layout_marginTop=
"@dimen/all_margin"
android:background=
"@color/gray_kongming"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingBottom=
"@dimen/all_spacing"
android:paddingEnd=
"@dimen/all_margin"
android:paddingStart=
"@dimen/all_margin"
android:paddingTop=
"@dimen/all_margin"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_time"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_caption_size"
/>
<TextView
android:id=
"@+id/tv_time"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:textColor=
"@color/black_likui"
android:textSize=
"@dimen/all_caption_size"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingBottom=
"@dimen/all_spacing"
android:paddingEnd=
"@dimen/all_margin"
android:paddingStart=
"@dimen/all_margin"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_type"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_caption_size"
/>
<TextView
android:id=
"@+id/tv_type"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:textColor=
"@color/black_likui"
android:textSize=
"@dimen/all_caption_size"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingBottom=
"@dimen/all_spacing"
android:paddingEnd=
"@dimen/all_margin"
android:paddingStart=
"@dimen/all_margin"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_count"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_caption_size"
/>
<TextView
android:id=
"@+id/tv_count"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:textColor=
"@color/black_likui"
android:textSize=
"@dimen/all_caption_size"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingBottom=
"@dimen/all_margin"
android:paddingEnd=
"@dimen/all_margin"
android:paddingStart=
"@dimen/all_margin"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/settle_pay_order_amt"
android:textColor=
"@color/black_zhangfei"
android:textSize=
"@dimen/all_caption_size"
/>
<TextView
android:id=
"@+id/tv_order_amt"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"end"
android:textColor=
"@color/black_likui"
android:textSize=
"@dimen/all_caption_size"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<Button
android:id=
"@+id/btn_confirm"
style=
"@style/button_positive"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"@dimen/all_margin"
android:layout_marginStart=
"@dimen/all_margin"
android:foreground=
"?android:attr/selectableItemBackground"
android:text=
"@{payResult?@string/settle_complete:@string/settle_retry}"
/>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/mipmap-xhdpi/ic_fail.png
0 → 100644
View file @
dab555f3
2.98 KB
app/src/main/res/mipmap-xhdpi/ic_succeed.png
0 → 100644
View file @
dab555f3
2.96 KB
app/src/main/res/mipmap-xxhdpi/ic_fail.png
0 → 100644
View file @
dab555f3
4.15 KB
app/src/main/res/mipmap-xxhdpi/ic_succeed.png
0 → 100644
View file @
dab555f3
4.12 KB
app/src/main/res/mipmap-xxxhdpi/ic_fail.png
0 → 100644
View file @
dab555f3
5.25 KB
app/src/main/res/mipmap-xxxhdpi/ic_succeed.png
0 → 100644
View file @
dab555f3
5.3 KB
app/src/main/res/values/strings.xml
View file @
dab555f3
...
@@ -503,7 +503,15 @@
...
@@ -503,7 +503,15 @@
<string
name=
"settle_order_amt"
>
应收金额
</string>
<string
name=
"settle_order_amt"
>
应收金额
</string>
<string
name=
"settle_pay_amt"
>
实收金额
</string>
<string
name=
"settle_pay_amt"
>
实收金额
</string>
<string
name=
"settle_pay_change"
>
找零金额
</string>
<string
name=
"settle_pay_change"
>
找零金额
</string>
<string
name=
"settle_pay_result"
>
支付结果
</string>
<string
name=
"settle_pay_succ"
>
支付成功
</string>
<string
name=
"settle_pay_fail"
>
支付失败
</string>
<string
name=
"settle_pay_time"
>
交易时间
</string>
<string
name=
"settle_pay_type"
>
收款方式
</string>
<string
name=
"settle_pay_count"
>
商品总数
</string>
<string
name=
"settle_pay_order_amt"
>
合计金额
</string>
<string
name=
"settle_retry"
>
重新支付
</string>
<string
name=
"settle_complete"
>
完成
</string>
<!--帮助POS-->
<!--帮助POS-->
<string
name=
"help_hint"
>
帮助
</string>
<string
name=
"help_hint"
>
帮助
</string>
<string
name=
"help_phone"
>
400–800–9406
</string>
<string
name=
"help_phone"
>
400–800–9406
</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