Commit fb602576 authored by 王海's avatar 王海

Merge remote-tracking branch 'origin/master'

parents f14eb793 6dcf6e32
......@@ -39,28 +39,21 @@ public class Pay extends RealmObject implements BaseModel, BaseBean {
public void init() {
switch (getPayType()) {
case C.PAY_CHANNEL.CASH:
// iconId = new int[]{R.mipmap.pay_xianjin_no, R.mipmap.pay_xianjin};
isSelected = true;
break;
case C.PAY_CHANNEL.ALI:
// iconId = new int[]{R.mipmap.pay_zhifubao_no, R.mipmap.pay_zhifubao};
break;
case C.PAY_CHANNEL.WECHAT:
// iconId = new int[]{R.mipmap.pay_weixin_no, R.mipmap.pay_weixin};
break;
case C.PAY_CHANNEL.BANK:
// iconId = new int[]{R.mipmap.pay_yinlian_no, R.mipmap.pay_yinlian};
break;
case C.PAY_CHANNEL.CARD:
// iconId = new int[]{R.mipmap.pay_chuzhi_no, R.mipmap.pay_chuzhi};
isNeedVip = true;
break;
case C.PAY_CHANNEL.TALLY:
// iconId = new int[]{R.mipmap.pay_shezhang_no, R.mipmap.pay_shezhang};
isNeedVip = true;
break;
default:
// iconId = new int[]{R.mipmap.pay_xianjin_no, R.mipmap.pay_xianjin};
break;
}
}
......
......@@ -19,6 +19,7 @@ import com.xingdata.zzdpos.ui.manage.sssku.fragment.AddFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.DetailFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.EditorFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.ManagerFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.PriceFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.SearchFragment;
import com.xingdata.zzdpos.ui.manage.sssku.fragment.SkugrpFragment;
......@@ -33,6 +34,7 @@ public class SsskuActivity extends BaseActivity<SsskuPresenter, ActivitySsskuBin
private AddFragment mAddFragment = new AddFragment();
private EditorFragment mEditorFragment = new EditorFragment();
private DetailFragment mDetailFragment = new DetailFragment();
private PriceFragment mPriceFragment = new PriceFragment();
private LoadingDialog mLoadingDialog = new LoadingDialog();
......@@ -156,6 +158,13 @@ public class SsskuActivity extends BaseActivity<SsskuPresenter, ActivitySsskuBin
}
}
@Override
public void showPriceFragment(Sssku sku) {
this.showTitleBarByTitleMode(C.TITLE_MODE.TEXT);
mViewBinding.tvTitle.setText(R.string.sssku_update);
this.start(mPriceFragment.setSssku(sku));
}
@Override
public void showDetailFragment(Sssku sku) {
......
......@@ -101,6 +101,13 @@ public interface SsskuContract {
*/
void showEditorFragment(Sssku sku, int editMode);
/**
* 显示价格页面
*
* @param sku 要编辑的商品
*/
void showPriceFragment(Sssku sku);
/**
* 显示详情页面
*
......@@ -147,7 +154,6 @@ public interface SsskuContract {
*/
void updateSku(Sssku sssku);
/**
* 删除商品
*
......
......@@ -137,7 +137,7 @@ public class SsskuPresenter extends SsskuContract.Presenter {
@Override
public void clickEditPriceSku(Sssku sssku) {
//TODO
mView.showPriceFragment(sssku);
}
@Override
......@@ -212,7 +212,7 @@ public class SsskuPresenter extends SsskuContract.Presenter {
mView.showMsg("修改成功");
mView.backToEditFragment();
mView.backToManagerFragment();
if (sssku1.getSkuGrpId().longValue() == mSkuGrpId) {
if (sssku1.getSkuGrpId().longValue() == mSkuGrpId || mSkuGrpId == 0L) {
mView.updateSku(sssku1);
} else {
mView.deleteSku(sssku1.getSkuId());
......
......@@ -227,7 +227,7 @@ public class EditorFragment extends BaseFragment<SsskuPresenter, FragmentSsskuEd
mViewBinding.nsSkugrp.attachDataSource(mSskugrps);
for (int i = 0; i < mSskugrps.size(); i++) {
if (mSskugrps.get(i).getSkuGrpId().longValue() == mSssku.getSkuGrpId()) {
mViewBinding.nsType1.setSelectedIndex(i);
mViewBinding.nsSkugrp.setSelectedIndex(i);
}
}
......
package com.xingdata.zzdpos.ui.manage.sssku.fragment;
import android.view.View;
import android.widget.EditText;
import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentSsskuPriceBinding;
import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.ui.manage.sssku.SsskuActivity;
import com.xingdata.zzdpos.ui.manage.sssku.SsskuPresenter;
import com.xingdata.zzdpos.util.ConvertUtil;
import com.xingdata.zzdpos.util.InputFilters;
public class PriceFragment extends BaseFragment<SsskuPresenter, FragmentSsskuPriceBinding> {
private Sssku mSssku;
@Override
public int getLayoutId() {
return R.layout.fragment_sssku_price;
}
@Override
public void initView() {
mViewBinding.ivPic.setImageURI(mSssku.getSpuImg());
mViewBinding.setSku(mSssku);
this.initPriceView();
this.setPriceViewBySssku();
mViewBinding.btnConfirm.setOnClickListener(view -> {
this.processSssku();
mPresenter.clickConfirm(mSssku, C.SKU_EDITOR_MODE.UPDATE);
});
}
/**
* 设置商品
*
* @param sssku 商品信息
*/
public PriceFragment setSssku(Sssku sssku) {
this.mSssku = sssku;
return this;
}
/**
* 初始化价格
*/
private void initPriceView() {
View.OnFocusChangeListener mOnFocusChangeListener = (view, b) -> {
if (view instanceof EditText) {
EditText editText = (EditText) view;
if (b && editText.getText().toString().equals("0.0")) {
editText.setText("");
} else if (!b && editText.getText().length() == 0) {
editText.setText("0.0");
}
}
};
mViewBinding.etPrice1.setFilters(InputFilters.getMoneyFilter(6));
mViewBinding.etPrice2.setFilters(InputFilters.getMoneyFilter(6));
mViewBinding.etPrice1.setOnFocusChangeListener(mOnFocusChangeListener);
mViewBinding.etPrice2.setOnFocusChangeListener(mOnFocusChangeListener);
}
/**
* 根据商品设置价格页面
*/
private void setPriceViewBySssku() {
mViewBinding.etPrice1.setText(ConvertUtil.fenToYuan(mSssku.getSkuRetailPrice1()));
mViewBinding.etPrice2.setText(ConvertUtil.fenToYuan(mSssku.getSkuRetailPrice2()));
}
/**
* 处理商品
*/
private void processSssku() {
mSssku.setSkuRetailPrice1(ConvertUtil.yuanToFen(mViewBinding.etPrice1.getText().toString()));
mSssku.setSkuRetailPrice2(ConvertUtil.yuanToFen(mViewBinding.etPrice2.getText().toString()));
mSssku.setCreateTime(null);
mSssku.setUpdateTime(null);
}
@Override
public boolean onBackPressedSupport() {
((SsskuActivity) getActivity()).backToDetailFragment();
return super.onBackPressedSupport();
}
}
......@@ -4,15 +4,17 @@ import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseAdapter;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentSsskuSkugrpBinding;
import com.xingdata.zzdpos.databinding.ItemSsskuSkugrpBinding;
import com.xingdata.zzdpos.model.Sskugrp;
import com.xingdata.zzdpos.ui.manage.sssku.SsskuActivity;
import com.xingdata.zzdpos.ui.manage.sssku.SsskuPresenter;
import com.xingdata.zzdpos.ui.manage.sssku.adapter.SkugrpAdapter;
import com.xingdata.zzdpos.ui.manage.sssku.dialog.SkugrpEditorDialog;
import com.xingdata.zzdpos.ui.manage.sssku.dialog.SkugrpMenuDialog;
import java.util.ArrayList;
import java.util.List;
......@@ -30,11 +32,11 @@ public class SkugrpFragment extends BaseFragment<SsskuPresenter, FragmentSsskuSk
public void initView() {
mSkugrpAdapter = new SkugrpAdapter();
mSkugrpAdapter.setNewData(mSskugrps);
mViewBinding.setVisibility(mSskugrps.size() > 0 ? View.VISIBLE : View.INVISIBLE);
mViewBinding.rlSkugrp.setAdapter(mSkugrpAdapter);
mViewBinding.rlSkugrp.setLayoutManager(new LinearLayoutManager(mContext));
mViewBinding.setVisibility(View.INVISIBLE);
mViewBinding.llSkugrpAdd.setOnClickListener(view -> {
new SkugrpEditorDialog().show(((SsskuActivity) getActivity()));
});
......@@ -61,4 +63,17 @@ public class SkugrpFragment extends BaseFragment<SsskuPresenter, FragmentSsskuSk
((SsskuActivity) getActivity()).backToManagerFragment();
return super.onBackPressedSupport();
}
class SkugrpAdapter extends BaseAdapter<Sskugrp, ItemSsskuSkugrpBinding> {
SkugrpAdapter() {
super(R.layout.item_sssku_skugrp, new ArrayList<>());
}
@Override
protected void convert(ItemSsskuSkugrpBinding mViewBinding, Sskugrp item) {
mViewBinding.tvName.setText(item.getSkuGrpName());
}
}
}
......@@ -31,8 +31,7 @@
android:layout_height="@dimen/all_line_width"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming"
android:visibility="gone" />
android:background="@color/gray_kongming" />
<TextView
android:id="@+id/tv_update_price"
......@@ -42,8 +41,7 @@
android:gravity="center"
android:text="@string/sku_update_price"
android:textColor="@color/blue_mawu"
android:textSize="@dimen/all_text_size"
android:visibility="gone" />
android:textSize="@dimen/all_text_size" />
<View
android:layout_width="match_parent"
......
......@@ -185,6 +185,7 @@
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size"
app:layout_constraintHorizontal_weight="1.5"
......@@ -196,6 +197,7 @@
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size"
app:layout_constraintHorizontal_weight="1.5"
......@@ -207,6 +209,7 @@
android:layout_width="0dp"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size"
app:layout_constraintLeft_toLeftOf="@id/ns_type_1"
......@@ -242,6 +245,7 @@
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center_vertical"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
......@@ -283,6 +287,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
......@@ -741,6 +746,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<import type="com.xingdata.zzdpos.util.ConvertUtil" />
<variable
name="sku"
type="com.xingdata.zzdpos.model.Sssku" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white_caocao"
android:paddingTop="@dimen/all_margin">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/iv_pic"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginStart="@dimen/margin"
app:failureImage="@mipmap/icon_goods_default"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:placeholderImage="@mipmap/icon_goods_default"
app:roundedCornerRadius="@dimen/all_shape_radius" />
<TextView
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:lines="2"
android:text="@{sku.spuName}"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size"
app:layout_constraintLeft_toRightOf="@id/iv_pic"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/tv_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/all_margin"
android:background="@drawable/shape_gray_r1"
android:padding="@dimen/all_spacing"
android:text="@{@string/sku_size+sku.spuUnitName}"
android:textSize="@dimen/all_caption_size"
app:layout_constraintBottom_toBottomOf="@id/ll_price"
app:layout_constraintLeft_toLeftOf="@id/tv_name" />
<LinearLayout
android:id="@+id/ll_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/all_margin"
app:layout_constraintRight_toRightOf="@id/tv_name"
app:layout_constraintTop_toBottomOf="@id/tv_name">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/money_rmb"
android:textColor="@color/red_guanyu"
android:textSize="@dimen/all_caption_size"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{ConvertUtil.fenToYuan(sku.skuRetailPrice1)}"
android:textColor="@color/red_guanyu"
android:textSize="@dimen/all_text_size"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="@dimen/all_line_width"
android:layout_marginTop="@dimen/all_margin"
android:background="@color/gray_huanggai"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_pic" />
</android.support.constraint.ConstraintLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin"
android:text="@string/sku_subtitle_info"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_sub_title_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/all_spacing"
android:layout_weight="1"
android:background="@color/white_caocao"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingEnd="@null"
android:paddingStart="@dimen/all_margin"
android:text="@string/sku_price1"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<EditText
android:id="@+id/et_price1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="@color/transparent"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:labelFor="@+id/et_price1"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingEnd="@null"
android:paddingStart="@dimen/all_margin"
android:text="@string/sku_price2"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<EditText
android:id="@+id/et_price2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="@color/transparent"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:labelFor="@+id/et_price2"
android:saveEnabled="false"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" />
</LinearLayout>
<Button
android:id="@+id/btn_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/all_margin"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@drawable/shape_red_r1"
android:foreground="?android:attr/selectableItemBackground"
android:text="@string/all_confirm"
android:textColor="@color/white_caocao"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -31,7 +31,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="撒看见那"
android:textColor="@color/black_baozheng"
android:textSize="@{selected?@dimen/all_sub_title_size:@dimen/all_text_size}" />
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="spuName"
type="String" />
<variable
name="spuUnitName"
type="String" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:background="@color/white_caocao"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="vertical">
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_gravity="bottom"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
</FrameLayout>
</layout>
......@@ -696,6 +696,7 @@
<string name="sku_skugrp">分组</string>
<string name="sku_type">类别</string>
<string name="sku_unit">单位</string>
<string name="sku_subtitle_price">调整价格</string>
<string name="sku_price1">售价</string>
<string name="sku_price2">促销价</string>
<string name="sku_subtitle_vip">会员信息</string>
......
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