diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index 7b7ca0116..52772795f 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -68,7 +68,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte break; } return BeforehandOrder::where($this->searchWhere) - ->field(['id', 'order_id', 'store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file']) + ->field(['id', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { diff --git a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php index 398e16498..51a7cfbe8 100644 --- a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php +++ b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php @@ -12,6 +12,8 @@ use app\common\model\delivery_service\DeliveryService; use app\common\model\dict\DictData; use app\common\model\store_product\StoreProduct; use app\common\model\store_product_price\StoreProductPrice; +use app\common\model\store_product_unit\StoreProductUnit; +use app\common\service\workWechat\ProductOffer; use support\exception\BusinessException; use think\facade\Db; @@ -136,8 +138,9 @@ class PurchaseProductOfferLogic extends BaseLogic 'after_sales' => $params['after_sales'], ]); $find = StoreProductPrice::where(['offer_id' => $params['id']])->find(); - $top_cate_id = StoreProduct::where('id', $offer['product_id'])->value('top_cate_id'); - $dict_data = DictData::where('type_value', 'price_lv_' . $top_cate_id)->field('name,value')->select(); + $product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('store_name,top_cate_id')->find(); + $unit_name=StoreProductUnit::where('id', $offer['unit_id'])->value('name'); + $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select(); $data = []; $data['bhoid'] = $offer['order_id']; $data['offer_id'] = $params['id']; @@ -167,6 +170,16 @@ class PurchaseProductOfferLogic extends BaseLogic StoreProductPrice::create($data); } Db::commit(); + $offer['store_name']=$product['store_name']; + $offer['unit_name']=$unit_name; + if($offer['pay_type']==1){ + $offer['pay_type_name']='赊账'; + }elseif($offer['pay_type']==2){ + $offer['pay_type_name']='现金'; + }else{ + $offer['pay_type_name']='没设置'; + } + ProductOffer::push($offer); return true; } catch (\Throwable $e) { Db::rollback(); diff --git a/app/common/service/workWechat/ProductOffer.php b/app/common/service/workWechat/ProductOffer.php new file mode 100644 index 000000000..e14c6620a --- /dev/null +++ b/app/common/service/workWechat/ProductOffer.php @@ -0,0 +1,37 @@ + "markdown", "markdown" => ["content" => "有新的采购商品 + >订单ID:$order_id + >商品名称:$store_name + >数量/单位:$num/$unit_name + >采购人:$buyer_name + >采购金额:$price + >采购时间:$create_time + >支付方式:$pay_type + [下载今日采购表格]($url)"]]; + (new Curl())->postJson($url, json_encode($arr, true)); + } catch (\Throwable $e) { + Log::error('推送商品信息保存:'.$e->getMessage()); + } + } +}