diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index b113dcf3c..0a8258efe 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -43,7 +43,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte public function lists(): array { return BeforehandOrder::where($this->searchWhere) - ->field(['id','order_id', 'uid','order_type','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) + ->field(['id','order_id', 'uid','order_type','total_num','total_price','outbound_id','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item){ diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 0119b3e34..fa2c7bfb1 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -92,9 +92,12 @@ class BeforehandOrderLogic extends BaseLogic */ public static function generateOrder(array $params): bool { + $order = BeforehandOrder::where('id', $params['id'])->find(); + if ($order['order_type']==4) { + throw new BusinessException('该订单类型不能生成支付订单'); + } Db::startTrans(); try { - $order = BeforehandOrder::where('id', $params['id'])->find(); $cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray(); $cart_select = []; @@ -225,7 +228,6 @@ class BeforehandOrderLogic extends BaseLogic return true; } catch (\Throwable $e) { Db::rollback(); - d($e); throw new BusinessException($e->getMessage()); } } @@ -345,6 +347,10 @@ class BeforehandOrderLogic extends BaseLogic $datas = []; $order = StoreOrder::where('id', $params['id'])->find(); + $find=BeforehandOrder::where('order_sn',$order['order_id'])->find(); + if($find){ + throw new BusinessException('该订单已转成预定单,请勿重新转'); + } $info = StoreOrderCartInfo::where('oid', $params['id'])->select(); $total_num = $order['total_num']; $total_price = $order['total_price']; @@ -369,6 +375,7 @@ class BeforehandOrderLogic extends BaseLogic 'total_price' => $total_price, 'pay_price' => 0, 'pay_type' => 0, + 'order_type' => 4, 'deduction_price' => 0, 'paid' => 0, 'mark' => $params['mark'] ?? '' diff --git a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php index d6df678fa..d28cdde9e 100644 --- a/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php +++ b/app/api/controller/purchase_product_offer/PurchaseProductOfferController.php @@ -5,6 +5,7 @@ namespace app\api\controller\purchase_product_offer; use app\api\lists\purchase_product_offer\PurchaseProductOfferLists; use app\api\controller\BaseApiController; +use app\common\model\dict\DictData; use app\common\model\purchase_product_offer\PurchaseProductOffer; @@ -53,11 +54,12 @@ class PurchaseProductOfferController extends BaseApiController * 出库上浮比例列表 */ public function outbound_floating_lv(){ - $data[]=[ - ['name'=>'干货/5','value'=>0.05], - ['name'=>'鲜货/15','value'=>0.15], - ['name'=>'粮油/5','value'=>0.05], - ]; + $list=DictData::where('type_value','outbound_floating')->field('name,value')->select()->each(function($item){ + $item->name_b=$item->name; + $item->name=$item->name.'/'.$item->value; + $item->value=convertStringToNumber($item->value); + }); + $data[]=$list; return $this->success('ok',$data); } diff --git a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php index 6a4cd723e..17f7f7ffd 100644 --- a/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/api/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -9,6 +9,7 @@ use app\common\model\delivery_service\DeliveryService; use app\common\model\store_product\StoreProduct; use app\common\model\store_product_unit\StoreProductUnit; use app\api\lists\BaseApiDataLists; +use app\common\model\store_category\StoreCategory; /** * 采购供应链商品列表 @@ -49,7 +50,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI return []; } return PurchaseProductOffer::where($this->searchWhere) - ->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark']) + ->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark','update_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['product_id'=>'desc','id' => 'desc']) ->select()->each(function($item){ @@ -58,6 +59,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI $item->image=$find->image; $item->store_info=$find->store_info; $item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name'); + $item->category_name=StoreCategory::where('id',$find->top_cate_id)->value('name'); if($item->is_buyer==1){ $item->is_buyer_name='需要采购'; }elseif($item->is_buyer==-1){