Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
7285e612
Commit
7285e612
authored
May 25, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结算打印添加二次确认
parent
e3083787
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
22 deletions
+54
-22
MainActivity.kt
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
+53
-22
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
View file @
7285e612
...
...
@@ -2,20 +2,23 @@ package com.miya.fastcashier.ui
import
android.content.Intent
import
android.os.Bundle
import
android.view.Gravity
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.FragmentManager
import
androidx.lifecycle.ViewModelProvider
import
com.miya.fastcashier.BaseApplication
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivityMainBinding
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.service.PrintService
import
com.miya.fastcashier.ui.dialog.AuthorizePasswordInputDialog
import
com.miya.fastcashier.ui.dialog.CommonDialog
import
com.miya.fastcashier.utils.*
import
com.miya.fastcashier.utils.manage.AccountPasswordManageKit
import
com.miya.fastcashier.utils.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.utils.manage.OrderRecordManageKit
import
com.miya.fastcashier.viewmodel.MainViewModel
import
com.miya.print.utils.PrintLogger
import
java.util.*
class
MainActivity
:
BaseActivity
()
{
...
...
@@ -24,6 +27,7 @@ class MainActivity : BaseActivity() {
private
lateinit
var
binding
:
ActivityMainBinding
private
lateinit
var
viewModel
:
MainViewModel
private
var
dateSelectHelper
:
DateSelectHelper
?
=
null
private
var
confirmDialog
:
CommonDialog
?
=
null
companion
object
{
@JvmStatic
...
...
@@ -81,27 +85,7 @@ class MainActivity : BaseActivity() {
}
binding
.
llBalance
.
clickWithTrigger
{
//上次记录的时间,或者当天0点
var
timeMillis
=
LocalKeyDataMKManageKit
.
getBalanceDate
()
if
(
timeMillis
>
0L
&&
timeMillis
<=
System
.
currentTimeMillis
())
{
val
currentDate
=
Date
()
var
daysAgoCurrent
:
Long
=
DateUtils
.
getDaysAgo
(
currentDate
,
1
)
if
(
timeMillis
<=
daysAgoCurrent
)
{
timeMillis
=
daysAgoCurrent
}
viewModel
.
orderStatistics
(
Date
(
timeMillis
),
currentDate
,
true
)
}
else
{
val
startDate
=
Calendar
.
getInstance
()
startDate
.
set
(
startDate
.
get
(
Calendar
.
YEAR
),
startDate
.
get
(
Calendar
.
MONTH
),
startDate
.
get
(
Calendar
.
DAY_OF_MONTH
),
0
,
0
,
0
)
viewModel
.
orderStatistics
(
startDate
.
time
,
Date
(),
true
)
}
showConfirmBalanceDialog
()
}
initData
()
...
...
@@ -144,6 +128,53 @@ class MainActivity : BaseActivity() {
})
}
private
fun
showConfirmBalanceDialog
(){
if
(
confirmDialog
==
null
||
!
confirmDialog
!!
.
isShowing
)
{
confirmDialog
=
CommonDialog
(
this
)
confirmDialog
!!
.
setCustomMessage
(
getString
(
R
.
string
.
app_text_confirm_balance
))
.
setNegativeStr
(
getString
(
R
.
string
.
cancel
))
.
setPositiveStr
(
getString
(
R
.
string
.
sure
))
.
setMessageGravity
(
Gravity
.
CENTER_HORIZONTAL
)
.
setOnClickListener
(
object
:
CommonDialog
.
OnDialogClickListener
{
override
fun
onNegativeClick
()
{
confirmDialog
!!
.
dismiss
()
confirmDialog
=
null
}
override
fun
onPositiveClick
()
{
toBalance
()
confirmDialog
!!
.
dismiss
()
confirmDialog
=
null
}
})
.
show
()
}
}
private
fun
toBalance
(){
//上次记录的时间,或者当天0点
var
timeMillis
=
LocalKeyDataMKManageKit
.
getBalanceDate
()
if
(
timeMillis
>
0L
&&
timeMillis
<=
System
.
currentTimeMillis
())
{
val
currentDate
=
Date
()
var
daysAgoCurrent
:
Long
=
DateUtils
.
getDaysAgo
(
currentDate
,
1
)
if
(
timeMillis
<=
daysAgoCurrent
)
{
timeMillis
=
daysAgoCurrent
}
viewModel
.
orderStatistics
(
Date
(
timeMillis
),
currentDate
,
true
)
}
else
{
val
startDate
=
Calendar
.
getInstance
()
startDate
.
set
(
startDate
.
get
(
Calendar
.
YEAR
),
startDate
.
get
(
Calendar
.
MONTH
),
startDate
.
get
(
Calendar
.
DAY_OF_MONTH
),
0
,
0
,
0
)
viewModel
.
orderStatistics
(
startDate
.
time
,
Date
(),
true
)
}
}
override
fun
onDestroy
()
{
dateSelectHelper
?.
dismiss
()
super
.
onDestroy
()
...
...
app/src/main/res/values/strings.xml
View file @
7285e612
...
...
@@ -26,6 +26,7 @@
<string
name=
"sure"
>
确定
</string>
<string
name=
"search_order_prompt_text"
>
还没有明细哦~
</string>
<string
name=
"app_text_login_out"
>
是否确认退出账号
</string>
<string
name=
"app_text_confirm_balance"
>
是否确认结算打印
</string>
<string
name=
"text_login_out_sure"
>
确认退出
</string>
<string
name=
"app_login_out"
>
退出登录
</string>
<string
name=
"text_refund_amount"
>
退款金额¥%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