提交 71b0faa8 authored 作者: lgd's avatar lgd

1.bat页面商店第一个页面,产品页面展示

2.//TODO erp用户激活,忘记密码测试,bat,mes,消息,我的,刷新token
上级 2cc94808
...@@ -103,5 +103,5 @@ dependencies { ...@@ -103,5 +103,5 @@ dependencies {
implementation 'com.github.tbruyelle:rxpermissions:0.10.2' implementation 'com.github.tbruyelle:rxpermissions:0.10.2'
implementation 'com.ashokvarma.android:bottom-navigation-bar:2.2.0' implementation 'com.ashokvarma.android:bottom-navigation-bar:2.2.0'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.45-androidx' implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.45-androidx'
implementation 'com.qmuiteam:qmui:1.4.0' implementation 'com.qmuiteam:qmui:2.0.0-alpha04'
} }
...@@ -113,6 +113,14 @@ ...@@ -113,6 +113,14 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Work.Base" android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.StoreSaleProductActivity"
android:configChanges="keyboardHidden|orientation"
android:label="选择产品"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider" android:authorities="com.wd.workoffice.fileprovider"
......
package com.wd.workoffice.bean;
import java.util.List;
public class ProductBean {
/**
* code : 0
* message : null
* data : {"records":[{"createdBy":111,"createdByName":null,"createdTime":"2019-10-30 17:42:02","updatedBy":111,"updatedByName":null,"updatedTime":"2020-02-24 09:46:45","id":29,"soleCode":"70BHZBHZ1-1001","simpleCode":"BHZ1-1","name":"保护渣","spec":"165*320(Q195)","unit":"支","weight":1000,"internalPrice":105.9,"processType":"PROCESS_SALE,PROCESS_CRUCIBLE,PROCESS_SUPPLY","processTypeList":null,"productTypeId":5,"ofKind":"SM","expectOutputDeptId":118,"erpId":"AG10086","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":null,"expectOutputDeptName":null,"isExpectOut":null,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null},{"createdBy":143,"createdByName":null,"createdTime":"2019-12-30 16:04:46","updatedBy":143,"updatedByName":null,"updatedTime":"2019-12-31 13:41:43","id":33,"soleCode":"白刚玉","simpleCode":"白刚玉","name":"白刚玉","spec":"80#","unit":"吨","weight":2,"internalPrice":100,"processType":"PROCESS_PURCHASE,PROCESS_SALE,PROCESS_SUPPLY,PROCESS_CRUCIBLE","processTypeList":null,"productTypeId":3,"ofKind":"OS","expectOutputDeptId":129,"erpId":"白刚玉","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":null,"expectOutputDeptName":null,"isExpectOut":null,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null}],"total":2,"size":10,"current":1,"orders":[],"searchCount":true,"pages":1}
* httpStatus : 0
* path : null
* ext : null
*/
/**
* records : [{"createdBy":111,"createdByName":null,"createdTime":"2019-10-30 17:42:02","updatedBy":111,"updatedByName":null,"updatedTime":"2020-02-24 09:46:45","id":29,"soleCode":"70BHZBHZ1-1001","simpleCode":"BHZ1-1","name":"保护渣","spec":"165*320(Q195)","unit":"支","weight":1000,"internalPrice":105.9,"processType":"PROCESS_SALE,PROCESS_CRUCIBLE,PROCESS_SUPPLY","processTypeList":null,"productTypeId":5,"ofKind":"SM","expectOutputDeptId":118,"erpId":"AG10086","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":null,"expectOutputDeptName":null,"isExpectOut":null,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null},{"createdBy":143,"createdByName":null,"createdTime":"2019-12-30 16:04:46","updatedBy":143,"updatedByName":null,"updatedTime":"2019-12-31 13:41:43","id":33,"soleCode":"白刚玉","simpleCode":"白刚玉","name":"白刚玉","spec":"80#","unit":"吨","weight":2,"internalPrice":100,"processType":"PROCESS_PURCHASE,PROCESS_SALE,PROCESS_SUPPLY,PROCESS_CRUCIBLE","processTypeList":null,"productTypeId":3,"ofKind":"OS","expectOutputDeptId":129,"erpId":"白刚玉","status":"1","createdUser":null,"shelfAction":null,"updatedUser":null,"outDeptId":null,"outDeptName":null,"productTypeName":null,"expectOutputDeptName":null,"isExpectOut":null,"ofKindName":null,"statusName":null,"relList":null,"outDeptCreatedBy":null,"outDeptCreatedTime":null,"transitPartId":null,"transitPartTypeCode":null,"remark":null}]
* total : 2
* size : 10
* current : 1
* orders : []
* searchCount : true
* pages : 1
*/
private int total;
private int size;
private int current;
private boolean searchCount;
private int pages;
private List<RecordsBean> records;
private List<?> orders;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
public boolean isSearchCount() {
return searchCount;
}
public void setSearchCount(boolean searchCount) {
this.searchCount = searchCount;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public List<RecordsBean> getRecords() {
return records;
}
public void setRecords(List<RecordsBean> records) {
this.records = records;
}
public List<?> getOrders() {
return orders;
}
public void setOrders(List<?> orders) {
this.orders = orders;
}
public static class RecordsBean {
/**
* createdBy : 111
* createdByName : null
* createdTime : 2019-10-30 17:42:02
* updatedBy : 111
* updatedByName : null
* updatedTime : 2020-02-24 09:46:45
* id : 29
* soleCode : 70BHZBHZ1-1001
* simpleCode : BHZ1-1
* name : 保护渣
* spec : 165*320(Q195)
* unit : 支
* weight : 1000.0
* internalPrice : 105.9
* processType : PROCESS_SALE,PROCESS_CRUCIBLE,PROCESS_SUPPLY
* processTypeList : null
* productTypeId : 5
* ofKind : SM
* expectOutputDeptId : 118
* erpId : AG10086
* status : 1
* createdUser : null
* shelfAction : null
* updatedUser : null
* outDeptId : null
* outDeptName : null
* productTypeName : null
* expectOutputDeptName : null
* isExpectOut : null
* ofKindName : null
* statusName : null
* relList : null
* outDeptCreatedBy : null
* outDeptCreatedTime : null
* transitPartId : null
* transitPartTypeCode : null
* remark : null
*/
private int createdBy;
private Object createdByName;
private String createdTime;
private int updatedBy;
private Object updatedByName;
private String updatedTime;
private int id;
private String soleCode;
private String simpleCode;
private String name;
private String spec;
private String unit;
private double weight;
private double internalPrice;
private String processType;
private Object processTypeList;
private int productTypeId;
private String ofKind;
private int expectOutputDeptId;
private String erpId;
private String status;
private Object createdUser;
private Object shelfAction;
private Object updatedUser;
private Object outDeptId;
private Object outDeptName;
private Object productTypeName;
private Object expectOutputDeptName;
private Object isExpectOut;
private Object ofKindName;
private Object statusName;
private Object relList;
private Object outDeptCreatedBy;
private Object outDeptCreatedTime;
private Object transitPartId;
private Object transitPartTypeCode;
private Object remark;
public int getCreatedBy() {
return createdBy;
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public int getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(int updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public String getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSoleCode() {
return soleCode;
}
public void setSoleCode(String soleCode) {
this.soleCode = soleCode;
}
public String getSimpleCode() {
return simpleCode;
}
public void setSimpleCode(String simpleCode) {
this.simpleCode = simpleCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public double getInternalPrice() {
return internalPrice;
}
public void setInternalPrice(double internalPrice) {
this.internalPrice = internalPrice;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public Object getProcessTypeList() {
return processTypeList;
}
public void setProcessTypeList(Object processTypeList) {
this.processTypeList = processTypeList;
}
public int getProductTypeId() {
return productTypeId;
}
public void setProductTypeId(int productTypeId) {
this.productTypeId = productTypeId;
}
public String getOfKind() {
return ofKind;
}
public void setOfKind(String ofKind) {
this.ofKind = ofKind;
}
public int getExpectOutputDeptId() {
return expectOutputDeptId;
}
public void setExpectOutputDeptId(int expectOutputDeptId) {
this.expectOutputDeptId = expectOutputDeptId;
}
public String getErpId() {
return erpId;
}
public void setErpId(String erpId) {
this.erpId = erpId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Object getCreatedUser() {
return createdUser;
}
public void setCreatedUser(Object createdUser) {
this.createdUser = createdUser;
}
public Object getShelfAction() {
return shelfAction;
}
public void setShelfAction(Object shelfAction) {
this.shelfAction = shelfAction;
}
public Object getUpdatedUser() {
return updatedUser;
}
public void setUpdatedUser(Object updatedUser) {
this.updatedUser = updatedUser;
}
public Object getOutDeptId() {
return outDeptId;
}
public void setOutDeptId(Object outDeptId) {
this.outDeptId = outDeptId;
}
public Object getOutDeptName() {
return outDeptName;
}
public void setOutDeptName(Object outDeptName) {
this.outDeptName = outDeptName;
}
public Object getProductTypeName() {
return productTypeName;
}
public void setProductTypeName(Object productTypeName) {
this.productTypeName = productTypeName;
}
public Object getExpectOutputDeptName() {
return expectOutputDeptName;
}
public void setExpectOutputDeptName(Object expectOutputDeptName) {
this.expectOutputDeptName = expectOutputDeptName;
}
public Object getIsExpectOut() {
return isExpectOut;
}
public void setIsExpectOut(Object isExpectOut) {
this.isExpectOut = isExpectOut;
}
public Object getOfKindName() {
return ofKindName;
}
public void setOfKindName(Object ofKindName) {
this.ofKindName = ofKindName;
}
public Object getStatusName() {
return statusName;
}
public void setStatusName(Object statusName) {
this.statusName = statusName;
}
public Object getRelList() {
return relList;
}
public void setRelList(Object relList) {
this.relList = relList;
}
public Object getOutDeptCreatedBy() {
return outDeptCreatedBy;
}
public void setOutDeptCreatedBy(Object outDeptCreatedBy) {
this.outDeptCreatedBy = outDeptCreatedBy;
}
public Object getOutDeptCreatedTime() {
return outDeptCreatedTime;
}
public void setOutDeptCreatedTime(Object outDeptCreatedTime) {
this.outDeptCreatedTime = outDeptCreatedTime;
}
public Object getTransitPartId() {
return transitPartId;
}
public void setTransitPartId(Object transitPartId) {
this.transitPartId = transitPartId;
}
public Object getTransitPartTypeCode() {
return transitPartTypeCode;
}
public void setTransitPartTypeCode(Object transitPartTypeCode) {
this.transitPartTypeCode = transitPartTypeCode;
}
public Object getRemark() {
return remark;
}
public void setRemark(Object remark) {
this.remark = remark;
}
}
}
...@@ -232,4 +232,18 @@ public interface ApiService { ...@@ -232,4 +232,18 @@ public interface ApiService {
*/ */
@GET("/transitpart/page/list/current-user/part-type") @GET("/transitpart/page/list/current-user/part-type")
Observable<BaseBean> getClient(@QueryMap Map<String, Object> param); Observable<BaseBean> getClient(@QueryMap Map<String, Object> param);
/**
* 根据关联往来单位(类别为客户)和生产厂(产品上架部门) --> 获取产品列表
*
* @param outDeptId
* @param transitPartId 销售订单(客户id),外采购订单(供应商id)
*
* processType 销售流程PROCESS_SALE
* 外采购流程PROCESS_PURCHAS
* @return
*/
@GET("product/page/list/by/outDept/transit-part")
Observable<BaseBean> getProductList(@QueryMap Map<String, Object> param);
} }
...@@ -24,9 +24,12 @@ import butterknife.BindView; ...@@ -24,9 +24,12 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
/* /**
* 商店-销售 * 商店-销售
*/ * author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleContract.View { public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleContract.View {
@BindView(R.id.tv_client) @BindView(R.id.tv_client)
...@@ -52,7 +55,7 @@ public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleCon ...@@ -52,7 +55,7 @@ public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleCon
List<String> depNameList = new ArrayList<>(); List<String> depNameList = new ArrayList<>();
private DepBean chooseDep; private DepBean chooseDep;
private Integer clientId; private Integer clientId;
private List<String> processNameList=new ArrayList<>(); private List<String> processNameList = new ArrayList<>();
private List<ProcessBean> processList; private List<ProcessBean> processList;
private ProcessBean chooseProcess; private ProcessBean chooseProcess;
...@@ -109,6 +112,9 @@ public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleCon ...@@ -109,6 +112,9 @@ public class StoreSaleActivity extends WorkToolBarActivity implements BatSaleCon
toast("请选择子流程"); toast("请选择子流程");
return; return;
} }
startActivity(StoreSaleProductActivity.class, "depId", chooseDep.getId() + "",
"process", chooseProcess.getName(), "clientName", tvClient.getText().toString(),
"depName", chooseDep.getName());
break; break;
} }
} }
......
...@@ -27,10 +27,12 @@ import butterknife.ButterKnife; ...@@ -27,10 +27,12 @@ import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer; import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
/**
/*
* 商店-销售-选择客户 * 商店-销售-选择客户
*/ * author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class StoreSaleClientActivity extends WorkToolBarActivity { public class StoreSaleClientActivity extends WorkToolBarActivity {
@BindView(R.id.et_key) @BindView(R.id.et_key)
...@@ -131,6 +133,7 @@ public class StoreSaleClientActivity extends WorkToolBarActivity { ...@@ -131,6 +133,7 @@ public class StoreSaleClientActivity extends WorkToolBarActivity {
public void onViewClicked() { public void onViewClicked() {
param.put("name", etKey.getText().toString()); param.put("name", etKey.getText().toString());
param.put("current", 1); param.put("current", 1);
page=1;
getData(); getData();
} }
} }
package com.wd.workoffice.ui.activity.bat;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.ProcessBean;
import com.wd.workoffice.bean.ProductBean;
import com.wd.workoffice.bean.workEnum.PermissType;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.adapter.StoreProcductAdapter;
import com.wd.workoffice.util.WorkUtils;
import com.wd.workoffice.widget.AddAndReduceView;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* 商店-销售-产品
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class StoreSaleProductActivity extends WorkToolBarActivity {
@BindView(R.id.tv_order_type)
TextView tvOrderType;
@BindView(R.id.tv_factory)
TextView tvFactory;
@BindView(R.id.tv_process)
TextView tvProcess;
@BindView(R.id.tv_client)
TextView tvClient;
@BindView(R.id.tv_choose)
TextView tvChoose;
@BindView(R.id.et_key)
EditText etKey;
@BindView(R.id.btn_search)
Button btnSearch;
@BindView(R.id.rv_product)
RecyclerView rvProduct;
private Map<String, Object> param;
private List<ProductBean.RecordsBean> clientList;
private StoreProcductAdapter clientAdapter;
private int page = 1;
@Override
protected void initView() {
ButterKnife.bind(this);
rvProduct.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
tvClient.setText("客户名称:" + getIntent().getStringExtra("clientName"));
tvFactory.setText("厂家:" + getIntent().getStringExtra("depName"));
tvProcess.setText("订单流程:" + getIntent().getStringExtra("process"));
}
private void openDialog(ProductBean.RecordsBean recordsBean) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.view_add_cart, null);
TextView tvOk = view.findViewById(R.id.tv_ok);
TextView tvCancel = view.findViewById(R.id.tv_cancel);
AddAndReduceView num = view.findViewById(R.id.ar_num);
EditText etPrice = view.findViewById(R.id.et_price);
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;
}
addCart(recordsBean, num.getNumber(), etPrice.getText().toString());
addCartDialog.dismiss();
}
});
tvCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addCartDialog.dismiss();
}
});
addCartDialog.show();
}
/**
* 添加购物车
*
* @param chooseProduct 产品
* @param number 数量
* @param price 单价
*/
private void addCart(ProductBean.RecordsBean chooseProduct, int number, String price) {
}
@Override
protected void initData() {
clientList = new ArrayList<>();
clientAdapter = new StoreProcductAdapter(R.layout.item_store_product, clientList);
clientAdapter.bindToRecyclerView(rvProduct);
param = WorkUtils.pageKey();
param.put("current", 1);
param.put("processType", PermissType.PROCESS_SALE.getCode());
param.put("outDeptId", getIntent().getStringExtra("depId"));
// param.put("searchValue", "1");
getData();
}
private void getData() {
RtfUtils.getRtf().getProductList(param).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
List<ProductBean.RecordsBean> dataList = JSON.parseObject(data.getData().toString(), ProductBean.class).getRecords();
if (page == 1) {
clientList.clear();
clientList.addAll(dataList);
clientAdapter.notifyDataSetChanged();
clientAdapter.loadMoreComplete();
} else {
clientAdapter.loadMoreComplete();
clientList.addAll(dataList);
clientAdapter.notifyDataSetChanged();
}
if (dataList.size() == 0) {
clientAdapter.loadMoreEnd();
} else {
page++;
}
}
});
}
@Override
protected void initEvent() {
clientAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
param.put("current", page);
getData();
}
}, rvProduct);
clientAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
openDialog(clientList.get(position));
}
});
}
@Override
protected int layoutId() {
return R.layout.activity_bat_sale_product;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_store_cart, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.cart:
break;
}
return super.onOptionsItemSelected(item);
}
@OnClick({R.id.tv_choose, R.id.btn_search})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_choose:
finish();
break;
case R.id.btn_search:
param.put("name", etKey.getText().toString());
param.put("current", 1);
page = 1;
getData();
break;
}
}
}
package com.wd.workoffice.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.ClientBean;
import com.wd.workoffice.bean.ProductBean;
import java.util.List;
/**
* Created by flexible on 2018/8/13.
*/
public class StoreProcductAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, BaseViewHolder> {
public StoreProcductAdapter(int layoutResId, List data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, ProductBean.RecordsBean item) {
helper.setText(R.id.tv_name, item.getSimpleCode());
helper.setText(R.id.tv_card, item.getSoleCode());
helper.setText(R.id.tv_card_name, item.getName());
helper.setText(R.id.tv_spec, item.getSpec());
helper.setText(R.id.tv_price, "¥".concat(String.valueOf(item.getInternalPrice())));
helper.setText(R.id.tv_unit, String.valueOf(item.getWeight()).concat("吨"));
helper.addOnClickListener(R.id.tv_cart);
}
}
...@@ -10,7 +10,6 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog; ...@@ -10,7 +10,6 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
* github: https://github.com/FlexibleXd * github: https://github.com/FlexibleXd
**/ **/
public class DialogUtils { public class DialogUtils {
public static QMUIDialog.MenuDialogBuilder listDialog(Context context) { public static QMUIDialog.MenuDialogBuilder listDialog(Context context) {
QMUIDialog.MenuDialogBuilder dialog = new QMUIDialog.MenuDialogBuilder(context); QMUIDialog.MenuDialogBuilder dialog = new QMUIDialog.MenuDialogBuilder(context);
return dialog; return dialog;
......
package com.wd.workoffice.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.wd.workoffice.R;
public class AddAndReduceView extends LinearLayout implements View.OnClickListener {
private final Button add;
private final Button remove;
private final TextView tvNum;
private int num = 1;
public AddAndReduceView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.view_add_remove, this);
add = findViewById(R.id.btn_add);
remove = findViewById(R.id.btn_reduce);
tvNum = findViewById(R.id.tv_num);
add.setOnClickListener(this);
remove.setOnClickListener(this);
}
public void setNumber(int number) {
num = number;
tvNum.setText(number + "");
}
public int getNumber() {
return num;
}
@Override
public void onClick(View v) {
String s = tvNum.getText().toString();
num = Integer.parseInt(s);
switch (v.getId()) {
case R.id.btn_add:
num++;
tvNum.setText(num + "");
if (mOnNumberChangedListener != null)
mOnNumberChangedListener.OnNumberChanged(num);
break;
case R.id.btn_reduce:
if (num > 1) {
num--;
tvNum.setText(num + "");
if (mOnNumberChangedListener != null)
mOnNumberChangedListener.OnNumberChanged(num);
return;
//接口回调
} else {
Toast.makeText(getContext(), "不能小于1", Toast.LENGTH_SHORT).show();
}
break;
}
}
public interface OnNumberChangedListener {
void OnNumberChanged(int vs);
}
private OnNumberChangedListener mOnNumberChangedListener;
public void setOnNumberChangedListener(OnNumberChangedListener onNumberChangedListener) {
mOnNumberChangedListener = onNumberChangedListener;
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="#D8DCE6" android:width="1dp"/>
<solid android:color="#F8F8F8"/>
<corners android:radius="3dp"/>
</shape>
\ No newline at end of file
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<Button <Button
android:id="@+id/btn_search" android:id="@+id/btn_search"
android:layout_width="50mm" android:layout_width="60mm"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10mm" android:layout_marginLeft="10mm"
android:background="@color/mainTextColor" android:background="@color/mainTextColor"
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_order_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3mm" android:layout_marginTop="3mm"
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
android:id="@+id/tv_factory"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3mm" android:layout_marginTop="3mm"
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
android:id="@+id/tv_name3" android:id="@+id/tv_process"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3mm" android:layout_marginTop="3mm"
...@@ -58,6 +60,7 @@ ...@@ -58,6 +60,7 @@
android:layout_marginTop="3mm"> android:layout_marginTop="3mm">
<TextView <TextView
android:id="@+id/tv_client"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
...@@ -65,6 +68,7 @@ ...@@ -65,6 +68,7 @@
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
android:id="@+id/tv_choose"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
...@@ -117,7 +121,7 @@ ...@@ -117,7 +121,7 @@
<Button <Button
android:id="@+id/btn_search" android:id="@+id/btn_search"
android:layout_width="50mm" android:layout_width="60mm"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10mm" android:layout_marginLeft="10mm"
android:background="@color/mainTextColor" android:background="@color/mainTextColor"
...@@ -127,6 +131,8 @@ ...@@ -127,6 +131,8 @@
</LinearLayout> </LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_product"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginTop="10mm"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:paddingHorizontal="20mm"
android:paddingVertical="10mm">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="图号TH82739857"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="#FCFCFD"
android:orientation="vertical"
android:padding="10mm">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="品名"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_card_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="规格"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_spec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="内部单价"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="单位"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="品号"
android:textColor="@color/flexible_text_gray"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_cart"
android:layout_width="90mm"
android:layout_height="26mm"
android:layout_gravity="right"
android:layout_marginTop="10mm"
android:background="@mipmap/product_add_cart" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d1f8f8f8"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20mm"
android:gravity="center"
android:text="加入购物车"
android:textSize="17sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30mm"
android:orientation="horizontal"
android:paddingHorizontal="20mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="外部单价"
android:textColor="@color/flexible_text_sup"
android:textSize="17sp" />
<EditText
android:id="@+id/et_price"
android:layout_width="match_parent"
android:layout_height="30mm"
android:layout_marginLeft="10mm"
android:background="@drawable/shape_add_cart"
android:gravity="right"
android:hint="预计开票单价"
android:inputType="numberDecimal"
android:paddingVertical="4mm"
android:paddingHorizontal="10mm"
android:textColor="@color/flexible_text_sup"
android:textColorHint="#91ABBA"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25mm"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="20mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="购买数量"
android:textColor="@color/flexible_text_sup"
android:textSize="17sp" />
<com.wd.workoffice.widget.AddAndReduceView
android:id="@+id/ar_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10mm" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30mm"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingVertical="15mm"
android:text="取消"
android:textColor="#007AFF"
android:textSize="17sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#D8DCE6" />
<TextView
android:id="@+id/tv_ok"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingVertical="15mm"
android:text="确定"
android:textColor="#007AFF"
android:textSize="17sp" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_add_cart"
android:orientation="horizontal">
<Button
android:id="@+id/btn_reduce"
android:layout_width="35mm"
android:layout_height="30mm"
android:background="#D8DCE6"
android:text="-"
android:textColor="#666666"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_num"
android:layout_width="0dp"
android:layout_height="30mm"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="1"
android:textColor="#5C7589"
android:textSize="17sp" />
<Button
android:id="@+id/btn_add"
android:layout_width="35mm"
android:layout_height="30mm"
android:background="#D8DCE6"
android:text="+"
android:textColor="#666666"
android:textSize="17sp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/ok"
android:title="完成"
app:showAsAction="always" />
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/preview"
android:title="编辑资料"
app:showAsAction="always" />
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/cart"
android:title="购物车"
app:showAsAction="always" />
</menu>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论