feat: 修改订单创建逻辑,优化了支付类型判断和订单生成过程,并调整了部分代码结构。
This commit is contained in:
parent
a1b54043d2
commit
3f90482d70
@ -182,14 +182,9 @@ class OrderController extends BaseApiController
|
|||||||
return $this->fail('购物车商品不能超过100个');
|
return $this->fail('购物车商品不能超过100个');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($pay_type == 9 || $pay_type == 17 ||$pay_type==13) {
|
$user=User::where('id',$this->userId)->find();
|
||||||
// if (empty($this->request->userInfo['merchant'])) {
|
|
||||||
// return $this->fail('请先绑定商户');
|
$order = OrderLogic::createOrder($cartId, $addressId, $user, $params);
|
||||||
// }
|
|
||||||
// $mer_id = $this->request->userInfo['merchant']['mer_id'];
|
|
||||||
// $params['mer_id'] = $mer_id;
|
|
||||||
// }
|
|
||||||
$order = OrderLogic::createOrder($cartId, $addressId, null, $params);
|
|
||||||
if ($order != false) {
|
if ($order != false) {
|
||||||
switch ($pay_type) {
|
switch ($pay_type) {
|
||||||
case PayEnum::BALANCE_PAY:
|
case PayEnum::BALANCE_PAY:
|
||||||
|
@ -61,7 +61,7 @@ class OrderLogic extends BaseLogic
|
|||||||
self::setError('购物车为空');
|
self::setError('购物车为空');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// try {
|
try {
|
||||||
self::$total_price = 0;
|
self::$total_price = 0;
|
||||||
self::$pay_price = 0;
|
self::$pay_price = 0;
|
||||||
self::$cost = 0; //成本
|
self::$cost = 0; //成本
|
||||||
@ -141,10 +141,10 @@ class OrderLogic extends BaseLogic
|
|||||||
if ($params['store_id']) {
|
if ($params['store_id']) {
|
||||||
$order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send');
|
$order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send');
|
||||||
}
|
}
|
||||||
// } catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
return ['order' => $order, 'cart_list' => $cart_select];
|
return ['order' => $order, 'cart_list' => $cart_select];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@ class StoreOrderLogic extends BaseLogic
|
|||||||
self::$activity_price = 0; //活动减少
|
self::$activity_price = 0; //活动减少
|
||||||
|
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
$check = DictType::where('type', 'activities')->find();
|
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,cost price,cost,product_id')->find();
|
$find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,cost price,cost,product_id')->find();
|
||||||
if (!$find) {
|
if (!$find) {
|
||||||
@ -107,7 +106,7 @@ class StoreOrderLogic extends BaseLogic
|
|||||||
'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提
|
'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提
|
||||||
'activity' =>'减免',
|
'activity' =>'减免',
|
||||||
'activity_price' =>self::$activity_price,
|
'activity_price' =>self::$activity_price,
|
||||||
'activities'=>$check['status'],
|
'activities' => self::$activity_price>0?1:0,
|
||||||
'default_delivery'=>1,
|
'default_delivery'=>1,
|
||||||
'original_price'=>self::$total_price,
|
'original_price'=>self::$total_price,
|
||||||
'deduction_price' => self::$activity_price
|
'deduction_price' => self::$activity_price
|
||||||
|
Loading…
x
Reference in New Issue
Block a user