Przeglądaj źródła

1.流通量+价格区间。
2.消费排行榜。

shihuiyun 2 lat temu
rodzic
commit
1df7de68e2

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -177,6 +177,7 @@
 
         <activity android:name="com.zswc.creativity.activity.AreaSelectActivity"/>
         <activity android:name=".activity.GivenActivity"/>
+        <activity android:name=".activity.ConsumeActivity"/>
 
 
         <activity android:name="com.zswc.creativity.activity.PasswordActivity"/>

+ 27 - 0
app/src/main/java/com/zswc/creativity/activity/ConsumeActivity.kt

@@ -0,0 +1,27 @@
+package com.zswc.creativity.activity
+
+import com.zswc.creativity.adapter.ConsumeAdapter
+import com.zswc.creativity.base.MBRActivity
+import com.zswc.creativity.databinding.ActivityConsumeBinding
+import com.zswc.creativity.vmodel.ConsumeVModel
+
+/**
+ *on 2022/9/15
+ */
+class ConsumeActivity : MBRActivity<ConsumeVModel, ConsumeAdapter, ActivityConsumeBinding>(){
+
+    override fun vmClass(): Class<ConsumeVModel> {
+        return ConsumeVModel::class.java
+    }
+    override fun binding(): ActivityConsumeBinding {
+        return ActivityConsumeBinding.inflate(layoutInflater)
+    }
+
+    override fun initAdapter(): ConsumeAdapter {
+       return ConsumeAdapter(vm)
+    }
+
+    override fun title(): String? {
+        return "消费排行榜"
+    }
+}

+ 36 - 2
app/src/main/java/com/zswc/creativity/activity/ResaleActivity.kt

@@ -4,8 +4,6 @@ import android.os.Bundle
 import android.text.Html
 import android.text.TextUtils
 import android.view.View
-import coil.load
-import coil.transform.RoundedCornersTransformation
 import com.hwangjr.rxbus.annotation.Subscribe
 import com.hwangjr.rxbus.annotation.Tag
 import com.qmuiteam.qmui.kotlin.onClick
@@ -17,6 +15,7 @@ import com.zswc.creativity.model.SellSuessBean
 import com.zswc.creativity.utils.PopuSurePasswordUtils
 import com.zswc.creativity.utils.glide.GlideUtils
 import com.zswc.creativity.vmodel.ResaleVModel
+import java.lang.Exception
 
 /**
  * 转售
@@ -69,6 +68,41 @@ class ResaleActivity : MBActivity<ResaleVModel, ActivityResaleBinding>() {
                 toast("请设置价格")
                return@onClick
             }
+            //判断价格区间
+            try {
+                if(null!=vm.data.value!!.proInfoObj?.jsMax||null!=vm.data.value!!.proInfoObj?.jsMin){
+
+                    if(null!=vm.data.value!!.proInfoObj?.jsMax&&null!=vm.data.value!!.proInfoObj?.jsMin){
+                        if(vm.sellPrice!!.toDouble()<vm.data.value!!.proInfoObj?.jsMin!!.toDouble()){
+                            toast("价格小于最小价格,请重设!")
+                            return@onClick
+                        }
+                        if(vm.sellPrice!!.toDouble()>vm.data.value!!.proInfoObj?.jsMax!!.toDouble()){
+                            toast("价格大于最大价格,请重设!")
+                            return@onClick
+                        }
+
+                    }
+
+                    if(null!=vm.data.value!!.proInfoObj?.jsMin){
+                        if(vm.sellPrice!!.toDouble()<vm.data.value!!.proInfoObj?.jsMin!!.toDouble()){
+                            toast("价格小于最小价格,请重设!")
+                            return@onClick
+                        }
+                    }
+
+                    if(null!=vm.data.value!!.proInfoObj?.jsMax){
+                        if(vm.sellPrice!!.toDouble()>vm.data.value!!.proInfoObj?.jsMax!!.toDouble()){
+                            toast("价格大于最大价格,请重设!")
+                            return@onClick
+                        }
+                    }
+
+                }
+
+            }catch (e:Exception){
+
+            }
 
             //去确认
             PopuSurePasswordUtils.show(context(),binding.tvSure, object : ChoiceData {

+ 68 - 0
app/src/main/java/com/zswc/creativity/adapter/ConsumeAdapter.kt

@@ -0,0 +1,68 @@
+package com.zswc.creativity.adapter
+
+import android.graphics.Color
+import android.graphics.Typeface
+import android.os.Bundle
+import android.text.*
+import android.text.style.AbsoluteSizeSpan
+import android.text.style.ForegroundColorSpan
+import android.text.style.StyleSpan
+import android.view.View
+import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
+import com.google.gson.Gson
+import com.qmuiteam.qmui.kotlin.onClick
+import com.zswc.creativity.R
+import com.zswc.creativity.activity.ArticleDetailActivity
+import com.zswc.creativity.databinding.ItemMsgBinding
+import com.zswc.creativity.model.MsgList
+import com.zswc.creativity.utils.VerifyUtils
+import com.zswc.creativity.vmodel.MsgVModel
+import com.ysnows.base.base.BAdapter
+import com.ysnows.base.utils.UiSwitch
+import com.zswc.creativity.databinding.ItemConsumeBinding
+import com.zswc.creativity.model.ConsumeList
+import com.zswc.creativity.utils.glide.GlideUtils
+import com.zswc.creativity.vmodel.ConsumeVModel
+
+class ConsumeAdapter(var vm: ConsumeVModel) : BAdapter<ConsumeList, BaseDataBindingHolder<ItemConsumeBinding>>(R.layout.item_consume) {
+
+    override fun convert(holder: BaseDataBindingHolder<ItemConsumeBinding>, item: ConsumeList) {
+        holder.dataBinding?.vm = vm
+        holder.dataBinding?.item = item
+
+        if(!TextUtils.isEmpty(item.zcTX)) {
+
+            GlideUtils.lImg(context,item.zcTX,50,50, holder.dataBinding?.imgAvater)
+        }
+
+        when (holder.adapterPosition) {
+            0 -> {
+                holder.dataBinding?.imgSum?.visibility = View.VISIBLE
+                holder.dataBinding?.tvNum?.visibility = View.GONE
+                holder.dataBinding?.imgSum?.setImageResource(R.drawable.ct_rank_one)
+            }
+            1 -> {
+                holder.dataBinding?.imgSum?.visibility = View.VISIBLE
+                holder.dataBinding?.tvNum?.visibility = View.GONE
+                holder.dataBinding?.imgSum?.setImageResource(R.drawable.ct_rank_two)
+            }
+            2 -> {
+                holder.dataBinding?.imgSum?.visibility = View.VISIBLE
+                holder.dataBinding?.tvNum?.visibility = View.GONE
+                holder.dataBinding?.imgSum?.setImageResource(R.drawable.ct_rank_three)
+            }
+            else -> {
+                holder.dataBinding?.imgSum?.visibility = View.GONE
+                holder.dataBinding?.tvNum?.visibility = View.VISIBLE
+                var num= holder.adapterPosition + 1
+                holder.dataBinding?.tvNum?.text = "" + num
+            }
+
+        }
+
+
+
+
+
+    }
+}

+ 2 - 2
app/src/main/java/com/zswc/creativity/config/Config.kt

@@ -7,8 +7,8 @@ object  Config : IConfig {
     override fun baseUrl(): String {
 
 
-        return "http://39.104.166.197:8080/api/" //正式
-//         return "http://120.79.86.50:8080/api/" //测试
+   //     return "http://39.104.166.197:8080/api/" //正式
+         return "http://120.79.86.50:8080/api/" //测试
 
 //        return "http://d06u7pg536nk.ngrok.xiaomiqiu123.top/api/"
 

+ 16 - 0
app/src/main/java/com/zswc/creativity/model/ConsumeList.kt

@@ -0,0 +1,16 @@
+package com.zswc.creativity.model
+
+import com.ysnows.base.inter.IModel
+
+/**
+ *
+ *
+ *
+ */
+data class ConsumeList(var id: String, var zcXfmoney:String, var createTime:String,
+                       var zcName:String, var zcTX:String,
+                       var pid:String
+                      ) : IModel {
+
+
+}

+ 17 - 16
app/src/main/java/com/zswc/creativity/model/MyTibetaDetails.kt

@@ -13,24 +13,25 @@ import com.ysnows.base.inter.IModel
  *
  */
 data class MyTibetaDetails(
-                         var id:String,var orderId:String,
-                         var tag:String,var mid:String,var collectorsName:String,
-                         var name:String,  var cover:String,
-                         var status:Int,  var type:Int,
-                         var resaleTime:String,  var company:String,  var companyHash:String,
-                         var companyHashTime:String,  var collectorsHash:String,  var collectorsHashTime:String,
-                         var createAt:String,var createTime:String,var cid:String,
-                         var proInfoObj:ProInfo?,
-                         var resaleStatus:Int,var isDestruction:Int,
-                         var authName:String,var memberName: String,
+    var id: String, var orderId: String,
+    var tag: String, var mid: String, var collectorsName: String,
+    var name: String, var cover: String,
+    var status: Int, var type: Int,
+    var resaleTime: String, var company: String, var companyHash: String,
+    var companyHashTime: String, var collectorsHash: String, var collectorsHashTime: String,
+    var createAt: String, var createTime: String, var cid: String,
+    var proInfoObj: ProInfo?,
+    var resaleStatus: Int, var isDestruction: Int,
+    var authName: String, var memberName: String,
 
-                         //新增
-                         var examplesIllustrate:String,var royalties:String,
-                         var serviceFee:String,var contractAddress:String,
-                         //新增(二级市场)
-                          var resalePrice:String, var isBuy:Int,var orderNo:String,
+    //新增
+    var examplesIllustrate: String, var royalties: String,
+    var serviceFee: String, var contractAddress: String,
 
+    //新增(二级市场)
+    var resalePrice: String, var isBuy: Int, var orderNo: String,
 
 
-): IModel {
+
+    ) : IModel {
 }

+ 2 - 1
app/src/main/java/com/zswc/creativity/model/ProInfo.kt

@@ -14,6 +14,7 @@ data class ProInfo(
         var warmPrompt:String,var authImg:String,var authName:String,var hash:String,
         var contractAddress:String,var status:String,var state:String,var createAt:String,
         var updateAt:String,var companyName:String,var createTime:String,
-         var syState:Int,var firstTime:String,
+         var syState:Int,var firstTime:String, var jsMax:String,var jsMin:String,
+        var circulateNum: String,
 ) : IModel {
 }

+ 9 - 0
app/src/main/java/com/zswc/creativity/utils/net/ApiService.kt

@@ -507,6 +507,15 @@ interface ApiService {
     suspend fun dhcpLog(@Body body: JSONObject?): PageResp<DhcpLog>
 
 
+    /**
+     * 消费排行榜-分页
+     * @return
+     */
+    @POST("User_center/xf_list")
+    suspend fun xfList(@Body body: JSONObject?): PageResp<ConsumeList>
+
+
+
 
 
 

+ 35 - 0
app/src/main/java/com/zswc/creativity/vmodel/ConsumeVModel.kt

@@ -0,0 +1,35 @@
+package com.zswc.creativity.vmodel
+
+import android.app.Application
+import android.graphics.Color
+import androidx.lifecycle.viewModelScope
+import com.alibaba.fastjson.JSONObject
+import com.hwangjr.rxbus.RxBus
+import com.zswc.creativity.config.ConfigRx
+import com.zswc.creativity.utils.net.NetEngine
+import com.ysnows.base.base.BRRepository
+import com.ysnows.base.base.BRViewModel
+import com.ysnows.base.net.IResp
+import com.ysnows.base.net.PageResp
+import kotlinx.coroutines.launch
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/25
+ */
+class ConsumeVModel(application: Application) : BRViewModel<BRRepository>(application) {
+
+
+
+    override fun apiFunc(): suspend () -> IResp<*> {
+
+
+
+        return { NetEngine.service.xfList(JSONObject()
+            .fluentPut("page_num", 10)
+            .fluentPut("page", repository().page)) }
+    }
+
+
+
+}

+ 11 - 0
app/src/main/java/com/zswc/creativity/vmodel/HomeMyVModel.kt

@@ -121,6 +121,17 @@ open class HomeMyVModel(application: Application) : BViewModel<BRepository>(appl
         UiSwitch.single(repository().context, MyOrderActivity::class.java)
 
     }
+    fun toConsume(){//消费排行榜
+        if(!isLogin.value!!){
+            toast("请登录")
+            return
+        }
+        UiSwitch.single(repository().context,ConsumeActivity::class.java)
+
+    }
+
+
+
     fun toCopyText(){
 
         val cm: ClipboardManager? = repository().context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?

+ 28 - 0
app/src/main/res/layout/activity_all_collect_details.xml

@@ -110,6 +110,8 @@
                                 android:layout_marginTop="5dp">
 
 
+
+
                                 <ImageView
                                     android:layout_width="30dp"
                                     android:layout_height="18dp"
@@ -130,6 +132,32 @@
                                     android:textColorHint="#54D7E9"
                                     android:textSize="@dimen/dp_11" />
 
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:background="#38D3D3"
+                                    android:paddingStart="9dp"
+                                    android:layout_marginStart="10dp"
+                                    android:paddingTop="2dp"
+                                    android:paddingEnd="9dp"
+                                    android:paddingBottom="2dp"
+                                    android:text="流通"
+                                    android:textColor="@color/white"
+                                    android:textSize="@dimen/dp_11" />
+
+                                <TextView
+                                    android:layout_width="wrap_content"
+                                    android:layout_height="wrap_content"
+                                    android:background="@drawable/bg_kuang_blue"
+                                    android:paddingStart="9dp"
+                                    android:paddingTop="2dp"
+                                    android:paddingEnd="9dp"
+                                    android:paddingBottom="2dp"
+                                    android:text="@{vm.data.proInfoObj.circulateNum}"
+                                    android:textColor="#54D7E9"
+                                    android:textColorHint="#54D7E9"
+                                    android:textSize="@dimen/dp_11" />
+
                             </LinearLayout>
 
                             <LinearLayout

+ 91 - 0
app/src/main/res/layout/activity_consume.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <data>
+
+    </data>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/color_bg"
+        android:orientation="vertical">
+
+
+        <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+            android:layout_width="match_parent"
+            android:layout_marginTop="12dp"
+            android:layout_marginEnd="15dp"
+            android:layout_marginStart="15dp"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            app:qmui_backgroundColor="@color/white"
+            app:qmui_borderColor="@color/white"
+            app:qmui_radius="12dp">
+
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_marginTop="10dp"
+                android:layout_marginStart="10dp"
+                android:layout_marginEnd="10dp"
+                app:qmui_borderColor="#F3F3F3"
+                app:qmui_backgroundColor="#F3F3F3"
+                android:orientation="horizontal"
+                android:gravity="center_vertical"
+                app:qmui_radius="6dp"
+                android:layout_height="32dp">
+
+                <TextView
+                    android:text="排名"
+                    android:textSize="12sp"
+                    android:layout_marginStart="10dp"
+                    android:textColor="#666666"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"/>
+
+
+                <TextView
+                    android:text="用户ID"
+                    android:textSize="12sp"
+                    android:layout_marginStart="15dp"
+                    android:textColor="#666666"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"/>
+
+
+                <TextView
+                    android:text="消费金额"
+                    android:textSize="12sp"
+                    android:layout_marginEnd="10dp"
+                    android:textColor="#666666"
+                    android:gravity="right"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"/>
+
+
+
+
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
+
+            <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+                android:id="@+id/refresh_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/recycler_view"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+                    tools:listitem="@layout/item_consume" />
+
+            </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+
+        </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
+
+    </LinearLayout>
+
+</layout>

+ 17 - 15
app/src/main/res/layout/fragment_home_my_to.xml

@@ -502,24 +502,26 @@
 
                                 </LinearLayout>
 
+
                                 <LinearLayout
                                     android:layout_width="0dp"
                                     android:layout_height="wrap_content"
                                     android:layout_weight="1"
                                     android:gravity="center"
-                                    android:onClick="@{v->vm.toSetting()}"
-                                    android:orientation="vertical">
+                                    android:onClick="@{v->vm.toConsume()}"
+                                    android:orientation="vertical"
+                                   >
 
                                     <ImageView
                                         android:layout_width="24dp"
                                         android:layout_height="24dp"
-                                        android:src="@drawable/ct_my_setting" />
+                                        android:src="@drawable/ct_my_store" />
 
                                     <TextView
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_marginTop="1dp"
-                                        android:text="设置"
+                                        android:text="消费排行榜"
                                         android:textColor="#222222"
                                         android:textSize="12sp" />
 
@@ -531,48 +533,45 @@
                                     android:layout_height="wrap_content"
                                     android:layout_weight="1"
                                     android:gravity="center"
-                                    android:onClick="@{v->vm.toGiven()}"
-                                    android:orientation="vertical"
-                                    android:visibility="invisible"
-                                    tools:visibility="visible">
+                                    android:onClick="@{v->vm.toSetting()}"
+                                    android:orientation="vertical">
 
                                     <ImageView
                                         android:layout_width="24dp"
                                         android:layout_height="24dp"
-                                        android:src="@drawable/ct_my_zeng" />
+                                        android:src="@drawable/ct_my_setting" />
 
                                     <TextView
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_marginTop="1dp"
-                                        android:text="转赠"
+                                        android:text="设置"
                                         android:textColor="#222222"
                                         android:textSize="12sp" />
 
 
                                 </LinearLayout>
 
-
                                 <LinearLayout
                                     android:layout_width="0dp"
                                     android:layout_height="wrap_content"
                                     android:layout_weight="1"
                                     android:gravity="center"
-                                    android:onClick="@{v->vm.toMall()}"
+                                    android:onClick="@{v->vm.toGiven()}"
                                     android:orientation="vertical"
-                                    android:visibility="invisible"
+                                    android:visibility="gone"
                                     tools:visibility="visible">
 
                                     <ImageView
                                         android:layout_width="24dp"
                                         android:layout_height="24dp"
-                                        android:src="@drawable/ct_my_store" />
+                                        android:src="@drawable/ct_my_zeng" />
 
                                     <TextView
                                         android:layout_width="wrap_content"
                                         android:layout_height="wrap_content"
                                         android:layout_marginTop="1dp"
-                                        android:text="商城订单"
+                                        android:text="转赠"
                                         android:textColor="#222222"
                                         android:textSize="12sp" />
 
@@ -582,6 +581,9 @@
 
 
 
+
+
+
                             </LinearLayout>
 
 

+ 71 - 0
app/src/main/res/layout/item_consume.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools" >
+
+    <data >
+        <import type="android.view.View" />
+
+        <variable
+            name="vm"
+            type="com.zswc.creativity.vmodel.ConsumeVModel" />
+
+        <variable
+            name="item"
+            type="com.zswc.creativity.model.ConsumeList" />
+
+    </data >
+    <LinearLayout
+        android:id="@+id/ll"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="13dp"
+        android:layout_marginEnd="10dp"
+        android:layout_marginBottom="10dp"
+        android:paddingTop="10dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:id="@+id/img_sum"
+            android:src="@drawable/ct_rank_one"
+            android:layout_width="16dp"
+            android:layout_height="16dp"/>
+        <TextView
+            android:id="@+id/tv_num"
+            android:textSize="14sp"
+            android:textColor="@color/text_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <com.qmuiteam.qmui.widget.QMUIRadiusImageView
+            android:id="@+id/img_avater"
+            android:layout_width="28dp"
+            android:layout_marginStart="15dp"
+            android:layout_height="28dp"
+            android:src="@drawable/ic_default_avatar"
+            app:qmui_border_color="@color/translucent"
+            app:qmui_is_oval="true" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="12dp"
+            android:text="@{item.zcName}"
+            android:textColor="#333333"
+            android:textSize="13sp" />
+
+
+
+        <TextView
+            android:textColor="#222222"
+            android:textSize="12sp"
+            android:text="@{item.zcXfmoney}"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+
+    </LinearLayout>
+
+</layout >

+ 1 - 1
base/src/main/java/com/ysnows/base/net/BOkhttpClient.kt

@@ -18,7 +18,7 @@ object BOkhttpClient {
                     .retryOnConnectionFailure(true)
 //                    .addInterceptor(CommonInterceptor())//设置公共参数
                     //上线的时候注释掉 12 不支持
-//                   .addInterceptor(ChuckInterceptor(BApp.instance()?.applicationContext))
+//                    .addInterceptor(ChuckInterceptor(BApp.instance()?.applicationContext))
                     .cookieJar(BCookieJar())
                     .addInterceptor(BHeaderInterceptor())