|
|
@@ -43,14 +43,14 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
//确认是否要配送的商品
|
|
|
$needSend = isset($goodsInfo['needSend']) && $goodsInfo['needSend'] == 1 ? 1 : 0;
|
|
|
-
|
|
|
+
|
|
|
$post['userId'] = $this->userId;
|
|
|
$user = $this->user;
|
|
|
$post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
|
|
|
$bookMobile = isset($post['bookMobile']) && !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
|
|
|
$bookMobile = empty($bookMobile) && isset($user['mobile']) && !empty($user['mobile']) ? $user['mobile'] : $bookMobile;
|
|
|
$post['bookMobile'] = $bookMobile;
|
|
|
-
|
|
|
+
|
|
|
$post['payWay'] = $this->isWx == true ? 0 : 1;
|
|
|
$defaultShopId = MerchantService::getDefaultShopId($this->merchant);
|
|
|
if (empty($defaultShopId)) {
|
|
|
@@ -107,7 +107,6 @@ class OrderController extends BaseController
|
|
|
|
|
|
$post['prePrice'] = $prePrice;
|
|
|
$post['actPrice'] = $actPrice;
|
|
|
- dd($post);
|
|
|
$order = OrderService::addOrder($post);
|
|
|
$orderId = $order['id'];
|
|
|
$orderSn = $order['orderSn'];
|
|
|
@@ -156,10 +155,14 @@ class OrderController extends BaseController
|
|
|
$typeList = configDict::getConfig('capitalType');
|
|
|
$capitalType = $typeList['xhOrder']['id'];
|
|
|
$totalFee = $order['actPrice'];
|
|
|
- xhPayToolService::balancePay($orderSn, $totalFee, $capitalType, $couponId);
|
|
|
- util::success(['discountAmount' => 9.9, 'discountType' => 0]);
|
|
|
+ $sourceType = 0;
|
|
|
+ $discountData = OrderService::getDiscountPrice(['price' => $totalFee, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->userId]);
|
|
|
+ $actPrice = $discountData['price'];
|
|
|
+ $respond = xhPayToolService::balancePay($orderSn, $actPrice, $capitalType, $couponId);
|
|
|
+ $balance = isset($respond['balance']) ? $respond['balance'] : 0;
|
|
|
+ util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'balance' => $balance]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//获取商城下单要用的微信支付和小程序支付参数 shish 2019.21.3
|
|
|
public function actionWxPay()
|
|
|
{
|
|
|
@@ -401,15 +404,15 @@ class OrderController extends BaseController
|
|
|
//直接将支付宝的html返回给前端
|
|
|
echo $result;
|
|
|
} elseif ($payWay == 2) {
|
|
|
- //验证支付密码是否正确
|
|
|
+ //余额支付,验证支付密码是否正确
|
|
|
$payPassword = isset($post['payPassword']) ? $post['payPassword'] : 0;
|
|
|
$user = UserService::getUserInfo($this->userId, false);
|
|
|
UserService::validPayPassword($payPassword, $user);
|
|
|
$typeList = configDict::getConfig('capitalType');
|
|
|
$capitalType = $typeList['xhOrder']['id'];
|
|
|
- $totalFee = $order['actPrice'];
|
|
|
- xhPayToolService::balancePay($orderSn, $totalFee, $capitalType, $couponId);
|
|
|
- util::success(['discountAmount' => 9.9, 'discountType' => 0]);
|
|
|
+ $respond = xhPayToolService::balancePay($orderSn, $actPrice, $capitalType, $couponId);
|
|
|
+ $balance = isset($respond['balance']) ? $respond['balance'] : 0;
|
|
|
+ util::success(['discountAmount' => $discountData['discountAmount'], 'discountType' => $discountData['discountType'], 'orderSn' => $orderSn, 'orderId' => $orderId, 'balance' => $balance]);
|
|
|
} else {
|
|
|
util::fail('无效的支付方式');
|
|
|
}
|