This commit is contained in:
mkm 2024-06-15 18:45:21 +08:00
commit 80d24acad4
4 changed files with 19 additions and 8 deletions

View File

@ -96,7 +96,7 @@ class PayNotifyLogic extends BaseLogic
public static function purchase_funds($orderSn, $extra = []) public static function purchase_funds($orderSn, $extra = [])
{ {
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
$user = User::where('id', $order['uid'])->find(); $user = User::where('id', $extra['uid'])->find();
if ($user['purchase_funds'] < $order['pay_price']) { if ($user['purchase_funds'] < $order['pay_price']) {
throw new \Exception('采购款不足'); throw new \Exception('采购款不足');
} }

View File

@ -55,7 +55,8 @@ class StoreStorageSend implements Consumer
'bar_code' => $find['bar_code'], 'bar_code' => $find['bar_code'],
'cate_id' => $find['cate_id'], 'cate_id' => $find['cate_id'],
'price' => $find['price'], 'price' => $find['price'],
'cost' => $find['cost'], // 'cost' => $find['cost'], //v1.0
'cost' => $find['purchase'],
'vip_price' => $find['vip_price'], 'vip_price' => $find['vip_price'],
'unit' => $find['unit'], 'unit' => $find['unit'],
'store_id' => $store_id, 'store_id' => $store_id,

View File

@ -4,6 +4,7 @@ namespace app\store\controller\store_order;
use app\api\logic\order\OrderLogic; use app\api\logic\order\OrderLogic;
use app\api\validate\OrderValidate; use app\api\validate\OrderValidate;
use app\common\model\order\Cart;
use app\common\model\user\User; use app\common\model\user\User;
use app\store\lists\store_order\StoreOrderLists; use app\store\lists\store_order\StoreOrderLists;
use app\common\controller\Definitions; use app\common\controller\Definitions;
@ -141,7 +142,7 @@ class StoreOrderController extends BaseAdminController
} }
$res = (new StoreOrderLogic())->dealSendSms($params); $res = (new StoreOrderLogic())->dealSendSms($params);
if($res){ if($res){
return $this->success('发送成功',[],1,1); return $this->success('发送成功',[],0,1);
}else{ }else{
return $this->fail('发送失败'); return $this->fail('发送失败');
} }
@ -156,20 +157,24 @@ class StoreOrderController extends BaseAdminController
$addressId = (int)$this->request->post('address_id'); $addressId = (int)$this->request->post('address_id');
$auth_code = $this->request->post('auth_code'); //微信支付条码 $auth_code = $this->request->post('auth_code'); //微信支付条码
$params = $this->request->post(); $params = $this->request->post();
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) {
return $this->fail('支付条码不能为空'); return $this->fail('支付条码不能为空');
} }
if (count($cartId) > 100) { if (count($cartId) > 100) {
return $this->fail('购物车商品不能超过100个'); return $this->fail('购物车商品不能超过100个');
} }
$user = null;
if($pay_type == PayEnum::PURCHASE_FUNDS){
$user = User::where('id',$this->request->post('uid'))->find();
}
$params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id用于判断是否是当前店铺的订单 $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id用于判断是否是当前店铺的订单
$order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params);
if ($order != false) { if ($order != false) {
switch ($pay_type) { switch ($pay_type) {
case PayEnum::PURCHASE_FUNDS: case PayEnum::PURCHASE_FUNDS:
//采购款支付 //采购款支付
PayNotifyLogic::handle('purchase_funds', $order['order_id']); PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]);
return $this->success('采购款支付成功'); return $this->success('采购款支付成功',[],0,1);
case PayEnum::CASH_PAY: case PayEnum::CASH_PAY:
//现金支付 //现金支付

View File

@ -4,6 +4,7 @@
namespace app\store\lists\user; namespace app\store\lists\user;
use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\store\lists\BaseAdminDataLists; use app\store\lists\BaseAdminDataLists;
use app\common\model\user\User; use app\common\model\user\User;
use app\common\model\user\UserShip; use app\common\model\user\UserShip;
@ -37,7 +38,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array public function lists(): array
{ {
$field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time"; $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds";
$lists = User::where($this->searchWhere) $lists = User::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->field($field) ->field($field)
@ -46,6 +47,10 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
$data['sex_text'] = $data->sex_text; $data['sex_text'] = $data->sex_text;
$data['mobile'] = substr_replace($data['mobile'], '****', 3, 4); $data['mobile'] = substr_replace($data['mobile'], '****', 3, 4);
$data['user_ship_name'] =$data['user_ship']==0?'一般用户':UserShip::where('id',$data['user_ship'])->value('title'); $data['user_ship_name'] =$data['user_ship']==0?'一般用户':UserShip::where('id',$data['user_ship'])->value('title');
$data['return_money'] = StoreFinanceFlow::
where(['user_id'=>$data['id'],'status'=>0,'financial_pm'=>0])
->sum('number');
})->toArray(); })->toArray();
return $lists; return $lists;
} }