再来一单完善

This commit is contained in:
lijia 2022-09-05 17:13:28 +08:00
parent 683798229b
commit 36be42d82b
23 changed files with 1105 additions and 1035 deletions

View File

@ -0,0 +1,24 @@
package com.oneclouds.cargo.event;
/**
* @author hlh
* @version 1.0.0
* @date 2021/9/14 15:37
* @description:
*/
public class ChangeTabEvent {
private int type;
public ChangeTabEvent(int type) {
this.type = type;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

View File

@ -0,0 +1,32 @@
package com.oneclouds.cargo.event;
/**
* @author hlh
* @version 1.0.0
* @date 2021/9/14 15:37
* @description:
*/
public class RefreshEvent {
private String message;
private int type;
public RefreshEvent(String message, int type) {
this.message = message;
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}

View File

@ -13,6 +13,7 @@ import androidx.fragment.app.Fragment;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.constant.SPConstant;
import com.oneclouds.cargo.event.ChangeTabEvent;
import com.oneclouds.cargo.ui.home.HomeFragment;
import com.oneclouds.cargo.ui.my.MyFragment;
import com.oneclouds.cargo.ui.wallet.WalletFragment;
@ -22,13 +23,16 @@ import com.oneclouds.cargo.util.titleutil.StateStyleUtil;
import com.oneclouds.cargo.util.view.BaseAppCompatActivity;
import com.oneclouds.cargo.util.view.BottomTabUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
public class MainActivity extends BaseAppCompatActivity {
private LinearLayout[] rs=new LinearLayout[4];
private ImageView[] ibs=new ImageView[4];
private TextView[] title_view=new TextView[4];
private int[] img0={R.mipmap.tab1, R.mipmap.tab2, R.mipmap.xiaoxi0, R.mipmap.tab3};
private int[] img1={R.mipmap.tab1_s, R.mipmap.tab2_s, R.mipmap.xiaoxi1, R.mipmap.tab3_s};
private int[] img0={R.mipmap.tab1, R.mipmap.tab2, R.mipmap.waybill, R.mipmap.tab3};
private int[] img1={R.mipmap.tab1_s, R.mipmap.tab2_s, R.mipmap.waybill_s, R.mipmap.tab3_s};
private Fragment[] fs=new Fragment[4];
private BottomTabUtil bt;
@ -37,6 +41,7 @@ public class MainActivity extends BaseAppCompatActivity {
super.onCreate(savedInstanceState);
StateStyleUtil.stateTextColor(this);
setContentView(R.layout.activity_main);
EventBus.getDefault().register(this);
con=this;
act=this;
fs[0]=new HomeFragment();
@ -143,4 +148,21 @@ public class MainActivity extends BaseAppCompatActivity {
}
}
@Subscribe
public void ChangeTabEvent(ChangeTabEvent event){
switch_image(bt.getIndex(),2);
if (!fs[2].isAdded()) {
// bt.hide(fs[bt.getIndex()]);
getSupportFragmentManager().beginTransaction().hide(fs[bt.getIndex()]).add(R.id.body,fs[2],"").commitAllowingStateLoss();
}else{
getSupportFragmentManager().beginTransaction().hide(fs[0]).show(fs[2]).commitAllowingStateLoss();
}
bt.setIndex(2);
// bt.hide(fs[0]);
// bt.selectItem(fs[2]);
}
}

View File

@ -110,9 +110,9 @@ public class DisCarActivity extends BaseActivity {
etInput = findViewById(R.id.etInput);
recyclerView = findViewById(R.id.recyclerView);
String string = getIntent().getExtras().getString(AppConfig.STRING);
// String string = getIntent().getExtras().getString(AppConfig.STRING);
title.setText("分配车辆");
etInput.setText(string);
// etInput.setText(string);
recyclerView.addItemDecoration(new RecyclerViewDecoration(con,RecyclerViewDecoration.VERTICAL_LIST));
adapterAll = recyclerView.createV(con, datas, R.layout.item_dis_car);

View File

@ -31,6 +31,7 @@ import com.oneclouds.cargo.bean.AddressBean;
import com.oneclouds.cargo.bean.AddressListBean;
import com.oneclouds.cargo.bean.AuthInfoBean;
import com.oneclouds.cargo.event.AddressEvent;
import com.oneclouds.cargo.event.ChangeTabEvent;
import com.oneclouds.cargo.event.GoodsEvent;
import com.oneclouds.cargo.event.InformationEvent;
import com.oneclouds.cargo.event.InformationEventTwo;
@ -77,7 +78,7 @@ public class NodeInfoActivity extends BaseActivity {
private TextView tvName, tvNameDis;
private TextView tvPhone, tvPhoneDis;
private TextView tvAddress, tvAddressDis;
private TextView tvStartTime;
private TextView tvStartTime,tvRight;
private EditText etMoney;
private TextView tvEndTimeDis;
private Button submit;
@ -100,6 +101,7 @@ public class NodeInfoActivity extends BaseActivity {
title_view = findViewById(R.id.title_view);
recycleView = findViewById(R.id.rv);
submit = findViewById(R.id.submit);
tvRight = findViewById(R.id.tvRight);
data = getIntent().getExtras().getString("data");
submit.setOnClickListener(V -> {
submint();
@ -114,6 +116,14 @@ public class NodeInfoActivity extends BaseActivity {
oib = gson.fromJson(data, OrderInputBean.class);
os = oib.getSendTableData().get(0);
op = oib.getPutTableData().get(0);
tvRight.setVisibility(View.VISIBLE);
tvRight.setText("再来一单");
tvRight.setOnClickListener(v->{
ChangeTabEvent changeTabEvent = new ChangeTabEvent(2);
EventBus.getDefault().post(changeTabEvent);
finish();
});
title_view.setText("发货信息");

View File

@ -21,6 +21,7 @@ import com.lxj.xpopup.XPopup;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.WaybillListBean;
import com.oneclouds.cargo.event.RefreshEvent;
import com.oneclouds.cargo.request.OrderRequest;
import com.oneclouds.cargo.request.WaybillRequest;
import com.oneclouds.cargo.ui.home.NodeInfoActivity;
@ -39,6 +40,9 @@ import com.oneclouds.cargo.util.view.BaseFragment;
import com.oneclouds.cargo.util.view.BaseRecyclerView;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,74 +56,83 @@ import java.util.Map;
*/
public class OrderList1Fragment extends BaseFragment {
private int type=0;
private int type = 0;
private WaybillListBean olb;
private WaybillRequest wr;
private OrderRequest or;
private Gson gson=new Gson();
private Gson gson = new Gson();
private LinearLayout select_type;
private List<Boolean> keys=new ArrayList<>();
private Map<Integer,String> submit_map=new HashMap<>();
private List<Boolean> keys = new ArrayList<>();
private Map<Integer, String> submit_map = new HashMap<>();
private BaseRecyclerView order_brv;
private int index=1;
private int num=0;
private boolean dataKey=true;
private String timer="";
private int index = 1;
private int num = 0;
private boolean dataKey = true;
private String timer = "";
private SmartRefreshLayout sr;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);
switch (m.what){
switch (m.what) {
case RequsetCodeConstants.SUCCESS:
sr.finishRefresh();
sr.finishLoadMore();
//获取数据
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type)!=null) {
Log.e("-list-",CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type));
olb=gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type),WaybillListBean.class);
if(olb.getCode()==200){
if(index==1){
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type) != null) {
Log.e("-list-", CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type));
olb = gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type), WaybillListBean.class);
if (olb.getCode() == 200) {
if (index == 1) {
initData();
}else{
addData();
} else {
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
} else {
ToastUtil.show(con, "加载失败");
}
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2+type);
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2 + type);
}
//撤销
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "撤销成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_REVOKE);
}
//删除
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "删除成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_DEL);
}
break;
case 13:
//处理修改类型
if(m.obj.equals("1")){
ToastUtil.show(con,"派单");
}else{
ToastUtil.show(con,"抢单");
if (m.obj.equals("1")) {
ToastUtil.show(con, "派单");
} else {
ToastUtil.show(con, "抢单");
}
break;
default:break;
default:
break;
}
}
@ -127,104 +140,103 @@ public class OrderList1Fragment extends BaseFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
root = inflater.inflate(R.layout.fragment_order_list, container, false);
con = getContext();
act = getActivity();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
Log.e("type", "-" + type + "-");
wr = new WaybillRequest(con, hd);
or = new OrderRequest(con, hd);
order_brv = root.findViewById(R.id.order_brv);
initRefreshLoad();
initView(null);
// initView(null);
return root;
}
private AdapterAlls aas;
private List<ManyBean> list=new ArrayList<>();
private List<ManyBean> list = new ArrayList<>();
@Override
public void initView(Object obj) {
super.initView(obj);
aas=order_brv.creates(con,list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
Button btnAgain=v.findViewById(R.id.btnAgain);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
}
}
}
btnAgain.setOnClickListener(v1->{
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in=new Intent(con, AnotherOrderActivity.class);
in.putExtra("id",ld.getOrderId());
int sum = 0;
public void initData() {
list.clear();
List<ManyBean> lists = new ArrayList<>();
for (int i = 0; i < olb.getData().getList().size(); i++) {
String str = olb.getData().getList().get(i).getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
keys.add(false);
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
if (TypeParts.isEntrust(con)) {
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i), R.layout.order_item));
}
if (lists.size() == 0 && sum == 0) {
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""), R.layout.item_null));
}
list.addAll(lists);
aas = order_brv.creates(con, list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout) {
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld = (WaybillListBean.DataDTO.ListDTO) o;
Button btn = v.findViewById(R.id.btn);
Button btnAgain = v.findViewById(R.id.btnAgain);
ImageView state_img = v.findViewById(R.id.state_img);
v.setOnClickListener(v12 -> {
Intent in = new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id", ld.getOrderId());
startActivity(in);
});
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
if (ld.getMakeStatus() == 107001) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
} else if (ld.getMakeStatus() == 107002) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
} else if (ld.getMakeStatus() == 107003) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
} else {
}
btnAgain.setOnClickListener(v1 -> {
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in = new Intent(con, AnotherOrderActivity.class);
in.putExtra("id", ld.getOrderId());
in.putExtra("type", type);
startActivity(in);
});
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
if (ld.getStatus() > 102002) {
btn.setText("查看运单");
}
if(ld.getStatus()==102001){
if (ld.getStatus() == 102001) {
btn.setText("删除");
}
btn.setOnClickListener(v1 -> {
if(ld.getStatus()>102002){
Log.e("查看","查看");
Intent in=new Intent(con, OrderDetailsActivity.class);
in.putExtra("id",ld.getWaybillId());
if (ld.getStatus() > 102002) {
Log.e("查看", "查看");
Intent in = new Intent(con, OrderDetailsActivity.class);
in.putExtra("id", ld.getWaybillId());
startActivity(in);
}else{
if(ld.getStatus()==102002){
} else {
if (ld.getStatus() == 102002) {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否撤销此订单?",
@ -233,90 +245,66 @@ public class OrderList1Fragment extends BaseFragment {
or.orderRevoke(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}else{
} else {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否删除此订单?",
"取消", "确认",
() -> {
Log.e("删除","删除");
Log.e("删除", "删除");
or.orderDelete(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}
}
});
default:break;
case R.layout.order_time:
break;
default:
break;
}
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
public void addData() {
List<ManyBean> lists = new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
String str=listDTO.getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
lists.add(new ManyBean(new time(timer),R.layout.order_time));
String str = listDTO.getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
lists.add(new ManyBean(listDTO, R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
public void initRefreshLoad(){
sr =root.findViewById(R.id.refreshLayout);
public void initRefreshLoad() {
sr = root.findViewById(R.id.refreshLayout);
sr.setOnRefreshListener(refreshLayout -> {
Log.e("下拉刷新", "pps");
index=1;
dataKey=true;
timer="";
wr.orderList(index,10,type);
index = 1;
dataKey = true;
timer = "";
wr.orderList(index, 10, type);
});
sr.setOnLoadMoreListener(refreshLayout -> {
Log.e("上拉加载", "次数"+index);
if(dataKey){
Log.e("上拉加载", "次数" + index);
if (dataKey) {
index++;
wr.orderList(index,10,type);
}else{
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
wr.orderList(index, 10, type);
} else {
Toast.makeText(con, "没有更多了", Toast.LENGTH_SHORT).show();
refreshLayout.finishLoadMore();
}
});
sr.autoRefresh();
}
class time{
class time {
private String timer;
@ -334,4 +322,17 @@ public class OrderList1Fragment extends BaseFragment {
}
@Subscribe
public void refreshList(RefreshEvent event) {
if (event.getType() == type) {
sr.autoRefresh();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -22,12 +22,14 @@ import com.lxj.xpopup.XPopup;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.WaybillListBean;
import com.oneclouds.cargo.event.RefreshEvent;
import com.oneclouds.cargo.request.OrderRequest;
import com.oneclouds.cargo.request.WaybillRequest;
import com.oneclouds.cargo.ui.home.OrderDetailsActivity;
import com.oneclouds.cargo.ui.home.OrderDetailsAllActivity;
import com.oneclouds.cargo.ui.my.invoice.InvoiceCreateActivity;
import com.oneclouds.cargo.ui.parts.TypeParts;
import com.oneclouds.cargo.ui.waybill.activity.AnotherOrderActivity;
import com.oneclouds.cargo.util.StringUtil;
import com.oneclouds.cargo.util.ToastUtil;
import com.oneclouds.cargo.util.adapter.AdapterAlls;
@ -39,6 +41,9 @@ import com.oneclouds.cargo.util.view.BaseFragment;
import com.oneclouds.cargo.util.view.BaseRecyclerView;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,74 +57,82 @@ import java.util.Map;
*/
public class OrderList2Fragment extends BaseFragment {
private int type=200001;
private int type = 200001;
private WaybillListBean olb;
private WaybillRequest wr;
private OrderRequest or;
private Gson gson=new Gson();
private Gson gson = new Gson();
private LinearLayout select_type;
private List<Boolean> keys=new ArrayList<>();
private Map<Integer,String> submit_map=new HashMap<>();
private List<Boolean> keys = new ArrayList<>();
private Map<Integer, String> submit_map = new HashMap<>();
private BaseRecyclerView order_brv;
private int index=1;
private int num=0;
private boolean dataKey=true;
private String timer="";
private int index = 1;
private int num = 0;
private boolean dataKey = true;
private String timer = "";
private SmartRefreshLayout sr;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);
switch (m.what){
switch (m.what) {
case RequsetCodeConstants.SUCCESS:
sr.finishRefresh();
sr.finishLoadMore();
//获取数据
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type)!=null) {
Log.e("-list-",CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type));
olb=gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type),WaybillListBean.class);
if(olb.getCode()==200){
if(index==1){
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type) != null) {
Log.e("-list-", CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type));
olb = gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type), WaybillListBean.class);
if (olb.getCode() == 200) {
if (index == 1) {
initData();
}else{
addData();
} else {
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
} else {
ToastUtil.show(con, "加载失败");
}
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2+type);
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2 + type);
}
//撤销
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "撤销成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_REVOKE);
}
//删除
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "删除成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_DEL);
}
break;
case 13:
//处理修改类型
if(m.obj.equals("1")){
ToastUtil.show(con,"派单");
}else{
ToastUtil.show(con,"抢单");
if (m.obj.equals("1")) {
ToastUtil.show(con, "派单");
} else {
ToastUtil.show(con, "抢单");
}
break;
default:break;
default:
break;
}
}
@ -127,110 +140,101 @@ public class OrderList2Fragment extends BaseFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
// submit=root.findViewById(R.id.submit);
// submit.setOnClickListener(v -> {
// if(submit_map.size()>0){
// Intent in=new Intent(con, InvoiceCreateActivity.class);
// in.putExtra("list",gson.toJson(submit_map));
// startActivity(in);
// }else{
// Toast.makeText(con,"请先选择需要开票的订单",Toast.LENGTH_LONG).show();
// }
// });
// if(type==0 || type==102005){
// submit.setVisibility(View.VISIBLE);
// }
root = inflater.inflate(R.layout.fragment_order_list, container, false);
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
con = getContext();
act = getActivity();
Log.e("type", "-" + type + "-");
wr = new WaybillRequest(con, hd);
or = new OrderRequest(con, hd);
order_brv = root.findViewById(R.id.order_brv);
initRefreshLoad();
initView(null);
return root;
}
private AdapterAlls aas;
private List<ManyBean> list=new ArrayList<>();
private List<ManyBean> list = new ArrayList<>();
@Override
public void initView(Object obj) {
super.initView(obj);
aas=order_brv.creates(con,list);
}
int sum = 0;
public void initData() {
list.clear();
List<ManyBean> lists = new ArrayList<>();
for (int i = 0; i < olb.getData().getList().size(); i++) {
String str = olb.getData().getList().get(i).getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
keys.add(false);
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
if (TypeParts.isEntrust(con)) {
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i), R.layout.order_item));
}
if (lists.size() == 0 && sum == 0) {
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""), R.layout.item_null));
}
list.addAll(lists);
aas = order_brv.creates(con, list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
switch (layout) {
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
WaybillListBean.DataDTO.ListDTO ld = (WaybillListBean.DataDTO.ListDTO) o;
Button btn = v.findViewById(R.id.btn);
ImageView state_img = v.findViewById(R.id.state_img);
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
Intent in = new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id", ld.getOrderId());
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
}
}
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
Button btnAgain = v.findViewById(R.id.btnAgain);
btnAgain.setOnClickListener(v1 -> {
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in = new Intent(con, AnotherOrderActivity.class);
in.putExtra("id", ld.getOrderId());
in.putExtra("type", type);
startActivity(in);
});
if (ld.getMakeStatus() == 107001) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
} else if (ld.getMakeStatus() == 107002) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
} else if (ld.getMakeStatus() == 107003) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
} else {
}
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
if (ld.getStatus() > 102002) {
btn.setText("查看运单");
}
if(ld.getStatus()==102001){
if (ld.getStatus() == 102001) {
btn.setText("删除");
}
btn.setOnClickListener(v1 -> {
if(ld.getStatus()>102002){
Log.e("查看","查看");
Intent in=new Intent(con, OrderDetailsActivity.class);
in.putExtra("id",ld.getWaybillId());
if (ld.getStatus() > 102002) {
Log.e("查看", "查看");
Intent in = new Intent(con, OrderDetailsActivity.class);
in.putExtra("id", ld.getWaybillId());
startActivity(in);
}else{
if(ld.getStatus()==102002){
} else {
if (ld.getStatus() == 102002) {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否撤销此订单?",
@ -239,90 +243,64 @@ public class OrderList2Fragment extends BaseFragment {
or.orderRevoke(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}else{
} else {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否删除此订单?",
"取消", "确认",
() -> {
Log.e("删除","删除");
Log.e("删除", "删除");
or.orderDelete(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}
}
});
default:break;
default:
break;
}
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
public void addData() {
List<ManyBean> lists = new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
String str=listDTO.getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
lists.add(new ManyBean(new time(timer),R.layout.order_time));
String str = listDTO.getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
lists.add(new ManyBean(listDTO, R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
public void initRefreshLoad(){
sr =root.findViewById(R.id.refreshLayout);
public void initRefreshLoad() {
sr = root.findViewById(R.id.refreshLayout);
sr.setOnRefreshListener(refreshLayout -> {
Log.e("下拉刷新", "pps");
index=1;
dataKey=true;
timer="";
wr.orderList(index,10,type);
index = 1;
dataKey = true;
timer = "";
wr.orderList(index, 10, type);
});
sr.setOnLoadMoreListener(refreshLayout -> {
Log.e("上拉加载", "次数"+index);
if(dataKey){
Log.e("上拉加载", "次数" + index);
if (dataKey) {
index++;
wr.orderList(index,10,type);
}else{
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
wr.orderList(index, 10, type);
} else {
Toast.makeText(con, "没有更多了", Toast.LENGTH_SHORT).show();
refreshLayout.finishLoadMore();
}
});
sr.autoRefresh();
}
class time{
class time {
private String timer;
@ -340,4 +318,16 @@ public class OrderList2Fragment extends BaseFragment {
}
@Subscribe
public void refreshList(RefreshEvent event) {
if (event.getType() == type) {
sr.autoRefresh();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -22,12 +22,14 @@ import com.lxj.xpopup.XPopup;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.WaybillListBean;
import com.oneclouds.cargo.event.RefreshEvent;
import com.oneclouds.cargo.request.OrderRequest;
import com.oneclouds.cargo.request.WaybillRequest;
import com.oneclouds.cargo.ui.home.OrderDetailsActivity;
import com.oneclouds.cargo.ui.home.OrderDetailsAllActivity;
import com.oneclouds.cargo.ui.my.invoice.InvoiceCreateActivity;
import com.oneclouds.cargo.ui.parts.TypeParts;
import com.oneclouds.cargo.ui.waybill.activity.AnotherOrderActivity;
import com.oneclouds.cargo.util.StringUtil;
import com.oneclouds.cargo.util.ToastUtil;
import com.oneclouds.cargo.util.adapter.AdapterAlls;
@ -39,6 +41,9 @@ import com.oneclouds.cargo.util.view.BaseFragment;
import com.oneclouds.cargo.util.view.BaseRecyclerView;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,74 +57,82 @@ import java.util.Map;
*/
public class OrderList3Fragment extends BaseFragment {
private int type=200003;
private int type = 200003;
private WaybillListBean olb;
private WaybillRequest wr;
private OrderRequest or;
private Gson gson=new Gson();
private Gson gson = new Gson();
private LinearLayout select_type;
private List<Boolean> keys=new ArrayList<>();
private Map<Integer,String> submit_map=new HashMap<>();
private List<Boolean> keys = new ArrayList<>();
private Map<Integer, String> submit_map = new HashMap<>();
private BaseRecyclerView order_brv;
private int index=1;
private int num=0;
private boolean dataKey=true;
private String timer="";
private int index = 1;
private int num = 0;
private boolean dataKey = true;
private String timer = "";
private SmartRefreshLayout sr;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);
switch (m.what){
switch (m.what) {
case RequsetCodeConstants.SUCCESS:
sr.finishRefresh();
sr.finishLoadMore();
//获取数据
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type)!=null) {
Log.e("-list-",CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type));
olb=gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type),WaybillListBean.class);
if(olb.getCode()==200){
if(index==1){
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type) != null) {
Log.e("-list-", CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type));
olb = gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type), WaybillListBean.class);
if (olb.getCode() == 200) {
if (index == 1) {
initData();
}else{
addData();
} else {
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
} else {
ToastUtil.show(con, "加载失败");
}
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2+type);
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2 + type);
}
//撤销
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "撤销成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_REVOKE);
}
//删除
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "删除成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_DEL);
}
break;
case 13:
//处理修改类型
if(m.obj.equals("1")){
ToastUtil.show(con,"派单");
}else{
ToastUtil.show(con,"抢单");
if (m.obj.equals("1")) {
ToastUtil.show(con, "派单");
} else {
ToastUtil.show(con, "抢单");
}
break;
default:break;
default:
break;
}
}
@ -127,110 +140,103 @@ public class OrderList3Fragment extends BaseFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
// submit=root.findViewById(R.id.submit);
// submit.setOnClickListener(v -> {
// if(submit_map.size()>0){
// Intent in=new Intent(con, InvoiceCreateActivity.class);
// in.putExtra("list",gson.toJson(submit_map));
// startActivity(in);
// }else{
// Toast.makeText(con,"请先选择需要开票的订单",Toast.LENGTH_LONG).show();
// }
// });
// if(type==0 || type==102005){
// submit.setVisibility(View.VISIBLE);
// }
root = inflater.inflate(R.layout.fragment_order_list, container, false);
con = getContext();
act = getActivity();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
Log.e("type", "-" + type + "-");
wr = new WaybillRequest(con, hd);
or = new OrderRequest(con, hd);
order_brv = root.findViewById(R.id.order_brv);
initRefreshLoad();
initView(null);
return root;
}
private AdapterAlls aas;
private List<ManyBean> list=new ArrayList<>();
private List<ManyBean> list = new ArrayList<>();
@Override
public void initView(Object obj) {
super.initView(obj);
aas=order_brv.creates(con,list);
}
int sum = 0;
public void initData() {
list.clear();
List<ManyBean> lists = new ArrayList<>();
for (int i = 0; i < olb.getData().getList().size(); i++) {
String str = olb.getData().getList().get(i).getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
keys.add(false);
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
if (TypeParts.isEntrust(con)) {
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i), R.layout.order_item));
}
if (lists.size() == 0 && sum == 0) {
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""), R.layout.item_null));
}
list.addAll(lists);
aas = order_brv.creates(con, list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
switch (layout) {
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
WaybillListBean.DataDTO.ListDTO ld = (WaybillListBean.DataDTO.ListDTO) o;
Button btn = v.findViewById(R.id.btn);
ImageView state_img = v.findViewById(R.id.state_img);
Button btnAgain = v.findViewById(R.id.btnAgain);
btnAgain.setOnClickListener(v1 -> {
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in = new Intent(con, AnotherOrderActivity.class);
in.putExtra("id", ld.getOrderId());
in.putExtra("type", type);
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
}
}
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
v.setOnClickListener(v12 -> {
Intent in = new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id", ld.getOrderId());
startActivity(in);
});
if (ld.getMakeStatus() == 107001) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
} else if (ld.getMakeStatus() == 107002) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
} else if (ld.getMakeStatus() == 107003) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
} else {
}
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
if (ld.getStatus() > 102002) {
btn.setText("查看运单");
}
if(ld.getStatus()==102001){
if (ld.getStatus() == 102001) {
btn.setText("删除");
}
btn.setOnClickListener(v1 -> {
if(ld.getStatus()>102002){
Log.e("查看","查看");
Intent in=new Intent(con, OrderDetailsActivity.class);
in.putExtra("id",ld.getWaybillId());
if (ld.getStatus() > 102002) {
Log.e("查看", "查看");
Intent in = new Intent(con, OrderDetailsActivity.class);
in.putExtra("id", ld.getWaybillId());
startActivity(in);
}else{
if(ld.getStatus()==102002){
} else {
if (ld.getStatus() == 102002) {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否撤销此订单?",
@ -239,90 +245,64 @@ public class OrderList3Fragment extends BaseFragment {
or.orderRevoke(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}else{
} else {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否删除此订单?",
"取消", "确认",
() -> {
Log.e("删除","删除");
Log.e("删除", "删除");
or.orderDelete(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}
}
});
default:break;
default:
break;
}
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
public void addData() {
List<ManyBean> lists = new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
String str=listDTO.getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
lists.add(new ManyBean(new time(timer),R.layout.order_time));
String str = listDTO.getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
lists.add(new ManyBean(listDTO, R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
public void initRefreshLoad(){
sr =root.findViewById(R.id.refreshLayout);
public void initRefreshLoad() {
sr = root.findViewById(R.id.refreshLayout);
sr.setOnRefreshListener(refreshLayout -> {
Log.e("下拉刷新", "pps");
index=1;
dataKey=true;
timer="";
wr.orderList(index,10,type);
index = 1;
dataKey = true;
timer = "";
wr.orderList(index, 10, type);
});
sr.setOnLoadMoreListener(refreshLayout -> {
Log.e("上拉加载", "次数"+index);
if(dataKey){
Log.e("上拉加载", "次数" + index);
if (dataKey) {
index++;
wr.orderList(index,10,type);
}else{
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
wr.orderList(index, 10, type);
} else {
Toast.makeText(con, "没有更多了", Toast.LENGTH_SHORT).show();
refreshLayout.finishLoadMore();
}
});
sr.autoRefresh();
}
class time{
class time {
private String timer;
@ -340,4 +320,16 @@ public class OrderList3Fragment extends BaseFragment {
}
@Subscribe
public void refreshList(RefreshEvent event) {
if (event.getType() == type) {
sr.autoRefresh();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -22,12 +22,14 @@ import com.lxj.xpopup.XPopup;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.WaybillListBean;
import com.oneclouds.cargo.event.RefreshEvent;
import com.oneclouds.cargo.request.OrderRequest;
import com.oneclouds.cargo.request.WaybillRequest;
import com.oneclouds.cargo.ui.home.OrderDetailsActivity;
import com.oneclouds.cargo.ui.home.OrderDetailsAllActivity;
import com.oneclouds.cargo.ui.my.invoice.InvoiceCreateActivity;
import com.oneclouds.cargo.ui.parts.TypeParts;
import com.oneclouds.cargo.ui.waybill.activity.AnotherOrderActivity;
import com.oneclouds.cargo.util.StringUtil;
import com.oneclouds.cargo.util.ToastUtil;
import com.oneclouds.cargo.util.adapter.AdapterAlls;
@ -39,6 +41,9 @@ import com.oneclouds.cargo.util.view.BaseFragment;
import com.oneclouds.cargo.util.view.BaseRecyclerView;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -52,74 +57,82 @@ import java.util.Map;
*/
public class OrderList4Fragment extends BaseFragment {
private int type=200004;
private int type = 200004;
private WaybillListBean olb;
private WaybillRequest wr;
private OrderRequest or;
private Gson gson=new Gson();
private Gson gson = new Gson();
private LinearLayout select_type;
private List<Boolean> keys=new ArrayList<>();
private Map<Integer,String> submit_map=new HashMap<>();
private List<Boolean> keys = new ArrayList<>();
private Map<Integer, String> submit_map = new HashMap<>();
private BaseRecyclerView order_brv;
private int index=1;
private int num=0;
private boolean dataKey=true;
private String timer="";
private int index = 1;
private int num = 0;
private boolean dataKey = true;
private String timer = "";
private SmartRefreshLayout sr;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);
switch (m.what){
switch (m.what) {
case RequsetCodeConstants.SUCCESS:
sr.finishRefresh();
sr.finishLoadMore();
//获取数据
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type)!=null) {
Log.e("-list-",CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type));
olb=gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type),WaybillListBean.class);
if(olb.getCode()==200){
if(index==1){
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type) != null) {
Log.e("-list-", CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type));
olb = gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type), WaybillListBean.class);
if (olb.getCode() == 200) {
if (index == 1) {
initData();
}else{
addData();
} else {
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
} else {
ToastUtil.show(con, "加载失败");
}
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2+type);
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2 + type);
}
//撤销
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "撤销成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_REVOKE);
}
//删除
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "删除成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_DEL);
}
break;
case 13:
//处理修改类型
if(m.obj.equals("1")){
ToastUtil.show(con,"派单");
}else{
ToastUtil.show(con,"抢单");
if (m.obj.equals("1")) {
ToastUtil.show(con, "派单");
} else {
ToastUtil.show(con, "抢单");
}
break;
default:break;
default:
break;
}
}
@ -127,110 +140,102 @@ public class OrderList4Fragment extends BaseFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
// submit=root.findViewById(R.id.submit);
// submit.setOnClickListener(v -> {
// if(submit_map.size()>0){
// Intent in=new Intent(con, InvoiceCreateActivity.class);
// in.putExtra("list",gson.toJson(submit_map));
// startActivity(in);
// }else{
// Toast.makeText(con,"请先选择需要开票的订单",Toast.LENGTH_LONG).show();
// }
// });
// if(type==0 || type==102005){
// submit.setVisibility(View.VISIBLE);
// }
root = inflater.inflate(R.layout.fragment_order_list, container, false);
con = getContext();
act = getActivity();
Log.e("type", "-" + type + "-");
wr = new WaybillRequest(con, hd);
or = new OrderRequest(con, hd);
order_brv = root.findViewById(R.id.order_brv);
initRefreshLoad();
initView(null);
return root;
}
private AdapterAlls aas;
private List<ManyBean> list=new ArrayList<>();
private List<ManyBean> list = new ArrayList<>();
@Override
public void initView(Object obj) {
super.initView(obj);
aas=order_brv.creates(con,list);
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
int sum = 0;
public void initData() {
list.clear();
List<ManyBean> lists = new ArrayList<>();
for (int i = 0; i < olb.getData().getList().size(); i++) {
String str = olb.getData().getList().get(i).getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
keys.add(false);
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
if (TypeParts.isEntrust(con)) {
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i), R.layout.order_item));
}
if (lists.size() == 0 && sum == 0) {
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""), R.layout.item_null));
}
list.addAll(lists);
aas = order_brv.creates(con, list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
switch (layout) {
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
WaybillListBean.DataDTO.ListDTO ld = (WaybillListBean.DataDTO.ListDTO) o;
Button btn = v.findViewById(R.id.btn);
ImageView state_img = v.findViewById(R.id.state_img);
Button btnAgain = v.findViewById(R.id.btnAgain);
btnAgain.setOnClickListener(v1 -> {
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in = new Intent(con, AnotherOrderActivity.class);
in.putExtra("id", ld.getOrderId());
in.putExtra("type", type);
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
}
}
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
v.setOnClickListener(v12 -> {
Intent in = new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id", ld.getOrderId());
startActivity(in);
});
if (ld.getMakeStatus() == 107001) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
} else if (ld.getMakeStatus() == 107002) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
} else if (ld.getMakeStatus() == 107003) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
} else {
}
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
if (ld.getStatus() > 102002) {
btn.setText("查看运单");
}
if(ld.getStatus()==102001){
if (ld.getStatus() == 102001) {
btn.setText("删除");
}
btn.setOnClickListener(v1 -> {
if(ld.getStatus()>102002){
Log.e("查看","查看");
Intent in=new Intent(con, OrderDetailsActivity.class);
in.putExtra("id",ld.getWaybillId());
if (ld.getStatus() > 102002) {
Log.e("查看", "查看");
Intent in = new Intent(con, OrderDetailsActivity.class);
in.putExtra("id", ld.getWaybillId());
startActivity(in);
}else{
if(ld.getStatus()==102002){
} else {
if (ld.getStatus() == 102002) {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否撤销此订单?",
@ -239,90 +244,64 @@ public class OrderList4Fragment extends BaseFragment {
or.orderRevoke(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}else{
} else {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否删除此订单?",
"取消", "确认",
() -> {
Log.e("删除","删除");
Log.e("删除", "删除");
or.orderDelete(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}
}
});
default:break;
default:
break;
}
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
public void addData() {
List<ManyBean> lists = new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
String str=listDTO.getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
lists.add(new ManyBean(new time(timer),R.layout.order_time));
String str = listDTO.getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
lists.add(new ManyBean(listDTO, R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
public void initRefreshLoad(){
sr =root.findViewById(R.id.refreshLayout);
public void initRefreshLoad() {
sr = root.findViewById(R.id.refreshLayout);
sr.setOnRefreshListener(refreshLayout -> {
Log.e("下拉刷新", "pps");
index=1;
dataKey=true;
timer="";
wr.orderList(index,10,type);
index = 1;
dataKey = true;
timer = "";
wr.orderList(index, 10, type);
});
sr.setOnLoadMoreListener(refreshLayout -> {
Log.e("上拉加载", "次数"+index);
if(dataKey){
Log.e("上拉加载", "次数" + index);
if (dataKey) {
index++;
wr.orderList(index,10,type);
}else{
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
wr.orderList(index, 10, type);
} else {
Toast.makeText(con, "没有更多了", Toast.LENGTH_SHORT).show();
refreshLayout.finishLoadMore();
}
});
sr.autoRefresh();
}
class time{
class time {
private String timer;
@ -340,4 +319,16 @@ public class OrderList4Fragment extends BaseFragment {
}
@Subscribe
public void refreshList(RefreshEvent event) {
if (event.getType() == type) {
sr.autoRefresh();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -21,12 +21,14 @@ import com.lxj.xpopup.XPopup;
import com.oneclouds.cargo.R;
import com.oneclouds.cargo.bean.BaseBean;
import com.oneclouds.cargo.bean.WaybillListBean;
import com.oneclouds.cargo.event.RefreshEvent;
import com.oneclouds.cargo.request.OrderRequest;
import com.oneclouds.cargo.request.WaybillRequest;
import com.oneclouds.cargo.ui.home.OrderDetailsActivity;
import com.oneclouds.cargo.ui.home.OrderDetailsAllActivity;
import com.oneclouds.cargo.ui.my.invoice.InvoiceCreateActivity;
import com.oneclouds.cargo.ui.parts.TypeParts;
import com.oneclouds.cargo.ui.waybill.activity.AnotherOrderActivity;
import com.oneclouds.cargo.util.ToastUtil;
import com.oneclouds.cargo.util.adapter.AdapterAlls;
import com.oneclouds.cargo.util.adapter.ManyBean;
@ -37,6 +39,9 @@ import com.oneclouds.cargo.util.view.BaseFragment;
import com.oneclouds.cargo.util.view.BaseRecyclerView;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -81,7 +86,12 @@ public class OrderList5Fragment extends BaseFragment {
if(index==1){
initData();
}else{
addData();
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
@ -92,6 +102,7 @@ public class OrderList5Fragment extends BaseFragment {
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
sr.autoRefresh();
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
@ -102,6 +113,7 @@ public class OrderList5Fragment extends BaseFragment {
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
sr.autoRefresh();
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
@ -128,23 +140,13 @@ public class OrderList5Fragment extends BaseFragment {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
// submit=root.findViewById(R.id.submit);
// submit.setOnClickListener(v -> {
// if(submit_map.size()>0){
// Intent in=new Intent(con, InvoiceCreateActivity.class);
// in.putExtra("list",gson.toJson(submit_map));
// startActivity(in);
// }else{
// Toast.makeText(con,"请先选择需要开票的订单",Toast.LENGTH_LONG).show();
// }
// });
// if(type==0 || type==102005){
// submit.setVisibility(View.VISIBLE);
// }
initRefreshLoad();
initView(null);
return root;
@ -156,6 +158,34 @@ public class OrderList5Fragment extends BaseFragment {
@Override
public void initView(Object obj) {
super.initView(obj);
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas=order_brv.creates(con,list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
@ -163,57 +193,31 @@ public class OrderList5Fragment extends BaseFragment {
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
Button btnAgain=v.findViewById(R.id.btnAgain);
btnAgain.setOnClickListener(v1->{
// Intent in=new Intent(con, NodeInfoActivity.class);
Intent in=new Intent(con, AnotherOrderActivity.class);
in.putExtra("id",ld.getOrderId());
in.putExtra("type",type);
startActivity(in);
});
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
if(ld.getMakeStatus()==107001){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
}
}
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
});
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
btn.setText("查看运单");
@ -255,33 +259,6 @@ public class OrderList5Fragment extends BaseFragment {
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
@ -293,8 +270,7 @@ public class OrderList5Fragment extends BaseFragment {
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
@ -337,5 +313,16 @@ public class OrderList5Fragment extends BaseFragment {
}
}
@Subscribe
public void refreshList(RefreshEvent event){
if (event.getType()==type){
sr.autoRefresh();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}

View File

@ -52,74 +52,82 @@ import java.util.Map;
*/
public class OrderList6Fragment extends BaseFragment {
private int type=102001;
private int type = 102001;
private WaybillListBean olb;
private WaybillRequest wr;
private OrderRequest or;
private Gson gson=new Gson();
private Gson gson = new Gson();
private LinearLayout select_type;
private List<Boolean> keys=new ArrayList<>();
private Map<Integer,String> submit_map=new HashMap<>();
private List<Boolean> keys = new ArrayList<>();
private Map<Integer, String> submit_map = new HashMap<>();
private BaseRecyclerView order_brv;
private int index=1;
private int num=0;
private boolean dataKey=true;
private String timer="";
private int index = 1;
private int num = 0;
private boolean dataKey = true;
private String timer = "";
private SmartRefreshLayout sr;
@Override
public void msgMethod(Message m) {
super.msgMethod(m);
switch (m.what){
switch (m.what) {
case RequsetCodeConstants.SUCCESS:
sr.finishRefresh();
sr.finishLoadMore();
//获取数据
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type)!=null) {
Log.e("-list-",CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type));
olb=gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2+type),WaybillListBean.class);
if(olb.getCode()==200){
if(index==1){
if (CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type) != null) {
Log.e("-list-", CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type));
olb = gson.fromJson(CacheGroup.cacheList.get(WaybillRequest.WAYBILL_LIST_V2 + type), WaybillListBean.class);
if (olb.getCode() == 200) {
if (index == 1) {
initData();
}else{
addData();
} else {
if(olb.getData().getList().size()==0){
dataKey=false;
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
}else{
addData();
}
}
}else{
ToastUtil.show(con,"加载失败");
} else {
ToastUtil.show(con, "加载失败");
}
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2+type);
CacheGroup.cacheList.remove(WaybillRequest.WAYBILL_LIST_V2 + type);
}
//撤销
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"撤销成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_REVOKE), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "撤销成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_REVOKE);
}
//删除
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL)!=null) {
BaseBean bb=gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL),BaseBean.class);
if(bb.getCode()==200){
ToastUtil.show(con,"删除成功");
}else{
ToastUtil.show(con,bb.getMsg());
if (CacheGroup.cacheList.get(OrderRequest.ORDER_DEL) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(OrderRequest.ORDER_DEL), BaseBean.class);
if (bb.getCode() == 200) {
sr.autoRefresh();
ToastUtil.show(con, "删除成功");
} else {
ToastUtil.show(con, bb.getMsg());
}
CacheGroup.cacheList.remove(OrderRequest.ORDER_DEL);
}
break;
case 13:
//处理修改类型
if(m.obj.equals("1")){
ToastUtil.show(con,"派单");
}else{
ToastUtil.show(con,"抢单");
if (m.obj.equals("1")) {
ToastUtil.show(con, "派单");
} else {
ToastUtil.show(con, "抢单");
}
break;
default:break;
default:
break;
}
}
@ -127,110 +135,93 @@ public class OrderList6Fragment extends BaseFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
root=inflater.inflate(R.layout.fragment_order_list,container,false);
con=getContext();
act=getActivity();
Log.e("type","-"+type+"-");
wr=new WaybillRequest(con,hd);
or=new OrderRequest(con,hd);
order_brv=root.findViewById(R.id.order_brv);
// submit=root.findViewById(R.id.submit);
// submit.setOnClickListener(v -> {
// if(submit_map.size()>0){
// Intent in=new Intent(con, InvoiceCreateActivity.class);
// in.putExtra("list",gson.toJson(submit_map));
// startActivity(in);
// }else{
// Toast.makeText(con,"请先选择需要开票的订单",Toast.LENGTH_LONG).show();
// }
// });
// if(type==0 || type==102005){
// submit.setVisibility(View.VISIBLE);
// }
root = inflater.inflate(R.layout.fragment_order_list, container, false);
con = getContext();
act = getActivity();
Log.e("type", "-" + type + "-");
wr = new WaybillRequest(con, hd);
or = new OrderRequest(con, hd);
order_brv = root.findViewById(R.id.order_brv);
initRefreshLoad();
initView(null);
return root;
}
private AdapterAlls aas;
private List<ManyBean> list=new ArrayList<>();
private List<ManyBean> list = new ArrayList<>();
@Override
public void initView(Object obj) {
super.initView(obj);
aas=order_brv.creates(con,list);
}
int sum = 0;
public void initData() {
list.clear();
List<ManyBean> lists = new ArrayList<>();
for (int i = 0; i < olb.getData().getList().size(); i++) {
String str = olb.getData().getList().get(i).getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
keys.add(false);
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
if (TypeParts.isEntrust(con)) {
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i), R.layout.order_item));
}
if (lists.size() == 0 && sum == 0) {
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""), R.layout.item_null));
}
list.addAll(lists);
aas = order_brv.creates(con, list);
aas.setOnItemViewListener((position, o, v, layout) -> {
switch (layout){
switch (layout) {
case R.layout.order_item:
WaybillListBean.DataDTO.ListDTO ld= (WaybillListBean.DataDTO.ListDTO) o;
Button btn=v.findViewById(R.id.btn);
ImageView state_img=v.findViewById(R.id.state_img);
ImageButton xuan=v.findViewById(R.id.xuan);
WaybillListBean.DataDTO.ListDTO ld = (WaybillListBean.DataDTO.ListDTO) o;
Button btn = v.findViewById(R.id.btn);
ImageView state_img = v.findViewById(R.id.state_img);
LinearLayout llAgain = v.findViewById(R.id.llAgain);
llAgain.setVisibility(View.GONE);
v.setOnClickListener(v12 -> {
Intent in=new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id",ld.getOrderId());
Intent in = new Intent(con, OrderDetailsAllActivity.class);
in.putExtra("id", ld.getOrderId());
startActivity(in);
});
if (ld.getStatus()!=102005) {
xuan.setVisibility(View.GONE);
}else{
if(ld.getMakeStatus()==107001){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
}else if(ld.getMakeStatus()==107002){
xuan.setVisibility(View.GONE);
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
}else if(ld.getMakeStatus()==107003){
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
}else{
if (ld.getMakeStatus() == 107001) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_state);
} else if (ld.getMakeStatus() == 107002) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing);
} else if (ld.getMakeStatus() == 107003) {
state_img.setVisibility(View.VISIBLE);
state_img.setImageResource(R.mipmap.invoicing_no);
} else {
}
}
xuan.setOnClickListener(v1 -> {
if(ld.getStatus()==102005){
if (keys.get(position)) {
xuan.setImageResource(R.mipmap.no_xuan);
keys.set(position,false);
num--;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.remove(position);
}else{
xuan.setImageResource(R.mipmap.xuan);
keys.set(position,true);
num++;
// if(num>0){
// submit.setText("提交开票申请("+num+")");
// }else{
// submit.setText("提交开票申请");
// }
submit_map.put(position,gson.toJson(o));
}
}else{
Toast.makeText(con,"订单尚未完成无法开票",Toast.LENGTH_LONG).show();
}
});
v.setTop(getResources().getDimensionPixelOffset(R.dimen.dp_10));
if (ld.getStatus()>102002) {
if (ld.getStatus() > 102002) {
btn.setText("查看运单");
}
if(ld.getStatus()==102001){
if (ld.getStatus() == 102001) {
btn.setText("删除");
}
btn.setOnClickListener(v1 -> {
if(ld.getStatus()>102002){
Log.e("查看","查看");
Intent in=new Intent(con, OrderDetailsActivity.class);
in.putExtra("id",ld.getWaybillId());
if (ld.getStatus() > 102002) {
Log.e("查看", "查看");
Intent in = new Intent(con, OrderDetailsActivity.class);
in.putExtra("id", ld.getWaybillId());
startActivity(in);
}else{
if(ld.getStatus()==102002){
} else {
if (ld.getStatus() == 102002) {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否撤销此订单?",
@ -239,90 +230,64 @@ public class OrderList6Fragment extends BaseFragment {
or.orderRevoke(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}else{
} else {
new XPopup.Builder(getActivity())
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认", "是否删除此订单?",
"取消", "确认",
() -> {
Log.e("删除","删除");
Log.e("删除", "删除");
or.orderDelete(ld.getOrderId());
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
}
}
});
default:break;
default:
break;
}
});
}
int sum=0;
public void initData(){
list.clear();
List<ManyBean> lists=new ArrayList<>();
for(int i=0;i<olb.getData().getList().size();i++){
String str=olb.getData().getList().get(i).getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
keys.add(false);
lists.add(new ManyBean(new time(timer),R.layout.order_time));
}
if(TypeParts.isEntrust(con)){
olb.getData().getList().get(i).setTotalFreight("");
}
keys.add(false);
lists.add(new ManyBean(olb.getData().getList().get(i),R.layout.order_item));
}
if(lists.size()==0 && sum==0){
sum++;
keys.add(false);
lists.add(new ManyBean(new time(""),R.layout.item_null));
}
list.addAll(lists);
aas.notifyDataSetChanged();
}
public void addData(){
List<ManyBean> lists=new ArrayList<>();
public void addData() {
List<ManyBean> lists = new ArrayList<>();
for (WaybillListBean.DataDTO.ListDTO listDTO : olb.getData().getList()) {
String str=listDTO.getCreateTime();
str=Timer.formatChange(str,"yyyy-MM-dd HH:mm:ss","yyyy-MM");
if(!str.equals(timer)){
timer=str;
lists.add(new ManyBean(new time(timer),R.layout.order_time));
String str = listDTO.getCreateTime();
str = Timer.formatChange(str, "yyyy-MM-dd HH:mm:ss", "yyyy-MM");
if (!str.equals(timer)) {
timer = str;
lists.add(new ManyBean(new time(timer), R.layout.order_time));
}
lists.add(new ManyBean(listDTO,R.layout.order_item));
lists.add(new ManyBean(listDTO, R.layout.order_item));
}
list.addAll(lists);
aas.notifyDataSetChanged();
order_brv.adds(lists);
}
//加载和刷新
public void initRefreshLoad(){
sr =root.findViewById(R.id.refreshLayout);
public void initRefreshLoad() {
sr = root.findViewById(R.id.refreshLayout);
sr.setOnRefreshListener(refreshLayout -> {
Log.e("下拉刷新", "pps");
index=1;
dataKey=true;
timer="";
wr.orderList(index,10,type);
index = 1;
dataKey = true;
timer = "";
wr.orderList(index, 10, type);
});
sr.setOnLoadMoreListener(refreshLayout -> {
Log.e("上拉加载", "次数"+index);
if(dataKey){
Log.e("上拉加载", "次数" + index);
if (dataKey) {
index++;
wr.orderList(index,10,type);
}else{
Toast.makeText(con,"没有更多了",Toast.LENGTH_SHORT).show();
wr.orderList(index, 10, type);
} else {
Toast.makeText(con, "没有更多了", Toast.LENGTH_SHORT).show();
refreshLayout.finishLoadMore();
}
});
sr.autoRefresh();
}
class time{
class time {
private String timer;

View File

@ -11,6 +11,7 @@ import com.oneclouds.cargo.ui.parts.UserParts
import com.xuexiang.xui.widget.tabbar.TabSegment
import kotlinx.android.synthetic.main.fragment_waybill_list.*
import kotlinx.android.synthetic.main.order_list_top.*
import org.greenrobot.eventbus.Subscribe
/**
* @ClassName WayBillsFragment

View File

@ -11,6 +11,7 @@ import android.widget.TextView
import android.widget.Toast
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.TimeUtil
import com.github.gzuliyujiang.wheelpicker.DatimePicker
import com.github.gzuliyujiang.wheelpicker.OptionPicker
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode
@ -24,6 +25,7 @@ import com.oneclouds.cargo.bean.*
import com.oneclouds.cargo.event.AddressEvent
import com.oneclouds.cargo.event.BaseEvent
import com.oneclouds.cargo.event.GoodsEvent
import com.oneclouds.cargo.event.RefreshEvent
import com.oneclouds.cargo.request.bean.CommonBodyBean
import com.oneclouds.cargo.request.bean.OrderInputBean
import com.oneclouds.cargo.request.bean.OrderInputBean.PutTableDataDTO
@ -49,6 +51,8 @@ import kotlinx.android.synthetic.main.activity_anohter_order.*
import kotlinx.android.synthetic.main.item_node_pretend.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import java.text.SimpleDateFormat
import java.util.*
/**
* @ClassName AnotherOrderActivity
@ -63,9 +67,9 @@ class AnotherOrderActivity : BaseActivity() {
lateinit var tvPhoneDis: TextView
lateinit var tvAddress: TextView
lateinit var tvAddressDis: TextView
lateinit var tvStartTime: TextView
lateinit var tvStartTime: TextView //装货有效期
lateinit var etMoney: EditText
lateinit var tvEndTimeDis: TextView
lateinit var tvEndTimeDis: TextView//卸货有效期
lateinit var ryPretend: BaseRecyclerView
lateinit var ryDis: BaseRecyclerView
@ -80,7 +84,6 @@ class AnotherOrderActivity : BaseActivity() {
mutableListOf<SendTableDataDTO>())
override fun getLayout() = R.layout.activity_anohter_order
override fun initView(savedInstanceState: Bundle?) {
@ -176,7 +179,8 @@ class AnotherOrderActivity : BaseActivity() {
updatePosGoodsDis = position1
val `in` = Intent(this, GoodsDischargeActivity::class.java)
`in`.putExtra("goodData", gson.toJson(oib))
`in`.putExtra("choiceData", gson.toJson(oib.putTableData.get(0).goods.get(position1)))
`in`.putExtra("choiceData",
gson.toJson(oib.putTableData.get(0).goods.get(position1)))
startActivity(`in`)
}
tvDel.setOnClickListener { v22: View? ->
@ -316,7 +320,9 @@ class AnotherOrderActivity : BaseActivity() {
{
ryPretend.delItemV(position1)
oib.putTableData.get(0).goods = oib.putTableData.get(0).getGoods().filter { it.name!= osg1.name }
oib.putTableData.get(0).goods =
oib.putTableData.get(0).getGoods()
.filter { it.name != osg1.name }
ryDis.delAllDatas()
ryDis.notifyDatas(oib.putTableData.get(0).goods)
// ryDis.notifyDatas(oib.putTableData.get(0).goods)
@ -463,6 +469,7 @@ class AnotherOrderActivity : BaseActivity() {
//分配车辆
etCar.setOnClickListener { V: View? ->
etMoney.clearFocus()
val intent = Intent(this, DisCarActivity::class.java)
intent.putExtra(AppConfig.STRING, etCar.text.toString())
startActivity(intent)
@ -482,11 +489,45 @@ class AnotherOrderActivity : BaseActivity() {
}
}
}
if (etMoney.text.toString().isEmpty()){
if (!TimeUtil.compareDate(tvStartTime.text.toString(),
TimeUtil.getNowString(SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault())),
SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault()))
) {
showToast("装货截止时间不能小于当前时间")
return@setOnClickListener
}
if (!TimeUtil.compareDate(tvEndTimeDis.text.toString(),
TimeUtil.getNowString(SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault())),
SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault()))
) {
showToast("卸货截止时间不能小于当前时间")
return@setOnClickListener
}
if (!TimeUtil.compareDate(effectiveTime.text.toString(),
TimeUtil.getNowString(SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault())),
SimpleDateFormat("yyyy-MM-dd HH:mm",
Locale.getDefault()))
) {
showToast("订单有效期不能小于当前时间")
return@setOnClickListener
}
if (etMoney.text.toString().isEmpty()) {
showToast("请输入运费信息")
return@setOnClickListener
}
if (oib.sendTableData[0].goods.size>0 &&oib.putTableData[0].goods.size>0 && !TextUtils.isEmpty(
if (oib.sendTableData[0].goods.size > 0 && oib.putTableData[0].goods.size > 0 && !TextUtils.isEmpty(
oib.formData.shipperCarId)
) {
XPopup.Builder(this)
@ -496,16 +537,21 @@ class AnotherOrderActivity : BaseActivity() {
{
oib.isSubmit = 1
oib.formData.isSubmit = 1
oib.sendTableData[0].totalPrice = etMoney.text.toString().toDouble()
oib.sendTableData[0].totalPrice =
etMoney.text.toString().toDouble()
Log.e("货源信息", Gson().toJson(oib))
DataManager.getInstance().againOrder(oib)
.compose(DataManager.setThread())
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<Any>(){
override fun onSuccess(t: CommonResponseBean<Any>?) {
super.onSuccess(t)
showToast("订单创建成功")
}
}))
.subscribe(BaseObserver(mContext,
object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<Any>?) {
super.onSuccess(t)
showToast("订单创建成功")
EventBus.getDefault().post(RefreshEvent("",
intent.extras!!.getInt("type")))
finish()
}
}))
}, null, false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局

View File

@ -30,19 +30,19 @@ public class BottomTabUtil {
fm = act.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
//ft.replace(R.id.body,f);
ft.add(layout,f,"").commit();
ft.add(layout,f,"").commitAllowingStateLoss();
}
public void setDefaultFragment(Fragment f) {
fm =act.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.hide(fs[index]);
ft.show(f);
ft.commit();
ft.commitAllowingStateLoss();
}
public void hide(Fragment f) {
fm =act.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.hide(f);
ft.commit();
ft.commitAllowingStateLoss();
}
}

View File

@ -42,35 +42,37 @@
<androidx.cardview.widget.CardView
android:id="@+id/add_address"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_24"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_44"
app:cardCornerRadius="@dimen/dp_29"
app:cardBackgroundColor="@color/color_theme"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/dp_20">
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_24"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
app:cardBackgroundColor="@color/color_theme"
app:cardCornerRadius="@dimen/dp_29">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_44"
android:orientation="horizontal"
android:layout_gravity="center">
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/type_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="添加常用地址"
android:textColor="#ffffffff"
android:textSize="@dimen/sp_16"
android:layout_gravity="center"
/>
android:textSize="@dimen/sp_16" />
<ImageView
android:layout_marginLeft="@dimen/dp_6"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_gravity="center"
android:src="@mipmap/add"/>
android:layout_marginLeft="@dimen/dp_6"
android:src="@mipmap/add" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -38,7 +38,7 @@
android:paddingLeft="@dimen/dp_12"
android:paddingRight="@dimen/dp_12"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_12"
android:elevation="@dimen/dp_1">
@ -374,6 +374,7 @@
</LinearLayout>
</RelativeLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#8AA5E1"
@ -404,13 +405,9 @@
android:layout_centerVertical="true"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#8AA5E1"
android:alpha="0.5"
android:visibility="gone"/>
<EditText
android:visibility="gone"
android:id="@+id/requirement"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#fff">
<FrameLayout
@ -13,125 +12,123 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:paddingBottom="@dimen/dp_4"
android:background="#DEEAF5">
android:background="#DEEAF5"
android:orientation="horizontal"
android:paddingBottom="@dimen/dp_4">
<LinearLayout
android:paddingTop="@dimen/dp_12"
android:id="@+id/huoyuan_box"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/dp_12">
<ImageView
android:id="@+id/huoyuan"
android:layout_width="@dimen/dp_36"
android:layout_height="@dimen/dp_36"
android:src="@mipmap/tab1_s"
android:scaleType="fitXY"
android:background="@null"
android:layout_gravity="center"
/>
android:background="@null"
android:scaleType="fitXY"
android:src="@mipmap/tab1_s" />
<TextView
android:id="@+id/title1"
android:layout_marginTop="@dimen/dp_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_4"
android:text="首页"
android:textColor="@color/color_theme"
android:textSize="@dimen/sp_12"
android:layout_gravity="center"
/>
android:textSize="@dimen/sp_12" />
</LinearLayout>
<LinearLayout
android:paddingTop="@dimen/dp_12"
android:id="@+id/wallet_box"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/dp_12">
<ImageView
android:id="@+id/wallet"
android:layout_width="@dimen/dp_36"
android:layout_height="@dimen/dp_36"
android:src="@mipmap/tab2"
android:scaleType="fitXY"
android:background="@null"
android:layout_gravity="center"
/>
android:background="@null"
android:scaleType="fitXY"
android:src="@mipmap/tab2" />
<TextView
android:id="@+id/title2"
android:layout_marginTop="@dimen/dp_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_4"
android:text="钱包"
android:textColor="#ffc9c9c9"
android:textSize="@dimen/sp_12"
android:layout_gravity="center"
/>
android:textSize="@dimen/sp_12" />
</LinearLayout>
<LinearLayout
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:id="@+id/news_box"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="@dimen/dp_12"
>
<ImageView
android:id="@+id/news"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:src="@mipmap/xiaoxi0"
android:scaleType="fitXY"
android:background="@null"
android:layout_width="@dimen/dp_36"
android:layout_height="@dimen/dp_36"
android:layout_gravity="center"
/>
android:background="@null"
android:scaleType="fitXY"
android:src="@mipmap/waybill" />
<TextView
android:id="@+id/title3"
android:layout_marginTop="@dimen/dp_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_4"
android:text="运单"
android:textColor="#ffc9c9c9"
android:textSize="@dimen/sp_12"
android:layout_gravity="center"
/>
android:textSize="@dimen/sp_12" />
</LinearLayout>
<LinearLayout
android:paddingTop="@dimen/dp_12"
android:id="@+id/my_box"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/dp_12">
<ImageView
android:id="@+id/my"
android:layout_width="@dimen/dp_36"
android:layout_height="@dimen/dp_36"
android:src="@mipmap/tab3"
android:scaleType="fitXY"
android:background="@null"
android:layout_gravity="center"
/>
android:background="@null"
android:scaleType="fitXY"
android:src="@mipmap/tab3" />
<TextView
android:id="@+id/title4"
android:layout_marginTop="@dimen/dp_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_4"
android:text="我的"
android:textColor="#ffc9c9c9"
android:textSize="@dimen/sp_12"
android:layout_gravity="center"
/>
android:textSize="@dimen/sp_12" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -37,7 +37,7 @@
android:layout_marginBottom="@dimen/dp_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_18"
android:textSize="@dimen/sp_16"
android:text="右边"
android:textColor="#fff"
android:layout_alignParentRight="true"

View File

@ -25,6 +25,8 @@
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/dp_76"
/>
</LinearLayout>

View File

@ -417,6 +417,7 @@
android:alpha="0.5"
android:visibility="gone"/>
<EditText
android:visibility="gone"
android:id="@+id/requirement"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"

View File

@ -59,6 +59,7 @@
android:layout_marginRight="@dimen/dp_10">
<ImageButton
android:visibility="gone"
android:id="@+id/xuan"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
@ -198,32 +199,41 @@
android:orientation="horizontal">
<Button
android:layout_weight="1"
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_36"
android:layout_weight="1"
android:background="@null"
android:elevation="@dimen/dp_3"
android:gravity="center"
android:text="撤销"
android:textColor="#ffd95959"
android:textSize="@dimen/sp_16" />
<View
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_36"
android:background="#EFEFEF" />
<Button
android:layout_weight="1"
android:id="@+id/btnAgain"
<LinearLayout
android:id="@+id/llAgain"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_36"
android:background="@null"
android:elevation="@dimen/dp_3"
android:gravity="center"
android:text="再来一单"
android:textColor="#4CAF50"
android:textSize="@dimen/sp_16" />
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_36"
android:background="#EFEFEF" />
<Button
android:id="@+id/btnAgain"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_36"
android:background="@null"
android:elevation="@dimen/dp_3"
android:gravity="center"
android:text="再来一单"
android:textColor="#4CAF50"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB