From 1d8e9a9a36378f946effc2e927d06dc6f85205cc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 23 Sep 2024 18:45:57 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat(menu):=20=E6=9B=B4=E6=96=B0=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E8=8F=9C=E5=8D=95=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BranchProductController.php | 19 ++++ app/api/controller/store/StoreController.php | 13 ++- .../StoreOrderCartInfoController.php | 29 +++++ .../branch_product/BranchProductLists.php | 104 ++++++++++++++++++ .../StoreOrderCartInfoLists.php | 95 ++++++++++++++++ 5 files changed, 254 insertions(+), 6 deletions(-) create mode 100644 app/api/controller/branch_product/BranchProductController.php create mode 100644 app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php create mode 100644 app/api/lists/branch_product/BranchProductLists.php create mode 100644 app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php diff --git a/app/api/controller/branch_product/BranchProductController.php b/app/api/controller/branch_product/BranchProductController.php new file mode 100644 index 000000000..c08f43515 --- /dev/null +++ b/app/api/controller/branch_product/BranchProductController.php @@ -0,0 +1,19 @@ +dataLists(new BranchProductLists()); + } +} diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index ab251819a..462caf03d 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -200,12 +200,13 @@ class StoreController extends BaseApiController */ public function menu_list(){ $menu=[ - ['name'=>'每日配送统计'], - ['name'=>'累计配送统计'], - ['name'=>'每日销量统计'], - ['name'=>'累计销量统计'], - ['name'=>'商品库存'], - ['name'=>'店铺收支'] + ['name'=>'每日配送统计','url'=>'/pagesOrder/deliveryOrder/index'], + ['name'=>'累计配送统计','url'=>'/pagesOrder/deliveryOrder/count'], + ['name'=>'每日销量统计','url'=>'/pagesOrder/productSales/index'], + ['name'=>'累计销量统计','url'=>'/pagesOrder/productSales/count'], + ['name'=>'商品库存','url'=>'/pagesOrder/store_product/index'], + ['name'=>'订单列表','url'=>'/pagesOrder/delivery/index'], + ['name'=>'店铺收支'], ]; return $this->success('ok',['menu'=>$menu]); } diff --git a/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php b/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php new file mode 100644 index 000000000..3eb6b0fea --- /dev/null +++ b/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php @@ -0,0 +1,29 @@ +dataLists(new CateLists()); + } + + +} diff --git a/app/api/lists/branch_product/BranchProductLists.php b/app/api/lists/branch_product/BranchProductLists.php new file mode 100644 index 000000000..109f22be7 --- /dev/null +++ b/app/api/lists/branch_product/BranchProductLists.php @@ -0,0 +1,104 @@ + [ 'cate_id', 'top_cate_id', 'two_cate_id'], + '%pipe_like%' => ['store_name' => 'store_name|bar_code'], + ]; + } + /** + * @notes 设置支持排序字段 + * @return string[] + * @date 2021/12/29 10:07 + * @remark 格式: ['前端传过来的字段名' => '数据库中的字段名']; + */ + public function setSortFields(): array + { + return ['sell' => 'price', 'sales' => 'sales',]; + } + + + /** + * @notes 设置默认排序 + * @return string[] + * @date 2021/12/29 10:06 + */ + public function setDefaultOrder(): array + { + return ['sort'=>'desc','price' => 'asc', 'id' => 'desc']; + } + + /** + * @notes 获取商品列表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function lists(): array + { + // $order = $this->request->get('order', ''); + // $field = $this->request->get('field', ''); + // if (empty($order) || empty($field)) { + // $order = $this->sortOrder; + // } else { + // $order = [$field => $order]; + // } + $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,is_lack'; + + $tag = ''; + + $this->searchWhere[] = ['is_show', '=', 1]; + $this->searchWhere[] = ['product_type', 'in', [0,4]]; + return StoreBranchProduct::where($this->searchWhere) + ->field($fields) + ->with(['className', 'unitName']) + ->limit($this->limitOffset, $this->limitLength) + ->order($this->sortOrder) + ->select()->each(function ($item) use ($tag) { + if($item['is_lack']==1){ + $tag='缺货'; + } + $item['tag'] = $tag; + return $item; + }) + ->toArray(); + } + + + /** + * @notes 获取商品列表数量 + * @return int + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function count(): int + { + return StoreBranchProduct::where($this->searchWhere) + ->count(); + } +} diff --git a/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php b/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php new file mode 100644 index 000000000..8bc43530a --- /dev/null +++ b/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php @@ -0,0 +1,95 @@ + 'create_time' + ]; + } + + + /** + * @notes 获取地址列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @date 2024/04/27 11:26 + */ + public function lists(): array + { + $store_id=$this->request->__get('store_id'); + if(!$store_id) return []; + // if ($this->request->get('start_time') == '') { + // $this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]]; + // } + $is_group=$this->request->get('is_group'); + $this->searchWhere[] = ['is_pay', '=', 1]; + $this->searchWhere[] = ['status', '>=', 0]; + $this->searchWhere[] = ['store_id', '=', 1]; + $query = StoreOrderCartInfo::where($this->searchWhere); + if ($is_group == 1) { + $query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group(['store_id', 'product_id']); + } else { + $query->field('store_id,product_id,price,total_price,cart_num,create_time,uid,oid'); + } + return $query->limit($this->limitOffset, $this->limitLength) + ->select()->each(function ($item){ + $find = StoreProduct::where('id', $item['product_id'])->field('image,unit,cate_id,store_name,store_info')->withTrashed()->find(); + if ($find) { + $item['image'] = $find['image']; //商品图片 + + $item['store_name'] = $find['store_name']; //商品名称 + + $item['store_info'] = $find['store_info']; //商品规格 + $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? ''; + $item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name') ?? ''; + } else { + $item['image'] = ''; //商品图片 + $item['store_name'] = ''; //商品名称 + $item['store_info'] = ''; //商品规格-(数据库叫商品简介) + $item['unit_name'] = ''; // + $item['cate_name'] = ''; // + $item['system_store'] = ''; // + } + return $item; //返回处理后的数据。 + }) + ->toArray(); + } + + + /** + * @notes 获取地址数量 + * @return int + * @date 2024/04/27 11:26 + */ + public function count(): int + { + return StoreOrderCartInfo::where($this->searchWhere)->count(); + } + +} \ No newline at end of file From 64396fe1b5d7596e8521d7253746fb3b12ebd7bc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 25 Sep 2024 17:40:46 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AE=A2=E5=8D=95ID=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WarehouseOrderController.php | 8 ++ .../StoreOrderCartInfoController.php | 13 +- .../SystemStoreStorageController.php | 39 ++++++ app/api/lists/order/OrderList.php | 1 - .../StoreOrderCartInfoGroupLists.php | 96 +++++++++++++++ .../StoreOrderCartInfoLists.php | 21 ++-- .../SystemStoreStorageGroupLists.php | 115 +++++++++++++++++ .../SystemStoreStorageLists.php | 116 ++++++++++++++++++ app/api/logic/order/OrderLogic.php | 1 - app/common/service/xlsx/OrderDetail.php | 10 +- 10 files changed, 403 insertions(+), 17 deletions(-) create mode 100644 app/api/controller/system_store_storage/SystemStoreStorageController.php create mode 100644 app/api/lists/store_order_cart_info/StoreOrderCartInfoGroupLists.php create mode 100644 app/api/lists/system_store_storage/SystemStoreStorageGroupLists.php create mode 100644 app/api/lists/system_store_storage/SystemStoreStorageLists.php diff --git a/app/admin/controller/warehouse_order/WarehouseOrderController.php b/app/admin/controller/warehouse_order/WarehouseOrderController.php index 071cfa386..5c0a32030 100644 --- a/app/admin/controller/warehouse_order/WarehouseOrderController.php +++ b/app/admin/controller/warehouse_order/WarehouseOrderController.php @@ -10,6 +10,7 @@ use app\admin\logic\warehouse_order\WarehouseOrderLogic; use app\admin\logic\warehouse_product\WarehouseProductLogic; use app\admin\validate\warehouse_order\WarehouseOrderValidate; use app\common\model\store_branch_product\StoreBranchProduct; +use app\common\model\store_order\StoreOrder; use app\common\model\store_product\StoreProduct; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\system_store\SystemStore; @@ -263,6 +264,13 @@ class WarehouseOrderController extends BaseAdminController $order['delivery_time']=date('Y-m-d H:i:s',$order['delivery_time']); $order['pay_time']=$order['create_time']; $order['order_id']=$order['code']; + + if($order['oid']>0){ + $orders=StoreOrder::where('id',$order['oid'])->findOrEmpty(); + $order['real_name']=$orders['real_name']; + $order['user_phone']=$orders['user_phone']; + $order['user_address']=$orders['user_address']; + } $file_path = $xlsx->export($data, $system_store, $order); return $this->success('导出成功', ['url' => $file_path]); diff --git a/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php b/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php index 3eb6b0fea..e85d6710d 100644 --- a/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php +++ b/app/api/controller/store_order_cart_info/StoreOrderCartInfoController.php @@ -4,8 +4,8 @@ namespace app\api\controller\store_order_cart_info; use app\api\controller\BaseApiController; -use app\api\lists\store_order_cart_info\CateLists; - +use app\api\lists\store_order_cart_info\StoreOrderCartInfoGroupLists; +use app\api\lists\store_order_cart_info\StoreOrderCartInfoLists; /** * 商品销量控制器 @@ -22,8 +22,13 @@ class StoreOrderCartInfoController extends BaseApiController */ public function lists() { - return $this->dataLists(new CateLists()); + $this->request->__set('store_id',5); + return $this->dataLists(new StoreOrderCartInfoLists()); } - + public function group_lists() + { + $this->request->__set('store_id',5); + return $this->dataLists(new StoreOrderCartInfoGroupLists()); + } } diff --git a/app/api/controller/system_store_storage/SystemStoreStorageController.php b/app/api/controller/system_store_storage/SystemStoreStorageController.php new file mode 100644 index 000000000..a2dcf4cea --- /dev/null +++ b/app/api/controller/system_store_storage/SystemStoreStorageController.php @@ -0,0 +1,39 @@ +dataLists(new SystemStoreStorageLists()); + } + /** + * @notes 获取商品分类列表 + * @return + * @author likeadmin + * @date 2024/04/23 10:27 + */ + public function group_lists() + { + return $this->dataLists(new SystemStoreStorageGroupLists()); + } + +} diff --git a/app/api/lists/order/OrderList.php b/app/api/lists/order/OrderList.php index 5e6652654..525ebac18 100644 --- a/app/api/lists/order/OrderList.php +++ b/app/api/lists/order/OrderList.php @@ -46,7 +46,6 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface $userId = $this->request->userId; if (!$userId) return []; $data = StoreOrder::with(['store'])->where($this->searchWhere)->where(['uid'=>$userId]) - ->whereIn('shipping_type',[1,2]) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() diff --git a/app/api/lists/store_order_cart_info/StoreOrderCartInfoGroupLists.php b/app/api/lists/store_order_cart_info/StoreOrderCartInfoGroupLists.php new file mode 100644 index 000000000..31aaa6659 --- /dev/null +++ b/app/api/lists/store_order_cart_info/StoreOrderCartInfoGroupLists.php @@ -0,0 +1,96 @@ + 'create_time' + ]; + } + + + /** + * @notes 获取地址列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @date 2024/04/27 11:26 + */ + public function lists(): array + { + $store_id = $this->request->__get('store_id'); + if (!$store_id) return []; + if ($this->request->get('store_name')) { + $store_name = $this->request->get('store_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->column('id'); + if ($ids) { + $this->searchWhere[] = ['product_id', 'in', $ids]; + } else { + return []; + } + } + $this->searchWhere[] = ['is_pay', '=', 1]; + $this->searchWhere[] = ['status', '>=', 0]; + $this->searchWhere[] = ['store_id', '=', $store_id]; + $query = StoreOrderCartInfo::where($this->searchWhere); + $query->field('store_id,product_id,price,sum(total_price) as total_price,sum(cart_num) as cart_num'); + return $query->limit($this->limitOffset, $this->limitLength) + ->group('product_id') + ->select()->each(function ($item) { + $find = StoreProduct::where('id', $item['product_id'])->field('image,unit,cate_id,store_name,store_info')->withTrashed()->find(); + if ($find) { + $item['image'] = $find['image']; //商品图片 + + $item['store_name'] = $find['store_name']; //商品名称 + + $item['store_info'] = $find['store_info']; //商品规格 + $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? ''; + $item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name') ?? ''; + } else { + $item['image'] = ''; //商品图片 + $item['store_name'] = ''; //商品名称 + $item['store_info'] = ''; //商品规格-(数据库叫商品简介) + $item['unit_name'] = ''; // + $item['cate_name'] = ''; // + $item['system_store'] = ''; // + } + return $item; //返回处理后的数据。 + }) + ->toArray(); + } + + + /** + * @notes 获取地址数量 + * @return int + * @date 2024/04/27 11:26 + */ + public function count(): int + { + return StoreOrderCartInfo::where($this->searchWhere)->count(); + } +} diff --git a/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php b/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php index 8bc43530a..b15faf5b0 100644 --- a/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php +++ b/app/api/lists/store_order_cart_info/StoreOrderCartInfoLists.php @@ -44,19 +44,20 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI { $store_id=$this->request->__get('store_id'); if(!$store_id) return []; - // if ($this->request->get('start_time') == '') { - // $this->searchWhere[] = ['create_time', 'between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]]; - // } - $is_group=$this->request->get('is_group'); + if ($this->request->get('store_name')) { + $store_name = $this->request->get('store_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->column('id'); + if ($ids) { + $this->searchWhere[] = ['product_id', 'in', $ids]; + } else { + return []; + } + } $this->searchWhere[] = ['is_pay', '=', 1]; $this->searchWhere[] = ['status', '>=', 0]; - $this->searchWhere[] = ['store_id', '=', 1]; + $this->searchWhere[] = ['store_id', '=', $store_id]; $query = StoreOrderCartInfo::where($this->searchWhere); - if ($is_group == 1) { - $query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group(['store_id', 'product_id']); - } else { - $query->field('store_id,product_id,price,total_price,cart_num,create_time,uid,oid'); - } + $query->field('store_id,product_id,price,total_price,cart_num,create_time,uid,oid'); return $query->limit($this->limitOffset, $this->limitLength) ->select()->each(function ($item){ $find = StoreProduct::where('id', $item['product_id'])->field('image,unit,cate_id,store_name,store_info')->withTrashed()->find(); diff --git a/app/api/lists/system_store_storage/SystemStoreStorageGroupLists.php b/app/api/lists/system_store_storage/SystemStoreStorageGroupLists.php new file mode 100644 index 000000000..84fbaca3d --- /dev/null +++ b/app/api/lists/system_store_storage/SystemStoreStorageGroupLists.php @@ -0,0 +1,115 @@ + 'create_time', + ]; + } + /** + * @notes 设置支持排序字段 + * @return string[] + * @date 2021/12/29 10:07 + * @remark 格式: ['前端传过来的字段名' => '数据库中的字段名']; + */ + public function setSortFields(): array + { + return []; + } + + + /** + * @notes 设置默认排序 + * @return string[] + * @date 2021/12/29 10:06 + */ + public function setDefaultOrder(): array + { + return ['id' => 'desc']; + } + + /** + * @notes 获取商品列表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function lists(): array + { + $fields = 'store_id,product_id,sum(nums) as nums,mark'; + if ($this->request->get('store_name')) { + $store_name = $this->request->get('store_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->column('id'); + if ($ids) { + $this->searchWhere[] = ['product_id', 'in', $ids]; + } else { + return []; + } + } + $this->searchWhere[] = ['type', '=', 1]; + $this->searchWhere[] = ['status', '=', 1]; + return SystemStoreStorage::where($this->searchWhere) + ->field($fields) + ->group('product_id') + ->limit($this->limitOffset, $this->limitLength) + ->order($this->sortOrder) + ->select()->each(function ($item) { + $find=StoreProduct::where('id', $item['product_id'])->with(['className', 'unitName']) + ->field('id,store_name,image,unit,cate_id,store_info')->find(); + if($find){ + $item['store_name'] = $find['store_name']; + $item['image'] = $find['image']; + $item['unit_name'] = $find['unit_name']; + $item['class_name'] = $find['class_name']; + $item['store_info'] = $find['store_info']; + }else{ + $item['product_name'] = ''; + $item['product_image'] = ''; + $item['product_unit'] = ''; + $item['product_cate'] = ''; + $item['store_info'] = ''; + } + return $item; + }) + ->toArray(); + } + + + /** + * @notes 获取商品列表数量 + * @return int + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function count(): int + { + return SystemStoreStorage::where($this->searchWhere) + ->count(); + } +} diff --git a/app/api/lists/system_store_storage/SystemStoreStorageLists.php b/app/api/lists/system_store_storage/SystemStoreStorageLists.php new file mode 100644 index 000000000..f3674d2cb --- /dev/null +++ b/app/api/lists/system_store_storage/SystemStoreStorageLists.php @@ -0,0 +1,116 @@ + 'create_time', + ]; + } + /** + * @notes 设置支持排序字段 + * @return string[] + * @date 2021/12/29 10:07 + * @remark 格式: ['前端传过来的字段名' => '数据库中的字段名']; + */ + public function setSortFields(): array + { + return []; + } + + + /** + * @notes 设置默认排序 + * @return string[] + * @date 2021/12/29 10:06 + */ + public function setDefaultOrder(): array + { + return ['id' => 'desc']; + } + + /** + * @notes 获取商品列表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function lists(): array + { + $fields = 'id,store_id,staff_id,product_id,warehouse_id,nums,mark,status'; + if ($this->request->get('store_name')) { + $store_name = $this->request->get('store_name'); + $ids = StoreProduct::where('store_name', 'like', '%' . $store_name . '%')->column('id'); + if ($ids) { + $this->searchWhere[] = ['product_id', 'in', $ids]; + } else { + return []; + } + } + $this->searchWhere[] = ['type', '=', 1]; + return SystemStoreStorage::where($this->searchWhere) + ->field($fields) + ->limit($this->limitOffset, $this->limitLength) + ->order($this->sortOrder) + ->select()->each(function ($item) { + if($item['staff_id']>0){ + $item['staff_name']=SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name'); + } + $find=StoreProduct::where('id', $item['product_id'])->with(['className', 'unitName']) + ->field('id,store_name,image,unit,cate_id,store_info')->find(); + if($find){ + $item['store_name'] = $find['store_name']; + $item['image'] = $find['image']; + $item['unit_name'] = $find['unit_name']; + $item['class_name'] = $find['class_name']; + $item['store_info'] = $find['store_info']; + }else{ + $item['product_name'] = ''; + $item['product_image'] = ''; + $item['product_unit'] = ''; + $item['product_cate'] = ''; + $item['store_info'] = ''; + } + return $item; + }) + ->toArray(); + } + + + /** + * @notes 获取商品列表数量 + * @return int + * @author likeadmin + * @date 2024/04/23 11:28 + */ + public function count(): int + { + return SystemStoreStorage::where($this->searchWhere) + ->count(); + } +} diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index a3f0b74c8..046e50d24 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -217,7 +217,6 @@ class OrderLogic extends BaseLogic // } //成本价 收益 $order = [ - 'create_time' => time(), 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 'cost' => self::$cost, //成本价1- diff --git a/app/common/service/xlsx/OrderDetail.php b/app/common/service/xlsx/OrderDetail.php index 2fa5e115d..d210cad63 100644 --- a/app/common/service/xlsx/OrderDetail.php +++ b/app/common/service/xlsx/OrderDetail.php @@ -109,8 +109,16 @@ class OrderDetail $sheet->setCellValue('A' . $count + 12, '下单人',); $sheet->mergeCells('B' . ($count + 12) . ':C' . $count + 12); + $sheet->setCellValue('B' . ($count + 12), $order['real_name']??''); + $sheet->setCellValue('D' . $count + 12, '电话'); - + $sheet->mergeCells('E' . ($count + 12) . ':F' . $count + 12); + $sheet->setCellValue('E' . ($count + 12), $order['user_phone']??''); + + $sheet->setCellValue('G' . $count + 12, '地址'); + $sheet->mergeCells('H' . ($count + 12) . ':J' . $count + 12); + $sheet->setCellValue('H' . ($count + 12), $order['user_address']??''); + $sheet->setCellValue('A' . $count + 13, '仓库',); $sheet->mergeCells('B' . ($count + 13) . ':C' . $count + 13); $sheet->setCellValue('D' . $count + 13, '送货'); From 21baf23272ab8f8352c0b0090e95c5d912f2d22b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 25 Sep 2024 17:59:54 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8API=EF=BC=8C=E5=A2=9E=E5=8A=A0'total?= =?UTF-8?q?=5Fprice'=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BF=AE=E5=A4=8D'is=5Flac?= =?UTF-8?q?k'=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/branch_product/BranchProductLists.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/api/lists/branch_product/BranchProductLists.php b/app/api/lists/branch_product/BranchProductLists.php index 109f22be7..d74a6a815 100644 --- a/app/api/lists/branch_product/BranchProductLists.php +++ b/app/api/lists/branch_product/BranchProductLists.php @@ -68,24 +68,16 @@ class BranchProductLists extends BaseApiDataLists implements ListsSearchInterfac // } else { // $order = [$field => $order]; // } - $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,is_lack'; - - $tag = ''; - - $this->searchWhere[] = ['is_show', '=', 1]; + $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,total_price'; + + $this->searchWhere[] = ['status', '=', 1]; $this->searchWhere[] = ['product_type', 'in', [0,4]]; return StoreBranchProduct::where($this->searchWhere) ->field($fields) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) - ->select()->each(function ($item) use ($tag) { - if($item['is_lack']==1){ - $tag='缺货'; - } - $item['tag'] = $tag; - return $item; - }) + ->select() ->toArray(); } From 0b42d7553abe4ab57cec1a24edaa36fc1ba45153 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 25 Sep 2024 20:45:48 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat(BranchProductLists):=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8API=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BA=93=E5=AD=98=E5=92=8C=E9=94=80=E5=94=AE=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../branch_product/BranchProductLists.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/api/lists/branch_product/BranchProductLists.php b/app/api/lists/branch_product/BranchProductLists.php index d74a6a815..d4853886e 100644 --- a/app/api/lists/branch_product/BranchProductLists.php +++ b/app/api/lists/branch_product/BranchProductLists.php @@ -7,6 +7,8 @@ use app\api\lists\BaseApiDataLists; use app\common\model\store_product\StoreProduct; use app\common\lists\ListsSearchInterface; use app\common\model\store_branch_product\StoreBranchProduct; +use app\common\model\store_order_cart_info\StoreOrderCartInfo; +use app\common\model\warehouse_product\WarehouseProduct; /** * 商品列表列表 @@ -61,23 +63,23 @@ class BranchProductLists extends BaseApiDataLists implements ListsSearchInterfac */ public function lists(): array { - // $order = $this->request->get('order', ''); - // $field = $this->request->get('field', ''); - // if (empty($order) || empty($field)) { - // $order = $this->sortOrder; - // } else { - // $order = [$field => $order]; - // } - $fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,total_price'; + $store_id = $this->request->__get('store_id'); + if (!$store_id) return []; + + $fields = 'id,top_cate_id,cate_id,product_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,total_price'; $this->searchWhere[] = ['status', '=', 1]; + $this->searchWhere[] = ['store_id', '=', $store_id]; $this->searchWhere[] = ['product_type', 'in', [0,4]]; return StoreBranchProduct::where($this->searchWhere) ->field($fields) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) - ->select() + ->select()->each(function($item){ + $item->distribution_nums=WarehouseProduct::where(['store_id'=>$item['store_id'],'product_id'=>$item['product_id'],'financial_pm'=>0])->sum('nums'); + $item->sales=StoreOrderCartInfo::where(['product_id'=>$item['product_id'],'store_id'=>$item['store_id'],'is_pay'=>1])->sum('cart_num'); + }) ->toArray(); } From 6ffd57704b1d9b43df5ca8048f4214acf1fc8352 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 25 Sep 2024 22:24:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat(StoreController):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E8=8F=9C=E5=8D=95=E9=93=BE=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=97=E9=93=BA=E6=94=B6=E6=94=AF=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 462caf03d..5bbfb08e5 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -206,7 +206,7 @@ class StoreController extends BaseApiController ['name'=>'累计销量统计','url'=>'/pagesOrder/productSales/count'], ['name'=>'商品库存','url'=>'/pagesOrder/store_product/index'], ['name'=>'订单列表','url'=>'/pagesOrder/delivery/index'], - ['name'=>'店铺收支'], + ['name'=>'店铺收支','url'=>'/pagesOrder/statistics/index'], ]; return $this->success('ok',['menu'=>$menu]); }