联合支付功能测试
This commit is contained in:
@@ -61,7 +61,8 @@
|
||||
<!-- </activity>-->
|
||||
<!-- <activity android:name="com.sw.dualscreen.activity.CollectedDataActivity" />-->
|
||||
<activity android:name="com.sw.dualscreen.activity.SettingActivity"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
|
||||
android:launchMode="singleTask" />
|
||||
<activity android:name="com.sw.dualscreen.activity.CollectedFoodActivity"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
<activity android:name="com.sw.dualscreen.activity.PayActivity"
|
||||
|
||||
@@ -255,40 +255,72 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
binding.ivImg.load(imgUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* 联合支付-即放即取模式
|
||||
*/
|
||||
private fun loadJFJQBySettlement(weight: Int) {
|
||||
//即放即取+联合支付人脸查询订单完成
|
||||
if (presentation!!.jointPaymentQueryFinish) {
|
||||
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
||||
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
||||
return
|
||||
}
|
||||
//重量小于等于5克时改为识别中页面
|
||||
isAnalyzing = false
|
||||
presentation?.step1FoodRecognizing()
|
||||
return
|
||||
}
|
||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||
//秤上重量过下,显示识别中页面
|
||||
presentation?.step1FoodRecognizing()
|
||||
return
|
||||
}
|
||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||
if (weight != lastWeight) {
|
||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||
}
|
||||
recognizeByWeight(weight, isWeightChange)
|
||||
}
|
||||
|
||||
/**
|
||||
* 联合支付-余量计量模式
|
||||
*/
|
||||
private fun loadYLJLBySettlement(weight: Int) {
|
||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||
//秤上重量过小,显示识别中页面
|
||||
presentation?.step1FoodRecognizing()
|
||||
return
|
||||
}
|
||||
//余量计量+联合支付人脸查询订单完成
|
||||
if (presentation!!.jointPaymentQueryFinish) {
|
||||
presentation?.updateWeight(weight)
|
||||
return
|
||||
}
|
||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||
recognizeByWeight(weight, isWeightChange)
|
||||
}
|
||||
|
||||
private fun readWeight(weight: Int) {
|
||||
log("registerDataChange weight = $weight")
|
||||
//runOnUiThread { binding.tvShowWeight.text="${weight*1000}克" }
|
||||
runOnUiThread {
|
||||
binding.tvShowWeight.let {
|
||||
if (it.text.toString() == weight.toString()) return@runOnUiThread
|
||||
it.text = "$weight"
|
||||
}
|
||||
}
|
||||
if (settlementMode == 0) {
|
||||
//联合支付-------------------------------------------
|
||||
//0-即放即取,1-余量计量
|
||||
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||
if (mealPickupMode == 1) {
|
||||
loadYLJLBySettlement(weight)
|
||||
return
|
||||
}
|
||||
//即放即取+联合支付人脸查询订单完成
|
||||
if (presentation!!.jointPaymentQueryFinish) {
|
||||
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
||||
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
||||
return
|
||||
}
|
||||
//重量小于等于5克时改为识别中页面
|
||||
isAnalyzing = false
|
||||
presentation?.step1FoodRecognizing()
|
||||
return
|
||||
}
|
||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||
//秤上重量过下,显示识别中页面
|
||||
presentation?.step1FoodRecognizing()
|
||||
return
|
||||
}
|
||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||
if (weight != lastWeight) {
|
||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||
}
|
||||
recognizeByWeight(weight, isWeightChange)
|
||||
loadJFJQBySettlement(weight)
|
||||
return
|
||||
}
|
||||
|
||||
//独立支付-------------------------------------------
|
||||
if (lastWeight - weight > 5) {
|
||||
//及放及取,从秤上拿走超过5克
|
||||
@@ -305,11 +337,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||
if (weight != lastWeight) {
|
||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||
}
|
||||
recognizeByWeight(weight, isWeightChange)
|
||||
}
|
||||
|
||||
@@ -321,6 +349,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
|
||||
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
|
||||
if (weight != lastWeight) {
|
||||
val payTypeDesc = if (settlementMode == 0) "联合支付" else "独立支付"
|
||||
log("readWeight-${payTypeDesc},weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||
}
|
||||
presentation?.updateWeight(weight)
|
||||
|
||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||
@@ -642,6 +674,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
//已显示副屏,则进行更新
|
||||
val weight = lastWeight
|
||||
lastWeight = 0
|
||||
presentation?.pauseCamera()
|
||||
presentation?.hideRecImage()
|
||||
presentation?.step1FoodRecognizing()
|
||||
|
||||
@@ -690,10 +723,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
lastTouchTime = System.currentTimeMillis()
|
||||
}
|
||||
|
||||
fun joinPayment() {
|
||||
|
||||
}
|
||||
|
||||
fun createOrder(
|
||||
foodInfo: FoodInfo,
|
||||
foodWeight: Int,
|
||||
|
||||
@@ -35,7 +35,7 @@ class FoodOrderAdapter(var list: MutableList<FoodItem>) :
|
||||
binding.tvFoodName.text = it.foodName
|
||||
val foodPrice = it.foodPrice.format2String(2)
|
||||
if (it.orderFrom == 2) {
|
||||
binding.tvPriceNorm.text = "${it.specName}-${it.specWeight}克"
|
||||
binding.tvPriceNorm.text = "${it.specName}/${it.specWeight}克"
|
||||
} else {
|
||||
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
|
||||
}
|
||||
|
||||
@@ -1220,18 +1220,21 @@ class MainScreenPresentation(
|
||||
isMember = false
|
||||
//ToastUtils.showToast("isKeepFaceState=$isKeepFaceState,mealPickupMode=$mealPickupMode")
|
||||
//|| isKeepFaceState
|
||||
if (activity.settlementMode == 0) {
|
||||
activity.isAnalyzing = false
|
||||
step1FoodRecognizing()
|
||||
} else {
|
||||
// if (activity.settlementMode == 0) {
|
||||
// activity.isAnalyzing = false
|
||||
// step1FoodRecognizing()
|
||||
// } else {
|
||||
if (mealPickupMode == 1) {
|
||||
step2FaceRecognizing(currentFood!!)
|
||||
isKeepFaceState = false
|
||||
if (activity.settlementMode == 0) {
|
||||
setTopInfoVisible()
|
||||
}
|
||||
} else {
|
||||
activity.isAnalyzing = false
|
||||
step1FoodRecognizing()
|
||||
}
|
||||
}
|
||||
// }
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1263,11 +1266,15 @@ class MainScreenPresentation(
|
||||
// foodWeight = lastWeight
|
||||
//)
|
||||
//userViewModel.postUserNutritionData(listOf(userNutritionParam))
|
||||
val realWeight = eatWeight.toDouble()
|
||||
val specWeight = currentFood!!.specWeight
|
||||
val eatNum = activity.getEatNum(realWeight, specWeight)
|
||||
activity.log("createOrder,realWeight=$realWeight,specWeight=$specWeight")
|
||||
activity.createOrder(
|
||||
foodInfo = currentFood!!,
|
||||
foodWeight = lastWeight,
|
||||
eatWeight = eatWeight,
|
||||
eatNum = activity.getEatNum(eatWeight.toDouble(), currentFood!!.specWeight),
|
||||
eatNum = eatNum,
|
||||
userId = currentUserId,
|
||||
isMember = isMember,
|
||||
notEnoughOneBlock = notEnoughOneBlock,
|
||||
|
||||
@@ -48,19 +48,22 @@
|
||||
android:textColor="#FF0A1428"
|
||||
android:textSize="52sp"
|
||||
android:textStyle="bold" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tvShowWeight"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="80dp"-->
|
||||
<!-- android:textSize="30sp"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- tools:text="100克"/>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvShowWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:textSize="40sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
tools:text="100克"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/foodDisplayLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="560dp"
|
||||
android:layout_marginHorizontal="28dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:visibility="visible">
|
||||
|
||||
<androidx.camera.view.PreviewView
|
||||
|
||||
Reference in New Issue
Block a user