Browse Source

兑换商品库存列表追加商品相关字段

wufeng 2 years ago
parent
commit
d6c5e43036

+ 1 - 1
app/admin/controller/InventoryExchange.php

@@ -14,7 +14,7 @@ class InventoryExchange extends BaseController
     //获取兑换商品库存列表
     public function list()
     {
-        $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'inventory_start' => '', 'inventory_end' => '', 'username' => '', 'name' => '', 'mobile' => ''], 'post');
+        $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'inventory_start' => '', 'inventory_end' => '', 'username' => '', 'name' => '', 'mobile' => '', 'good_name' => '', 'good_code' => ''], 'post');
 
         return InventoryExchangeLogic::list($param);
     }

+ 5 - 2
app/admin/logic/InventoryExchangeLogic.php

@@ -19,17 +19,20 @@ class InventoryExchangeLogic extends BaseLogic
     public static function list(array $data = []): Json
     {
         $db = InventoryExchangeModel::alias('a')
-            ->leftJoin('account b', 'b.id=a.account_id AND b.is_del=' . CommonModel::$del_normal);
+            ->leftJoin('account b', 'b.id=a.account_id AND b.is_del=' . CommonModel::$del_normal)
+            ->leftJoin('good c', 'c.id=a.good_id AND c.is_del=' . CommonModel::$del_normal);
 
         if ($data['status'] != '') $db->where('b.status', $data['status']);
         if (($data['inventory_start'] != '') && ($data['inventory_end'] != '')) $db->whereBetween('a.inventory', [$data['inventory_start'], $data['inventory_end']]);
         if ($data['username'] != '') $db->whereLike('a.account_username', '%' . $data['username'] . '%');
         if ($data['name'] != '') $db->whereLike('a.account_name', '%' . $data['name'] . '%');
         if ($data['mobile'] != '') $db->whereLike('b.mobile', '%' . $data['mobile'] . '%');
+        if ($data['good_name'] != '') $db->whereLike('c.good_name', '%' . $data['good_name'] . '%');
+        if ($data['good_code'] != '') $db->whereLike('c.good_code', '%' . $data['good_code'] . '%');
 
         $count = $db->count('a.id');
 
-        $list = $db->field('a.id,a.account_username,b.status,a.account_name,b.mobile,a.inventory,a.updatetime')
+        $list = $db->field('a.id,a.account_username,b.status,a.account_name,b.mobile,a.inventory,a.updatetime,c.good_cover_img,c.good_code,c.good_name,c.moq,c.step,c.good_remark,c.unit_id,c.type,c.price')
             ->page($data['page'], $data['size'])
             ->order(['a.id' => 'desc'])
             ->select()

+ 1 - 1
app/mobile/logic/ExchangeLogic.php

@@ -115,7 +115,7 @@ class ExchangeLogic extends BaseLogic
 
             //生成兑换订单
             OrderModel::create([
-                'orderCode' => make_no('DH'),
+                'orderCode' => make_no('QR'),
                 'company_id' => self::$company_id,
                 'card_id' => self::$card_id,
                 'uid' => self::$aid,