Browse Source

手机端,说货地址列表和详情优化

wufeng 2 years ago
parent
commit
28ce83a4a4
2 changed files with 7 additions and 5 deletions
  1. 1 4
      app/admin/logic/InventoryShoppingLogic.php
  2. 6 1
      app/mobile/logic/AddrLogic.php

+ 1 - 4
app/admin/logic/InventoryShoppingLogic.php

@@ -2,7 +2,6 @@
 
 namespace app\admin\logic;
 
-use app\model\AccountModel;
 use app\model\CommonModel;
 use app\model\GoodModel;
 use app\model\InventoryShoppingModel;
@@ -22,10 +21,8 @@ class InventoryShoppingLogic extends BaseLogic
             ->leftJoin('unit c', 'c.id=b.unit_id AND c.is_del=' . CommonModel::$del_normal);
 
         if ($data['good_name'] != '') $db = $db->whereLike('a.good_name', '%' . $data['good_name'] . '%');
-        if (($data['inventory_start'] != '') && ($data['inventory_end'] != '')) {
-            $db = $db->whereBetween('a.inventory', [$data['inventory_start'], $data['inventory_end']]);
+        if (($data['inventory_start'] != '') && ($data['inventory_end'] != '')) $db = $db->whereBetween('a.inventory', [$data['inventory_start'], $data['inventory_end']]);
 
-        }
 
         $count = $db->count('a.id');
 

+ 6 - 1
app/mobile/logic/AddrLogic.php

@@ -19,10 +19,12 @@ class AddrLogic extends BaseLogic
         $count = $db->count('id');
 
         $list = $db
-            ->field('id,addr_code,addr,contactor,mobile')
+            ->field('id,addr_code,addr,contactor,mobile,"" addr_name')
             ->page($data['page'], $data['size'])
             ->withAttr('addr_code', function ($val) {
                 return explode(',', $val);
+            })->withAttr('addr_name', function ($val, $da) {
+                return get_addr_name($da['addr_code']);
             })
             ->order('id', 'desc')
             ->select()
@@ -52,8 +54,11 @@ class AddrLogic extends BaseLogic
     {
         $rs = AddrModel::withoutField('uid,is_del')
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
+            ->append(['addr_name'])
             ->withAttr('addr_code', function ($val) {
                 return explode(',', $val);
+            })->withAttr('addr_name', function ($val, $da) {
+                return get_addr_name($da['addr_code']);
             })
             ->findOrEmpty()
             ->toArray();