Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
Project
Project
Details
Activity
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
朱世闯
YPPos
Commits
cdde717b
Commit
cdde717b
authored
Nov 26, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增现金舍分
parent
7338ad68
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
19 deletions
+40
-19
build.gradle
app/build.gradle
+2
-2
output-metadata.json
app/release/output-metadata.json
+3
-3
yppos_v100011-1.00.011-release-2021-11-26.apk
app/release/yppos_v100011-1.00.011-release-2021-11-26.apk
+0
-0
PosConfig.kt
app/src/main/java/com/ypsx/yppos/room/entity/PosConfig.kt
+1
-1
MainActivity.kt
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
+2
-1
CashPayPopupWindow.kt
...c/main/java/com/ypsx/yppos/ui/popup/CashPayPopupWindow.kt
+28
-12
MainViewModel.kt
...main/java/com/ypsx/yppos/viewmodel/state/MainViewModel.kt
+4
-0
No files found.
app/build.gradle
View file @
cdde717b
...
@@ -15,8 +15,8 @@ android {
...
@@ -15,8 +15,8 @@ android {
applicationId
"com.ypsx.yppos"
applicationId
"com.ypsx.yppos"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
30
targetSdkVersion
30
versionCode
10001
0
versionCode
10001
1
versionName
"1.00.01
0
"
versionName
"1.00.01
1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
}
...
...
app/release/output-metadata.json
View file @
cdde717b
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
{
{
"type"
:
"SINGLE"
,
"type"
:
"SINGLE"
,
"filters"
:
[],
"filters"
:
[],
"versionCode"
:
10001
0
,
"versionCode"
:
10001
1
,
"versionName"
:
"1.00.01
0
"
,
"versionName"
:
"1.00.01
1
"
,
"outputFile"
:
"yppos_v10001
0-1.00.010-release-2021-11-1
6.apk"
"outputFile"
:
"yppos_v10001
1-1.00.011-release-2021-11-2
6.apk"
}
}
]
]
}
}
\ No newline at end of file
app/release/yppos_v10001
0-1.00.010-release-2021-11-1
6.apk
→
app/release/yppos_v10001
1-1.00.011-release-2021-11-2
6.apk
View file @
cdde717b
No preview for this file type
app/src/main/java/com/ypsx/yppos/room/entity/PosConfig.kt
View file @
cdde717b
...
@@ -38,7 +38,7 @@ data class PosConfig(
...
@@ -38,7 +38,7 @@ data class PosConfig(
var
deleteList
:
Int
=
0
,
var
deleteList
:
Int
=
0
,
//整单取消授权方式: 0: 全部允许, 1:需店长授权
//整单取消授权方式: 0: 全部允许, 1:需店长授权
var
cancelWholeOrder
:
Int
=
0
,
var
cancelWholeOrder
:
Int
=
0
,
//现金圆整方式: 0: 四舍五入
//现金圆整方式: 0: 四舍五入
,1:舍分
var
cashRoundMode
:
Int
=
0
,
var
cashRoundMode
:
Int
=
0
,
//锁屏时间,单位分钟, =0表示不锁屏,大于0表示锁屏时间(限制5-60)
//锁屏时间,单位分钟, =0表示不锁屏,大于0表示锁屏时间(限制5-60)
var
lockScreen
:
Int
=
0
,
var
lockScreen
:
Int
=
0
,
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/MainActivity.kt
View file @
cdde717b
...
@@ -361,10 +361,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
...
@@ -361,10 +361,11 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
"现金收款金额不能小于0.1元"
.
toastFailed
()
"现金收款金额不能小于0.1元"
.
toastFailed
()
return
@setPayClick
return
@setPayClick
}
}
val
cashRoundMode
=
mViewModel
.
cashRoundMode
.
get
()
val
cashPayPopupWindow
=
CashPayPopupWindow
(
this
@MainActivity
)
val
cashPayPopupWindow
=
CashPayPopupWindow
(
this
@MainActivity
)
cashPayPopupWindow
.
showPopupWindow
()
cashPayPopupWindow
.
showPopupWindow
()
cashPayPopupWindow
.
setData
(
it
,
payment
)
cashPayPopupWindow
.
setData
(
it
,
payment
,
cashRoundMode
)
cashPayPopupWindow
.
setCashPayClick
{
payMethod
,
receivablesMoney
,
roundMoney
,
changeMoney
,
payMoney
->
cashPayPopupWindow
.
setCashPayClick
{
payMethod
,
receivablesMoney
,
roundMoney
,
changeMoney
,
payMoney
->
cashPayPopupWindow
.
dismiss
()
cashPayPopupWindow
.
dismiss
()
var
orderNo
=
mViewModel
.
orderNo
.
get
()
var
orderNo
=
mViewModel
.
orderNo
.
get
()
...
...
app/src/main/java/com/ypsx/yppos/ui/popup/CashPayPopupWindow.kt
View file @
cdde717b
...
@@ -7,15 +7,18 @@ import android.view.inputmethod.EditorInfo
...
@@ -7,15 +7,18 @@ import android.view.inputmethod.EditorInfo
import
android.view.inputmethod.InputMethodManager
import
android.view.inputmethod.InputMethodManager
import
com.ypsx.base.base.appContext
import
com.ypsx.base.base.appContext
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.base.ext.util.screenWidth
import
com.ypsx.base.ext.util.toJson
import
com.ypsx.base.ext.view.afterTextChange
import
com.ypsx.base.ext.view.afterTextChange
import
com.ypsx.base.util.dXLog
import
com.ypsx.base.util.dXLog
import
com.ypsx.common.app.ext.hideSoftKeyboard
import
com.ypsx.yppos.R
import
com.ypsx.yppos.R
import
com.ypsx.yppos.databinding.PopupCashPayBinding
import
com.ypsx.yppos.databinding.PopupCashPayBinding
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.http.data.entity.PosPayMethod
import
com.ypsx.yppos.room.entity.PosConfig
import
com.ypsx.yppos.room.repository.PosConfigRepository
import
com.ypsx.yppos.utils.CashierInputFilter
import
com.ypsx.yppos.utils.CashierInputFilter
import
com.ypsx.yppos.utils.toastFailed
import
com.ypsx.yppos.utils.toastFailed
import
com.ypsx.yppos.viewmodel.state.CashPayViewModel
import
com.ypsx.yppos.viewmodel.state.CashPayViewModel
import
kotlinx.coroutines.*
import
razerdp.basepopup.BasePopupWindow
import
razerdp.basepopup.BasePopupWindow
import
java.math.BigDecimal
import
java.math.BigDecimal
import
java.math.RoundingMode
import
java.math.RoundingMode
...
@@ -24,9 +27,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -24,9 +27,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
lateinit
var
bind
:
PopupCashPayBinding
lateinit
var
bind
:
PopupCashPayBinding
private
var
roundMoney
:
Double
=
0.0
private
var
roundMoney
:
Double
=
0.0
lateinit
var
payMethod
:
PosPayMethod
lateinit
var
payMethod
:
PosPayMethod
private
var
loadConfig
:
PosConfig
?
=
null
var
payAction
:
(
item
:
PosPayMethod
,
receivablesMoney
:
Double
,
roundMoney
:
Double
,
changeMoney
:
Double
,
payMoney
:
Double
)
->
Unit
=
{
_
:
PosPayMethod
,
_
:
Double
,
_
:
Double
,
_
:
Double
,
_
:
Double
->
}
var
payAction
:
(
item
:
PosPayMethod
,
receivablesMoney
:
Double
,
roundMoney
:
Double
,
changeMoney
:
Double
,
payMoney
:
Double
)
->
Unit
=
{
_
:
PosPayMethod
,
_
:
Double
,
_
:
Double
,
_
:
Double
,
_
:
Double
->
}
init
{
init
{
setContentView
(
R
.
layout
.
popup_cash_pay
)
setContentView
(
R
.
layout
.
popup_cash_pay
)
...
@@ -44,9 +49,13 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -44,9 +49,13 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
bind
=
PopupCashPayBinding
.
bind
(
contentView
)
bind
=
PopupCashPayBinding
.
bind
(
contentView
)
bind
.
vm
=
CashPayViewModel
()
bind
.
vm
=
CashPayViewModel
()
bind
.
click
=
ProxyClick
()
bind
.
click
=
ProxyClick
()
loadConfig
=
PosConfigRepository
.
getInstance
().
loadConfig
()
setAutoShowKeyboard
(
bind
.
textView20
,
true
)
setAutoShowKeyboard
(
bind
.
textView20
,
true
)
setKeyboardAdaptive
(
true
)
setKeyboardAdaptive
(
true
)
setKeyboardAdaptionMode
(
bind
.
textView23
,
setKeyboardAdaptionMode
(
bind
.
textView23
,
FLAG_KEYBOARD_ALIGN_TO_ROOT
or
FLAG_KEYBOARD_ANIMATE_ALIGN
FLAG_KEYBOARD_ALIGN_TO_ROOT
or
FLAG_KEYBOARD_ANIMATE_ALIGN
)
)
bind
.
textView20
.
filters
=
arrayOf
(
CashierInputFilter
())
bind
.
textView20
.
filters
=
arrayOf
(
CashierInputFilter
())
...
@@ -61,7 +70,7 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -61,7 +70,7 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
val
scale
=
BigDecimal
(
it
).
minus
(
BigDecimal
.
valueOf
(
payMoney
)).
setScale
(
1
)
val
scale
=
BigDecimal
(
it
).
minus
(
BigDecimal
.
valueOf
(
payMoney
)).
setScale
(
1
)
bind
.
vm
?.
changeMoney
?.
set
(
scale
.
toDouble
())
bind
.
vm
?.
changeMoney
?.
set
(
scale
.
toDouble
())
bind
.
vm
?.
change2
?.
set
(
"¥${bind.vm?.changeMoney?.get()}"
)
bind
.
vm
?.
change2
?.
set
(
"¥${bind.vm?.changeMoney?.get()}"
)
}
else
{
}
else
{
bind
.
vm
?.
changeMoney
?.
set
(
0.0
)
bind
.
vm
?.
changeMoney
?.
set
(
0.0
)
bind
.
vm
?.
change2
?.
set
(
"¥${bind.vm?.changeMoney?.get()}"
)
bind
.
vm
?.
change2
?.
set
(
"¥${bind.vm?.changeMoney?.get()}"
)
}
}
...
@@ -72,17 +81,24 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -72,17 +81,24 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
val
imm
:
InputMethodManager
=
val
imm
:
InputMethodManager
=
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
imm
.
hideSoftInputFromWindow
(
bind
.
textView20
.
windowToken
,
InputMethodManager
.
HIDE_NOT_ALWAYS
)
imm
.
hideSoftInputFromWindow
(
bind
.
textView20
.
windowToken
,
InputMethodManager
.
HIDE_NOT_ALWAYS
)
return
@setOnEditorActionListener
true
return
@setOnEditorActionListener
true
}
}
return
@setOnEditorActionListener
false
return
@setOnEditorActionListener
false
}
}
}
}
fun
setData
(
payMethod
:
PosPayMethod
,
amount
:
String
)
{
fun
setData
(
payMethod
:
PosPayMethod
,
amount
:
String
,
cashRoundMode
:
Int
)
{
this
.
payMethod
=
payMethod
this
.
payMethod
=
payMethod
val
rawData
=
BigDecimal
(
amount
)
val
rawData
=
BigDecimal
(
amount
)
val
scale
=
rawData
.
setScale
(
1
,
RoundingMode
.
HALF_UP
)
val
scale
=
rawData
.
setScale
(
1
,
if
(
cashRoundMode
==
0
)
RoundingMode
.
HALF_UP
else
RoundingMode
.
DOWN
)
loadConfig
?.
toJson
()
?.
dXLog
()
roundMoney
=
(
rawData
-
scale
).
toDouble
()
roundMoney
=
(
rawData
-
scale
).
toDouble
()
bind
.
vm
?.
receivables
?.
set
(
scale
.
toDouble
())
bind
.
vm
?.
receivables
?.
set
(
scale
.
toDouble
())
bind
.
vm
?.
receivables2
?.
set
(
"¥$scale"
)
bind
.
vm
?.
receivables2
?.
set
(
"¥$scale"
)
...
@@ -101,11 +117,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
...
@@ -101,11 +117,11 @@ class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
}
}
fun
confirm
()
{
fun
confirm
()
{
var
payMoney
:
String
=
bind
.
textView20
.
text
.
toString
()
var
payMoney
:
String
=
bind
.
textView20
.
text
.
toString
()
val
receivables
:
Double
?
=
bind
.
vm
?.
receivables
?.
get
()
val
receivables
:
Double
?
=
bind
.
vm
?.
receivables
?.
get
()
val
changeMoney
:
Double
?
=
bind
.
vm
?.
changeMoney
?.
get
()
val
changeMoney
:
Double
?
=
bind
.
vm
?.
changeMoney
?.
get
()
if
(
payMoney
.
isEmpty
())
{
if
(
payMoney
.
isEmpty
())
{
payMoney
=
receivables
.
toString
()
payMoney
=
receivables
.
toString
()
}
}
if
(
receivables
!=
null
&&
changeMoney
!=
null
)
{
if
(
receivables
!=
null
&&
changeMoney
!=
null
)
{
if
(
receivables
>
payMoney
.
toDouble
())
{
if
(
receivables
>
payMoney
.
toDouble
())
{
...
...
app/src/main/java/com/ypsx/yppos/viewmodel/state/MainViewModel.kt
View file @
cdde717b
...
@@ -40,10 +40,14 @@ class MainViewModel : BaseViewModel() {
...
@@ -40,10 +40,14 @@ class MainViewModel : BaseViewModel() {
var
amount
=
DoubleObservableField
(
0.00
)
var
amount
=
DoubleObservableField
(
0.00
)
var
cashRoundMode
=
IntObservableField
(
0
)
init
{
init
{
val
loadConfig
=
PosConfigRepository
.
getInstance
().
loadConfig
()
val
loadConfig
=
PosConfigRepository
.
getInstance
().
loadConfig
()
storeName
.
set
(
loadConfig
?.
storeName
)
storeName
.
set
(
loadConfig
?.
storeName
)
cashRoundMode
.
set
(
loadConfig
?.
cashRoundMode
)
code
=
loadConfig
?.
code
!!
code
=
loadConfig
?.
code
!!
val
orderDate
=
DateUtil
.
getOrderDate
()
val
orderDate
=
DateUtil
.
getOrderDate
()
...
...
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