public ModelLocalCar(JSONObject object) throws JSONException {
   if (object != null) {
     store = new ModelStoreSelected(object.optJSONObject("store"));
     storePostInfo = new ModelStorePostInfo(object.optJSONObject("storePostInfo"));
     diliver = new ModelDiliver(object.optJSONObject("diliver"));
     payment = new ModelPayment(object.optJSONObject("payment"));
     JSONArray array = object.optJSONArray("goods");
     if (array != null) {
       goodsMoney = 0;
       postFee = 0;
       for (int i = 0; i < array.length(); i++) {
         ModelLocalCarGoods goods = new ModelLocalCarGoods(array.optJSONObject(i));
         carGoods.add(goods);
         if (goods.isSelected()) {
           goodsCount += goods.getGoodsCount();
           goodsMoney += goods.getGoodsCount() * goods.getGoods().getRetailPrice();
         } else {
           isSelected = false;
         }
       }
       if (diliver.getType() != ModelDiliver.TYPE_SELF
           & goodsMoney > 0
           & goodsMoney < storePostInfo.getHawManyPackages()) {
         // 非自取,购物金额大于0且小于免邮金额
         postFee = storePostInfo.getPostage();
       }
       totalMoney = goodsMoney + postFee;
     }
   }
   setStorePostInfo();
 }
 public JSONObject toJsonObject() throws JSONException {
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("store", store.getJsonObject());
   jsonObject.put("storePostInfo", storePostInfo.getJsonObject());
   jsonObject.put("diliver", diliver.toJsonObject());
   jsonObject.put("payment", payment.toJsonObject());
   JSONArray jsonArray = new JSONArray();
   for (int i = 0; i < carGoods.size(); i++) {
     jsonArray.put(carGoods.get(i).toJsonObject());
   }
   jsonObject.put("goods", jsonArray);
   return jsonObject;
 }