Commit f5d1dccc by mReturn

销售&搜索&评论

parent c846a5f6
Showing with 1218 additions and 105 deletions
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
android:value="599a41697f2c743210000990" /> android:value="599a41697f2c743210000990" />
<meta-data <meta-data
android:name="UMENG_CHANNEL" android:name="UMENG_CHANNEL"
android:value="Channel ID" /> android:value="dev" />
<!--android:value="Channel ID" />-->
<!-- 高德地图 --> <!-- 高德地图 -->
<meta-data <meta-data
......
...@@ -87,19 +87,20 @@ public class InitializeActivity extends DataBindingActivity<ActivityInitializeMa ...@@ -87,19 +87,20 @@ public class InitializeActivity extends DataBindingActivity<ActivityInitializeMa
} }
break; break;
case Constants.ENGINEER: case Constants.ENGINEER:
case Constants.MANAGER_ENGINEER:
Intent intent1 = new Intent(InitializeActivity.this, MainActivity.class); Intent intent1 = new Intent(InitializeActivity.this, MainActivity.class);
startActivity(intent1); startActivity(intent1);
break; break;
case Constants.MANAGER_ENGINEER: // case Constants.MANAGER_ENGINEER:
Intent intent2; // Intent intent2;
if (StationManager.getInstance().haveData()) { // if (StationManager.getInstance().haveData()) {
intent2 = new Intent(InitializeActivity.this, MainActivity.class); // intent2 = new Intent(InitializeActivity.this, MainActivity.class);
startActivity(intent2); // startActivity(intent2);
} else { // } else {
intent2 = new Intent(InitializeActivity.this, ServiceStationActivity.class); // intent2 = new Intent(InitializeActivity.this, ServiceStationActivity.class);
} // }
startActivity(intent2); // startActivity(intent2);
break; // break;
default: default:
break; break;
} }
......
...@@ -3,6 +3,7 @@ package com.dayu.utils; ...@@ -3,6 +3,7 @@ package com.dayu.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
...@@ -60,6 +61,7 @@ public class CommonUtils { ...@@ -60,6 +61,7 @@ public class CommonUtils {
Intent intent = new Intent(Intent.ACTION_DIAL); Intent intent = new Intent(Intent.ACTION_DIAL);
Uri data = Uri.parse("tel:" + phoneNum); Uri data = Uri.parse("tel:" + phoneNum);
intent.setData(data); intent.setData(data);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
} }
...@@ -111,4 +113,31 @@ public class CommonUtils { ...@@ -111,4 +113,31 @@ public class CommonUtils {
} }
} }
/**
* 获取订单状态描述
* @return
*/
public static String getOrderStauts(Context context,int state) {
// 1待付款2待商家确认3取消订单4待发货5待收货6已收货验收7退货申请8换货申请9退货待返货10换货待返货
// 11拒绝退货12拒绝换货13退货已返货14换货已返货15已退货16订单完成
String[] status = context.getResources().getStringArray(R.array.sale_order_status);
if (status.length>= state){
return status[state-1];
}else {
return "unkonwn";
}
}
/**
* 获取订单状态对应的颜色
* @return
*/
public static int getOrderStautsColor(Context context, int state) {
if (state>6 && state<16){
return context.getResources().getColor(R.color.common_red);
}else {
return context.getResources().getColor(R.color.text_common_blue);
}
}
} }
...@@ -860,6 +860,28 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸­äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ ...@@ -860,6 +860,28 @@ C) 在甲方使用大鱼平å°æœåŠ¡è¿‡ç¨‹ä¸­äº§ç”Ÿçš„业务数æ®ï¼Œå®¢æˆ·æ•°æ
<string name="sale_progress_str">进度</string> <string name="sale_progress_str">进度</string>
<string name="sale_record_str">详细记录</string> <string name="sale_record_str">详细记录</string>
<string name="income_money">收入金额</string> <string name="income_money">收入金额</string>
<string name="sale_order_state1">待确认</string>
<string name="sale_order_state2">待发货/交付</string>
<string name="sale_order_state3">待收货/退换</string>
<string name="sale_order_state4">已完成</string>
<array name="sale_order_status">
<item>待付款</item>
<item>待商家确认</item>
<item>取消订单</item>
<item>待发货</item>
<item>待收货</item>
<item>已收货验收</item>
<item>退货申请</item>
<item>换货申请</item>
<item>退货待返货</item>
<item>换货待返货</item>
<item>拒绝退货</item>
<item>拒绝换货</item>
<item>退货已返货</item>
<item>换货已返货</item>
<item>已退货</item>
<item>订单完成</item>
</array>
<!--sale--> <!--sale-->
<!--user--> <!--user-->
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</style> </style>
<style name="sale_item_text2" parent="sale_item_text"> <style name="sale_item_text2" parent="sale_item_text">
<item name="android:layout_marginLeft">@dimen/size_order_item_tooltext_ml</item> <item name="android:layout_marginLeft">3dp</item>
</style> </style>
<style name="sale_detail_text" parent="sale_item_text"> <style name="sale_detail_text" parent="sale_item_text">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<style name="sale_record_text" parent="sale_item_text"> <style name="sale_record_text" parent="sale_item_text">
<item name="android:layout_width">100dp</item> <item name="android:layout_width">100dp</item>
<item name="android:layout_marginRight">@dimen/dp_20</item> <item name="android:layout_marginRight">@dimen/dp_15</item>
</style> </style>
<style name="ll_user_edit"> <style name="ll_user_edit">
......
...@@ -177,8 +177,8 @@ public class OrderApiFactory { ...@@ -177,8 +177,8 @@ public class OrderApiFactory {
return Api.getService(OrderService.class).searchOrder(key, userAccount, status, page, pageSize).compose(Api.applySchedulers()); return Api.getService(OrderService.class).searchOrder(key, userAccount, status, page, pageSize).compose(Api.applySchedulers());
} }
public static Observable<BasePageBean<CommentBean>> getComment(int targetId, int status, int targetType, int page, int pageSize) { public static Observable<BasePageBean<CommentBean>> getComment(int targetId, int status, int targetType,int accountType, int page, int pageSize) {
return Api.getService(OrderService.class).getComment(targetId, status, targetType, page, pageSize).compose(Api.applySchedulers()); return Api.getService(OrderService.class).getComment(targetId, status, targetType,accountType, 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());
......
...@@ -407,6 +407,7 @@ interface OrderService { ...@@ -407,6 +407,7 @@ interface OrderService {
Observable<BaseResponse<BasePageBean<CommentBean>>> getComment(@Query("targetId") int targetId, Observable<BaseResponse<BasePageBean<CommentBean>>> getComment(@Query("targetId") int targetId,
@Query("status") int status, @Query("status") int status,
@Query("targetType") int targetType, @Query("targetType") int targetType,
@Query("accountType ") int accountType,
@Query("page") int page, @Query("page") int page,
@Query("pageSize") int pageSize); @Query("pageSize") int pageSize);
/** /**
......
...@@ -7,7 +7,7 @@ package com.dayu.order.api.protocol; ...@@ -7,7 +7,7 @@ package com.dayu.order.api.protocol;
public class CommentPostData { public class CommentPostData {
public int accountId; //留言人或回复人ID public int accountId; //留言人或回复人ID
public String accountName; //账号名称 public String accountName; //账号名称
public int accountType; public int accountType = 1;// 账号类型:1工程师或服务商 2小程序用户 3大鱼公司 ,
public int companyId; //ka companyId public int companyId; //ka companyId
public String content; //留言 public String content; //留言
public String messageAvatarUrl; //头像 public String messageAvatarUrl; //头像
...@@ -15,8 +15,8 @@ public class CommentPostData { ...@@ -15,8 +15,8 @@ public class CommentPostData {
public String name; //SP名称或KA名称 public String name; //SP名称或KA名称
public int status = 1; //状态 1显示 2屏蔽 public int status = 1; //状态 1显示 2屏蔽
public int targetId; //招标、授权、SPM服务ID public int targetId; //招标、授权、SPM服务ID
public int targetName; //招标授权名称 public String targetName; //招标授权名称
public int targetType = 3; //类型:1:招标 2:授权 3:SPM服务 public int targetType = 3; //类型:1:招标 2:授权 3:SPM服务 4:销售商品
public String updated; //更新人名称 public String updated; //更新人名称
public int beMessageId; //被回复的留言ID public int beMessageId; //被回复的留言ID
......
...@@ -128,6 +128,7 @@ public class OperateDetailFragment extends BaseFragment<SImplePresenter, Fragmen ...@@ -128,6 +128,7 @@ public class OperateDetailFragment extends BaseFragment<SImplePresenter, Fragmen
ProgressUtil.startLoad(mActivity); ProgressUtil.startLoad(mActivity);
CommentPostData commentData = new CommentPostData(); CommentPostData commentData = new CommentPostData();
commentData.targetId = operateInfo.getId(); commentData.targetId = operateInfo.getId();
commentData.targetName = operateInfo.getName();
commentData.accountId = Integer.parseInt(userInfo.getAccountId()); commentData.accountId = Integer.parseInt(userInfo.getAccountId());
commentData.accountName = userInfo.getAccountName(); commentData.accountName = userInfo.getAccountName();
commentData.messageAvatarUrl = userInfo.getHeaderImg(); commentData.messageAvatarUrl = userInfo.getHeaderImg();
...@@ -174,7 +175,7 @@ public class OperateDetailFragment extends BaseFragment<SImplePresenter, Fragmen ...@@ -174,7 +175,7 @@ public class OperateDetailFragment extends BaseFragment<SImplePresenter, Fragmen
private void getCommentData() { private void getCommentData() {
ProgressUtil.startLoad(mActivity); ProgressUtil.startLoad(mActivity);
OrderApiFactory.getComment(operateInfo.getId(), 1, 3, page, pageSize) OrderApiFactory.getComment(operateInfo.getId(), 1, 3,1, page, pageSize)
.subscribe(mPresenter.baseObserver(data -> { .subscribe(mPresenter.baseObserver(data -> {
if (page == 1) { if (page == 1) {
commentList.clear(); commentList.clear();
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<activity android:name=".ui.activity.SaleOrderDetailActivity" <activity android:name=".ui.activity.SaleOrderDetailActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
/> />
<activity android:name=".ui.activity.ProductSearchActivity"
android:screenOrientation="portrait"
/>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.bigfish.salecenter.adapter;
import android.view.View;
import com.bigfish.salecenter.R;
import com.bigfish.salecenter.databinding.ItemSaleCommentBinding;
import com.bigfish.salecenter.model.CommentBean;
import com.dayu.base.ui.adapter.CoreAdapter;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.GlideImageLoader;
/**
* Created by mReturn
*/
public class CommentAdapter extends CoreAdapter<CommentBean,ItemSaleCommentBinding> {
public CommentAdapter(boolean needFoot) {
super(needFoot);
}
@Override
protected void onBind(ItemSaleCommentBinding holder, CommentBean item, int position) {
super.onBind(holder, item, position);
holder.rlComponent.setVisibility(item.getMessageType() == 1?View.VISIBLE:View.GONE);
holder.rlReply.setVisibility(item.getMessageType() == 1?View.GONE:View.VISIBLE);
GlideImageLoader.load(mContext,holder.ivAvatar,item.getMessageAvatarUrl(),R.drawable.icon_user_default);
GlideImageLoader.load(mContext,holder.ivAvatar2,item.getMessageAvatarUrl(),R.drawable.icon_user_default);
holder.tvTime.setText(CommonUtils.getTimeDesc(mContext,item.getCreateTime()));
holder.tvTime2.setText(CommonUtils.getTimeDesc(mContext,item.getCreateTime()));
}
}
...@@ -2,13 +2,15 @@ package com.bigfish.salecenter.adapter; ...@@ -2,13 +2,15 @@ package com.bigfish.salecenter.adapter;
import com.bigfish.salecenter.R; import com.bigfish.salecenter.R;
import com.bigfish.salecenter.databinding.ItemSaleOrderBinding; import com.bigfish.salecenter.databinding.ItemSaleOrderBinding;
import com.bigfish.salecenter.model.OrdersBean;
import com.dayu.base.ui.adapter.CoreAdapter; import com.dayu.base.ui.adapter.CoreAdapter;
import com.dayu.utils.CommonUtils;
/** /**
* Created by mReturn * Created by mReturn
* on 2020/2/13 * on 2020/2/13
**/ **/
public class SaleOrderAdapter extends CoreAdapter<String,ItemSaleOrderBinding> { public class SaleOrderAdapter extends CoreAdapter<OrdersBean,ItemSaleOrderBinding> {
int type; int type;
public SaleOrderAdapter(boolean needFoot, int type) { public SaleOrderAdapter(boolean needFoot, int type) {
...@@ -17,9 +19,15 @@ public class SaleOrderAdapter extends CoreAdapter<String,ItemSaleOrderBinding> { ...@@ -17,9 +19,15 @@ public class SaleOrderAdapter extends CoreAdapter<String,ItemSaleOrderBinding> {
} }
@Override @Override
protected void onBind(ItemSaleOrderBinding holder, String item, int position) { protected void onBind(ItemSaleOrderBinding holder, OrdersBean item, int position) {
super.onBind(holder, item, position); super.onBind(holder, item, position);
holder.tvBrandModel.setText(item); holder.tvBrandModel.setText(item.getGoodsModel());
holder.tvPrice.setText(CommonUtils.getMoneyStr(mContext,item.getPrice()));
holder.tvCommision.setText(CommonUtils.getMoneyStr(mContext,item.getSalesPrice()));
holder.tvStatus.setText(CommonUtils.getOrderStauts(mContext,item.getStatus()));
holder.tvStatus.setTextColor(CommonUtils.getOrderStautsColor(mContext,item.getStatus()));
holder.tvDate.setText(item.getCreateTime());
holder.tvCompany.setText(item.getReceiverName());
holder.tvDateDesc.setText(type == 1?mContext.getString(R.string.sale_order_date):mContext.getString(R.string.sale_order_date2)); holder.tvDateDesc.setText(type == 1?mContext.getString(R.string.sale_order_date):mContext.getString(R.string.sale_order_date2));
} }
} }
package com.bigfish.salecenter.api; package com.bigfish.salecenter.api;
import com.bigfish.salecenter.event.SaleTabNumEvent;
import com.bigfish.salecenter.model.CollectProductData; import com.bigfish.salecenter.model.CollectProductData;
import com.bigfish.salecenter.model.CommentBean;
import com.bigfish.salecenter.model.CommentPostData;
import com.bigfish.salecenter.model.OrdersBean;
import com.bigfish.salecenter.model.ProductDetailBean; import com.bigfish.salecenter.model.ProductDetailBean;
import com.bigfish.salecenter.model.ProductListBean; import com.bigfish.salecenter.model.ProductListBean;
import com.bigfish.salecenter.model.SalTabNumBean;
import com.dayu.base.api.protocol.BasePageBean; import com.dayu.base.api.protocol.BasePageBean;
import com.dayu.base.api.protocol.BaseResponse; import com.dayu.base.api.protocol.BaseResponse;
import com.dayu.common.Constants; import com.dayu.common.Constants;
...@@ -30,6 +35,7 @@ public interface SaleService { ...@@ -30,6 +35,7 @@ public interface SaleService {
*/ */
@GET(kaApi+"/goods/mobileGoods") @GET(kaApi+"/goods/mobileGoods")
Observable<BaseResponse<BasePageBean<ProductListBean>>> getProducts(@Query("engineerId") int engineerId, Observable<BaseResponse<BasePageBean<ProductListBean>>> getProducts(@Query("engineerId") int engineerId,
@Query("key") String key,
@Query("page") int page, @Query("page") int page,
@Query("pageSize") int pageSize); @Query("pageSize") int pageSize);
...@@ -42,6 +48,7 @@ public interface SaleService { ...@@ -42,6 +48,7 @@ public interface SaleService {
*/ */
@GET(kaApi+"/goods/mobileCollectionGoods") @GET(kaApi+"/goods/mobileCollectionGoods")
Observable<BaseResponse<BasePageBean<ProductListBean>>> getCollections(@Query("engineerId") int engineerId, Observable<BaseResponse<BasePageBean<ProductListBean>>> getCollections(@Query("engineerId") int engineerId,
@Query("key") String key,
@Query("page") int page, @Query("page") int page,
@Query("pageSize") int pageSize); @Query("pageSize") int pageSize);
...@@ -68,4 +75,49 @@ public interface SaleService { ...@@ -68,4 +75,49 @@ public interface SaleService {
*/ */
@POST(kaApi+"/goodsCollections") @POST(kaApi+"/goodsCollections")
Observable<BaseResponse<Boolean>> collectProdcut(@Body CollectProductData data); Observable<BaseResponse<Boolean>> collectProdcut(@Body CollectProductData data);
/**
* 销售列表
* @return
*/
@GET(Constants.API_8600+"/orderGoods/mobile")
Observable<BaseResponse<BasePageBean<OrdersBean>>> getSaleOrders(@Query("engineerId") int engineerId,
@Query("state") int state,
@Query("key") String key,
@Query("page") int page,
@Query("pageSize") int pageSize);
/**
* 订单详情
* @param id
* @return
*/
@GET(Constants.API_8600+"/orderGoods/{id}")
Observable<BaseResponse<OrdersBean>> getOrderDetail(@Path("id") int id);
/**
* 销售tab数量
* @param engineerId
* @return
*/
@GET(Constants.API_7900+"/goods/engineerCount/{engineerId}")
Observable<BaseResponse<SalTabNumBean>> getTabNums(@Path("engineerId") int engineerId);
/**
* 获取留言
* @return
*/
@GET("/api-message/" +"leaveMessage")
Observable<BaseResponse<BasePageBean<CommentBean>>> getComment(@Query("targetId") int targetId,
@Query("status") int status,
@Query("targetType") int targetType,
@Query("accountType ") int accountType,
@Query("page") int page,
@Query("pageSize") int pageSize);
/**
* 留言/回复
*/
@POST("/api-message/" +"leaveMessage")
Observable<BaseResponse<Boolean>> addComment(@Body CommentPostData data);
} }
package com.bigfish.salecenter.model;
/**
* Created by mReturn
* on 2020\1\9 0009.
*/
public class CommentBean {
private int id;
private int targetId;
private int targetType;
private String targetName;
private int accountId;
private String accountName;
private int accountType;
private Object name;
private String messageAvatarUrl;
private int beAccountId;
private Object beName;
private int beMessageId;
private String content;
private Object reContent;
private String createTime;
private int messageType;
private int parentId;
private String orderNum;
private int status;
private int isRead;
private Object updateTime;
private String updated;
private Object companyId;
private Object keyword;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getTargetId() {
return targetId;
}
public void setTargetId(int targetId) {
this.targetId = targetId;
}
public int getTargetType() {
return targetType;
}
public void setTargetType(int targetType) {
this.targetType = targetType;
}
public String getTargetName() {
return targetName;
}
public void setTargetName(String targetName) {
this.targetName = targetName;
}
public int getAccountId() {
return accountId;
}
public void setAccountId(int accountId) {
this.accountId = accountId;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public int getAccountType() {
return accountType;
}
public void setAccountType(int accountType) {
this.accountType = accountType;
}
public Object getName() {
return name;
}
public void setName(Object name) {
this.name = name;
}
public String getMessageAvatarUrl() {
return messageAvatarUrl;
}
public void setMessageAvatarUrl(String messageAvatarUrl) {
this.messageAvatarUrl = messageAvatarUrl;
}
public int getBeAccountId() {
return beAccountId;
}
public void setBeAccountId(int beAccountId) {
this.beAccountId = beAccountId;
}
public Object getBeName() {
return beName;
}
public void setBeName(Object beName) {
this.beName = beName;
}
public int getBeMessageId() {
return beMessageId;
}
public void setBeMessageId(int beMessageId) {
this.beMessageId = beMessageId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Object getReContent() {
return reContent;
}
public void setReContent(Object reContent) {
this.reContent = reContent;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public int getMessageType() {
return messageType;
}
public void setMessageType(int messageType) {
this.messageType = messageType;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getIsRead() {
return isRead;
}
public void setIsRead(int isRead) {
this.isRead = isRead;
}
public Object getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Object updateTime) {
this.updateTime = updateTime;
}
public String getUpdated() {
return updated;
}
public void setUpdated(String updated) {
this.updated = updated;
}
public Object getCompanyId() {
return companyId;
}
public void setCompanyId(Object companyId) {
this.companyId = companyId;
}
public Object getKeyword() {
return keyword;
}
public void setKeyword(Object keyword) {
this.keyword = keyword;
}
}
package com.bigfish.salecenter.model;
/**
* Created by mReturn
* on 2020\1\9 0009.
*/
public class CommentPostData {
public int accountId; //留言人或回复人ID
public String accountName; //账号名称
public int accountType = 1; // 账号类型:1工程师或服务商 2小程序用户 3大鱼公司
public int companyId; //ka companyId
public String content; //留言
public String messageAvatarUrl; //头像
public int messageType; //留言类型 1留言 2回复
public String name; //SP名称或KA名称
public int status = 1; //状态 1显示 2屏蔽
public int targetId; //招标、授权、SPM服务ID
public String targetName; //招标授权名称
public int targetType = 4; //类型:1:招标 2:授权 3:SPM服务 4:销售商品
public String updated; //更新人名称
public int beMessageId; //被回复的留言ID
public String beName; //被回复人昵称
public int parentId; //父节点
public int beAccountId; //被回复人ID
}
...@@ -293,7 +293,7 @@ public class ProductDetailBean implements Serializable { ...@@ -293,7 +293,7 @@ public class ProductDetailBean implements Serializable {
this.goodsPics = goodsPics; this.goodsPics = goodsPics;
} }
public static class GoodsCategorysBean { public static class GoodsCategorysBean implements Serializable{
/** /**
* id : 1 * id : 1
* goodsId : 1 * goodsId : 1
...@@ -339,7 +339,7 @@ public class ProductDetailBean implements Serializable { ...@@ -339,7 +339,7 @@ public class ProductDetailBean implements Serializable {
} }
} }
public static class GoodsPicsBean { public static class GoodsPicsBean implements Serializable{
/** /**
* id : 1 * id : 1
* goodsId : 1 * goodsId : 1
......
package com.bigfish.salecenter.model;
public class SalTabNumBean {
/**
* goodsCount : 52
* selling : 0
* engineerCollecd : 0
* selled : 0
*/
private int goodsCount;
private int selling;
private int engineerCollecd;
private int selled;
public int getGoodsCount() {
return goodsCount;
}
public void setGoodsCount(int goodsCount) {
this.goodsCount = goodsCount;
}
public int getSelling() {
return selling;
}
public void setSelling(int selling) {
this.selling = selling;
}
public int getEngineerCollecd() {
return engineerCollecd;
}
public void setEngineerCollecd(int engineerCollecd) {
this.engineerCollecd = engineerCollecd;
}
public int getSelled() {
return selled;
}
public void setSelled(int selled) {
this.selled = selled;
}
}
...@@ -9,4 +9,14 @@ public class SaleTab { ...@@ -9,4 +9,14 @@ public class SaleTab {
public int collect; public int collect;
public int inSale; public int inSale;
public int saleDone; public int saleDone;
public SaleTab() {
}
public SaleTab(int products, int collect, int inSale, int saleDone) {
this.products = products;
this.collect = collect;
this.inSale = inSale;
this.saleDone = saleDone;
}
} }
package com.bigfish.salecenter.presenter.homesale; package com.bigfish.salecenter.presenter.homesale;
import com.bigfish.salecenter.api.SaleService;
import com.bigfish.salecenter.model.SaleTab; import com.bigfish.salecenter.model.SaleTab;
import com.dayu.base.api.Api;
import com.dayu.event.UserInfo; import com.dayu.event.UserInfo;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
...@@ -22,14 +24,17 @@ public class HomeSalePresenter extends HomeSaleContract.Presenter{ ...@@ -22,14 +24,17 @@ public class HomeSalePresenter extends HomeSaleContract.Presenter{
@Override @Override
public void getTabNum(int userId) { public void getTabNum(int userId) {
SaleTab tab = new SaleTab(); Api.getService(SaleService.class).getTabNums(mUserId).compose(Api.applySchedulers())
mView.setTabNum(tab, mIndex); .subscribe(baseObserver(data ->{
SaleTab tab = new SaleTab(data.getGoodsCount(),data.getEngineerCollecd(),data.getSelling(),data.getSelled());
mView.setTabNum(tab, mIndex);
}));
} }
@Override @Override
public void onAttached() { public void onAttached() {
UserInfo userInfo = UserManager.getInstance().getUser(); UserInfo userInfo = UserManager.getInstance().getUser();
mUserId = Integer.parseInt(userInfo.getAccountId()); mUserId = Integer.parseInt(userInfo.getAccountId());
ToastUtils.showShortToast("sale: "+mUserId);
} }
} }
package com.bigfish.salecenter.presenter.saleorder; package com.bigfish.salecenter.presenter.saleorder;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.text.TextUtils;
import com.bigfish.salecenter.api.SaleService;
import com.bigfish.salecenter.event.RefreshSaleTab;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductContract; import com.bigfish.salecenter.presenter.saleproduct.SaleProductContract;
import com.dayu.base.api.Api;
import com.dayu.common.Constants;
import com.dayu.event.UserInfo; import com.dayu.event.UserInfo;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -19,6 +26,7 @@ public class SaleOrderPresent extends SaleOrderContract.Presenter { ...@@ -19,6 +26,7 @@ public class SaleOrderPresent extends SaleOrderContract.Presenter {
private int mUserId; private int mUserId;
private int type; //1.销售中 2.已完成 private int type; //1.销售中 2.已完成
private ObservableField<Object> datas = new ObservableField<>(); private ObservableField<Object> datas = new ObservableField<>();
public String keyStr ; //搜索关键字
@Override @Override
public void onAttached() { public void onAttached() {
...@@ -39,22 +47,24 @@ public class SaleOrderPresent extends SaleOrderContract.Presenter { ...@@ -39,22 +47,24 @@ public class SaleOrderPresent extends SaleOrderContract.Presenter {
public void refresh() { public void refresh() {
super.refresh(); super.refresh();
mPage = 1; mPage = 1;
// if (type == 1) { getOrders();
// ToastUtils.showShortToast("in sale"); if (TextUtils.isEmpty(keyStr)){
// } else { EventBus.getDefault().post(new RefreshSaleTab(-1));
// ToastUtils.showShortToast("sale done");
// }
//test data
List<String> items = new ArrayList<>();
for (int i=0;i<10;i++){
items.add("order item-"+i+"-"+type);
} }
datas.set(items); }
private void getOrders() {
Api.getService(SaleService.class).getSaleOrders(23,type,keyStr,mPage,Constants.PAGESIZE).compose(Api.applySchedulers())
.subscribe(baseObserver(orders->{
// ToastUtils.showShortToast(products.getData().size() + " ");
datas.set(orders);
mPage++;
}, responeThrowable -> datas.set(Constants.FAILED)));
} }
@Override @Override
public void loadMore() { public void loadMore() {
super.loadMore(); super.loadMore();
getOrders();
} }
} }
package com.bigfish.salecenter.presenter.saleproduct; package com.bigfish.salecenter.presenter.saleproduct;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.text.TextUtils;
import com.bigfish.salecenter.api.SaleService; import com.bigfish.salecenter.api.SaleService;
import com.bigfish.salecenter.event.RefreshSaleTab;
import com.bigfish.salecenter.model.CollectProductData; import com.bigfish.salecenter.model.CollectProductData;
import com.bigfish.salecenter.model.ProductListBean; import com.bigfish.salecenter.model.ProductListBean;
import com.dayu.base.api.Api; import com.dayu.base.api.Api;
...@@ -11,6 +13,8 @@ import com.dayu.event.UserInfo; ...@@ -11,6 +13,8 @@ import com.dayu.event.UserInfo;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
import org.greenrobot.eventbus.EventBus;
import io.reactivex.Observable; import io.reactivex.Observable;
/** /**
...@@ -21,6 +25,7 @@ public class SaleProductPresent extends SaleProductContract.Presenter { ...@@ -21,6 +25,7 @@ public class SaleProductPresent extends SaleProductContract.Presenter {
private int mPage; private int mPage;
private int mUserId; private int mUserId;
public int type; //1.商品 2.收藏 public int type; //1.商品 2.收藏
public String keyStr ; //搜索关键字
private ObservableField<Object> datas = new ObservableField<>(); private ObservableField<Object> datas = new ObservableField<>();
@Override @Override
...@@ -47,13 +52,15 @@ public class SaleProductPresent extends SaleProductContract.Presenter { ...@@ -47,13 +52,15 @@ public class SaleProductPresent extends SaleProductContract.Presenter {
} else { } else {
getCollections(); getCollections();
} }
if (TextUtils.isEmpty(keyStr)){
EventBus.getDefault().post(new RefreshSaleTab(-1));
}
} }
//商品列表 //商品列表
private void getProducts() { private void getProducts() {
Api.getService(SaleService.class).getProducts(mUserId, mPage, Constants.PAGESIZE).compose(Api.applySchedulers()) Api.getService(SaleService.class).getProducts(mUserId, keyStr, mPage, Constants.PAGESIZE).compose(Api.applySchedulers())
.subscribe(baseObserver( .subscribe(baseObserver(
products -> { products -> {
// ToastUtils.showShortToast(products.getData().size() + " "); // ToastUtils.showShortToast(products.getData().size() + " ");
...@@ -65,7 +72,7 @@ public class SaleProductPresent extends SaleProductContract.Presenter { ...@@ -65,7 +72,7 @@ public class SaleProductPresent extends SaleProductContract.Presenter {
//收藏列表 //收藏列表
private void getCollections() { private void getCollections() {
Api.getService(SaleService.class).getCollections(mUserId, mPage, Constants.PAGESIZE).compose(Api.applySchedulers()) Api.getService(SaleService.class).getCollections(mUserId, keyStr, mPage, Constants.PAGESIZE).compose(Api.applySchedulers())
.subscribe(baseObserver( .subscribe(baseObserver(
products -> { products -> {
// ToastUtils.showShortToast("collections: " + products.getData().size()); // ToastUtils.showShortToast("collections: " + products.getData().size());
......
package com.bigfish.salecenter.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import com.bigfish.salecenter.R;
import com.bigfish.salecenter.adapter.SaleProductAdapter;
import com.bigfish.salecenter.databinding.ActivityProductSearchBinding;
import com.bigfish.salecenter.databinding.ItemSaleProductBinding;
import com.bigfish.salecenter.model.ProductListBean;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductContract;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent;
import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.widgets.listener.OnItemClickListener;
import java.util.ArrayList;
public class ProductSearchActivity extends BaseActivity<SaleProductPresent, ActivityProductSearchBinding>
implements SaleProductContract.View {
private int mType; //1.商品 2.收藏
SaleProductAdapter mAdapter;
public static void launch(Context context, int type) {
Intent intent = new Intent(context, ProductSearchActivity.class);
intent.putExtra("type", type);
context.startActivity(intent);
}
@Override
public void setPresenter() {
mBind.setPresenter(mPresenter);
}
@Override
public int getLayoutId() {
return R.layout.activity_product_search;
}
@Override
public void initView() {
mBind.tvCancel.setOnClickListener(view -> dumpBack());
mType = getIntent().getIntExtra("type", 0);
mPresenter.setType(mType);
initSerachView();
mAdapter = new SaleProductAdapter(true);
mAdapter.setViewType(R.layout.item_sale_product);
mAdapter.initPresenter(mPresenter);
mBind.recyclerView.setAdapter(mAdapter);
mAdapter.setData(new ArrayList<>());
mBind.recyclerView.setVisibility(View.GONE);
mBind.recyclerView.setOnItemClickListener(new OnItemClickListener<ProductListBean, ItemSaleProductBinding>() {
@Override
public void OnItemClick(ProductListBean item, ItemSaleProductBinding bind) {
Intent intent = new Intent(mActivity, ProductDetailActivity.class);
intent.putExtra("id", item.getId());
mActivity.startActivity(intent);
}
});
}
private void initSerachView() {
mBind.edtSeacher.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
mPresenter.refresh();
InputMethodManager imm = (InputMethodManager) mActivity
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), 0);
return true;
}
return false;
});
}
}
package com.bigfish.salecenter.ui.activity; package com.bigfish.salecenter.ui.activity;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.widget.CheckBox;
import com.bigfish.salecenter.R; import com.bigfish.salecenter.R;
import com.bigfish.salecenter.api.SaleService;
import com.bigfish.salecenter.databinding.ActivityOrderDetailBinding; import com.bigfish.salecenter.databinding.ActivityOrderDetailBinding;
import com.bigfish.salecenter.model.OrdersBean;
import com.chad.library.adapter.base.BaseQuickAdapter; 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.Api;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.base.ui.presenter.SImplePresenter; import com.dayu.base.ui.presenter.SImplePresenter;
import com.dayu.utils.CommonUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -18,6 +21,8 @@ import java.util.List; ...@@ -18,6 +21,8 @@ import java.util.List;
* on 2020/2/14 * on 2020/2/14
**/ **/
public class SaleOrderDetailActivity extends BaseActivity<SImplePresenter, ActivityOrderDetailBinding> { public class SaleOrderDetailActivity extends BaseActivity<SImplePresenter, ActivityOrderDetailBinding> {
private int mId;
@Override @Override
public void setPresenter() { public void setPresenter() {
...@@ -31,23 +36,45 @@ public class SaleOrderDetailActivity extends BaseActivity<SImplePresenter, Activ ...@@ -31,23 +36,45 @@ public class SaleOrderDetailActivity extends BaseActivity<SImplePresenter, Activ
@Override @Override
public void initView() { public void initView() {
mBind.toolbar.setNavigationOnClickListener(v -> dumpBack()); mBind.toolbar.setNavigationOnClickListener(v -> dumpBack());
setStepAdapter(); mId = getIntent().getIntExtra("id",0);
initData();
}
private void initData() {
showDialog();
Api.getService(SaleService.class).getOrderDetail(mId).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(
data->{
setDetailViewData(data);
}
));
} }
private void setStepAdapter() { private void setDetailViewData(OrdersBean data) {
mBind.tvOrderNumber.setText(data.getOrderGoodsNum());
mBind.tvCompanyName.setText(data.getOrgName());
mBind.tvCustomerName.setText(data.getReceiverName());
mBind.tvCustomerAddr.setText(data.getReceiverAddress());
mBind.tvCustomerPhone.setText(data.getReceiverMobile());
mBind.tvModel.setText(data.getGoodsModel());
mBind.tvSellerCompany.setText(data.getProviderName());
mBind.tvCompanyPn.setText(data.getGoodsPn());
mBind.tvSinglePrice.setText(CommonUtils.getMoneyStr(this,data.getGoodsPrice()));
mBind.tvOrderCount.setText(data.getNum()+"");
mBind.tvOrderMoney.setText(CommonUtils.getMoneyStr(this,data.getPrice()));
mBind.tvBonus.setText(CommonUtils.getMoneyStr(this,data.getSalesPrice()));
setStepAdapter(data.getOrderGoodsRecordVOS());
}
List<String> testList = new ArrayList<>(); private void setStepAdapter(List<OrdersBean.OrderGoodsRecordVOSBean> records) {
for (int i = 0; i < 3; i++) {
testList.add("test data" + i);
}
BaseQuickAdapter<String, BaseViewHolder> stepAdapter = BaseQuickAdapter<OrdersBean.OrderGoodsRecordVOSBean, BaseViewHolder> stepAdapter =
new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_sale_step, testList) { new BaseQuickAdapter<OrdersBean.OrderGoodsRecordVOSBean, BaseViewHolder>(R.layout.item_sale_step, records) {
@Override @Override
protected void convert(BaseViewHolder helper, String item) { protected void convert(BaseViewHolder helper, OrdersBean.OrderGoodsRecordVOSBean item) {
helper.setText(R.id.tv_time, item); helper.setText(R.id.tv_time, item.getCreateTime());
helper.setText(R.id.tv_progress, item); helper.setText(R.id.tv_progress, item.getProgressTitle());
helper.setText(R.id.tv_detail, item); helper.setText(R.id.tv_detail, item.getRecord());
} }
}; };
mBind.rvSellStep.setLayoutManager(new LinearLayoutManager(this)); mBind.rvSellStep.setLayoutManager(new LinearLayoutManager(this));
......
...@@ -120,7 +120,7 @@ public class HomeSaleFragment extends BaseFragment<HomeSalePresenter, FragmentHo ...@@ -120,7 +120,7 @@ public class HomeSaleFragment extends BaseFragment<HomeSalePresenter, FragmentHo
@Override @Override
public void setTabNum(SaleTab tab, int myTabIndex) { public void setTabNum(SaleTab tab, int myTabIndex) {
EventBus.getDefault().post(new SaleTabNumEvent(15)); EventBus.getDefault().post(new SaleTabNumEvent(tab.products+tab.collect+tab.inSale+tab.saleDone));
String[] tabNum = new String[]{tab.products + "",tab.collect + "", tab.inSale + "",tab.saleDone + ""}; String[] tabNum = new String[]{tab.products + "",tab.collect + "", tab.inSale + "",tab.saleDone + ""};
if (isFirstAddTab) { if (isFirstAddTab) {
mBind.tbSale.removeAllTabs(); mBind.tbSale.removeAllTabs();
...@@ -165,4 +165,5 @@ public class HomeSaleFragment extends BaseFragment<HomeSalePresenter, FragmentHo ...@@ -165,4 +165,5 @@ public class HomeSaleFragment extends BaseFragment<HomeSalePresenter, FragmentHo
public void onRefreshTab(RefreshSaleTab event) { public void onRefreshTab(RefreshSaleTab event) {
mPresenter.chooseTab(event.getTabNum()); mPresenter.chooseTab(event.getTabNum());
} }
} }
...@@ -54,8 +54,14 @@ public class ProductInstructionFragment extends BaseFragment<SImplePresenter, Fr ...@@ -54,8 +54,14 @@ public class ProductInstructionFragment extends BaseFragment<SImplePresenter, Fr
if (mDetail != null) { if (mDetail != null) {
initDataView(); initDataView();
mBind.btnShare.setOnClickListener(v -> onShareClick()); mBind.btnShare.setOnClickListener(v -> onShareClick());
mBind.btnContact.setOnClickListener(v -> mBind.btnContact.setOnClickListener(v -> {
CommonUtils.dialPhone(mActivity, mDetail.getSalesHot()) if (TextUtils.isEmpty(mDetail.getSalesHot())) {
ToastUtils.showShortToast(R.string.no_mobile);
} else {
CommonUtils.dialPhone(getContext(), mDetail.getSalesHot());
}
}
); );
} }
} }
......
...@@ -2,16 +2,26 @@ package com.bigfish.salecenter.ui.fragment; ...@@ -2,16 +2,26 @@ package com.bigfish.salecenter.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import com.bigfish.salecenter.R; import com.bigfish.salecenter.R;
import com.bigfish.salecenter.adapter.SaleOrderAdapter; import com.bigfish.salecenter.adapter.SaleOrderAdapter;
import com.bigfish.salecenter.adapter.SaleProductAdapter; import com.bigfish.salecenter.adapter.SaleProductAdapter;
import com.bigfish.salecenter.databinding.FragmentCommonSaleBinding; import com.bigfish.salecenter.databinding.FragmentCommonSaleBinding;
import com.bigfish.salecenter.databinding.ItemSaleOrderBinding;
import com.bigfish.salecenter.databinding.ItemSaleProductBinding;
import com.bigfish.salecenter.model.OrdersBean;
import com.bigfish.salecenter.model.ProductListBean;
import com.bigfish.salecenter.presenter.saleorder.SaleOrderPresent; import com.bigfish.salecenter.presenter.saleorder.SaleOrderPresent;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent; import com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent;
import com.bigfish.salecenter.ui.activity.ProductDetailActivity; import com.bigfish.salecenter.ui.activity.ProductDetailActivity;
import com.bigfish.salecenter.ui.activity.SaleOrderDetailActivity; import com.bigfish.salecenter.ui.activity.SaleOrderDetailActivity;
import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.base.ui.fragment.BaseFragment;
import com.dayu.common.MyTextWatcher;
import com.dayu.utils.CommonUtils;
import com.dayu.widgets.listener.OnItemClickListener; import com.dayu.widgets.listener.OnItemClickListener;
/** /**
...@@ -38,7 +48,7 @@ public class SaleOrderFragment extends BaseFragment<SaleOrderPresent,FragmentCom ...@@ -38,7 +48,7 @@ public class SaleOrderFragment extends BaseFragment<SaleOrderPresent,FragmentCom
@Override @Override
protected void lazyLoad() { protected void lazyLoad() {
super.lazyLoad(); super.lazyLoad();
// mPresenter.refresh(); mPresenter.refresh();
} }
...@@ -47,20 +57,57 @@ public class SaleOrderFragment extends BaseFragment<SaleOrderPresent,FragmentCom ...@@ -47,20 +57,57 @@ public class SaleOrderFragment extends BaseFragment<SaleOrderPresent,FragmentCom
Bundle bundle = getArguments(); Bundle bundle = getArguments();
type = bundle.getInt("type"); type = bundle.getInt("type");
mPresenter.setType(type); mPresenter.setType(type);
mBind.edtSeacher.setHint(mActivity.getString(R.string.input_sale_order)+type); // mBind.edtSeacher.setHint(mActivity.getString(R.string.input_sale_order)+type);
initSearchView();
mAdapter = new SaleOrderAdapter(true,type); mAdapter = new SaleOrderAdapter(true,type);
mAdapter.setViewType(R.layout.item_sale_order); mAdapter.setViewType(R.layout.item_sale_order);
mBind.recyclerView.setAdapter(mAdapter); mBind.recyclerView.setAdapter(mAdapter);
mPresenter.refresh();
mBind.recyclerView.setOnItemClickListener(new OnItemClickListener() { mBind.recyclerView.setOnItemClickListener((OnItemClickListener<OrdersBean, ItemSaleOrderBinding>) (item, bind) -> {
Intent intent = new Intent(mActivity,SaleOrderDetailActivity.class);
intent.putExtra("id",item.getId());
startActivity(intent);
});
}
private void initSearchView() {
mBind.edtSeacher.setHint(mActivity.getString(R.string.input_sale_order));
mBind.edtSeacher.addTextChangedListener(new MyTextWatcher(){
@Override @Override
public void OnItemClick(Object item, Object bind) { public void afterTextChanged(Editable s) {
startActivity(new Intent(mActivity,SaleOrderDetailActivity.class)); super.afterTextChanged(s);
if (s.toString().trim().length()>0)
mBind.tvCancel.setVisibility(View.VISIBLE);
}
});
mBind.edtSeacher.setOnEditorActionListener((v, actionId, event) -> {
String str = mBind.edtSeacher.getText().toString();
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
if (str.length()>0){
mPresenter.keyStr = mBind.edtSeacher.getText().toString();
mPresenter.refresh();
CommonUtils.hideSoftInput(mActivity);
return true;
}
}
return false;
});
mBind.tvCancel.setOnClickListener(view -> {
mBind.edtSeacher.setText("");
mBind.tvCancel.setVisibility(View.GONE);
CommonUtils.hideSoftInput(mActivity);
if (!TextUtils.isEmpty(mPresenter.keyStr)){
mPresenter.keyStr = "";
mPresenter.refresh();
} }
}); });
} }
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.fragment_common_sale; return R.layout.fragment_common_sale;
......
package com.bigfish.salecenter.ui.fragment; package com.bigfish.salecenter.ui.fragment;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import com.bigfish.salecenter.R; import com.bigfish.salecenter.R;
import com.bigfish.salecenter.adapter.SaleProductAdapter; import com.bigfish.salecenter.adapter.SaleProductAdapter;
import com.bigfish.salecenter.databinding.FragmentCommonSaleBinding; import com.bigfish.salecenter.databinding.FragmentCommonSaleBinding;
import com.bigfish.salecenter.databinding.ItemSaleProductBinding; import com.bigfish.salecenter.databinding.ItemSaleProductBinding;
import com.bigfish.salecenter.event.CollectChangedEvent; import com.bigfish.salecenter.event.CollectChangedEvent;
import com.bigfish.salecenter.event.RefreshSaleTab;
import com.bigfish.salecenter.model.ProductListBean; import com.bigfish.salecenter.model.ProductListBean;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductContract; import com.bigfish.salecenter.presenter.saleproduct.SaleProductContract;
import com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent; import com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent;
import com.bigfish.salecenter.ui.activity.ProductDetailActivity; import com.bigfish.salecenter.ui.activity.ProductDetailActivity;
import com.bigfish.salecenter.ui.activity.ProductSearchActivity;
import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.base.ui.fragment.BaseFragment;
import com.dayu.common.MyTextWatcher;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.widgets.listener.OnItemClickListener; import com.dayu.widgets.listener.OnItemClickListener;
...@@ -58,8 +68,9 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme ...@@ -58,8 +68,9 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
Bundle bundle = getArguments(); Bundle bundle = getArguments();
type = bundle.getInt("type"); type = bundle.getInt("type");
initSearchView();
mPresenter.setType(type); mPresenter.setType(type);
mBind.edtSeacher.setHint(mActivity.getString(R.string.input_sale_product) + type);
mAdapter = new SaleProductAdapter(true); mAdapter = new SaleProductAdapter(true);
mAdapter.setViewType(R.layout.item_sale_product); mAdapter.setViewType(R.layout.item_sale_product);
...@@ -74,6 +85,49 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme ...@@ -74,6 +85,49 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme
}); });
} }
private void initSearchView() {
mBind.edtSeacher.setHint(mActivity.getString(R.string.input_sale_product));
mBind.edtSeacher.addTextChangedListener(new MyTextWatcher(){
@Override
public void afterTextChanged(Editable s) {
super.afterTextChanged(s);
if (s.toString().trim().length()>0)
mBind.tvCancel.setVisibility(View.VISIBLE);
}
});
mBind.edtSeacher.setOnEditorActionListener((v, actionId, event) -> {
String str = mBind.edtSeacher.getText().toString();
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
if (str.length()>0){
mPresenter.keyStr = mBind.edtSeacher.getText().toString();
mPresenter.refresh();
CommonUtils.hideSoftInput(mActivity);
return true;
}
}
return false;
});
mBind.tvCancel.setOnClickListener(view -> {
mBind.edtSeacher.setText("");
mBind.tvCancel.setVisibility(View.GONE);
CommonUtils.hideSoftInput(mActivity);
if (!TextUtils.isEmpty(mPresenter.keyStr)){
mPresenter.keyStr = "";
mPresenter.refresh();
}
});
}
private void hideBoard(){
InputMethodManager imm = (InputMethodManager) mActivity
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), 0);
}
private void toDetail(ProductListBean item) { private void toDetail(ProductListBean item) {
Intent intent = new Intent(mActivity, ProductDetailActivity.class); Intent intent = new Intent(mActivity, ProductDetailActivity.class);
intent.putExtra("id", item.getId()); intent.putExtra("id", item.getId());
...@@ -95,6 +149,7 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme ...@@ -95,6 +149,7 @@ public class SaleProductFragment extends BaseFragment<SaleProductPresent, Fragme
mPresenter.refresh(); mPresenter.refresh();
} else { } else {
updateCollectData(event); updateCollectData(event);
EventBus.getDefault().post(new RefreshSaleTab(-1));
} }
} }
} }
......
...@@ -77,22 +77,22 @@ ...@@ -77,22 +77,22 @@
android:text="" /> android:text="" />
</LinearLayout> </LinearLayout>
<LinearLayout </RelativeLayout>
style="@style/sale_linearlayout_detail" <LinearLayout
android:layout_alignParentRight="true" style="@style/sale_linearlayout_detail"
android:layout_width="wrap_content" android:layout_alignParentRight="true"
> android:layout_width="wrap_content"
>
<TextView <TextView
style="@style/sale_detail_text" style="@style/sale_detail_text"
android:text="@string/sale_customer_phone" /> android:text="@string/sale_customer_phone" />
<TextView <TextView
android:id="@+id/tv_customer_phone" android:id="@+id/tv_customer_phone"
style="@style/sale_item_text2" style="@style/sale_item_text2"
android:text="" /> android:text="" />
</LinearLayout> </LinearLayout>
</RelativeLayout>
<LinearLayout style="@style/sale_linearlayout_detail"> <LinearLayout style="@style/sale_linearlayout_detail">
...@@ -155,8 +155,8 @@ ...@@ -155,8 +155,8 @@
<TextView <TextView
android:id="@+id/tv_single_price" android:id="@+id/tv_single_price"
style="@style/sale_item_text2" android:textColor="@color/text_common_blue"
android:text="" /> style="@style/sale_item_text2" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<TextView <TextView
android:id="@+id/tv_order_count" android:id="@+id/tv_order_count"
style="@style/sale_item_text2" style="@style/sale_item_text2"
android:text="" /> />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
...@@ -192,25 +192,27 @@ ...@@ -192,25 +192,27 @@
<TextView <TextView
android:id="@+id/tv_order_money" android:id="@+id/tv_order_money"
style="@style/sale_item_text2" style="@style/sale_item_text2"
android:text="" /> android:textColor="@color/text_common_blue"
/>
</LinearLayout> </LinearLayout>
<LinearLayout </RelativeLayout>
style="@style/sale_linearlayout_detail" <LinearLayout
android:layout_alignParentRight="true" style="@style/sale_linearlayout_detail"
android:layout_width="wrap_content" android:layout_alignParentRight="true"
> android:layout_width="wrap_content"
>
<TextView <TextView
style="@style/sale_detail_text" style="@style/sale_detail_text"
android:text="@string/sale_agent_bonus" /> android:text="@string/sale_agent_bonus" />
<TextView <TextView
android:id="@+id/tv_bonus" android:id="@+id/tv_bonus"
style="@style/sale_item_text2" style="@style/sale_item_text2"
android:text="" /> android:textColor="@color/text_common_green"
</LinearLayout> />
</RelativeLayout> </LinearLayout>
<TextView <TextView
style="@style/sale_detail_text" style="@style/sale_detail_text"
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="presenter"
type="com.bigfish.salecenter.presenter.saleproduct.SaleProductPresent" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/rl_seacher"
style="@style/title"
android:visibility="visible">
<EditText
android:id="@+id/edt_seacher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/iv"
android:background="@null"
android:hint="@string/input_sale_product"
android:imeOptions="actionSearch"
android:inputType="text"
android:singleLine="true"
android:text="@={presenter.keyStr}"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv"
style="@style/title_image_back"
android:src="@drawable/seacher" />
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:gravity="center"
android:text="@string/cancle"
android:textColor="@color/cl_black"
android:textSize="@dimen/dp_18"
android:textStyle="bold" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape" />
</RelativeLayout>
</RelativeLayout>
<com.dayu.widgets.LRecyclerView
android:id="@+id/recyclerView"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5" />
</LinearLayout>
</layout>
\ No newline at end of file
...@@ -48,9 +48,10 @@ ...@@ -48,9 +48,10 @@
android:gravity="center" android:gravity="center"
android:text="@string/cancle" android:text="@string/cancle"
android:textColor="@color/cl_black" android:textColor="@color/cl_black"
android:textSize="@dimen/dp_18" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone" /> android:visibility="gone"
/>
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="item"
type="com.bigfish.salecenter.model.CommentBean" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_component"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="10dp"
/>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/iv_avatar"
android:text="@{item.accountName}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/tv_name"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/tv_name"
android:text="time"
android:textColor="@color/tv_cl"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name"
android:layout_alignLeft="@id/tv_name"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:text="@{item.content}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/icon_comment" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/tv_content"
android:layout_marginTop="10dp"
android:background="@color/color_ee" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_reply"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="55dp"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/iv_avatar2"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/icon_user_default" />
<TextView
android:id="@+id/tv_name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/iv_avatar2"
android:text="@{item.accountName}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_time2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/tv_name2"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/tv_name2"
android:text="time"
android:textColor="@color/tv_cl"
android:textSize="13sp" />
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name2"
android:layout_alignLeft="@id/tv_name2"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_reply_"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reply_str"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_reply_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{"@"+item.beName}'
android:textColor="@color/cl_home_button"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{": "+item.content}'
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
</LinearLayout>
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/icon_comment" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/ll_content"
android:layout_marginTop="10dp"
android:background="@color/color_ee" />
</RelativeLayout>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="item"
type="com.bigfish.salecenter.model.CommentBean" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_component"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="10dp"
/>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/iv_avatar"
android:text="@{item.accountName}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/tv_name"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/tv_name"
android:text="time"
android:textColor="@color/tv_cl"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name"
android:layout_alignLeft="@id/tv_name"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:text="@{item.content}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/icon_comment" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/tv_content"
android:layout_marginTop="10dp"
android:background="@color/color_ee" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_reply"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="55dp"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/iv_avatar2"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@drawable/icon_user_default" />
<TextView
android:id="@+id/tv_name2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/iv_avatar2"
android:text="@{item.accountName}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_time2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/tv_name2"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/tv_name2"
android:text="time"
android:textColor="@color/tv_cl"
android:textSize="13sp" />
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_name2"
android:layout_alignLeft="@id/tv_name2"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_reply_"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reply_str"
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_reply_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{"@"+item.beName}'
android:textColor="@color/cl_home_button"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{": "+item.content}'
android:textColor="@color/cl_home_title_text_color"
android:textSize="13sp" />
</LinearLayout>
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/icon_comment" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/ll_content"
android:layout_marginTop="10dp"
android:background="@color/color_ee" />
</RelativeLayout>
</LinearLayout>
</layout>
\ No newline at end of file
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<TextView <TextView
style="@style/sale_item_text" style="@style/sale_item_text"
android:text="@string/sale_commision" android:text="@string/commision_str"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="25dp" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_time" android:id="@+id/tv_time"
style="@style/sale_item_text" style="@style/sale_item_text"
android:maxLines="2"
android:textSize="12sp"
android:layout_width="95dp" android:layout_width="95dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_order_step_item1" android:background="@drawable/bg_order_step_item1"
...@@ -20,14 +22,17 @@ ...@@ -20,14 +22,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_order_step_item2" android:background="@drawable/bg_order_step_item2"
android:gravity="center" android:gravity="center"
android:textSize="12sp"
android:text="@string/sale_progress_str" /> android:text="@string/sale_progress_str" />
<TextView <TextView
android:id="@+id/tv_detail" android:id="@+id/tv_detail"
style="@style/sale_item_text" style="@style/sale_item_text"
android:textSize="12sp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_order_step_item1" android:background="@drawable/bg_order_step_item1"
android:maxLines="2"
android:gravity="center" android:gravity="center"
android:text="@string/sale_record_str" /> android:text="@string/sale_record_str" />
</LinearLayout> </LinearLayout>
......
...@@ -86,11 +86,13 @@ public class PwLoginPresenter extends PwLoginContract.Presenter { ...@@ -86,11 +86,13 @@ public class PwLoginPresenter extends PwLoginContract.Presenter {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} else if (UserManager.getInstance().getRole() == Constants.MANAGER_NOSITE_ENGINEER } else if (UserManager.getInstance().getRole() == Constants.MANAGER_NOSITE_ENGINEER
|| UserManager.getInstance().getRole() == Constants.MANAGER) { || UserManager.getInstance().getRole() == Constants.MANAGER) {
ARouter.getInstance().build(RouterPath.PATH_MANAGER).navigation(); // ARouter.getInstance().build(RouterPath.PATH_MANAGER).navigation();
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} }
} else { } else {
AppManager.getInstance().finishAllActivity(); AppManager.getInstance().finishAllActivity();
ARouter.getInstance().build(RouterPath.PATH_SERVICESTATION).navigation(); // ARouter.getInstance().build(RouterPath.PATH_SERVICESTATION).navigation();
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} }
})); }));
} }
......
...@@ -153,11 +153,13 @@ public class SmsLoginPresenter extends SmsLoginContract.Presenter { ...@@ -153,11 +153,13 @@ public class SmsLoginPresenter extends SmsLoginContract.Presenter {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} else if (UserManager.getInstance().getRole() == Constants.MANAGER_NOSITE_ENGINEER } else if (UserManager.getInstance().getRole() == Constants.MANAGER_NOSITE_ENGINEER
|| UserManager.getInstance().getRole() == Constants.MANAGER) { || UserManager.getInstance().getRole() == Constants.MANAGER) {
ARouter.getInstance().build(RouterPath.PATH_MANAGER).navigation(); // ARouter.getInstance().build(RouterPath.PATH_MANAGER).navigation();
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} }
} else { } else {
AppManager.getInstance().finishAllActivity(); AppManager.getInstance().finishAllActivity();
ARouter.getInstance().build(RouterPath.PATH_SERVICESTATION).navigation(); // ARouter.getInstance().build(RouterPath.PATH_SERVICESTATION).navigation();
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
} }
})); }));
} }
......
...@@ -36,7 +36,7 @@ public class ServiceRecordActivity extends BaseActivity<SImplePresenter,Activity ...@@ -36,7 +36,7 @@ public class ServiceRecordActivity extends BaseActivity<SImplePresenter,Activity
private void setAdapter() { private void setAdapter() {
List<String> testList = new ArrayList<>(); List<String> testList = new ArrayList<>();
for (int i = 0; i < 13; i++) { for (int i = 0; i < 15; i++) {
testList.add("test data" + i); testList.add("test data" + i);
} }
......
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