|
@@ -211,7 +211,7 @@ class GoodsController extends Curd
|
|
|
->exists()) {
|
|
|
$item['have_success_paydetail'] = 'Y';
|
|
|
}
|
|
|
- $item['payDetail'] = PayDetailService::getPayWay($item['order_groupby'],$item['order_id']);
|
|
|
+ $item['payDetail'] = PayDetailService::getPayWay($item['order_groupby'], $item['order_id']);
|
|
|
}
|
|
|
|
|
|
return $items;
|
|
@@ -1785,20 +1785,30 @@ class GoodsController extends Curd
|
|
|
}
|
|
|
}
|
|
|
// 推荐人
|
|
|
+ $orderAmount = [];
|
|
|
$params['order_extend_json']['referee'] = $params['referee'] ?? '';
|
|
|
foreach ($params['goodsContentList'] as $goods) {
|
|
|
+ $amountPay = floatval($goods['goods_sales_price']) * $goods['nbr'];
|
|
|
$discountJson = [];
|
|
|
if (!empty($params['order_discount_json'])) {
|
|
|
$discountJson = json_decode($params['order_discount_json'], true);
|
|
|
- foreach ($discountJson as &$item) {
|
|
|
- if (!empty($item['coupon_value'])) {
|
|
|
- $item['coupon_value'] = round((floatval($goods['goods_sales_price']) * $goods['nbr'] / $params['order_amount_total']) * $item['coupon_value'], 2);
|
|
|
+ foreach ($discountJson as $item) {
|
|
|
+// if (!empty($item['coupon_value'])) {
|
|
|
+// $item['coupon_value'] = round((floatval($goods['goods_sales_price']) * $goods['nbr'] / $params['order_amount_total']) * $item['coupon_value'], 2);
|
|
|
+// }
|
|
|
+ if (!empty($item['coupon_id'])) {
|
|
|
+ $orderAmount = OrderService::countAndAmount($params['goodsContentList'], $item['coupon_id']);
|
|
|
+ $payAmountUseCoupon = $params['order_amount_pay'] - ($params['order_amount_total'] - $orderAmount['amount']);
|
|
|
+ if (in_array($goods['goods_id'], $orderAmount['goodsIds'])) {
|
|
|
+ $amountPay = round((floatval($goods['goods_sales_price']) * $goods['nbr'] / $orderAmount['amount']) * $payAmountUseCoupon, 2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $orderAmount['amount'] = $params['order_amount_pay'];
|
|
|
+ $amountPay = round((floatval($goods['goods_sales_price']) * $goods['nbr'] / $params['order_amount_total']) * $params['order_amount_pay'], 2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$orderId = 'OD' . date('ymdHi') . random_string(4, 'up');
|
|
|
- $amountPay = round((floatval($goods['goods_sales_price']) * $goods['nbr'] / $params['order_amount_total']) * $params['order_amount_pay'], 2);
|
|
|
-// $amountPay = round(floatval($goods['goods_sales_price']) * $goods['nbr'] * $params['order_ratio'], 2);
|
|
|
$data = [
|
|
|
'order_id' => $orderId,
|
|
|
'order_groupby' => $params['orderGroupId'],
|