支付调试优化
This commit is contained in:
@@ -90,7 +90,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
|
||||
val mode = SPUtil.getInstance().get(GlobalKey.KEY_CHARGE_MODE, 0)
|
||||
//不计费模式切换菜品,重新加载数据
|
||||
if(mode == 1) {
|
||||
if (mode == 1) {
|
||||
presentation?.loadUnbilledMode()
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
private fun initData() {
|
||||
// viewModel.getEquipmentToken()
|
||||
viewModel.getUserFaceCache(pageNo = 1)
|
||||
//viewModel.getUserFaceCache2()
|
||||
//viewModel.getUserFaceCache2()
|
||||
|
||||
// presentation?.step1()
|
||||
presentation?.step1FoodRecognizing()
|
||||
@@ -232,13 +232,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||
val eatWeight = if (mealPickupMode == 0) {
|
||||
//即放即取
|
||||
presentation?.recognitionWeight?:0.0
|
||||
presentation!!.recognitionWeight
|
||||
} else {
|
||||
presentation?.recognitionWeight?.minus(lastWeight)?:0.0
|
||||
presentation!!.recognitionWeight - lastWeight
|
||||
}
|
||||
createOrder(
|
||||
foodInfo = checkedItem!!,
|
||||
foodWeight = presentation?.lastWeight?.roundToInt()?:0,
|
||||
foodWeight = presentation?.lastWeight?.roundToInt() ?: 0,
|
||||
eatWeight = eatWeight.roundToInt()
|
||||
) {
|
||||
presentation?.dismiss()
|
||||
@@ -683,7 +683,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
lastTouchTime = System.currentTimeMillis()
|
||||
}
|
||||
|
||||
fun createOrder(foodInfo: FoodInfo, foodWeight: Int, eatWeight: Int, block:()-> Unit) {
|
||||
fun createOrder(foodInfo: FoodInfo, foodWeight: Int, eatWeight: Int, block: () -> Unit) {
|
||||
if (foodWeight <= 5 || eatWeight <= 5) {
|
||||
ToastUtils.showToast("请取走餐品")
|
||||
return
|
||||
}
|
||||
val mode = SPUtil.getInstance().get(GlobalKey.KEY_CHARGE_MODE, 0)
|
||||
val order = FoodOrder(
|
||||
deviceId = GlobalData.deviceId,
|
||||
|
||||
@@ -217,6 +217,10 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
fun memberPay(param: HashMap<String, String>, block: () -> Unit) {
|
||||
userViewModel.memberPay(param) {
|
||||
runOnUiThread {
|
||||
if (it.not()) {
|
||||
ToastUtils.showToast("支付失败,请稍后重试")
|
||||
return@runOnUiThread
|
||||
}
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,15 +53,16 @@ class PayResultFragment : BaseFragment<FragmentPayResultBinding>() {
|
||||
memberInfo = it.getParcelable(MEMBER_INFO)
|
||||
}
|
||||
|
||||
totalPrice = payActivity?.foodInfo?.vipPrice ?: 0.0
|
||||
if (memberInfo != null) {
|
||||
binding.layoutMemberInfo.visible()
|
||||
totalPrice = payActivity?.foodInfo?.vipPrice ?: 0.0
|
||||
binding.layoutVip.visible()
|
||||
balance = (memberInfo!!.topUpBalance ?: 0.0) + (memberInfo!!.rewardBalance ?: 0.0)
|
||||
realPayPrice = if (balance >= totalPrice) 0.0 else totalPrice - balance
|
||||
expensesBalance = if (balance >= totalPrice) totalPrice else balance
|
||||
loadUserInfo(memberInfo!!)
|
||||
} else {
|
||||
binding.layoutMemberInfo.gone()
|
||||
binding.layoutVip.gone()
|
||||
totalPrice = payActivity?.foodInfo?.specPrice ?: 0.0
|
||||
}
|
||||
|
||||
when (pageType) {
|
||||
|
||||
@@ -1,253 +1,253 @@
|
||||
package com.sw.dualscreen.model.response
|
||||
|
||||
|
||||
import android.os.Parcelable
|
||||
import android.text.TextUtils
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* 就餐数据
|
||||
*/
|
||||
@Parcelize
|
||||
data class UserNutritionData(
|
||||
/**
|
||||
* 总胆固醇
|
||||
*/
|
||||
@SerializedName("cho")
|
||||
val cho: String? = "",
|
||||
/**
|
||||
* 饮食纤维
|
||||
*/
|
||||
@SerializedName("dietFiber")
|
||||
val dietFiber: String? = "",
|
||||
/**
|
||||
* 能量
|
||||
*/
|
||||
@SerializedName("energy")
|
||||
val energy: String? = "",
|
||||
/**
|
||||
* 脂肪
|
||||
*/
|
||||
@SerializedName("fat")
|
||||
val fat: String? = "",
|
||||
/**
|
||||
* 食物类型和实际摄入量清单
|
||||
*/
|
||||
@SerializedName("foodTypeAndRealIntakeVoList")
|
||||
val foodTypeAndRealIntakeVoList: List<FoodTypeAndRealIntakeVo?>? = listOf(),
|
||||
@SerializedName("foodWeight")
|
||||
val foodWeight: String? = "",
|
||||
@SerializedName("message")
|
||||
val message: String? = "",
|
||||
/**
|
||||
* 钠
|
||||
*/
|
||||
@SerializedName("na")
|
||||
val na: String? = "",
|
||||
/**
|
||||
* 蛋白质
|
||||
*/
|
||||
@SerializedName("protein")
|
||||
val protein: String? = "",
|
||||
/**
|
||||
* 最大推荐热量
|
||||
*/
|
||||
@SerializedName("recommendMax")
|
||||
val recommendMax: String? = "",
|
||||
/**
|
||||
* 最小推荐热量
|
||||
*/
|
||||
@SerializedName("recommendMin")
|
||||
val recommendMin: String? = "",
|
||||
/**
|
||||
* 热量详情
|
||||
*/
|
||||
@SerializedName("stFoodInfoPagoda")
|
||||
val stFoodInfoPagoda: StFoodInfoPagoda? = StFoodInfoPagoda(),
|
||||
@SerializedName("stUserFoodInfoList")
|
||||
val stUserFoodInfoList: List<StUserFoodInfo?>? = listOf(),
|
||||
/**
|
||||
* 每日总热量
|
||||
*/
|
||||
@SerializedName("totalEnergyCalculateScore")
|
||||
val totalEnergyCalculateScore: String? = "",
|
||||
/**
|
||||
* 用户所在部门
|
||||
*/
|
||||
@SerializedName("userDept")
|
||||
val userDept: String? = "",
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@SerializedName("userId")
|
||||
val userId: String? = "",
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@SerializedName("userName")
|
||||
val userName: String? = ""
|
||||
) : Parcelable {
|
||||
fun recommendMaxValue(): Double =
|
||||
if (TextUtils.isEmpty(recommendMax)) 0.0
|
||||
else recommendMax!!.toDouble()
|
||||
|
||||
fun recommendMinValue(): Double =
|
||||
if (TextUtils.isEmpty(recommendMin)) 0.0
|
||||
else recommendMin!!.toDouble()
|
||||
|
||||
fun energyValue(): Double =
|
||||
if (TextUtils.isEmpty(energy)) 0.0
|
||||
else energy!!.toDouble()
|
||||
|
||||
fun totalEnergyCalculateScoreValue(): Double =
|
||||
if (TextUtils.isEmpty(totalEnergyCalculateScore)) 0.0
|
||||
else totalEnergyCalculateScore!!.toDouble()
|
||||
|
||||
@Parcelize
|
||||
data class FoodTypeAndRealIntakeVo(
|
||||
@SerializedName("childMaterClassName")
|
||||
val childMaterClassName: String? = "",
|
||||
@SerializedName("foodId")
|
||||
val foodId: String? = "",
|
||||
@SerializedName("goodsId")
|
||||
val goodsId: String? = "",
|
||||
@SerializedName("goodsName")
|
||||
val goodsName: String? = "",
|
||||
@SerializedName("materClassName")
|
||||
val materClassName: String? = "",
|
||||
@SerializedName("materId")
|
||||
val materId: String? = "",
|
||||
@SerializedName("materialType")
|
||||
val materialType: String? = "",
|
||||
@SerializedName("realityIntake")
|
||||
val realityIntake: String? = ""
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class StFoodInfoPagoda(
|
||||
/**
|
||||
* 水果
|
||||
*/
|
||||
@SerializedName("fruits")
|
||||
val fruits: String? = "",
|
||||
@SerializedName("fruitsRecommend")
|
||||
val fruitsRecommend: String? = "",
|
||||
/**
|
||||
* 粮食
|
||||
*/
|
||||
@SerializedName("grain")
|
||||
val grain: String? = "",
|
||||
@SerializedName("grainRecommend")
|
||||
val grainRecommend: String? = "",
|
||||
/**
|
||||
* 肉
|
||||
*/
|
||||
@SerializedName("meat")
|
||||
val meat: String? = "",
|
||||
@SerializedName("meatRecommend")
|
||||
val meatRecommend: String? = "",
|
||||
/**
|
||||
* 油
|
||||
*/
|
||||
@SerializedName("oil")
|
||||
val oil: String? = "",
|
||||
/**
|
||||
* 盐
|
||||
*/
|
||||
@SerializedName("salt")
|
||||
val salt: String? = "",
|
||||
/**
|
||||
* 大豆
|
||||
*/
|
||||
@SerializedName("soya")
|
||||
val soya: String? = "",
|
||||
@SerializedName("soyaRecommend")
|
||||
val soyaRecommend: String? = "",
|
||||
/**
|
||||
* 糖
|
||||
*/
|
||||
@SerializedName("sugar")
|
||||
val sugar: String? = "",
|
||||
/**
|
||||
* 蔬菜
|
||||
*/
|
||||
@SerializedName("vegetable")
|
||||
val vegetable: String? = "",
|
||||
@SerializedName("vegetableRecommend")
|
||||
val vegetableRecommend: String? = ""
|
||||
) : Parcelable {
|
||||
fun fruitsValue(): Double =
|
||||
if (TextUtils.isEmpty(fruits))
|
||||
0.0
|
||||
else fruits!!.toDouble()
|
||||
|
||||
fun grainValue(): Double =
|
||||
if (TextUtils.isEmpty(grain))
|
||||
0.0
|
||||
else grain!!.toDouble()
|
||||
|
||||
fun vegetableValue(): Double =
|
||||
if (TextUtils.isEmpty(vegetable))
|
||||
0.0
|
||||
else vegetable!!.toDouble()
|
||||
|
||||
fun meatValue(): Double =
|
||||
if (TextUtils.isEmpty(meat))
|
||||
0.0
|
||||
else meat!!.toDouble()
|
||||
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class StUserFoodInfo(
|
||||
@SerializedName("canteenId")
|
||||
val canteenId: String? = "",
|
||||
@SerializedName("createBy")
|
||||
val createBy: String? = "",
|
||||
@SerializedName("createTime")
|
||||
val createTime: String? = "",
|
||||
@SerializedName("dataSource")
|
||||
val dataSource: String? = "",
|
||||
@SerializedName("dataType")
|
||||
val dataType: String? = "",
|
||||
@SerializedName("delFlag")
|
||||
val delFlag: String? = "",
|
||||
@SerializedName("deviceId")
|
||||
val deviceId: String? = "",
|
||||
@SerializedName("dinnerType")
|
||||
val dinnerType: String? = "",
|
||||
@SerializedName("eatDay")
|
||||
val eatDay: String? = "",
|
||||
@SerializedName("eatNum")
|
||||
val eatNum: String? = "",
|
||||
@SerializedName("eatWeight")
|
||||
val eatWeight: Double? = 0.0,
|
||||
@SerializedName("foodId")
|
||||
val foodId: String? = "",
|
||||
@SerializedName("foodImg")
|
||||
val foodImg: String? = "",
|
||||
@SerializedName("foodMaterialId")
|
||||
val foodMaterialId: String? = "",
|
||||
@SerializedName("foodName")
|
||||
val foodName: String? = "",
|
||||
@SerializedName("foodWeight")
|
||||
val foodWeight: String? = "",
|
||||
@SerializedName("id")
|
||||
val id: String? = "",
|
||||
@SerializedName("isSync")
|
||||
val isSync: String? = "",
|
||||
@SerializedName("isSyncCopy")
|
||||
val isSyncCopy: String? = "",
|
||||
@SerializedName("specId")
|
||||
val specId: String? = "",
|
||||
@SerializedName("stBasicDiningInformationUserESVo")
|
||||
val stBasicDiningInformationUserESVo: String? = "",
|
||||
@SerializedName("stallType")
|
||||
val stallType: String? = "",
|
||||
@SerializedName("type")
|
||||
val type: String? = "",
|
||||
@SerializedName("userId")
|
||||
val userId: String? = ""
|
||||
) : Parcelable
|
||||
}
|
||||
//package com.sw.dualscreen.model.response
|
||||
//
|
||||
//
|
||||
//import android.os.Parcelable
|
||||
//import android.text.TextUtils
|
||||
//import com.google.gson.annotations.SerializedName
|
||||
//import kotlinx.parcelize.Parcelize
|
||||
//
|
||||
///**
|
||||
// * 就餐数据
|
||||
// */
|
||||
//@Parcelize
|
||||
//data class UserNutritionData(
|
||||
// /**
|
||||
// * 总胆固醇
|
||||
// */
|
||||
// @SerializedName("cho")
|
||||
// val cho: String? = "",
|
||||
// /**
|
||||
// * 饮食纤维
|
||||
// */
|
||||
// @SerializedName("dietFiber")
|
||||
// val dietFiber: String? = "",
|
||||
// /**
|
||||
// * 能量
|
||||
// */
|
||||
// @SerializedName("energy")
|
||||
// val energy: String? = "",
|
||||
// /**
|
||||
// * 脂肪
|
||||
// */
|
||||
// @SerializedName("fat")
|
||||
// val fat: String? = "",
|
||||
// /**
|
||||
// * 食物类型和实际摄入量清单
|
||||
// */
|
||||
// @SerializedName("foodTypeAndRealIntakeVoList")
|
||||
// val foodTypeAndRealIntakeVoList: List<FoodTypeAndRealIntakeVo?>? = listOf(),
|
||||
// @SerializedName("foodWeight")
|
||||
// val foodWeight: String? = "",
|
||||
// @SerializedName("message")
|
||||
// val message: String? = "",
|
||||
// /**
|
||||
// * 钠
|
||||
// */
|
||||
// @SerializedName("na")
|
||||
// val na: String? = "",
|
||||
// /**
|
||||
// * 蛋白质
|
||||
// */
|
||||
// @SerializedName("protein")
|
||||
// val protein: String? = "",
|
||||
// /**
|
||||
// * 最大推荐热量
|
||||
// */
|
||||
// @SerializedName("recommendMax")
|
||||
// val recommendMax: String? = "",
|
||||
// /**
|
||||
// * 最小推荐热量
|
||||
// */
|
||||
// @SerializedName("recommendMin")
|
||||
// val recommendMin: String? = "",
|
||||
// /**
|
||||
// * 热量详情
|
||||
// */
|
||||
// @SerializedName("stFoodInfoPagoda")
|
||||
// val stFoodInfoPagoda: StFoodInfoPagoda? = StFoodInfoPagoda(),
|
||||
// @SerializedName("stUserFoodInfoList")
|
||||
// val stUserFoodInfoList: List<StUserFoodInfo?>? = listOf(),
|
||||
// /**
|
||||
// * 每日总热量
|
||||
// */
|
||||
// @SerializedName("totalEnergyCalculateScore")
|
||||
// val totalEnergyCalculateScore: String? = "",
|
||||
// /**
|
||||
// * 用户所在部门
|
||||
// */
|
||||
// @SerializedName("userDept")
|
||||
// val userDept: String? = "",
|
||||
// /**
|
||||
// * 用户id
|
||||
// */
|
||||
// @SerializedName("userId")
|
||||
// val userId: String? = "",
|
||||
// /**
|
||||
// * 姓名
|
||||
// */
|
||||
// @SerializedName("userName")
|
||||
// val userName: String? = ""
|
||||
//) : Parcelable {
|
||||
// fun recommendMaxValue(): Double =
|
||||
// if (TextUtils.isEmpty(recommendMax)) 0.0
|
||||
// else recommendMax!!.toDouble()
|
||||
//
|
||||
// fun recommendMinValue(): Double =
|
||||
// if (TextUtils.isEmpty(recommendMin)) 0.0
|
||||
// else recommendMin!!.toDouble()
|
||||
//
|
||||
// fun energyValue(): Double =
|
||||
// if (TextUtils.isEmpty(energy)) 0.0
|
||||
// else energy!!.toDouble()
|
||||
//
|
||||
// fun totalEnergyCalculateScoreValue(): Double =
|
||||
// if (TextUtils.isEmpty(totalEnergyCalculateScore)) 0.0
|
||||
// else totalEnergyCalculateScore!!.toDouble()
|
||||
//
|
||||
// @Parcelize
|
||||
// data class FoodTypeAndRealIntakeVo(
|
||||
// @SerializedName("childMaterClassName")
|
||||
// val childMaterClassName: String? = "",
|
||||
// @SerializedName("foodId")
|
||||
// val foodId: String? = "",
|
||||
// @SerializedName("goodsId")
|
||||
// val goodsId: String? = "",
|
||||
// @SerializedName("goodsName")
|
||||
// val goodsName: String? = "",
|
||||
// @SerializedName("materClassName")
|
||||
// val materClassName: String? = "",
|
||||
// @SerializedName("materId")
|
||||
// val materId: String? = "",
|
||||
// @SerializedName("materialType")
|
||||
// val materialType: String? = "",
|
||||
// @SerializedName("realityIntake")
|
||||
// val realityIntake: String? = ""
|
||||
// ) : Parcelable
|
||||
//
|
||||
// @Parcelize
|
||||
// data class StFoodInfoPagoda(
|
||||
// /**
|
||||
// * 水果
|
||||
// */
|
||||
// @SerializedName("fruits")
|
||||
// val fruits: String? = "",
|
||||
// @SerializedName("fruitsRecommend")
|
||||
// val fruitsRecommend: String? = "",
|
||||
// /**
|
||||
// * 粮食
|
||||
// */
|
||||
// @SerializedName("grain")
|
||||
// val grain: String? = "",
|
||||
// @SerializedName("grainRecommend")
|
||||
// val grainRecommend: String? = "",
|
||||
// /**
|
||||
// * 肉
|
||||
// */
|
||||
// @SerializedName("meat")
|
||||
// val meat: String? = "",
|
||||
// @SerializedName("meatRecommend")
|
||||
// val meatRecommend: String? = "",
|
||||
// /**
|
||||
// * 油
|
||||
// */
|
||||
// @SerializedName("oil")
|
||||
// val oil: String? = "",
|
||||
// /**
|
||||
// * 盐
|
||||
// */
|
||||
// @SerializedName("salt")
|
||||
// val salt: String? = "",
|
||||
// /**
|
||||
// * 大豆
|
||||
// */
|
||||
// @SerializedName("soya")
|
||||
// val soya: String? = "",
|
||||
// @SerializedName("soyaRecommend")
|
||||
// val soyaRecommend: String? = "",
|
||||
// /**
|
||||
// * 糖
|
||||
// */
|
||||
// @SerializedName("sugar")
|
||||
// val sugar: String? = "",
|
||||
// /**
|
||||
// * 蔬菜
|
||||
// */
|
||||
// @SerializedName("vegetable")
|
||||
// val vegetable: String? = "",
|
||||
// @SerializedName("vegetableRecommend")
|
||||
// val vegetableRecommend: String? = ""
|
||||
// ) : Parcelable {
|
||||
// fun fruitsValue(): Double =
|
||||
// if (TextUtils.isEmpty(fruits))
|
||||
// 0.0
|
||||
// else fruits!!.toDouble()
|
||||
//
|
||||
// fun grainValue(): Double =
|
||||
// if (TextUtils.isEmpty(grain))
|
||||
// 0.0
|
||||
// else grain!!.toDouble()
|
||||
//
|
||||
// fun vegetableValue(): Double =
|
||||
// if (TextUtils.isEmpty(vegetable))
|
||||
// 0.0
|
||||
// else vegetable!!.toDouble()
|
||||
//
|
||||
// fun meatValue(): Double =
|
||||
// if (TextUtils.isEmpty(meat))
|
||||
// 0.0
|
||||
// else meat!!.toDouble()
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Parcelize
|
||||
// data class StUserFoodInfo(
|
||||
// @SerializedName("canteenId")
|
||||
// val canteenId: String? = "",
|
||||
// @SerializedName("createBy")
|
||||
// val createBy: String? = "",
|
||||
// @SerializedName("createTime")
|
||||
// val createTime: String? = "",
|
||||
// @SerializedName("dataSource")
|
||||
// val dataSource: String? = "",
|
||||
// @SerializedName("dataType")
|
||||
// val dataType: String? = "",
|
||||
// @SerializedName("delFlag")
|
||||
// val delFlag: String? = "",
|
||||
// @SerializedName("deviceId")
|
||||
// val deviceId: String? = "",
|
||||
// @SerializedName("dinnerType")
|
||||
// val dinnerType: String? = "",
|
||||
// @SerializedName("eatDay")
|
||||
// val eatDay: String? = "",
|
||||
// @SerializedName("eatNum")
|
||||
// val eatNum: String? = "",
|
||||
// @SerializedName("eatWeight")
|
||||
// val eatWeight: Double? = 0.0,
|
||||
// @SerializedName("foodId")
|
||||
// val foodId: String? = "",
|
||||
// @SerializedName("foodImg")
|
||||
// val foodImg: String? = "",
|
||||
// @SerializedName("foodMaterialId")
|
||||
// val foodMaterialId: String? = "",
|
||||
// @SerializedName("foodName")
|
||||
// val foodName: String? = "",
|
||||
// @SerializedName("foodWeight")
|
||||
// val foodWeight: String? = "",
|
||||
// @SerializedName("id")
|
||||
// val id: String? = "",
|
||||
// @SerializedName("isSync")
|
||||
// val isSync: String? = "",
|
||||
// @SerializedName("isSyncCopy")
|
||||
// val isSyncCopy: String? = "",
|
||||
// @SerializedName("specId")
|
||||
// val specId: String? = "",
|
||||
// @SerializedName("stBasicDiningInformationUserESVo")
|
||||
// val stBasicDiningInformationUserESVo: String? = "",
|
||||
// @SerializedName("stallType")
|
||||
// val stallType: String? = "",
|
||||
// @SerializedName("type")
|
||||
// val type: String? = "",
|
||||
// @SerializedName("userId")
|
||||
// val userId: String? = ""
|
||||
// ) : Parcelable
|
||||
//}
|
||||
@@ -9,10 +9,8 @@ import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.FoodSearchReq
|
||||
import com.sw.dualscreen.model.response.FoodOrder
|
||||
import com.sw.dualscreen.model.response.MemberInfo
|
||||
import com.sw.dualscreen.model.response.PayResult
|
||||
import com.sw.dualscreen.model.response.UserFaceModel
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.objbox.CollectedFoodInfo
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
@@ -166,11 +164,11 @@ interface ApiService {
|
||||
/**
|
||||
* 查询支付结果
|
||||
*/
|
||||
@POST
|
||||
@GET
|
||||
suspend fun queryOrderState(
|
||||
@Url url: String = "${GlobalData.appBaseUrl}/terminal/neglect/pay/app/turnOrderInfo",
|
||||
// @Query("orderNo") orderNo: String
|
||||
@Body param: HashMap<String, String>
|
||||
@Query("orderNo") orderNo: String
|
||||
// @Body param: HashMap<String, String>
|
||||
): ApiResponse<Any?>
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,12 +31,10 @@ import com.sw.dualscreen.ext.gone
|
||||
import com.sw.dualscreen.ext.load
|
||||
import com.sw.dualscreen.ext.maskName
|
||||
import com.sw.dualscreen.ext.visible
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.DinnerType
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.UserEnergy
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.utils.Debouncer
|
||||
import com.sw.dualscreen.utils.SPUtil
|
||||
import com.sw.dualscreen.viewmodel.UserViewModel
|
||||
@@ -119,9 +117,16 @@ class MainScreenPresentation(
|
||||
lastWeight = weight * 1000 // 将千克转成克
|
||||
Timber.tag(TAG)
|
||||
.d("updateWeight lastWeight = $weight, currentStep = $currentStep, isGoStep1 = $isGoStep1")
|
||||
// if (lastWeight <= 5) {
|
||||
// activity.isAnalyzing = false
|
||||
// }
|
||||
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||
val chargeMode = SPUtil.getInstance().get(GlobalKey.KEY_CHARGE_MODE, 0)
|
||||
if (mealPickupMode == 1 && chargeMode == 0) {
|
||||
//余量计量+计费模式
|
||||
recognitionWeight = lastWeight
|
||||
if (weight > 5) {
|
||||
//余量计量,有重量的情况下不回到重新识别状态
|
||||
return
|
||||
}
|
||||
}
|
||||
if (currentStep == 2 && lastWeight <= 5 && isGoStep1) {
|
||||
//人脸识别过程中,秤上物品拿走
|
||||
isGoStep1 = false
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.sw.dualscreen.ext.toSafeDouble
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.UserEnergy
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import timber.log.Timber
|
||||
import kotlin.math.max
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ class FacePayPresentation(
|
||||
var userId = faceEntity.userName
|
||||
if (userId == null) return@Observer
|
||||
// TODO: 测试支付用户id
|
||||
userId = "1987710988425662466"
|
||||
// userId = "1987710988425662466"
|
||||
faceRecSuccess(userId)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sw.dualscreen.presentation.pay
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Presentation
|
||||
import android.os.Bundle
|
||||
import android.view.Display
|
||||
@@ -47,9 +48,11 @@ class ScanQrCodePayPresentation(
|
||||
|
||||
//实际支付金额
|
||||
private var realPayPrice = 0.0
|
||||
|
||||
//扣除余额
|
||||
private var expensesBalance = 0.0
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initView() {
|
||||
when (type) {
|
||||
0 -> {
|
||||
@@ -69,12 +72,14 @@ class ScanQrCodePayPresentation(
|
||||
}
|
||||
|
||||
1 -> {
|
||||
binding.layoutVip.visible()
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo!=null) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.gone()
|
||||
binding.layoutScanQrCode.visible()
|
||||
|
||||
val memberInfo = activity.memberInfo
|
||||
totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
//totalPrice = if (memberInfo != null) activity.foodInfo?.vipPrice else activity.foodInfo?.specPrice
|
||||
balance = (memberInfo?.topUpBalance ?: 0.0) + (memberInfo?.rewardBalance ?: 0.0)
|
||||
realPayPrice = if (balance >= totalPrice) 0.0 else totalPrice - balance
|
||||
expensesBalance = if (balance >= totalPrice) totalPrice else balance
|
||||
@@ -103,13 +108,15 @@ class ScanQrCodePayPresentation(
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.layoutVip.visible()
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo!=null) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.visible()
|
||||
binding.layoutScanQrCode.gone()
|
||||
|
||||
val memberInfo = activity.memberInfo
|
||||
totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
balance = (memberInfo?.topUpBalance ?: 0.0) + (memberInfo?.rewardBalance ?: 0.0)
|
||||
//totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
balance = if (memberInfo != null) (memberInfo.topUpBalance ?: 0.0)+(memberInfo.rewardBalance ?: 0.0) else 0.0
|
||||
realPayPrice = if (balance >= totalPrice) 0.0 else totalPrice - balance
|
||||
expensesBalance = if (balance >= totalPrice) totalPrice else balance
|
||||
|
||||
@@ -122,8 +129,9 @@ class ScanQrCodePayPresentation(
|
||||
)
|
||||
)
|
||||
|
||||
binding.tvPayInfo.text =
|
||||
"余额扣除 ${expensesBalance.format2String(2)} 元,在线支付 ${totalPrice.format2String(2)} 元"
|
||||
val showBalance = expensesBalance.format2String(2)
|
||||
val showTotal = totalPrice.format2String(2)
|
||||
binding.tvPayInfo.text = "余额扣除 $showBalance 元,在线支付 $showTotal 元"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,10 +142,8 @@ class ScanQrCodePayPresentation(
|
||||
|
||||
val phone = item.phone ?: ""
|
||||
binding.tvUserPhone.text =
|
||||
if (phone.length == 11)
|
||||
phone.replace(phone.substring(3, 7), "****")
|
||||
else
|
||||
phone
|
||||
if (phone.length == 11) phone.replace(phone.substring(3, 7), "****")
|
||||
else phone
|
||||
}
|
||||
|
||||
private fun getAmountList(): List<TextBean> {
|
||||
@@ -157,9 +163,7 @@ class ScanQrCodePayPresentation(
|
||||
TextBean(text = " 元,扣除后可用余额 ", textSize = 30, textColor = "#FF5E7585")
|
||||
val remainingBalance = balance - totalPrice
|
||||
TextBean(
|
||||
text = remainingBalance.format2String(2),
|
||||
textSize = 30,
|
||||
textColor = "#FF0A1428"
|
||||
text = remainingBalance.format2String(2), textSize = 30, textColor = "#FF0A1428"
|
||||
)
|
||||
} else {
|
||||
//余额小于总价格,使用余额+扫码支付
|
||||
|
||||
@@ -9,10 +9,8 @@ import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.FoodSearchReq
|
||||
import com.sw.dualscreen.model.response.FoodOrder
|
||||
import com.sw.dualscreen.model.response.MemberInfo
|
||||
import com.sw.dualscreen.model.response.PayResult
|
||||
import com.sw.dualscreen.model.response.UserFaceModel
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.network.api.ApiService
|
||||
import com.sw.dualscreen.objbox.CollectedFoodInfo
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
@@ -207,15 +205,11 @@ class RemoteRepository constructor(
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
* @param orderNo 订单好
|
||||
* @param queryType 查询类型 1支付2退款
|
||||
* @param orderNo 订单号
|
||||
*/
|
||||
suspend fun queryOrderState(orderNo: String, queryType: Int = 1): ApiResponse<Any?> {
|
||||
suspend fun queryOrderState(orderNo: String): ApiResponse<Any?> {
|
||||
return safeApiCall {
|
||||
apiService.queryOrderState(param = hashMapOf(
|
||||
"payOrderNo" to orderNo,
|
||||
"queryType" to "$queryType"
|
||||
))
|
||||
apiService.queryOrderState(orderNo = orderNo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.arcsoft.face.ErrorInfo
|
||||
import com.sw.dualscreen.GlobalData
|
||||
import com.sw.dualscreen.GlobalKey
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.ApiResponse
|
||||
import com.sw.dualscreen.model.response.DinnerType
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.FoodOrder
|
||||
@@ -14,7 +13,6 @@ import com.sw.dualscreen.model.response.PayResult
|
||||
import com.sw.dualscreen.model.response.UserFaceModel
|
||||
import com.sw.dualscreen.model.response.UserFaceModel2
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.objbox.CollectedFoodInfo
|
||||
import com.sw.dualscreen.utils.GsonUtils
|
||||
import com.sw.dualscreen.utils.SPUtil
|
||||
@@ -49,8 +47,8 @@ class UserViewModel : BaseViewModel() {
|
||||
val searchFoodInfoList: StateFlow<List<FoodInfo>> = _searchFoodInfoList
|
||||
|
||||
// 就餐数据
|
||||
private val _nutritionData = MutableStateFlow<UserNutritionData?>(null)
|
||||
val nutritionData: StateFlow<UserNutritionData?> = _nutritionData
|
||||
// private val _nutritionData = MutableStateFlow<UserNutritionData?>(null)
|
||||
// val nutritionData: StateFlow<UserNutritionData?> = _nutritionData
|
||||
|
||||
/**
|
||||
* 饭点类型 早餐/午餐/晚餐
|
||||
@@ -388,15 +386,16 @@ class UserViewModel : BaseViewModel() {
|
||||
Timber.tag(TAG).d("queryOrderState")
|
||||
val response = repository.queryOrderState(orderNo = orderId)
|
||||
if (parseResponse(response)) {
|
||||
val respData = response.data as? String
|
||||
?: if (response.data is Any) {
|
||||
GsonUtils.toJson(response.data)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
val payResult = GsonUtils.fromJson(respData, PayResult::class.java)
|
||||
val orderState = payResult?.paySuc == "1"
|
||||
block(orderState)
|
||||
//val respData = response.data as? String
|
||||
// ?: if (response.data is Any) {
|
||||
// GsonUtils.toJson(response.data)
|
||||
// } else {
|
||||
// ""
|
||||
// }
|
||||
//al payResult = GsonUtils.fromJson(respData, PayResult::class.java)
|
||||
//val orderState = payResult?.paySuc == "1"
|
||||
//data=1的话 是支付成功 0是待支付
|
||||
block(response.data == "1")
|
||||
} else {
|
||||
block(false)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
tools:background="#FFF4FAFF">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/layoutMemberInfo"
|
||||
android:id="@+id/layoutVip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
|
||||
Reference in New Issue
Block a user