Commit e88d0595 by wjg

调整列表金额和详情金额逻辑一致

parent 5ac25204
...@@ -20,7 +20,7 @@ android { ...@@ -20,7 +20,7 @@ android {
} }
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME : applicationId, JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "682a53c0cd0201792d45c469", //JPush 上注册的包名对应的 Appkey. JPUSH_APPKEY : "59c9290134b359212290c075", //JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可. JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
] ]
} }
......
package com.ihaoin.hooloo.device; package com.ihaoin.hooloo.device;
import android.app.Application; import android.app.Application;
import android.os.Handler;
import android.os.Message;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import com.ihaoin.hooloo.device.config.AppConfig; import com.ihaoin.hooloo.device.config.AppConfig;
import com.ihaoin.hooloo.device.data.MainData; import com.ihaoin.hooloo.device.data.MainData;
import com.ihaoin.hooloo.device.data.enums.OrderState;
import com.ihaoin.hooloo.device.data.vo.Order;
import com.ihaoin.hooloo.device.data.vo.OrderPkg;
import com.ihaoin.hooloo.device.network.HttpUtil; import com.ihaoin.hooloo.device.network.HttpUtil;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.JsonUtils;
import com.ihaoin.hooloo.device.util.SharedPreferencesUtils; import com.ihaoin.hooloo.device.util.SharedPreferencesUtils;
import com.ihaoin.hooloo.device.util.StringUtils; import com.ihaoin.hooloo.device.util.StringUtils;
import com.umeng.commonsdk.UMConfigure; import com.umeng.commonsdk.UMConfigure;
import java.util.ArrayList;
import java.util.List;
import cn.jpush.android.api.JPushInterface; import cn.jpush.android.api.JPushInterface;
public class HLApplication extends Application { public class HLApplication extends Application {
......
...@@ -150,6 +150,10 @@ public class Utils { ...@@ -150,6 +150,10 @@ public class Utils {
if (optional.isPresent()) { if (optional.isPresent()) {
return optional.get(); return optional.get();
} }
optional = skus.stream().filter(x -> Base.TRUE.equals(x.getIsDefault())).findAny();
if (optional.isPresent()) {
return optional.get();
}
return skus.get(0); return skus.get(0);
} }
......
...@@ -39,6 +39,7 @@ import java.util.ArrayList; ...@@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class GoodsDetailDialog extends Dialog { public class GoodsDetailDialog extends Dialog {
...@@ -133,9 +134,17 @@ public class GoodsDetailDialog extends Dialog { ...@@ -133,9 +134,17 @@ public class GoodsDetailDialog extends Dialog {
} }
} }
txtName.setText(mGoods.getName()); Optional<Sku> optional = mGoods.getSkus().stream().filter(x -> Base.TRUE.equals(x.getIsDefault())).findAny();
if (optional.isPresent()) {
Sku defaultSku = optional.get();
txtPrice.setText(Utils.toString(defaultSku.getPrice()));
txtDiscount.setText(Utils.toString(defaultSku.getDiscount()));
} else {
txtPrice.setText(Utils.toString(mGoods.getPrice())); txtPrice.setText(Utils.toString(mGoods.getPrice()));
txtDiscount.setText(Utils.toString(mGoods.getDiscount())); txtDiscount.setText(Utils.toString(mGoods.getDiscount()));
}
txtName.setText(mGoods.getName());
butnSubtract.setOnClickListener(v -> subtractGoods()); butnSubtract.setOnClickListener(v -> subtractGoods());
butnAdd.setOnClickListener(v -> addGoods()); butnAdd.setOnClickListener(v -> addGoods());
......
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