Commit 6e81cf77 authored by zhang_z's avatar zhang_z

营销方案;

parent 5cf3032f
......@@ -22,6 +22,7 @@
<w>shixiu</w>
<w>skugrps</w>
<w>skus</w>
<w>strs</w>
<w>sunquan</w>
<w>xishi</w>
<w>yanqing</w>
......
......@@ -6,6 +6,7 @@ import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseActivity;
import com.xingdata.zzdpos.databinding.ActivityMsBinding;
import com.xingdata.zzdpos.model.Ms;
import com.xingdata.zzdpos.ui.dialog.LoadingDialog;
import com.xingdata.zzdpos.ui.marketing.ms.fragment.AddFragment;
import com.xingdata.zzdpos.ui.marketing.ms.fragment.EditorFragment;
import com.xingdata.zzdpos.ui.marketing.ms.fragment.ManagerFragment;
......@@ -18,6 +19,8 @@ public class MsActivity extends BaseActivity<MsPresenter, ActivityMsBinding> imp
private EditorFragment mEditorFragment = new EditorFragment();
private AddFragment mAddFragment = new AddFragment();
private LoadingDialog mLoadingDialog = new LoadingDialog();
@Override
public int getLayoutId() {
return R.layout.activity_ms;
......@@ -42,20 +45,22 @@ public class MsActivity extends BaseActivity<MsPresenter, ActivityMsBinding> imp
@Override
public void showEditorFragment(Ms ms) {
LogUtils.e("编辑 " + ms.getMsName());
start(mEditorFragment);
}
@Override
public void showEditorFragment(int msType) {
LogUtils.e("添加 " + msType);
start(mEditorFragment);
}
@Override
public void showLoadingDialog() {
mLoadingDialog.show(this);
}
@Override
public void dismissLoadingDialog() {
mLoadingDialog.dismiss();
}
}
package com.xingdata.zzdpos.ui.marketing.ms.adapter;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseSelectedAdapter;
import com.xingdata.zzdpos.base.BaseViewHolder;
import com.xingdata.zzdpos.databinding.ItemSelectorBinding;
import com.xingdata.zzdpos.ui.marketing.ms.model.BaseBean;
import java.util.ArrayList;
public class BeanAdapter<T extends BaseBean> extends BaseSelectedAdapter<T, ItemSelectorBinding> {
public BeanAdapter() {
super(R.layout.item_selector, new ArrayList<>(), true);
}
@Override
protected void convert(BaseViewHolder helper, ItemSelectorBinding mViewBinding, T item) {
mViewBinding.setSelected(getSelectedPosition() == helper.getAdapterPosition());
mViewBinding.tvName.getPaint().setFakeBoldText(getSelectedPosition() == helper.getAdapterPosition());
mViewBinding.tvName.setText(item.getName());
}
public String[] getStrs() {
String[] strs = new String[getData().size()];
for (int i = 0; i < getData().size(); i++) {
strs[i] = getData().get(i).getName();
}
return strs;
}
}
......@@ -29,11 +29,14 @@ public class AddFragment extends BaseFragment<MsPresenter, FragmentMsAddBinding>
mViewBinding.rlType.addItemDecoration(new MyMenuItemDecoration(mContext, 2, getResources().getColor(R.color.gray_kongming)));
// set t listener
mTypeAdapter.setOnItemClickListener((adapter, view, position) -> mPresenter.clickTypeItem(mTypeAdapter.getData().get(position)));
mTypeAdapter.setOnItemClickListener((adapter, view, position) -> {
this.pop();
mPresenter.clickTypeItem(mTypeAdapter.getData().get(position));
});
}
/**
*
* 获取类型列表
*/
private List<Integer> getTypeList() {
List<Integer> msList = new ArrayList<>();
......
package com.xingdata.zzdpos.ui.marketing.ms.fragment;
import android.app.DatePickerDialog;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
import com.xingdata.zzdpos.databinding.FragmentMsEditorBinding;
import com.xingdata.zzdpos.model.Ms;
import com.xingdata.zzdpos.ui.marketing.ms.MsPresenter;
import com.xingdata.zzdpos.ui.marketing.ms.adapter.BeanAdapter;
import com.xingdata.zzdpos.ui.marketing.ms.model.Area;
import com.xingdata.zzdpos.ui.marketing.ms.model.Group;
import com.xingdata.zzdpos.ui.marketing.ms.model.User;
import com.xingdata.zzdpos.util.ConvertUtil;
import java.util.ArrayList;
import java.util.List;
public class EditorFragment extends BaseFragment<MsPresenter, FragmentMsEditorBinding> {
private Ms mMs;
private BeanAdapter<Group> mGroupAdapter;
private BeanAdapter<Area> mAreaAdapter;
private BeanAdapter<User> mUserAdapter;
private DatePickerDialog mDateStartDialog, mDateEndDialog;
@Override
public int getLayoutId() {
return R.layout.fragment_ms_editor;
......@@ -14,6 +37,141 @@ public class EditorFragment extends BaseFragment<MsPresenter, FragmentMsEditorBi
@Override
public void initView() {
initF();
initInfoViews();
initTimeViews();
initMsViews();
setF();
}
private void initF() {
mMs = new Ms();
mMs.setMsDateBegin(20170105L);
mMs.setMsDateEnd(20170115L);
}
private void setF() {
List<Group> groups = new ArrayList<>();
groups.add(new Group(C.MS_GROUP.ALL, "全场"));
groups.add(new Group(C.MS_GROUP.CATE, "指定品类"));
groups.add(new Group(C.MS_GROUP.SKU, "指定商品"));
List<Area> areas = new ArrayList<>();
areas.add(new Area(0, "所有门店"));
areas.add(new Area(1, "本店"));
List<User> users = new ArrayList<>();
users.add(new User(0, "所有顾客"));
users.add(new User(0, "所有会员"));
mGroupAdapter.setNewData(groups);
mAreaAdapter.setNewData(areas);
mUserAdapter.setNewData(users);
}
/**
* 初始化基本信息界面
*/
private void initInfoViews() {
}
/**
* 初始化时间信息界面
*/
private void initTimeViews() {
mViewBinding.setDateStart(new StringBuffer(mMs.getMsDateBegin().toString()).insert(8, "日").insert(6, "月").insert(4, "年").toString());
mViewBinding.setDateEnd(new StringBuffer(mMs.getMsDateEnd().toString()).insert(8, "日").insert(6, "月").insert(4, "年").toString());
mViewBinding.tvTimeMore.setOnClickListener(view -> {
});
//date
mViewBinding.llDateStart.setOnClickListener(view -> {
showDatePickerDialog();
});
mViewBinding.llDateEnd.setOnClickListener(view -> {
});
}
/**
* 初始化活动信息界面
*/
private void initMsViews() {
// group
mGroupAdapter = new BeanAdapter<>();
mViewBinding.rlGroup.setAdapter(mGroupAdapter);
mViewBinding.rlGroup.setLayoutManager(new LinearLayoutManager(mContext));
// area
mAreaAdapter = new BeanAdapter<>();
// user
mUserAdapter = new BeanAdapter<>();
// listener
mGroupAdapter.setOnItemClickListener((adapter, view, position) -> {
});
mViewBinding.llArea.setOnClickListener(view -> showSelectorDialog(R.string.ms_editor_area, mAreaAdapter, (dialog1, which) -> {
mViewBinding.setArea(mAreaAdapter.getStrs()[which]);
mAreaAdapter.setSelectedPosition(which);
dialog1.dismiss();
})
);
mViewBinding.llUser.setOnClickListener(view -> showSelectorDialog(R.string.ms_editor_user, mUserAdapter, (dialog1, which) -> {
mViewBinding.setUser(mUserAdapter.getStrs()[which]);
mUserAdapter.setSelectedPosition(which);
dialog1.dismiss();
})
);
}
private void showDatePickerDialog() {
String[] strings = mViewBinding.getDateStart().split("[^x00-xff]");
DatePickerDialog dialog = new DatePickerDialog(mContext, 0, (datePicker, year, month, day) -> {
mViewBinding.setDateStart(year + "年" + (month + 1) + "月" + day + "日");
mMs.setMsDateBegin(ConvertUtil.stringToLong(year + "" + month + 1 + "" + day));
// if (textView.getId() == R.id.tv_date_end &&
// Integer.valueOf(mViewBinding.tvDateStart.getText().toString().replace("-", "")) >
// Integer.valueOf(mViewBinding.tvDateEnd.getText().toString().replace("-", ""))) {
// mViewBinding.tvDateStart.setText(mViewBinding.tvDateEnd.getText());
// String[] stringEnds = mViewBinding.tvDateEnd.getText().toString().split("-");
// mDateStartBinding.dp.updateDate(Integer.valueOf(stringEnds[0]), Integer.valueOf(stringEnds[1]) - 1, Integer.valueOf(stringEnds[2]));
// }
// if (textView.getId() == R.id.tv_date_start &&
// Integer.valueOf(mViewBinding.tvDateStart.getText().toString().replace("-", "")) >
// Integer.valueOf(mViewBinding.tvDateEnd.getText().toString().replace("-", ""))) {
// mViewBinding.tvDateEnd.setText(mViewBinding.tvDateStart.getText());
// String[] stringStarts = mViewBinding.tvDateStart.getText().toString().split("-");
// mDateEndBinding.dp.updateDate(Integer.valueOf(stringStarts[0]), Integer.valueOf(stringStarts[1]) - 1, Integer.valueOf(stringStarts[2]));
// }
}, Integer.valueOf(strings[0]), Integer.valueOf(strings[1]) - 1, Integer.valueOf(strings[2]));//后边三个参数为显示dialog时默认的日期,月份从0开始,0-11对应1-12个月
dialog.show();
}
private void initDatePickerDialog(String date) {
String[] strings = date.split("[^x00-xff]");
}
/**
* 显示选择对话框
*
* @param title 标题
* @param adapter 适配器信息
* @param onClickListener item点击事件
*/
private void showSelectorDialog(int title, BeanAdapter adapter, DialogInterface.OnClickListener onClickListener) {
new AlertDialog.Builder(mContext).setTitle(title)
.setSingleChoiceItems(adapter.getStrs(), adapter.getSelectedPosition(), onClickListener)
.create().show();
}
}
package com.xingdata.zzdpos.ui.marketing.ms.model;
public class Area extends BaseBean {
public Area(int id, String name) {
setId(id);
setName(name);
}
}
package com.xingdata.zzdpos.ui.marketing.ms.model;
public class BaseBean {
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.xingdata.zzdpos.ui.marketing.ms.model;
public class Group extends BaseBean {
public Group(int id, String name) {
setId(id);
setName(name);
}
}
package com.xingdata.zzdpos.ui.marketing.ms.model;
public class Type extends BaseBean {
public Type(int id, String name) {
setId(id);
setName(name);
}
}
package com.xingdata.zzdpos.ui.marketing.ms.model;
public class User extends BaseBean {
public User(int id, String name) {
setId(id);
setName(name);
}
}
......@@ -3,19 +3,19 @@ package com.xingdata.zzdpos.ui.store.adapter;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseSelectedAdapter;
import com.xingdata.zzdpos.base.BaseViewHolder;
import com.xingdata.zzdpos.databinding.ItemStoreSkugrpBinding;
import com.xingdata.zzdpos.databinding.ItemSelectorBinding;
import com.xingdata.zzdpos.model.Sskugrp;
import java.util.ArrayList;
public class SkugrpAdapter extends BaseSelectedAdapter<Sskugrp, ItemStoreSkugrpBinding> {
public class SkugrpAdapter extends BaseSelectedAdapter<Sskugrp, ItemSelectorBinding> {
public SkugrpAdapter() {
super(R.layout.item_store_skugrp, new ArrayList<>(), false);
super(R.layout.item_selector, new ArrayList<>(), false);
}
@Override
protected void convert(BaseViewHolder helper, ItemStoreSkugrpBinding mViewBinding, Sskugrp item) {
protected void convert(BaseViewHolder helper, ItemSelectorBinding mViewBinding, Sskugrp item) {
mViewBinding.setSelected(getSelectedPosition() == helper.getAdapterPosition());
mViewBinding.tvName.getPaint().setFakeBoldText(getSelectedPosition() == helper.getAdapterPosition());
mViewBinding.tvName.setText(item.getSkuGrpName());
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
<data>
<variable
name="name"
type="String" />
<variable
name="dateStart"
type="String" />
<variable
name="dateEnd"
type="String" />
<variable
name="timeStart"
type="String" />
<variable
name="timeEnd"
type="String" />
<variable
name="user"
type="String" />
<variable
name="area"
type="String" />
</data>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_zhouyu"
android:orientation="vertical">
android:background="@color/gray_zhouyu">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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/ms_editor_subtitle_info"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_sub_title_size" />
<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:background="@color/white_caocao"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/ms_editor_name"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/transparent"
android:hint="@string/ms_editor_name_hint"
android:text="@{name}"
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
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:orientation="horizontal"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/ms_editor_subtitle_time"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_sub_title_size" />
<TextView
android:id="@+id/tv_time_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground"
android:paddingBottom="@dimen/all_spacing"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin"
android:paddingTop="@dimen/all_spacing"
android:text="@string/ms_editor_time_more"
android:textColor="@color/blue_mawu"
android:textSize="@dimen/all_body_size" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" />
<LinearLayout
android:id="@+id/ll_date_start"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/ms_editor_date_start"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/all_margin"
android:drawableEnd="@mipmap/createstore_drop_down"
android:gravity="center_vertical"
android:text="@{dateStart}"
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_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
<LinearLayout
android:id="@+id/ll_date_end"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/ms_editor_date_end"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/all_margin"
android:drawableEnd="@mipmap/createstore_drop_down"
android:gravity="center_vertical"
android:text="@{dateEnd}"
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" />
<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/ms_editor_subtitle_ms"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_sub_title_size" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" />
<LinearLayout
android:id="@+id/ll_user"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/ms_editor_user"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/all_margin"
android:drawableEnd="@mipmap/createstore_drop_down"
android:gravity="center_vertical"
android:text="@{user}"
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_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
<LinearLayout
android:id="@+id/ll_area"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/ms_editor_area"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/all_margin"
android:drawableEnd="@mipmap/createstore_drop_down"
android:gravity="center_vertical"
android:text="@{area}"
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" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginTop="@dimen/all_margin"
android:background="@color/gray_huanggai" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/rl_group"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/f_group"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginTop="@dimen/all_margin"
android:background="@color/gray_huanggai" />
<FrameLayout
android:id="@+id/f_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white_caocao" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginBottom="@dimen/all_margin"
android:background="@color/gray_huanggai" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</layout>
\ No newline at end of file
......@@ -11,6 +11,7 @@
<dimen name="all_text_size">16sp</dimen>
<dimen name="all_text_size_small">12sp</dimen>
<dimen name="all_caption_size">12sp</dimen>
<dimen name="all_body_size">14sp</dimen>
<dimen name="all_tiny_size">9sp</dimen>
<dimen name="all_title_size">26sp</dimen>
<dimen name="all_padding">10dp</dimen>
......
......@@ -325,14 +325,21 @@
<string name="ms_empty_hint">没有搜到此计划\n请重新搜索,或点击添加按钮进行添加~</string>
<string name="ms_editor_title">管理-营销计划</string>
<string name="ms_editor_setting">设置营销计划</string>
<string name="ms_editor_name">计划名称:</string>
<string name="ms_editor_subtitle_info">基本信息</string>
<string name="ms_editor_name">计划名称</string>
<string name="ms_editor_name_hint">请输入计划名称</string>
<string name="ms_editor_subtitle_time">时间信息</string>
<string name="ms_editor_time_more">更多设置</string>
<string name="ms_editor_date">起止时间:</string>
<string name="ms_editor_date_start">开始时间</string>
<string name="ms_editor_date_end">结束时间</string>
<string name="ms_editor_time">限定时段:</string>
<string name="ms_editor_week">限定星期:</string>
<string name="ms_editor_subtitle_ms">活动信息</string>
<string name="ms_editor_type">营销方式:</string>
<string name="ms_editor_group">营销对象:</string>
<string name="ms_editor_area">营销范围:</string>
<string name="ms_editor_group">营销主体</string>
<string name="ms_editor_user">营销对象</string>
<string name="ms_editor_area">营销范围</string>
<string name="ms_editor_buy"></string>
<string name="ms_editor_group_all_hint">任意商品</string>
<string name="ms_editor_group_skugrp_hint">品类下的任意商品</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