订单列表
This commit is contained in:
parent
c471f447ea
commit
9a484b48fe
@ -51,6 +51,7 @@ public class PathConfig {
|
||||
public static final String NEWS_CULTIVATE_ID = "d9d8c7ea-32e0-43ed-ad17-7c99a3c389b9";//在线培训
|
||||
public static final String NEWS_BOOKS_ID = "98c74389-2088-499b-a046-8611bdc57ea4";//数图资源
|
||||
public static final String NEWS_TOUR_ID = "51ae7beb-f277-47a4-937a-088e6d47656d";//文化旅游
|
||||
public static final String ORDER_CANCEL_ID = "bf2d6bb5-4562-4ace-827e-378e41571576";//订单取消原因
|
||||
|
||||
|
||||
public static final String PLACE_TYPE_ID = "df8b758c-f6d8-465a-9aa8-c451fde47076";//场馆类型字典
|
||||
|
@ -22,6 +22,15 @@ public class BaseDictionaryBean implements IPickerViewData {
|
||||
private String dataSummary;
|
||||
private boolean parent;
|
||||
private List<?> subData;
|
||||
private boolean isCheck;
|
||||
|
||||
public boolean isCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setCheck(boolean check) {
|
||||
isCheck = check;
|
||||
}
|
||||
|
||||
public String getDataCode() {
|
||||
return dataCode;
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.base;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
|
||||
public class DicHolder extends RecyclerView.ViewHolder {
|
||||
public CheckBox mCb;
|
||||
public TypeFaceTextView mTvName;
|
||||
|
||||
public DicHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mCb = itemView.findViewById(R.id.cb_check);
|
||||
mTvName = itemView.findViewById(R.id.tv_name);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 作者 : Adam on 2018/11/14.
|
||||
* 邮箱 : itgaojian@163.com
|
||||
* 描述 : <功能描述>
|
||||
*/
|
||||
public class DicSelAdapter extends BaseRecyclerAdapter<BaseDictionaryBean, DicHolder> {
|
||||
public DicSelAdapter(Context ctx, List<BaseDictionaryBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DicHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(mContext)
|
||||
.inflate(R.layout.item_show_photo, parent, false);
|
||||
return new DicHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(DicHolder h, int i) {
|
||||
BaseDictionaryBean bean = mData.get(i);
|
||||
h.mCb.setChecked(bean.isCheck());
|
||||
h.mTvName.setText(bean.getDataName());
|
||||
}
|
||||
|
||||
public interface OnItemClick {
|
||||
void clickListener(List<String> data, int pos);
|
||||
}
|
||||
|
||||
private OnItemClick listener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClick listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,239 @@
|
||||
package com.sucstepsoft.cm_utils.core.widget.views;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.R;
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.DicSelAdapter;
|
||||
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 作者 : Adam on 2018/7/23.
|
||||
* 邮箱 : itgaojian@163.com
|
||||
* 描述 : 取消订单
|
||||
*/
|
||||
public class BottomCancelOrderDialog extends Dialog {
|
||||
private static final int SUCCESS = 1234;
|
||||
private static final int ERROR = 2234;
|
||||
private static final int EMPTY = 3234;
|
||||
private static final int LOADING = 4234;
|
||||
ImageView mIvUserIcon;
|
||||
TextView mTvName;
|
||||
ImageView mIvLike;
|
||||
TextView mTvLikeNum;
|
||||
LinearLayout mLlLike;
|
||||
TextView mTvContent;
|
||||
ImageView mIvContent;
|
||||
TextView mTvTime;
|
||||
TextView mTvRestore;
|
||||
private boolean iscancelable;
|
||||
private boolean isBackCancelable;
|
||||
private Context context;
|
||||
private int gravity;
|
||||
private ButtomDialogCommentView mItemCommentDialog;
|
||||
private View view;
|
||||
private List<BaseDictionaryBean> list;
|
||||
|
||||
private BottomCancelOrderDialog(Context context, boolean isCancelable, boolean isBackCancelable, int gravity, List<BaseDictionaryBean> list) {
|
||||
super(context, R.style.dialog_full_screen);
|
||||
this.context = context;
|
||||
this.gravity = gravity;
|
||||
this.iscancelable = isCancelable;
|
||||
this.isBackCancelable = isBackCancelable;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
view = LayoutInflater.from(context).inflate(R.layout.layout_bottom_reason, null);
|
||||
TypeFaceTextView tvConfirm = view.findViewById(R.id.tv_publish);
|
||||
TypeFaceTextView tvCancel = view.findViewById(R.id.tv_cancel);
|
||||
EditText etRemark = view.findViewById(R.id.et_remark);
|
||||
RecyclerView rlvReason = view.findViewById(R.id.rlv_reason);
|
||||
rlvReason.setLayoutManager(new LinearLayoutManager(context));
|
||||
DicSelAdapter adapter = new DicSelAdapter(context, list);
|
||||
rlvReason.setAdapter(adapter);
|
||||
adapter.addOnItemClickListener(baseDictionaryBean -> {
|
||||
baseDictionaryBean.setCheck(!baseDictionaryBean.isCheck());
|
||||
adapter.setData(list);
|
||||
});
|
||||
tvCancel.setOnClickListener(v -> this.dismiss());
|
||||
tvConfirm.setOnClickListener(v -> {
|
||||
boolean flag = false;
|
||||
String reason = "";
|
||||
List<BaseDictionaryBean> data = adapter.getData();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
BaseDictionaryBean bean = data.get(i);
|
||||
if (bean.isCheck()) {
|
||||
reason = bean.getDataId();
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
mMoreDataListener.loadMoreData(reason, etRemark.getText().toString().trim());
|
||||
} else {
|
||||
ToastUtils.show("请选择原因");
|
||||
}
|
||||
|
||||
});
|
||||
setContentView(view);
|
||||
setDialogParams();
|
||||
}
|
||||
|
||||
public void hideSoftKeyboard() {
|
||||
hideSoftKeyboard(getCurrentFocus());
|
||||
}
|
||||
|
||||
public void hideSoftKeyboard(View view) {
|
||||
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (view != null) {
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setDialogParams() {
|
||||
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
windowManager.getDefaultDisplay().getMetrics(dm);
|
||||
int height = dm.heightPixels;
|
||||
setCancelable(iscancelable);
|
||||
setCanceledOnTouchOutside(isBackCancelable);
|
||||
Window window = this.getWindow();
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setWindowAnimations(R.style.Dialog_ChoseFile);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
// params.height = (int) (height * 0.7);
|
||||
window.setAttributes(params);
|
||||
window.setBackgroundDrawable(new ColorDrawable());
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
private void showSoftKeyBoardDialog(EditText editText) {
|
||||
if (editText != null) {
|
||||
editText.setFocusable(true);
|
||||
editText.setFocusableInTouchMode(true);
|
||||
//请求获得焦点
|
||||
editText.requestFocus();
|
||||
//调用系统输入法
|
||||
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
inputManager.showSoftInput(editText, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface OnChoseListener {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private LoadMoreDataListener mMoreDataListener;
|
||||
|
||||
public void addLoadMoreDataListener(LoadMoreDataListener listener) {
|
||||
mMoreDataListener = listener;
|
||||
}
|
||||
|
||||
public interface LoadMoreDataListener {
|
||||
void loadMoreData(String reason, String remark);
|
||||
}
|
||||
|
||||
public static class DialogBuilder {
|
||||
private Context mContext;
|
||||
private boolean isCancelable;
|
||||
private boolean mIsBackable;
|
||||
private int mGravity = Gravity.BOTTOM;
|
||||
private OnChoseListener mListener;
|
||||
private boolean mIsShowOther;
|
||||
private String pId;
|
||||
private String nId;
|
||||
private String newsId;
|
||||
private String isShowImg;
|
||||
|
||||
private List<BaseDictionaryBean> list;
|
||||
|
||||
public DialogBuilder(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public DialogBuilder setIscancelable(boolean iscancelable) {
|
||||
this.isCancelable = iscancelable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setIsBackCancelable(boolean isBackCancelable) {
|
||||
this.mIsBackable = isBackCancelable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setShowLocation(int gravity) {
|
||||
this.mGravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean mIsShow;
|
||||
|
||||
public DialogBuilder setIsShowFile(boolean isShowFile) {
|
||||
mIsShow = isShowFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setIsShowOther(boolean isShow) {
|
||||
mIsShowOther = isShow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setCommentId(String pId, String nId, String newsId) {
|
||||
this.pId = pId;
|
||||
this.nId = nId;
|
||||
this.newsId = newsId;
|
||||
return this;
|
||||
}
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
public DialogBuilder setActivity(Activity activity) {
|
||||
this.mActivity = activity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setIsShowImg(String isShowImg) {
|
||||
this.isShowImg = isShowImg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DialogBuilder setList(List<BaseDictionaryBean> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BottomCancelOrderDialog build() {
|
||||
return new BottomCancelOrderDialog(this.mContext, this.isCancelable, this.mIsBackable, this.mGravity, this.list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
23
cm_utils/src/main/res/layout/item_dic_check.xml
Normal file
23
cm_utils/src/main/res/layout/item_dic_check.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_check"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:button="@drawable/sel_radio_checkbox"
|
||||
android:enabled="false"
|
||||
tools:checked="true" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
tools:text="问问吾问无为谓" />
|
||||
</LinearLayout>
|
86
cm_utils/src/main/res/layout/layout_bottom_reason.xml
Executable file
86
cm_utils/src/main/res/layout/layout_bottom_reason.xml
Executable file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shp_rectangle_white"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_publish"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:text="确定"
|
||||
android:textColor="#9F1512"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:text="取消"
|
||||
android:textSize="16sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rectangle_gray_5">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="原因" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_reason"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="备注"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_remark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="left"
|
||||
android:hint="备注"
|
||||
android:lines="3"
|
||||
android:minLines="3"
|
||||
android:padding="5dp"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -3,6 +3,13 @@
|
||||
package="com.tenlionsoft.moduleshop">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".activitys.OrderListActivity"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activitys.ShopAddAddressActivity"
|
||||
android:exported="false">
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.tenlionsoft.moduleshop.activitys;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@ -18,10 +20,14 @@ import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
import com.sucstepsoft.cm_utils.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.cm_utils.utils.LogUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.R2;
|
||||
import com.tenlionsoft.moduleshop.adapter.OrderConfirmGoodsAdapter;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderSuccessBean;
|
||||
import com.tenlionsoft.moduleshop.beans.SaveOrderBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShippingAddressBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopGoodsDetailBean;
|
||||
import com.tenlionsoft.moduleshop.net.ShopApi;
|
||||
@ -36,6 +42,8 @@ import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 结算页面
|
||||
@ -56,6 +64,8 @@ public class OrderConfirmActivity extends BaseActivity {
|
||||
TypeFaceTextView mTvConfirm;
|
||||
@BindView(R2.id.ll_choose_address)
|
||||
LinearLayout mLlChooseAddress;
|
||||
@BindView(R2.id.et_words)
|
||||
EditText mEtWords;
|
||||
private List<ShopGoodsDetailBean> mCarDatas = new ArrayList<>();
|
||||
private List<ShopGoodsDetailBean> mDatas = new ArrayList<>();
|
||||
private OrderConfirmGoodsAdapter mAdapter;
|
||||
@ -77,10 +87,12 @@ public class OrderConfirmActivity extends BaseActivity {
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_ADDRESS)
|
||||
.withInt("type", 1)//选择地址
|
||||
.navigation(mActivity, 13));
|
||||
mTvConfirm.setOnClickListener(v -> doSaveOrder());
|
||||
getDefaultAddress();
|
||||
parserShopCar();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
*/
|
||||
@ -176,4 +188,76 @@ public class OrderConfirmActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建参数
|
||||
*/
|
||||
private RequestBody buildParams() {
|
||||
SaveOrderBean bean = new SaveOrderBean();
|
||||
bean.setShopAddressId(mAddressBean.getShopAddressId());
|
||||
String words = mEtWords.getText().toString().trim();
|
||||
bean.setWords(words);
|
||||
List<SaveOrderBean.GoodsItemListBean> listBeans = new ArrayList<>();
|
||||
for (int i = 0; i < mDatas.size(); i++) {
|
||||
ShopGoodsDetailBean goodsDetailBean = mDatas.get(i);
|
||||
SaveOrderBean.GoodsItemListBean b = new SaveOrderBean.GoodsItemListBean();
|
||||
b.setCount(goodsDetailBean.getCarAmount());
|
||||
b.setGoodsId(goodsDetailBean.getGoodsId());
|
||||
b.setGoodsItemId(goodsDetailBean.getGoodsStandarId());
|
||||
listBeans.add(b);
|
||||
}
|
||||
bean.setGoodsItemList(listBeans);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(bean);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
return body;
|
||||
}
|
||||
|
||||
private void doSaveOrder() {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "提交中...");
|
||||
dialog.show();
|
||||
RequestBody body = buildParams();
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.doSaveOrder(body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<OrderSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(OrderSuccessBean successBean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("下单成功");
|
||||
mCarDatas.removeAll(mDatas);
|
||||
toSaveLocalData();
|
||||
ARouter.getInstance()
|
||||
.build(PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_MINE_ORDER)
|
||||
.withInt("type", 2)
|
||||
.navigation();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void toSaveLocalData() {
|
||||
Gson gson = new Gson();
|
||||
String s = gson.toJson(mCarDatas);
|
||||
UserLgUtils.setShopCar(s);
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.tenlionsoft.moduleshop.activitys;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseActivity;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.R2;
|
||||
import com.tenlionsoft.moduleshop.fragments.OrderFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
/**
|
||||
* 我的订单
|
||||
*/
|
||||
@Route(path = PathConfig.PATH_MODULE_SHOP_ACTIVITY_SHOP_MINE_ORDER)
|
||||
public class OrderListActivity extends BaseActivity {
|
||||
|
||||
|
||||
@BindView(R2.id.xtl_new_type)
|
||||
TabLayout mXTabLayout;
|
||||
@BindView(R2.id.vp_new_content)
|
||||
ViewPager2 mVpContent;
|
||||
private List<Fragment> mFragments;
|
||||
private Unbinder mBind;
|
||||
private Disposable mDisposable;
|
||||
private String mId;
|
||||
private String mTitle;
|
||||
private String[] tabs = new String[]{"全部", "待付款", "待收货", "已完成", "已取消"};
|
||||
private String[] types = new String[]{"all", "0", "2", "4", ""};
|
||||
private int mType;
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
return R.layout.activity_order_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
mBind = ButterKnife.bind(this);
|
||||
mTvBaseTitle.setText("我的订单");
|
||||
refreshView(STATE_LOAD_SUCCESS);
|
||||
mType = getIntent().getIntExtra("type", -1);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mFragments = new ArrayList<>();
|
||||
for (int i = 0; i < tabs.length; i++) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("type", types[i]);
|
||||
if ("已取消".equals(tabs[i])) {
|
||||
bundle.putString("isCancel", "1");
|
||||
} else {
|
||||
bundle.putString("isCancel", "0");
|
||||
}
|
||||
OrderFragment fragment = new OrderFragment();
|
||||
fragment.setArguments(bundle);
|
||||
mFragments.add(fragment);
|
||||
View view = View.inflate(mActivity, R.layout.item_tab_custom_view, null);
|
||||
TypeFaceTextView textView = view.findViewById(R.id.tv_tab_title);
|
||||
textView.setText(tabs[i]);
|
||||
mXTabLayout.addTab(mXTabLayout.newTab().setCustomView(view));
|
||||
}
|
||||
|
||||
mXTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
View tabView = tab.getCustomView();
|
||||
tabView.findViewById(R.id.iv_right).setVisibility(View.VISIBLE);
|
||||
tabView.findViewById(R.id.iv_Left).setVisibility(View.VISIBLE);
|
||||
TextView tvTab = tabView.findViewById(R.id.tv_tab_title);
|
||||
tvTab.setTextColor(Color.RED);
|
||||
mVpContent.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
View tabView = tab.getCustomView();
|
||||
tabView.findViewById(R.id.iv_right).setVisibility(View.INVISIBLE);
|
||||
tabView.findViewById(R.id.iv_Left).setVisibility(View.INVISIBLE);
|
||||
TextView tvTab = tabView.findViewById(R.id.tv_tab_title);
|
||||
tvTab.setTextColor(Color.GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
mXTabLayout.setTabIndicatorFullWidth(false);
|
||||
View customView = mXTabLayout.getTabAt(0).getCustomView();
|
||||
customView.findViewById(R.id.iv_right).setVisibility(View.VISIBLE);
|
||||
customView.findViewById(R.id.iv_Left).setVisibility(View.VISIBLE);
|
||||
TextView tvTab = customView.findViewById(R.id.tv_tab_title);
|
||||
tvTab.setTextColor(Color.RED);
|
||||
MyFragmentPageAdapter adapter = new MyFragmentPageAdapter(OrderListActivity.this);
|
||||
mVpContent.setAdapter(adapter);
|
||||
mVpContent.setCurrentItem(0);
|
||||
mVpContent.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
mXTabLayout.selectTab(mXTabLayout.getTabAt(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
super.onPageScrollStateChanged(state);
|
||||
}
|
||||
});
|
||||
if (mType == 2) {
|
||||
mVpContent.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class MyFragmentPageAdapter extends FragmentStateAdapter {
|
||||
|
||||
|
||||
public MyFragmentPageAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||
super(fragmentActivity);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return mFragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mDisposable != null && !mDisposable.isDisposed()) {
|
||||
mDisposable.dispose();
|
||||
}
|
||||
if (mBind != null) {
|
||||
mBind.unbind();
|
||||
}
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.tenlionsoft.moduleshop.activitys;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
@ -89,9 +90,60 @@ public class ShippingAddressActivity extends BaseActivity {
|
||||
.withSerializable("bean", mCurrentBean)
|
||||
.withInt("type", 3)
|
||||
.navigation(mActivity, 12));
|
||||
mAdapter.addOnDelListener((b, i) -> new AlertDialog.Builder(mActivity)
|
||||
.setTitle("警告")
|
||||
.setMessage("确定要删除该收货地址吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
doDelAddress(b);
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show());
|
||||
getAddressList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收货地址
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
private void doDelAddress(ShippingAddressBean b) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "删除中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.doDelShippingAddress(b.getShopAddressId(), UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseSuccessBean baseSuccessBean) {
|
||||
dialog.dismiss();
|
||||
ToastUtils.show("删除成功");
|
||||
mDatas.clear();
|
||||
getAddressList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@ package com.tenlionsoft.moduleshop.activitys;
|
||||
import android.app.ProgressDialog;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
@ -62,7 +63,9 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
EditText mEtZipCode;
|
||||
@BindView(R2.id.ll_confirm)
|
||||
LinearLayout mLlConfirm;
|
||||
private int mType;
|
||||
@BindView(R2.id.tv_address_edit)
|
||||
TypeFaceTextView mTvAddressEdit;
|
||||
|
||||
private ShippingAddressBean mBean;
|
||||
|
||||
private AreaBean mSelArea1;
|
||||
@ -78,6 +81,8 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
private OptionsPickerView<AreaBean> mArea3Picker;
|
||||
private OptionsPickerView<AreaBean> mArea4Picker;
|
||||
|
||||
private int mType;//判断是新增还是编辑 2新增 其他编辑
|
||||
|
||||
|
||||
@Override
|
||||
protected int setLayoutId() {
|
||||
@ -93,6 +98,7 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
if (2 == mType) {
|
||||
//新增
|
||||
mLlConfirm.setOnClickListener(v -> doSaveAddress());
|
||||
mTvAddressEdit.setVisibility(View.GONE);
|
||||
} else {
|
||||
//编辑
|
||||
mBean = (ShippingAddressBean) getIntent().getSerializableExtra("bean");
|
||||
@ -107,20 +113,22 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
|
||||
|
||||
private void setDetailBean() {
|
||||
String[] s = mBean.getAreaName().split(" ");
|
||||
mTvArea1.setText(s[0]);
|
||||
mTvArea2.setText(s[1]);
|
||||
mTvArea3.setText(s[2]);
|
||||
mTvArea4.setText(s[3]);
|
||||
mSelArea4 = new AreaBean();
|
||||
mSelArea4.setAreaId(mBean.getAreaId());
|
||||
mSelArea4.setAreaCode(mBean.getAreaCode());
|
||||
mSelArea4.setAreaName(mBean.getAreaName());
|
||||
// String[] s = mBean.getAreaName().split(" ");
|
||||
// mTvArea1.setText(s[0]);
|
||||
// mTvArea2.setText(s[1]);
|
||||
// mTvArea3.setText(s[2]);
|
||||
// mTvArea4.setText(s[3]);
|
||||
// mSelArea4 = new AreaBean();
|
||||
// mSelArea4.setAreaId(mBean.getAreaId());
|
||||
// mSelArea4.setAreaCode(mBean.getAreaCode());
|
||||
// mSelArea4.setAreaName(mBean.getAreaName());
|
||||
mEtName.setText(mBean.getShopAddressName());
|
||||
mEtPhone.setText(mBean.getShopAddressPhone());
|
||||
mEtZipCode.setText(mBean.getShopAddressZipcode());
|
||||
mEtDetail.setText(mBean.getShopAddressContent());
|
||||
getArea4Detail();
|
||||
mTvAddressEdit.setVisibility(View.VISIBLE);
|
||||
mTvAddressEdit.setText(mBean.getAreaName());
|
||||
// getArea4Detail();
|
||||
}
|
||||
|
||||
|
||||
@ -298,22 +306,45 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private boolean checkParams() {
|
||||
if (mSelArea1 == null) {
|
||||
ToastUtils.show("请选择省份");
|
||||
return false;
|
||||
}
|
||||
if (mType == 2) {
|
||||
if (mSelArea1 == null) {
|
||||
ToastUtils.show("请选择省份");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mSelArea2 == null) {
|
||||
ToastUtils.show("请选择市");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea3 == null) {
|
||||
ToastUtils.show("请选择区县");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea4 == null) {
|
||||
ToastUtils.show("请选择乡镇、街道");
|
||||
return false;
|
||||
if (mSelArea2 == null) {
|
||||
ToastUtils.show("请选择市");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea3 == null) {
|
||||
ToastUtils.show("请选择区县");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea4 == null) {
|
||||
ToastUtils.show("请选择乡镇、街道");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
//编辑
|
||||
if (mSelArea1 != null) {
|
||||
if (mSelArea1 == null) {
|
||||
ToastUtils.show("请选择省份");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mSelArea2 == null) {
|
||||
ToastUtils.show("请选择市");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea3 == null) {
|
||||
ToastUtils.show("请选择区县");
|
||||
return false;
|
||||
}
|
||||
if (mSelArea4 == null) {
|
||||
ToastUtils.show("请选择乡镇、街道");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
String detail = mEtDetail.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(detail)) {
|
||||
@ -337,17 +368,38 @@ public class ShopAddAddressActivity extends BaseActivity {
|
||||
|
||||
private RequestBody buildParams() {
|
||||
SaveAddressBean bean = new SaveAddressBean();
|
||||
bean.setAreaCode(mSelArea4.getAreaCode());
|
||||
bean.setAreaId(mSelArea4.getAreaId());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(mSelArea1.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea2.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea3.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea4.getAreaName());
|
||||
bean.setAreaName(sb.toString());
|
||||
if (mType != 2) {
|
||||
if (mSelArea1 != null) {
|
||||
bean.setAreaCode(mSelArea4.getAreaCode());
|
||||
bean.setAreaId(mSelArea4.getAreaId());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(mSelArea1.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea2.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea3.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea4.getAreaName());
|
||||
bean.setAreaName(sb.toString());
|
||||
} else {
|
||||
bean.setAreaName(mBean.getAreaName());
|
||||
bean.setAreaCode(mBean.getAreaCode());
|
||||
bean.setAreaId(mBean.getAreaId());
|
||||
}
|
||||
} else {
|
||||
bean.setAreaCode(mSelArea4.getAreaCode());
|
||||
bean.setAreaId(mSelArea4.getAreaId());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(mSelArea1.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea2.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea3.getAreaName());
|
||||
sb.append(" ");
|
||||
sb.append(mSelArea4.getAreaName());
|
||||
bean.setAreaName(sb.toString());
|
||||
}
|
||||
|
||||
String detail = mEtDetail.getText().toString().trim();
|
||||
String name = mEtName.getText().toString().trim();
|
||||
String phone = mEtPhone.getText().toString().trim();
|
||||
|
@ -40,6 +40,18 @@ public class ShippingAddressAdapter extends BaseRecyclerAdapter<ShippingAddressB
|
||||
}
|
||||
h.mIvEdit.setOnClickListener(v -> mEditListener.onEdit(b, i));
|
||||
h.mLlContent.setOnClickListener(v -> mItemSelectListener.onSelect(b, i));
|
||||
h.mIvDel.setOnClickListener(v -> mDelListener.onDel(b, i));
|
||||
}
|
||||
|
||||
|
||||
private OnDelListener mDelListener;
|
||||
|
||||
public void addOnDelListener(OnDelListener listener) {
|
||||
this.mDelListener = listener;
|
||||
}
|
||||
|
||||
public interface OnDelListener {
|
||||
void onDel(ShippingAddressBean b, int i);
|
||||
}
|
||||
|
||||
private OnEditListener mEditListener;
|
||||
|
@ -0,0 +1,80 @@
|
||||
package com.tenlionsoft.moduleshop.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderListBean;
|
||||
import com.tenlionsoft.moduleshop.holder.OrderHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
public class ShopOrderAdapter extends BaseRecyclerAdapter<OrderListBean.RowsBean, OrderHolder> {
|
||||
|
||||
public ShopOrderAdapter(Context ctx, List<OrderListBean.RowsBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_order, parent, false);
|
||||
return new OrderHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(OrderHolder h, int i) {
|
||||
OrderListBean.RowsBean bean = mData.get(i);
|
||||
h.mTvShopName.setText(bean.getShopName());
|
||||
h.mTvTime.setText("下单时间:" + bean.getOrderFinalTime());
|
||||
h.mTvStatus.setText(bean.getOrderStatusMsg());
|
||||
ShopOrderDetailAdapter adapter = new ShopOrderDetailAdapter(mContext, bean.getOrderDetailList());
|
||||
h.mRlvOrderDetail.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
h.mRlvOrderDetail.setAdapter(adapter);
|
||||
h.mTvPrice.setText("总计 ¥ " + bean.getAmountFinalTotalMoney());
|
||||
if (0 == bean.getIsCancel()) {
|
||||
//订单正常
|
||||
switch (bean.getOrderStatus()) {
|
||||
case 0://待付款
|
||||
h.mTvToPay.setVisibility(View.VISIBLE);
|
||||
h.mTvCancel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 1://待发货
|
||||
case 2://待收货
|
||||
h.mTvCancel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 3://售后
|
||||
h.mTvDel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case 4://完成
|
||||
h.mTvDel.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
h.mTvDel.setOnClickListener(v -> mControlListener.onDel(bean));
|
||||
h.mTvCancel.setOnClickListener(v -> mControlListener.onCancel(bean));
|
||||
h.mTvToPay.setOnClickListener(v -> mControlListener.onToPay(bean));
|
||||
}
|
||||
|
||||
private OnOrderControlListener mControlListener;
|
||||
|
||||
public void addOnOrderControlListener(OnOrderControlListener listener) {
|
||||
mControlListener = listener;
|
||||
}
|
||||
|
||||
public interface OnOrderControlListener {
|
||||
void onDel(OrderListBean.RowsBean b);
|
||||
|
||||
void onCancel(OrderListBean.RowsBean b);
|
||||
|
||||
void onToPay(OrderListBean.RowsBean b);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.tenlionsoft.moduleshop.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderListBean;
|
||||
import com.tenlionsoft.moduleshop.holder.OrderDetailHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
public class ShopOrderDetailAdapter extends BaseRecyclerAdapter<OrderListBean.RowsBean.OrderDetailListBean, OrderDetailHolder> {
|
||||
|
||||
public ShopOrderDetailAdapter(Context ctx, List<OrderListBean.RowsBean.OrderDetailListBean> list) {
|
||||
super(ctx, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDetailHolder createHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.item_order_detail, parent, false);
|
||||
return new OrderDetailHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindHolder(OrderDetailHolder h, int i) {
|
||||
OrderListBean.RowsBean.OrderDetailListBean b = mData.get(i);
|
||||
h.mTvName.setText(Html.fromHtml(b.getGoodsName()));
|
||||
Glide.with(mContext)
|
||||
.load(BaseUrlApi.BASE_SHOP_IMG_URL + b.getGoodsLogo())
|
||||
.apply(new RequestOptions()
|
||||
.placeholder(R.drawable.ic_img_default)
|
||||
.error(R.drawable.ic_img_default))
|
||||
.into(h.mIvIcon);
|
||||
h.mTvPrice.setText("¥ " + b.getGoodsItemPrice());
|
||||
h.mTvGoodsStanard.setText(b.getGoodsItemName());
|
||||
h.mTvCountPrice.setText("¥ " + b.getTotalPrice());
|
||||
h.mTvCount.setText("数量:" + b.getGoodsItemCount());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.tenlionsoft.moduleshop.beans;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OrderSuccessBean {
|
||||
private List<String> data;
|
||||
|
||||
public List<String> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<String> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.tenlionsoft.moduleshop.beans;
|
||||
|
||||
public class SaveCancelOrderBean {
|
||||
|
||||
private String cancelData;
|
||||
private String cancelRemark;
|
||||
|
||||
public String getCancelData() {
|
||||
return cancelData;
|
||||
}
|
||||
|
||||
public void setCancelData(String cancelData) {
|
||||
this.cancelData = cancelData;
|
||||
}
|
||||
|
||||
public String getCancelRemark() {
|
||||
return cancelRemark;
|
||||
}
|
||||
|
||||
public void setCancelRemark(String cancelRemark) {
|
||||
this.cancelRemark = cancelRemark;
|
||||
}
|
||||
}
|
@ -0,0 +1,336 @@
|
||||
package com.tenlionsoft.moduleshop.fragments;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ethanhua.skeleton.RecyclerViewSkeletonScreen;
|
||||
import com.ethanhua.skeleton.Skeleton;
|
||||
import com.google.gson.Gson;
|
||||
import com.sucstepsoft.cm_utils.constant.PathConfig;
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean;
|
||||
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
|
||||
import com.sucstepsoft.cm_utils.core.widget.base.BaseFragment;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.BottomCancelOrderDialog;
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.ItemSplitDivider;
|
||||
import com.sucstepsoft.cm_utils.utils.ExceptionHandler;
|
||||
import com.sucstepsoft.cm_utils.utils.UIUtil;
|
||||
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
|
||||
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
import com.tenlionsoft.moduleshop.R2;
|
||||
import com.tenlionsoft.moduleshop.adapter.ShopOrderAdapter;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderListBean;
|
||||
import com.tenlionsoft.moduleshop.beans.SaveCancelOrderBean;
|
||||
import com.tenlionsoft.moduleshop.net.ShopApi;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class OrderFragment extends BaseFragment {
|
||||
@BindView(R2.id.rlv_orders)
|
||||
RecyclerView mRlvOrders;
|
||||
|
||||
private String mType;//订单状态
|
||||
// private String[] tabs = new String[]{"全部", "待付款", "待收货", "已完成"};
|
||||
// private String[] types = new String[]{"", "0", "2", "4",""};
|
||||
private int mCurrentPage;
|
||||
private List<OrderListBean.RowsBean> mDatas;
|
||||
private ShopOrderAdapter mAdapter;
|
||||
private RecyclerViewSkeletonScreen mSkeletonScreen;
|
||||
private String mIsCancel = "0";
|
||||
|
||||
|
||||
@Override
|
||||
protected void setDataToView(View dataView) {
|
||||
ButterKnife.bind(this, dataView);
|
||||
setStateView(STATE_SUCCESS);
|
||||
mType = getArguments().getString("type");
|
||||
mIsCancel = getArguments().getString("isCancel");
|
||||
if ("all".equals(mType)) {
|
||||
mType = "";
|
||||
mIsCancel = "";
|
||||
}
|
||||
mCurrentPage = 1;
|
||||
mDatas = new ArrayList<>();
|
||||
mAdapter = new ShopOrderAdapter(mActivity, mDatas);
|
||||
mRlvOrders.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.VERTICAL, false));
|
||||
mRlvOrders.addItemDecoration(new ItemSplitDivider(mActivity, LinearLayoutManager.VERTICAL, 1, Color.parseColor("#F2F2F2")));
|
||||
mRlvOrders.setAdapter(mAdapter);
|
||||
mSkeletonScreen = Skeleton.bind(mRlvOrders)
|
||||
.adapter(mAdapter)
|
||||
.load(R.layout.item_skeleton_order)
|
||||
.show();
|
||||
|
||||
mRlvOrders.setFocusableInTouchMode(false);
|
||||
mRlvOrders.setFocusable(false);
|
||||
mRlvOrders.setHasFixedSize(true);
|
||||
mAdapter.addOnOrderControlListener(new ShopOrderAdapter.OnOrderControlListener() {
|
||||
@Override
|
||||
public void onDel(OrderListBean.RowsBean b) {
|
||||
doDelOrder(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(OrderListBean.RowsBean b) {
|
||||
doCancelOrder(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onToPay(OrderListBean.RowsBean b) {
|
||||
doPayOrder(b);
|
||||
}
|
||||
});
|
||||
getOrderList(mCurrentPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
private void doDelOrder(OrderListBean.RowsBean b) {
|
||||
new AlertDialog.Builder(mActivity)
|
||||
.setTitle("警告")
|
||||
.setMessage("确定要删除该订单吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
ProgressDialog dialog1 = UIUtil.initDialog(mActivity, "删除中...");
|
||||
dialog1.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.doDelOrder(b.getOrderId(), UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseSuccessBean baseSuccessBean) {
|
||||
dialog1.dismiss();
|
||||
ToastUtils.show("删除成功");
|
||||
refreshView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog1.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
private void doCancelOrder(OrderListBean.RowsBean b) {
|
||||
new AlertDialog.Builder(mActivity)
|
||||
.setTitle("警告")
|
||||
.setMessage("确定要取消该订单吗?")
|
||||
.setPositiveButton("确定", (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
getReasonList(b);
|
||||
})
|
||||
.setNegativeButton("取消", (dialog, which) -> dialog.dismiss())
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showCancelDialog(OrderListBean.RowsBean b, List<BaseDictionaryBean> list) {
|
||||
BottomCancelOrderDialog dialog = new BottomCancelOrderDialog.DialogBuilder(mActivity)
|
||||
.setList(list)
|
||||
.build();
|
||||
dialog.addLoadMoreDataListener(new BottomCancelOrderDialog.LoadMoreDataListener() {
|
||||
@Override
|
||||
public void loadMoreData(String reason, String remark) {
|
||||
dialog.dismiss();
|
||||
ProgressDialog d = UIUtil.initDialog(mActivity, "取消中...");
|
||||
d.show();
|
||||
SaveCancelOrderBean orderBean = new SaveCancelOrderBean();
|
||||
orderBean.setCancelData(reason);
|
||||
orderBean.setCancelRemark(remark);
|
||||
Gson gson = new Gson();
|
||||
String obj = gson.toJson(orderBean);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), obj);
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.doCancelOrder(b.getOrderId(), body, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseSuccessBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseSuccessBean baseSuccessBean) {
|
||||
d.dismiss();
|
||||
ToastUtils.show("取消成功");
|
||||
refreshView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
d.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void getReasonList(OrderListBean.RowsBean b) {
|
||||
ProgressDialog dialog = UIUtil.initDialog(mActivity, "加载中...");
|
||||
dialog.show();
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.getCancelData(PathConfig.ORDER_CANCEL_ID, UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<List<BaseDictionaryBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<BaseDictionaryBean> baseDictionaryBeans) {
|
||||
dialog.dismiss();
|
||||
if (baseDictionaryBeans.size() > 0) {
|
||||
showCancelDialog(b, baseDictionaryBeans);
|
||||
} else {
|
||||
ToastUtils.show("暂无数据");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
dialog.dismiss();
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
*/
|
||||
private void doPayOrder(OrderListBean.RowsBean b) {
|
||||
ToastUtils.show("暂时无法支付");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单
|
||||
*/
|
||||
private void getOrderList(int page) {
|
||||
RetrofitManager.getInstance()
|
||||
.create(ShopApi.class)
|
||||
.getMineShopOrderList(mType,
|
||||
mCurrentPage + "",
|
||||
mIsCancel,
|
||||
UserLgUtils.getToken())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<OrderListBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(OrderListBean orderListBean) {
|
||||
if (mSkeletonScreen != null) {
|
||||
mSkeletonScreen.hide();
|
||||
}
|
||||
if (page == 1) {
|
||||
if (orderListBean != null && orderListBean.getRows().size() > 0) {
|
||||
mDatas.addAll(orderListBean.getRows());
|
||||
mAdapter.setData(mDatas);
|
||||
setStateView(STATE_SUCCESS);
|
||||
} else {
|
||||
setStateView(STATE_EMPTY);
|
||||
}
|
||||
mSrlView.finishRefresh();
|
||||
} else {
|
||||
if (orderListBean != null && orderListBean.getRows().size() > 0) {
|
||||
mDatas.addAll(orderListBean.getRows());
|
||||
mAdapter.setData(mDatas);
|
||||
} else {
|
||||
mSrlView.setNoMoreData(true);
|
||||
}
|
||||
}
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
ExceptionHandler.handleException(e);
|
||||
e.printStackTrace();
|
||||
mSrlView.finishLoadMore();
|
||||
mSrlView.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void refreshView() {
|
||||
mCurrentPage = 1;
|
||||
mDatas.clear();
|
||||
getOrderList(mCurrentPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadMoreData() {
|
||||
++mCurrentPage;
|
||||
getOrderList(mCurrentPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentViewId() {
|
||||
return R.layout.fragment_order;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.tenlionsoft.moduleshop.holder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
public class OrderDetailHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView mIvIcon;
|
||||
public LinearLayout mLlItem;
|
||||
public TypeFaceTextView mTvName;
|
||||
public TypeFaceTextView mTvPrice;
|
||||
public TypeFaceTextView mTvGoodsStanard;
|
||||
public TypeFaceTextView mTvCount;
|
||||
public TypeFaceTextView mTvCountPrice;
|
||||
public ImageView mIvDel;
|
||||
|
||||
public OrderDetailHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mIvIcon = itemView.findViewById(R.id.iv_goods_icon);
|
||||
mLlItem = itemView.findViewById(R.id.ll_item);
|
||||
mTvName = itemView.findViewById(R.id.tv_goods_name);
|
||||
mTvPrice = itemView.findViewById(R.id.tv_goods_price);
|
||||
mTvGoodsStanard = itemView.findViewById(R.id.tv_goods_standard);
|
||||
mTvCount = itemView.findViewById(R.id.tv_count);
|
||||
mTvCountPrice = itemView.findViewById(R.id.tv_count_price);
|
||||
mIvDel = itemView.findViewById(R.id.iv_del);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.tenlionsoft.moduleshop.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
|
||||
import com.tenlionsoft.moduleshop.R;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
public class OrderHolder extends RecyclerView.ViewHolder {
|
||||
public TypeFaceTextView mTvShopName;
|
||||
public TypeFaceTextView mTvTime;
|
||||
public TypeFaceTextView mTvStatus;
|
||||
public RecyclerView mRlvOrderDetail;
|
||||
public TypeFaceTextView mTvPrice;
|
||||
public TypeFaceTextView mTvToPay;
|
||||
public TypeFaceTextView mTvCancel;
|
||||
public TypeFaceTextView mTvDel;
|
||||
|
||||
public OrderHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mTvShopName = itemView.findViewById(R.id.tv_shop_name);
|
||||
mTvTime = itemView.findViewById(R.id.tv_time);
|
||||
mTvStatus = itemView.findViewById(R.id.tv_status);
|
||||
mRlvOrderDetail = itemView.findViewById(R.id.rlv_order_detail);
|
||||
mTvPrice = itemView.findViewById(R.id.tv_count_price);
|
||||
mTvToPay = itemView.findViewById(R.id.tv_to_pay);
|
||||
mTvCancel = itemView.findViewById(R.id.tv_cancel_order);
|
||||
mTvDel = itemView.findViewById(R.id.tv_del_order);
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ public class ShippingAddressHolder extends RecyclerView.ViewHolder {
|
||||
public TypeFaceTextView mTvName;
|
||||
public ImageView mIvEdit;
|
||||
public LinearLayout mLlContent;
|
||||
public ImageView mIvDel;
|
||||
|
||||
public ShippingAddressHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -29,5 +30,6 @@ public class ShippingAddressHolder extends RecyclerView.ViewHolder {
|
||||
mIvEdit = itemView.findViewById(R.id.iv_edit);
|
||||
mLlContent = itemView.findViewById(R.id.ll_content);
|
||||
mTvName = itemView.findViewById(R.id.tv_name);
|
||||
mIvDel = itemView.findViewById(R.id.iv_del);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.tenlionsoft.moduleshop.net;
|
||||
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseDictionaryBean;
|
||||
import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean;
|
||||
import com.tenlionsoft.moduleshop.beans.GoodsListBean;
|
||||
import com.tenlionsoft.moduleshop.beans.GoodsStandardBean;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderListBean;
|
||||
import com.tenlionsoft.moduleshop.beans.OrderSuccessBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShippingAddressBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopGoodsDetailBean;
|
||||
import com.tenlionsoft.moduleshop.beans.ShopSortListBean;
|
||||
@ -12,6 +15,7 @@ import java.util.List;
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.DELETE;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
@ -76,7 +80,7 @@ public interface ShopApi {
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("app/order/savebycart")
|
||||
Observable<BaseSuccessBean> doSaveOrder(@Body RequestBody goods, @Header("token") String token);
|
||||
Observable<OrderSuccessBean> doSaveOrder(@Body RequestBody goods, @Header("token") String token);
|
||||
|
||||
/**
|
||||
* 新增收货地址
|
||||
@ -108,6 +112,12 @@ public interface ShopApi {
|
||||
@GET("app/shopaddress/getdefault")
|
||||
Observable<ShippingAddressBean> getDefaultAddress(@Header("token") String token);
|
||||
|
||||
/**
|
||||
* 删除收货地址
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@DELETE("app/shopaddress/remove/{ids}")
|
||||
Observable<BaseSuccessBean> doDelShippingAddress(@Path("ids") String id, @Header("token") String token);
|
||||
|
||||
/**
|
||||
* 收货地址列表
|
||||
@ -115,9 +125,40 @@ public interface ShopApi {
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@GET("app/shopaddress/list")
|
||||
Observable<List<ShippingAddressBean>> getShippingAddressList(@Header("token") String token);
|
||||
|
||||
/**
|
||||
* 我的订单
|
||||
* app/order/listpage
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@GET("app/order/listpage")
|
||||
Observable<OrderListBean> getMineShopOrderList(@Query("orderStatus") String status,
|
||||
@Query("page") String page,
|
||||
@Query("isCancel") String isCancel,
|
||||
@Header("token") String token);
|
||||
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@DELETE("app/order/delete/{orderId}")
|
||||
Observable<BaseSuccessBean> doDelOrder(@Path("orderId") String id, @Header("token") String token);
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@PUT("app/order/updatebuyersclose/{orderId}")
|
||||
Observable<BaseSuccessBean> doCancelOrder(@Path("orderId") String id,
|
||||
@Body RequestBody body,
|
||||
@Header("token") String token);
|
||||
|
||||
/**
|
||||
* 获取取消原因
|
||||
*/
|
||||
@Headers({"base_url_name:shop", "Content-Type:application/json", "Accept:application/json"})
|
||||
@GET("app/data/listbyparentid/{id}")
|
||||
Observable<List<BaseDictionaryBean>> getCancelData(@Path("id") String id,
|
||||
@Header("token") String token);
|
||||
|
||||
}
|
||||
|
@ -107,6 +107,29 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="留言" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_words"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:gravity="left"
|
||||
android:hint="请输入留言"
|
||||
android:minLines="4"
|
||||
android:padding="5dp"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
34
moduleshop/src/main/res/layout/activity_order_list.xml
Normal file
34
moduleshop/src/main/res/layout/activity_order_list.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/Theme.AppCompat">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_tab_bg"
|
||||
android:elevation="2dp">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/xtl_new_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@color/white"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="@color/app_title_9f_no"
|
||||
app:tabTextAppearance="@style/TabLayoutTextStyle"
|
||||
app:tabTextColor="@color/gray_text" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vp_new_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
@ -19,6 +19,13 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_address_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
tools:text="内蒙古 呼和浩特市 新城区" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
11
moduleshop/src/main/res/layout/fragment_order.xml
Normal file
11
moduleshop/src/main/res/layout/fragment_order.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_orders"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
139
moduleshop/src/main/res/layout/item_order.xml
Normal file
139
moduleshop/src/main/res/layout/item_order.xml
Normal file
@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_shop_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
tools:text="商店名称商店名称商店名称商店名称商店名称商店名称商店名称商店名称商店名称商店名称商店名称" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shp_status_gray"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
tools:text="订单状态" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rlv_order_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="14sp"
|
||||
tools:text="下单时间:2022-12-28 10:10:10" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_count_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
tools:text="总计" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_to_pay"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sel_btn_red_grad"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="去付款"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_cancel_order"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/sel_btn_red_grad"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="取消订单"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_del_order"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/sel_btn_red_grad"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="删除订单"
|
||||
android:textColor="@color/white"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
112
moduleshop/src/main/res/layout/item_order_detail.xml
Normal file
112
moduleshop/src/main/res/layout/item_order_detail.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_goods_icon"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:scaleType="fitXY"
|
||||
tools:src="@drawable/ic_img_default" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/iv_goods_icon"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
tools:text="Redmi Note 12 %G 120Hz OLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6GbOLED屏幕 晓龙4移动平台 5000mAh 长续航 6Gb" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_price"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="16sp"
|
||||
tools:text="¥1299" />
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_goods_standard"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/shp_sel_red_border"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="12sp"
|
||||
tools:text="¥1299" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/shp_rectangle_gray"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="12sp"
|
||||
tools:text="数量" />
|
||||
|
||||
|
||||
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
|
||||
android:id="@+id/tv_count_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textColor="@color/app_title_9f_no"
|
||||
android:textSize="12sp"
|
||||
tools:text="单价" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_del_tong"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -45,11 +45,24 @@
|
||||
tools:text="高 11111111" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_edit"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:padding="10dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_edit_icon" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_edit"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:padding="10dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_edit_icon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_del_tong" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
70
moduleshop/src/main/res/layout/item_skeleton_order.xml
Executable file
70
moduleshop/src/main/res/layout/item_skeleton_order.xml
Executable file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/gray_line"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/img_news"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@color/light_transparent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:background="@color/light_transparent"
|
||||
android:text="Google正式发布Android8.0"
|
||||
app:layout_constraintLeft_toRightOf="@+id/img_news"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/img_news" />
|
||||
|
||||
<!-- <View-->
|
||||
<!-- android:id="@+id/tv_time"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="12dp"-->
|
||||
<!-- android:layout_marginRight="50dp"-->
|
||||
<!-- android:background="@color/light_transparent"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@+id/img_news"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@+id/tv_title"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent" />-->
|
||||
|
||||
<View
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:background="@color/light_transparent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/img_news"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tv_title"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/img_news"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1px"
|
||||
android:background="@color/gray_line"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user