Browse Source

客户页面成交数量显示不正确的bug
客户列表显示bug

RaoMeng 9 years ago
parent
commit
84e505155a

+ 20 - 24
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/CustomerListActivity.java

@@ -99,7 +99,7 @@ public class CustomerListActivity extends BaseActivity implements View.OnClickLi
         mAdapter = new BussinessDetailAdapter(ct, jsonArray);
         mlist.setAdapter(mAdapter);
 
-        mEmptyLayout = new EmptyLayout(this,mlist.getRefreshableView());
+        mEmptyLayout = new EmptyLayout(this, mlist.getRefreshableView());
         mEmptyLayout.setShowLoadingButton(false);
         mEmptyLayout.setShowEmptyButton(false);
         mEmptyLayout.setShowErrorButton(false);
@@ -145,19 +145,19 @@ public class CustomerListActivity extends BaseActivity implements View.OnClickLi
     private void initData() {
         em_code = CommonUtil.getSharedPreferences(ct, "erp_username");
         sendHttpResquest(Constants.HTTP_SUCCESS_INIT, kind, page, 0, "");
-        DBManager dbManager=new DBManager(ct);
-        List<EmployeesEntity> db=  dbManager.select_getEmployee(
+        DBManager dbManager = new DBManager(ct);
+        List<EmployeesEntity> db = dbManager.select_getEmployee(
                 new String[]{CommonUtil.getSharedPreferences(ct, "erp_master"),
-                CommonUtil.getSharedPreferences(ct, "erp_username")}
+                        CommonUtil.getSharedPreferences(ct, "erp_username")}
                 , "whichsys=? and em_code=? ");
-        if (!ListUtils.isEmpty(db)){
-            for (EmployeesEntity model:db) {
+        if (!ListUtils.isEmpty(db)) {
+            for (EmployeesEntity model : db) {
                 Log.i(TAG, "initData:" + model.getEM_DEPART());
                 Log.i(TAG, "initData:" + model.getEM_POSITION());
                 Log.i(TAG, "initData:" + model.getCOMPANY());
             }
             tv_position.setText(db.get(0).getEM_POSITION());
-            tv_department.setText(db.get(0).getEM_DEFAULTORNAME()+"—>");
+            tv_department.setText(db.get(0).getEM_DEFAULTORNAME() + "—>");
         }
     }
 
@@ -385,23 +385,19 @@ public class CustomerListActivity extends BaseActivity implements View.OnClickLi
                     JSONArray json0 = JSON.parseObject(msg.getData().getString("result")).getJSONArray("customers0");
                     JSONArray json1 = JSON.parseObject(msg.getData().getString("result")).getJSONArray("customers1");
                     if (json0 != null && json1 != null) {
-                        if (page == 1) {
-                            unEndSize = json0.size();
-                            endSize = json1.size();
-                            totalSize = json.size();
+                        if (page == 1){
+                            unEndSize = json0.getJSONObject(0).getIntValue("count");
+                            endSize = json1.getJSONObject(0).getIntValue("count");
+                            totalSize = json.getJSONObject(0).getIntValue("count");
+
+                            CommonUtil.textSpanForStyle(tv_count_unend, unEndSize + "\n未成交", String.valueOf(unEndSize),
+                                    ct.getResources().getColor(R.color.yellow_home));
+                            CommonUtil.textSpanForStyle(tv_count_end, endSize + "\n已成交", String.valueOf(endSize),
+                                    ct.getResources().getColor(R.color.yellow_home));
+                            CommonUtil.textSpanForStyle(tv_count_total, totalSize + "\n全部客户", String.valueOf(totalSize),
+                                    ct.getResources().getColor(R.color.yellow_home));
                         }
-                     /*  else {
-                           unEndSize += json0.size();
-                           endSize += json1.size();
-                           totalSize += json.size();
-                       }*/
-
-                        CommonUtil.textSpanForStyle(tv_count_unend, unEndSize + "\n未成交", String.valueOf(unEndSize),
-                                ct.getResources().getColor(R.color.yellow_home));
-                        CommonUtil.textSpanForStyle(tv_count_end, endSize + "\n已成交", String.valueOf(endSize),
-                                ct.getResources().getColor(R.color.yellow_home));
-                        CommonUtil.textSpanForStyle(tv_count_total, totalSize + "\n全部客户", String.valueOf(totalSize),
-                                ct.getResources().getColor(R.color.yellow_home));
+
                     }
                     switch (type) {
                         case 0:
@@ -418,7 +414,7 @@ public class CustomerListActivity extends BaseActivity implements View.OnClickLi
                         if (page == 1) jsonArray.clear();
                         jsonArray.addAll(json);
                         mAdapter.notifyDataSetChanged();
-                    }else {
+                    } else {
                         mEmptyLayout.showEmpty();
                     }
                     mlist.onRefreshComplete();

+ 8 - 5
WeiChat/src/main/res/layout/item_customer_main.xml

@@ -3,20 +3,23 @@
     android:layout_height="wrap_content"
     style="@style/crm_ll_card">
 
-    <RelativeLayout style="@style/crm_ll_sale_item">
+    <LinearLayout style="@style/crm_ll_sale_item">
 
         <TextView
             android:id="@+id/tv_cu_title"
             android:text="深圳市优软科技有限公司"
             android:textSize="15sp"
-            style="@style/TextView_Basic" />
+            style="@style/TextView_Basic"
+            android:layout_width="0dp"
+            android:layout_weight="1"/>
 
         <TextView
-            android:layout_alignParentRight="true"
+            android:gravity="right"
             android:id="@+id/tv_cu_state"
             android:text="未成交"
-            style="@style/TextView_Basic" />
-    </RelativeLayout>
+            style="@style/TextView_Basic"
+            android:layout_width="wrap_content"/>
+    </LinearLayout>
     <LinearLayout style="@style/crm_ll_sale_item"
         android:visibility="gone">