From e3d3e94a08de6fd6150ac720b1bbf778e378b3fc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 12 Oct 2024 18:08:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=8D=E6=9E=84PurchaseProductOfferContr?= =?UTF-8?q?oller=E5=92=8CPurchaseProductOfferLists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新PurchaseProductOfferController中的outbound_floating_lv方法,使用字典数据代替硬编码的出库上浮比例列表 - 在PurchaseProductOfferLists中添加category_name字段,提高采购供应链商品列表的信息完整性 --- .../PurchaseProductOfferController.php | 12 +++++++----- .../PurchaseProductOfferLists.php | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) 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){ From 9103d26df933264ec7e4312e6934d557411908f4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 12 Oct 2024 20:53:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A2=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=B3=BB=E7=BB=9F=E9=80=BB=E8=BE=91=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在生成预订单时增加订单类型的判断,避免生成支付订单 - 优化预订单列表展示,增加出库单ID字段 - 完善从商城订单转换为预订单的逻辑,防止重复转换 - 修复了一些潜在的逻辑错误和数据一致性问题 --- .../lists/beforehand_order/BeforehandOrderLists.php | 2 +- .../logic/beforehand_order/BeforehandOrderLogic.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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'] ?? ''