|
@@ -48,8 +48,9 @@ class FragmentPayScanCode(private val dc: DeviceClass, private val posTrx: PosTr
|
|
|
binding.lifecycleOwner = this
|
|
|
binding.viewModel = viewModel.apply {
|
|
|
nozzle.value = dc.nozzleNo
|
|
|
- amount.value = dc.amount.toDouble()
|
|
|
- amountText.value = StringUtil.get(R.string.amount_rmb, dc.amount.toString())
|
|
|
+ amount.value = dc.myAmount
|
|
|
+ netAmount.value = posTrx.myNetAmount
|
|
|
+ discount.value = posTrx.myDiscount
|
|
|
volume.value = dc.volume
|
|
|
oil.value = dc.productName
|
|
|
time.value = dc.endTimeStamp.substring(5)
|
|
@@ -62,8 +63,6 @@ class FragmentPayScanCode(private val dc: DeviceClass, private val posTrx: PosTr
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
|
|
- viewModel.amountText.value = StringUtil.get(R.string.amount_with_discount, posTrx.netAmount.toString(), posTrx.discount.toString())
|
|
|
-
|
|
|
startPay()
|
|
|
}
|
|
|
|
|
@@ -121,8 +120,9 @@ class FragmentPayScanCode(private val dc: DeviceClass, private val posTrx: PosTr
|
|
|
|
|
|
class PayScanCodeViewModel : ViewModel() {
|
|
|
val nozzle = MutableLiveData(1)
|
|
|
- val amount = MutableLiveData(0.0)
|
|
|
- val amountText = MutableLiveData("¥0.00")
|
|
|
+ val amount = MutableLiveData("0.00")
|
|
|
+ val netAmount = MutableLiveData("0.00")
|
|
|
+ val discount = MutableLiveData("0.00")
|
|
|
val scanTip = MutableLiveData(StringUtil.get(R.string.plz_scan))
|
|
|
val volume = MutableLiveData("0.00")
|
|
|
val oil = MutableLiveData("")
|