feat(payment): 添加会员折扣功能并重构支付逻辑
- 新增 getMemberDiscount 接口用于查询会员折扣 - 在人脸识别支付中集成会员折扣计算逻辑 - 将支付金额计算从 vipPrice 切换到 specPrice 并应用会员折扣 - 在初始化活动中添加设备配置获取功能 - 使用 ConstraintLayout 重构主餐品列表布局 - 添加 Timber 日志框架替换原有 Log 工具 - 重构 MainScreenPresentation 中的食物价格计算逻辑 - 移除重复的设备配置获取代码,统一在 InitActivity 中处理
This commit is contained in:
@@ -86,6 +86,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import org.json.JSONObject
|
||||
import timber.log.Timber
|
||||
import java.io.File
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
@@ -200,6 +201,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
|
||||
override fun initialize() {
|
||||
super.initialize()
|
||||
settlementMode = SpTool.settlementMode
|
||||
isPageVisible = true
|
||||
// 拦截扫码枪按键事件,防止触发页面按钮点击
|
||||
registerKeyEvent()
|
||||
@@ -212,9 +214,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
initData()
|
||||
}
|
||||
|
||||
private fun initLayoutEatDetailBinding(mode: Int) {
|
||||
private fun initLayoutEatDetailBinding() {
|
||||
Timber.tag(TAG).d("initLayoutEatDetailBinding,settlementMode=$settlementMode")
|
||||
binding.flFoodList.removeAllViews()
|
||||
if (mode == 0) {
|
||||
if (settlementMode == 0) {
|
||||
//联合支付
|
||||
val b = LayoutMainFoodList2Binding.inflate(layoutInflater, binding.flFoodList, true)
|
||||
rvFoodList = b.rvFoodList
|
||||
@@ -255,25 +258,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
initLayoutEatDetailBinding(SpTool.settlementMode)
|
||||
viewModel.getDeviceConfig { deviceConfig ->
|
||||
runOnUiThread {
|
||||
if (deviceConfig == null) {
|
||||
ToastUtils.showToast("获取设备配置数据失败")
|
||||
initLayoutEatDetailBinding(SpTool.settlementMode)
|
||||
return@runOnUiThread
|
||||
}
|
||||
//结算模式:1-独立支付,2-联合结算
|
||||
settlementMode = if (deviceConfig.payType == 2) 0 else 1
|
||||
SpTool.settlementMode = settlementMode
|
||||
|
||||
GlobalData.appId = deviceConfig.arcsoftAppId ?: ""
|
||||
GlobalData.sdkKey = deviceConfig.arcsoftSdkKey ?: ""
|
||||
GlobalData.activeKey = deviceConfig.arcsoftActiveKey ?: ""
|
||||
viewModel.activeEngine()
|
||||
initLayoutEatDetailBinding(settlementMode)
|
||||
}
|
||||
}
|
||||
viewModel.activeEngine()
|
||||
initLayoutEatDetailBinding()
|
||||
updateDateTime()
|
||||
binding.tvTitleTime.setOnClickListener {
|
||||
EnvSwitchDialog(context = this, onEnvChanged = {
|
||||
|
||||
Reference in New Issue
Block a user