Commit 197c8c9d authored by UIUANG\Zsc's avatar UIUANG\Zsc

增加现金支付

parent e9bb0e8b
......@@ -4,7 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$USER_HOME$/.gradle/wrapper/dists/gradle-6.1.1-all/cfmwm155h49vnt3hynmlrsdst/gradle-6.1.1" />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/drawable/bg_popup_offer_details.xml" value="0.3508682328907048" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/drawable/btn_confirm_bg.xml" value="0.3508682328907048" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/drawable/edit_bg.xml" value="0.3508682328907048" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_login.xml" value="0.16347124117053483" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_main.xml" value="0.16347124117053483" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/activity_register.xml" value="0.16347124117053483" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay.xml" value="0.33" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_cash_pay_success.xml" value="0.33" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_order_pay_amount.xml" value="0.16347124117053483" />
<entry key="..\:/AndroidProject/YPPos/app/src/main/res/layout/popup_pay_success.xml" value="0.16347124117053483" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
......@@ -15,8 +15,8 @@ android {
applicationId "com.ypsx.yppos"
minSdkVersion 21
targetSdkVersion 30
versionCode 100006
versionName "1.00.006"
versionCode 100007
versionName "1.00.007"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -10,9 +10,9 @@
{
"type": "SINGLE",
"filters": [],
"versionCode": 100006,
"versionName": "1.00.006",
"outputFile": "yppos_v100006-1.00.006-release-2021-11-01.apk"
"versionCode": 100007,
"versionName": "1.00.007",
"outputFile": "yppos_v100007-1.00.007-release-2021-11-11.apk"
}
]
}
\ No newline at end of file
package com.ypsx.yppos.http.data.bean
data class CashPaySuccess(
var payAmount: Double,
var changeAmount: Double,
var roundPrice: Double,
var orderNo: String
)
package com.ypsx.yppos.http.data.bean
data class OrderPayment(
var payMethod: String,
var payTime: String,
var total: Double = 0.00,
)
......@@ -15,5 +15,6 @@ data class UploadOrderResponse(
var total:Double,
var authCode:String,
var payMethod:String,
)
......@@ -4,7 +4,7 @@ enum class PosPayMethod {
CARDPAY,
//扫码聚合支付
CCB_BAR_PAY,
CASHPAY,
CASHPAY,//现金结算
UNIONPAY_POS,
//扫码
OFFLINE_QRCODE_PAY,
......
......@@ -2,6 +2,7 @@ package com.ypsx.yppos.http.data.request
import com.ypsx.yppos.http.data.bean.InsertOrderProductDTO
import com.ypsx.yppos.http.data.bean.OrderActivityResponse
import com.ypsx.yppos.http.data.bean.OrderPayment
data class InsertOrderRequest(
var activitys: List<OrderActivityResponse>? = null,
......@@ -19,7 +20,7 @@ data class InsertOrderRequest(
var posId: String,
var storeId: String,
var status: String,
var roundPrice: Double = 0.0,
var roundPrice: Double = 0.0,//舍分金额
var remark: String? = null,
var products: List<InsertOrderProductDTO>,
......@@ -33,7 +34,9 @@ data class InsertOrderRequest(
// 订单实际支付的金额=totalAmount-discountTotal
var payAmount: Double,
//找零金额
var changeAmount: Double = 0.0,
var changeAmount: Double = 0.0,//找零金额
var payments: List<OrderPayment>? =null
)
)
......@@ -31,12 +31,14 @@ class HttpRequestManger {
* 申请注册
*/
suspend fun applyPos(applyPosMachineRequest: ApplyPosMachineRequest): ApiResponse<PosMachineResponse> {
//清除数据
CacheUtil.setUpdateTimeBigger("")
CacheUtil.setLoginResponse(null)
PosDatabase.clearAllTables()
val applyPosData = apiService.applyPos(applyPosMachineRequest)
if (applyPosData.isSuccess()) {
val id = applyPosData.data
//根据POS机Id查询POS机详情
return apiService.getById(id)
} else {
//抛出错误异常
......@@ -53,6 +55,7 @@ class HttpRequestManger {
return if (registerData.isSuccess()) {
val posId = registerData.data.id
val status = registerData.data.status
//如果在申请中,延时2秒继续获取详情
if (status == PosStatus.APPLY.name) {
delay(2000)
getById(posId)
......@@ -63,9 +66,6 @@ class HttpRequestManger {
} else {
throw AppException(registerData.code, registerData.message)
}
//抛出错误异常
// throw AppException(registerData.code, registerData.message)
}
/**
......@@ -81,17 +81,20 @@ class HttpRequestManger {
val loginData = apiService.posLogin(loginRequest)
if (loginData.isSuccess()) {
val data = loginData.data
//保存登录信息
CacheUtil.setLoginResponse(data)
val posConfigData = apiService.getByPosId(posId)
if (posConfigData.isSuccess()) {
val configData = posConfigData.data
//保存到数据库
PosConfigRepository.getInstance().savePosConfig(posId, configData)
val askTime = CacheUtil.getUpdateTimeBigger()
val currentTime = DateUtil.getTodayDateTime()
//增量获取商品信息
val productList = apiService.getProductList(storeId, askTime)
if (productList.isSuccess()) {
PosProductRepository.getInstance().insertAll(productList.data)
//更新时间
CacheUtil.setUpdateTimeBigger(currentTime)
return loginData
} else {
......@@ -115,6 +118,7 @@ class HttpRequestManger {
payMethod: PosPayMethod
): UploadOrderResponse {
val list = arrayListOf(insertOrderRequest)
//上传订单
val uploadOrderData = apiService.uploadOrder(list)
if (uploadOrderData.isSuccess()) {
......@@ -123,6 +127,10 @@ class HttpRequestManger {
val data = uploadData[0]
val success = data.success
if (success) {
if (payMethod == PosPayMethod.CASHPAY) {
data.payMethod = payMethod.name
return data
}
var cardPayPassword: String? = null
if (payMethod == PosPayMethod.CARDPAY) {
cardPayPassword = ""
......@@ -135,10 +143,12 @@ class HttpRequestManger {
total = insertOrderRequest.payAmount,
cardPayPassword = cardPayPassword
)
//获得对应的支付订单签名
val cashPaySignData = apiService.getCashPaySign(unifiedCashPaySignRequest)
if (cashPaySignData.isSuccess()) {
data.total = insertOrderRequest.payAmount
data.authCode = authCode
data.payMethod = payMethod.name
return data
} else {
throw AppException(cashPaySignData.code, cashPaySignData.getResponseMsg())
......@@ -195,6 +205,7 @@ class HttpRequestManger {
replyCommand(commandResponse.id)
val startTime = System.currentTimeMillis()
when (commandResponse.type) {
//上传日志文件
PosCommandType.UPLOAD_LOG.name -> {
//压缩文件
var todayDate = DateUtil.getTodayDate()
......@@ -213,13 +224,11 @@ class HttpRequestManger {
var millis = System.currentTimeMillis() - currentTimeMillis
LogUtils.debugInfo("压缩使用${millis}s")
// zipFile(upLoadUrl,zipUrl)
// zipUrl.dXLog()
saveCommand(zipUrl, startTime, commandResponse)
// upload.toString().dXLog()
}
//上传数据库
PosCommandType.UPLOAD_DB.name -> {
val databasePath = appContext.getDatabasePath(name)
val currentTimeMillis = System.currentTimeMillis()
......
......@@ -70,9 +70,9 @@ class LogService : Service() {
private fun createEmptyNotification() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var channel = NotificationChannel(
val channel = NotificationChannel(
"CHANNEL_ID", "CHANNEL_NAME",
NotificationManager.IMPORTANCE_HIGH
NotificationManager.IMPORTANCE_MIN
)
val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
......
......@@ -71,7 +71,7 @@ class SyncProductService: Service() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var channel = NotificationChannel(
"CHANNEL_ID", "CHANNEL_NAME",
NotificationManager.IMPORTANCE_HIGH
NotificationManager.IMPORTANCE_MIN
)
val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
manager.createNotificationChannel(channel)
......@@ -79,6 +79,7 @@ class SyncProductService: Service() {
Notification.Builder(appContext, "CHANNEL_ID")
.setContentTitle("后台服务")
.setSmallIcon(R.drawable.icon_yp_logo)
.setOnlyAlertOnce(true)
.build()
startForeground(1, notification)
// startForeground(1, new Notification());
......
......@@ -33,6 +33,8 @@ import com.ypsx.yppos.viewmodel.request.RequestMainViewModel
import com.ypsx.yppos.viewmodel.state.MainViewModel
import kotlinx.android.synthetic.main.activity_main.*
import razerdp.basepopup.BasePopupWindow.*
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.*
import kotlin.collections.ArrayList
import kotlin.system.exitProcess
......@@ -352,30 +354,60 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
orderPayAmountPopupWindow.setData(orderNo, payment)
orderPayAmountPopupWindow.setPayClick { it ->
orderPayAmountPopupWindow.dismiss()
payAmountPopupWindow = PayAmountPopupWindow(this@MainActivity)
payAmountPopupWindow?.showPopupWindow()
payAmountPopupWindow?.setData(it, payment)
payAmountPopupWindow?.onDismissListener = object :
OnDismissListener() {
override fun onDismiss() {
payAmountPopupWindow = null
if (it == PosPayMethod.CASHPAY) {
val cashPayPopupWindow = CashPayPopupWindow(this@MainActivity)
cashPayPopupWindow.showPopupWindow()
cashPayPopupWindow.setData(it, payment)
cashPayPopupWindow.setCashPayClick { payMethod, receivablesMoney, roundMoney, changeMoney, payMoney ->
cashPayPopupWindow.dismiss()
var orderNo = mViewModel.orderNo.get()
var totalAmount = mViewModel.payAmount.get()
var payAmount = mViewModel.payAmount.get()
var promotionOnSaleTotal = mViewModel.discountSpecial.get()
var discountTotal = mViewModel.discountMoney.get()
var data = orderProductAdapter.data
var arrayList = ArrayList<InsertOrderProductDTO>()
arrayList.addAll(data)
arrayList.addAll(posBuyPartsDeleted)
"$realName 付款方式:${payMethod.name} ".dXLog()
requestMainViewModel.createOrder(
orderNo,
totalAmount.toDouble(),
payAmount.toDouble(),
promotionOnSaleTotal.toDouble(),
discountTotal.toDouble(),
arrayList,
payMethod,
"", roundMoney, changeMoney
)
}
}
payAmountPopupWindow?.setKeyEventListener { event ->
scanGunKeyEventHelper?.analysisKeyEvent(event)
return@setKeyEventListener true
}
payAmountPopupWindow?.setFinishClick {
payAmountPopupWindow?.dismiss()
"${realName}支付超时".dXLog()
val messageDialog = MessagePopupWindow(this@MainActivity)
messageDialog.showPopupWindow()
messageDialog.setData("支付超时", "请确认是否支付成功", gone = false)
messageDialog.setMessageClick {
messageDialog.dismiss()
mViewModel.resetOrderNo()
productPromotionRequest.orderNo = mViewModel.orderNo.get()
"${realName}点击我知道了,并重置小票号:${productPromotionRequest.orderNo}".dXLog()
} else {
payAmountPopupWindow = PayAmountPopupWindow(this@MainActivity)
payAmountPopupWindow?.showPopupWindow()
payAmountPopupWindow?.setData(it, payment)
payAmountPopupWindow?.onDismissListener = object :
OnDismissListener() {
override fun onDismiss() {
payAmountPopupWindow = null
}
}
payAmountPopupWindow?.setKeyEventListener { event ->
scanGunKeyEventHelper?.analysisKeyEvent(event)
return@setKeyEventListener true
}
payAmountPopupWindow?.setFinishClick {
payAmountPopupWindow?.dismiss()
"${realName}支付超时".dXLog()
val messageDialog = MessagePopupWindow(this@MainActivity)
messageDialog.showPopupWindow()
messageDialog.setData("支付超时", "请确认是否支付成功", gone = false)
messageDialog.setMessageClick {
messageDialog.dismiss()
mViewModel.resetOrderNo()
productPromotionRequest.orderNo = mViewModel.orderNo.get()
"${realName}点击我知道了,并重置小票号:${productPromotionRequest.orderNo}".dXLog()
}
}
}
}
......@@ -423,13 +455,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
val orderId = it.data?.orderId
val total = it.data?.total
var authCode = it.data?.authCode
if (payAmountPopupWindow != null && payAmountPopupWindow!!.isShowing && payAmountPopupWindow!!.timeIsStart()) {
payAmountPopupWindow?.setShowTimer()
requestMainViewModel.getStateByOrderId(orderId!!, total!!, authCode!!)
}
//支付成功后,
// 获取支付状态
//获取订单详情 进行打印
......@@ -452,7 +481,10 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
})
requestMainViewModel.paySuccessState.observe(this, {
payAmountPopupWindow!!.dismiss()
if (payAmountPopupWindow != null) {
payAmountPopupWindow!!.dismiss()
}
if (it.isSuccess) {
if (payFailedPopWindow != null) {
payFailedPopWindow!!.dismiss()
......@@ -462,14 +494,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
paySuccessPopWindow!!.setData(it.data!!)
paySuccessPopWindow!!.onDismissListener = object : OnDismissListener() {
override fun onDismiss() {
mViewModel.resetOrderNo()
mViewModel.resetAmount()
productPromotionRequest.orderNo = mViewModel.orderNo.get()
productPromotionRequest.products.clear()
posBuyPartsDeleted.clear()
mViewModel.recyclerShow.set(false)
orderProductAdapter.data.clear()
orderProductAdapter.notifyDataSetChanged()
paySuccessView()
}
}
} else {
......@@ -491,6 +516,33 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>(),
})
}
})
requestMainViewModel.paySuccessStateCash.observe(this, {
val payAmount =
BigDecimal(it.data!!.payAmount).minus(BigDecimal.valueOf(it.data!!.roundPrice))
.plus(
BigDecimal.valueOf(it.data!!.changeAmount)
).setScale(2,RoundingMode.HALF_UP).toString()
val paySuccessPopWindow = CashPaySuccessPopWindow(this)
paySuccessPopWindow.showPopupWindow()
paySuccessPopWindow.setData(payAmount,it.data!!.changeAmount.toString())
paySuccessPopWindow.onDismissListener = object : OnDismissListener() {
override fun onDismiss() {
paySuccessView()
}
}
})
}
private fun paySuccessView() {
mViewModel.resetOrderNo()
mViewModel.resetAmount()
productPromotionRequest.orderNo = mViewModel.orderNo.get()
productPromotionRequest.products.clear()
posBuyPartsDeleted.clear()
mViewModel.recyclerShow.set(false)
orderProductAdapter.data.clear()
orderProductAdapter.notifyDataSetChanged()
}
......
package com.ypsx.yppos.ui.popup
import android.content.Context
import android.view.Gravity
import android.view.View
import android.view.inputmethod.EditorInfo
import com.ypsx.base.base.appContext
import com.ypsx.base.ext.util.screenWidth
import com.ypsx.base.ext.view.afterTextChange
import com.ypsx.base.util.dXLog
import com.ypsx.yppos.R
import com.ypsx.yppos.databinding.PopupCashPayBinding
import com.ypsx.yppos.http.data.entity.PosPayMethod
import com.ypsx.yppos.utils.CashierInputFilter
import com.ypsx.yppos.utils.toastFailed
import com.ypsx.yppos.viewmodel.state.CashPayViewModel
import razerdp.basepopup.BasePopupWindow
import java.math.BigDecimal
import java.math.RoundingMode
class CashPayPopupWindow(context: Context) : BasePopupWindow(context) {
lateinit var bind: PopupCashPayBinding
private var roundMoney: Double = 0.0
lateinit var payMethod: PosPayMethod
var payAction: (item: PosPayMethod, receivablesMoney: Double, roundMoney: Double, changeMoney: Double, payMoney: Double) -> Unit =
{ _: PosPayMethod, _: Double, _: Double, _: Double, _: Double-> }
init {
setContentView(R.layout.popup_cash_pay)
width = appContext.screenWidth / 4 * 3
popupGravity = Gravity.CENTER
isOutSideTouchable = false
setOutSideDismiss(false)
}
override fun onViewCreated(contentView: View) {
// 透出应付金额,应付金额四舍五入到分位(记录舍分金额)
bind = PopupCashPayBinding.bind(contentView)
bind.vm = CashPayViewModel()
bind.click = ProxyClick()
setAutoShowKeyboard(bind.textView20, true)
setKeyboardAdaptive(true)
setKeyboardAdaptionMode(bind.textView23,
FLAG_KEYBOARD_ALIGN_TO_ROOT or FLAG_KEYBOARD_ANIMATE_ALIGN
)
bind.textView20.filters = arrayOf(CashierInputFilter())
bind.textView20.afterTextChange {
if (it.isEmpty()) {
bind.vm?.changeMoney?.set(0.0)
bind.vm?.change2?.set("¥${bind.vm?.changeMoney?.get()}")
} else {
val payMoney: Double? = bind.vm?.receivables?.get()
if (payMoney != null) {
if (payMoney <= it.toDouble()) {
val scale = BigDecimal(it).minus(BigDecimal.valueOf(payMoney)).setScale(1)
bind.vm?.changeMoney?.set(scale.toDouble())
bind.vm?.change2?.set("¥${bind.vm?.changeMoney?.get()}")
}else{
bind.vm?.changeMoney?.set(0.0)
bind.vm?.change2?.set("¥${bind.vm?.changeMoney?.get()}")
}
}
}
}
bind.textView20.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
ProxyClick().confirm()
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}
}
fun setData(payMethod: PosPayMethod, amount: String) {
this.payMethod = payMethod
val rawData = BigDecimal(amount)
val scale = rawData.setScale(1, RoundingMode.HALF_UP)
roundMoney = (rawData - scale).toDouble()
bind.vm?.receivables?.set(scale.toDouble())
bind.vm?.receivables2?.set("¥$scale")
// bind.vm?.actuallyPaid?.set(scale.toString())
bind.vm?.changeMoney?.set(0.0)
bind.vm?.change2?.set("¥${bind.vm?.changeMoney?.get()}")
"舍分金额:$roundMoney".dXLog()
}
inner class ProxyClick {
fun close() {
dismiss()
}
fun confirm() {
val payMoney:String = bind.textView20.text.toString()
val receivables: Double? = bind.vm?.receivables?.get()
val changeMoney:Double? = bind.vm?.changeMoney?.get()
if (payMoney.isEmpty()) {
"应付金额不允许为空!".toastFailed()
return
}
if (receivables != null && changeMoney != null) {
if (receivables > payMoney.toDouble()) {
"实付金额不允许小于应付金额".toastFailed()
return
}
"应付金额:$receivables 舍分金额:$roundMoney 找零金额$changeMoney 实付金额:$payMoney".dXLog()
payAction.invoke(
payMethod,
receivables,
roundMoney,
changeMoney,
payMoney.toDouble()
)
}
}
}
fun setCashPayClick(payAction: (item: PosPayMethod, receivablesMoney: Double, roundMoney: Double, changeMoney: Double, payMoney: Double) -> Unit) {
this.payAction = payAction
}
}
\ No newline at end of file
package com.ypsx.yppos.ui.popup
import android.app.Activity
import android.content.Context
import android.view.Gravity
import android.view.View
import com.ypsx.base.base.appContext
import com.ypsx.base.ext.util.screenWidth
import com.ypsx.yppos.R
import com.ypsx.yppos.databinding.PopupCashPaySuccessBinding
import com.ypsx.yppos.viewmodel.state.PaySuccessViewModel
import razerdp.basepopup.BasePopupWindow
import java.util.*
class CashPaySuccessPopWindow(context: Context) : BasePopupWindow(context) {
lateinit var bind: PopupCashPaySuccessBinding
var timer: Timer? = null
var task: TimerTask? = null
var recLen = 5
lateinit var activity: Activity
init {
setContentView(R.layout.popup_cash_pay_success)
width = appContext.screenWidth / 4 * 3
popupGravity = Gravity.CENTER
isOutSideTouchable = false
setOutSideDismiss(false)
}
private fun stopTimer() {
if (task != null && timer != null) {
timer?.cancel()
timer?.purge()
timer = null
task = null
}
}
override fun onViewCreated(contentView: View) {
bind = PopupCashPaySuccessBinding.bind(contentView)
bind.vm = PaySuccessViewModel()
bind.click = ProxyClick()
activity = context
timer = Timer()
task = object : TimerTask() {
override fun run() {
recLen--
if (recLen < 0) {
if (isShowing) {
activity.runOnUiThread {
dismiss()
}
}
stopTimer()
}
}
}
timer?.schedule(task, 1000, 1000);
}
fun setData(payAmount: String,changeAmount:String) {
bind.vm?.payAmount?.set(payAmount)
bind.vm?.changeAmount?.set(changeAmount)
}
override fun dismiss() {
super.dismiss()
stopTimer()
}
inner class ProxyClick {
fun close() {
dismiss()
}
}
}
\ No newline at end of file
......@@ -33,15 +33,27 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
bind?.vm = OrderPayAmountViewModel()
bind?.click = ProxyClick()
val offline: Boolean = bind?.vm?.scanOffline?.get() == false
val cardPay: Boolean = bind?.vm?.scanCardPay?.get() == false
if (offline && cardPay) {
bind?.rbOffline?.isChecked = true
bind?.rbCardPay?.isChecked = false
} else if (offline && !cardPay) {
bind?.rbOffline?.isChecked = true
} else if (!offline && cardPay) {
bind?.rbCardPay?.isChecked = true
// val offline: Boolean = bind?.vm?.scanOffline?.get() == false
// val cardPay: Boolean = bind?.vm?.scanCardPay?.get() == false
// val cashPay: Boolean = bind?.vm?.scanCashPay?.get() == false
when (bind?.vm?.firstName?.get()) {
PosPayMethod.CCB_BAR_PAY.name,
PosPayMethod.LCSW_BAR_PAY.name -> {
bind?.rbOffline?.isChecked = true
bind?.rbCardPay?.isChecked = false
bind?.rbCash?.isChecked = false
}
PosPayMethod.CARDPAY.name -> {
bind?.rbOffline?.isChecked = false
bind?.rbCardPay?.isChecked = true
bind?.rbCash?.isChecked = false
}
PosPayMethod.CASHPAY.name -> {
bind?.rbOffline?.isChecked = false
bind?.rbCardPay?.isChecked = false
bind?.rbCash?.isChecked = true
}
}
}
......@@ -94,6 +106,7 @@ class OrderPayAmountPopupWindow(context: Context) : BasePopupWindow(context) {
}
}
R.id.rb_cash->PosPayMethod.CASHPAY
R.id.rbCardPay -> PosPayMethod.CARDPAY
else -> PosPayMethod.CCB_BAR_PAY
}
......
package com.ypsx.yppos.utils;
import android.text.InputFilter;
import android.text.Spanned;
import android.text.TextUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CashierInputFilter implements InputFilter {
Pattern mPattern;
//输入的最大金额
private static final double MAX_VALUE = 9999.9;
//小数点后的位数
private static final int POINTER_LENGTH = 1;
private static final String POINTER = ".";
private static final String ZERO = "0";
public CashierInputFilter() {
mPattern = Pattern.compile("([0-9]|\\.)*");
}
/**
* @param source 新输入的字符串
* @param start 新输入的字符串起始下标,一般为0
* @param end 新输入的字符串终点下标,一般为source长度-1
* @param dest 输入之前文本框内容
* @param dstart 原内容起始坐标,一般为0
* @param dend 原内容终点坐标,一般为dest长度-1
* @return 输入内容
*/
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
String sourceText = source.toString();
String destText = dest.toString();
//验证删除等按键
if (TextUtils.isEmpty(sourceText)) {
return "";
}
Matcher matcher = mPattern.matcher(source);
//已经输入小数点的情况下,只能输入数字
if(destText.contains(POINTER)) {
if (!matcher.matches()) {
return "";
} else {
if (POINTER.equals(source.toString())) { //只能输入一个小数点
return "";
}
}
//验证小数点精度,保证小数点后只能输入两位
int index = destText.indexOf(POINTER);
int length = dend - index;
if (length > POINTER_LENGTH) {
return dest.subSequence(dstart, dend);
}
} else {
/**
* 没有输入小数点的情况下,只能输入小数点和数字
* 1. 首位不能输入小数点
* 2. 如果首位输入0,则接下来只能输入小数点了
*/
if (!matcher.matches()) {
return "";
} else {
if ((POINTER.equals(source.toString())) && TextUtils.isEmpty(destText)) { //首位不能输入小数点
return "";
} else if (!POINTER.equals(source.toString()) && ZERO.equals(destText)) { //如果首位输入0,接下来只能输入小数点
return "";
}
}
}
//验证输入金额的大小
double sumText = Double.parseDouble(destText + sourceText);
if (sumText > MAX_VALUE) {
return dest.subSequence(dstart, dend);
}
return dest.subSequence(dstart, dend) + sourceText;
}
}
......@@ -17,6 +17,8 @@ import com.ypsx.yppos.room.entity.PosBuy
import com.ypsx.yppos.room.entity.PosBuyPart
import com.ypsx.yppos.room.entity.PosBuyPayment
import com.ypsx.yppos.room.entity.PosConfig
import java.math.BigDecimal
import java.math.RoundingMode
private const val PRNSTS_OK = 0 //OK
......@@ -239,7 +241,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
getAmountCenterSpace(
"应付款:${orderResponse.payAmount}",
"应付款:${orderResponse.totalAmount}",
"数量:${orderResponse.buyNumber}"
),
0,
......@@ -252,10 +254,14 @@ object PrintUtils {
fontStyle,
0
)
val minus = BigDecimal.valueOf(orderResponse.totalAmount)
.minus(BigDecimal.valueOf(orderResponse.roundPrice))
val scale1 =
minus.plus(BigDecimal.valueOf(orderResponse.changeAmount))
.setScale(2).toDouble()
height += printerManager.drawTextEx(
getAmountCenterSpace(
"实付款:${orderResponse.payAmount}",
"实付款:${scale1}",
"找零金额:${orderResponse.changeAmount}"
),
0,
......@@ -274,9 +280,9 @@ object PrintUtils {
)
var payments = orderResponse.payments
var payMethod = ""
var total = ""
var total = orderResponse.totalAmount
if (payments.isNotEmpty()) {
total = payments[0].total.toString()
payMethod = when (payments[0].payMethod) {
PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付"
......@@ -284,17 +290,22 @@ object PrintUtils {
PosPayMethod.CARDPAY.name -> {
"会员余额支付"
}
PosPayMethod.CASHPAY.name->{
"现金支付"
}
else -> {
""
}
}
}else{
payMethod = "现金支付"
}
height += printerManager.drawTextEx(
"付款方式:$payMethod $total", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
val scale = minus.setScale(2).toDouble()
height += printerManager.drawTextEx(
" 实际扣款:${total}", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
" 实际扣款:${scale}", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
height += printerManager.drawTextEx(
......@@ -710,7 +721,7 @@ object PrintUtils {
height += printerManager.drawTextEx(
getAmountCenterSpace(
"应付款:${posBuy.payAmount}",
"应付款:${posBuy.totalAmount}",
"数量:${posBuy.buyNumber}"
),
0,
......@@ -723,10 +734,14 @@ object PrintUtils {
fontStyle,
0
)
val minus = BigDecimal.valueOf(posBuy.totalAmount)
.minus(BigDecimal.valueOf(posBuy.roundPrice))
val scale1 =
minus.plus(BigDecimal.valueOf(posBuy.changeAmount))
.setScale(2, RoundingMode.HALF_UP).toDouble()
height += printerManager.drawTextEx(
getAmountCenterSpace(
"实付款:${posBuy.payAmount}",
"实付款:${scale1}",
"找零金额:${posBuy.changeAmount}"
),
0,
......@@ -746,26 +761,30 @@ object PrintUtils {
var payMethod = ""
var total = ""
if (posBuyPayment != null) {
total = posBuyPayment.total.toString()
payMethod = when (posBuyPayment.payMethod) {
payMethod = if (posBuyPayment == null) {
"现金支付"
} else {
when (posBuyPayment.payMethod) {
PosPayMethod.CCB_BAR_PAY.name, PosPayMethod.LCSW_BAR_PAY.name -> {
"扫码支付"
}
PosPayMethod.CARDPAY.name -> {
"会员余额支付"
}
PosPayMethod.CASHPAY.name -> {
"现金支付"
}
else -> {
""
}
}
}
height += printerManager.drawTextEx(
"付款方式:$payMethod $total", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
"付款方式:$payMethod ${posBuy.totalAmount}", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
val scale = minus.setScale(2).toDouble()
height += printerManager.drawTextEx(
" 实际扣款:${total}", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
" 实际扣款:${scale}", 0, height, 384, -1, fontName, fontSize, 0, fontStyle, 0
)
height += printerManager.drawTextEx(
......
......@@ -7,7 +7,6 @@ import com.ypsx.base.ext.launch
import com.ypsx.base.ext.request
import com.ypsx.base.ext.requestNoCheck
import com.ypsx.base.ext.util.toJson
import com.ypsx.base.network.AppException
import com.ypsx.base.util.dXLog
import com.ypsx.yppos.http.apiService
import com.ypsx.yppos.http.data.bean.*
......@@ -44,6 +43,7 @@ class RequestMainViewModel : BaseViewModel() {
var payState = MutableLiveData<UpdateUiState<UploadOrderResponse>>()
val paySuccessState = MutableLiveData<UpdateUiState<String>>()
val paySuccessStateCash = MutableLiveData<UpdateUiState<CashPaySuccess>>()
init {
......@@ -132,7 +132,7 @@ class RequestMainViewModel : BaseViewModel() {
if (posProduct?.style == PosProductStyle.WEIGHT.name) {
listNum += 1
}else if (posProduct?.style == PosProductStyle.SINGLE.name) {
} else if (posProduct?.style == PosProductStyle.SINGLE.name) {
listNum += product.quantity.toInt()
}
val amount: Double = product.price.times(product.quantity) ?: 0.0
......@@ -237,11 +237,11 @@ class RequestMainViewModel : BaseViewModel() {
}
if (posProduct?.style == PosProductStyle.WEIGHT.name) {
listNum += 1
}else if (posProduct?.style == PosProductStyle.SINGLE.name) {
} else if (posProduct?.style == PosProductStyle.SINGLE.name) {
listNum += product.quantity.toInt()
}
var activityInfo = product.activityInfo
var activitys:ArrayList<ActivityInfoDTO> = arrayListOf()
var activitys: ArrayList<ActivityInfoDTO> = arrayListOf()
if (activityInfo != null) {
activitys.add(activityInfo)
}
......@@ -283,7 +283,7 @@ class RequestMainViewModel : BaseViewModel() {
payAmountBean.postValue(
PayAmountBean(
BigDecimalUtils.forPlus(discountTotal),
BigDecimalUtils.forPlus( payApportionAmount),
BigDecimalUtils.forPlus(payApportionAmount),
BigDecimalUtils.forPlus(discountMoney),
BigDecimalUtils.forPlus(discountTime),
BigDecimalUtils.forPlus(discountSpecial),
......@@ -305,12 +305,19 @@ class RequestMainViewModel : BaseViewModel() {
discountTotal: Double,
productList: List<InsertOrderProductDTO>,
payMethod: PosPayMethod,
barcode: String
barcode: String,
roundMoney: Double = 0.0, changeMoney: Double = 0.0
) {
val status = when (payMethod) {
PosPayMethod.CASHPAY -> "FINISHED"
else -> "CREATED"
}
val loginResponse = CacheUtil.getLoginResponse()
val dataTime = DateUtil.getTodayDateTime()
val insertOrderRequest = InsertOrderRequest(
activitys = orderPromotions,
createTime = DateUtil.getTodayDateTime(),
createTime = dataTime,
creatorId = loginResponse!!.loginUser.username ?: "",
creatorName = loginResponse.loginUser.realName ?: "",
orderNo = orderNo,
......@@ -319,18 +326,36 @@ class RequestMainViewModel : BaseViewModel() {
mobile = "",
posId = posConfig?.id ?: "",
storeId = posConfig?.storeId ?: "",
status = "CREATED",
status = status,
products = productList,
totalAmount = totalAmount,
promotionOnSaleTotal = promotionOnSaleTotal,
discountTotal = discountTotal,
payAmount = payAmount,
roundPrice = roundMoney,
changeAmount = changeMoney,
payments = if (payMethod == PosPayMethod.CASHPAY)
arrayListOf(
OrderPayment(
payMethod = payMethod.name,
payTime = dataTime,
total = totalAmount
)
) else null
)
requestNoCheck({
HttpRequestCoroutine.createOrder(insertOrderRequest, barcode, payMethod)
}, {
val uiState = UpdateUiState(isSuccess = true, it)
payState.postValue(uiState)
if (it.payMethod == PosPayMethod.CASHPAY.name) {
getOrderDetailById(it.orderId, "")
val cashPaySuccess = CashPaySuccess(payAmount, changeMoney, roundMoney, orderNo)
val uiState = UpdateUiState(isSuccess = true, cashPaySuccess)
paySuccessStateCash.postValue(uiState)
} else {
val uiState = UpdateUiState(isSuccess = true, it)
payState.postValue(uiState)
}
}, {
val uiState = UpdateUiState(isSuccess = false, data = "", it.errorMsg)
paySuccessState.postValue(uiState)
......@@ -393,7 +418,4 @@ class RequestMainViewModel : BaseViewModel() {
}
}
\ No newline at end of file
package com.ypsx.yppos.viewmodel.state
import com.ypsx.base.base.viewmodel.BaseViewModel
import com.ypsx.base.callback.databind.DoubleObservableField
import com.ypsx.base.callback.databind.StringObservableField
class CashPayViewModel : BaseViewModel() {
//
var receivables = DoubleObservableField()
var receivables2 = StringObservableField("¥" + receivables.get())
var actuallyPaid = StringObservableField()
//找零借
var changeMoney = DoubleObservableField(0.0)
var change2 = StringObservableField("¥${changeMoney.get()}")
}
\ No newline at end of file
......@@ -19,8 +19,10 @@ class OrderPayAmountViewModel : BaseViewModel() {
var scanOffline = BooleanObservableField(false)
var scanCardPay = BooleanObservableField(false)
var scanCashPay = BooleanObservableField(false)
var payName = StringObservableField("")
var firstName = StringObservableField("")
var offlineVisible = object : ObservableInt(scanOffline) {
......@@ -33,6 +35,16 @@ class OrderPayAmountViewModel : BaseViewModel() {
}
}
var cashVisible = object : ObservableInt(scanCashPay) {
override fun get(): Int {
return if (scanCashPay.get()) {
View.VISIBLE
} else {
View.GONE
}
}
}
var cardPayVisible = object : ObservableInt(scanCardPay) {
override fun get(): Int {
return if (scanCardPay.get()) {
......@@ -53,13 +65,36 @@ class OrderPayAmountViewModel : BaseViewModel() {
for (str in payMethod) {
when (str) {
PosPayMethod.CCB_BAR_PAY.name,
PosPayMethod.LCSW_BAR_PAY.name->{
PosPayMethod.LCSW_BAR_PAY.name -> {
payName.set(str)
scanOffline.set(true)
}
PosPayMethod.CARDPAY.name-> scanCardPay.set(true)
PosPayMethod.CARDPAY.name -> scanCardPay.set(true)
PosPayMethod.CASHPAY.name -> scanCashPay.set(true)
}
}
when {
payMethods.contains(PosPayMethod.CASHPAY.name) -> {
firstName.set(PosPayMethod.CASHPAY.name)
return@launch
}
payMethods.contains(PosPayMethod.CCB_BAR_PAY.name) -> {
firstName.set(PosPayMethod.CCB_BAR_PAY.name)
return@launch
}
payMethods.contains(PosPayMethod.LCSW_BAR_PAY.name) -> {
firstName.set(PosPayMethod.LCSW_BAR_PAY.name)
return@launch
}
payMethods.contains(PosPayMethod.CARDPAY.name) -> {
firstName.set(PosPayMethod.CARDPAY.name)
return@launch
}
}
}
}
......
......@@ -6,6 +6,8 @@ import com.ypsx.base.callback.databind.StringObservableField
class PaySuccessViewModel : BaseViewModel() {
var amount = StringObservableField()
var payAmount = StringObservableField()
var changeAmount = StringObservableField()
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffa14eff" />
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#ffd8d8d8" />
<corners android:radius="2dp" />
</shape>
\ No newline at end of file
<?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"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="vm"
type="com.ypsx.yppos.viewmodel.state.CashPayViewModel" />
<variable
name="click"
type="com.ypsx.yppos.ui.popup.CashPayPopupWindow.ProxyClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog">
<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:text="@string/cash_pay"
android:textColor="@color/black"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_popup_close"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:onClick="@{()->click.close()}"
app:layout_constraintBottom_toBottomOf="@+id/tv_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_popup_close" />
<TextView
android:id="@+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingStart="20dp"
android:text="应收款:"
android:textColor="#969696"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
<TextView
android:id="@+id/textView19"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingEnd="20dp"
android:text="@{vm.receivables2}"
android:textColor="#FF4400"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView18"
app:layout_constraintTop_toBottomOf="@+id/tv_title"
tools:text="¥12.34" />
<TextView
android:id="@+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingStart="20dp"
android:text="实付款:"
android:textColor="#969696"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView18" />
<EditText
android:id="@+id/textView20"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:background="@drawable/edit_bg"
android:paddingVertical="15dp"
android:paddingStart="10dp"
android:imeOptions="actionDone"
android:hint="@{String.valueOf(vm.receivables)}"
android:inputType="numberDecimal"
android:digits="0123456789."
android:text="@={vm.actuallyPaid}"
android:textColor="#333333"
android:textColorHint="#999999"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView17"
app:layout_constraintTop_toBottomOf="@+id/textView19" />
<TextView
android:id="@+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingStart="20dp"
android:text="找零:&#12288;"
android:textColor="#969696"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView17" />
<TextView
android:id="@+id/textView22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingVertical="15dp"
android:paddingEnd="20dp"
android:maxLength="6"
android:text="@{vm.change2}"
android:textColor="#333333"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textView21"
app:layout_constraintTop_toBottomOf="@+id/textView20"
tools:text="123" />
<TextView
android:id="@+id/textView23"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginHorizontal="20dp"
android:text="确认"
android:onClick="@{()->click.confirm()}"
android:layout_marginVertical="15dp"
android:background="@drawable/btn_confirm_bg"
android:textColor="@color/white"
android:textSize="20sp"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView22"
app:layout_constraintVertical_bias="1.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?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"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingDefaultResource">
<data>
<variable
name="vm"
type="com.ypsx.yppos.viewmodel.state.PaySuccessViewModel" />
<variable
name="click"
type="com.ypsx.yppos.ui.popup.CashPaySuccessPopWindow.ProxyClick" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_popup_pay">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageView6"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_pay_success" />
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:text="@string/pay_success"
android:textColor="@color/black_333"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView6" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_333"
android:textSize="22dp"
android:text="收款:"
/>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rmb"
android:textSize="22dp"
android:textColor="@color/red" />
<TextView
android:id="@+id/tv_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{vm.payAmount}"
android:textColor="@color/red"
android:textSize="22dp"
tools:text="112.32" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black_333"
android:textSize="22dp"
android:text="找零:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rmb"
android:textSize="22dp"
android:textColor="@color/red" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{vm.changeAmount}"
android:textColor="@color/red"
android:textSize="22dp"
tools:text="12.32" />
</LinearLayout>
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="5s后自动关闭"
android:textColor="@color/colorAccent"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="0.5dp"
android:layout_marginTop="20dp"
android:background="@color/black_333"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView9" />
<TextView
android:id="@+id/textView10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/close"
android:onClick="@{()->click.close()}"
android:textColor="@color/black_333"
android:gravity="center"
android:textSize="18sp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -138,6 +138,23 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/constraintLayout4">
<RadioButton
android:id="@+id/rb_cash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/bg_pay_amount_check"
android:button="@null"
android:checked="true"
android:drawableEnd="@drawable/bg_pay_amount"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/cash_pay"
android:visibility="@{vm.cashVisible}"
android:textColor="#4D4D4D"
android:textSize="16sp" />
<RadioButton
android:id="@+id/rb_offline"
android:layout_width="match_parent"
......
......@@ -33,6 +33,7 @@
<string name="total_discount_amount">总优惠金额:</string>
<string name="checkout_counter">收银台</string>
<string name="order_no">小票流水号</string>
<string name="cash_pay">现金</string>
<string name="scan_qr_pay">扫码支付</string>
<string name="member_balance_pay">会员余额</string>
<string name="receive_payment_now">立即收款</string>
......
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