提交 217c3b4e authored 作者: lgd's avatar lgd

1.产品弹窗,上下架需要在调试

2.//TODO erp用户激活,忘记密码测试,产品详情数据调整,搜索具体调试,产品下单,,bat,mes,消息,我的,刷新token
上级 d7095f41
...@@ -154,7 +154,7 @@ public class ProductBean { ...@@ -154,7 +154,7 @@ public class ProductBean {
private Object updatedUser; private Object updatedUser;
private Object outDeptId; private Object outDeptId;
private Object outDeptName; private Object outDeptName;
private Object productTypeName; private String productTypeName;
private Object expectOutputDeptName; private Object expectOutputDeptName;
private Object isExpectOut; private Object isExpectOut;
private Object ofKindName; private Object ofKindName;
...@@ -392,11 +392,11 @@ public class ProductBean { ...@@ -392,11 +392,11 @@ public class ProductBean {
this.outDeptName = outDeptName; this.outDeptName = outDeptName;
} }
public Object getProductTypeName() { public String getProductTypeName() {
return productTypeName; return productTypeName;
} }
public void setProductTypeName(Object productTypeName) { public void setProductTypeName(String productTypeName) {
this.productTypeName = productTypeName; this.productTypeName = productTypeName;
} }
......
...@@ -22,13 +22,25 @@ import io.reactivex.Observable; ...@@ -22,13 +22,25 @@ import io.reactivex.Observable;
public interface WorkProContract { public interface WorkProContract {
interface Model extends IBaseModel { interface Model extends IBaseModel {
Observable<BaseBean> getPro(Map<String, Object> param); Observable<BaseBean> getPro(Map<String, Object> param);
Observable<BaseBean> modify(Integer id, String internalPrice, String remark);
Observable<BaseBean> onSale(Integer id, String shelfAction);
} }
interface View extends IBaseView { interface View extends IBaseView {
void getPro(List<ProductBean.RecordsBean> dataList); void getPro(List<ProductBean.RecordsBean> dataList);
void modify(String msg);
void onSale(String msg);
} }
interface Presenter extends IBasePresenter<View> { interface Presenter extends IBasePresenter<View> {
void getPro(Map<String, Object> param); void getPro(Map<String, Object> param);
void modify(Integer id, String internalPrice, String remark);
void onSale(Integer id, String shelfAction);
} }
} }
...@@ -3,7 +3,9 @@ package com.wd.workoffice.model; ...@@ -3,7 +3,9 @@ package com.wd.workoffice.model;
import com.wd.workoffice.app.BaseBean; import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.contract.WorkProContract; import com.wd.workoffice.contract.WorkProContract;
import com.wd.workoffice.retrofit.RtfUtils; import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.util.WorkUtils;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
...@@ -19,6 +21,23 @@ public class WorkProModel implements WorkProContract.Model { ...@@ -19,6 +21,23 @@ public class WorkProModel implements WorkProContract.Model {
return RtfUtils.getRtf().getPro(param); return RtfUtils.getRtf().getPro(param);
} }
@Override
public Observable<BaseBean> modify(Integer id, String internalPrice, String remark) {
Map<String,Object> param =new HashMap<>();
param.put("id",id);
param.put("internalPrice",internalPrice);
param.put("remark",remark);
return RtfUtils.getRtf().modifyProPrice( WorkUtils.convertMapToBody(param));
}
@Override
public Observable<BaseBean> onSale(Integer id, String shelfAction) {
Map<String,Object> param =new HashMap<>();
param.put("id",id);
param.put("shelfAction",shelfAction);
return RtfUtils.getRtf().onSalePro(WorkUtils.convertMapToBody(param));
}
public static WorkProModel newInstance() { public static WorkProModel newInstance() {
return new WorkProModel(); return new WorkProModel();
} }
......
...@@ -48,6 +48,60 @@ public class WorkProPresenter extends BasePresenter<WorkProContract.View, WorkPr ...@@ -48,6 +48,60 @@ public class WorkProPresenter extends BasePresenter<WorkProContract.View, WorkPr
}); });
} }
@Override
public void modify(Integer id, String internalPrice, String remark) {
mView.showLoading();
mModel.modify(id, internalPrice, remark).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
mDisposable.add(d);
}
@Override
public void onFail(String errorMsg) {
mView.hideLoading();
mView.onError(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
mView.hideLoading();
if (data.getCode() != 0) {
mView.onError(data.getMessage());
return;
}
mView.modify(data.getMessage());
}
});
}
@Override
public void onSale(Integer id, String shelfAction) {
mView.showLoading();
mModel.onSale(id, shelfAction).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
mDisposable.add(d);
}
@Override
public void onFail(String errorMsg) {
mView.hideLoading();
mView.onError(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
mView.hideLoading();
if (data.getCode() != 0) {
mView.onError(data.getMessage());
return;
}
mView.onSale(data.getMessage());
}
});
}
@Override @Override
public WorkProContract.Model bindModel() { public WorkProContract.Model bindModel() {
return WorkProModel.newInstance(); return WorkProModel.newInstance();
......
...@@ -225,8 +225,8 @@ public interface ApiService { ...@@ -225,8 +225,8 @@ public interface ApiService {
/** /**
* 根据往来单位的类别 获取当前用户所维护的往来单位列表 * 根据往来单位的类别 获取当前用户所维护的往来单位列表
* *
* @param name * name
* @param partTypeCode partTypeCode:SUPPLIER-供应商 * partTypeCode partTypeCode:SUPPLIER-供应商
* * CUSTOMER-客户 * * CUSTOMER-客户
* * TRANSPORTERS-运输商 * * TRANSPORTERS-运输商
* @return * @return
...@@ -237,8 +237,8 @@ public interface ApiService { ...@@ -237,8 +237,8 @@ public interface ApiService {
/** /**
* 根据关联往来单位(类别为客户)和生产厂(产品上架部门) --> 获取产品列表 * 根据关联往来单位(类别为客户)和生产厂(产品上架部门) --> 获取产品列表
* *
* @param outDeptId * outDeptId
* @param transitPartId 销售订单(客户id),外采购订单(供应商id) * transitPartId 销售订单(客户id),外采购订单(供应商id)
* <p> * <p>
* processType 销售流程PROCESS_SALE * processType 销售流程PROCESS_SALE
* 外采购流程PROCESS_PURCHAS * 外采购流程PROCESS_PURCHAS
...@@ -250,9 +250,9 @@ public interface ApiService { ...@@ -250,9 +250,9 @@ public interface ApiService {
/** /**
* 仓库 * 仓库
* *
* @param deptId * deptId
* @param customerId * customerId
* @param sign 固定值send * sign 固定值send
* 供应 参数是3个 * 供应 参数是3个
* 坩埚的话 内部交易一个参数 deptId * 坩埚的话 内部交易一个参数 deptId
* @return * @return
...@@ -272,14 +272,14 @@ public interface ApiService { ...@@ -272,14 +272,14 @@ public interface ApiService {
/** /**
* 订单 * 订单
* *
* @param orderStatus app端订单筛选: * orderStatus app端订单筛选:
* 100:待审核 * 100:待审核
* 200:待接单 * 200:待接单
* 710: 待生产 (已接单、申请提前结束) * 710: 待生产 (已接单、申请提前结束)
* 500:已入库 * 500:已入库
* 600: 已交付 * 600: 已交付
* 960:已关闭 (审核失败、已拒单、已提前结束) * 960:已关闭 (审核失败、已拒单、已提前结束)
* @param identity 1:作为买家(销售部门) 2:作为卖家(生产部门) * identity 1:作为买家(销售部门) 2:作为卖家(生产部门)
* @return * @return
*/ */
@GET("/saleOrder/current-user/page/list") @GET("/saleOrder/current-user/page/list")
...@@ -288,14 +288,14 @@ public interface ApiService { ...@@ -288,14 +288,14 @@ public interface ApiService {
/** /**
* 外采购订单 * 外采购订单
* *
* @param orderStatus app端订单筛选: * orderStatus app端订单筛选:
* 100:待审核 * 100:待审核
* 200:待接单 * 200:待接单
* 300 + 410 = 710: 待生产 (已接单、申请提前结束) * 300 + 410 = 710: 待生产 (已接单、申请提前结束)
* 500:已入库 * 500:已入库
* 600: 已交付 * 600: 已交付
* 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束) * 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束)
* @param identity 1:作为买家(销售部门) 2:作为卖家(生产部门) * identity 1:作为买家(销售部门) 2:作为卖家(生产部门)
* @return * @return
*/ */
@GET("/purchaseOrder/current-user/page/list") @GET("/purchaseOrder/current-user/page/list")
...@@ -304,14 +304,14 @@ public interface ApiService { ...@@ -304,14 +304,14 @@ public interface ApiService {
/** /**
* 内部 * 内部
* *
* @param orderStatus app端订单筛选: * orderStatus app端订单筛选:
* 100:待审核 * 100:待审核
* 200:待接单 * 200:待接单
* 300 + 410 = 710: 待生产 (已接单、申请提前结束) * 300 + 410 = 710: 待生产 (已接单、申请提前结束)
* 500:已入库 * 500:已入库
* 600: 已交付 * 600: 已交付
* 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束) * 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束)
* @param identity 1:作为买家(销售部门) 2:作为卖家(生产部门) * identity 1:作为买家(销售部门) 2:作为卖家(生产部门)
* @return * @return
*/ */
@GET("/insideOrder/current-user/page/list") @GET("/insideOrder/current-user/page/list")
...@@ -320,13 +320,13 @@ public interface ApiService { ...@@ -320,13 +320,13 @@ public interface ApiService {
/** /**
* 供应订单 * 供应订单
* *
* @param orderStatus app端订单筛选: * orderStatus app端订单筛选:
* 100:待审核 * 100:待审核
* 200:待接单 * 200:待接单
* 300 + 410 = 710: 待生产 (已接单、申请提前结束) * 300 + 410 = 710: 待生产 (已接单、申请提前结束)
* 500:已入库 * 500:已入库
* 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束) * 220 + 320 + 420 = 960 :已关闭 (审核失败、已拒单、已提前结束)
* @param identity 1:作为买家(销售部门) 2:作为卖家(生产部门) * identity 1:作为买家(销售部门) 2:作为卖家(生产部门)
* @return * @return
*/ */
@GET("/supplierOrder/current-user/page/list") @GET("/supplierOrder/current-user/page/list")
...@@ -376,4 +376,26 @@ public interface ApiService { ...@@ -376,4 +376,26 @@ public interface ApiService {
@GET("/product-price-change/page/list") @GET("/product-price-change/page/list")
Observable<BaseBean> getProHistoryPrice(@QueryMap Map<String, Object> param); Observable<BaseBean> getProHistoryPrice(@QueryMap Map<String, Object> param);
/**
* 产品详情
* internalPrice 价格(内部价格)
* id
* remark
*
* @return
*/
@PUT("/product/price")
Observable<BaseBean> modifyProPrice(@Body RequestBody requestBody);
/**
* 上下架
* shelfAction
* id
*
*
* @return
*/
@PUT("/product/app/shelf")
Observable<BaseBean> onSalePro(@Body RequestBody requestBody);
} }
...@@ -117,7 +117,6 @@ public class StoreSaleProductActivity extends WorkToolBarActivity { ...@@ -117,7 +117,6 @@ public class StoreSaleProductActivity extends WorkToolBarActivity {
} }
}); });
addCartDialog.show(); addCartDialog.show();
} }
/** /**
......
package com.wd.workoffice.ui.activity.bat.work; package com.wd.workoffice.ui.activity.bat.work;
import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity; import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.ClientBean;
import com.wd.workoffice.bean.ProDetail; import com.wd.workoffice.bean.ProDetail;
import com.wd.workoffice.bean.ProductBean; import com.wd.workoffice.bean.ProductBean;
import com.wd.workoffice.retrofit.RtfUtils; import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver; import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.util.WorkUtils;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -70,6 +70,10 @@ public class WorkProDetailActivity extends WorkToolBarActivity { ...@@ -70,6 +70,10 @@ public class WorkProDetailActivity extends WorkToolBarActivity {
TextView tvDepPersonPhone; TextView tvDepPersonPhone;
@BindView(R.id.tv_dep_person_dep) @BindView(R.id.tv_dep_person_dep)
TextView tvDepPersonDep; TextView tvDepPersonDep;
@BindView(R.id.ll_on_sale)
LinearLayout llOnSale;
@BindView(R.id.ll_dep)
LinearLayout llDep;
private ProductBean.RecordsBean proBean; private ProductBean.RecordsBean proBean;
@Override @Override
...@@ -84,16 +88,16 @@ public class WorkProDetailActivity extends WorkToolBarActivity { ...@@ -84,16 +88,16 @@ public class WorkProDetailActivity extends WorkToolBarActivity {
proBean = JSON.parseObject(pro, ProductBean.RecordsBean.class); proBean = JSON.parseObject(pro, ProductBean.RecordsBean.class);
getData(proBean.getId()); getData(proBean.getId());
tvCard.setText(proBean.getSoleCode()); tvCard.setText(proBean.getSoleCode());
// tvImgCard.setText(proBean.get()); tvImgCard.setText(proBean.getSimpleCode());
tvName.setText(proBean.getName()); tvName.setText(proBean.getName());
tvSpec.setText(proBean.getSpec()); tvSpec.setText(proBean.getSpec());
tvClazz.setText(proBean.getProcessType()); tvClazz.setText(proBean.getProductTypeName());
tvKind.setText(proBean.getTransitPartTypeCode()); tvKind.setText(proBean.getOfKind());
tvUnit.setText(proBean.getUnit()); tvUnit.setText(proBean.getUnit());
tvWeight.setText(String.valueOf(proBean.getWeight())); tvWeight.setText(String.valueOf(proBean.getWeight()));
tvPrice.setText(String.valueOf(proBean.getInternalPrice())); tvPrice.setText(String.valueOf(proBean.getInternalPrice()));
tvStatus.setText(proBean.getStatusName()); tvStatus.setText(TextUtils.equals(proBean.getStatus(), "1") ? "正常" : "冻结");
tvProcess.setText(proBean.getProcessType());
} }
} }
...@@ -116,13 +120,24 @@ public class WorkProDetailActivity extends WorkToolBarActivity { ...@@ -116,13 +120,24 @@ public class WorkProDetailActivity extends WorkToolBarActivity {
toast(data.getMessage()); toast(data.getMessage());
return; return;
} }
// ProDetail.DataBean.ProductInfoBean productInfo = data.getData().getProductInfo(); ProDetail.DataBean info = data.getData();
// tvDep.setText(productInfo.getdep()); if (info.getOutDeptRelList() != null && info.getOutDeptRelList().size() != 0) {
// tvDepName.setText(productInfo.getName()); tvDep.setText(info.getOutDeptRelList().get(0).getDeptName());
// tvDepType.setText("类别:"+productInfo.getTransitPartTypeCode()); llOnSale.setVisibility(View.VISIBLE);
// tvDepType.setText("地址:"+productInfo.get; }
// tvDepType.setText(""+productInfo.getName()); if (info.getTransitPartRelList() != null && info.getTransitPartRelList().size() != 0) {
// tvDepName.setText(productInfo.getName()); ProDetail.DataBean.TransitPartRelListBean depData = info.getTransitPartRelList().get(0);
llDep.setVisibility(View.VISIBLE);
tvDepName.setText(depData.getName());
tvDepType.setText("类别:" + WorkUtils.getClientType(depData.getPartTypeCode()));
tvDepAddress.setText("地址:" + depData.getAddress());
tvDepPrice.setText("渠道价格:" + (depData.getChannelPrice() == null ? "无" : String.valueOf(depData.getChannelPrice())));
tvDepPerson.setText("维护人:" + depData.getAccountName());
tvDepPersonPhone.setText("维护人手机号:" + depData.getPhone());
tvDepPersonDep.setText("维护部门:" + depData.getDeptName());
}
//
// transitPartRelList 往来单位关联 // transitPartRelList 往来单位关联
// * partTypeCode: SUPPLIER-供应商 CUSTOMER-客户 TRANSPORTERS-运输商 // * partTypeCode: SUPPLIER-供应商 CUSTOMER-客户 TRANSPORTERS-运输商
// * name:往来单位名称 // * name:往来单位名称
...@@ -149,6 +164,7 @@ public class WorkProDetailActivity extends WorkToolBarActivity { ...@@ -149,6 +164,7 @@ public class WorkProDetailActivity extends WorkToolBarActivity {
@OnClick(R.id.btn_price) @OnClick(R.id.btn_price)
public void onViewClicked() { public void onViewClicked() {
startActivity(WorkProPriceActivity.class, "id", proBean.getId()+""); startActivity(WorkProPriceActivity.class, "id", proBean.getId() + "");
} }
} }
...@@ -168,4 +168,14 @@ public class WorkProSearchActivity extends WorkBaseActivity implements WorkProCo ...@@ -168,4 +168,14 @@ public class WorkProSearchActivity extends WorkBaseActivity implements WorkProCo
} }
} }
@Override
public void modify(String msg) {
}
@Override
public void onSale(String msg) {
}
} }
...@@ -22,7 +22,7 @@ public class WorkProductAdapter extends BaseQuickAdapter<ProductBean.RecordsBean ...@@ -22,7 +22,7 @@ public class WorkProductAdapter extends BaseQuickAdapter<ProductBean.RecordsBean
protected void convert(BaseViewHolder helper, ProductBean.RecordsBean item) { protected void convert(BaseViewHolder helper, ProductBean.RecordsBean item) {
helper.setText(R.id.tv_name, item.getSimpleCode()); helper.setText(R.id.tv_name, item.getSimpleCode());
helper.setText(R.id.tv_card, "品号:"+item.getSoleCode()); helper.setText(R.id.tv_card, "品号:"+item.getSoleCode());
// helper.setText(R.id.tv_img_card, "图号:"+item.get()); helper.setText(R.id.tv_img_card, "图号:"+item.getSimpleCode());
helper.setText(R.id.tv_spec, "规格:"+item.getSpec()); helper.setText(R.id.tv_spec, "规格:"+item.getSpec());
helper.setText(R.id.tv_price, "¥".concat(String.valueOf(item.getInternalPrice()))); helper.setText(R.id.tv_price, "¥".concat(String.valueOf(item.getInternalPrice())));
helper.addOnClickListener(R.id.btn_modify); helper.addOnClickListener(R.id.btn_modify);
......
...@@ -2,7 +2,10 @@ package com.wd.workoffice.ui.fg; ...@@ -2,7 +2,10 @@ package com.wd.workoffice.ui.fg;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
...@@ -18,6 +21,7 @@ import com.wd.workoffice.ui.activity.bat.work.WorkProDetailActivity; ...@@ -18,6 +21,7 @@ import com.wd.workoffice.ui.activity.bat.work.WorkProDetailActivity;
import com.wd.workoffice.ui.adapter.WorkProductAdapter; import com.wd.workoffice.ui.adapter.WorkProductAdapter;
import com.wd.workoffice.util.ProFilterData; import com.wd.workoffice.util.ProFilterData;
import com.wd.workoffice.util.WorkUtils; import com.wd.workoffice.util.WorkUtils;
import com.wd.workoffice.widget.AddAndReduceView;
import com.wd.workoffice.widget.DropDownMenu; import com.wd.workoffice.widget.DropDownMenu;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -25,6 +29,7 @@ import java.util.List; ...@@ -25,6 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -138,6 +143,90 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View ...@@ -138,6 +143,90 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View
startActivity(WorkProDetailActivity.class, "pro", JSON.toJSONString(dataList.get(position))); startActivity(WorkProDetailActivity.class, "pro", JSON.toJSONString(dataList.get(position)));
} }
}); });
workProductAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
switch (view.getId()) {
case R.id.btn_modify:
openModify(dataList.get(position).getId());
break;
case R.id.btn_on_sale:
openOnSale(dataList.get(position));
break;
}
}
});
}
/**
* 修改弹窗
*
* @param id
*/
private void openModify(int id) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_pro_modify_price, null);
TextView tvOk = view.findViewById(R.id.tv_ok);
TextView tvCancel = view.findViewById(R.id.tv_cancel);
EditText etPrice = view.findViewById(R.id.et_price);
EditText etRemark = view.findViewById(R.id.et_remark);
builder.setView(view);
AlertDialog addCartDialog = builder.create();
tvOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(etPrice.getText().toString())) {
toast("请填写内部价格");
return;
}
if (TextUtils.isEmpty(etRemark.getText().toString())) {
toast("请填写备注");
return;
}
workProPresenter.modify(id, etPrice.getText().toString(), etRemark.getText().toString());
addCartDialog.dismiss();
}
});
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addCartDialog.dismiss();
}
});
addCartDialog.show();
}
/**
* 修改上下架
*
* @param data
*/
private void openOnSale(ProductBean.RecordsBean data) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_pro_on_sale, null);
TextView tvOk = view.findViewById(R.id.tv_ok);
TextView tvCancel = view.findViewById(R.id.tv_cancel);
TextView tvTitle = view.findViewById(R.id.tv_title);
TextView tvPrice = view.findViewById(R.id.tv_price);
TextView tvName = view.findViewById(R.id.tv_name);
tvPrice.setText(String.valueOf(data.getInternalPrice()).concat("/").concat(data.getUnit()));
tvName.setText(data.getName());
builder.setView(view);
AlertDialog addCartDialog = builder.create();
tvOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
workProPresenter.onSale(data.getId(),"down");
addCartDialog.dismiss();
}
});
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addCartDialog.dismiss();
}
});
addCartDialog.show();
} }
@Override @Override
...@@ -165,4 +254,16 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View ...@@ -165,4 +254,16 @@ public class WorkProFragment extends WorkBaseFg implements WorkProContract.View
page++; page++;
} }
} }
@Override
public void modify(String msg) {
page = 1;
workProPresenter.getPro(param);
toast(msg);
}
@Override
public void onSale(String msg) {
toast(msg);
}
} }
...@@ -6,6 +6,7 @@ import android.database.Cursor; ...@@ -6,6 +6,7 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.text.TextUtils;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -29,22 +30,41 @@ public class WorkUtils { ...@@ -29,22 +30,41 @@ public class WorkUtils {
/** /**
* 将map数据转换为 普通的 json RequestBody * 将map数据转换为 普通的 json RequestBody
*
* @param map 以前的请求参数 * @param map 以前的请求参数
* @return * @return
*/ */
public static RequestBody convertMapToBody(Map<?,?> map) { public static RequestBody convertMapToBody(Map<?, ?> map) {
return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), JSON.toJSONString(map)); return RequestBody.create(MediaType.parse("application/json; charset=utf-8"), JSON.toJSONString(map));
} }
public static Map<String, Object> simpleParam() { public static Map<String, Object> simpleParam() {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
return param; return param;
} }
public static Map<String, Object> pageKey() { public static Map<String, Object> pageKey() {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("size", Config.SIZE); param.put("size", Config.SIZE);
return param; return param;
} }
/**
* code: SUPPLIER-供应商 CUSTOMER-客户 TRANSPORTERS-运输商
*
* @param code
* @return
*/
public static String getClientType(String code) {
if (TextUtils.equals("SUPPLIER", code)) {
return "供应商";
} else if (TextUtils.equals("CUSTOMER", code)) {
return "客户";
} else {
return "运输商";
}
}
public static File uriToFile(Uri uri, Context context) { public static File uriToFile(Uri uri, Context context) {
String path = null; String path = null;
if ("file".equals(uri.getScheme())) { if ("file".equals(uri.getScheme())) {
...@@ -115,12 +135,13 @@ public class WorkUtils { ...@@ -115,12 +135,13 @@ public class WorkUtils {
@Override @Override
public void onTick(long millisUntilFinished) { public void onTick(long millisUntilFinished) {
if (code == 0) { if (code == 0) {
txtTime.setText("( "+String.valueOf(millisUntilFinished / JianGe) + " )"); txtTime.setText("( " + String.valueOf(millisUntilFinished / JianGe) + " )");
txtTime.setTextColor(WorkApp.getApp().getResources().getColor(R.color.flexible_text_gray)); txtTime.setTextColor(WorkApp.getApp().getResources().getColor(R.color.flexible_text_gray));
} else { } else {
txtTime.setText("跳过 " + String.valueOf(millisUntilFinished / JianGe) + "s"); txtTime.setText("跳过 " + String.valueOf(millisUntilFinished / JianGe) + "s");
} }
} }
@Override @Override
public void onFinish() { public void onFinish() {
if (code == 0) { if (code == 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论