Commit 39b0166f authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents 4892fe17 00fffede
......@@ -80,6 +80,10 @@ public class UserInfoEditFragment extends BaseFragment<UserPresenter, FragmentUs
ToastUtils.showShort("会员帐号不能为空");
return;
}
if (mViewBinding.userPhone.getText().length() !=11) {
ToastUtils.showShort("会员帐号长度必须11位");
return;
}
if (mViewBinding.userLevel.getText().length() == 0) {
ToastUtils.showShort("会员等级不能为空");
......
......@@ -41,7 +41,7 @@ public class RechargeRuleEditFragment extends BaseFragment<RechargeRulePresenter
mViewBinding.infoTitle.popMenu.setVisibility(View.GONE);
if (mMscard != null) {
mViewBinding.infoTitle.tvTitle.setText("修改会员");
mViewBinding.infoTitle.tvTitle.setText("修改充值优惠");
mViewBinding.ruleNameLayout.setVisibility(View.GONE);
mViewBinding.ruleName.setText("充" + ConvertUtil.fenToYuanNoZero(mMscard.getCruleChargeAmt()) + "送" + ConvertUtil.fenToYuanNoZero(mMscard.getCruleSendAmt()) + "元");
mViewBinding.rechargAmt.setText(ConvertUtil.fenToYuanNoZero(mMscard.getCruleChargeAmt()));
......
......@@ -20,6 +20,7 @@ import com.xingdata.zzdpos.model.Trule;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.model.VipRechargeOrder;
import com.xingdata.zzdpos.ui.dialog.PromptDialog;
import com.xingdata.zzdpos.ui.vip.fragment.VipAddSucceedFragment;
import com.xingdata.zzdpos.util.Global;
import com.xingdata.zzdpos.view.ViewTools;
......@@ -50,7 +51,9 @@ public class VipActivity extends BaseActivity<VipPresenter, ActivityVipBinding>
@Override
public void addVipSus(Vip vip) {
mPresenter.vipListFragment.updateVipSus(vip);
// mPresenter.vipListFragment.updateVipSus(vip);
mPresenter.vipAddSucceedFragment.setmVip(vip);
start(mPresenter.vipAddSucceedFragment);
}
@Override
......
......@@ -16,6 +16,7 @@ import com.xingdata.zzdpos.db.DBFactory;
import com.xingdata.zzdpos.model.Mscard;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.model.VipRechargeOrder;
import com.xingdata.zzdpos.ui.vip.fragment.VipAddSucceedFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipExpenseListFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipInfoEditFragment;
import com.xingdata.zzdpos.ui.vip.fragment.VipInfoFragment;
......@@ -37,6 +38,7 @@ public class VipPresenter extends VipContract.Presenter {
public VipTruleListFragment vipMscardListFragment = new VipTruleListFragment();
public VipSearchFragment vipSearchFragment = new VipSearchFragment();
public VipRechargeFragment vipRechargeFragment = new VipRechargeFragment();
public VipAddSucceedFragment vipAddSucceedFragment =new VipAddSucceedFragment();
public int inVipState = 0; //1 充值
@Override
......@@ -78,8 +80,11 @@ public class VipPresenter extends VipContract.Presenter {
@Override
public void addVip(Vip vip) {
int vipDis= vip.getVipDefDiscount();
if (vip.getVipId() == null) {
ApiFactory.User.addVip(vip).subscribe(mVip -> {
mVip.setVipLevelName(vip.getVipLevelName());
mVip.setVipDefDiscount(vipDis);
mView.addVipSus(mVip);
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
......
package com.xingdata.zzdpos.ui.vip.fragment;
/**
* Created by JM_DEV on 2017/12/21.
*/
import android.view.View;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentVipAddSucceedBinding;
import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.vip.VipPresenter;
import com.xingdata.zzdpos.util.ConvertUtil;
import com.xingdata.zzdpos.util.OnClickListener;
/**
* 会员信息界面
*/
public class VipAddSucceedFragment extends BaseFragment<VipPresenter, FragmentVipAddSucceedBinding> {
private Vip mVip;
@Override
public int getLayoutId() {
return R.layout.fragment_vip_add_succeed;
}
@Override
public void initView() {
mViewBinding.infoTitle.popMenu.setVisibility(View.GONE);
mViewBinding.infoTitle.tvTitle.setText("添加成功");
mViewBinding.vipName.setText(mVip.getVipName());
mViewBinding.vipMobile.setText(mVip.getVipMobile() + "");
if (String.valueOf(mVip.getVipTag()).equals("1")) {
mViewBinding.vipLevel.setText("超级会员" + " " + ConvertUtil.discount(mVip.getVipDefDiscount()) + "折");
} else {
mViewBinding.vipLevel.setText(mVip.getVipLevelName() + " " + ConvertUtil.discount(mVip.getVipDefDiscount()) + "折");
}
mViewBinding.onAdd.setOnClickListener(view -> {
ToastUtils.showShort("111");
});
// mViewBinding.setOnClickListener(view -> {
// switch (view.getId()) {
// case R.id.onSure:
//
// break;
//
// case R.id.onAdd;
//
// break;
//
// case R.id.
// }
// });
mViewBinding.infoTitle.ivBack.setOnClickListener(new OnClickListener() {
@Override
protected void myOnClickListener(View v) {
pop();
mPresenter.vipListFragment.updateVipSus(null);
}
});
}
public void setmVip(Vip mVip) {
this.mVip = mVip;
}
}
......@@ -37,8 +37,9 @@ import java.util.List;
public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipInfoEditBinding> {
private List<Level> levels;
private ArrayList<Level> mLevels = new ArrayList<>();
private Vip mVip;
private Vip vip;
private Byte vipTag;
private int vipDiscounts;
@Override
public int getLayoutId() {
......@@ -48,20 +49,20 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
@Override
public void initView() {
mViewBinding.infoTitle.popMenu.setVisibility(View.GONE);
if (mVip != null) {
if (vip != null) {
mViewBinding.infoTitle.tvTitle.setText("修改会员");
mViewBinding.vipDiscounts.setText(mVip.getVipLevelName() + mVip.getVipDefDiscount() + "折");
mViewBinding.vipBirthday.setText(StringUtil.format(new Date(mVip.getVipBirthday())));
mViewBinding.vipName.setText(mVip.getVipName());
mViewBinding.vipPhone.setText(mVip.getVipMobile() + "");
if (String.valueOf(mVip.getVipTag()).equals("1")) {
mViewBinding.vipDiscounts.setText("超级会员"+ " " + ConvertUtil.discount(mVip.getVipDefDiscount()) + "折");
mViewBinding.vipDiscounts.setText(vip.getVipLevelName() + vip.getVipDefDiscount() + "折");
mViewBinding.vipBirthday.setText(StringUtil.format(new Date(vip.getVipBirthday())));
mViewBinding.vipName.setText(vip.getVipName());
mViewBinding.vipPhone.setText(vip.getVipMobile() + "");
if (String.valueOf(vip.getVipTag()).equals("1")) {
mViewBinding.vipDiscounts.setText("超级会员" + " " + ConvertUtil.discount(vip.getVipDefDiscount()) + "折");
} else {
mViewBinding.vipDiscounts.setText(mVip.getVipLevelName() + " " + ConvertUtil.discount(mVip.getVipDefDiscount()) + "折");
mViewBinding.vipDiscounts.setText(vip.getVipLevelName() + " " + ConvertUtil.discount(vip.getVipDefDiscount()) + "折");
}
mViewBinding.vipDiscounts.setEnabled(false);
// ((CheckBox) mViewBinding.vipSuper).setChecked(mVip.getVipTag() == 1);
RadioButton radioButton = mViewBinding.vipSex.findViewWithTag(mVip.getVipSex().toString());
RadioButton radioButton = mViewBinding.vipSex.findViewWithTag(vip.getVipSex().toString());
if (radioButton != null) {
radioButton.setChecked(true);
}
......@@ -69,6 +70,7 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
mViewBinding.infoTitle.tvTitle.setText("添加会员");
mViewBinding.vipDiscounts.setEnabled(true);
mViewBinding.vipDiscounts.setText(levels.get(0).getVipLevelName() + " " + ConvertUtil.discount(levels.get(0).getVipDefDiscount()) + "折");
vipDiscounts = levels.get(0).getVipDefDiscount();
mViewBinding.vipBirthday.setText(StringUtil.format(new Date(System.currentTimeMillis())));
((RadioButton) mViewBinding.vipSex.getChildAt(0)).setChecked(true);
}
......@@ -96,9 +98,10 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
ToastUtils.showShort("手机号长度必须为11位");
return;
}
if (mVip == null) {
mVip = new Vip();
Vip mVip = new Vip();
if (vip != null) {
mVip.setVipId(vip.getVipId());
mVip.setVipDefDiscount(vip.getVipDefDiscount());
}
mVip.setVipName(mViewBinding.vipName.getText().toString().trim());
mVip.setVipMobile(Long.parseLong(mViewBinding.vipPhone.getText().toString().trim()));
......@@ -107,8 +110,9 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
mVip.setVipLevelName("超级会员");
} else {
mVip.setVipTag(Byte.parseByte("0"));
mVip.setVipLevelName(levels.get(0).getVipLevelName());
}
mVip.setVipDefDiscount(vipDiscounts);
int sexId = mViewBinding.vipSex.getCheckedRadioButtonId();
if (sexId != -1) {
mVip.setVipSex(Byte.parseByte(mViewBinding.vipSex.findViewById(sexId).getTag().toString()));
......@@ -136,8 +140,13 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
OptionsPickerView.OnOptionsSelectListener() {
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {
String tx = levels.get(options1).getPickerViewText();
mViewBinding.vipDiscounts.setText(tx + " " + ConvertUtil.discount(levels.get(options1 - 1).getVipDefDiscount()) + "折");
if (options1 == 0) {
mViewBinding.vipDiscounts.setText(levels.get(options1).getPickerViewText() + " " + ConvertUtil.discount(levels.get(options1).getVipDefDiscount()) + "折");
vipDiscounts = levels.get(options1).getVipDefDiscount();
} else {
mViewBinding.vipDiscounts.setText(levels.get(levels.size() - 1).getVipLevelName() + " " + ConvertUtil.discount(levels.get(levels.size() - 1).getVipDefDiscount()) + "折");
vipDiscounts = levels.get(levels.size() - 1).getVipDefDiscount();
}
vipTag = Byte.parseByte(options1 + "");
}
}).setTitleText("请选择")
......@@ -159,11 +168,11 @@ public class VipInfoEditFragment extends BaseFragment<VipPresenter, FragmentVipI
}
public void setVip(Vip mVip) {
this.mVip = mVip;
this.vip = mVip;
}
public Vip getmVip() {
return mVip;
return vip;
}
//将两个选择时间的dialog放在该函数中
......
......@@ -194,6 +194,7 @@ public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListB
levels = levelPager.getList();
Level level = new Level();
level.setVipLevelName("超级会员");
level.setVipDefDiscount(levels.get(levels.size()-1).getVipDefDiscount());
levels.add(level);
}
......
......@@ -283,8 +283,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:orientation="horizontal">
<Button
......
......@@ -145,7 +145,6 @@
style="@style/button_positive_noradius"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:onClick="@{onClickListener}"
android:text="确认" />
......
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="onClickListener"
type="com.xingdata.zzdpos.util.OnClickListener" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
android:orientation="vertical">
<include
android:id="@+id/info_title"
layout="@layout/title_pop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/all_margin_left"
android:background="@mipmap/tv_bg"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/all_margin_left"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_succeed" />
<TextView
style="@style/default_blacktext_bigstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="添加成功" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_no_margin_smallstyle"
android:text="会员手机" />
<TextView
android:id="@+id/vip_name"
style="@style/default_blacktext_no_margin_smallstyle"
android:layout_width="match_parent"
android:gravity="right"
android:text="111111"
android:textColor="@color/black_likui" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_no_margin_smallstyle"
android:text="会员手机" />
<TextView
android:id="@+id/vip_mobile"
style="@style/default_blacktext_no_margin_smallstyle"
android:layout_width="match_parent"
android:gravity="right"
android:text="111111"
android:textColor="@color/black_likui" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/all_margin_left"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_no_margin_smallstyle"
android:text="会员等级" />
<TextView
android:id="@+id/vip_level"
style="@style/default_blacktext_no_margin_smallstyle"
android:layout_width="match_parent"
android:gravity="right"
android:text=""
android:textColor="@color/black_likui" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:id="@+id/onSure"
style="@style/button_positive_noradius"
android:layout_alignParentBottom="true"
android:onClick="@{onClickListener}"
android:text="完成" />
<Button
android:id="@+id/onRecharge"
style="@style/button_positive_white"
android:layout_alignBottom="@id/onRecharge"
android:layout_alignParentBottom="true"
android:onClick="@{onClickListener}"
android:text="充值" />
<Button
android:id="@+id/onAdd"
style="@style/button_positive_white"
android:layout_alignBottom="@id/onRecharge"
android:layout_alignParentBottom="true"
android:onClick="@{onClickListener}"
android:text="继续添加" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -275,7 +275,6 @@
android:layout_gravity="center_vertical"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_margin_16_sp_style"
android:layout_width="wrap_content"
......
......@@ -231,8 +231,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:layout_height="match_parent"
android:orientation="horizontal">
......
......@@ -202,8 +202,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:layout_height="match_parent"
android:orientation="horizontal">
......
......@@ -15,34 +15,39 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/all_margin"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:background="@mipmap/img_boss" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/padding_big"
android:layout_marginTop="@dimen/padding_big"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="vertical">
<TextView
android:id="@+id/user_name"
style="@style/default_blacktext_bigstyle"
android:id="@+id/user_mobile"
android:textSize="@dimen/all_text_size_small"
style="@style/default_blacktext_margin_16_sp_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="张小萌" />
android:text="13311556556" />
<TextView
android:id="@+id/user_mobile"
style="@style/default_blacktext_smallstyle"
android:id="@+id/user_name"
style="@style/default_blacktext_margin_16_sp_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13311556556" />
android:text="张小萌" />
</LinearLayout>
<LinearLayout
......@@ -71,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="@dimen/detail_textview_size" />
android:textSize="@dimen/big_big_text_size" />
<TextView
android:layout_width="match_parent"
......
......@@ -9,8 +9,15 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_margin="@dimen/all_margin_left"
android:background="@mipmap/hd_default02"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -19,14 +26,14 @@
<TextView
android:id="@+id/vip_name"
style="@style/default_blacktext_bigstyle"
style="@style/default_blacktext_nopadding_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="张小萌" />
<TextView
android:id="@+id/vip_mobile"
style="@style/default_blacktext_smallstyle"
style="@style/default_blacktext_nopadding_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13311556556" />
......
......@@ -7,7 +7,6 @@
name="onClickListener"
type="com.xingdata.zzdpos.util.OnClickListener" />
</data>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
......
......@@ -63,6 +63,14 @@
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/all_text_size</item>
</style>
<style name="default_blacktext_no_margin_smallstyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">35dp</item>
<item name="android:gravity">center_vertical</item>
<item name="android:singleLine">true</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/all_text_size</item>
</style>
<style name="default_blacktext_margin_smallstyle">
<item name="android:layout_width">wrap_content</item>
......@@ -307,9 +315,34 @@
<style name="button_positive_noradius">
<item name="android:background">@drawable/selector_gradient_red_button_background_noradius </item>
<item name="android:layout_height">@dimen/button3_height</item>
<item name="android:layout_width">match_parent</item>
<item name="android:textColor">@color/white</item>
<item name="android:gravity">center</item>
<item name="android:focusable">false</item>
<item name="android:layout_marginLeft">@dimen/all_margin_left</item>
<item name="android:layout_marginRight">@dimen/all_margin_left</item>
<item name="android:layout_marginBottom">@dimen/all_margin_left</item>
<item name="android:focusableInTouchMode">false</item>
</style>
<style name="button_positive_white">
<item name="android:background">@drawable/shape_red_layout </item>
<item name="android:layout_height">@dimen/button3_height</item>
<item name="android:layout_width">match_parent</item>
<item name="android:textColor">@color/deep_red</item>
<item name="android:gravity">center</item>
<item name="android:focusable">false</item>
<item name="android:layout_marginLeft">@dimen/all_margin_left</item>
<item name="android:layout_marginRight">@dimen/all_margin_left</item>
<item name="android:layout_marginBottom">@dimen/all_margin_left</item>
<item name="android:focusableInTouchMode">false</item>
</style>
<style name="button_positive_red">
<item name="android:background">@drawable/selector_gradient_red_button_background_noradius </item>
<item name="android:layout_height">@dimen/button3_height</item>
<item name="android:textColor">@color/black</item>
<item name="android:gravity">center</item>
<item name="android:focusable">false</item>
<item name="android:layout_margin">@dimen/all_margin_left</item>
<item name="android:focusableInTouchMode">false</item>
</style>
......
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