private void sub() {
    JSONObject jb = new JSONObject();
    try {
      jb.put("price", mPrice);
      jb.put("marketPrice", mMarketPrice);
      jb.put("cash_pay", mCash);
      jb.put("name", mName);
      jb.put("title", mSortName);
      jb.put("cover_img", mListImg.get(0));
      jb.put("p_unit_name", mUnit);
      jb.put("descripation", mDec);
      JSONArray ja = new JSONArray();
      for (String str : mListImg) {
        ja.put(str);
      }
      jb.put("imgs", ja.toString());

    } catch (JSONException e) {

    }

    mHttpClient.postData1(
        NONSTANDAR_PRODUCT_ADD,
        new AppAjaxParam(jb),
        new AppAjaxCallback.onResultListener() {
          @Override
          public void onResult(String data, String msg) {
            showToast(msg);
            finish();
          }

          @Override
          public void onError(String error) {
            showToast(error);
          }
        });
  }
示例#2
0
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setTitleText("首页");
    //		initImageView(R.id.left_icon).setImageResource(R.drawable.ic_message);
    mUser = SharePreferencesUtil.getShopInfo(getActivity());
    if (mUser.getQ_verifi() != 1) {
      mOnSelectTab.onSelect(4);
    }

    // 昨日营收
    mTvSRY = (TextView) view.findViewById(R.id.sr_y);
    // 累计收入
    mTvSRT = (TextView) view.findViewById(R.id.sr_t);
    // 余额
    mTvSRE = (TextView) view.findViewById(R.id.sr_e);
    // 新的订单
    mTvOrderNew = (TextView) view.findViewById(R.id.o_new);
    // 代收货订单
    mTvOrderDai = (TextView) view.findViewById(R.id.o_dai);
    // 抢单订单
    mTvOrderQiang = (TextView) view.findViewById(R.id.o_qiang);

    // 新增用户
    mTvPNew = (TextView) view.findViewById(R.id.p_new);
    // 活跃用户
    mTvPHou = (TextView) view.findViewById(R.id.p_huo);
    // 累计用户
    mTvAll = (TextView) view.findViewById(R.id.p_all);

    mView1 = (LinearLayout) view.findViewById(R.id.view1);
    mView1.setOnClickListener(this);

    mView2 = (TextView) view.findViewById(R.id.view2);
    mView2.setOnClickListener(this);

    mView21 = (LinearLayout) view.findViewById(R.id.view2_1);
    mView21.setOnClickListener(this);

    mView22 = (LinearLayout) view.findViewById(R.id.view2_2);
    mView22.setOnClickListener(this);

    mView3 = (LinearLayout) view.findViewById(R.id.view3);
    mView3.setOnClickListener(this);

    mView4 = (LinearLayout) view.findViewById(R.id.view4);
    mView4.setOnClickListener(this);

    mTvName = (TextView) view.findViewById(R.id.name);
    mTvName.setText(mUser.getName());
    mTvName.setOnClickListener(this);

    JSONObject jb = new JSONObject();
    mAppHttpClient.postData1(
        HOME,
        new AppAjaxParam(jb),
        new onResultListener() {

          @Override
          public void onResult(String data, String msg) {

            try {
              JSONObject jb = new JSONObject(data);
              JSONObject jb1 = new JSONObject(jb.getString("custormer"));

              mTvPNew.setText(jb1.getString("new_add"));
              mTvPHou.setText(jb1.getString("hyl"));
              mTvAll.setText(jb1.getString("allU"));

              JSONObject jb2 = new JSONObject(jb.getString("order"));
              mTvOrderDai.setText(jb2.getString("shouHuo"));
              mTvOrderNew.setText(jb2.getString("newOrder"));
              mTvOrderQiang.setText(jb2.getString("robOrder"));

              JSONObject jb3 = new JSONObject(jb.getString("account"));
              mTvSRE.setText(PriceUtil.floatToString(jb3.getInt("balance")));
              mTvSRT.setText(PriceUtil.floatToString(jb3.getInt("LJYS")));
              mTvSRY.setText(PriceUtil.floatToString(jb3.getInt("YS")));
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }

          @Override
          public void onError(String error) {}
        });
  }