|
|
@@ -42,8 +42,12 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
private TextView period_tv;
|
|
|
private TextView timpoint_tv;
|
|
|
private int sc_booktype = -1;
|
|
|
+ private int sc_cytype = -1;
|
|
|
private int setType;
|
|
|
private FormEditText bIntroductionEt;
|
|
|
+ private LinearLayout roomType_ll;
|
|
|
+ private TextView rtype1_tv;
|
|
|
+ private TextView rtype2_tv;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -58,6 +62,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
private void initView() {
|
|
|
setType = getIntent().getIntExtra("setType",-1);
|
|
|
|
|
|
+ //设置营业时间
|
|
|
mTvStartTime = (TextView) findViewById(R.id.tv_startTime);
|
|
|
mTvEndTime = (TextView) findViewById(R.id.tv_endTime);
|
|
|
mSubmitBtn = (Button) findViewById(R.id.submit_btn);
|
|
|
@@ -66,6 +71,7 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
mTvEndTime.setOnClickListener(this);
|
|
|
mSubmitBtn.setOnClickListener(this);
|
|
|
|
|
|
+ //设置预约时间类型
|
|
|
set_hour_ll = (LinearLayout)findViewById(R.id.set_hour_ll);
|
|
|
set_booktype_ll = (LinearLayout)findViewById(R.id.set_booktype_ll);
|
|
|
|
|
|
@@ -75,22 +81,38 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
timpoint_tv = (TextView) findViewById(R.id.timpoint_tv);
|
|
|
timpoint_tv.setOnClickListener(this);
|
|
|
|
|
|
+ //设置包房预订类型
|
|
|
+ roomType_ll = (LinearLayout) findViewById(R.id.set_roomtype_ll);
|
|
|
+ rtype1_tv = (TextView) findViewById(R.id.rtype1_tv);
|
|
|
+ rtype2_tv = (TextView) findViewById(R.id.rtype2_tv);
|
|
|
+ rtype1_tv.setOnClickListener(this);
|
|
|
+ rtype2_tv.setOnClickListener(this);
|
|
|
+
|
|
|
bIntroductionEt = (FormEditText) findViewById(R.id.business_Introduction_et);
|
|
|
if (setType == 1){
|
|
|
getSupportActionBar().setTitle("设置营业时间");
|
|
|
set_hour_ll.setVisibility(View.VISIBLE);
|
|
|
set_booktype_ll.setVisibility(View.GONE);
|
|
|
bIntroductionEt.setVisibility(View.GONE);
|
|
|
+ roomType_ll.setVisibility(View.GONE);
|
|
|
}else if (setType == 2){
|
|
|
getSupportActionBar().setTitle("设置预约时间类型");
|
|
|
set_hour_ll.setVisibility(View.GONE);
|
|
|
set_booktype_ll.setVisibility(View.VISIBLE);
|
|
|
bIntroductionEt.setVisibility(View.GONE);
|
|
|
+ roomType_ll.setVisibility(View.GONE);
|
|
|
}else if (setType == 3){
|
|
|
getSupportActionBar().setTitle("商家详情");
|
|
|
set_hour_ll.setVisibility(View.GONE);
|
|
|
set_booktype_ll.setVisibility(View.GONE);
|
|
|
bIntroductionEt.setVisibility(View.VISIBLE);
|
|
|
+ roomType_ll.setVisibility(View.GONE);
|
|
|
+ }else if (setType == 4){
|
|
|
+ getSupportActionBar().setTitle("设置包房预订类型");
|
|
|
+ set_hour_ll.setVisibility(View.GONE);
|
|
|
+ set_booktype_ll.setVisibility(View.GONE);
|
|
|
+ bIntroductionEt.setVisibility(View.GONE);
|
|
|
+ roomType_ll.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -108,6 +130,8 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
doSaveTimeType();
|
|
|
else if (setType == 3)
|
|
|
doSaveBIntroduction();
|
|
|
+ else if (setType == 4)
|
|
|
+ doSaveRoomtype();
|
|
|
}else if (v.getId() == R.id.tv_startTime){
|
|
|
startActivityForResult(new Intent(mContext, SelectCalendarActivity.class)
|
|
|
.putExtra("startDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
@@ -130,14 +154,61 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
sc_booktype = 0;
|
|
|
period_tv.setBackgroundResource(R.color.white);
|
|
|
timpoint_tv.setBackgroundResource(R.color.aqua);
|
|
|
+ }else if (v.getId() == R.id.rtype1_tv){
|
|
|
+ sc_cytype = 0;
|
|
|
+ rtype1_tv.setBackgroundResource(R.color.aqua);
|
|
|
+ rtype2_tv.setBackgroundResource(R.color.white);
|
|
|
+ }else if (v.getId() == R.id.rtype2_tv){
|
|
|
+ sc_cytype = 1;
|
|
|
+ rtype1_tv.setBackgroundResource(R.color.white);
|
|
|
+ rtype2_tv.setBackgroundResource(R.color.aqua);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void doSaveRoomtype() {
|
|
|
+ if ( sc_cytype == -1){
|
|
|
+ ToastMessage("请选择包房预订类型");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("sc_uu",CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
|
|
|
+ param.put(" sc_cytype", sc_cytype);
|
|
|
+
|
|
|
+ LogUtil.prinlnLongMsg("appStoreUpdate",JSONUtil.map2JSON(param));
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("user/appStoreUpdate")
|
|
|
+ .add("map", JSONUtil.map2JSON(param))
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ try {
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ LogUtil.prinlnLongMsg("appStoreUpdate", o.toString()+"");
|
|
|
+ //{"result":"true"}
|
|
|
+ if (o.toString().contains("result") && JSON.parseObject(o.toString()).getBooleanValue("result")){
|
|
|
+ Toast.makeText(ct,getString(R.string.save_success),Toast.LENGTH_LONG).show();
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
private void doSaveBIntroduction() {
|
|
|
if (StringUtil.isEmpty(bIntroductionEt.getText().toString())){
|
|
|
ToastMessage("请输入商家详情介绍");
|
|
|
return;
|
|
|
}
|
|
|
+ if (bIntroductionEt.getText().toString().contains("'")){
|
|
|
+ ToastMessage("含违规字符");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
Map<String,Object> param = new HashMap<>();
|
|
|
param.put("sc_uu",CommonUtil.getSharedPreferences(MyApplication.getInstance(),"erp_uu"));
|
|
|
@@ -237,11 +308,14 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
LogUtil.prinlnLongMsg("appCompanyAdmin", o.toString()+"");
|
|
|
// {"endtime":"17:00","result":"1","starttime":"10:00","url":"http://113.105.74.140:8081/u/123/100123/201709/o/ab6d93f74f9b4ec7a06f7dbfd725ec38.png"}
|
|
|
|
|
|
+
|
|
|
+ //预约时间段
|
|
|
if (o.toString().contains("starttime"))
|
|
|
mTvStartTime.setText(JSON.parseObject(o.toString()).getString("starttime")+"");
|
|
|
if (o.toString().contains("endtime"))
|
|
|
mTvEndTime.setText(JSON.parseObject(o.toString()).getString("endtime"));
|
|
|
String timekind = JSON.parseObject(o.toString()).getString("timekind");
|
|
|
+ //预约时间类型
|
|
|
if (!StringUtil.isEmpty(timekind)){
|
|
|
if ("1".equals(timekind)){
|
|
|
sc_booktype = 1;
|
|
|
@@ -253,9 +327,25 @@ public class BusinessHoursSetting extends BaseActivity implements View.OnClickLi
|
|
|
timpoint_tv.setBackgroundResource(R.color.aqua);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //商家详情介绍
|
|
|
if (o.toString().contains("introduce") && !StringUtil.isEmpty(JSON.parseObject(o.toString()).getString("introduce"))){
|
|
|
bIntroductionEt.setText(JSON.parseObject(o.toString()).getString("introduce"));
|
|
|
}
|
|
|
+
|
|
|
+ //包房预订类型
|
|
|
+ String cytype = JSON.parseObject(o.toString()).getString("cytype");
|
|
|
+ if (!StringUtil.isEmpty(cytype)){
|
|
|
+ if ("1".equals(cytype)){
|
|
|
+ sc_cytype = 1;
|
|
|
+ rtype1_tv.setBackgroundResource(R.color.white);
|
|
|
+ rtype2_tv.setBackgroundResource(R.color.aqua);
|
|
|
+ }else {
|
|
|
+ sc_cytype = 0;
|
|
|
+ rtype1_tv.setBackgroundResource(R.color.aqua);
|
|
|
+ rtype2_tv.setBackgroundResource(R.color.white);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|