@@ -0,0 +1,234 @@ | |||
package com.huntersun.vkyes.etcopencard.project.ui.activity.order; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.widget.Button; | |||
import android.widget.LinearLayout; | |||
import com.huntersun.vky.obublelib.util.ToastUtil; | |||
import com.huntersun.vkyes.etcopencard.R; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.ResultBean; | |||
import com.huntersun.vkyes.etcopencard.project.utils.Constants; | |||
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; | |||
import com.huntersun.vkyes.etcopencard.src.app.AppActivity; | |||
/** | |||
* Date :2023-03-15 | |||
* Description:订单列表和详情操作工具类 | |||
*/ | |||
public class OrderUtils { | |||
private Context context; | |||
private LinearLayout LLBtns; | |||
private Button btnFinish; | |||
private Button btnLogistics; | |||
private Button btnReturnGoods; | |||
private Button btnExGoods; | |||
private Button btnCancelOrder; | |||
private Button btnEditAddr; | |||
private Button btnAudit; | |||
private Button btnDeliver; | |||
private Button btnActive; | |||
private Button btnAgainActive; | |||
private Button btnReceiveGoods; | |||
//数据 | |||
private ResultBean.BizContent orderData; //订单数据 | |||
private boolean isFromList; //是否来自订单列表 | |||
public OrderUtils(Context context,ResultBean.BizContent orderData,boolean isFromList,LinearLayout LLBtns,Button btnFinish, | |||
Button btnLogistics,Button btnReturnGoods,Button btnExGoods, | |||
Button btnCancelOrder,Button btnEditAddr,Button btnAudit,Button btnDeliver, | |||
Button btnActive,Button btnAgainActive,Button btnReceiveGoods) { | |||
this.context = context; | |||
this.orderData = orderData; | |||
this.isFromList = isFromList; | |||
this.LLBtns = LLBtns; | |||
this.btnFinish = btnFinish; | |||
this.btnLogistics = btnLogistics; | |||
this.btnReturnGoods = btnReturnGoods; | |||
this.btnExGoods = btnExGoods; | |||
this.btnCancelOrder = btnCancelOrder; | |||
this.btnEditAddr = btnEditAddr; | |||
this.btnAudit = btnAudit; | |||
this.btnDeliver = btnDeliver; | |||
this.btnActive = btnActive; | |||
this.btnAgainActive = btnAgainActive; | |||
this.btnReceiveGoods = btnReceiveGoods; | |||
initBtnClick(); | |||
setBtnViewVisibleOrHide(); | |||
} | |||
/** | |||
* 设置按钮的显示和隐藏 | |||
*/ | |||
private void setBtnViewVisibleOrHide(){ | |||
LLBtns.setVisibility(View.GONE); | |||
btnFinish.setVisibility(View.GONE); | |||
btnLogistics.setVisibility(View.GONE); | |||
btnReturnGoods.setVisibility(View.GONE); | |||
btnExGoods.setVisibility(View.GONE); | |||
btnCancelOrder.setVisibility(View.GONE); | |||
btnEditAddr.setVisibility(View.GONE); | |||
btnAudit.setVisibility(View.GONE); | |||
btnDeliver.setVisibility(View.GONE); | |||
btnActive.setVisibility(View.GONE); | |||
btnAgainActive.setVisibility(View.GONE); | |||
btnReceiveGoods.setVisibility(View.GONE); | |||
if(FunHelper.isEmpty(orderData.getOrderStep())){ | |||
orderData.setOrderStep("0"); | |||
} | |||
switch (Integer.parseInt(orderData.getOrderStep())){ | |||
case Constants.ORDER_STATUS_WAIT_AUDIT://待审核 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnEditAddr.setVisibility(View.VISIBLE); | |||
btnAudit.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_WAIT_DELIVERY://待发货 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnCancelOrder.setVisibility(View.VISIBLE); | |||
btnEditAddr.setVisibility(View.VISIBLE); | |||
btnDeliver.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_WAIT_TAKE_DELIVERY://待收货 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnLogistics.setVisibility(View.VISIBLE); | |||
btnReturnGoods.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_WAIT_ACTIVE://待激活 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnFinish.setVisibility(View.VISIBLE); | |||
btnReturnGoods.setVisibility(View.VISIBLE); | |||
btnExGoods.setVisibility(View.VISIBLE); | |||
btnActive.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_FINISH://已结束 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnAgainActive.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_RETURN_GOODS://退货中 | |||
LLBtns.setVisibility(View.VISIBLE); | |||
btnReceiveGoods.setVisibility(View.VISIBLE); | |||
break; | |||
case Constants.ORDER_STATUS_EX_GOODS://换货中 | |||
break; | |||
} | |||
} | |||
/** | |||
* 设置点击事件 | |||
*/ | |||
private void initBtnClick(){ | |||
//结束订单 | |||
btnFinish.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
ToastUtil.showS(context,"确定是否结束订单"); | |||
} | |||
}); | |||
//查看物流 | |||
btnLogistics.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(OrderLogisticsActivity.class); | |||
} | |||
}); | |||
//退货 | |||
btnReturnGoods.setOnClickListener( new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(ApplyReturnGoodsStep1Activity.class); | |||
} | |||
}); | |||
//换货 | |||
btnExGoods.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(ApplyExGoodsStep1Activity.class); | |||
} | |||
}); | |||
//取消订单 | |||
btnCancelOrder.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(CancelOrderStep1Activity.class); | |||
} | |||
}); | |||
//修改地址 | |||
btnEditAddr.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(EditOrderAddrActivity.class); | |||
} | |||
}); | |||
//审核 | |||
btnAudit.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(AuditingActivity.class); | |||
} | |||
}); | |||
//发货 | |||
btnDeliver.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
ToastUtil.showS(context,"发货"); | |||
} | |||
}); | |||
//激活 | |||
btnActive.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
ToastUtil.showS(context,"激活"); | |||
} | |||
}); | |||
//再次唤起 | |||
btnAgainActive.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
ToastUtil.showS(context,"再次唤起"); | |||
} | |||
}); | |||
//确认完成 | |||
btnReceiveGoods.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
startActivity(ConfirmReceiveGoodsStep1Activity.class); | |||
} | |||
}); | |||
} | |||
/** | |||
* 跳转 | |||
* @param activityClass | |||
*/ | |||
private void startActivity(Class<?> activityClass){ | |||
Bundle bundle = new Bundle(); | |||
bundle.putString("id",FunHelper.isEmpty(orderData.getId()) ? "" : orderData.getId()); | |||
bundle.putString("orderId",FunHelper.isEmpty(orderData.getOrderId()) ? "" : orderData.getOrderId()); | |||
bundle.putString("vehiclePlate",FunHelper.isEmpty(orderData.getVehiclePlate()) ? "" : orderData.getVehiclePlate()); | |||
bundle.putString("amount",FunHelper.isEmpty(orderData.getAmount()) ? "0" : orderData.getAmount()); | |||
bundle.putString("orderStep",FunHelper.isEmpty(orderData.getOrderStep()) ? "" : orderData.getOrderStep()); | |||
bundle.putString("cardId",FunHelper.isEmpty(orderData.getCardId()) ? "" : orderData.getCardId()); | |||
bundle.putString("obuId",FunHelper.isEmpty(orderData.getObuId()) ? "" : orderData.getObuId()); | |||
Intent intent = new Intent(); | |||
intent.setClass(context, activityClass); | |||
intent.putExtras(bundle); | |||
context.startActivity(intent); | |||
} | |||
} |
@@ -2,25 +2,19 @@ package com.huntersun.vkyes.etcopencard.project.ui.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
import androidx.core.content.ContextCompat; | |||
import com.chad.library.adapter.base.BaseQuickAdapter; | |||
import com.chad.library.adapter.base.BaseViewHolder; | |||
import com.google.gson.Gson; | |||
import com.huntersun.vkyes.etcopencard.R; | |||
import com.huntersun.vkyes.etcopencard.databinding.FragmentHomeFiveBinding; | |||
import com.huntersun.vkyes.etcopencard.databinding.FragmentSonOneBinding; | |||
import com.huntersun.vkyes.etcopencard.project.api.Api; | |||
import com.huntersun.vkyes.etcopencard.project.api.Converter; | |||
import com.huntersun.vkyes.etcopencard.project.api.FatherBean; | |||
import com.huntersun.vkyes.etcopencard.project.api.MyRetrofit; | |||
import com.huntersun.vkyes.etcopencard.project.api.Parameters; | |||
import com.huntersun.vkyes.etcopencard.project.api.RequestParameters; | |||
@@ -28,9 +22,11 @@ import com.huntersun.vkyes.etcopencard.project.api.Result; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.EnumBean; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.IFCode; | |||
import com.huntersun.vkyes.etcopencard.project.api.bean.ResultBean; | |||
import com.huntersun.vkyes.etcopencard.project.tool.MyShared; | |||
import com.huntersun.vkyes.etcopencard.project.ui.activity.HomeListInfo; | |||
import com.huntersun.vkyes.etcopencard.project.ui.activity.MainActivity; | |||
import com.huntersun.vkyes.etcopencard.project.ui.activity.order.OrderUtils; | |||
import com.huntersun.vkyes.etcopencard.project.utils.Constants; | |||
import com.huntersun.vkyes.etcopencard.project.utils.FunHelper; | |||
import com.huntersun.vkyes.etcopencard.src.action.StatusAction; | |||
import com.huntersun.vkyes.etcopencard.src.aop.SingleClick; | |||
import com.huntersun.vkyes.etcopencard.src.app.AppFragment; | |||
@@ -41,9 +37,10 @@ import com.scwang.smart.refresh.layout.api.RefreshLayout; | |||
import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import androidx.annotation.NonNull; | |||
import androidx.core.content.ContextCompat; | |||
import retrofit2.Response; | |||
/** | |||
@@ -67,7 +64,6 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
BaseQuickAdapter<String, BaseViewHolder> adapter2 = new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_screen) { | |||
private int selectedPosition = 0; | |||
@Override | |||
protected void convert(BaseViewHolder holder, String item) { | |||
TextView textView = holder.getView(R.id.text); | |||
@@ -185,6 +181,9 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
}); | |||
} | |||
/* | |||
* 订单adapter | |||
*/ | |||
BaseQuickAdapter<ResultBean.BizContent, BaseViewHolder> adapter | |||
= new BaseQuickAdapter<ResultBean.BizContent, BaseViewHolder>(R.layout.item_list_content) { | |||
@SuppressLint("LogNotTimber") | |||
@@ -198,10 +197,19 @@ public class FragmentSonOne extends TitleBarFragment<MainActivity> | |||
helper.setText(R.id.text6, "0".equals(item.getType()) ? "客车办理" : "货车办理"); | |||
helper.setText(R.id.text7, "0".equals(item.getType()) ? "客车" : "货车"); | |||
helper.setText(R.id.text8, item.getAmount() == null ? "0.00元" : Integer.parseInt(item.getAmount()) * 0.01 + "元"); | |||
new OrderUtils(getActivity(),item,true,helper.getView(R.id.LLBtns), | |||
helper.getView(R.id.btnFinish),helper.getView(R.id.btnLogistics), | |||
helper.getView(R.id.btnReturnGoods),helper.getView(R.id.btnExGoods), | |||
helper.getView(R.id.btnCancelOrder),helper.getView(R.id.btnEditAddr), | |||
helper.getView(R.id.btnAudit),helper.getView(R.id.btnDeliver), | |||
helper.getView(R.id.btnActive),helper.getView(R.id.btnAgainActive), | |||
helper.getView(R.id.btnReceiveGoods)); | |||
helper.setOnClickListener(R.id.layout, new View.OnClickListener() { | |||
@Override | |||
@SingleClick | |||
public void onClick(View v) { | |||
public void onClick(View v) {//跳转订单详情 | |||
Intent intent = new Intent(); | |||
intent.putExtra("id", item.getId()); | |||
intent.setClass(getContext(), HomeListInfo.class); |
@@ -3,6 +3,6 @@ | |||
<corners android:radius="@dimen/dp_50"/> | |||
<solid android:color="@color/transparent"/> | |||
<stroke | |||
android:width="@dimen/dp_1" | |||
android:color="@color/color_666666" /> | |||
android:width="@dimen/dp_0_5" | |||
android:color="@color/color_999999" /> | |||
</shape> |
@@ -189,20 +189,5 @@ | |||
android:layout_height="1dp" | |||
android:layout_margin="@dimen/dp_10" /> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:padding="@dimen/dp_10" | |||
android:visibility="gone"> | |||
<Button | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_30" | |||
android:background="@drawable/button_status1" | |||
android:text="修改地址" | |||
android:textColor="#00B38B" | |||
android:textSize="@dimen/sp_12" /> | |||
</LinearLayout> | |||
<include layout="@layout/layout_order_btns"/> | |||
</LinearLayout> |
@@ -0,0 +1,123 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
style="@style/MatchWrap.Vertical"> | |||
<LinearLayout | |||
android:id="@+id/LLBtns" | |||
style="@style/MatchWrap.Horizontal" | |||
android:padding="@dimen/dp_10" | |||
android:gravity="center_vertical|right" | |||
android:visibility="gone"> | |||
<Button | |||
android:id="@+id/btnFinish" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/border_dark_grey_radius" | |||
android:text="结束订单" | |||
android:visibility="gone" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textColor="@color/color_666666" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnLogistics" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/border_dark_grey_radius" | |||
android:text="查看物流" | |||
android:visibility="gone" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textColor="@color/color_666666" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnReturnGoods" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/border_dark_grey_radius" | |||
android:text="申请退货" | |||
android:visibility="gone" | |||
android:textColor="#B3B3B3" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnExGoods" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/border_dark_grey_radius" | |||
android:text="申请换货" | |||
android:visibility="gone" | |||
android:textColor="#B3B3B3" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnCancelOrder" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/border_dark_grey_radius" | |||
android:text="取消订单" | |||
android:visibility="gone" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textColor="#B3B3B3" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnEditAddr" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:background="@drawable/button_status1" | |||
android:text="修改地址" | |||
android:visibility="gone" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:textColor="#00B38B" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnAudit" | |||
style="@style/BtnShortStyle" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:layout_gravity="center_vertical|center_horizontal" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:text="审核" | |||
android:visibility="gone" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnDeliver" | |||
style="@style/BtnShortStyle" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:layout_gravity="center_vertical|center_horizontal" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:text="发货" | |||
android:visibility="gone" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnActive" | |||
style="@style/BtnShortStyle" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:layout_gravity="center_vertical|center_horizontal" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:text="去激活" | |||
android:visibility="gone" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnAgainActive" | |||
style="@style/BtnShortStyle" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:layout_gravity="center_vertical|center_horizontal" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:text="再次唤起" | |||
android:visibility="gone" | |||
android:textSize="@dimen/sp_12" /> | |||
<Button | |||
android:id="@+id/btnReceiveGoods" | |||
style="@style/BtnShortStyle" | |||
android:layout_width="@dimen/dp_67" | |||
android:layout_height="@dimen/dp_25" | |||
android:layout_gravity="center_vertical|center_horizontal" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:text="确认完成" | |||
android:visibility="gone" | |||
android:textSize="@dimen/sp_12" /> | |||
</LinearLayout> | |||
</LinearLayout> |