Commit 70880c49 by 罗翻

android2.0.0

parent 9e8f1f3f
Showing with 596 additions and 48 deletions
......@@ -71,7 +71,7 @@ public class LocationService extends Service {
sendMessage();
}
};
mTimer.schedule(mTask, 2000, 300000);
mTimer.schedule(mTask, 2000, 10000);
}
public void sendMessage() {
......@@ -88,8 +88,10 @@ public class LocationService extends Service {
if (accounid != null) {
mAccountId = Integer.parseInt(accounid);
}
if (mSiteId == 0) {
mSiteId = siteID;
}
}
sendMessage();
return super.onStartCommand(intent, flags, startId);
}
......
......@@ -12,6 +12,7 @@ import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.bigfish.BuildConfig;
import com.dayu.bigfish.R;
import com.dayu.bigfish.SplashActivity;
import com.dayu.bigfish.api.protocol.InformBean;
......@@ -48,7 +49,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static com.dayu.common.Constants.IS_DEBUG;
/**
* Created by luofan
......@@ -87,7 +87,7 @@ public class HxManager {
//初始化
EMClient.getInstance().init(context, options);
//在做打包混淆时,关闭debug模式,避免消耗不必要的资源
EMClient.getInstance().setDebugMode(IS_DEBUG);
EMClient.getInstance().setDebugMode(BuildConfig.DEBUG);
initEasemob();
initEM();
sdkInited = true;
......@@ -228,7 +228,7 @@ public class HxManager {
//注册环信消息监听
EMClient.getInstance().chatManager().addMessageListener(msgListener);
//注册一个监听连接状态的listener
if ("release".equals(Constants.ENVIROMENT)) {
if (!BuildConfig.DEBUG) {
EMClient.getInstance().addConnectionListener(new MyConnectionListener());
}
}
......
......@@ -167,9 +167,9 @@ public class ServerException extends Exception {
case Constants.ERROR_NULL: //数据返回为null
message = Constants.NOT_SHOW;
break;
default:
message = BaseApplication.getContext().getString(R.string.get_info_failed);
break;
// default:
// message = BaseApplication.getContext().getString(R.string.get_info_failed);
// break;
}
}
}
......@@ -41,7 +41,7 @@ public class Constants {
* 正式环境.
*/
public static final String ENVIROMENT = "release";
public static final int LOG_LEVEL = LogUtils.LEVEL_ALL;
public static final int LOG_LEVEL = LogUtils.LEVEL_OFF;
public static final String BASE_URL = "https://mobile.kf.ai";
public final static String UP_PHOTO = "/file/uploadMore?targetPath=online/sp/mobile/android/business/checkApply";
public final static String WEB_SOP = "https://sop.kf.ai/#/sop";
......@@ -52,6 +52,21 @@ public class Constants {
public static final boolean IS_DEBUG = false;
/**
* 统一配置.
*/
// public static final String ENVIROMENT = "release";
// public static final int LOG_LEVEL = LogUtils.LEVEL_ALL;
// public static final String BASE_URL = BuildConfig.BASEURL;
// public final static String UP_PHOTO = BuildConfig.UP_PHOTO;
// public final static String WEB_SOP = BuildConfig.WEB_SOP;
// public final static String WEB_SOP_DETAIL = BuildConfig.WEB_SOP_DETAIL;
// public final static String WEB_ZHI_SHI = BuildConfig.WEB_ZHI_SHI;
// public final static String CHECK_MULTI_WEB_SOP = BuildConfig.CHECK_MULTI_WEB_SOP;
// public final static String MULTI_WEB_SOP = BuildConfig.MULTI_WEB_SOP;
// public static final boolean IS_DEBUG = false;
/**
* 演示环境
*/
// public static final String ENVIROMENT = "demons";
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFAAE8A9" />
<size android:height="9999dp" />
<corners android:radius="9999dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#09BB07" />
<size android:height="9999dp" />
<corners android:radius="9999dp" />
</shape>
\ No newline at end of file
......@@ -313,7 +313,7 @@
<string name="send_already">已发货</string>
<string name="modify_part_info">修改信息</string>
<string name="customer_acceptance">客户验收</string>
<string name="scan_code_for_appointment">扫一扫验收/付款/评价</string>
<string name="scan_code_for_appointment">扫一扫验收/评价</string>
<string name="scan_code_for_appointment_two">点击-上门服务-预约记录-进行绑定登录后,选择工单验收</string>
<string name="order_record">工单记录</string>
<string name="order_num">工单编号</string>
......@@ -399,13 +399,14 @@
<string name="signature_name">请先签名!</string>
<string name="input_money">请输入费用!</string>
<string name="no_money">不收费</string>
<string name="wechat_pay">微信支付</string>
<string name="wechat_pay">移动支付</string>
<string name="cash_pay">现金支付</string>
<string name="pay_type">支付方式</string>
<string name="pay_state">支付状态</string>
<string name="not_pay">未支付</string>
<string name="is_pay">已支付</string>
<string name="pay_sccucess">支付成功</string>
<string name="pay_money_sccucess">收款成功</string>
<string name="pay_fail">支付失败</string>
<string name="click_and_signature">点击此处让客户去签名</string>
<string name="download_gaode_notice">您还未安装高德地图~</string>
......@@ -470,6 +471,7 @@
<string name="servering">服务中</string>
<string name="order_success">已完工</string>
<string name="order_closed">已关闭</string>
<string name="scan_pay">扫码收款</string>
<!--消息-->
......
......@@ -38,4 +38,10 @@ public class ServiceStationActivity extends BaseActivity<ServiceStationPresenter
mBind.recyclerView.setOnItemClickListener((item, bind) ->
mPresenter.selectStation((ServiceStation) item));
}
@Override
public void finish() {
super.finish();
overridePendingTransition(0, R.anim.slide_bottom_out);
}
}
......@@ -14,6 +14,7 @@ import com.dayu.common.Constants;
import com.dayu.managercenter.R;
import com.dayu.managercenter.common.ManagerConstant;
import com.dayu.managercenter.databinding.FragmentManagerBinding;
import com.dayu.managercenter.ui.activity.AllOrderActivity;
import com.dayu.managercenter.ui.activity.CreateOrderActivity;
import com.dayu.managercenter.ui.activity.ServiceStationActivity;
import com.dayu.provider.event.ManagerReceiveEvent;
......@@ -68,12 +69,17 @@ public class ManagerFragment extends DataBindingFragment<FragmentManagerBinding>
AppManager.getInstance().finishAllActivity();
ARouter.getInstance().build(BaseConstant.PATH_LOGIN).navigation();
});
mBind.tvRightTitle.setOnClickListener(v -> {
mBind.title.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putInt(Constants.STATE, 1);
Intent intent = new Intent(mActivity, ServiceStationActivity.class);
intent.putExtra(Constants.BUNDLE, bundle);
startActivity(intent);
mActivity.overridePendingTransition(R.anim.slide_bottom_in, 0);
});
mBind.tvRightTitle.setOnClickListener(v -> {
Intent intent = new Intent(mActivity, AllOrderActivity.class);
startActivity(intent);
});
mBind.createOrder.setOnClickListener(v -> {
Bundle bundle = new Bundle();
......
......@@ -25,13 +25,14 @@
style="@style/text_title"
android:ellipsize="middle"
android:maxEms="9"
android:drawableRight="@drawable/icon_arrow_down"
android:singleLine="true"
android:text="@string/send_order" />
<TextView
android:id="@+id/tv_right_title"
style="@style/title_right_text"
android:text="@string/swtich_service_station"
android:text="@string/all_order"
android:textColor="#3faafc"
android:textSize="@dimen/dp_13.3" />
</RelativeLayout>
......
......@@ -8,6 +8,7 @@ import com.dayu.order.api.protocol.LogsticsInfo;
import com.dayu.order.api.protocol.Order;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.OrderPart;
import com.dayu.order.api.protocol.Pay;
import com.dayu.order.api.protocol.ServerInstruction;
import com.dayu.order.api.protocol.ShipperCompany;
import com.dayu.order.api.protocol.Spu;
......@@ -29,7 +30,6 @@ public class OrderApiFactory {
return Api.getService(OrderService.class).startOrder(body).compose(Api.applySchedulers());
}
public static Observable<Integer> startServer(RequestBody body) {
return Api.getService(OrderService.class).startServer(body).compose(Api.applySchedulers());
}
......@@ -146,11 +146,19 @@ public class OrderApiFactory {
return Api.getService(OrderService.class).createUrl(orderId).compose(Api.applySchedulers());
}
public static Observable<Boolean> queryPayStatus(int siteId) {
return Api.getService(OrderService.class).queryPayStatus(siteId).compose(Api.applySchedulers());
}
public static Observable<Boolean> modifyOrder(RequestBody body) {
return Api.getService(OrderService.class).modifyOrder(body).compose(Api.applySchedulers());
}
public static Observable<BasePageBean<Order>> searchOrder(String key, int siteId,int userAccount, int status, int page, int pageSize) {
return Api.getService(OrderService.class).searchOrder(key, siteId,userAccount, status, page, pageSize).compose(Api.applySchedulers());
public static Observable<Pay> pay(RequestBody body) {
return Api.getService(OrderService.class).pay(body).compose(Api.applySchedulers());
}
public static Observable<BasePageBean<Order>> searchOrder(String key, int siteId, int userAccount, int status, int page, int pageSize) {
return Api.getService(OrderService.class).searchOrder(key, siteId, userAccount, status, page, pageSize).compose(Api.applySchedulers());
}
}
......@@ -8,6 +8,7 @@ import com.dayu.order.api.protocol.LogsticsInfo;
import com.dayu.order.api.protocol.Order;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.OrderPart;
import com.dayu.order.api.protocol.Pay;
import com.dayu.order.api.protocol.ServerInstruction;
import com.dayu.order.api.protocol.ShipperCompany;
import com.dayu.order.api.protocol.Spu;
......@@ -326,6 +327,15 @@ interface OrderService {
Observable<BaseResponse<String>> createUrl(@Path("orderId") int orderId);
/**
* 查询是否开通移动支付.
*
* @param siteId
* @return
*/
@GET(OrderConstant.QUEY_PAY_STATUS)
Observable<BaseResponse<Boolean>> queryPayStatus(@Path("siteId") int siteId);
/**
* 修改自建单.
*
* @param body
......@@ -334,6 +344,15 @@ interface OrderService {
@PUT(OrderConstant.MODIFY_NEW_ORDER)
Observable<BaseResponse<Boolean>> modifyOrder(@Body RequestBody body);
/**
* 支付.
*
* @param body
* @return
*/
@POST(OrderConstant.PAY)
Observable<BaseResponse<Pay>> pay(@Body RequestBody body);
/**
* 搜索.
......
......@@ -55,7 +55,7 @@ public class OrderDetail implements Serializable {
private Double materialCost;
private Object materialCostComment;
private double otherPrice;
private Object otherPriceComment;
private String otherPriceComment;
private Double totalPrice;
private Object cancelOrderReason;
private Object closePhase;
......@@ -493,11 +493,11 @@ public class OrderDetail implements Serializable {
this.otherPrice = otherPrice;
}
public Object getOtherPriceComment() {
public String getOtherPriceComment() {
return otherPriceComment;
}
public void setOtherPriceComment(Object otherPriceComment) {
public void setOtherPriceComment(String otherPriceComment) {
this.otherPriceComment = otherPriceComment;
}
......
package com.dayu.order.api.protocol;
/**
* Created by luofan
* on 2019/1/8.
*/
public class Pay {
private String errorCode;
private String errorMessage;
private String resultCode;
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
}
......@@ -174,4 +174,14 @@ public class OrderConstant {
*/
public static final String SEARCH_ORDER = "/api-order/" + "orders/provider";
/**
* 支付.
*/
public static final String PAY = "/api-base/" + "shouqianbaPay/order/pay";
/**
* 查询是否开通移动支付.
*/
public static final String QUEY_PAY_STATUS = "/api-base/" +"shouqianbaMerchant/status/siteId/{siteId}";
}
......@@ -26,6 +26,7 @@ public class EditePresenter extends EditeContract.Presenter {
private int mState;
public ObservableField<String> info = new ObservableField<>();
public ObservableField<String> title = new ObservableField<>();
private int mOrderId;
@Override
......@@ -36,6 +37,11 @@ public class EditePresenter extends EditeContract.Presenter {
if (!infos.equals(UIUtils.getString(R.string.no_data))) {
info.set(infos);
}
if (mState == 0) {
title.set("修改备注");
} else {
title.set("修改任务描述");
}
}
......
......@@ -3,6 +3,7 @@ package com.dayu.order.presenter.multipleprocess;
import com.dayu.base.ui.presenter.BaseListPresenter;
import com.dayu.common.BaseView;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.widgets.listener.OnCloseListener;
import java.util.ArrayList;
......@@ -17,8 +18,12 @@ public interface MultipleProcessContract {
interface View extends BaseView {
HashMap<String, Object> getParams();
void paySuccess(OrderDetail detail);
void setRepairType();
HashMap<String, Object> getPayParam();
void initPayerPhotoView(ArrayList<String> list);
void showPayerDialog();
......@@ -29,6 +34,8 @@ public interface MultipleProcessContract {
void setPayStatus();
void setPayStatus(Boolean blooean);
void showSelectPayerDialog(OnCloseListener listener);
void showNoPayerDialog();
......@@ -38,6 +45,8 @@ public interface MultipleProcessContract {
String getTotalMoney();
int getPayType();
void setPayBackGround(Integer payType);
}
abstract class Presenter extends BaseListPresenter<View> {
......@@ -45,5 +54,8 @@ public interface MultipleProcessContract {
public abstract void getOrderInfo(int orderId);
public abstract void queryPayStatus(int siteId);
public abstract void pay(String contents);
}
}
......@@ -9,6 +9,7 @@ import com.dayu.base.api.BaseApiFactory;
import com.dayu.common.Constants;
import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.Spu;
import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.QrCodeActivity;
......@@ -45,6 +46,8 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
private ArrayList<String> mImages = new ArrayList<>();
private Integer mNeedEsignature;
private String mSignatureUrl;
private OrderDetail mOrderDetail;
private boolean mCanProcess;
@Override
public void onAttached() {
......@@ -56,6 +59,7 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
mOrderType = 1;
}
getOrderInfo(mSpus.get(0).getOrderId());
queryPayStatus(UserManager.getInstance().getUser().getSiteId());
}
@Override
......@@ -69,6 +73,10 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
}
public void process() {
if (mView.getPayType() == 1 && !mCanProcess) {
ToastUtils.showShortToast("请先扫码收款后再提交验收!");
return;
}
File file = new File(SignatureActivity.path);
if (mNeedEsignature != null && mNeedEsignature == 1 && !file.exists()) {
ToastUtils.showShortToast(R.string.signature_name);
......@@ -190,6 +198,7 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
public void getOrderInfo(int orderId) {
mView.showDialog();
OrderApiFactory.queryOrderInfo(orderId).subscribe(baseObserver(detail -> {
mOrderDetail = detail;
if (1 == (detail.getRepairType())) {
mRepairType = UIUtils.getString(R.string.payer_baonei);
} else if (2 == (detail.getRepairType())) {
......@@ -207,9 +216,54 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
if ((payType != null && (payType == 1 || payType == 2)) && (payState == 3 || payState == 2)) {
mView.setPayStatus();
}
if (detail.getPayStatus() == 3 && detail.getPayType() == 1) {
mCanProcess = true;
mView.paySuccess(detail);
mView.setPayBackGround(detail.getPayType());
}
}));
}
@Override
public void queryPayStatus(int siteId) {
mView.showDialog();
OrderApiFactory.queryPayStatus(UserManager.getInstance().getUser().getSiteId())
.subscribe(baseObserver(aBoolean -> mView.setPayStatus(aBoolean)));
}
@Override
public void pay(String contents) {
if (TextUtils.isEmpty(mView.getTotalMoney()) || Double.parseDouble(mView.getTotalMoney()) == 0.00) {
ToastUtils.showShortToast("请输入金额再进行收款!");
return;
}
mView.showDialog();
HashMap<String, Object> params = new HashMap<>();
params.put("clientId", mOrderDetail.getId());
params.put("dynamicId", contents);
params.put("operator", UserManager.getInstance().getUser().getAccountName());
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
OrderApiFactory.modifyOrder(getModifyBody()).
subscribe(baseObserver(aBoolean -> {
mView.showDialog();
OrderApiFactory.pay(body).subscribe(baseObserver(pay -> {
ToastUtils.showShortToast("支付成功!");
mCanProcess = true;
mView.paySuccess(null);
}, exception -> ToastUtils.showShortToast(exception.message)));
}));
}
private RequestBody getModifyBody() {
HashMap<String, Object> param = mView.getPayParam();
param.put("id", mOrderDetail.getId());
JSONObject jsonObject = new JSONObject(param);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
return body;
}
public String getRepairType() {
return mRepairType;
}
......
......@@ -3,6 +3,7 @@ package com.dayu.order.presenter.processorder;
import com.dayu.base.ui.presenter.BasePresenter;
import com.dayu.common.BaseView;
import com.dayu.order.api.protocol.OrderDetail;
import java.util.ArrayList;
import java.util.List;
......@@ -15,6 +16,8 @@ public interface ProcessOrderContract {
interface View extends BaseView {
String getSum();
void showSignature();
/**
......@@ -40,6 +43,10 @@ public interface ProcessOrderContract {
void setPayBackGround(Integer payType);
void setSignature(String signature);
void paySuccess(OrderDetail detail);
void setPayStatus(Boolean aBoolean);
}
abstract class Presenter extends BasePresenter<View> {
......@@ -89,5 +96,13 @@ public interface ProcessOrderContract {
*/
public abstract void dumpToServerInstruction();
/**
* 支付.
*
* @param contents
*/
public abstract void pay(String contents);
public abstract void queryPayStatus(int siteId);
}
}
......@@ -70,17 +70,20 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
private String mSignatureUrl;
public String mPath;
private String mSignaturePath;
private UserInfo mUserInfo;
private boolean mCanProcess = false;
@Override
public void onAttached() {
Bundle bundle = mView.getBundle();
mOrderId = bundle.getInt(Constants.ORDER_ID, 0);
mPosition = bundle.getInt(Constants.ORDER_POSTION, 0);
UserInfo userInfo = UserManager.getInstance().getUser();
mAccountId = Integer.parseInt(userInfo.getAccountId());
mUserInfo = UserManager.getInstance().getUser();
mAccountId = Integer.parseInt(mUserInfo.getAccountId());
mOrderInfoDao = GreenDaoManager.getInstance().getmDaoSession().getOrderInfoDao();
mView.showDialog();
getOrderInfo(mOrderId);
queryPayStatus(mUserInfo.getSiteId());
Query<OrderInfo> query = mOrderInfoDao.queryBuilder().where(OrderInfoDao.Properties.Id.eq(mOrderId),
OrderInfoDao.Properties.EngineerId.eq(mAccountId))
.build();
......@@ -148,7 +151,11 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
if (mNeedEsignature != null && mNeedEsignature == 1) {
mView.showSignature();
}
if (detail.getPayStatus() == 3 && detail.getPayType() == 1) {
mCanProcess = true;
mView.paySuccess(detail);
mView.setPayBackGround(detail.getPayType());
}
}));
}
......@@ -164,6 +171,7 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
params.put("materialCost", materialCost);
params.put("otherPrice", otherPrice);
params.put("servicePrice", servicePrice);
params.put("totalPrice", mView.getSum());
// params.put("categoryName")
// params.put("brandName", brandName);
......@@ -266,6 +274,10 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
@Override
public void submitOrder() {
if (mView.getPayType() == 1 && !mCanProcess) {
ToastUtils.showShortToast("请先扫码收款后再提交验收!");
return;
}
if (mNeedEsignature != null && mNeedEsignature == 1 && TextUtils.isEmpty(mSignaturePath)) {
ToastUtils.showShortToast(R.string.signature_name);
return;
......@@ -328,6 +340,52 @@ public class ProcessOrderPresenter extends ProcessOrderContract.Presenter {
MobclickAgent.onEvent(BaseApplication.getContext(), "check_serverInstruction");
}
@Override
public void pay(String contents) {
if (TextUtils.isEmpty(mView.getTotalMoney()) || Double.parseDouble(mView.getTotalMoney()) == 0.00) {
ToastUtils.showShortToast("请输入金额再进行收款!");
return;
}
mView.showDialog();
HashMap<String, Object> params = new HashMap<>();
params.put("clientId", mOrderId);
params.put("dynamicId", contents);
params.put("operator", mUserInfo.getAccountName());
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
OrderApiFactory.modifyOrder(getModifyBody()).
subscribe(baseObserver(aBoolean -> {
mView.showDialog();
OrderApiFactory.pay(body).subscribe(baseObserver(pay -> {
mCanProcess = true;
mView.paySuccess(null);
}, exception -> ToastUtils.showShortToast(exception.message)));
}));
}
@Override
public void queryPayStatus(int siteId) {
mView.showDialog();
OrderApiFactory.queryPayStatus(mUserInfo.getSiteId())
.subscribe(baseObserver(aBoolean -> mView.setPayStatus(aBoolean)));
}
private RequestBody getModifyBody() {
mView.getData();
OrderInfo info = mOrderField.get();
HashMap<String, Object> orderParams = new HashMap<>();
orderParams.put("id", mOrderId);
orderParams.put("doorPrice", info.getDoorPrice());
orderParams.put("materialCost", info.getMaterialCost());
orderParams.put("otherPrice", info.getOtherPrice());
orderParams.put("doorPriceComment", info.getOtherInfo());
orderParams.put("totalPrice", mView.getSum());
JSONObject jsonObject = new JSONObject(orderParams);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
return body;
}
public void setSignaturePath(String path) {
mSignaturePath = path;
}
......
......@@ -23,6 +23,7 @@ import com.dayu.base.ui.adapter.PhotoViewAdapter;
import com.dayu.base.ui.adapter.SpacesItemDecoration;
import com.dayu.common.MyTextWatcher;
import com.dayu.order.R;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.databinding.ActivityMultipleProcessBinding;
import com.dayu.order.presenter.multipleprocess.MultipleProcessContract;
import com.dayu.order.presenter.multipleprocess.MultipleProcessPresenter;
......@@ -30,6 +31,8 @@ import com.dayu.utils.ToastUtils;
import com.dayu.utils.UIUtils;
import com.dayu.widgets.CustomDialog;
import com.dayu.widgets.listener.OnCloseListener;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.entity.LocalMedia;
......@@ -69,6 +72,11 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
private int mPayType = 3;
private PhotoViewAdapter mAdapter;
private RecyclerView mPhoto;
private LinearLayout mScanPay;
private ImageView mScan;
private TextView mTvScan;
private RelativeLayout mRlPay;
private boolean mWechatStatus;
@Override
public void setPresenter() {
......@@ -90,7 +98,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
}
public void initFootView(View view) {
RelativeLayout rlPay = view.findViewById(R.id.rl_pay);
mRlPay = view.findViewById(R.id.rl_pay);
mSignature = view.findViewById(R.id.rl_signature);
mDoorPrice = view.findViewById(R.id.et_door_price);
mServerPrice = view.findViewById(R.id.et_serve_price);
......@@ -109,19 +117,27 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
mCashPay = view.findViewById(R.id.cash_pay);
mPhoto = view.findViewById(R.id.photo);
mScanPay = view.findViewById(R.id.scan_pay);
mScan = view.findViewById(R.id.iv_scan);
mTvScan = view.findViewById(R.id.tv_scan_pay);
mNoPay.setOnClickListener(v -> {
mPayType = 3;
clearData();
rlPay.setVisibility(View.GONE);
mRlPay.setVisibility(View.GONE);
setBackGround(mNoPay);
});
mWechatPay.setOnClickListener(v -> {
if (canPay) {
ToastUtils.showShortToast(getString(R.string.can_not_repet_get_money));
} else {
if (mWechatStatus) {
mPayType = 1;
rlPay.setVisibility(View.VISIBLE);
mRlPay.setVisibility(View.VISIBLE);
setBackGround(mWechatPay);
} else {
ToastUtils.showShortToast("您公司未开通移动支付,请到服务商系统-设置-移动支付设置中进行开通。");
}
}
});
mCashPay.setOnClickListener(v -> {
......@@ -129,7 +145,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
ToastUtils.showShortToast(getString(R.string.can_not_repet_get_money));
} else {
mPayType = 2;
rlPay.setVisibility(View.VISIBLE);
mRlPay.setVisibility(View.VISIBLE);
setBackGround(mCashPay);
}
});
......@@ -147,6 +163,14 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
mAllSignature.setVisibility(View.VISIBLE);
}
initTotal();
mScanPay.setOnClickListener(v -> {
if (TextUtils.isEmpty(getSum()) || Double.parseDouble(getSum()) == 0.00) {
ToastUtils.showShortToast("请输入金额!");
return;
}
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan();
});
}
private void setBackGround(TextView tv) {
......@@ -160,6 +184,64 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
tv.setTextColor(getResources().getColor(R.color.white));
}
@Override
public void setPayBackGround(Integer payType) {
mPayType = payType;
mNoPay.setBackgroundResource(R.drawable.grey_commom);
mCashPay.setBackgroundResource(R.drawable.grey_commom);
mWechatPay.setBackgroundResource(R.drawable.grey_commom);
mNoPay.setTextColor(getResources().getColor(R.color.cl_tab_init));
mCashPay.setTextColor(getResources().getColor(R.color.cl_tab_init));
mWechatPay.setTextColor(getResources().getColor(R.color.cl_tab_init));
if (payType == 1) {
mWechatPay.setBackgroundResource(R.drawable.blue_commom);
mWechatPay.setTextColor(getResources().getColor(R.color.white));
mRlPay.setVisibility(View.VISIBLE);
} else if (payType == 2) {
mCashPay.setBackgroundResource(R.drawable.blue_commom);
mCashPay.setTextColor(getResources().getColor(R.color.white));
mRlPay.setVisibility(View.VISIBLE);
} else {
mNoPay.setBackgroundResource(R.drawable.blue_commom);
mNoPay.setTextColor(getResources().getColor(R.color.white));
mRlPay.setVisibility(View.GONE);
}
}
@Override
public void paySuccess(OrderDetail detail) {
mScanPay.setBackgroundResource(R.drawable.btn_green_light_react);
mTvScan.setText(UIUtils.getString(R.string.pay_money_sccucess));
mScan.setImageResource(R.drawable.icon_succeed);
mNoPay.setEnabled(false);
mWechatPay.setEnabled(false);
mCashPay.setEnabled(false);
mDoorPrice.setEnabled(false);
mMaterialsPrice.setEnabled(false);
mOtherPrice.setEnabled(false);
mDoorInfo.setEnabled(false);
mScanPay.setEnabled(false);
if (detail != null) {
if (detail.getDoorPrice() != null) {
mDoorPrice.setText(new DecimalFormat("0.00").format(detail.getDoorPrice()) + "");
} else {
mDoorPrice.setText("0.00");
}
if (detail.getMaterialCost() != null) {
mMaterialsPrice.setText(new DecimalFormat("0.00").format(detail.getMaterialCost()) + "");
} else {
mMaterialsPrice.setText("0.00");
}
if (detail.getOtherPrice() != null) {
mOtherPrice.setText(new DecimalFormat("0.00").format(detail.getOtherPrice()) + "");
} else {
mOtherPrice.setText("0.00");
}
mDoorInfo.setText(detail.getDoorPriceComment());
mTotalMoney.setText(getSum());
}
}
private void initTotal() {
mDoorPrice.addTextChangedListener(new MyTextWatcher() {
@Override
......@@ -237,6 +319,19 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
}
@Override
public HashMap<String, Object> getPayParam() {
HashMap<String, Object> params = new HashMap<>();
if (mDoorPrice != null) {
params.put("doorPrice", mDoorPrice.getText().toString().trim());
params.put("materialCost", mMaterialsPrice.getText().toString().trim());
params.put("otherPrice", mOtherPrice.getText().toString().trim());
params.put("doorPriceComment", mDoorInfo.getText().toString().trim());
params.put("totalPrice", getTotalMoney());
}
return params;
}
@Override
public void initPayerPhotoView(ArrayList<String> list) {
list.remove("add");
mPayerImages = list;
......@@ -289,6 +384,11 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
}
@Override
public void setPayStatus(Boolean blooean) {
mWechatStatus = blooean;
}
@Override
public void showNoPayerDialog() {
CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.payer_dialog_content)
, (dialog, confirm) -> dialog.dismiss());
......@@ -340,6 +440,14 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
}
mAdapter.setData(mPayerImages);
break;
case 0x0000c0de:
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (result.getContents() != null) {
mPresenter.pay(result.getContents());
}
break;
default:
break;
}
} else if (resultCode == 100) {
mIcon.setVisibility(View.GONE);
......
......@@ -17,12 +17,15 @@ import com.dayu.base.ui.adapter.SpacesItemDecoration;
import com.dayu.common.Constants;
import com.dayu.common.MyTextWatcher;
import com.dayu.order.R;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.common.OrderConstant;
import com.dayu.order.databinding.ActivityProcessOrderBinding;
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.ToastUtils;
import com.dayu.utils.UIUtils;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import com.luck.picture.lib.PictureSelectionModel;
......@@ -51,6 +54,8 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
private Integer mPayType = 3;
private String mSignaturePath;
private PhotoViewAdapter mAdapter;
private int mScanState;
private boolean mWechatStatus;
@Override
public int getLayoutId() {
......@@ -85,21 +90,38 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
mPayType = 3;
clearData();
mBind.rlPay.setVisibility(View.GONE);
mBind.scanPay.setVisibility(View.GONE);
setBackGround(mBind.noPay);
});
mBind.wechatPay.setOnClickListener(v -> {
if (mWechatStatus) {
mPayType = 1;
mBind.rlPay.setVisibility(View.VISIBLE);
mBind.scanPay.setVisibility(View.VISIBLE);
setBackGround(mBind.wechatPay);
} else {
ToastUtils.showShortToast("您公司未开通移动支付,请到服务商系统-设置-移动支付设置中进行开通。");
}
});
mBind.cashPay.setOnClickListener(v -> {
mPayType = 2;
mBind.rlPay.setVisibility(View.VISIBLE);
mBind.scanPay.setVisibility(View.GONE);
setBackGround(mBind.cashPay);
});
initTotal();
mBind.scan.setOnClickListener(v ->
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan());
mBind.scan.setOnClickListener(v -> {
mScanState = 1;
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan();
});
mBind.scanPay.setOnClickListener(v -> {
if (TextUtils.isEmpty(getSum()) || Double.parseDouble(getSum()) == 0.00) {
ToastUtils.showShortToast("请输入金额!");
return;
}
mScanState = 2;
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan();
});
}
private void setBackGround(TextView tv) {
......@@ -140,6 +162,7 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
});
}
@Override
public String getSum() {
return new DecimalFormat("0.00").format(parseDb(mBind.etDoorPrice.getText().toString())
+ parseDb(mBind.etServePrice.getText().toString())
......@@ -317,6 +340,45 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
}
@Override
public void paySuccess(OrderDetail detail) {
mBind.scanPay.setBackgroundResource(R.drawable.btn_green_light_react);
mBind.tvScanPay.setText(UIUtils.getString(R.string.pay_money_sccucess));
mBind.ivScan.setImageResource(R.drawable.icon_succeed);
mBind.noPay.setEnabled(false);
mBind.wechatPay.setEnabled(false);
mBind.cashPay.setEnabled(false);
mBind.etDoorPrice.setEnabled(false);
mBind.etMaterialsPrice.setEnabled(false);
mBind.etOtherPrice.setEnabled(false);
mBind.etDoorInfo.setEnabled(false);
mBind.scanPay.setEnabled(false);
if (detail != null) {
if (detail.getDoorPrice() != null) {
mBind.etDoorPrice.setText(new DecimalFormat("0.00").format(detail.getDoorPrice()) + "");
} else {
mBind.etDoorPrice.setText("0.00");
}
if (detail.getMaterialCost() != null) {
mBind.etMaterialsPrice.setText(new DecimalFormat("0.00").format(detail.getMaterialCost()) + "");
} else {
mBind.etMaterialsPrice.setText("0.00");
}
if (detail.getOtherPrice() != null) {
mBind.etOtherPrice.setText(new DecimalFormat("0.00").format(detail.getOtherPrice()) + "");
} else {
mBind.etOtherPrice.setText("0.00");
}
mBind.etDoorInfo.setText(detail.getDoorPriceComment());
mBind.tvTotalMoney.setText(getSum());
}
}
@Override
public void setPayStatus(Boolean aBoolean) {
mWechatStatus = aBoolean;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
......@@ -345,7 +407,11 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
case 0x0000c0de:
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if (result.getContents() != null) {
if (mScanState == 1) {
mBind.etSerialNum.setText(result.getContents());
} else if (mScanState == 2) {
mPresenter.pay(result.getContents());
}
}
break;
default:
......
......@@ -114,7 +114,7 @@ public class MultiOrderDetailFragment extends DataBindingFragment<FragmentMultiD
bundle.putInt(Constants.ORDER_ID, detail.getId());
Intent intent = new Intent(mActivity, QrCodeActivity.class);
intent.putExtra(Constants.BUNDLE, bundle);
startActivity(intent);
mActivity.startActivity(intent);
MobclickAgent.onEvent(mActivity, "customer_apponitment");
});
if (detail.getEsignatureImg() == null) {
......
......@@ -21,7 +21,7 @@
<TextView
android:id="@+id/text_idea"
android:text="@string/modify_order"
android:text="@{presenter.title}"
style="@style/text_title" />
<ImageView
......
......@@ -193,9 +193,9 @@
android:id="@+id/rl_serial_num"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:gravity="center_vertical"
android:layout_below="@id/line_version"
android:background="@color/cl_white">
android:background="@color/cl_white"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_serial_num"
......@@ -320,8 +320,8 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/dp_15"
android:visibility="gone"
android:src="@drawable/icon_arrow_right" />
android:src="@drawable/icon_arrow_right"
android:visibility="gone" />
</RelativeLayout>
<ImageView
......@@ -687,8 +687,8 @@
android:id="@+id/tv_total_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:paddingRight="23dp"
android:layout_centerHorizontal="true"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3" />
......@@ -724,8 +724,37 @@
android:textColor="@color/cl_home_title_text_color"
android:textColorHint="@color/cl_selector_hui"
android:textSize="@dimen/sp_13.3" />
<LinearLayout
android:id="@+id/scan_pay"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_below="@id/et_door_info"
android:layout_margin="10dp"
android:background="@drawable/btn_green_react"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:src="@drawable/icon_w_scan" />
<TextView
android:id="@+id/tv_scan_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/scan_pay"
android:textColor="@color/cl_white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_signature_all"
android:layout_width="match_parent"
......
......@@ -8,7 +8,7 @@
android:layout_height="match_parent"
android:id="@+id/zxing_barcode_surface"
app:zxing_framing_rect_width="250dp"
app:zxing_framing_rect_height="150dp"/>
app:zxing_framing_rect_height="250dp"/>
<com.journeyapps.barcodescanner.ViewfinderView
android:layout_width="match_parent"
......
......@@ -240,6 +240,28 @@
android:textSize="14sp" />
<TextView
android:id="@+id/tv_company_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_customer_type"
android:layout_marginTop="@dimen/dp_13"
android:text="企业名称"
android:textColor="@color/cl_order_text_one"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/company_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_customer_type"
android:layout_marginLeft="19dp"
android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/tv_company_name"
android:text='@{!TextUtils.isEmpty(item.customerCompany)?item.customerCompany:@string/no_data}'
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tv_customer_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -247,6 +269,7 @@
android:layout_alignBottom="@+id/customer_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/tv_company_name"
android:text="@string/customer_name"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
......@@ -255,10 +278,10 @@
android:id="@+id/customer_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_customer_type"
android:layout_below="@+id/tv_company_name"
android:layout_marginLeft="19dp"
android:layout_marginTop="@dimen/dp_15"
android:layout_toRightOf="@+id/tv_customer_type"
android:layout_toRightOf="@+id/tv_customer_name"
android:text='@{!TextUtils.isEmpty(item.customerName)?item.customerName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color"
android:textSize="14sp" />
......
......@@ -375,10 +375,34 @@
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/two_text_three"
android:id="@+id/tv_company_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/two_text_two"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_13"
android:text="企业名称"
android:textColor="@color/cl_order_text_one"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/company_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/two_text_two"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/two_text_two"
android:text='@{!TextUtils.isEmpty(item.customerCompany)?item.customerCompany:@string/no_data}'
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_14"
android:visibility="@{item.customerType == 1?View.GONE:View.VISIBLE}" />
<TextView
android:id="@+id/two_text_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_company_name"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_13"
android:text="@string/customer_name"
......@@ -389,7 +413,7 @@
android:id="@+id/tv_customer_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_customer_type"
android:layout_below="@id/tv_company_name"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/two_text_three"
......@@ -402,7 +426,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/tv_customer_type"
android:layout_below="@+id/tv_company_name"
android:layout_marginLeft="19dp"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
......
......@@ -47,9 +47,9 @@
android:layout_centerVertical="true"
android:layout_toRightOf="@id/tv_player"
android:text="*"
android:visibility="gone"
android:textColor="#F74848"
android:textSize="@dimen/sp_15" />
android:textSize="@dimen/sp_15"
android:visibility="gone" />
<TextView
android:id="@+id/tv_payer"
......@@ -70,8 +70,8 @@
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="@dimen/dp_15"
android:visibility="gone"
android:src="@drawable/icon_arrow_right" />
android:src="@drawable/icon_arrow_right"
android:visibility="gone" />
</RelativeLayout>
<ImageView
......@@ -84,11 +84,11 @@
android:layout_height="36dp"
android:layout_marginBottom="@dimen/dp_8"
android:layout_marginLeft="@dimen/dp_15"
android:visibility="gone"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_8"
android:text="@string/order_select_payer_notice"
android:textColor="#F74848" />
android:textColor="#F74848"
android:visibility="gone" />
<ImageView
android:id="@+id/line_notice"
......@@ -236,7 +236,8 @@
android:id="@+id/up_serve"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_54"
android:layout_below="@id/up_door">
android:layout_below="@id/up_door"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
......@@ -389,6 +390,7 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:paddingRight="23dp"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3" />
......@@ -399,6 +401,8 @@
android:text="@string/tv_order_yuan"
android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" />
</RelativeLayout>
<ImageView
......@@ -423,6 +427,33 @@
android:textColor="@color/cl_home_title_text_color"
android:textColorHint="@color/cl_selector_hui"
android:textSize="@dimen/sp_13.3" />
<LinearLayout
android:id="@+id/scan_pay"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_below="@id/et_door_info"
android:layout_margin="10dp"
android:background="@drawable/btn_green_react"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:src="@drawable/icon_w_scan" />
<TextView
android:id="@+id/tv_scan_pay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/scan_pay"
android:textColor="@color/cl_white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
......
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