// 显示获取到 private void displayCustomerInfo() { mBalanceAmt.setText("¥" + Utils.num2String(mCustomerInfo.getBalance()) + "元"); mCouponNums.setText(mCustomerInfo.getCoupons().size() + "张"); }
/** 预下单 */ private void preCreateOrder(final int amt) { goods = new ArrayList<Good>(); Good good1 = new Good("大象", 1, amt, "专业的套套"); Good good2 = new Good("辛太急", 2, 0, ""); goods.add(good1); goods.add(good2); extraInfo = new ArrayList<ExtraInfo>(); ExtraInfo mobile = new ExtraInfo("电话", "186********"); ExtraInfo address = new ExtraInfo("地址", "望京SOHO 塔3 A17层"); extraInfo.add(address); extraInfo.add(mobile); int totalAmount = 0; for (Good good : goods) { totalAmount += good.good_amount * good.good_count; } mTotalAmt = totalAmount + ""; if (!Utils.isCanConnectionNetWork(MainActivity.this)) { Toast.makeText(MainActivity.this, "网络连接异常!", Toast.LENGTH_SHORT).show(); return; } if (null != dialog) { dialog.show(); } StringRequest req = new StringRequest( Method.POST, App.getDomain() + "/ordertoken", new Listener<String>() { @Override public void onResponse(String arg0) { try { if (dialog.isShowing()) { dialog.dismiss(); } T.d("return => " + arg0); JSONObject tokenJson = new JSONObject(arg0); ConstValue.orderToken = tokenJson.getString("token"); mqt.setOutOrderToken(ConstValue.orderToken); // 跳转到下单页面 jumpToCashier(mTotalAmt); } catch (Exception e) { if (dialog.isShowing()) { dialog.dismiss(); } T.d(e.toString()); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError arg0) { if (dialog.isShowing()) { dialog.dismiss(); } Toaster.show(MainActivity.this, "请求失败!"); T.d(arg0.toString()); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("total_amt", mTotalAmt); params.put("out_mchnt", App.getOutMerchant()); return params; } }; mQueue.add(req); }