From 4344e46544fb37428a156c4f7e8aa37a2e06db10 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 1 Sep 2024 10:35:40 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86CapitalF?= =?UTF-8?q?lowLogic,=20PayNotifyLogic,=20StoreFinanceFlowLogic,=20WeChatMn?= =?UTF-8?q?pService=E7=AD=89=E6=96=87=E4=BB=B6=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E6=96=B0=E7=9A=84=E5=8F=82=E6=95=B0$key=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86storeIncome=E5=92=8CstoreExpense?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=B9=B6=E8=B0=83=E6=95=B4=E4=BA=86?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=8F=98=E9=87=8F=E5=90=8D=E7=A7=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CapitalFlowLogic.php | 12 ++++++------ app/common/logic/PayNotifyLogic.php | 12 ++++++------ app/common/logic/StoreFinanceFlowLogic.php | 6 +++--- app/common/service/wechat/WeChatMnpService.php | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index 7acb20d1b..3898b55c8 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -100,7 +100,7 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function storeIncome($category, $linkType, $linkId, $amount, $mark = '') + public function storeIncome($category, $linkType, $linkId, $amount, $mark = '',$key='') { $model = new CapitalFlow(); $model->store_id = $this->store['id']; @@ -108,8 +108,8 @@ class CapitalFlowLogic extends BaseLogic $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - $model->before_balance = $this->store['balance']; - $model->balance = bcadd($this->store['balance'], $amount, 2); + $model->before_balance = $this->store[$key]??0; + $model->balance = bcadd($this->store[$key]??0, $amount, 2); $model->create_time = date('Y-m-d H:i:s'); $model->type = 'in'; $model->title = $this->getTitle($category, $amount); @@ -129,7 +129,7 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function storeExpense($category, $linkType, $linkId, $amount, $mark = '') + public function storeExpense($category, $linkType, $linkId, $amount, $mark = '',$key='') { $model = new CapitalFlow(); $model->store_id = $this->store['store_id']; @@ -138,8 +138,8 @@ class CapitalFlowLogic extends BaseLogic $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - $model->before_balance = $this->store['balance']; - $model->balance = bcsub($this->store['balance'], $amount, 2); + $model->before_balance = $this->store[$key]??0; + $model->balance = bcsub($this->store[$key], $amount, 2); $model->create_time = date('Y-m-d H:i:s'); $model->type = 'out'; $model->title = $this->getTitle($category, $amount); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 86a6910f0..ec166fb77 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -97,7 +97,7 @@ class PayNotifyLogic extends BaseLogic // self::addUserSing($order); $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 3, $order['store_id']); - self::dealProductLog($order); + // self::dealProductLog($order); self::afterPay($order); if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) { @@ -163,7 +163,7 @@ class PayNotifyLogic extends BaseLogic ]; UserSign::create($sing); - self::dealProductLog($order); + // self::dealProductLog($order); } @@ -211,7 +211,7 @@ class PayNotifyLogic extends BaseLogic ]; OrderLogic::writeOff($params); } - self::dealProductLog($order); + // self::dealProductLog($order); if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) { $checkArr = [ 'cart_id' => $order['cart_id'], @@ -269,7 +269,7 @@ class PayNotifyLogic extends BaseLogic } self::afterPay($order, $extra['transaction_id']); // self::addUserSing($order); - self::dealProductLog($order); + // self::dealProductLog($order); if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 4]); @@ -517,7 +517,7 @@ class PayNotifyLogic extends BaseLogic } $cashFlowLogic = new CashFlowLogic(); $cashFlowLogic->insert($order['store_id'], $order['pay_price']); - self::dealProductLog($order); + // self::dealProductLog($order); if ($order && $order['store_id'] && $order['reservation'] != 1) { $params = [ @@ -561,7 +561,7 @@ class PayNotifyLogic extends BaseLogic } $order->save(); self::afterPay($order); - self::dealProductLog($order); + // self::dealProductLog($order); // if ($order->pay_type == 9) { // $extra['create_time'] = $order['create_time']; diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php index 7fd7b23da..70c21d8d5 100644 --- a/app/common/logic/StoreFinanceFlowLogic.php +++ b/app/common/logic/StoreFinanceFlowLogic.php @@ -151,18 +151,18 @@ class StoreFinanceFlowLogic extends BaseLogic $store = SystemStore::where('id', $store_id)->find(); $capitalFlowDao = new CapitalFlowLogic($store, 'store'); if ($money > 0) { - $capitalFlowDao->storeIncome('store_money_add', 'order', $order_id, $money); + $capitalFlowDao->storeIncome('store_money_add', 'order', $order_id, $money,'','store_money'); SystemStore::where('id', $store_id)->inc('store_money', $money)->update(); } if ($deposit > 0) { - $capitalFlowDao->storeIncome('store_paid_deposit_add', 'order', $order_id, $deposit); + $capitalFlowDao->storeIncome('store_paid_deposit_add', 'order', $order_id, $deposit,'','paid_deposit'); SystemStore::where('id', $store_id)->inc('paid_deposit', $deposit)->update(); } $find = StoreFinanceFlow::where(['order_id' => $order_id, 'financial_pm' => 1, 'financial_type' => 16, 'status' => 0])->find(); StoreFinanceFlow::where(['order_id' => $order_id, 'financial_type' => 16])->update(['status' => 1]); if ($find) { if ($find['number'] > 0) { - $capitalFlowDao->storeIncome('store_attrition_add', 'order', $order_id, $find['number']); + $capitalFlowDao->storeIncome('store_attrition_add', 'order', $order_id, $find['number'],'','attrition'); SystemStore::where('id', $store_id)->inc('attrition', $find['number'])->update(); } } diff --git a/app/common/service/wechat/WeChatMnpService.php b/app/common/service/wechat/WeChatMnpService.php index c9cb5ef25..e298eaa6f 100644 --- a/app/common/service/wechat/WeChatMnpService.php +++ b/app/common/service/wechat/WeChatMnpService.php @@ -109,9 +109,9 @@ class WeChatMnpService $dateTime = new DateTime(date('Y-m-d H:i:s')); $formattedDateTime = $dateTime->format('Y-m-d\TH:i:s.uP'); if(in_array($logistics_type,[1,2,4])){ - $item_desc='商品'; + $item_desc='门店商品'; }else{ - $item_desc='充值'; + $item_desc='采购礼包'; } return $this->app->getClient()->postJson("wxa/sec/order/upload_shipping_info?access_token=$token", [ 'order_key' =>[ From d9b553cca385ea6b29b8348dc39f90f74fb3cda2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 1 Sep 2024 12:06:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_order/StoreOrderLists.php | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php index d083b379e..ac3ab608b 100644 --- a/app/admin/lists/store_order/StoreOrderLists.php +++ b/app/admin/lists/store_order/StoreOrderLists.php @@ -11,13 +11,14 @@ 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\user\User; +use app\common\lists\ListsExcelInterface; /** * 订单列表列表 * Class StoreOrderLists * @package app\admin\listsstore_order */ -class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface +class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface { @@ -30,7 +31,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['order_id','store_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id','paid', 'status', 'is_writeoff','is_merge'], + '=' => ['order_id','store_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id','paid', 'status', 'is_writeoff','is_merge','uid'], 'between_time' => 'create_time' ]; } @@ -119,4 +120,36 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface }) ->count(); } + + /** + * @notes 导出文件名 + * @return string + * @author 乔峰 + * @date 2022/11/24 16:17 + */ + public function setFileName(): string + { + return '订单列表'; + } + + + /** + * @notes 导出字段 + * @return string[] + * @author 乔峰 + * @date 2022/11/24 16:17 + */ + public function setExcelFields(): array + { + $data = [ + 'id' => 'ID', + 'order_id'=>'订单号', + 'store_name'=>'门店', + 'nickname' => '用户', + 'total_price' => '总金额', + 'pay_price' => '实际支付', + 'pay_time' => '支付时间', + ]; + return $data; + } } From 2d10a79e5479d198f364bf0448df9348755f36a0 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 1 Sep 2024 12:37:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0'export'=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=92=8C=E4=BB=B7=E5=80=BC=E8=AE=A1=E7=AE=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_branch_product/StoreBranchProductLists.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index 6b2f16248..106b3ca66 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -66,6 +66,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI public function lists(): array { $class_all = $this->request->get('class_all'); + $export=$this->request->get('export'); $where = []; if ($class_all) { $arr = Cate::where('pid', $class_all)->column('id'); @@ -89,10 +90,13 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) ->select() - ->each(function ($item) { + ->each(function ($item) use($export) { $item['system_store_name'] = SystemStore::where('id', $item['store_id'])->value('name'); $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name'); $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name'); + if($export==2){ + $item['total_price'] = bcmul($item['purchase'],$item['stock'],2); + } return $item; }) ->toArray(); @@ -150,6 +154,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI 'vip_price' => '会员价', 'price' => '零售价', 'bar_code' => '条码', + 'total_price' => '价值', ]; return $data; }