diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php index 3da16980b..90dfddcc8 100644 --- a/app/admin/lists/store_order/StoreOrderLists.php +++ b/app/admin/lists/store_order/StoreOrderLists.php @@ -64,7 +64,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface ->order(['id' => 'desc']) ->select()->each(function ($item) { $item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : ''; - $item['status_name'] = OrderEnum::getOrderType($item['status']) ?? ''; + if($item['status']==-1){ + $item['status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? ''; + }else{ + $item['status_name'] = OrderEnum::getOrderType($item['status']) ?? ''; + } if ($item['uid'] <= 0) { $item['nickname'] = '游客'; } else { diff --git a/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php b/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php index 959b68f01..a8a9aa900 100644 --- a/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php +++ b/app/admin/lists/store_order_cart_info/StoreOrderCartInfoLists.php @@ -47,7 +47,7 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI return StoreOrderCartInfo::where($this->searchWhere) ->field('cart_info,product_id,store_id')->limit($this->limitOffset, $this->limitLength) ->select()->each(function ($item) { - $find=StoreBranchProduct::where('product_id',$item['product_id'])->where('store_id',$item['store_id'])->field('image,store_name,store_info')->find(); + $find=StoreProduct::where('id',$item['product_id'])->field('image,store_name,store_info')->find(); if($find){ $item['image']=$find['image'];//商品图片 $item['store_name']=$find['store_name'];//商品名称 diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index e65ce0f15..9e47ccca4 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -3,6 +3,7 @@ namespace app\common\logic; use app\common\enum\OrderEnum; +use app\common\enum\PayEnum; use app\common\model\finance\CapitalFlow; class CapitalFlowLogic extends BaseLogic @@ -72,12 +73,15 @@ class CapitalFlowLogic extends BaseLogic $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - if ($payType == OrderEnum::BALANCE_PAYMEN_NO) { - $model->before_balance = $this->user['purchase_funds']; - $model->balance = bcsub($this->user['purchase_funds'], $amount, 2); - } else { + if ($payType == PayEnum::PURCHASE_FUNDS) { + $model->before_balance = bcadd($this->user['purchase_funds'],$amount,2); + $model->balance = $this->user['purchase_funds']; + } elseif ($payType == PayEnum::BALANCE_PAY){ + $model->before_balance = bcadd($this->user['now_money'],$amount,2); + $model->balance = $this->user['now_money']; + }else{ $model->before_balance = $this->user['now_money']; - $model->balance = bcsub($this->user['now_money'], $amount, 2); + $model->balance = $this->user['now_money']; } $model->create_time = date('Y-m-d H:i:s'); $model->type = 'out'; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 789d8162a..a20916ee0 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -93,7 +93,7 @@ class PayNotifyLogic extends BaseLogic } // self::addUserSing($order); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 0, $order['store_id']); + $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 3, $order['store_id']); self::dealProductLog($order); self::afterPay($order); @@ -203,7 +203,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 1, $order['store_id']); + $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 18, $order['store_id']); // if ($user['user_ship'] == 1) { // self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); // } @@ -263,7 +263,7 @@ class PayNotifyLogic extends BaseLogic } else { $capitalFlowDao = new CapitalFlowLogic($user); //微信支付和用户余额无关 - $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1, $order['store_id']); + $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 0, $order['store_id']); } $order->save(); if ($order['reservation'] == 1 && in_array($order['shipping_type'], [1, 2])) { @@ -304,10 +304,10 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); if ($purchase_funds >= $orderRe['price']) { User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update(); - $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']); + $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $orderRe['refund_price'], '', 0, $orderRe['store_id']); } else { User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update(); - $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']); + $capitalFlowDao->userExpense('user_balance_recharge_refund', 'order', $orderRe['id'], $purchase_funds, '', 0, $orderRe['store_id']); } //退还 充值得兑换券 UserSignLogic::RefundRecharge($orderRe); diff --git a/app/common/model/store_order/StoreOrder.php b/app/common/model/store_order/StoreOrder.php index 977458c8c..69b1b301b 100644 --- a/app/common/model/store_order/StoreOrder.php +++ b/app/common/model/store_order/StoreOrder.php @@ -40,7 +40,11 @@ class StoreOrder extends BaseModel public function getStatusNameTextAttr($value, $data) { - $status = OrderEnum::getOrderType($data['status']) ?? ''; + if($data['status']==-1){ + $status = OrderEnum::refundStatus($data['refund_status']) ?? ''; + }else{ + $status = OrderEnum::getOrderType($data['status']) ?? ''; + } return $status; }