Commit c8dcfce4 by wjg

init

parent ce422dbf
......@@ -24,17 +24,17 @@ android {
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation project(path: ':library_recyclerview')
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.kyleduo.switchbutton:library:2.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
compileOnly 'org.projectlombok:lombok:1.18.24'
implementation 'com.fasterxml.jackson.core:jackson-core:2.10.0'
implementation'com.fasterxml.jackson.core:jackson-databind:2.10.0'
}
......@@ -4,12 +4,17 @@
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".HLApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".view.LauncherActivity"
android:label="@string/app_name"
......
package com.ihaoin.hooloo.device.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.Goods;
import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> {
private Context mContext;
public GoodsAdapter(Context context, int layoutResId, int sectionHeadResId) {
super(layoutResId, sectionHeadResId, null);
this.mContext = context;
}
@Override
protected void convertHead(BaseViewHolder helper, ScrollBean item) {
helper.setText(R.id.txt_category, item.header);
}
@Override
protected void convert(BaseViewHolder helper, ScrollBean item) {
ScrollBean.ScrollItemBean t = item.t;
Goods goods = (Goods) t.getObject();
helper.setText(R.id.txt_name, goods.getName());
if (StringUtils.isEmpty(goods.getDesc())) {
helper.setGone(R.id.txt_intro, false);
} else {
helper.setGone(R.id.txt_intro, true);
helper.setText(R.id.txt_intro, goods.getDesc());
}
if (CollectionUtils.isEmpty(goods.getTags())) {
helper.setGone(R.id.layout_tags, false);
} else {
helper.setGone(R.id.layout_tags, true);
LinearLayout layoutTag = helper.getView(R.id.layout_tags);
layoutTag.removeAllViews();
goods.getTags().forEach(x -> {
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
((TextView) tagView.findViewById(R.id.txt_tag)).setText(x);
layoutTag.addView(tagView);
});
}
ImageView imgThumbnail = helper.getView(R.id.img_thumbnail);
RoundedCorners roundedCorners = new RoundedCorners(5);
RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
Glide.with(mContext).load(goods.getPics().getThumbnail()).apply(options).into(imgThumbnail);
View butnAdd = helper.getView(R.id.butn_add);
butnAdd.setOnClickListener(v -> Utils.sendBroadcast(mContext, goods, goods.getSkus().get(0), 1));
View layoutItem = helper.getView(R.id.layout_item);
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, goods));
}
}
package com.ihaoin.hooloo.device.adapter;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.Recommend;
import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.util.Utils;
public class RecommendAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHolder> {
private Context mContext;
public RecommendAdapter(Context context, int layoutResId, int sectionHeadResId) {
super(layoutResId, sectionHeadResId, null);
this.mContext = context;
}
@Override
protected void convertHead(BaseViewHolder helper, ScrollBean item) {
}
@Override
protected void convert(BaseViewHolder helper, ScrollBean item) {
ScrollBean.ScrollItemBean t = item.t;
Recommend recommend = (Recommend) t.getObject();
helper.setText(R.id.txt_name, recommend.getTitle());
helper.setText(R.id.txt_intro, recommend.getDesc());
ImageView imgRecommend = helper.getView(R.id.img_recommend);
RoundedCorners roundedCorners = new RoundedCorners(5);
RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
Glide.with(mContext).load(recommend.getBackground()).apply(options).into(imgRecommend);
View layoutItem = helper.getView(R.id.layout_item);
layoutItem.setOnClickListener(v -> Utils.showGoodsDetail(mContext, recommend.getGoods()));
}
}
package com.ihaoin.hooloo.device.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.bumptech.glide.Glide;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.StringAppend;
import com.ihaoin.hooloo.device.view.TrolleyView;
import java.util.List;
public class TrolleyAdapter extends BaseAdapter {
private Context mContext;
private TrolleyView trolleyView;
public TrolleyAdapter(Context context, TrolleyView trolleyView) {
this.mContext = context;
this.trolleyView = trolleyView;
}
@Override
public int getCount() {
return isEmpty() ? 0 : getTrolleyGoods().size();
}
@Override
public Object getItem(int position) {
return isEmpty() ? null : getTrolleyGoods().get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TrolleyGoods goods = (TrolleyGoods) this.getItem(position);
convertView = LayoutInflater.from(mContext).inflate(R.layout.item_trolley, null);
ToggleButton butnState = convertView.findViewById(R.id.butn_state);
ImageView imgThumbnail = convertView.findViewById(R.id.img_thumbnail);
TextView txtName = convertView.findViewById(R.id.txt_name);
TextView txtOptions = convertView.findViewById(R.id.txt_options);
TextView txtPrice = convertView.findViewById(R.id.txt_price);
TextView txtDiscount = convertView.findViewById(R.id.txt_discount);
View butnSubtract = convertView.findViewById(R.id.butn_subtract);
TextView txtCount = convertView.findViewById(R.id.txt_count);
View butnAdd = convertView.findViewById(R.id.butn_add);
butnState.setChecked(goods.getChecked());
txtName.setText(goods.getName());
if (!CollectionUtils.isEmpty(goods.getRules())) {
StringAppend stringAppend = new StringAppend("/");
goods.getRules().forEach(x -> stringAppend.append(x.getSpecName()));
txtOptions.setText(stringAppend.toString());
txtOptions.setVisibility(View.VISIBLE);
} else {
txtOptions.setVisibility(View.GONE);
}
txtPrice.setText(goods.getPrice().toString());
txtDiscount.setText(goods.getDiscount().toString());
txtCount.setText(goods.getCount().toString());
butnSubtract.setOnClickListener(v -> trolleyView.subtractGoods(position));
butnAdd.setOnClickListener(v -> trolleyView.addGoods(position));
Glide.with(mContext).load(goods.getPics().getThumbnail()).into(imgThumbnail);
return convertView;
}
private List<TrolleyGoods> getTrolleyGoods() {
return trolleyView.getTrolleyGoods();
}
@Override
public boolean isEmpty() {
return getTrolleyGoods() == null || getTrolleyGoods().isEmpty() ? true : false;
}
}
package com.ihaoin.hooloo.device.config;
public class AppConfig {
// pub
}
......@@ -3,18 +3,72 @@ package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
@Data
public class Category implements Serializable {
/** 分类id */
/**
* 分类id
*/
private Integer id;
/** 分类名称 */
/**
* 分类名称
*/
private String name;
/** 商品信息 */
/**
* 商品信息
*/
private List<Goods> goods;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Goods> getGoods() {
return goods;
}
public void setGoods(List<Goods> goods) {
this.goods = goods;
}
public Category(Integer id, String name, List<Goods> goods) {
this.setId(id);
this.setName(name);
this.setGoods(goods);
}
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (((Category) o).getId() == null) {
return false;
}
return this.getId().equals(((Category) o).getId());
}
@Override
public String toString() {
return this.getId().toString();
}
@Override
public int hashCode() {
return this.getId();
}
}
......@@ -4,17 +4,14 @@ package com.ihaoin.hooloo.device.data;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class Datas {
private Integer countOfOrder = 9;
private String tips = "http://www.baidu.com";
public static Integer COUNT_OF_ORDER = 9;
public static String tips = "http://www.baidu.com";
private List<String> leftImages;
private Map<Integer, String> rightImages;
public static List<String> leftImages;
public static Map<Integer, String> rightImages;
private List<Recommend> recommends;
private List<Category> categorys;
public static List<Recommend> recommends;
public static List<Category> categorys;
}
......@@ -4,9 +4,6 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
@Data
public class Goods implements Serializable {
/** 商品id */
private Integer goodId;
......@@ -28,4 +25,93 @@ public class Goods implements Serializable {
private List<String> tags;
/** SKU */
private List<Sku> skus;
// public Goods(Integer id, String name, Pics pics){
// this.setGoodId(id);
// this.setName(name);
// this.setPics(pics);
// }
//
// public Goods(){
// }
public Integer getGoodId() {
return goodId;
}
public void setGoodId(Integer goodId) {
this.goodId = goodId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Pics getPics() {
return pics;
}
public void setPics(Pics pics) {
this.pics = pics;
}
public List<GoodsSpec> getSpecs() {
return specs;
}
public void setSpecs(List<GoodsSpec> specs) {
this.specs = specs;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public List<Sku> getSkus() {
return skus;
}
public void setSkus(List<Sku> skus) {
this.skus = skus;
}
}
package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
@Data
public class GoodsRule {
public class GoodsRule implements Serializable {
/** 选项id */
private Integer ruleId;
/** 名称 */
private String ruleName;
/** 是否默认 */
private Integer isDefault;
/** 价格 */
private BigDecimal price;
public Integer getRuleId() {
return ruleId;
}
public Integer getIsDefault() {
return isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
public void setRuleId(Integer ruleId) {
this.ruleId = ruleId;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
......@@ -3,9 +3,7 @@ package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
@Data
public class GoodsSpec implements Serializable {
/** 规格id */
private Integer specId;
......@@ -13,4 +11,29 @@ public class GoodsSpec implements Serializable {
private String specName;
/** 选项列表 */
private List<GoodsRule> rules;
public Integer getSpecId() {
return specId;
}
public void setSpecId(Integer specId) {
this.specId = specId;
}
public String getSpecName() {
return specName;
}
public void setSpecName(String specName) {
this.specName = specName;
}
public List<GoodsRule> getRules() {
return rules;
}
public void setRules(List<GoodsRule> rules) {
this.rules = rules;
}
}
package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class Pics {
public class Pics implements Serializable {
/** 缩略图 */
private String thumbnail;
/** 介绍图 */
......@@ -15,4 +12,33 @@ public class Pics {
/** 详情图 */
private List<String> detailImages;
// public Pics(String thumbnail, List<String> introImages, List<String> detailImages) {
// this.thumbnail = thumbnail;
// this.introImages = introImages;
// this.detailImages = detailImages;
// }
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public List<String> getIntroImages() {
return introImages;
}
public void setIntroImages(List<String> introImages) {
this.introImages = introImages;
}
public List<String> getDetailImages() {
return detailImages;
}
public void setDetailImages(List<String> detailImages) {
this.detailImages = detailImages;
}
}
......@@ -2,19 +2,63 @@ package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import lombok.Data;
@Data
public class Recommend implements Serializable {
/** 推荐标题 */
/**
* 推荐标题
*/
private String title;
/** 推荐介绍 */
/**
* 推荐介绍
*/
private String desc;
/** 推荐背景图 */
/**
* 推荐背景图
*/
private String background;
/** 商品信息 */
/**
* 商品信息
*/
private Goods goods;
public Recommend(String title, String desc, String background, Goods goods) {
this.setTitle(title);
this.setDesc(desc);
this.setBackground(background);
this.setGoods(goods);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
public Goods getGoods() {
return goods;
}
public void setGoods(Goods goods) {
this.goods = goods;
}
}
package com.ihaoin.hooloo.device.data;
import com.chad.library.adapter.base.entity.SectionEntity;
/**
* Created by Jair on 2022/4/22.
*/
public class ScrollBean extends SectionEntity<ScrollBean.ScrollItemBean> {
public ScrollBean(boolean isHeader, String header) {
super(isHeader, header);
}
public ScrollBean(ScrollItemBean bean) {
super(bean);
}
public static class ScrollItemBean {
private Object obj;
private String type;
public ScrollItemBean(Object obj, String type) {
this.obj = obj;
this.type = type;
}
public Object getObject() {
return obj;
}
public String getType() {
return type;
}
}
}
package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
@Data
public class Sku implements Serializable {
/** sku id */
private Integer skuId;
/** 状态:0-售罄,1-可售 */
private Integer state;
/** 默认状态:0-否,1-是 */
private Integer isDefault;
/** 原价 */
private BigDecimal price;
/** 折扣价 */
private BigDecimal discount;
/** SKU规格 */
private List<SkuRule> rules;
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public Integer getIsDefault() {
return isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
public Integer getSkuId() {
return skuId;
}
public void setSkuId(Integer skuId) {
this.skuId = skuId;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public List<SkuRule> getRules() {
return rules;
}
public void setRules(List<SkuRule> rules) {
this.rules = rules;
}
}
package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
@Data
public class SkuRule {
public class SkuRule implements Serializable {
/** 规格id */
private Integer specId;
/** 规格名称 */
......@@ -16,4 +14,44 @@ public class SkuRule {
private String ruleName;
/** 价格 */
private BigDecimal price;
public Integer getSpecId() {
return specId;
}
public void setSpecId(Integer specId) {
this.specId = specId;
}
public String getSpecName() {
return specName;
}
public void setSpecName(String specName) {
this.specName = specName;
}
public Integer getRuleId() {
return ruleId;
}
public void setRuleId(Integer ruleId) {
this.ruleId = ruleId;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
package com.ihaoin.hooloo.device.data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
public class TrolleyGoods implements Serializable {
/**
* 自动生成id
*/
private Long id;
/**
* 是否选中
*/
private Boolean checked = true;
/** 商品信息 */
/**
* 商品id
*/
private Integer goodId;
/**
* 名称
*/
private String name;
/**
* 介绍
*/
private String desc;
/**
* 图片信息
*/
private Pics pics;
/**
* 标签
*/
private List<String> tags;
/** 购买sku信息 */
/**
* sku id
*/
private Integer skuId;
/**
* 状态:0-售罄,1-可售
*/
private Integer state;
/**
* 默认状态:0-否,1-是
*/
private Integer isDefault;
/**
* 原价
*/
private BigDecimal price;
/**
* 折扣价
*/
private BigDecimal discount;
/**
* SKU规格
*/
private List<SkuRule> rules;
/**
* 数量
*/
private Integer count;
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (((TrolleyGoods) o).getId() == null) {
return false;
}
return this.getId().equals(((TrolleyGoods) o).getId());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Boolean getChecked() {
return checked;
}
public void setChecked(Boolean checked) {
this.checked = checked;
}
public Integer getGoodId() {
return goodId;
}
public void setGoodId(Integer goodId) {
this.goodId = goodId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Pics getPics() {
return pics;
}
public void setPics(Pics pics) {
this.pics = pics;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public Integer getSkuId() {
return skuId;
}
public void setSkuId(Integer skuId) {
this.skuId = skuId;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Integer getIsDefault() {
return isDefault;
}
public void setIsDefault(Integer isDefault) {
this.isDefault = isDefault;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public List<SkuRule> getRules() {
return rules;
}
public void setRules(List<SkuRule> rules) {
this.rules = rules;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
package com.ihaoin.hooloo.device.util;
import java.util.Collection;
public class CollectionUtils {
public static Boolean isEmpty(Collection collection) {
if (collection == null || collection.isEmpty()) {
return true;
}
return false;
}
}
package com.ihaoin.hooloo.device.util;
import java.util.List;
import java.util.Random;
public class RandomUtils {
public static Long nextLong(List<Long> longs) {
Long val = new Random().nextLong();
if (CollectionUtils.isEmpty(longs)) {
return val;
}
if (longs.contains(val)) {
return nextLong(longs);
}
return val;
}
}
package com.ihaoin.hooloo.device.util;
import java.util.List;
public class StringAppend {
public static final String SPLITER_ENTER = "\n";
private StringBuffer stringBuffer = new StringBuffer();
private String spliter = "";
public StringAppend(String spliter) {
this.spliter = spliter;
}
public StringAppend append(String string) {
if (StringUtils.isEmpty(string)) {
return this;
}
if (stringBuffer.length() > 0) {
stringBuffer.append(spliter);
}
stringBuffer.append(string);
return this;
}
public StringAppend append(List<String> list) {
if (list == null || list.isEmpty()) {
return this;
}
list.forEach(item -> {
this.append(item);
});
return this;
}
@Override
public String toString() {
return stringBuffer.toString();
}
}
package com.ihaoin.hooloo.device.util;
public class StringUtils {
public static Boolean isEmpty(String s) {
if (s == null || s.isEmpty()) {
return true;
}
return false;
}
}
package com.ihaoin.hooloo.device.util;
import android.content.Context;
import android.content.Intent;
import android.util.DisplayMetrics;
import com.ihaoin.hooloo.device.data.Goods;
import com.ihaoin.hooloo.device.data.Sku;
import com.ihaoin.hooloo.device.view.GoodsDetailDialog;
import com.ihaoin.hooloo.device.view.TipsDialog;
public class Utils {
public static String ADD_TROLLEY_ACTION = "";
public static void sendBroadcast(Context context, Goods goods, Sku sku, Integer count) {
Intent intent = new Intent();
intent.setAction(Utils.ADD_TROLLEY_ACTION);
intent.putExtra("goods", goods);
intent.putExtra("sku", sku);
intent.putExtra("count", count);
context.sendBroadcast(intent);
}
public static void showGoodsDetail(Context context, Goods goods) {
GoodsDetailDialog dialog = new GoodsDetailDialog(context, goods);
dialog.show();
}
public static void showTips(Context context) {
TipsDialog dialog = new TipsDialog(context);
dialog.show();
}
/**
* 获得资源 dimens (dp)
*
* @param context
* @param id 资源id
* @return
*/
public static float getDimens(Context context, int id) {
DisplayMetrics dm = context.getResources().getDisplayMetrics();
float px = context.getResources().getDimension(id);
return px / dm.density;
}
/**
* dp转px
*
* @param context
* @param dp
* @return
*/
public static int dpToPx(Context context, float dp) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((dp * displayMetrics.density) + 0.5f);
}
}
package com.ihaoin.hooloo.device.view;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.Goods;
import com.ihaoin.hooloo.device.util.CollectionUtils;
import com.ihaoin.hooloo.device.util.StringUtils;
import com.ihaoin.hooloo.device.util.Utils;
public class GoodsDetailDialog extends Dialog {
private Goods goods;
private View butnClose;
private ImageView imgIntro;
private TextView txtName;
private LinearLayout layoutSpecs;
private LinearLayout layoutImages;
private TextView txtPrice;
private TextView txtDiscount;
private Button butnSubtract;
private TextView txtCount;
private Button butnAdd;
private Button butnBuy;
private Button butnTrolley;
private Integer count;
public GoodsDetailDialog(@NonNull Context context, Goods goods) {
super(context);
this.goods = goods;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.view_goods_detail);
initViews();
}
private void initViews() {
butnClose = findViewById(R.id.butn_close);
imgIntro = findViewById(R.id.img_intro);
txtName = findViewById(R.id.txt_name);
layoutSpecs = findViewById(R.id.layout_specs);
layoutImages = findViewById(R.id.layout_images);
txtPrice = findViewById(R.id.txt_price);
txtDiscount = findViewById(R.id.txt_discount);
butnSubtract = findViewById(R.id.butn_subtract);
txtCount = findViewById(R.id.txt_count);
butnAdd = findViewById(R.id.butn_add);
butnBuy = findViewById(R.id.butn_buy);
butnTrolley = findViewById(R.id.butn_trolley);
butnClose.setOnClickListener(x -> dismiss());
Glide.with(getContext()).load(goods.getPics().getIntroImages().get(0)).into(imgIntro);
txtName.setText(goods.getName());
buildSpecs();
buildDetails();
}
private void buildSpecs() {
if (CollectionUtils.isEmpty(goods.getSpecs())) {
return;
}
goods.getSpecs().forEach(spec -> {
if (CollectionUtils.isEmpty(spec.getRules())) {
return;
}
View specView = getLayoutInflater().inflate(R.layout.item_spec, null);
TextView txtName = specView.findViewById(R.id.txt_name);
RadioGroup specGroup = specView.findViewById(R.id.group_spec);
txtName.setText(spec.getSpecName());
spec.getRules().forEach(rule -> {
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT);
layoutParams.rightMargin = Utils.dpToPx(getContext(), 5);
RadioButton button = (RadioButton) getLayoutInflater().inflate(R.layout.item_spec_rule, null);
button.setId(rule.getRuleId());
button.setText(rule.getRuleName());
if (rule.getIsDefault() != null && rule.getIsDefault().equals(1)) {
button.setChecked(true);
}
specGroup.addView(button, layoutParams);
});
layoutSpecs.addView(specView);
});
}
private void buildDetails() {
if (goods.getPics() == null || CollectionUtils.isEmpty(goods.getPics().getDetailImages())) {
return;
}
goods.getPics().getDetailImages().forEach(url -> {
if (StringUtils.isEmpty(url)) {
return;
}
ImageView imageView = new ImageView(getContext());
imageView.setAdjustViewBounds(true);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.bottomMargin = Utils.dpToPx(getContext(), 5);
Glide.with(getContext()).load(url).into(imageView);
layoutImages.addView(imageView, layoutParams);
});
}
}
package com.ihaoin.hooloo.device.view;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.adapter.GoodsAdapter;
import com.ihaoin.hooloo.device.adapter.RecommendAdapter;
import com.ihaoin.hooloo.device.data.Category;
import com.ihaoin.hooloo.device.data.Goods;
import com.ihaoin.hooloo.device.data.Pics;
import com.ihaoin.hooloo.device.data.Recommend;
import com.ihaoin.hooloo.device.data.ScrollBean;
import com.ihaoin.hooloo.device.data.Sku;
import com.ihaoin.hooloo.device.util.Utils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class LauncherActivity extends Activity {
private RadioGroup groupCategory;
private RecyclerView recGoods;
private RecyclerView recRecommends;
// private TextView rightTitle;
private List<Recommend> recommends;
private List<ScrollBean> scrollRecommends;
private List<Category> categorys;
private List<ScrollBean> scrollGoods;
private GridLayoutManager recommendManager;
private LinearLayoutManager goodsLayoutManager;
private RecommendAdapter recommendAdapter;
private GoodsAdapter goodsAdapter;
//右侧title在数据中所对应的position集合
private List<Integer> tPosition = new ArrayList<>();
//记录商品当前可见的第一个item的position
private int first = 0;
private Context mContext;
private TrolleyView trolleyView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launcher);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
mContext = this;
trolleyView = findViewById(R.id.view_trolley);
groupCategory = findViewById(R.id.group_category);
recGoods = findViewById(R.id.rec_right);
recRecommends = findViewById(R.id.rec_recommend);
try {
initData();
} catch (JsonProcessingException e) {
e.printStackTrace();
}
initRecommends();
initCategorys();
initGoods();
this.registerdAddReceiver();
}
private void initRecommends() {
recommendManager = new GridLayoutManager(mContext, 2);
recommendManager.setSpanSizeLookup(new MySpanSizeLookup());
recRecommends.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
outRect.left = Utils.dpToPx(LauncherActivity.this, 10);
outRect.bottom = Utils.dpToPx(LauncherActivity.this, 10);
}
});
if (recommendAdapter == null) {
recommendAdapter = new RecommendAdapter(this, R.layout.item_recommend, R.layout.item_logo);
recRecommends.setAdapter(recommendAdapter);
recRecommends.setLayoutManager(recommendManager);
} else {
recommendAdapter.notifyDataSetChanged();
}
scrollRecommends = new ArrayList<>();
ScrollBean header = new ScrollBean(true, null);
scrollRecommends.add(header);
recommends.forEach(x -> scrollRecommends.add(new ScrollBean(new ScrollBean.ScrollItemBean(x, null))));
recommendAdapter.setNewData(scrollRecommends);
}
class MySpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
@Override
public int getSpanSize(int position) {
Log.d("TEST", "position:" + position);
if (position == 0 || position == 1) {
return 2;
}
return 1;
}
}
private void initGoods() {
goodsLayoutManager = new LinearLayoutManager(mContext);
if (goodsAdapter == null) {
goodsAdapter = new GoodsAdapter(this, R.layout.item_goods, R.layout.item_goods_category);
recGoods.setAdapter(goodsAdapter);
recGoods.setLayoutManager(goodsLayoutManager);
} else {
goodsAdapter.notifyDataSetChanged();
}
goodsAdapter.setNewData(scrollGoods);
// 商品滚动时同时设置分类变化
recGoods.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
//因为每次滑动之后,右侧列表中可见的第一个item的position肯定会改变,并且右侧列表中可见的第一个item的position变换了之后,
//才有可能改变右侧title的值,所以这个方法内的逻辑在右侧可见的第一个item的position改变之后一定会执行
int firstPosition = goodsLayoutManager.findFirstVisibleItemPosition();
String title = "";
if (first != firstPosition && firstPosition >= 0) {
//给first赋值
first = firstPosition;
//判断如果右侧可见的第一个item是否是header,设置相应的值
if (scrollGoods.get(first).isHeader) {
title = scrollGoods.get(first).header;
} else {
title = scrollGoods.get(first).t.getType();
}
}
//遍历左边列表,列表对应的内容等于右边的title,则设置左侧对应item高亮
for (int i = 0; i < categorys.size(); i++) {
if (categorys.get(i).getName().equals(title)) {
// leftAdapter.selectItem(i);
if (groupCategory.getCheckedRadioButtonId() == categorys.get(i).getId()) {
break;
}
View view = groupCategory.findViewById(categorys.get(i).getId());
view.performClick();
}
}
}
});
}
private void initCategorys() {
groupCategory.removeAllViews();
if (categorys == null || categorys.isEmpty()) {
return;
}
categorys.forEach(category -> {
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
RadioButton view = (RadioButton) this.getLayoutInflater().inflate(R.layout.item_category, null);
view.setText(category.getName());
view.setId(category.getId());
view.setTag(category);
groupCategory.addView(view, layoutParams);
view.setOnClickListener(v -> {
Integer checkedId = v.getId();
Category category1 = (Category) groupCategory.findViewById(checkedId).getTag();
int position = categorys.indexOf(category1);
goodsLayoutManager.scrollToPositionWithOffset(tPosition.get(position), 0);
for (int i = 0; i < groupCategory.getChildCount(); i++) {
View child = groupCategory.getChildAt(i);
if (!(child instanceof RadioButton)) {
continue;
}
RadioButton butn = (RadioButton) child;
if (butn.getId() == checkedId) {
butn.getPaint().setFakeBoldText(true);
} else {
butn.getPaint().setFakeBoldText(false);
}
}
});
});
// 添加温馨提示
RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
TextView view = (TextView) this.getLayoutInflater().inflate(R.layout.item_tips, null);
groupCategory.addView(view, layoutParams);
view.setOnClickListener(v -> Utils.showTips(LauncherActivity.this));
groupCategory.check(categorys.get(0).getId());
}
//获取数据(若请求服务端数据,请求到的列表需有序排列)
private void initData() throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
Pics p1 = new Pics();
Pics p2 = new Pics();
Pics p3 = new Pics();
p1.setThumbnail("https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118");
p2.setThumbnail("https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/baike/s%3D220/sign=6e742a00ff03918fd3d13ac8613c264b/d439b6003af33a87e4037dface5c10385243b5e7.jpg");
p3.setThumbnail("https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftx18%2F0217202021933.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1653792863&t=ec8778ab3ff1891dbd8e715956097181");
// Goods g1 = new Goods(1, "冰茶咖啡1", p1);
// Goods g2 = new Goods(2, "冰茶咖啡2", p2);
// Goods g3 = new Goods(3, "冰茶咖啡3", p3);
// Goods g4 = new Goods(4, "冰茶咖啡4", p1);
// Goods g5 = new Goods(5, "冰茶咖啡5", p2);
// Goods g6 = new Goods(6, "冰茶咖啡6", p3);
// Goods g7 = new Goods(7, "冰茶咖啡7", p3);
// Goods g8 = new Goods(7, "冰茶咖啡8", p3);
// Goods g9 = new Goods(7, "冰茶咖啡9", p3);
// Goods g10 = new Goods(7, "冰茶咖啡10", p3);
// Goods g11 = new Goods(7, "冰茶咖啡11", p3);
// Goods g12 = new Goods(7, "冰茶咖啡12", p3);
// Goods g13 = new Goods(7, "冰茶咖啡13", p3);
// Goods g14 = new Goods(7, "冰茶咖啡14", p3);
// Goods g15 = new Goods(7, "冰茶咖啡15", p3);
// Goods g16 = new Goods(7, "冰茶咖啡16", p3);
// Goods g17 = new Goods(7, "冰茶咖啡17", p3);
// Goods g18 = new Goods(7, "冰茶咖啡18", p3);
// Goods g19 = new Goods(7, "冰茶咖啡19", p3);
// Goods g20 = new Goods(7, "冰茶咖啡20", p3);
// Goods g21 = new Goods(7, "冰茶咖啡21", p3);
// Goods g22 = new Goods(7, "冰茶咖啡22", p3);
Goods g1 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"isDefault\":1,\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"isDefault\":1,\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"isDefault\":1,\"skuId\":1,\"state\":1,\"price\":10.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"price\":11.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"price\":12.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"price\":13.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g2 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g3 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g4 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g5 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g6 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g7 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g8 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g9 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g10 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g11 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g12 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g13 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g14 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g15 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g16 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g17 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g18 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g19 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g20 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g21 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Goods g22 = objectMapper.readValue("{\"goodId\":100,\"name\":\"冰茶咖啡\",\"price\":29.9,\"discount\":19.9,\"pics\":{\"thumbnail\":\"https://img1.baidu.com/it/u=3426268058,1014861135&fm=253&fmt=auto&app=138&f=JPEG?w=190&h=118\",\"introImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg\"],\"detailImages\":[\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg\",\"https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg\"]},\"desc\":\"\",\"remark\":\"\",\"tags\":[\"YYDS\",\"杨幂同款\"],\"specs\":[{\"specId\":1,\"specName\":\"温度\",\"rules\":[{\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0},{\"ruleId\":2,\"ruleName\":\"加冰\",\"price\":2},{\"ruleId\":3,\"ruleName\":\"加热\",\"price\":3}]},{\"specId\":2,\"specName\":\"糖度\",\"rules\":[{\"ruleId\":4,\"ruleName\":\"无糖\",\"price\":0},{\"ruleId\":5,\"ruleName\":\"少糖\",\"price\":1},{\"ruleId\":6,\"ruleName\":\"多糖\",\"price\":2}]}],\"skus\":[{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":2,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":2.00}]},{\"skuId\":1,\"state\":1,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"加糖\",\"price\":4.00}]}]}", Goods.class);
Sku s1 = objectMapper.readValue("{\"skuId\":1,\"state\":1,\"isDefault\":1,\"price\":20.9,\"discount\":19.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"常温\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]}", Sku.class);
Sku s2 = objectMapper.readValue("{\"skuId\":1,\"state\":1,\"isDefault\":1,\"price\":21.9,\"discount\":39.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"冰\",\"price\":2.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"多糖\",\"price\":1.00}]}", Sku.class);
Sku s3 = objectMapper.readValue("{\"skuId\":1,\"state\":1,\"isDefault\":1,\"price\":22.9,\"discount\":49.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"热\",\"price\":3.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"少糖\",\"price\":4.00}]}", Sku.class);
Sku s4 = objectMapper.readValue("{\"skuId\":1,\"state\":1,\"isDefault\":1,\"price\":23.9,\"discount\":59.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"不冰\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"无糖\",\"price\":0.00}]}", Sku.class);
Sku s5 = objectMapper.readValue("{\"skuId\":1,\"state\":1,\"isDefault\":1,\"price\":24.9,\"discount\":69.9,\"rules\":[{\"specId\":1,\"specName\":\"温度\",\"ruleId\":1,\"ruleName\":\"不热\",\"price\":0.00},{\"specId\":2,\"specName\":\"糖度\",\"ruleId\":3,\"ruleName\":\"多糖\",\"price\":1.00}]}", Sku.class);
// g1.setSkus(Arrays.asList(s1, s2, s3));
g2.setSkus(Arrays.asList(s5, s2, s3));
g3.setSkus(Arrays.asList(s4, s2));
g4.setSkus(Arrays.asList(s3, s5));
g5.setSkus(Arrays.asList(s2, s1));
Category c1 = new Category(1, "分类一", Arrays.asList(g1, g2, g3));
Category c2 = new Category(2, "分类二", Arrays.asList(g4, g5, g6, g7, g8));
Category c3 = new Category(3, "分类三", Arrays.asList(g9, g10));
Category c4 = new Category(4, "分类四", Arrays.asList(g11));
Category c5 = new Category(5, "分类五", Arrays.asList(g12, g13, g14, g15, g16, g17, g18, g19, g20, g21, g22));
Recommend r1 = new Recommend("推荐一", "介绍一介绍一介绍一介绍一介绍一", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F2ff161bap00qzik7b00aad000t700inp.png&thumbnail=660x2147483647&quality=80&type=jpg", g1);
Recommend r2 = new Recommend("推荐二", "介介绍二介绍二绍二介绍二介绍二", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2F5527f996p00qzikdu00avd000th00inp.png&thumbnail=660x2147483647&quality=80&type=jpg", g2);
Recommend r3 = new Recommend("推荐三", "推荐三推荐三推荐三推荐三推荐三", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0916%2Fbe0a3f04p00qziken00cvd000te00ikp.png&thumbnail=660x2147483647&quality=80&type=jpg", g3);
Recommend r4 = new Recommend("推荐四", "推荐四推荐四推荐四", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1019%2F3f2df175j00r174rk006vc000us00n4c.jpg&thumbnail=660x2147483647&quality=80&type=jpg", g4);
Recommend r5 = new Recommend("推荐五", "推荐五推荐五", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2021%2F1019%2F7dd6faa1j00r174rk005gc000us00n4c.jpg&thumbnail=660x2147483647&quality=80&type=jpg", g5);
recommends = Arrays.asList(r1, r2, r3, r4, r5);
categorys = Arrays.asList(c1, c2, c3, c4, c5);
scrollGoods = new ArrayList<>();
categorys.forEach(category -> {
scrollGoods.add(new ScrollBean(true, category.getName()));
category.getGoods().forEach(goods -> {
scrollGoods.add(new ScrollBean(new ScrollBean.ScrollItemBean(goods, category.getName())));
});
});
for (int i = 0; i < scrollGoods.size(); i++) {
if (scrollGoods.get(i).isHeader) {
//遍历右侧列表,判断如果是header,则将此header在右侧列表中所在的position添加到集合中
tPosition.add(i);
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
this.unregisterAddReceiver();
}
private AddReceiver addReceiver = null;
private void registerdAddReceiver() {
if (addReceiver == null) {
addReceiver = new AddReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Utils.ADD_TROLLEY_ACTION);
this.registerReceiver(addReceiver, intentFilter);
}
}
private void unregisterAddReceiver() {
if (addReceiver != null) {
this.unregisterReceiver(addReceiver);
addReceiver = null;
}
}
class AddReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Goods goods = (Goods) intent.getSerializableExtra("goods");
Sku sku = (Sku) intent.getSerializableExtra("sku");
Integer count = intent.getIntExtra("count", 1);
trolleyView.addGoods(goods, sku, count);
}
}
}
package com.ihaoin.hooloo.device.view;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.data.Datas;
public class TipsDialog extends Dialog {
private View butnClose;
private WebView webView;
public TipsDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.view_tips);
initViews();
}
private void initViews() {
webView = findViewById(R.id.web_view);
butnClose = findViewById(R.id.butn_close);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return false;
}
});
webView.loadUrl(Datas.tips);
butnClose.setOnClickListener(x -> dismiss());
}
}
package com.ihaoin.hooloo.device.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.ihaoin.hooloo.device.R;
import com.ihaoin.hooloo.device.adapter.TrolleyAdapter;
import com.ihaoin.hooloo.device.data.Datas;
import com.ihaoin.hooloo.device.data.Goods;
import com.ihaoin.hooloo.device.data.Sku;
import com.ihaoin.hooloo.device.data.TrolleyGoods;
import com.ihaoin.hooloo.device.util.RandomUtils;
import com.ihaoin.hooloo.device.util.Utils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class TrolleyView extends RelativeLayout {
private List<TrolleyGoods> trolleyGoods = new ArrayList<>();
private Boolean state = false;
private Boolean trolleyAniming = false;
private View butnClear;
private View viewBackground;
private View layoutTrolley;
private ListView listTrolley;
private View layoutSettleBar;
private TextView txtCount;
private TextView txtTotal;
private View butnPay;
TrolleyAdapter trolleyAdapter;
private void init() {
View view = LayoutInflater.from(getContext()).inflate(R.layout.view_trolley, this);
butnClear = view.findViewById(R.id.butn_clear);
viewBackground = view.findViewById(R.id.view_background);
layoutTrolley = view.findViewById(R.id.layout_trolley);
listTrolley = view.findViewById(R.id.list_trolley);
layoutSettleBar = view.findViewById(R.id.layout_settle_bar);
txtCount = view.findViewById(R.id.txt_count);
txtTotal = view.findViewById(R.id.txt_total);
butnPay = view.findViewById(R.id.butn_pay);
this.setView();
trolleyAdapter = new TrolleyAdapter(this.getContext(), this);
listTrolley.setAdapter(trolleyAdapter);
butnClear.setOnClickListener(v -> clearTrolley());
layoutSettleBar.setOnClickListener(v -> toggleTrolley());
viewBackground.setOnClickListener(v -> closeTrolley());
butnPay.setOnClickListener(v -> showPayDialog());
}
public void addGoods(Goods goods, Sku sku, Integer count) {
if (getCount() >= Datas.COUNT_OF_ORDER) {
Toast.makeText(this.getContext(), String.format("每个订单商品数量不能越过%s个", Datas.COUNT_OF_ORDER), Toast.LENGTH_SHORT).show();
return;
}
Optional<TrolleyGoods> optional = this.trolleyGoods.stream().filter(x -> x.getGoodId().equals(goods.getGoodId()) && x.getSkuId().equals(sku.getSkuId())).findAny();
// 判断是否在购物车里存在同样规格的产品
if (optional.isPresent()) {
TrolleyGoods g = optional.get();
g.setCount(g.getCount() + 1);
} else {
TrolleyGoods g = new TrolleyGoods();
g.setId(RandomUtils.nextLong(trolleyGoods.stream().map(TrolleyGoods::getId).collect(Collectors.toList())));
g.setChecked(true);
g.setGoodId(goods.getGoodId());
g.setName(goods.getName());
g.setDesc(goods.getDesc());
g.setPics(goods.getPics());
g.setTags(goods.getTags());
g.setSkuId(sku.getSkuId());
g.setState(sku.getState());
g.setIsDefault(sku.getIsDefault());
g.setPrice(sku.getPrice());
g.setDiscount(sku.getDiscount());
g.setRules(sku.getRules());
g.setCount(count);
this.trolleyGoods.add(g);
}
this.measureListHeight();
this.goodsChanged();
}
public void addGoods(Integer position) {
TrolleyGoods goods = this.trolleyGoods.get(position);
goods.setCount(goods.getCount() + 1);
this.goodsChanged();
}
public void subtractGoods(Integer position) {
TrolleyGoods goods = this.trolleyGoods.get(position);
if (goods.getCount() <= 1) {
this.trolleyGoods.remove(goods);
} else {
goods.setCount(goods.getCount() - 1);
}
this.goodsChanged();
}
private void goodsChanged() {
this.trolleyAdapter.notifyDataSetChanged();
// BigDecimal discountTotal = this.getTrolleyGoods().stream().map(TrolleyGoods::getDiscount).reduce(BigDecimal.ZERO, BigDecimal::add);
this.txtCount.setText(getCount().toString());
this.txtTotal.setText(getTotal().toString());
this.setView();
}
private Integer getCount() {
return this.getTrolleyGoods().stream().collect(Collectors.summingInt(TrolleyGoods::getCount));
}
private BigDecimal getTotal() {
return this.getTrolleyGoods().stream().map(x -> x.getDiscount().multiply(new BigDecimal(x.getCount()))).reduce(BigDecimal.ZERO, BigDecimal::add);
}
private void setView() {
if (this.trolleyGoods.isEmpty()) {
this.setVisibility(View.INVISIBLE);
viewBackground.setVisibility(View.INVISIBLE);
layoutTrolley.setVisibility(View.INVISIBLE);
state = false;
} else {
this.setVisibility(View.VISIBLE);
}
}
private void measureListHeight() {
int count = this.trolleyGoods.size() > 2 ? 2 : this.trolleyGoods.size();
int height = Utils.dpToPx(this.getContext(), 100 * count);
ViewGroup.LayoutParams layoutParams = listTrolley.getLayoutParams();
layoutParams.height = height;
listTrolley.setLayoutParams(layoutParams);
}
private void clearTrolley() {
this.trolleyGoods.clear();
setView();
}
private void toggleTrolley() {
if (state) {
closeTrolley();
} else {
openTrolley();
}
}
private void openTrolley() {
if (trolleyAniming) {
return;
}
trolleyAniming = true;
viewBackground.setOnClickListener(v -> closeTrolley());
layoutTrolley.setOnClickListener(v -> {
});
viewBackground.setVisibility(View.VISIBLE);
layoutTrolley.setVisibility(View.VISIBLE);
Animation animation = AnimationUtils.loadAnimation(this.getContext(), R.anim.trolley_translate_in);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
trolleyAniming = false;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
layoutTrolley.startAnimation(animation);
state = true;
}
private void closeTrolley() {
if (trolleyAniming) {
return;
}
trolleyAniming = true;
Animation animation = AnimationUtils.loadAnimation(this.getContext(), R.anim.trolley_translate_out);
layoutTrolley.startAnimation(animation);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
viewBackground.setVisibility(View.INVISIBLE);
layoutTrolley.setVisibility(View.INVISIBLE);
state = false;
trolleyAniming = false;
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
private void showPayDialog() {
}
public TrolleyView(Context context) {
super(context);
init();
}
public TrolleyView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TrolleyView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public TrolleyView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
public List<TrolleyGoods> getTrolleyGoods() {
return trolleyGoods;
}
}
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromYDelta="100%p"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toYDelta="0%p" />
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromYDelta="0%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toYDelta="100%" />
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke
android:width="0.5px"
android:color="@color/colorPrimary" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid
android:width="1dp"
android:color="@color/colorPrimary" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="5dp" />
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M15,5L15,25"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
<path
android:pathData="M5,15H25,15"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
</vector>
</item>
</layer-list>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:alpha="0.9"
android:tint="@color/colorPrimary"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/colorPrimary"
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" />
</vector>
<vector android:height="18dp" android:tint="#999999"
android:viewportHeight="24" android:viewportWidth="24"
android:width="18dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8,9h8v10L8,19L8,9zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M5,15L13,22"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
<path
android:pathData="M12.4,21.9L23,9"
android:strokeWidth="1"
android:strokeColor="#FFFFFF" />
</vector>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M0,0L0,30"
android:strokeWidth="2"
android:strokeColor="@color/colorPrimary" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M0,0L0,30"
android:strokeWidth="0.5"
android:strokeColor="@color/line" />
</vector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="@color/line"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/black"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12 19,6.41z" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
<item>
<vector
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M5,15H25,15"
android:strokeWidth="1"
android:strokeColor="@color/colorPrimary" />
</vector>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
<size
android:width="30dp"
android:height="30dp" />
</shape>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<item android:drawable="@drawable/ic_checked" android:state_checked="true" />
<item android:drawable="@drawable/ic_checked" android:state_selected="true" />
<item android:drawable="@drawable/ic_uncheck" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/textPrimary" android:state_checked="true" />
<item android:color="@color/textPrimary" android:state_pressed="true" />
<item android:color="@color/textPrimary" android:state_selected="true" />
<item android:color="@color/textPrimary" android:state_focused="true" />
<item android:color="@color/textSecondPrimary" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_label_checked" android:state_checked="true" />
<item android:drawable="@drawable/ic_label_checked" android:state_pressed="true" />
<item android:drawable="@drawable/ic_label_checked" android:state_selected="true" />
<item android:drawable="@drawable/ic_label_checked" android:state_focused="true" />
<item android:drawable="@drawable/ic_label_uncheck" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_spec_checked" android:state_checked="true" />
<item android:drawable="@drawable/bg_spec_checked" android:state_pressed="true" />
<item android:drawable="@drawable/bg_spec_checked" android:state_selected="true" />
<item android:drawable="@drawable/bg_spec_checked" android:state_focused="true" />
<item android:drawable="@drawable/bg_spec_uncheck" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/white" android:state_checked="true" />
<item android:color="@color/white" android:state_pressed="true" />
<item android:color="@color/white" android:state_selected="true" />
<item android:color="@color/white" android:state_focused="true" />
<item android:color="@color/textPrimary" />
</selector>
......@@ -5,45 +5,43 @@
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".view.LauncherActivity">
<include
layout="@layout/view_trolley"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_recommends"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_recommend"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="vertical" />
android:layout_weight="7" />
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
android:layout_weight="4">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_spu"
android:id="@+id/rec_right"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/right_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black"
android:singleLine="true"
android:textSize="14sp" />
</FrameLayout>
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:background="@android:color/black" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rec_category"
<ScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
android:layout_weight="1.3"
android:scrollbars="none">
<RadioGroup
android:id="@+id/group_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@color/line"
android:dividerPadding="20dp"
android:gravity="center"
android:orientation="vertical"
android:showDividers="middle" />
</ScrollView>
</LinearLayout>
<com.ihaoin.hooloo.device.view.TrolleyView
android:id="@+id/view_trolley"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sel_category_label"
android:button="@null"
android:gravity="center"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:textColor="@drawable/sel_category_color"
android:textSize="12sp" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginEnd="10dp"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom"
android:orientation="vertical">
<TextView
android:id="@+id/txt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@color/textPrimary"
android:textSize="14sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_tags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="center_vertical"
android:orientation="horizontal" />
<TextView
android:id="@+id/txt_intro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="茶叶与咖啡完美的碰撞"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@color/textRed"
android:textSize="12sp"
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@color/textSecondPrimary"
android:textSize="9sp" />
<Button
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/ic_add" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/txt_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:singleLine="true"
android:textColor="@color/textPrimary"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@mipmap/logo" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_item"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_recommend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_name"
android:layout_marginStart="30dp"
android:layout_marginTop="10dp"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="温度"
android:textColor="@color/textPrimary"
android:textSize="16sp"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/group_spec"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/butn_rule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/sel_spec_bg"
android:button="@null"
android:paddingStart="15dp"
android:paddingTop="5dp"
android:paddingEnd="15dp"
android:paddingBottom="5dp"
android:singleLine="true"
android:textColor="@drawable/sel_spec_color"
android:textSize="12sp" />
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp">
<TextView
android:id="@+id/txt_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_tag"
android:padding="3dp"
android:singleLine="true"
android:textColor="@color/colorPrimary"
android:textSize="9sp"
tools:ignore="SmallSp" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:drawableEnd="@drawable/ic_baseline_chevron_right_24"
android:gravity="center"
android:padding="10dp"
android:text="温馨提示"
android:textColor="@color/colorPrimary"
android:textSize="9sp" />
......@@ -6,14 +6,21 @@
android:orientation="horizontal"
android:padding="10dp">
<ToggleButton
android:id="@+id/butn_checked"
android:layout_width="30dp"
android:layout_height="30dp" />
android:id="@+id/butn_state"
style="@style/button_style"
android:layout_width="25dp"
android:layout_height="25dp"
android:background="@drawable/sel_butn_check"
android:checked="true"
android:textOff=""
android:textOn="" />
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
android:layout_marginRight="10dp"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -24,7 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
......@@ -33,61 +40,70 @@
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="冰/无糖"
android:textColor="@android:color/darker_gray"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:gravity="center_vertical"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_original_price"
android:id="@+id/txt_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ms__arrow"
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@android:color/black"
android:textColor="@color/textRed"
android:textSize="12sp"
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount_price"
android:layout_width="wrap_content"
android:id="@+id/txt_discount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/ms__arrow"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@android:color/darker_gray"
android:textColor="@color/textSecondPrimary"
android:textSize="9sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/butn_subtract"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ms__arrow" />
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/ic_sub" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="1"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
<Button
android:id="@+id/butn_add"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ms__menu_down" />
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/ic_add" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white">
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -14,7 +14,7 @@
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="确认订单"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="24sp"
android:textStyle="bold" />
<ImageView
......@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="使用微信扫一扫,确认订单并付款"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="20sp" />
<TextView
android:id="@+id/txt_times"
......@@ -42,7 +42,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="60秒后失效"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
......@@ -59,20 +59,20 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫码成功"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="在微信小程序上确认订单并付款"
android:textColor="@android:color/black"
android:textColor="@color/textPrimary"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
......@@ -81,7 +81,7 @@
android:id="@+id/butn_close"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
android:src="@drawable/ms__arrow" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_width="600dp"
android:layout_height="match_parent">
<ScrollView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/img_intro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:src="@mipmap/wx20220427" />
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_categorys"
android:layout_width="match_parent"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/img_intro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical" />
android:layout_margin="10dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:src="@mipmap/wx20220427" />
<LinearLayout
android:id="@+id/layout_images"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical" />
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/txt_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="冰茶咖啡"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/layout_specs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<LinearLayout
android:id="@+id/layout_images"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/darker_gray"
android:orientation="vertical"
android:padding="10dp">
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:layout_alignParentBottom="true"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_original_price"
android:layout_width="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ms__arrow"
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@android:color/black"
android:textSize="12sp"
android:textStyle="bold" />
android:layout_weight="1"
android:gravity="bottom"
android:orientation="horizontal">
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="19.9"
android:textColor="@color/textRed"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_discount_price"
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="5dp"
android:src="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_discount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@color/textSecondPrimary"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:drawableLeft="@drawable/ms__arrow"
android:gravity="center_vertical"
android:text="29.9"
android:textColor="@android:color/darker_gray"
android:textSize="9sp" />
android:layout_marginStart="10dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/butn_subtract"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/ic_sub" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="1"
android:textColor="@color/textPrimary"
android:textSize="12sp" />
<Button
android:id="@+id/butn_add"
style="@style/button_style"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/ic_add" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/butn_subtract"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ms__arrow" />
<TextView
android:id="@+id/txt_count"
android:layout_width="wrap_content"
android:id="@+id/butn_trolley"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="1"
android:textColor="@android:color/black"
android:textSize="12sp" />
android:layout_weight="1"
android:background="@drawable/bg_button"
android:text="加入购物袋"
android:textColor="@color/colorPrimary"
android:textStyle="bold" />
<Button
android:id="@+id/butn_add"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ms__menu_down" />
android:id="@+id/butn_buy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="立即购买"
android:textColor="@color/white"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<Button
android:id="@+id/butn_buy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:text="立即购买" />
<Button
android:id="@+id/butn_trolley"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="加入购物袋" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/butn_close"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ms__arrow"
android:layout_alignParentRight="true"
android:layout_margin="20dp"/>
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
android:src="@drawable/ic_outline_close_24" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="600dp"
android:layout_height="match_parent">
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/butn_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
android:src="@drawable/ic_outline_close_24" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/layout_trolley"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/holo_red_dark"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/view_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialog_bg"
android:visibility="invisible">
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/layout_trolley"
android:layout_width="400dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="60dp"
android:background="@android:color/white"
android:orientation="vertical"
android:visibility="invisible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:text="购物袋"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="@+id/butn_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@null"
android:drawableLeft="@drawable/ms__menu_down"
android:gravity="right|center_vertical"
android:text="清空购物车"
android:textColor="@android:color/darker_gray"
android:textSize="12sp" />
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="购物袋"
android:textColor="@android:color/black"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="@+id/butn_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@null"
android:drawableStart="@drawable/ic_baseline_delete_outline_24"
android:drawablePadding="5dp"
android:gravity="end|center_vertical"
android:text="清空购物袋"
android:textColor="@android:color/darker_gray"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/line" />
<ListView
android:id="@+id/list_trolley"
android:layout_width="match_parent"
android:layout_height="300dp"
android:divider="@null" />
<ImageView
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/line" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@android:color/darker_gray" />
<ListView
android:id="@+id/list_trolley"
android:layout_width="match_parent"
android:layout_height="300dp"
android:divider="@null" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/layout_settle_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<RelativeLayout
......@@ -65,43 +81,40 @@
android:id="@+id/txt_count"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:background="@android:color/holo_red_dark"
android:layout_alignParentEnd="true"
android:background="@drawable/ic_dot"
android:gravity="center"
android:text="9"
android:textSize="12sp" />
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
android:orientation="horizontal">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ms__menu_down" />
<TextView
android:id="@+id/txt_amount"
android:id="@+id/txt_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ms__menu_down"
android:text="10"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textColor="@color/textPrimary"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="冰茶咖啡(冰)(全糖)x1 冰茶咖啡(冰)(无糖)x1"
android:textColor="@android:color/darker_gray"
android:textSize="12sp" />
</LinearLayout>
<Button
android:id="@+id/butn_pay"
android:layout_width="100dp"
android:layout_height="match_parent"
android:background="@android:color/black"
android:background="@color/colorPrimary"
android:text="付款"
android:textColor="@android:color/white"
android:textSize="14sp" />
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimary">#FF2C9CFF</color>
<color name="dialog_bg">#CC000000</color>
<color name="textPrimary">#FF000000</color>
<color name="textSecondPrimary">#FF666666</color>
<color name="line">#FF979797</color>
<color name="textRed">#FFFF001D</color>
<color name="white">#FFFFFF</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="button_style" parent="Widget.AppCompat.Button.Borderless">
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
include ':app', ':library_recyclerview'
include ':app'
rootProject.name='hooloo'
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