Commit e9bb0e8b authored by UIUANG\Zsc's avatar UIUANG\Zsc

修改打印

parent 14df108f
......@@ -15,8 +15,8 @@ android {
applicationId "com.ypsx.yppos"
minSdkVersion 21
targetSdkVersion 30
versionCode 100003
versionName "1.00.003"
versionCode 100006
versionName "1.00.006"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 100003,
"versionName": "1.00.003",
"outputFile": "yppos_v100003-1.00.003-release-2021-10-27.apk"
"versionCode": 100006,
"versionName": "1.00.006",
"outputFile": "yppos_v100006-1.00.006-release-2021-11-01.apk"
}
]
}
\ No newline at end of file
......@@ -11,5 +11,6 @@ enum class PosPayMethod {
GROUP_PAY,
BUY_CARDPAY,
CASH_TICKET_PAY,
AGGREGATE_SCAN_CODE_PAY
AGGREGATE_SCAN_CODE_PAY,
LCSW_BAR_PAY
}
\ No newline at end of file
......@@ -37,8 +37,7 @@ abstract class PosDatabase : RoomDatabase() {
context.applicationContext,
PosDatabase::class.java,
name
).allowMainThreadQueries()
.fallbackToDestructiveMigration().build()
).allowMainThreadQueries().build()
INSTANCE = instance
return instance
}
......
......@@ -81,7 +81,7 @@ class PosBuyRepository {
quantity = product.paymentProductQuantity,
barCode = product.barCode,
tailAmount = product.tailAmount,
amount = product.amount,
amount = product.productAmount,
weightCode = product.weightCode,
deleted = false,
conversionRatio = product.conversionRatio,
......
......@@ -454,7 +454,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
requestMainViewModel.paySuccessState.observe(this, {
payAmountPopupWindow!!.dismiss()
if (it.isSuccess) {
payFailedPopWindow!!.dismiss()
if (payFailedPopWindow != null) {
payFailedPopWindow!!.dismiss()
}
paySuccessPopWindow = PaySuccessPopWindow(this)
paySuccessPopWindow!!.showPopupWindow()
paySuccessPopWindow!!.setData(it.data!!)
......
......@@ -75,7 +75,25 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
fun pay() {
var checkedRadioButtonId = bind?.radio?.checkedRadioButtonId
val payMethod = when (checkedRadioButtonId) {
R.id.rb_offline -> PosPayMethod.CCB_BAR_PAY
R.id.rb_offline -> {
val payName = bind!!.vm?.payName?.get()
if (payName!!.isNotEmpty()) {
when (payName) {
PosPayMethod.CCB_BAR_PAY.name -> {
PosPayMethod.CCB_BAR_PAY
}
PosPayMethod.LCSW_BAR_PAY.name -> {
PosPayMethod.LCSW_BAR_PAY
}
else -> {
PosPayMethod.CCB_BAR_PAY
}
}
} else {
PosPayMethod.CCB_BAR_PAY
}
}
R.id.rbCardPay -> PosPayMethod.CARDPAY
else -> PosPayMethod.CCB_BAR_PAY
}
......
......@@ -68,6 +68,7 @@ class PayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
var title = ""
when (payMethod) {
PosPayMethod.LCSW_BAR_PAY,
PosPayMethod.CCB_BAR_PAY -> {
title = "扫码支付"
binding?.vm?.payTitle?.set("扫码支付")
......
......@@ -278,7 +278,7 @@ object PrintUtils {
if (payments.isNotEmpty()) {
total = payments[0].total.toString()
payMethod = when (payments[0].payMethod) {
PosPayMethod.CCB_BAR_PAY.name -> {
PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付"
}
PosPayMethod.CARDPAY.name -> {
......@@ -562,7 +562,7 @@ object PrintUtils {
var discountTime = 0.0 //分时
var discountSpecial = 0.0 //特价
var discountMoney = 0.0 //满减
var list: List<OrderActivityResponse>? =null
var list: List<OrderActivityResponse>? = null
if (posBuy.activitys != null && posBuy.activitys != "") {
list =
Gson().fromJson(
......@@ -593,7 +593,7 @@ object PrintUtils {
var discountMoney = 0.0
var isPromotion = false
if (product.activitys!=null&&product.activitys != "") {
if (product.activitys != null && product.activitys != "") {
// XLog.d(product.activitys)
val activityInfoDTO: List<ActivityInfoDTO> =
......@@ -626,7 +626,7 @@ object PrintUtils {
//
val name = if (discountMoney > 0.0 && isPromotion) {
"${index + 1} *${product.name}*"
}else{
} else {
"${index + 1} ${product.name}"
}
height += printerManager.drawTextEx(
......@@ -710,7 +710,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
getAmountCenterSpace(
"应付款:${posBuy.totalAmount}",
"应付款:${posBuy.payAmount}",
"数量:${posBuy.buyNumber}"
),
0,
......@@ -749,7 +749,7 @@ object PrintUtils {
if (posBuyPayment != null) {
total = posBuyPayment.total.toString()
payMethod = when (posBuyPayment.payMethod) {
PosPayMethod.CCB_BAR_PAY.name -> {
PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付"
}
PosPayMethod.CARDPAY.name -> {
......
......@@ -20,6 +20,9 @@ class OrderPayAmountViewModel : BaseViewModel() {
var scanCardPay = BooleanObservableField(false)
var payName = StringObservableField("")
var offlineVisible = object : ObservableInt(scanOffline) {
override fun get(): Int {
return if (scanOffline.get()) {
......@@ -48,11 +51,13 @@ class OrderPayAmountViewModel : BaseViewModel() {
if (!payMethods.isNullOrEmpty()) {
val payMethod:List<String> = payMethods.split(",")
for (str in payMethod) {
if (str == PosPayMethod.CCB_BAR_PAY.name) {
scanOffline.set(true)
}
if (str == PosPayMethod.CARDPAY.name) {
scanCardPay.set(true)
when (str) {
PosPayMethod.CCB_BAR_PAY.name,
PosPayMethod.LCSW_BAR_PAY.name->{
payName.set(str)
scanOffline.set(true)
}
PosPayMethod.CARDPAY.name-> scanCardPay.set(true)
}
}
}
......
......@@ -39,7 +39,14 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation project(path: ':common')
implementation project(path: ':base')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'io.github.razerdp:BasePopup:3.1.8'
implementation 'com.github.jenly1314.AppUpdater:app-updater:1.1.0'
implementation 'com.github.getActivity:ToastUtils:9.5'
implementation 'com.aliyun.dpa:oss-android-sdk:2.1.0'
}
\ No newline at end of file
package com.ypsx.ypselfpos.ui.popup
import android.content.Context
import android.view.Gravity
import com.ypsx.base.base.appContext
import com.ypsx.base.ext.util.screenWidth
import com.ypsx.ypselfpos.R
import razerdp.basepopup.BasePopupWindow
class AppUpdaterPopupWindow(context: Context) : BasePopupWindow(context) {
init {
setContentView(R.layout.popup_app_updater)
width = appContext.screenWidth / 4 * 3
setPopupGravity(GravityMode.RELATIVE_TO_ANCHOR, Gravity.CENTER)
isOutSideTouchable = false
setOutSideDismiss(false)
setBackgroundColor(R.color.black_60)
}
override fun onBackPressed(): Boolean {
return false
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -7,4 +7,5 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="black_60">#99000000</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">self_yppos</string>
<string name="app_name">自助收银POS</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment