diff --git a/app/admin/lists/goods/GoodsLists.php b/app/admin/lists/goods/GoodsLists.php index dac26f3..cd36358 100644 --- a/app/admin/lists/goods/GoodsLists.php +++ b/app/admin/lists/goods/GoodsLists.php @@ -6,6 +6,7 @@ namespace app\admin\lists\goods; use app\admin\lists\BaseAdminDataLists; use app\common\model\goods\Goods; use app\common\lists\ListsSearchInterface; +use app\common\model\goods\GoodsLabel; /** @@ -47,7 +48,14 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface ->limit($this->limitOffset, $this->limitLength) ->with(['className','brandName','unitName','warehouseName']) ->order(['id' => 'desc']) - ->select() + ->select()->each(function($data){ + if(!empty($data['sys_labels'])){ + $goodslabel = GoodsLabel::where('id','in',trim($data['sys_labels'],','))->column('name'); + $data['sys_labels_text'] = implode(',',$goodslabel); + }else{ + $data['sys_labels_text'] = ''; + } + }) ->toArray(); } diff --git a/app/admin/lists/merchant/MerchantLists.php b/app/admin/lists/merchant/MerchantLists.php index d502f14..3b505ff 100644 --- a/app/admin/lists/merchant/MerchantLists.php +++ b/app/admin/lists/merchant/MerchantLists.php @@ -27,7 +27,8 @@ class MerchantLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['category_id', 'type_id', 'mer_name', 'credit_buy', 'status', 'commission_rate', 'service_phone','service_user', 'mer_money', 'financial_bank', 'financial_wechat', 'financial_alipay'], + '=' => ['category_id', 'type_id'], + '%like%' => ['mer_name'] ]; } diff --git a/app/admin/lists/supplier/SupplierLists.php b/app/admin/lists/supplier/SupplierLists.php index 558c559..b46e776 100644 --- a/app/admin/lists/supplier/SupplierLists.php +++ b/app/admin/lists/supplier/SupplierLists.php @@ -27,7 +27,8 @@ class SupplierLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['category_id', 'type_id', 'mer_name'], + '=' => ['category_id', 'type_id'], + '%like%' => ['mer_name'] ]; } diff --git a/app/admin/logic/goods/GoodsLogic.php b/app/admin/logic/goods/GoodsLogic.php index 301478f..195c5a8 100644 --- a/app/admin/logic/goods/GoodsLogic.php +++ b/app/admin/logic/goods/GoodsLogic.php @@ -5,6 +5,7 @@ namespace app\admin\logic\goods; use app\common\model\goods\Goods; use app\common\logic\BaseLogic; +use app\common\model\goods\GoodsLabel; use think\facade\Db; @@ -47,7 +48,8 @@ class GoodsLogic extends BaseLogic 'details' => $params['details'] ? implode(',', $params['details']) : '', 'data' => $params['data'], 'more' => $params['more'], - 'sort' => $params['sort'] + 'sort' => $params['sort'], + 'sys_labels' => $params['sys_labels'] ?? '', ]); Db::commit(); @@ -90,7 +92,8 @@ class GoodsLogic extends BaseLogic 'details' => $params['details'] ? implode(',', $params['details']) : '', 'data' => $params['data'], 'more' => $params['more'], - 'sort' => $params['sort'] + 'sort' => $params['sort'], + 'sys_labels' => $params['sys_labels'] ?? '', ]); Db::commit(); @@ -125,7 +128,14 @@ class GoodsLogic extends BaseLogic */ public static function detail($params): array { - return Goods::findOrEmpty($params['id'])->toArray(); + $data = Goods::findOrEmpty($params['id']); + if(!empty($data['sys_labels'])){ + $goodslabel = GoodsLabel::where('id','in',trim($data['sys_labels'],','))->column('name'); + $data['sys_labels_text'] = implode(',',$goodslabel); + }else{ + $data['sys_labels_text'] = ''; + } + return $data->toArray(); } /** * @notes 设置标签 diff --git a/app/admin/logic/merchant/MerchantLogic.php b/app/admin/logic/merchant/MerchantLogic.php index 38a12b6..b7e7adf 100644 --- a/app/admin/logic/merchant/MerchantLogic.php +++ b/app/admin/logic/merchant/MerchantLogic.php @@ -141,6 +141,17 @@ class MerchantLogic extends BaseLogic */ public static function detail($params): array { - return Merchant::findOrEmpty($params['mer_id'])->toArray(); + $data = Merchant::where('mer_id',$params['mer_id'])->findOrEmpty(); + $province = Db::name('geo_province')->field('province_name')->where('province_code',$data['province_id'])->findOrEmpty(); + $city = Db::name('geo_city')->field('city_name')->where('city_code',$data['city_id'])->findOrEmpty(); + $area = Db::name('geo_area')->field('area_name')->where('area_code',$data['area_id'])->findOrEmpty(); + $street = Db::name('geo_street')->field('street_name')->where('street_code',$data['street_id'])->findOrEmpty(); + $village = Db::name('geo_village')->field('village_name')->where('village_code',$data['village_id'])->findOrEmpty(); + $data['province_name'] = !empty($province) ? $province['province_name'] : ''; + $data['city_name'] = !empty($city) ? $city['city_name'] : ''; + $data['area_name'] = !empty($area) ? $area['area_name'] : ''; + $data['street_name'] = !empty($street) ? $street['street_name'] : ''; + $data['village_name'] = !empty($village) ? $village['village_name'] : ''; + return $data->toArray(); } } \ No newline at end of file diff --git a/app/admin/logic/supplier/SupplierLogic.php b/app/admin/logic/supplier/SupplierLogic.php index 12195b9..0a25910 100644 --- a/app/admin/logic/supplier/SupplierLogic.php +++ b/app/admin/logic/supplier/SupplierLogic.php @@ -3,6 +3,7 @@ namespace app\admin\logic\supplier; +use app\common\model\goods\GoodsLabel; use app\common\model\supplier\Supplier; use app\common\logic\BaseLogic; use think\facade\Db; @@ -137,7 +138,24 @@ class SupplierLogic extends BaseLogic */ public static function detail($params): array { - return Supplier::findOrEmpty($params['id'])->toArray(); + $data = Supplier::findOrEmpty($params['id']); + $province = Db::name('geo_province')->field('province_name')->where('province_code',$data['province_id'])->findOrEmpty(); + $city = Db::name('geo_city')->field('city_name')->where('city_code',$data['city_id'])->findOrEmpty(); + $area = Db::name('geo_area')->field('area_name')->where('area_code',$data['area_id'])->findOrEmpty(); + $street = Db::name('geo_street')->field('street_name')->where('street_code',$data['street_id'])->findOrEmpty(); + $village = Db::name('geo_village')->field('village_name')->where('village_code',$data['village_id'])->findOrEmpty(); + $data['province_name'] = !empty($province) ? $province['province_name'] : ''; + $data['city_name'] = !empty($city) ? $city['city_name'] : ''; + $data['area_name'] = !empty($area) ? $area['area_name'] : ''; + $data['street_name'] = !empty($street) ? $street['street_name'] : ''; + $data['village_name'] = !empty($village) ? $village['village_name'] : ''; + if(!empty($data['sys_labels'])){ + $goodslabel = GoodsLabel::where('id','in',trim($data['sys_labels'],','))->column('name'); + $data['sys_labels_text'] = implode(',',$goodslabel); + }else{ + $data['sys_labels_text'] = ''; + } + return $data->toArray(); } /** diff --git a/app/admin/validate/goods/GoodsValidate.php b/app/admin/validate/goods/GoodsValidate.php index 3424a51..88e32ea 100644 --- a/app/admin/validate/goods/GoodsValidate.php +++ b/app/admin/validate/goods/GoodsValidate.php @@ -51,7 +51,7 @@ class GoodsValidate extends BaseValidate */ public function sceneAdd() { - return $this->only(['name','py','class','brand','unit','warehouse']); + return $this->remove('id',true); } @@ -62,9 +62,7 @@ class GoodsValidate extends BaseValidate * @date 2024/04/23 11:28 */ public function sceneEdit() - { - return $this->only(['id','name','py','class','brand','unit','warehouse']); - } + {} /** diff --git a/app/api/lists/goods/GoodsLists.php b/app/api/lists/goods/GoodsLists.php index dc62873..39f2e97 100644 --- a/app/api/lists/goods/GoodsLists.php +++ b/app/api/lists/goods/GoodsLists.php @@ -91,7 +91,7 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface $order['id'] = 'desc'; } return Goods::where($this->searchWhere)->where($where) - ->field(['id', 'name','brand','class','unit', 'sell', 'code','imgs','sales']) + ->field(['id', 'name','brand','class','unit', 'sell', 'code','imgs','sales','spec']) ->limit($this->limitOffset, $this->limitLength) ->with(['className','brandName','unitName']) ->order($order) diff --git a/app/api/lists/operation/OpurchaseGoodsOfferList.php b/app/api/lists/operation/OpurchaseGoodsOfferList.php index 9bc5be2..a3ffd7c 100644 --- a/app/api/lists/operation/OpurchaseGoodsOfferList.php +++ b/app/api/lists/operation/OpurchaseGoodsOfferList.php @@ -47,7 +47,7 @@ class OpurchaseGoodsOfferList extends BaseAdminDataLists implements ListsSearchI $where[] = ['price','=','']; } if(!$supplier_id) return []; - return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where) + return OpurchaseGoodsOffer::where($this->searchWhere)->where('supplier_id',$supplier_id)->where($where)->where('is_adopt',0) ->with('goods') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc'])