Commit b1b1879e authored by linfeng's avatar linfeng

代码合并提交

parent 52f5bd8e
......@@ -167,5 +167,10 @@ public class ApiConfig {
*/
public static String HTTP_URL_CALENDAR_PRICE = RvFrameConfig.HOST + "/vehicle/vehicle_model/calendar_price/app/unauth/list/";
/**
* 获取租车价格
*/
public static String HTTP_URL_CALENDAR_UNAUTH_PRICE = RvFrameConfig.HOST + "/vehicle/vehicle_model/calendar_price/app/unauth/app/price";
public static String HTTP_URL_PRERENT_DAYS = RvFrameConfig.HOST + "/api/app/cofig/app/unauth/types?types=999";
}
......@@ -55,6 +55,7 @@ import com.rv.home.rv.module.ui.main.home.bean.CarTypeListBean;
import com.rv.home.rv.module.ui.main.home.bean.ConfirmOrderBean;
import com.rv.home.rv.module.ui.main.home.bean.DrivingListBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderAliPayBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderCalendarPriceBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderDataBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderMemberBean;
import com.rv.home.rv.module.ui.main.home.bean.OrderPayBean;
......@@ -188,6 +189,7 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
private List<SelectItemBean.DataBean> selectItem;
private List<CarCouponBean.DataBean.CarCouponTypeDataBean.CarCouponDataBean> selectCouponList = null;
private OrderMemberBean.DataBean memberData;
private OrderCalendarPriceBean calendarPriceBean;
public static Intent getIntent(Context context, OrderDataBean bean, CarTypeListBean.DataBeanX.DataBean carBean, String startTime, String endTime, OrderPriceBean beanPrice) {
return new Intent(context, ConfirmOrderActivity.class)
......@@ -279,14 +281,16 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
getMember();
getCarPrice();
}
@Override
public void onShowResult(int requestType, BaseBean result) {
switch (requestType) {
case 0:
// priceBean = (OrderPriceBean) result;
calendarPriceBean = (OrderCalendarPriceBean) result;
getMember();
break;
case 1:
ConfirmOrderBean orderBean = (ConfirmOrderBean) result;
......@@ -509,8 +513,8 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
showToast("请同意预定须知");
return;
}
String inviterPhone = edtInviterPhone.getText().toString().trim() ;
if(!TextUtils.isEmpty(inviterPhone) && inviterPhone.length() != 11){
String inviterPhone = edtInviterPhone.getText().toString().trim();
if (!TextUtils.isEmpty(inviterPhone) && inviterPhone.length() != 11) {
showToast("请输入正确的邀请人手机号");
return;
}
......@@ -547,6 +551,22 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
}.show();
}
/**
* 获取每天价格
*/
private void getCarPrice() {
Map<String, Object> headMap = new LinkedHashMap<>();
if (OkGoUtil.getToken() != null)
headMap.put("Authorization", OkGoUtil.getToken());
Map<String, Object> map = new LinkedHashMap<>();
map.put("startDate", dataBean.getStartTime());
map.put("endDate", dataBean.getEndTime());
map.put("vehicleModelId", mCarBean.getVehicleModel().getId());
mPresenter.getData(RvFrameConfig.VEHICLE_ORDER, 0, ApiConfig.HTTP_URL_CALENDAR_UNAUTH_PRICE, OrderCalendarPriceBean.class, map, headMap, true);
}
/**
* 创建订单
*/
......@@ -724,47 +744,52 @@ public class ConfirmOrderActivity extends BaseStatusActivity<CommonPresenter> {
* 支付价格计算
*/
private void getPayMoney() {
if (priceBean == null || priceBean.getData() == null || dataBean == null) {
if (priceBean == null || priceBean.getData() == null || dataBean == null || calendarPriceBean == null || calendarPriceBean.getData() == null) {
return;
}
ArrayList<OrderPriceDetailBean.ChildrenBean> childrenBeanList = new ArrayList<>(); //费用明细
double payMoney = 0.00;
double dayPrice = mCarBean.getVehicleModel().getSum();
// double dayPrice = mCarBean.getVehicleModel().getSum();
double totalPrice = 0.00; //租车总价
for (int i = 0; i < calendarPriceBean.getData().size(); i++) {
totalPrice = totalPrice + calendarPriceBean.getData().get(i).getPrice();
}
int dayNum = dataBean.getDayNum();
OrderPriceDetailBean.ChildrenBean childrenBean2 = new OrderPriceDetailBean.ChildrenBean();
childrenBean2.setKey("车辆租赁费");
childrenBean2.setDetail(dayNum + "天");
childrenBean2.setVal("¥" + new BigDecimal(dayPrice * dayNum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
childrenBean2.setVal("¥" + new BigDecimal(totalPrice).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
childrenBeanList.add(childrenBean2);
if (isMemberType == 0) { //是否使用会员 0 不使用
payMoney = dayPrice * dayNum + priceBean.getData().getDeposit(); //租车和押金价格
carAmount = dayPrice * dayNum;
payMoney = totalPrice + priceBean.getData().getDeposit(); //租车和押金价格
carAmount = totalPrice;
} else {
if (memberData != null) {
if (dayNum > memberData.getRentFreeDays()) {
payMoney = dayPrice * (dayNum - memberData.getRentFreeDays()) + priceBean.getData().getDeposit();
carAmount = dayPrice * (dayNum - memberData.getRentFreeDays());
OrderPriceDetailBean.ChildrenBean childrenBean1 = new OrderPriceDetailBean.ChildrenBean();
childrenBean1.setKey("免费天数");
childrenBean1.setDetail("会员天数" + (dayNum - memberData.getRentFreeDays()) + "天");
childrenBean1.setVal("-¥" + new BigDecimal(dayPrice * memberData.getRentFreeDays()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
childrenBeanList.add(childrenBean1);
} else if (dayNum <= memberData.getRentFreeDays()) {
payMoney = priceBean.getData().getDeposit();
carAmount = 0;
OrderPriceDetailBean.ChildrenBean childrenBean1 = new OrderPriceDetailBean.ChildrenBean();
childrenBean1.setKey("免费天数");
childrenBean1.setDetail("会员天数" + dayNum + "天");
childrenBean1.setVal("-¥" + new BigDecimal(dayPrice * dayNum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
childrenBeanList.add(childrenBean1);
}
}
// if (memberData != null) {
// if (dayNum > memberData.getRentFreeDays()) {
// payMoney = dayPrice * (dayNum - memberData.getRentFreeDays()) + priceBean.getData().getDeposit();
//
// carAmount = dayPrice * (dayNum - memberData.getRentFreeDays());
// OrderPriceDetailBean.ChildrenBean childrenBean1 = new OrderPriceDetailBean.ChildrenBean();
// childrenBean1.setKey("免费天数");
// childrenBean1.setDetail("会员天数" + (dayNum - memberData.getRentFreeDays()) + "天");
// childrenBean1.setVal("-¥" + new BigDecimal(dayPrice * memberData.getRentFreeDays()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
// childrenBeanList.add(childrenBean1);
// } else if (dayNum <= memberData.getRentFreeDays()) {
// payMoney = priceBean.getData().getDeposit();
// carAmount = 0;
//
// OrderPriceDetailBean.ChildrenBean childrenBean1 = new OrderPriceDetailBean.ChildrenBean();
// childrenBean1.setKey("免费天数");
// childrenBean1.setDetail("会员天数" + dayNum + "天");
// childrenBean1.setVal("-¥" + new BigDecimal(dayPrice * dayNum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
// childrenBeanList.add(childrenBean1);
// }
// }
}
if (drivingType == 1) {
payMoney = payMoney + priceBean.getData().getDriverAmount(); // + 专职司机
......
package com.rv.home.rv.module.ui.main.home.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.io.Serializable;
import java.util.List;
/**
* Desc:获取日历订单价格
*/
public class OrderCalendarPriceBean extends BaseBean implements Serializable {
private List<DataBean> data;
private boolean rel;
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public boolean isRel() {
return rel;
}
public void setRel(boolean rel) {
this.rel = rel;
}
public static class DataBean implements Serializable {
// "date": "2019-10-26 00:00:00",
// "price": 0.180,
// "no_discount_price": 0.30,
// "freeDays": 1
private long date;
private double price;
private double no_discount_price;
private double freeDays;
public long getDate() {
return date;
}
public void setDate(long date) {
this.date = date;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getNo_discount_price() {
return no_discount_price;
}
public void setNo_discount_price(double no_discount_price) {
this.no_discount_price = no_discount_price;
}
public double getFreeDays() {
return freeDays;
}
public void setFreeDays(double freeDays) {
this.freeDays = freeDays;
}
}
}
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 to comment