diff --git a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php index 3261ab5a1..ef7a920d0 100644 --- a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php +++ b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php @@ -42,6 +42,8 @@ class PurchaseProductOfferController extends BaseApiController return $this->fail('请选择供应商'); } $params['admin_id']=0; + $params['manufacture'] = !empty($params['manufacture']) ? date('Y-m-d H:i:s', $params['manufacture']) : ''; + $params['expiration_date'] = !empty($params['expiration_date']) ? date('Y-m-d H:i:s', $params['expiration_date']) : ''; PurchaseProductOfferLogic::setProcureInfo($params); return $this->success('设置成功', [], 1, 1); } diff --git a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php index 88a0faadb..581f8694e 100644 --- a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -53,10 +53,14 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI $cateIds = []; $list = PurchaseProductOffer::where($this->searchWhere) ->with('product') - ->field(['id', 'order_id', 'product_id', 'price', 'total_price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark','update_time', 'supplier_id', 'package', 'store_info', 'marques', 'after_sales', 'pay_type']) + ->field(['id', 'order_id', 'product_id', 'price', 'total_price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark','update_time', 'supplier_id', 'package', 'store_info', 'marques', 'after_sales', 'pay_type', 'expiration_date', 'manufacture']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item) use(&$cateIds, &$supplierIds, &$unitIds) { + $item->store_info = empty($item['store_info']) ? ($item['product']['store_info'] ?? '') : $item['store_info']; + $item->after_sales = empty($item['after_sales']) ? ($item['product']['after_sales'] ?? '') : $item['after_sales']; + $item->marques = empty($item['marques']) ? ($item['product']['marques'] ?? '') : $item['marques']; + $item->package = empty($item['package']) ? ($item['product']['package'] ?? '') : $item['package']; $item->store_name=$item->product->store_name ?? ''; $item->image=$item->product->image ?? ''; $cateIds[] = $item->product->top_cate_id ?? 0; @@ -82,6 +86,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI $categories = StoreCategory::field('id,name')->whereIn('id', array_unique($cateIds))->select()->toArray(); $categories = reset_index($categories, 'id'); foreach ($list as &$item) { + $item['made_place'] = $item['product']['made_place'] ?? ''; $item['supplier_name'] = $suppliers[$item['supplier_id']]['mer_name'] ?? ''; $item['unit_name'] = $units[$item['unit']]['name'] ?? ''; $item['category_name'] = !empty($item['product']['top_cate_id']) && !empty($categories[$item['product']['top_cate_id']]) ? $categories[$item['product']['top_cate_id']]['name'] : ''; diff --git a/app/common/model/purchase_product_offer/PurchaseProductOffer.php b/app/common/model/purchase_product_offer/PurchaseProductOffer.php index ba02ef4cb..80441c476 100644 --- a/app/common/model/purchase_product_offer/PurchaseProductOffer.php +++ b/app/common/model/purchase_product_offer/PurchaseProductOffer.php @@ -24,7 +24,7 @@ class PurchaseProductOffer extends BaseModel public function product() { - return $this->hasOne(StoreProduct::class, 'id', 'product_id')->field('id,store_name,top_cate_id,image'); + return $this->hasOne(StoreProduct::class, 'id', 'product_id')->field('id,store_name,top_cate_id,image,store_info,package,marques,after_sales,made_place'); } } \ No newline at end of file