Explorar el Código

qrcode for sku and search shop goods

billyyoyo hace 6 años
padre
commit
67c6ce5ee3

+ 26 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/ShopGoodsInfo.java

@@ -9,6 +9,8 @@ public class ShopGoodsInfo {
     private float market_price;
     private float goods_price;
     private float vip_goods_price;
+    private float deductible_amount;
+    private float vip_deductible_amount;
     private int sale_number;
     private int but_type;
 
@@ -64,10 +66,34 @@ public class ShopGoodsInfo {
         return vip_goods_price;
     }
 
+    public float getVipPrice() {
+        return vip_goods_price - vip_deductible_amount;
+    }
+
+    public float getPrice() {
+        return goods_price - deductible_amount;
+    }
+
     public void setVip_goods_price(float vip_goods_price) {
         this.vip_goods_price = vip_goods_price;
     }
 
+    public float getDeductible_amount() {
+        return deductible_amount;
+    }
+
+    public void setDeductible_amount(float deductible_amount) {
+        this.deductible_amount = deductible_amount;
+    }
+
+    public float getVip_deductible_amount() {
+        return vip_deductible_amount;
+    }
+
+    public void setVip_deductible_amount(float vip_deductible_amount) {
+        this.vip_deductible_amount = vip_deductible_amount;
+    }
+
     public int getSale_number() {
         return sale_number;
     }

+ 18 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/TaskSimple.java

@@ -10,6 +10,8 @@ public class TaskSimple {
     private String icon;
     private float bonus;
     private int is_succession;
+    private int is_shop;
+    private float shop_amount;
 
     public int getId() {
         return id;
@@ -19,6 +21,22 @@ public class TaskSimple {
         this.id = id;
     }
 
+    public int getIs_shop() {
+        return is_shop;
+    }
+
+    public void setIs_shop(int is_shop) {
+        this.is_shop = is_shop;
+    }
+
+    public float getShop_amount() {
+        return shop_amount;
+    }
+
+    public void setShop_amount(float shop_amount) {
+        this.shop_amount = shop_amount;
+    }
+
     public String getTitle() {
         return title;
     }

+ 9 - 3
app/src/main/java/com/sheep/gamegroup/module/search/GoodsHolder.java

@@ -5,20 +5,25 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.model.entity.Article;
 import com.sheep.gamegroup.model.entity.ShopGoodsInfo;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 
+import java.util.Locale;
+
 import butterknife.BindView;
 
 public class GoodsHolder extends SearchResultHolder<ShopGoodsInfo> {
 
     @BindView(R.id.name_view)
     TextView name_view;
-    @BindView(R.id.price_view)
-    TextView price_view;
+    @BindView(R.id.vip_price_view)
+    TextView vip_price_view;
+    @BindView(R.id.nor_price_view)
+    TextView nor_price_view;
     @BindView(R.id.image_view)
     ImageView image_view;
 
@@ -32,7 +37,8 @@ public class GoodsHolder extends SearchResultHolder<ShopGoodsInfo> {
     @Override
     public void configView() {
         ViewUtil.setText(name_view, item.getName());
-        ViewUtil.setText(price_view, "VIP回报购\n" + item.getVip_goods_price() + "\n回报购\n" + item.getGoods_price());
+        ViewUtil.setText(vip_price_view, String.format(Locale.CHINA, "¥%s", NumberFormatUtils.retainMost2(item.getVipPrice())));
+        ViewUtil.setText(nor_price_view, String.format(Locale.CHINA, "¥%s", NumberFormatUtils.retainMost2(item.getPrice())));
         ViewUtil.setImage(image_view, item.getImage());
     }
 

+ 10 - 4
app/src/main/java/com/sheep/gamegroup/module/search/TaskHolder.java

@@ -30,6 +30,8 @@ public class TaskHolder extends SearchResultHolder<TaskSimple> {
     TextView item_home_page_search_content_tv;
     @BindView(R.id.item_home_page_search_bonus_tv)
     TextView item_home_page_search_bonus_tv;
+    @BindView(R.id.item_home_page_search_tag_tv)
+    TextView item_home_page_search_tag_tv;
 
     public TaskHolder(@NonNull View itemView) {
         super(itemView);
@@ -47,11 +49,15 @@ public class TaskHolder extends SearchResultHolder<TaskSimple> {
 
     @Override
     public void configView() {
-        ViewUtil.setVisibility(item_home_page_search_bonus_tv, item.hasBonus());
-        ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s元", NumberFormatUtils.retainMost2(item.getBonus())));
-        ViewUtil.setText(item_home_page_search_content_tv, String.format(Locale.CHINA, "%s/%s", item.getTitle(), item.getName()));
+        if (item.getIs_shop() == 1) {
+            ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s经验值", NumberFormatUtils.retainMost2(item.getShop_amount() * 10000)));
+            ViewUtil.setText(item_home_page_search_tag_tv, "遇见预约任务");
+        } else {
+            ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s元", NumberFormatUtils.retainMost2(item.getBonus())));
+            ViewUtil.setText(item_home_page_search_tag_tv, "现金任务");
+        }
+        ViewUtil.setText(item_home_page_search_content_tv, item.getName());
         ViewUtil.setGameImage(item_home_page_search_iv, item.getIcon());
-
     }
 
 }

+ 17 - 1
app/src/main/res/layout/item_home_page_search.xml

@@ -37,11 +37,27 @@
         android:text="试玩赚钱/永恒边界"
         android:textColor="#ff333333"
         android:textSize="14sp"
-        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_marginTop="12dp"
         app:layout_constraintEnd_toStartOf="@id/item_home_page_search_bonus_tv"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
+    <TextView
+        android:id="@+id/item_home_page_search_tag_tv"
+        android:text="现金任务"
+        android:textColor="@color/white"
+        android:textSize="11sp"
+        android:background="@drawable/shape_blue_solid_rectangle_18"
+        app:layout_constraintTop_toBottomOf="@+id/item_home_page_search_content_tv"
+        app:layout_constraintLeft_toRightOf="@+id/item_home_page_search_iv"
+        android:layout_marginTop="8dp"
+        android:paddingLeft="8dp"
+        android:paddingRight="8dp"
+        android:paddingTop="3dp"
+        android:paddingBottom="3dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
     <View
         android:layout_width="match_parent"
         android:layout_height="0.5px"

+ 67 - 13
app/src/main/res/layout/shop_goods_item.xml

@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="96dp"
+    android:layout_height="132dp"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <ImageView
         android:id="@+id/image_view"
         android:scaleType="centerCrop"
         app:layout_constraintTop_toTopOf="parent"
-        android:layout_marginTop="12dp"
+        android:layout_marginTop="16dp"
         app:layout_constraintLeft_toLeftOf="parent"
-        android:layout_marginLeft="12dp"
-        android:layout_width="72dp"
-        android:layout_height="72dp" />
+        android:layout_marginLeft="16dp"
+        android:layout_width="100dp"
+        android:layout_height="100dp" />
 
     <TextView
         android:id="@+id/name_view"
@@ -22,24 +22,78 @@
         app:layout_constraintLeft_toRightOf="@+id/image_view"
         android:layout_marginLeft="8dp"
         android:layout_marginRight="80dp"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/image_view"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content" />
 
     <TextView
-        android:id="@+id/price_view"
+        android:id="@+id/vip_tag_view"
         android:text="VIP回报购"
-        android:textColor="@color/red_F07422"
-        android:textSize="12sp"
+        android:textColor="#C7A16D"
+        android:textSize="10sp"
+        android:gravity="center"
+        app:layout_constraintLeft_toRightOf="@+id/image_view"
+        app:layout_constraintBottom_toBottomOf="@+id/image_view"
+        android:layout_marginBottom="36dp"
+        android:layout_marginRight="12dp"
+        android:layout_marginLeft="8dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/vip_price_view"
+        android:text="¥20.00"
+        android:textColor="#C7A16D"
+        android:textSize="13sp"
         android:gravity="center"
+        app:layout_constraintLeft_toRightOf="@+id/vip_tag_view"
+        app:layout_constraintBottom_toBottomOf="@+id/image_view"
+        android:layout_marginBottom="35dp"
+        android:layout_marginRight="12dp"
+        android:layout_marginLeft="8dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/nor_tag_view"
+        android:text="回报购"
+        android:textColor="@color/black_666666"
+        android:textSize="10sp"
+        android:gravity="center"
+        app:layout_constraintLeft_toRightOf="@+id/image_view"
+        app:layout_constraintBottom_toBottomOf="@+id/image_view"
+        android:layout_marginBottom="8dp"
+        android:layout_marginRight="12dp"
+        android:layout_marginLeft="8dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:id="@+id/nor_price_view"
+        android:text="¥20.00"
+        android:textColor="#FF2D4B"
+        android:textSize="13sp"
+        android:gravity="center"
+        app:layout_constraintLeft_toRightOf="@+id/nor_tag_view"
+        app:layout_constraintBottom_toBottomOf="@+id/image_view"
+        android:layout_marginBottom="8dp"
+        android:layout_marginRight="12dp"
+        android:layout_marginLeft="8dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <TextView
+        android:text="回报购"
+        android:textColor="@color/white"
+        android:textSize="13sp"
+        android:gravity="center"
+        android:background="@drawable/shape_blue_solid_rectangle_18"
         android:layout_marginRight="12dp"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
+        android:layout_width="71dp"
+        android:layout_height="24dp" />
 
     <View
         style="@style/style_item_line_full"