Example #1
0
  public void getOrderFlow(String orderCharId) {

    mOrderControl.getOrderFlow(
        orderCharId,
        new OnSuccessListener<OrderFlowModel>() {
          @Override
          public void onSuccess(OrderFlowModel v, Response response) {
            if (null == v) {
              mActivity.findViewById(R.id.orderdetail_linear_orderflow).setVisibility(View.GONE);
              return;
            }
            mActivity.findViewById(R.id.orderdetail_linear_orderflow).setVisibility(View.VISIBLE);
            mOrderFlowModel = v;
            mOrderFlowAdapter = new OrderFlowAdapter(mActivity, mOrderFlowModel);
            ((LinearListView) mActivity.findViewById(R.id.orderdetail_linear_orderflow))
                .setAdapter(mOrderFlowAdapter);

            if (mOrderFlowModel.isShowMap()) {
              mActivity.findViewById(R.id.orderdetail_layout_map).setVisibility(View.VISIBLE);
              mActivity
                  .findViewById(R.id.orderdetail_layout_map)
                  .setOnClickListener(
                      new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                          ToolUtil.reportStatisticsClick(mActivity.getActivityPageId(), "21003");
                          mActivity.startMap();
                        }
                      });
              mActivity.findViewById(R.id.seperator_5).setVisibility(View.VISIBLE);
            }
            // if(mOrderFlowModel.getTotal() !=null )
            // ((TextView)mActivity.findViewById(
            // R.id.orderdetail_textview_flow_total_time)).setText(Html.fromHtml("您的订单处理时间共<strong>"
            // + mOrderFlowModel.getTotal() + "</strong>"));
            // 第三方流水
            /*
             * if (mOrderFlowModel.getThirdSysno() != null &&
             * mOrderFlowModel.getThirdType() != 0) { ((TextView)
             * mActivity
             * .findViewById(R.id.orderdetail_textview_loading))
             * .setText("正在从第三方快递查询流水,请稍候...");
             * getOrderFlowFromThird(); } else
             */ {
              mActivity.findViewById(R.id.orderdetail_linear_loading).setVisibility(View.GONE);
            }
          }
        },
        new OnErrorListener() {
          @Override
          public void onError(Ajax ajax, Response response) {
            ((TextView) mActivity.findViewById(R.id.orderdetail_textview_loading))
                .setText("查询失败, 请稍后再试.");
            mActivity.findViewById(R.id.orderdetail_loadingbar).setVisibility(View.GONE);
          }
        });
  }
Example #2
0
  public void cancelOrder(boolean withoutNotice) {
    if (withoutNotice == false) {
      UiUtils.showDialog(
          mActivity,
          R.string.caption_hint,
          R.string.message_order_cancel,
          R.string.btn_yes,
          R.string.btn_no,
          new AppDialog.OnClickListener() {

            @Override
            public void onDialogClick(int nButtonId) {
              if (nButtonId == AppDialog.BUTTON_POSITIVE) {
                cancelOrder(true);
              }
            }
          });
      return;
    }
    ToolUtil.sendTrack(
        mActivity.getClass().getName(),
        mActivity.getString(R.string.tag_OrderDetailActivity),
        OrderDetailActivity.class.getName(),
        mActivity.getString(R.string.tag_OrderDetailActivity),
        "03012");
    final String orderCharId = mOrderModel.getOrderCharId();

    OnSuccessListener<JSONObject> success =
        new OnSuccessListener<JSONObject>() {
          @Override
          public void onSuccess(JSONObject v, Response response) {
            mActivity.closeProgressLayer();
            if (v.optInt("errno", -1) == 0) {
              mActivity.setIsOperate(true);
              mActivity.initOrderDetailView();

              // Report for canceling order.
              StatisticsEngine.trackEvent(mActivity, "cancel_order", "orderId=" + orderCharId);
              AppStorage.setData(AppStorage.SCOPE_DEFAULT, AppStorage.KEY_MINE_RELOAD, "1", false);
            } else {
              String data = v.optString("data", "");
              data = data.equals("") ? Config.NORMAL_ERROR : data;
              UiUtils.makeToast(mActivity, data);
            }
          }
        };

    mActivity.showProgressLayer("正在取消订单, 请稍候...");
    mOrderControl.orderCancel(orderCharId, false, success, mActivity);
  }
Example #3
0
  public void getOrderInfo(String orderCharId) {

    mActivity.showLoadingLayer();
    mOrderControl.getOrderDetail(
        orderCharId,
        new OnSuccessListener<JSONObject>() {
          @Override
          public void onSuccess(JSONObject v, Response response) {
            mActivity.closeLoadingLayer();
            try {
              if (v.getInt("errno") != 0) {
                mOrderModel = null;
                UiUtils.makeToast(
                    mActivity,
                    v.optString("data") == null ? Config.NORMAL_ERROR : v.optString("data"));
              } else {
                mOrderModel = new OrderModel();
                JSONObject json = v.optJSONObject("data");
                mOrderInfo = v.getString("data");
                mOrderModel.parse(json);
              }
            } catch (Exception ex) {
              Log.e(LOG_TAG, ToolUtil.getStackTraceString(ex));
              mOrderModel = null;
            }

            if (mOrderModel != null) {
              renderOrderInfo();
            }
          }
        },
        new OnErrorListener() {
          @Override
          public void onError(Ajax ajax, Response response) {
            ((TextView) mActivity.findViewById(R.id.orderdetail_textview_loading))
                .setText("查询失败, 请稍后再试.");
            mActivity.findViewById(R.id.orderdetail_loadingbar).setVisibility(View.GONE);
          }
        });
  }