diff --git a/app/admin/controller/store_order/StoreOrderController.php b/app/admin/controller/store_order/StoreOrderController.php index 34307b5cb..414312813 100644 --- a/app/admin/controller/store_order/StoreOrderController.php +++ b/app/admin/controller/store_order/StoreOrderController.php @@ -116,40 +116,7 @@ class StoreOrderController extends BaseAdminController if(empty($detail)){ return $this->fail('无该订单请检查'); } - //微信支付 - if(in_array($detail['pay_type'],[PayEnum::WECHAT_PAY_MINI,PayEnum::WECHAT_PAY_BARCODE])){ - $money = (int)bcmul($detail['pay_price'],100); - $refund = (new \app\common\logic\store_order\StoreOrderLogic()) - ->refund($params['order_id'],$money,$money); - if($refund){ -// $arr = [ -// 'amount'=>[ -// 'refund'=>$money -// ] -// ]; -// PayNotifyLogic::refund($params['order_id'],$arr); - return $this->success(); - } - } - //余额支付 采购款支付 - if (in_array($detail['pay_type'] ,[PayEnum::BALANCE_PAY,PayEnum::PURCHASE_FUNDS])){ - $money = bcmul($detail['pay_price'],100); - $arr = [ - 'amount'=>[ - 'refund'=>$money - ] - ]; - PayNotifyLogic::refund($params['order_id'],$arr); - return $this->success(); - - } - //现金支付 - if($detail['pay_type'] = PayEnum::CASH_PAY){ - PayNotifyLogic::cash_refund($params['order_id']); - return $this->success(); - } - //todo 支付包支付 - + StoreOrderLogic::refund($detail,$params); return $this->fail('退款失败'); } 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/admin/lists/user/UserLists.php b/app/admin/lists/user/UserLists.php index 920176906..a419056cc 100644 --- a/app/admin/lists/user/UserLists.php +++ b/app/admin/lists/user/UserLists.php @@ -13,6 +13,7 @@ use app\common\model\user\UserAddress; use app\common\model\vip_flow\VipFlow; use support\Db; use app\common\lists\ListsSearchInterface; +use app\common\model\system_store\SystemStore; class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsSearchInterface { @@ -44,7 +45,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS public function lists(): array { $field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship, - label_id,integral,now_money,total_recharge_amount,vip_time"; + label_id,integral,now_money,total_recharge_amount,vip_time,store_id"; $lists = User::where($this->searchWhere) ->with(['user_ship','user_label']) ->limit($this->limitOffset, $this->limitLength) @@ -68,6 +69,10 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS if($item['label_name']== null){ $item['label_name'] = '无'; } + $item['store_name']=''; + if($item['store_id']>0){ + $item['store_name'] = SystemStore::where('id',$item['store_id'])->value('name'); + } $item['return_money'] = VipFlow:: where(['user_id'=>$item['id'],'status'=>0]) ->sum('number')??0; @@ -135,12 +140,17 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS public function setExcelFields(): array { return [ - 'sn' => '用户编号', 'nickname' => '用户昵称', + 'real_name' => '真实姓名', 'account' => '账号', 'mobile' => '手机号码', - 'channel' => '注册来源', - 'create_time' => '注册时间', + 'now_money' => '用户余额', + 'integral' => '礼品券', + 'vip_name' => '会员类型', + 'store_name' => '门店', + 'total_recharge_amount' => '累计消费', + 'purchase_funds' => '采购款', + 'format_address'=>'地址' ]; } } \ No newline at end of file diff --git a/app/admin/logic/store_order/StoreOrderLogic.php b/app/admin/logic/store_order/StoreOrderLogic.php index 23379ef93..96ded6ae2 100644 --- a/app/admin/logic/store_order/StoreOrderLogic.php +++ b/app/admin/logic/store_order/StoreOrderLogic.php @@ -2,9 +2,10 @@ namespace app\admin\logic\store_order; - +use app\common\enum\PayEnum; use app\common\model\store_order\StoreOrder; use app\common\logic\BaseLogic; +use app\common\logic\PayNotifyLogic; use app\common\model\store_order_cart_info\StoreOrderCartInfo; use think\facade\Db; @@ -29,9 +30,7 @@ class StoreOrderLogic extends BaseLogic { Db::startTrans(); try { - StoreOrder::create([ - - ]); + StoreOrder::create([]); Db::commit(); return true; @@ -54,9 +53,7 @@ class StoreOrderLogic extends BaseLogic { Db::startTrans(); try { - StoreOrder::where('id', $params['id'])->update([ - - ]); + StoreOrder::where('id', $params['id'])->update([]); Db::commit(); return true; @@ -90,11 +87,42 @@ class StoreOrderLogic extends BaseLogic */ public static function detail($params): array { - $data= StoreOrder::findOrEmpty($params['id']); - if($data){ - $data['status_name']=$data->status_name_text; - $data['pay_time']=date('Y-m-d H:i:s',$data['pay_time']); + $data = StoreOrder::findOrEmpty($params['id']); + if ($data) { + $data['status_name'] = $data->status_name_text; + $data['pay_time'] = date('Y-m-d H:i:s', $data['pay_time']); } return $data?->toArray(); } -} \ No newline at end of file + + public static function refund($detail, $params) + { + //微信支付 + if (in_array($detail['pay_type'], [PayEnum::WECHAT_PAY_MINI, PayEnum::WECHAT_PAY_BARCODE])) { + $money = (int)bcmul($detail['pay_price'], 100); + $refund = (new \app\common\logic\store_order\StoreOrderLogic()) + ->refund($params['order_id'], $money, $money); + if ($refund) { + return '退款成功'; + } + } + //余额支付 采购款支付 + if (in_array($detail['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) { + $money = bcmul($detail['pay_price'], 100); + $arr = [ + 'amount' => [ + 'refund' => $money + ] + ]; + PayNotifyLogic::refund($params['order_id'], $arr); + return '退款成功'; + } + //现金支付 + if ($detail['pay_type'] = PayEnum::CASH_PAY) { + PayNotifyLogic::cash_refund($params['order_id']); + return '退款成功'; + } + return false; + //todo 支付包支付 + } +} diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index a72a22068..299cbc2bb 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -2,6 +2,7 @@ namespace app\api\controller\order; +use app\admin\logic\store_order\StoreOrderLogic; use app\api\logic\order\OrderLogic; use app\api\controller\BaseApiController; use app\api\lists\order\OrderList; @@ -413,15 +414,9 @@ class OrderController extends BaseApiController } } - // #[ - // ApiDoc\Title('核销'), - // ApiDoc\url('/api/order/order/writeoff_order'), - // ApiDoc\Method('POST'), - // ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"), - // ApiDoc\NotHeaders(), - // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - // ApiDoc\ResponseSuccess("data", type: "array"), - // ] + /** + * 核销 + */ public function writeoff_order() { $params = (new OrderValidate())->post()->goCheck('check'); @@ -453,25 +448,22 @@ class OrderController extends BaseApiController } - // #[ - // ApiDoc\Title('订单退款申请'), - // ApiDoc\url('/api/order/order/apply_refund'), - // ApiDoc\Method('POST'), - // ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"), - // ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"), - // ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"), - // ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"), - // ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"), - // ApiDoc\NotHeaders(), - // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - // ApiDoc\ResponseSuccess("data", type: "array"), - // ] + /** + * 订单退款申请 + */ public function apply_refund() { $params = (new OrderValidate())->post()->goCheck('add'); $uid = $this->userId; //拆单逻辑 - OrderLogic::dealRefund($uid, $params); + $res=OrderLogic::dealRefund($uid, $params); + $detail = StoreOrder::where('id', $params['id'])->where('refund_type',1)->find(); + if($detail && $res!=2){ + $res=StoreOrderLogic::refund($detail,['order_id'=>$detail['order_id']]); + if($res!=false){ + return $this->success($res); + } + } return $this->success('申请成功'); } diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index f5982542b..fae9c37fe 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -102,6 +102,11 @@ class LoginLogic extends BaseLogic //返回登录信息 $avatar = $user->avatar ?: Config::get('project.default_image.user_avatar'); $avatar = FileService::getFileUrl($avatar); + if($user->store_id){ + $share_name=SystemStore::where('id',$user->store_id)->value('abbreviation'); + }else{ + $share_name=SystemStore::where('id',4)->value('abbreviation'); + } return [ 'avatar' => $avatar, 'id'=>$userInfo['user_id'], @@ -113,6 +118,7 @@ class LoginLogic extends BaseLogic // 'sn' => $userInfo['sn'], 'token' => $userInfo['token'], 'real_name' => $userInfo['real_name'], + 'share_name' => $share_name.'No.'.preg_replace('/4/','*', $user['id']), ]; } catch (\Exception $e) { self::setError($e->getMessage()); diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index eb44a671e..d6e84dfff 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -18,6 +18,7 @@ use app\common\model\order\Cart; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_category\StoreCategory; use app\common\model\store_finance_flow\StoreFinanceFlow; +use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_product\StoreProduct; @@ -82,13 +83,13 @@ class OrderLogic extends BaseLogic self::$fresh_price = 0; //生鲜金额 /** 计算价格 */ $off_activity = Config::where('name', 'off_activity')->value('value'); - $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info'; + $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose'; foreach ($cart_select as $k => $v) { $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find(); if (!$find) { // unset($cart_select[$k]); // continue; - $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info'; + $field = 'id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase, id product_id,cate_id,store_info,rose'; $find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find(); if ($find) { $cate_id = StoreCategory::where('id', $find['cate_id'])->value('pid'); @@ -135,6 +136,7 @@ class OrderLogic extends BaseLogic $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; $cart_select[$k]['vip_frozen_price'] = 0; $cart_select[$k]['store_info'] = $find['store_info']; + $cart_select[$k]['rose'] = $find['rose']; //会员待返回金额 // if ($user && $off_activity == 0) { // if ($user['user_ship'] == 4) { @@ -229,7 +231,7 @@ class OrderLogic extends BaseLogic $store_id = getenv('STORE_ID') ?? 1; $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? []; } - $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id')??0; + $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id') ?? 0; } if (empty($store_check)) { if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) { @@ -290,12 +292,25 @@ class OrderLogic extends BaseLogic // $_order['reservation_time'] = $params['reservation_time']; // $_order['reservation'] = YesNoEnum::YES; // } - if ($addressId > 0 && $uid > 0) { - $address = UserAddress::where(['id' => $addressId, 'uid' => $uid])->find(); + if ($uid > 0) { + $address = UserAddress::where(['uid' => $uid])->find(); if ($address) { $_order['real_name'] = $address['real_name']; $_order['user_phone'] = $address['phone']; - $_order['user_address'] = $address['detail']; + if ($address['area']) { + $_order['user_address'] = Db::name('geo_area')->where('area_code', $address['area'])->value('area_name') ?? ''; + } + if ($address['street']) { + $street_name = Db::name('geo_street')->where('street_code', $address['street'])->value('street_name') ?? ''; + $_order['user_address'] .= '/' . $street_name; + } + if ($address['village']) { + $village_name = Db::name('geo_village')->where('village_code', $address['village'])->value('village_name') ?? ''; + $_order['user_address'] .= '/' . $village_name; + } + if ($address['brigade']) { + $_order['user_address'] .= '/' . $address['brigade'] ?? $address['brigade'] . '队'; + } } } if ($params['shipping_type'] == 2) { @@ -575,12 +590,7 @@ class OrderLogic extends BaseLogic 'staff_id' => $params['staff_id'] ?? 0, ], ['id' => $order['id']]); //修改商品统计记录标识 - (new StoreProductLog())->update( - [ - 'store_id' => $params['store_id'] - ], - ['oid' => $order['id']] - ); + (new StoreProductLog())->where('oid', $order['id'])->update(['store_id' => $params['store_id']]); (new StoreOrderCartInfo())->update([ 'verify_code' => $params['verify_code'] . '-1', 'writeoff_time' => time(), @@ -590,6 +600,10 @@ class OrderLogic extends BaseLogic 'update_time' => time(), ], ['oid' => $order['id']]); $financeFlow = new StoreFinanceFlow(); + $res = $financeFlow->where('order_id', $order['id'])->update(['store_id' => $params['store_id'], 'staff_id' => $params['staff_id']]); + if ($res) { + $order['store_id'] = $params['store_id']; + } $financeFlowLogic = new StoreFinanceFlowLogic(); $select_1 = $financeFlow->where(['order_id' => $order['id'], 'financial_pm' => 1, 'financial_type' => ['in' => 14, 15, 16]])->select(); foreach ($select_1 as $k => $v) { @@ -818,7 +832,7 @@ class OrderLogic extends BaseLogic } } - return 1; + return $order['status']??1; } diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index ef5a9590f..8eb727c10 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -86,7 +86,7 @@ class UserLogic extends BaseLogic { $data = User::with(['userShip'])->where('id',$uid) ->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship - ,purchase_funds,integral,pay_password,label_id') + ,purchase_funds,integral,pay_password,label_id,store_id') ->find(); //判断是不是员工 if($data){ @@ -101,12 +101,10 @@ class UserLogic extends BaseLogic $data['next_limit'] = $new['limit'] - $data['total_recharge_amount']; } $data['is_staff'] = 0; - $data['store_id'] = 0; if(isset($data['mobile']) && $data['mobile']){ $check = DeliveryService::where('phone',$data['mobile'])->find()??[]; if ($check){ $data['is_staff'] = 1; - $data['store_id'] = $check['store_id']; } } $data['label_name']=UserLabel::where('label_id',$data['label_id'])->value('label_name'); @@ -125,6 +123,12 @@ class UserLogic extends BaseLogic $number = UserSign::where('uid',$uid)->where(['status'=>0])->sum('number'); $data['number'] =bcadd($number,0,2); $data['GetNumber'] =bcadd($GetNumber,0,2); + if($data['store_id']){ + $share_name=SystemStore::where('id',$data['store_id'])->value('abbreviation'); + }else{ + $share_name=SystemStore::where('id',4)->value('abbreviation'); + } + $data['share_name']= $share_name.'No.'.preg_replace('/4/','*', $data['id']); }else{ $data = []; } diff --git a/app/common/controller/BaseLikeController.php b/app/common/controller/BaseLikeController.php index 13c07d9c8..3302bcd0b 100644 --- a/app/common/controller/BaseLikeController.php +++ b/app/common/controller/BaseLikeController.php @@ -22,8 +22,11 @@ class BaseLikeController extends BaseController * @author 乔峰 * @date 2021/12/27 14:21 */ - protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0) + protected function success(string $msg = 'success', $data = [], int $code = 1, int $show = 0) { + if(is_object($data)){ + $data = $data->toArray(); + } return JsonService::success($msg, $data, $code, $show); } @@ -36,6 +39,9 @@ class BaseLikeController extends BaseController */ protected function data($data) { + if(is_object($data)){ + $data = $data->toArray(); + } return JsonService::data($data); } 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 c4b03a1af..e37f97f22 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; } diff --git a/app/queue/redis/OrderWetchaPushSend.php b/app/queue/redis/OrderWetchaPushSend.php index 0f6315125..60e1ba2f2 100644 --- a/app/queue/redis/OrderWetchaPushSend.php +++ b/app/queue/redis/OrderWetchaPushSend.php @@ -43,7 +43,8 @@ class OrderWetchaPushSend implements Consumer $cart_info=StoreOrderCartInfo::where('oid',$order['id'])->field('cart_info')->select(); $product_info="\r\n>商品信息:------------------"; foreach($cart_info as $k=>$v['cart_info']){ - $a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元'; + $unit_name=$v['cart_info']['cart_info']['unit_name']??''; + $a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].$unit_name.' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元'; $product_info.="\r\n>$a"; } $arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的订单请及时跟踪 diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 9adaf4a7b..6988ba07d 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -66,6 +66,7 @@ class WorkbenchLogic extends BaseLogic $storeFinanceWhere['store_id'] = $params['store_id']; $storeFinanceWhereTwo['store_id'] = $params['store_id']; $attritionWhere['id'] = $params['store_id']; + $all_where['store_id'] = $params['store_id']; } $orderLogic = new StoreOrderLogic(); //订单总金额