Ejemplo n.º 1
0
  /** 获取抢单列表数据 */
  public void getData() {
    // 拼接url
    StringBuffer sb = new StringBuffer();
    sb.append(Constants.getCurrUrl()).append(Constants.URL_GET_REQUEST_LIST).append("?");
    String url = sb.toString();
    RequestParams rp = new RequestParams();
    rp.add("needid", needId);
    postWithLoading(
        url,
        rp,
        false,
        new HttpCallback() {
          @Override
          public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
            MyNeedListBean bean = (MyNeedListBean) t;
            if (bean != null && bean.data.size() != 0) {
              for (int i = 0; i < bean.data.size(); i++) {
                bankList.add(bean.data.get(i));
              }
              mListview.setAdapter(new ListAdapter());
            }

            String str = bean.data.size() + "人抢单";
            SpannableStringBuilder spanStrContent = new SpannableStringBuilder(str);
            ForegroundColorSpan span_1 = new ForegroundColorSpan(Color.argb(255, 255, 0, 0));
            spanStrContent.setSpan(span_1, 0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            mTVType.setText(spanStrContent.toString());

            // 时间
            if (!Utils.isEmpty(grabSingleBean.getEnddate())) {
              String[] sourceStrArray = grabSingleBean.getEnddate().split(" ");
              mTVTime.setText(sourceStrArray[0]);
              mTVTime.setCompoundDrawablesWithIntrinsicBounds(
                  getResources().getDrawable(R.drawable.pic_time), null, null, null);
            }
          }

          @Override
          public void onFailure(BaseBean base) {
            int status = base.getStatus(); // 状态码
            String msg = base.getMsg(); // 错误信息
            ToastUtil.show(mContext, "status = " + status + "\n" + "msg = " + msg);
          }
        },
        MyNeedListBean.class);
  }
Ejemplo n.º 2
0
  /** 获取个人数据 */
  public void getInfoData(String userid) {
    // 拼接url
    StringBuffer sb = new StringBuffer();
    sb.append(Constants.getCurrUrl()).append(Constants.GETINFO).append("?");
    String url = sb.toString();
    RequestParams rp = new RequestParams();
    rp.add("userid", userid);
    postWithLoading(
        url,
        rp,
        false,
        new HttpCallback() {
          @Override
          public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
            final MyInfoBean base = (MyInfoBean) t;
            if (base != null) {

              // 公司头像
              if (!Utils.isEmpty(base.getData().getImghead())) {
                String picUrl =
                    Constants.getCurrUrl()
                        + Constants.CASE_IMAGE_URL_HEADER
                        + base.getData().getImghead();
                ImageLoader.getInstance()
                    .displayImage(
                        picUrl,
                        mTVGSIcon,
                        TopADApplication.getSelf().getImageLoaderOption(),
                        new ImageLoadingListener() {
                          @Override
                          public void onLoadingStarted(String s, View view) {}

                          @Override
                          public void onLoadingFailed(String s, View view, FailReason failReason) {}

                          @Override
                          public void onLoadingComplete(String s, View view, Bitmap bitmap) {}

                          @Override
                          public void onLoadingCancelled(String s, View view) {}
                        });
              }

              // 公司名
              if (!Utils.isEmpty(base.getData().getCompanyname())) {
                mTVGSName.setText(base.getData().getCompanyname());
              }

              // 0 - 未开始 1-项目进行中,2-项目完成
              if ("2".equals(state)) {
                mTVProgectState.setText("项目已完成");
              } else if ("1".equals(state)) {
                mTVProgectState.setText("项目进行中...");
              }

              // 时间
              if (!Utils.isEmpty(base.getData().getAdddate())) {
                String[] sourceStrArray = base.getData().getAdddate().split(" ");
                mTVProgectTime.setText(sourceStrArray[0]);
              }

              mTVGSIcon.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                      MyNeedBean myNeedBean = new MyNeedBean();
                      myNeedBean.setAdddate(base.getData().getAdddate());
                      myNeedBean.setAddress(base.getData().getAddress());
                      myNeedBean.setBirthday(base.getData().getBirthday());
                      myNeedBean.setCompanyname(base.getData().getCompanyname());
                      myNeedBean.setId(base.getData().getId());
                      myNeedBean.setImgcard1(base.getData().getImgcard1());
                      myNeedBean.setImgcard2(base.getData().getImgcard2());
                      myNeedBean.setImgdiploma(base.getData().getImgdiploma());
                      myNeedBean.setImghead(base.getData().getImghead());
                      myNeedBean.setImglicense(base.getData().getImglicense());
                      myNeedBean.setImgnamecard(base.getData().getImgnamecard());
                      myNeedBean.setImghead(base.getData().getImghead());
                      myNeedBean.setIntro(base.getData().getIntro());
                      myNeedBean.setJob1(base.getData().getJob1());
                      myNeedBean.setJob2(base.getData().getJob2());
                      myNeedBean.setNeedid(needId);
                      myNeedBean.setNickname(base.getData().getNickname());
                      myNeedBean.setSex(base.getData().getSex());
                      myNeedBean.setUserid(base.getData().getUserid());

                      Intent intent = new Intent(MyNeedDetailsActivity.this, DetailsActivity.class);
                      intent.putExtra("data_details", myNeedBean);
                      startActivity(intent);
                    }
                  });
            }
          }

          @Override
          public void onFailure(BaseBean base) {
            String msg = base.getMsg(); // 错误信息
            ToastUtil.show(mContext, msg);
          }
        },
        MyInfoBean.class);
  }
Ejemplo n.º 3
0
  @Override
  public void onClick(View v) {
    super.onClick(v);
    switch (v.getId()) {
        // 项目完成
      case R.id.btn_finish:
        DialogManager.showDialog(
            MyNeedDetailsActivity.this,
            null,
            "点击确定,将完成项目。托管的项目款将直接打入接单方钱包。",
            "确定",
            "",
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                // 拼接url
                StringBuffer sb = new StringBuffer();
                sb.append(Constants.getCurrUrl()).append(Constants.URL_NEED_ENDPRJ).append("?");
                String url = sb.toString();
                RequestParams rp = new RequestParams();
                rp.add("needid", needId);
                rp.add("userid", grabSingleBean.getUserid());
                rp.add("token", TopADApplication.getSelf().getToken());
                postWithLoading(
                    url,
                    rp,
                    false,
                    new HttpCallback() {
                      @Override
                      public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
                        mFinish.setVisibility(View.GONE);
                        mProjectTrust.setVisibility(View.GONE);
                        mTVPrompt2.setVisibility(View.GONE);
                        mTVPrompt.setVisibility(View.GONE);
                        mTVProgectState.setText("项目已完成");
                      }

                      @Override
                      public void onFailure(BaseBean base) {
                        int status = base.getStatus(); // 状态码
                        String msg = base.getMsg(); // 错误信息
                        //                        ToastUtil.show(mContext, "status = " + status +
                        // "\n"
                        //                                + "msg = " + msg);
                      }
                    },
                    BaseBean.class);
              }
            },
            null,
            true,
            null);

        break;

        // 项目款托管
      case R.id.btn_project_trust:
        AliPayUtil aliPayUtil = new AliPayUtil(MyNeedDetailsActivity.this);
        aliPayUtil.aliPay(
            MyNeedDetailsActivity.this,
            "项目款托管",
            TopADApplication.getSelf().getUserId() + "|3|" + grabSingleBean.getId(),
            grabSingleBean.getBudget());
        break;

        // 项目取消
      case R.id.btn_project_cancel:
        // 拼接url
        StringBuffer sbcancel = new StringBuffer();
        sbcancel.append(Constants.getCurrUrl()).append(Constants.URL_NEED_DELPROJECT).append("?");
        String urlcancel = sbcancel.toString();
        RequestParams rpcancel = new RequestParams();
        rpcancel.add("needid", needId);
        rpcancel.add("userid", grabSingleBean.getUserid());
        rpcancel.add("token", TopADApplication.getSelf().getToken());
        postWithLoading(
            urlcancel,
            rpcancel,
            false,
            new HttpCallback() {
              @Override
              public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
                finish();
              }

              @Override
              public void onFailure(BaseBean base) {
                int status = base.getStatus(); // 状态码
                String msg = base.getMsg(); // 错误信息
                ToastUtil.show(mContext, "status = " + status + "\n" + "msg = " + msg);
              }
            },
            BaseBean.class);
        break;

      default:
        break;
    }
  }