Commit 61f3d5dc authored by zhang_z's avatar zhang_z

Merge remote-tracking branch 'origin/master'

parents 37e6451d 11e1ac1e
......@@ -539,6 +539,10 @@ public final class ApiFactory {
skuGrpId, keyword));
}
public static Observable<Pager<com.xingdata.zzdpos.model.Sssku>> querySssku(String wd) {
return run(Api.getInstance().service.querySssku(wd));
}
public static Observable<Pager<com.xingdata.zzdpos.model.Sssku>> querySssku(int pageNum,
String keyword) {
return run(Api.getInstance().service.querySssku(pageNum, C.PRODUCT.PAGE_SIZE, keyword));
......
......@@ -417,6 +417,9 @@ interface ApiService {
@POST(C.URL.SSSKU.detail)
Observable<HttpMessage<Sssku>> detailSssku(@Query("id") Long id);
@POST(C.URL.SSSKU.query)
Observable<HttpMessage<Pager<Sssku>>> querySssku(@Query("wd") String barcode);
@POST(C.URL.SSSKU.update)
Observable<HttpMessage<Sssku>> updateSssku(@Body Sssku sssku);
......
......@@ -3,6 +3,7 @@ package com.xingdata.zzdpos.ui.manage.inventory;
import com.blankj.utilcode.util.TimeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.api.ApiFactory;
import com.xingdata.zzdpos.db.DB;
......@@ -11,6 +12,7 @@ import com.xingdata.zzdpos.model.Cs;
import com.xingdata.zzdpos.model.CsDetail;
import com.xingdata.zzdpos.model.Sssku;
import com.xingdata.zzdpos.ui.main.MainPresenter;
import com.xingdata.zzdpos.util.ConvertUtil;
import com.xingdata.zzdpos.util.StringUtil;
......@@ -71,20 +73,9 @@ public class InventoryPresenter extends InventoryContract.Presenter {
* @param barcode 条形码
*/
public void getProductByBarcode(String barcode) {
mView.isShowLoading(true);
mCompositeDisposable.add(
queryProductsByScan(barcode).subscribe(ssskus -> {
mView.isShowLoading(false);
mView.searchGoodsSuc();
if (ssskus.size() > 1) {
mView.addInventoryGoodsItem(ssskus);
} else if (ssskus.size() == 1) {
mView.addInventoryGoodsItem(ssskus.get(0));
} else {
ToastUtils.showShort("没有此商品");
}
})
);
queryProductsByScan(barcode);
}
/**
......@@ -93,11 +84,22 @@ public class InventoryPresenter extends InventoryContract.Presenter {
* @param barcode 扫描出的条形码
* @return 商品信息
*/
public static Observable<List<Sssku>> queryProductsByScan(String barcode) {
RealmQuery<Sssku> query = DB.getInstance().get(MainPresenter.class).where(Sssku.class);
query.equalTo("spuBarcode", StringUtil.strToLong(barcode)).equalTo("skuStatus", 0);
return Observable.just(query.findAll())
.flatMap(ssskus -> Observable.just(getList(ssskus)));
public void queryProductsByScan(String barcode) {
mView.isShowLoading(true);
ApiFactory.Sssku.querySssku(barcode).doFinally(() -> mView.isShowLoading(false))
.subscribe(
ssskuPager -> {
mView.searchGoodsSuc();
if (ssskuPager.getList().size() > 1) {
mView.addInventoryGoodsItem(ssskuPager.getList());
} else if (ssskuPager.getList().size() == 1) {
mView.addInventoryGoodsItem(ssskuPager.getList().get(0));
} else {
ToastUtils.showShort("没有此商品");
}
}, throwable -> {
ToastUtils.showShort("删除" + throwable.getMessage());
});
}
@Override
......@@ -117,7 +119,7 @@ public class InventoryPresenter extends InventoryContract.Presenter {
mView.isShowLoading(true);
ApiFactory.Cs.delCsDetail(cs.getId(), cs.getCsNo()).doFinally(() -> mView.isShowLoading(false))
.subscribe(object -> {
mView.delSucc();
mView.delSucc();
}, throwable -> {
ToastUtils.showShort(throwable.getMessage());
});
......@@ -130,7 +132,7 @@ public class InventoryPresenter extends InventoryContract.Presenter {
@Override
public void changeTitle(String s, boolean b) {
mView.changeTitle(s,b);
mView.changeTitle(s, b);
}
@Override
......@@ -140,7 +142,7 @@ public class InventoryPresenter extends InventoryContract.Presenter {
.subscribe(object -> {
mView.disInventoryDetailFragment(false);
}, throwable -> {
ToastUtils.showShort("删除"+throwable.getMessage());
ToastUtils.showShort("删除" + throwable.getMessage());
});
}
......
......@@ -36,12 +36,16 @@ public class VipExpenseAdapter extends BaseAdapter<Saleorder, ItemVipExpenseItem
getPayName(item);
//设置支付方式
mViewBinding.expenseType.setText(item.getPayName());
mViewBinding.imgLeft.setBackgroundResource(getPayName(item));
mViewBinding.expenseTime.setText(StringUtil.format(new Date(item.getCreateTime()),StringUtil.mmddhhmmmDatePattern));
if (getPayName(item) != -1) {
mViewBinding.imgLeft.setBackgroundResource(getPayName(item));
} else {
System.out.println("aaaaaaaaaaaaa");
}
mViewBinding.expenseTime.setText(StringUtil.format(new Date(item.getCreateTime()), StringUtil.mmddhhmmmDatePattern));
}
public Integer getPayName(Saleorder item) {
Integer inBG=-1;
Integer inBG=null;
switch (item.getPayType()) {
case C.PAY_CHANNEL.CASH:
inBG = R.mipmap.pay_cash;
......@@ -61,6 +65,10 @@ public class VipExpenseAdapter extends BaseAdapter<Saleorder, ItemVipExpenseItem
case C.PAY_CHANNEL.TALLY:
inBG = R.mipmap.pay_credit;
break;
default:
inBG = R.mipmap.pay_credit;
break;
}
return inBG;
......
......@@ -29,10 +29,10 @@ public class VipTruleAdapter extends BaseAdapter<Trule, ItemVipMscardItemBinding
@Override
protected void convert(ItemVipMscardItemBinding mViewBinding, Trule item) {
mViewBinding.truleName.setText(item.getTruleName());
mViewBinding.truleMoney.setText(ConvertUtil.fenToYuanNoZero(item.getTruleValAmt()));
mViewBinding.truleName.setText(ConvertUtil.fenToYuanNoZero(item.getTruleValAmt()));
mViewBinding.truleMoney.setText("满"+ConvertUtil.fenToYuanNoZero(item.getTruleValAmt())+"元使用");
mViewBinding.truleValidity.setText(mContext.getString(R.string.vip_mscard_period_of_validity, StringUtil.format(new Date(item.getTruleExp()), "yyyy.MM.dd"), StringUtil.format(new Date(item.getTruleExp()), "yyyy.MM.dd")));
mViewBinding.truleCondition.setText(ConvertUtil.fenToYuanNoPoint(item.getTruleOrderAmt()));
// mViewBinding.truleCondition.setText(ConvertUtil.fenToYuanNoPoint(item.getTruleOrderAmt()));
if (item.getTruleStatus().toString().equals("0")) {
mViewBinding.truleBgLeft.setBackgroundResource(R.mipmap.return_ticket_one);
mViewBinding.truleBgRight.setBackgroundResource(R.mipmap.return_ticket_two);
......
......@@ -34,7 +34,7 @@ public class VipExpenseListFragment extends BaseFragment<VipPresenter, FragmentV
private VipExpenseAdapter vipRechargeAdapter;
private List<Saleorder> orders = new ArrayList<>();
private List<Level> levels = null;
private int pageNumber = 0;
private int pageNumber = 1;
@Override
......@@ -73,7 +73,7 @@ public class VipExpenseListFragment extends BaseFragment<VipPresenter, FragmentV
}
private void onRefresh() {
pageNumber = 0;
pageNumber = 1;
mPresenter.saleorderQuery(mVip.getVipId(), pageNumber);
}
......
......@@ -12,6 +12,7 @@ import com.xingdata.zzdpos.ui.vip.dialog.VipEditMenuDialog;
import com.xingdata.zzdpos.util.ConvertUtil;
import com.xingdata.zzdpos.util.StringUtil;
import java.util.Date;
import java.util.List;
/**
......@@ -48,9 +49,15 @@ public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipInfoB
}else {
mViewBinding.vipLevel.setText(mVip.getVipLevelName());
}
mViewBinding.vipBirthday.setText(mVip.getVipBirthday() + "");
String strDate=String.valueOf(mVip.getVipBirthday());
if (strDate.length()==8){
mViewBinding.vipBirthday.setText(strDate.substring(0, 4)+"-"+strDate.substring(4, 6)+"-"+strDate.substring(6, 8));
}else {
mViewBinding.vipBirthday.setText(strDate);
}
mViewBinding.vipName.setText(mVip.getVipName());
mViewBinding.vipMoble.setText(mVip.getVipMobile() + "");
mViewBinding.crtTime.setText(StringUtil.format(new Date(mVip.getCreateTime())));
mViewBinding.vipSex.setText(getVipSex(mVip.getVipSex()));
mViewBinding.vipDiscounts.setText(getString(R.string.vip_discount, ConvertUtil.discount(mVip.getVipDefDiscount() )+ ""));
mPresenter.ticketQuery(mVip.getVipId());
......@@ -94,5 +101,8 @@ public class VipInfoFragment extends BaseFragment<VipPresenter, FragmentVipInfoB
public void ticketQuerySus(List<Ticket> ticketPager) {
mViewBinding.ticketCount.setText(String.valueOf(ticketPager.size()));
}
}
......@@ -134,6 +134,7 @@ public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListB
}
start(mPresenter.vipSearchFragment);
});
mPresenter.getVipLevel(0, 200);
mPresenter.getVipNumber();
}
......@@ -267,7 +268,7 @@ public class VipListFragment extends BaseFragment<VipPresenter, FragmentVipListB
*/
public void getVipNumberSus(Sta sta) {
if (vipState != 0) {
mViewBinding.vipCount.setText(sta.getCardCount() + "");
mViewBinding.vipCount.setText(sta.getCardCount() + "/次");
mViewBinding.vipCountAddToday.setText("¥" + ConvertUtil.fenToYuan2(sta.getCardAmt()));
} else {
mViewBinding.vipCount.setText(sta.getVipCount() + "");
......
......@@ -49,9 +49,9 @@
<TextView
android:id="@+id/vipName"
style="@style/default_blacktext_bigstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/default_blacktext_bigstyle" />
android:layout_height="wrap_content" />
<TextView
android:id="@+id/vipMoble"
......@@ -227,8 +227,8 @@
<TextView
style="@style/default_blacktext_margin_16_sp_style"
android:layout_width="74dp"
android:text="年龄:" />
android:layout_width="110dp"
android:text="出生年月:" />
<TextView
android:id="@+id/vip_birthday"
......@@ -238,6 +238,27 @@
</LinearLayout>
<include layout="@layout/line_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<TextView
style="@style/default_blacktext_margin_16_sp_style"
android:layout_width="110dp"
android:text="注册日期:" />
<TextView
android:id="@+id/crt_time"
style="@style/default_blacktext_nopadding_smallstyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" />
</LinearLayout>
<include layout="@layout/line_layout" />
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -125,6 +125,7 @@
<include layout="@layout/line_layout"/>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_marginTop="@dimen/all_margin"
android:id="@+id/recharge_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
......@@ -42,7 +42,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text=""
android:textColor="@color/black_likui"
android:textSize="@dimen/all_text_size_small_small" />
</LinearLayout>
......
......@@ -4,93 +4,79 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/all_margin"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<RelativeLayout
android:id="@+id/trule_bg_left"
android:background="@mipmap/return_ticket_one"
android:orientation="vertical"
android:gravity="center_horizontal"
android:padding="5dp">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/return_ticket_one">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="horizontal">
<TextView
android:layout_marginRight="5dp"
android:layout_width="35dp"
android:layout_height="35dp"
android:background="@drawable/shape_white_oval"
android:gravity="center"
android:text="券"
android:textColor="@color/blue_mawu" />
style="@style/default_whitetext_no_margin_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥"
android:textSize="@dimen/all_text_size_low" />
<TextView
android:id="@+id/trule_name"
style="@style/default_bartext_style"
style="@style/default_whitetext_no_margin_smallstyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
android:textSize="@dimen/text_primary_title_smile" />
</LinearLayout>
<TextView
android:id="@+id/trule_validity"
android:layout_weight="1"
android:gravity="center"
style="@style/textView_body_small"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="@color/white" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/trule_bg_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trule_bg_right"
android:background="@mipmap/return_ticket_two"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/trule_money"
android:layout_weight="1"
style="@style/default_bartext_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
android:layout_marginTop="@dimen/all_spacing"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/big_text_size" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="@dimen/all_margin_left"
android:layout_marginRight="@dimen/all_margin_left"
android:background="@color/white" />
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginLeft="@dimen/all_padding"
android:layout_marginRight="@dimen/all_padding"
android:background="@color/gray1"></View>
<TextView
android:id="@+id/trule_validity"
style="@style/textView_body_small"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/all_spacing"
android:layout_weight="1"
android:id="@+id/trule_condition"
style="@style/default_bartext_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="@dimen/detail_textview_size" />
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/dialog_inputPassWord_textsize_small" />
</LinearLayout>
</LinearLayout>
......
......@@ -454,7 +454,7 @@
<string name="adv_plan"> 本级标准:消费金额满 %s</string>
<string name="level_Number">共有 %s个会员等级</string>
<string name="vip_level_title">等级设置</string>
<string name="vip_mscard_period_of_validity">有效期:%s-%s</string>
<string name="vip_mscard_period_of_validity">期限:%s-%s</string>
<!--会员充值-->
<string name="vip_recharge_title">会员充值</string>
......
......@@ -72,6 +72,14 @@
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/all_text_size</item>
</style>
<style name="default_whitetext_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/white</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>
......
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