...
|
...
|
@@ -398,7 +398,13 @@ class CartModel |
|
|
if (!empty($orderInfo)) {
|
|
|
$orderInfo['paymentType'] = isset($orderInfo['paymentType']) ? $orderInfo['paymentType'] : '';
|
|
|
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentType'], $orderInfo['couponCode'], $orderInfo['yohoCoin'], $skuList);
|
|
|
// 有货币
|
|
|
$result['yohoCoinCompute'] = $orderCompute['yohoCoinCompute'];
|
|
|
} else {
|
|
|
// 有货币
|
|
|
$result['yohoCoinCompute'] = self::yohoCoinCompute($pay);
|
|
|
}
|
|
|
|
|
|
// 根据地址id查询地址信息
|
|
|
if (isset($orderInfo['address'])) {
|
|
|
$address = $orderInfo['address'];
|
...
|
...
|
@@ -525,17 +531,17 @@ class CartModel |
|
|
if (isset($payReturn['payment_way'])) {
|
|
|
$onePay = array();
|
|
|
$isPaymentType = true;
|
|
|
foreach ($payReturn['payment_way'] as $pay) {
|
|
|
if ($pay['is_support'] !== 'Y') {
|
|
|
foreach ($payReturn['payment_way'] as $val) {
|
|
|
if ($val['is_support'] !== 'Y') {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
$onePay = array();
|
|
|
$onePay['id'] = $pay['payment_id'];
|
|
|
$onePay['paymentType'] = $pay['payment_type'];
|
|
|
$onePay['name'] = $pay['payment_type_name'];
|
|
|
$onePay['isSupport'] = $pay['is_support'] === 'Y';
|
|
|
// $onePay['default'] = ($pay['default'] === 'Y');
|
|
|
$onePay['id'] = $val['payment_id'];
|
|
|
$onePay['paymentType'] = $val['payment_type'];
|
|
|
$onePay['name'] = $val['payment_type_name'];
|
|
|
$onePay['isSupport'] = $val['is_support'] === 'Y';
|
|
|
// $onePay['default'] = ($val['default'] === 'Y');
|
|
|
if (isset($orderInfo['paymentType']) && $onePay['paymentType'] === $orderInfo['paymentType']) {
|
|
|
$onePay['recommend'] = true;
|
|
|
$isPaymentType = false;
|
...
|
...
|
@@ -550,14 +556,6 @@ class CartModel |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 有货币
|
|
|
$result['yohoCoin'] = Helpers::transPrice($payReturn['yoho_coin']);
|
|
|
/*
|
|
|
* 默认使用有货币
|
|
|
* $result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : $payReturn['use_yoho_coin'];
|
|
|
*/
|
|
|
$result['useYohoCoin'] = isset($orderCompute['use_yoho_coin']) ? $orderCompute['use_yoho_coin'] : false;
|
|
|
|
|
|
// 订单数据
|
|
|
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
|
|
|
//判断是否为JIT商品
|
...
|
...
|
@@ -579,8 +577,6 @@ class CartModel |
|
|
// 商品金额
|
|
|
$result['goodsPrice'] = $payReturn['shopping_cart_data']['str_order_amount'];
|
|
|
|
|
|
//print_r($payReturn['shopping_cart_data']['gain_yoho_coin']);
|
|
|
|
|
|
//有货币
|
|
|
if((int)$payReturn['shopping_cart_data']['gain_yoho_coin'] > 0) {
|
|
|
|
...
|
...
|
@@ -630,6 +626,35 @@ class CartModel |
|
|
}
|
|
|
|
|
|
/**
|
|
|
*有货币使用前端方案显示及是否可单击判断
|
|
|
*/
|
|
|
public static function yohoCoinCompute($orderCompute) {
|
|
|
$yohoCoinData = ['totalYohoCoinNum' => 0, 'yohoCoin' => 0, 'useYohoCoin' => 0, 'yohoCoinClick' => 0, 'yohoCoinMsg' => ''];
|
|
|
|
|
|
if (empty($orderCompute)) {
|
|
|
return $yohoCoinData;
|
|
|
}
|
|
|
|
|
|
$yohoCoinData = [
|
|
|
'totalYohoCoinNum' => intval($orderCompute['total_yoho_coin_num']),
|
|
|
'yohoCoin' => Helpers::transPrice($orderCompute['yoho_coin']),
|
|
|
'useYohoCoin' => Helpers::transPrice($orderCompute['use_yoho_coin']),
|
|
|
'yohoCoinClick' => 0,
|
|
|
'yohoCoinMsg' => ''
|
|
|
];
|
|
|
|
|
|
if ($yohoCoinData['totalYohoCoinNum'] < 100) {
|
|
|
$yohoCoinData['yohoCoinMsg'] = "共{$yohoCoinCompute['totalYohoCoinNum']}有币币,满100可用";
|
|
|
} else if ($yohoCoinData['useYohoCoin'] > 0 || $yohoCoinData['yohoCoin'] > 0) {
|
|
|
$yohoCoinData['yohoCoinMsg'] = '可抵¥' . ($yohoCoinData['useYohoCoin'] > 0 ? $yohoCoinData['useYohoCoin'] : $yohoCoinData['yohoCoin']);
|
|
|
$yohoCoinData['yohoCoinClick'] = 1;
|
|
|
} else {
|
|
|
$yohoCoinData['yohoCoinMsg'] = "不满足有货币使用条件";
|
|
|
}
|
|
|
|
|
|
return $yohoCoinData;
|
|
|
}
|
|
|
/**
|
|
|
* 购物车结算--获取可用的优惠券数目
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
...
|
...
|
@@ -668,6 +693,7 @@ class CartModel |
|
|
// 有货币添加.00后缀
|
|
|
$compute['data']['use_yoho_coin'] = Helpers::transPrice($compute['data']['use_yoho_coin']);
|
|
|
$result = $compute['data'];
|
|
|
$result['yohoCoinCompute'] = self::yohoCoinCompute($compute['data']);
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
|