Commit af566e4e by 罗翻

处理工单修改

parent 15b3c7f4
Showing with 678 additions and 91 deletions
......@@ -30,6 +30,9 @@
<color name="default_editext_color">#FF959595</color>
<color name="cl_line">#FFE3E3E3</color>
<color name="cl_bg">#FFF5F5F5</color>
<color name="tv_bg">#FFEFEFF4</color>
<color name="tv_cl">#FF888888</color>
<color name="common_red">#FF5A4B</color>
......
......@@ -20,7 +20,7 @@
<string name="tv_work_order_two">预约上门</string>
<string name="tv_work_order_three">我已出发</string>
<string name="tv_work_order_four">开始服务</string>
<string name="tv_work_order_five">服务记录</string>
<string name="tv_work_order_five">检测与方案</string>
<string name="tv_work_order_six">客户验收</string>
<string name="tv_person_center_name">暂无姓名</string>
<string name="tv_person_center_sex">性别:</string>
......@@ -59,11 +59,11 @@
<string name="item_restart">需要再次上门</string>
<string name="up_door_reason">上门原因</string>
<string name="wait">等待验收</string>
<string name="order_pm">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</string>
<string name="order_pm">产品</string>
<string name="order_pm_text">请输入产品类型</string>
<string name="order_pinpai">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</string>
<string name="order_pinpai">品牌</string>
<string name="order_pinpai_text">请输入品牌</string>
<string name="order_xinghao">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</string>
<string name="order_xinghao">型号</string>
<string name="order_xuliehaoma">序列号码</string>
<string name="order_goumai_date">购买日期</string>
<string name="order_serve_type">服务类型</string>
......@@ -298,6 +298,22 @@
<string name="other_money">其他费用</string>
<string name="remark">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</string>
<string name="no_charge_record">暂无收费记录</string>
<string name="order_brand_name">品牌名称</string>
<string name="order_product_model">型号</string>
<string name="order_product_model_hint">产品详细型号</string>
<string name="order_serail">序列号</string>
<string name="order_serail_hint">产品序列号</string>
<string name="order_payer">费用承担方</string>
<string name="order_select_payer">请选择费用承担方</string>
<string name="order_select_payer_notice">修改费用承担方可能会导致费用争议,请一定要确认清楚之后再操作</string>
<string name="order_payer_prove">费用承担证明</string>
<string name="server_info">服务信息</string>
<string name="payer_baonei">派单方承担(保内)</string>
<string name="payer_baowai">用户承担(保外)</string>
<string name="payer_dialog_content">您还没有选择费用承担方,请选择后再提交验收</string>
<string name="payer_dialog_title">未选择费用承担方</string>
<string name="payer_select_title">确认操作</string>
<string name="payer_select_content">您修改了费用承担方,可能会导致费用争议。修改后不能调整,确认此操作吗?</string>
<!--消息-->
......
......@@ -57,7 +57,7 @@ android {
}
greendao {
schemaVersion 2
schemaVersion 3
daoPackage 'com.dayu.order.greendao'
targetGenDir 'src/main/java'
}
......
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 2): knows all DAOs.
* Master of DAO (schema version 3): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 2;
public static final int SCHEMA_VERSION = 3;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......
......@@ -24,7 +24,7 @@ public class MyOpenHelper extends DaoMaster.OpenHelper {
public void onUpgrade(Database db, int oldVersion, int newVersion) {
if (oldVersion < newVersion) {
//更改过的实体类(新增的不用加) 更新UserDao文件 可以添加多个 XXDao.class 文件
// MigrationHelper.getInstance().migrate(db, OrderInfoDao.class);
MigrationHelper.getInstance().migrate(db, OrderInfoDao.class);
}
}
......
......@@ -35,10 +35,16 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
public final static Property MaterialCost = new Property(5, String.class, "materialCost", false, "materialCost");
public final static Property OtherPrice = new Property(6, String.class, "otherPrice", false, "otherPrice");
public final static Property OtherInfo = new Property(7, String.class, "otherInfo", false, "otherInfo");
public final static Property ImgPath = new Property(8, String.class, "imgPath", false, "IMG_PATH");
public final static Property BrandName = new Property(8, String.class, "brandName", false, "brandName");
public final static Property ProductModel = new Property(9, String.class, "productModel", false, "productModel");
public final static Property Sn = new Property(10, String.class, "sn", false, "sn");
public final static Property Payer = new Property(11, String.class, "payer", false, "payer");
public final static Property ImgPath = new Property(12, String.class, "imgPath", false, "IMG_PATH");
public final static Property ImgPayerPath = new Property(13, String.class, "imgPayerPath", false, "IMG_PAYER_PATH");
}
private final StringConverter imgPathConverter = new StringConverter();
private final StringConverter imgPayerPathConverter = new StringConverter();
public OrderInfoDao(DaoConfig config) {
super(config);
......@@ -60,7 +66,12 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
"\"materialCost\" TEXT," + // 5: materialCost
"\"otherPrice\" TEXT," + // 6: otherPrice
"\"otherInfo\" TEXT," + // 7: otherInfo
"\"IMG_PATH\" TEXT);"); // 8: imgPath
"\"brandName\" TEXT," + // 8: brandName
"\"productModel\" TEXT," + // 9: productModel
"\"sn\" TEXT," + // 10: sn
"\"payer\" TEXT," + // 11: payer
"\"IMG_PATH\" TEXT," + // 12: imgPath
"\"IMG_PAYER_PATH\" TEXT);"); // 13: imgPayerPath
}
/** Drops the underlying database table. */
......@@ -105,9 +116,34 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
stmt.bindString(8, otherInfo);
}
String brandName = entity.getBrandName();
if (brandName != null) {
stmt.bindString(9, brandName);
}
String productModel = entity.getProductModel();
if (productModel != null) {
stmt.bindString(10, productModel);
}
String sn = entity.getSn();
if (sn != null) {
stmt.bindString(11, sn);
}
String payer = entity.getPayer();
if (payer != null) {
stmt.bindString(12, payer);
}
List imgPath = entity.getImgPath();
if (imgPath != null) {
stmt.bindString(9, imgPathConverter.convertToDatabaseValue(imgPath));
stmt.bindString(13, imgPathConverter.convertToDatabaseValue(imgPath));
}
List imgPayerPath = entity.getImgPayerPath();
if (imgPayerPath != null) {
stmt.bindString(14, imgPayerPathConverter.convertToDatabaseValue(imgPayerPath));
}
}
......@@ -147,9 +183,34 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
stmt.bindString(8, otherInfo);
}
String brandName = entity.getBrandName();
if (brandName != null) {
stmt.bindString(9, brandName);
}
String productModel = entity.getProductModel();
if (productModel != null) {
stmt.bindString(10, productModel);
}
String sn = entity.getSn();
if (sn != null) {
stmt.bindString(11, sn);
}
String payer = entity.getPayer();
if (payer != null) {
stmt.bindString(12, payer);
}
List imgPath = entity.getImgPath();
if (imgPath != null) {
stmt.bindString(9, imgPathConverter.convertToDatabaseValue(imgPath));
stmt.bindString(13, imgPathConverter.convertToDatabaseValue(imgPath));
}
List imgPayerPath = entity.getImgPayerPath();
if (imgPayerPath != null) {
stmt.bindString(14, imgPayerPathConverter.convertToDatabaseValue(imgPayerPath));
}
}
......@@ -169,7 +230,12 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // materialCost
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // otherPrice
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // otherInfo
cursor.isNull(offset + 8) ? null : imgPathConverter.convertToEntityProperty(cursor.getString(offset + 8)) // imgPath
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // brandName
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // productModel
cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // sn
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // payer
cursor.isNull(offset + 12) ? null : imgPathConverter.convertToEntityProperty(cursor.getString(offset + 12)), // imgPath
cursor.isNull(offset + 13) ? null : imgPayerPathConverter.convertToEntityProperty(cursor.getString(offset + 13)) // imgPayerPath
);
return entity;
}
......@@ -184,7 +250,12 @@ public class OrderInfoDao extends AbstractDao<OrderInfo, Long> {
entity.setMaterialCost(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setOtherPrice(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setOtherInfo(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setImgPath(cursor.isNull(offset + 8) ? null : imgPathConverter.convertToEntityProperty(cursor.getString(offset + 8)));
entity.setBrandName(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setProductModel(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
entity.setSn(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
entity.setPayer(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
entity.setImgPath(cursor.isNull(offset + 12) ? null : imgPathConverter.convertToEntityProperty(cursor.getString(offset + 12)));
entity.setImgPayerPath(cursor.isNull(offset + 13) ? null : imgPayerPathConverter.convertToEntityProperty(cursor.getString(offset + 13)));
}
@Override
......
package com.dayu.order.presenter.processorder;
import com.bigkoo.pickerview.OptionsPickerView;
import com.dayu.base.ui.presenter.BasePresenter;
import com.dayu.common.BaseView;
import com.dayu.widgets.listener.OnCloseListener;
import java.util.ArrayList;
import java.util.List;
......@@ -25,24 +27,59 @@ public interface ProcessOrderContract {
*/
void initPhotoView(ArrayList<String> list);
/**
* 初始化费用承担证明图片.
* @param list
*/
void initPayerPhotoView(ArrayList<String> list);
void clearData();
/**
* 由于databinding和greendao结合使用引起临时改变,所以在这不使用双向绑定。
*/
void getData();
void showPayerDialog(List<String> cardItem, OptionsPickerView.OnOptionsSelectListener listener);
/**
* 当订单不是ka派单时,不可修改.
*/
void setFoucesable();
void showNoPayerDialog();
void showSelectPayerDialog(OnCloseListener listener);
}
abstract class Presenter extends BasePresenter<View> {
public abstract void getOrderInfo(int orderId);
/**
*
* @param imageUrl
* @param orderId
* @param editText
* @param engineerId
* @param isPay
* @param doorPrice
* @param doorPriceComment
* @param servicePrice
* @param materialCost
* @param otherPrice
* @param brandName
* @param productModel
* @param sn
* @param repairType
* @param picsCost
*/
public abstract void commitOrder(List<String> imageUrl, int orderId, String editText, int engineerId,
int isPay, String doorPrice, String doorPriceComment,
String servicePrice, String materialCost, String otherPrice);
String servicePrice, String materialCost, String otherPrice,
String brandName,String productModel,String sn,int repairType,List<String> picsCost);
public abstract void commitPhoto(List<String> imageUrl);
public abstract void commitPhoto(List<String> imageUrl,List<String> payerUrl);
/**
* 保存订单.
......@@ -64,5 +101,10 @@ public interface ProcessOrderContract {
*/
public abstract void dumpToServerInstruction();
/**
* 显示费用承担方.
*/
public abstract void showPayerDialog();
}
}
......@@ -21,6 +21,7 @@ import com.dayu.order.ui.activity.SopWebViewActivity;
import com.dayu.provider.event.OrderState;
import com.dayu.provider.event.RefreshTab;
import com.dayu.utils.ProgressUtil;
import com.dayu.utils.UIUtils;
import com.dayu.utils.UserManager;
import com.luck.picture.lib.tools.PictureFileUtils;
import com.umeng.analytics.MobclickAgent;
......@@ -52,12 +53,19 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
private int mAccountId;
private OrderInfoDao mOrderInfoDao;
private ArrayList<String> mImages = new ArrayList<>();
private ArrayList<String> mPayerImages = new ArrayList<>();
public ObservableBoolean buttonState = new ObservableBoolean(false);
public ObservableField<OrderInfo> mOrderField = new ObservableField<>();
public ObservableField<OrderDetail> mDetail = new ObservableField<>();
public ObservableField<String> mPayer = new ObservableField<>();
public ObservableField<String> mBrandName = new ObservableField<>();
public ObservableField<String> mProductModel = new ObservableField<>();
public ObservableField<String> mSN = new ObservableField<>();
private OrderInfo mOrderInfo;
private int isPay;//是否支付费用,默认=1 不支付费用
private int mAnyContacts;
private boolean isNative;//true 数据去本地.
private OrderDetail mOrderDetail;
@Override
public void onAttached() {
......@@ -75,14 +83,28 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
List<OrderInfo> list = query.list();
if (list.size() > 0) {
mOrderInfo = list.get(0);
if ("1".equals(mOrderInfo.getPayer())) {
mPayer.set(UIUtils.getString(R.string.payer_baonei));
} else if ("2".equals(mOrderInfo.getPayer())) {
mPayer.set(UIUtils.getString(R.string.payer_baowai));
}
mBrandName.set(mOrderInfo.getBrandName());
mProductModel.set(mOrderInfo.getProductModel());
mSN.set(mOrderInfo.getSn());
if (mOrderInfo.getImgPath() != null && mOrderInfo.getImgPath().size() > 0
&& !TextUtils.isEmpty(mOrderInfo.getImgPath().get(0))) {
mImages.addAll(mOrderInfo.getImgPath());
}
if (mOrderInfo.getImgPayerPath() != null && mOrderInfo.getImgPayerPath().size() > 0
&& !TextUtils.isEmpty(mOrderInfo.getImgPayerPath().get(0))) {
mPayerImages.addAll(mOrderInfo.getImgPayerPath());
}
isNative = true;
} else {
mOrderInfo = new OrderInfo();
mOrderInfo.setId(mOrderId);
mOrderInfo.setEngineerId(mAccountId);
isNative = false;
}
mOrderField.set(mOrderInfo);
if (mOrderInfo != null && TextUtils.isEmpty(mOrderInfo.getDoorPrice()) && TextUtils.isEmpty(mOrderInfo.getServerPrice())
......@@ -93,6 +115,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
}
mView.initAddIv();
mView.initPhotoView(mImages);
mView.initPayerPhotoView(mPayerImages);
}
public void swtichButton() {
......@@ -106,13 +129,31 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
@Override
public void getOrderInfo(int orderId) {
OrderApiFactory.queryOrderInfo(orderId).subscribe(baseObserver(detail -> {
detail.setCreatedSource(3);
mOrderDetail = detail;
if (detail.getCreatedSource() != 3) {
mView.setFoucesable();
}
mDetail.set(detail);
mAnyContacts = detail.getAnyContacts();
if (!isNative) {
if (detail.getCreatedSource() != 3) {
if (1 == (detail.getRepairType())) {
mPayer.set(UIUtils.getString(R.string.payer_baonei));
} else if (2 == (detail.getRepairType())) {
mPayer.set(UIUtils.getString(R.string.payer_baowai));
}
}
mBrandName.set(detail.getBrandName());
mProductModel.set(detail.getProductModel());
mSN.set(detail.getSn());
}
}));
}
@Override
public void commitOrder(List<String> imageUrl, int orderId, String editText, int engineerId, int isPay, String doorPrice, String doorPriceComment, String servicePrice, String materialCost, String otherPrice) {
public void commitOrder(List<String> imageUrl, int orderId, String editText, int engineerId, int isPay, String doorPrice, String doorPriceComment, String servicePrice, String materialCost, String otherPrice,
String brandName, String productModel, String sn, int repairType, List<String> picsCost) {
HashMap<String, Object> params = new HashMap<>();
params.put("customerCheckComment", editText);
params.put("doorPrice", doorPrice);
......@@ -126,6 +167,11 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
params.put("otherPriceComment", "");
params.put("servicePrice", servicePrice);
params.put("servicePriceComment", "");
params.put("brandName", brandName);
params.put("productModel", productModel);
params.put("sn", sn);
params.put("repairType", repairType);
//照片上传
if (imageUrl != null) {
StringBuilder str = new StringBuilder();
......@@ -141,6 +187,22 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
} else {
params.put("pics", null);
}
if (picsCost != null) {
StringBuilder str = new StringBuilder();
for (int a = 0; a < picsCost.size(); a++) {
if (a == picsCost.size() - 1) {
str.append(picsCost.get(a));
} else {
str.append(picsCost.get(a));
str.append(",");
}
params.put("picsCost", str);
}
} else {
params.put("picsCost", null);
}
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
OrderApiFactory.commitOrder(body).subscribe(baseObserver(integer -> {
......@@ -160,7 +222,38 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
}
@Override
public void commitPhoto(List<String> imageUrl) {
public void commitPhoto(List<String> imageUrl, List<String> payerUrl) {
MultipartBody.Part[] parts;
if (imageUrl != null && payerUrl.size() > 0) {
parts = packPhoto(imageUrl);
BaseApiFactory.uploadPhoto(parts).subscribe(baseObserver(list -> {
if (payerUrl.size() > 0) {
MultipartBody.Part[] payerParts = packPhoto(payerUrl);
BaseApiFactory.uploadPhoto(payerParts).subscribe(baseObserver(
payerlist -> commitOrder(list, payerlist)));
} else {
commitOrder(list, null);
}
}));
} else {
parts = packPhoto(payerUrl);
BaseApiFactory.uploadPhoto(parts).subscribe(baseObserver(list ->
commitOrder(null, list)));
}
}
private void commitOrder(List<String> list, List<String> payerList) {
mView.getData();
OrderInfo info = mOrderField.get();
commitOrder(list, mOrderId, info.getServerRecord(),
mAccountId, isPay, info.getDoorPrice(), info.getOtherInfo(),
info.getServerPrice(), info.getMaterialCost(), info.getOtherPrice(), info.getBrandName(), info.getProductModel(), info.getSn(), Integer.parseInt(info.getPayer()), payerList);
mImages.clear();
mPayerImages.clear();
PictureFileUtils.deleteCacheDirFile(BaseApplication.getContext());
}
private MultipartBody.Part[] packPhoto(List<String> imageUrl) {
ArrayList<File> files = new ArrayList<>();
if (imageUrl != null && imageUrl.size() > 0) {
for (int i = 0; i < imageUrl.size(); i++) {
......@@ -175,15 +268,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
MultipartBody.Part.createFormData("fileUpload", files.get(i).getName(), requestFile);
part[i] = body;
}
BaseApiFactory.uploadPhoto(part).subscribe(baseObserver(list -> {
mView.getData();
OrderInfo info = mOrderField.get();
commitOrder(list, mOrderId, info.getServerRecord(),
mAccountId, isPay, info.getDoorPrice(), info.getOtherInfo(),
info.getServerPrice(), info.getMaterialCost(), info.getOtherPrice());
mImages.clear();
PictureFileUtils.deleteCacheDirFile(BaseApplication.getContext());
}));
return part;
}
@Override
......@@ -192,6 +277,9 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
if (mImages != null && mImages.size() > 0) {
mOrderField.get().setImgPath(mImages);
}
if (mPayerImages != null && mPayerImages.size() > 0) {
mOrderField.get().setImgPayerPath(mPayerImages);
}
mOrderInfoDao.insertOrReplace(mOrderField.get());
mView.showToast(R.string.order_save_success);
mView.dumpBack();
......@@ -201,24 +289,37 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
@Override
public void submitOrder() {
ProgressUtil.setCanDismiss(false);
mView.showDialog();
if (buttonState.get()) {
isPay = 2;
} else {
isPay = 1;
}
if (mImages.size() != 0) {
mView.showDialog();
commitPhoto(mImages);
} else {
mView.getData();
OrderInfo info = mOrderField.get();
if (TextUtils.isEmpty(info.getPayer())) {
mView.showNoPayerDialog();
return;
}
if ("1".equals(mOrderInfo.getPayer())) {
mPayer.set(UIUtils.getString(R.string.payer_baonei));
} else if ("2".equals(mOrderInfo.getPayer())) {
mPayer.set(UIUtils.getString(R.string.payer_baowai));
}
mView.showSelectPayerDialog((dialog, confirm) -> {
if (confirm) {
mView.showDialog();
if (mImages.size() != 0 && mPayerImages.size() != 0) {
mView.showDialog();
commitPhoto(mImages, mPayerImages);
} else {
commitOrder(null, mOrderId, info.getServerRecord(),
mAccountId, isPay, info.getDoorPrice(), info.getOtherInfo(),
info.getServerPrice(), info.getMaterialCost(), info.getOtherPrice());
info.getServerPrice(), info.getMaterialCost(), info.getOtherPrice(), info.getBrandName(), info.getProductModel(), info.getSn(), Integer.parseInt(info.getPayer()), null);
}
MobclickAgent.onEvent(BaseApplication.getContext(), "commite_order");
}
});
}
@Override
public void dumpToSop() {
......@@ -237,4 +338,19 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
MobclickAgent.onEvent(BaseApplication.getContext(), "check_serverInstruction");
}
@Override
public void showPayerDialog() {
List<String> list = new ArrayList<>();
list.add(UIUtils.getString(R.string.payer_baonei));
list.add(UIUtils.getString(R.string.payer_baowai));
mView.showPayerDialog(list, (options1, options2, options3, v) -> {
mPayer.set(list.get(options1));
if (list.get(options1).equals(UIUtils.getString(R.string.payer_baonei))) {
mOrderInfo.setPayer("1");
} else {
mOrderInfo.setPayer("2");
}
});
}
}
......@@ -33,13 +33,24 @@ public class OrderInfo extends BaseObservable {
private String otherPrice;
@Property(nameInDb = "otherInfo")
private String otherInfo;
@Property(nameInDb = "brandName")
private String brandName;
@Property(nameInDb = "productModel")
private String productModel;
@Property(nameInDb = "sn")
private String sn;
@Property(nameInDb = "payer")
private String payer;
@Convert(columnType = String.class, converter = StringConverter.class)
private List<String> imgPath;
@Convert(columnType = String.class, converter = StringConverter.class)
private List<String> imgPayerPath;
@Generated(hash = 712517816)
@Generated(hash = 1265702630)
public OrderInfo(long id, int engineerId, String serverRecord, String doorPrice,
String serverPrice, String materialCost, String otherPrice,
String otherInfo, List<String> imgPath) {
String otherInfo, String brandName, String productModel, String sn,
String payer, List<String> imgPath, List<String> imgPayerPath) {
this.id = id;
this.engineerId = engineerId;
this.serverRecord = serverRecord;
......@@ -48,7 +59,12 @@ public class OrderInfo extends BaseObservable {
this.materialCost = materialCost;
this.otherPrice = otherPrice;
this.otherInfo = otherInfo;
this.brandName = brandName;
this.productModel = productModel;
this.sn = sn;
this.payer = payer;
this.imgPath = imgPath;
this.imgPayerPath = imgPayerPath;
}
@Generated(hash = 1695813404)
......@@ -128,4 +144,45 @@ public class OrderInfo extends BaseObservable {
public void setImgPath(List<String> imgPath) {
this.imgPath = imgPath;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getProductModel() {
return productModel;
}
public void setProductModel(String productModel) {
this.productModel = productModel;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getPayer() {
return payer;
}
public void setPayer(String payer) {
this.payer = payer;
}
public List<String> getImgPayerPath() {
return imgPayerPath;
}
public void setImgPayerPath(List<String> imgPayerPath) {
this.imgPayerPath = imgPayerPath;
}
}
......@@ -8,7 +8,8 @@ import com.dayu.order.presenter.logisticsinfo.LogisticsInfoPresenter;
import com.dayu.order.ui.adapter.LogisticsAdapter;
/**
* Created by luofan on 2018/1/23.
* Created by luofan
* on 2018/1/23.
*/
public class LogisticsInfoActivity extends BaseActivity<LogisticsInfoPresenter, ActivityLogisticsInfoBinding> implements LogisticsInfoContract.View {
......
......@@ -6,8 +6,10 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.bigkoo.pickerview.OptionsPickerView;
import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.common.Constants;
import com.dayu.order.R;
......@@ -16,7 +18,10 @@ import com.dayu.order.presenter.processorder.ProcessOrderContract;
import com.dayu.order.presenter.processorder.ProcessOrderPresenter;
import com.dayu.order.sqlbean.OrderInfo;
import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.UIUtils;
import com.dayu.utils.UtilsScreen;
import com.dayu.widgets.CustomDialog;
import com.dayu.widgets.listener.OnCloseListener;
import com.luck.picture.lib.PictureSelectionModel;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
......@@ -36,8 +41,11 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
implements ProcessOrderContract.View {
private int mIvWeight;
private ImageView mAddIV;
private ImageView mPayerAddIV;
private List<LocalMedia> mSelectList;
private ArrayList<String> mImages = new ArrayList<>();
private ArrayList<String> mPayerImages = new ArrayList<>();
private int mPhotoState = 0; //0:payer
@Override
public int getLayoutId() {
......@@ -48,7 +56,14 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
@Override
public void initView() {
mSelectList = new ArrayList<>();
mAddIV.setOnClickListener(v -> showPicDialog());
mAddIV.setOnClickListener(v -> {
mPhotoState = 1;
showPicDialog();
});
mPayerAddIV.setOnClickListener(v -> {
mPhotoState = 0;
showPicDialog();
});
}
@Override
......@@ -61,13 +76,25 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
mIvWeight = (UtilsScreen.getScreenWidth(mActivity) - UtilsScreen.dip2px(mActivity, 20)) / 5;
mAddIV = new ImageView(mActivity);
mAddIV.setLayoutParams(new ViewGroup.LayoutParams(mIvWeight, mIvWeight));
mAddIV.setImageResource(R.drawable.settopic_pictrue);
mAddIV.setImageResource(R.drawable.icon_submit_photo);
mPayerAddIV = new ImageView(mActivity);
mPayerAddIV.setLayoutParams(new ViewGroup.LayoutParams(mIvWeight, mIvWeight));
mPayerAddIV.setImageResource(R.drawable.icon_submit_photo);
mBind.llPlayerImage.removeAllViews();
mBind.llPlayerImage.addView(mPayerAddIV);
}
public void showPicDialog() {
int size;
if (mPhotoState == 0) {
size = 5 - mPayerImages.size();
} else {
size = 5 - mImages.size();
}
PictureSelectionModel selector = PictureSelector.create(mActivity)
.openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()
.maxSelectNum(5 - mImages.size())// 最大图片选择数量 int
.maxSelectNum(size)// 最大图片选择数量 int
.imageSpanCount(4)// 每行显示个数 int
.selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE
.previewImage(true)// 是否可预览图片 true or false
......@@ -105,27 +132,37 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
@Override
public void initPhotoView(ArrayList<String> list) {
mImages = list;
mBind.llImage.removeAllViews();
initPhoto(list, mBind.llImage, mAddIV);
}
@Override
public void initPayerPhotoView(ArrayList<String> list) {
mPayerImages = list;
initPhoto(list, mBind.llPlayerImage, mPayerAddIV);
}
public void initPhoto(ArrayList<String> list, LinearLayout layout, ImageView mAdd) {
layout.removeAllViews();
for (int i = 0; i < list.size(); i++) {
View view = LayoutInflater.from(mActivity).inflate(R.layout.item_picture_select, null);
view.setLayoutParams(new RelativeLayout.LayoutParams(mIvWeight, mIvWeight));
view.setPadding(0, 0, 10, 0);
ImageView ivDelete = (ImageView) view.findViewById(R.id.iv_picture_delete);
ImageView imageView = (ImageView) view.findViewById(R.id.iv_picture);
ImageView ivDelete = view.findViewById(R.id.iv_picture_delete);
ImageView imageView = view.findViewById(R.id.iv_picture);
String path = list.get(i);
GlideImageLoader.load(mActivity, path, imageView);
imageView.setOnClickListener(v -> dumpPic());
imageView.setOnClickListener(v -> dumpPic(list));
ivDelete.setOnClickListener(v -> {
if (list.size() == 5) {
mBind.llImage.addView(mAddIV);
layout.addView(mAdd);
}
mBind.llImage.removeView(view);
layout.removeView(view);
list.remove(path);
});
mBind.llImage.addView(view);
layout.addView(view);
}
if (list.size() < 5) {
mBind.llImage.addView(mAddIV);
layout.addView(mAdd);
}
}
......@@ -147,17 +184,62 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
info.setServerPrice(mBind.etServePrice.getText().toString());
info.setServerRecord(mBind.etServeInfo.getText().toString());
info.setOtherInfo(mBind.etDoorInfo.getText().toString());
info.setBrandName(mBind.tvBrand.getText().toString());
info.setProductModel(mBind.etVersion.getText().toString());
info.setSn(mBind.etSerialNum.getText().toString());
mPresenter.mOrderField.set(info);
}
private void dumpPic() {
private void dumpPic(ArrayList<String> list) {
Intent intent = new Intent(this, PreviewActivty.class);
intent.putStringArrayListExtra(Constants.BUNDLE_KEY_ID, mImages);
intent.putStringArrayListExtra(Constants.BUNDLE_KEY_ID, list);
int DELETECODE = 0;
startActivityForResult(intent, DELETECODE);
}
@Override
public void showPayerDialog(List<String> cardItem, OptionsPickerView.OnOptionsSelectListener listener) {
//条件选择器
OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, listener)
.setContentTextSize(20)
.setLineSpacingMultiplier(2.0f)
.build();
pvOptions.setPicker(cardItem);
pvOptions.show();
}
@Override
public void setFoucesable() {
mBind.tvBrand.setFocusable(false);
mBind.tvBrand.setFocusable(false);
mBind.etVersion.setFocusable(false);
mBind.etSerialNum.setFocusable(false);
mBind.ivPayer.setVisibility(View.GONE);
mBind.tvPayer.setClickable(false);
}
@Override
public void showNoPayerDialog() {
CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.payer_dialog_content)
, (dialog, confirm) -> dialog.dismiss());
customDialog.setTitle(getString(R.string.payer_dialog_title))
.setPositiveButton(getString(R.string.comfirm))
.setOneButton(true);
customDialog.show();
}
@Override
public void showSelectPayerDialog(OnCloseListener listener) {
CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.payer_select_content)
, listener);
customDialog.setTitle(getString(R.string.payer_select_title))
.setNegativeButton(getString(R.string.cancle))
.setPositiveButton(getString(R.string.submit))
.setPositiveButtonColor(UIUtils.getColor(R.color.common_red));
customDialog.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
......@@ -166,16 +248,18 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
mSelectList = PictureSelector.obtainMultipleResult(data);
if (mSelectList != null) {
for (int a = 0; a < mSelectList.size(); a++) {
if (mPhotoState == 0) {
mPayerImages.add(mSelectList.get(a).getCompressPath());
} else {
mImages.add(mSelectList.get(a).getCompressPath());
// try {
// ExifInterface exif = new ExifInterface(mSelectList.get(a).getCompressPath());
// String time = exif.getAttribute(TAG_DATETIME);
// } catch (IOException e) {
// e.printStackTrace();
// }
}
}
if (mPhotoState == 0) {
initPayerPhotoView(mPayerImages);
} else {
initPhotoView(mImages);
}
}
break;
}
}
......
package com.dayu.order.ui.activity;
import android.content.Context;
import android.graphics.Color;
import android.view.inputmethod.InputMethodManager;
import com.bigkoo.pickerview.TimePickerView;
import com.dayu.base.ui.activity.BaseActivity;
......@@ -36,6 +38,12 @@ public class SubcribeTimeActivity extends BaseActivity<SubcribeTimePresenter, Ac
@Override
public void selectTime(boolean[] type, TimePickerView.OnTimeSelectListener listener) {
try {
InputMethodManager imm = (InputMethodManager) mActivity
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), 0);
} catch (NullPointerException e) {
}
TimePickerView pvTime = new TimePickerView.Builder(mActivity, listener)
.setType(type)//默认全部显示
.setCancelText(getString(R.string.cancle))//取消按钮文字
......
......@@ -14,7 +14,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="@color/cl_home_listview_bg"
android:orientation="vertical">
......@@ -30,6 +30,12 @@
android:id="@+id/tv_back"
style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_6"
android:layout_alignParentBottom="true"
android:src="@drawable/line_shape" />
</RelativeLayout>
<TextView
......@@ -45,31 +51,41 @@
android:textSize="13.3sp"
android:visibility="@{presenter.mDetail.subStatus == 5?View.VISIBLE:View.GONE}" />
<ImageView
style="@style/card_line"
android:layout_below="@id/tv_modify_sop" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tv_modify_sop"
android:layout_marginTop="@dimen/dp_10">
android:layout_height="wrap_content"
android:layout_below="@id/tv_modify_sop">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="@color/cl_white">
<TextView
android:id="@+id/tv_product_title"
android:layout_width="match_parent"
android:layout_height="43dp"
android:background="@color/tv_bg"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="18dp"
android:text="产品信息"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
<RelativeLayout
android:id="@+id/text_content_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_product_title"
android:layout_marginBottom="@dimen/dp_162">
<RelativeLayout
android:id="@+id/text_one"
android:id="@+id/rl_product"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="@color/cl_white">
<TextView
......@@ -84,12 +100,11 @@
<TextView
android:id="@+id/tv_product"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/text_one_text"
android:layout_alignBottom="@+id/text_one_text"
android:layout_marginLeft="22dp"
android:layout_marginStart="22dp"
android:layout_marginLeft="90dp"
android:layout_toEndOf="@+id/text_one_text"
android:layout_toRightOf="@+id/text_one_text"
android:text="@{presenter.mDetail.categoryName??@string/now_no}"
......@@ -100,7 +115,7 @@
<ImageView
android:id="@+id/image_lin"
style="@style/line"
android:layout_below="@id/text_one" />
android:layout_below="@id/rl_product" />
<RelativeLayout
android:id="@+id/text_two"
......@@ -119,57 +134,231 @@
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15" />
<TextView
<EditText
android:id="@+id/tv_brand"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_21.3"
android:layout_marginLeft="90dp"
android:layout_toRightOf="@id/text_two_text"
android:text="@{presenter.mDetail.brandName??@string/now_no}"
android:background="@null"
android:hint="@string/order_brand_name"
android:text="@={presenter.mBrandName}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" />
</RelativeLayout>
<ImageView
android:id="@+id/image_two_lin"
android:id="@+id/line_brand"
style="@style/line"
android:layout_below="@id/text_two" />
<RelativeLayout
android:id="@+id/rl_verion"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_below="@id/line_brand"
android:background="@color/cl_white">
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_13"
android:text="@string/order_product_model"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15" />
<EditText
android:id="@+id/et_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="90dp"
android:layout_toRightOf="@id/tv_version"
android:background="@null"
android:hint="@string/order_product_model_hint"
android:text="@={presenter.mProductModel}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" />
</RelativeLayout>
<ImageView
android:id="@+id/line_version"
style="@style/line"
android:layout_below="@id/rl_verion" />
<RelativeLayout
android:id="@+id/text_six"
android:id="@+id/rl_serial_num"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_below="@id/image_two_lin"
android:layout_below="@id/line_version"
android:background="@color/cl_white">
<TextView
android:id="@+id/text_six_text"
android:id="@+id/tv_serial_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_13"
android:text="@string/order_serve_type"
android:text="@string/order_serail"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15" />
<EditText
android:id="@+id/et_serial_num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="75dp"
android:layout_toRightOf="@id/tv_serial_num"
android:background="@null"
android:hint="@string/order_serail_hint"
android:text="@={presenter.mSN}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" />
</RelativeLayout>
<ImageView
android:id="@+id/line_serial"
style="@style/line"
android:layout_below="@id/rl_serial_num" />
<TextView
android:id="@+id/tv_serve"
android:id="@+id/tv_palyer_title"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_below="@+id/line_serial"
android:background="@color/tv_bg"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="18dp"
android:text="@string/order_payer"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
<RelativeLayout
android:id="@+id/rl_player"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_below="@id/tv_palyer_title"
android:background="@color/cl_white">
<TextView
android:id="@+id/tv_player"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_13"
android:text="@string/order_payer"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tv_player_xin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_21.3"
android:layout_toRightOf="@id/text_six_text"
android:text="@{presenter.mDetail.providerName??@string/now_no}"
android:layout_toRightOf="@id/tv_player"
android:text="*"
android:textColor="#F74848"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tv_payer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="45dp"
android:layout_toRightOf="@id/tv_player"
android:background="@null"
android:hint="@string/order_select_payer"
android:text="@{presenter.mPayer}"
android:onClick="@{()->presenter.showPayerDialog()}"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" />
<ImageView
android:id="@+id/iv_payer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/dp_15"
android:src="@drawable/icon_arrow_right" />
</RelativeLayout>
<ImageView
android:id="@+id/image_six_lin"
android:id="@+id/line_player"
style="@style/line"
android:layout_below="@id/rl_player" />
<TextView
android:id="@+id/tv_notice"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_below="@id/line_player"
android:layout_marginBottom="@dimen/dp_8"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_8"
android:text="@string/order_select_payer_notice"
android:textColor="#F74848" />
<ImageView
android:id="@+id/line_notice"
style="@style/line"
android:layout_below="@id/text_six" />
android:layout_below="@id/tv_notice" />
<LinearLayout
android:id="@+id/rl_palyer_prove"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/line_notice"
android:layout_marginTop="@dimen/dp_27"
android:layout_marginBottom="@dimen/dp_18"
android:background="@color/cl_white"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/order_payer_prove"
android:textColor="@color/default_text_color"
android:layout_marginLeft="@dimen/dp_15"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/order_payer_prove_notice"
android:layout_marginLeft="@dimen/dp_15"
android:textColor="@color/default_text_color"
android:textSize="12sp" />
<LinearLayout
android:id="@+id/ll_player_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal" />
</LinearLayout>
<TextView
android:id="@+id/tv_server_info"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_below="@+id/rl_palyer_prove"
android:background="@color/tv_bg"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="18dp"
android:text="@string/server_info"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
<RelativeLayout
android:id="@+id/time_Three"
......@@ -177,7 +366,7 @@
android:layout_height="@dimen/dp_183"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/text_six"
android:layout_below="@+id/tv_server_info"
android:background="@color/cl_white">
<TextView
......@@ -237,7 +426,7 @@
android:layout_below="@id/photo_text_title"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal"></LinearLayout>
android:orientation="horizontal" />
</RelativeLayout>
<ImageView
......@@ -357,9 +546,7 @@
android:text="@{presenter.mOrderField.serverPrice}"
android:textColor="@color/cl_home_title_text_color"
android:textColorHint="@color/cl_selector_hui"
android:textSize="@dimen/sp_13.3"
/>
android:textSize="@dimen/sp_13.3" />
<TextView
android:layout_width="wrap_content"
......@@ -547,6 +734,7 @@
android:text="@string/submit_order"
android:textColor="@color/cl_white"
android:textSize="@dimen/sp_13.3" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
......
<resources>
<string name="app_name">orderCenter</string>
<string name="order_payer_prove_notice">上传发票,订单信息,或者机器sn码,生产日期等信息证明</string>
</resources>
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