Commit 718af5b9 by wukun

1220

parent dbc16daf
...@@ -198,6 +198,10 @@ public class OrderApiFactory { ...@@ -198,6 +198,10 @@ public class OrderApiFactory {
return Api.getService(OrderService.class).getComment(targetId, page, pageSize).compose(Api.applySchedulers()); return Api.getService(OrderService.class).getComment(targetId, page, pageSize).compose(Api.applySchedulers());
} }
public static Observable<BasePageBean<CommentBean>> getCommentOrder(int targetId, int status, int targetType, int accountType, int page, int pageSize) {
return Api.getService(OrderService.class).getCommentOrder(targetId, page, pageSize).compose(Api.applySchedulers());
}
public static Observable<Boolean> addComment(CommentPostData data) { public static Observable<Boolean> addComment(CommentPostData data) {
return Api.getService(OrderService.class).addComment(data).compose(Api.applySchedulers()); return Api.getService(OrderService.class).addComment(data).compose(Api.applySchedulers());
} }
......
...@@ -453,15 +453,24 @@ public interface OrderService { ...@@ -453,15 +453,24 @@ public interface OrderService {
@Query("pageSize") int pageSize); @Query("pageSize") int pageSize);
/** /**
* 获取留言
*
* @return
*/
@GET(Constants.API_7400 + "/leaveMessage/order/engineer/orderId/{orderId}")
Observable<BaseResponse<BasePageBean<CommentBean>>> getCommentOrder(@Path("orderId") int orderId,
@Query("page") int page,
@Query("pageSize") int pageSize);
/**
* 留言 * 留言
*/ */
@POST(Constants.API_7400 + "/leaveMessage/spu/engineer") @POST(Constants.API_7400 + "/leaveMessage/order/engineer")
Observable<BaseResponse<Boolean>> addComment(@Body CommentPostData data); Observable<BaseResponse<Boolean>> addComment(@Body CommentPostData data);
/** /**
* 回复 * 回复
*/ */
@POST(Constants.API_7400 + "/leaveMessage/spu/engineer") @POST(Constants.API_7400 + "/leaveMessage/order/engineer")
Observable<BaseResponse<Boolean>> addCommentReply(@Body CommentReplyData data); Observable<BaseResponse<Boolean>> addCommentReply(@Body CommentReplyData data);
/** /**
......
...@@ -15,7 +15,11 @@ import com.chad.library.adapter.base.BaseQuickAdapter; ...@@ -15,7 +15,11 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.BaseViewHolder;
import com.dayu.base.api.APIService; import com.dayu.base.api.APIService;
import com.dayu.base.api.Api; import com.dayu.base.api.Api;
import com.dayu.base.api.protocol.CommentBean;
import com.dayu.base.api.protocol.CommentPostData;
import com.dayu.base.api.protocol.CommentReplyData;
import com.dayu.base.ui.activity.ImgGalleryActivty; import com.dayu.base.ui.activity.ImgGalleryActivty;
import com.dayu.base.ui.adapter.CommentAdapter;
import com.dayu.base.ui.adapter.CoreAdapter; import com.dayu.base.ui.adapter.CoreAdapter;
import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.base.ui.fragment.BaseFragment;
import com.dayu.base.ui.presenter.SImplePresenter; import com.dayu.base.ui.presenter.SImplePresenter;
...@@ -25,6 +29,7 @@ import com.dayu.location.base.LocationUtils; ...@@ -25,6 +29,7 @@ import com.dayu.location.base.LocationUtils;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory; import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.OrderService; import com.dayu.order.api.OrderService;
import com.dayu.order.api.protocol.OperateInfo;
import com.dayu.order.api.protocol.OrderDetail; import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.api.protocol.bean.GreenPersionSiteInfo; import com.dayu.order.api.protocol.bean.GreenPersionSiteInfo;
...@@ -41,6 +46,7 @@ import com.dayu.provider.event.TakeOrderSuccessEvent; ...@@ -41,6 +46,7 @@ import com.dayu.provider.event.TakeOrderSuccessEvent;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.utils.CommonUtils; import com.dayu.utils.CommonUtils;
import com.dayu.utils.GlideImageLoader; import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.ProgressUtil;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
...@@ -70,6 +76,12 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag ...@@ -70,6 +76,12 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
List<String> phones = new ArrayList<>(); List<String> phones = new ArrayList<>();
private ArrayList<String> phoneNum; private ArrayList<String> phoneNum;
private List<CommentBean> commentList = new ArrayList<>();
private int page = 1;
private int pageSize = 200;
private CommentAdapter mCommentAdapter;
private CommentBean selectedItem;
public static MultiOrderDetailFragment newInstance(OrderDetail detail, List<String> info) { public static MultiOrderDetailFragment newInstance(OrderDetail detail, List<String> info) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putSerializable(Constants.ORDER_DETAIL, detail); args.putSerializable(Constants.ORDER_DETAIL, detail);
...@@ -90,6 +102,7 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag ...@@ -90,6 +102,7 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
OrderDetail detail = (OrderDetail) getArguments().getSerializable(Constants.ORDER_DETAIL); OrderDetail detail = (OrderDetail) getArguments().getSerializable(Constants.ORDER_DETAIL);
phoneNum = getArguments().getStringArrayList(Constants.OPERATE_DETAIL_PHONE); phoneNum = getArguments().getStringArrayList(Constants.OPERATE_DETAIL_PHONE);
orderId = detail.getId(); orderId = detail.getId();
setListenter(); setListenter();
mBind.setItem(detail); mBind.setItem(detail);
...@@ -231,6 +244,87 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag ...@@ -231,6 +244,87 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
if (!TextUtils.isEmpty(detail.getTeamName())) { if (!TextUtils.isEmpty(detail.getTeamName())) {
mBind.teamName.setText("(" + detail.getTeamName() + "转派)"); mBind.teamName.setText("(" + detail.getTeamName() + "转派)");
} }
getCommentData();
mCommentAdapter = new CommentAdapter(false);
mCommentAdapter.setData(commentList);
mBind.rlComponent.setLayoutManager(new LinearLayoutManager(mActivity));
mBind.rlComponent.setAdapter(mCommentAdapter);
//发送
mBind.btnSend.setOnClickListener(v -> {
String content = mBind.edtComment.getText().toString();
if (TextUtils.isEmpty(content)) return;
ProgressUtil.startLoad(mActivity);
if (selectedItem != null) {
CommentReplyData commentReplyData = new CommentReplyData(mUserId, content, orderId, "");
commentReplyData.beMessageId = selectedItem.getId();
OrderApiFactory.addCommentReply(commentReplyData).subscribe(mPresenter.baseObserver(result -> {
if (result) {
selectedItem = null;
sendCommendSuccess();
}
}));
} else {
CommentPostData commentData = new CommentPostData(mUserId, content, orderId, "");
OrderApiFactory.addComment(commentData).subscribe(mPresenter.baseObserver(result -> {
if (result)
sendCommendSuccess();
}));
}
CommonUtils.hideSoftInput(mActivity, mBind.edtComment);
});
// mBind.btnComment.setOnClickListener(v -> {
// selectedItem = null;
// mBind.edtComment.setText("");
// mBind.edtComment.requestFocus();
// CommonUtils.ShowSoftInput(mActivity, mBind.edtComment);
// });
mCommentAdapter.setOnItemClickListener((item, bind) -> {
selectedItem = item;
mBind.edtComment.setText("");
mBind.edtComment.requestFocus();
CommonUtils.ShowSoftInput(mActivity, mBind.edtComment);
});
}
private void sendCommendSuccess() {
page = 1;
mBind.edtComment.setText("");
getCommentData();
}
private void getCommentData() {
ProgressUtil.startLoad(mActivity);
OrderApiFactory.getCommentOrder(orderId, 1, 3, 1, page, pageSize)
.subscribe(mPresenter.baseObserver(data -> {
// mBind.refreshLayout.finishRefresh();
// mBind.refreshLayout.finishLoadMore();
if (page == 1) {
commentList.clear();
// mBind.refreshLayout.setEnableLoadMore(data.getData().size() > 0);
}
// commentList = transData(data.getData());
commentList.addAll(data.getData());
mBind.tvComponent.setText("留言. " + data.getTotalRows());
mCommentAdapter.setData(commentList);
// mBind.refreshLayout.setEnableLoadMore(page < data.getTotalPages());
page += 1;
}, responeThrowable -> {
// mBind.refreshLayout.finishRefresh();
// mBind.refreshLayout.finishLoadMore();
}));
OrderApiFactory.getCommentOrder(orderId, 1, 3, 1, page, pageSize)
.subscribe(mPresenter.baseObserver(data -> {
}, responeThrowable -> {
}));
} }
//小绿人相关信息 //小绿人相关信息
......
...@@ -824,6 +824,63 @@ ...@@ -824,6 +824,63 @@
android:background="@color/white" /> android:background="@color/white" />
<TextView <TextView
android:id="@+id/tv_component"
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="@color/color_ee"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:text="沟通记录"
android:textColor="@color/cl_home_title_text_color"
android:textSize="14sp"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:background="@color/cl_white"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginRight="10dp" />
<EditText
android:id="@+id/edt_comment"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1"
android:background="#f5f5f5"
android:hint="@string/ask_detail"
android:padding="5dp"
android:paddingLeft="5dp"
android:singleLine="true"
android:textSize="13sp" />
<Button
android:id="@+id/btn_send"
android:layout_width="80dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="@color/cl_home_button"
android:gravity="center"
android:text="@string/send_str"
android:textColor="@color/cl_white"
android:textSize="13sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rl_component"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tv_contact_seller" android:id="@+id/tv_contact_seller"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="35dp" android:layout_height="35dp"
......
...@@ -128,8 +128,7 @@ ...@@ -128,8 +128,7 @@
android:text="留言" android:text="留言"
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold"/>
android:visibility="gone"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -137,8 +136,7 @@ ...@@ -137,8 +136,7 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_margin="10dp" android:layout_margin="10dp"
android:background="@color/cl_white" android:background="@color/cl_white"
android:orientation="horizontal" android:orientation="horizontal">
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/iv_avatar" android:id="@+id/iv_avatar"
...@@ -175,8 +173,7 @@ ...@@ -175,8 +173,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rl_component" android:id="@+id/rl_component"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:visibility="gone"/>
</LinearLayout> </LinearLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment