|
|
@@ -47,7 +47,7 @@ class PurchaseClass extends BaseClass
|
|
|
const REFUND_YES = 2;
|
|
|
|
|
|
//添加采购 ssh 2021.1.18
|
|
|
- public static function addPurchase($data)
|
|
|
+ public static function addPurchase($data, $ghs)
|
|
|
{
|
|
|
$orderSn = orderSn::getPurchaseSn();
|
|
|
$data['orderSn'] = $orderSn;
|
|
|
@@ -144,6 +144,7 @@ class PurchaseClass extends BaseClass
|
|
|
$prePrice = bcadd($prePrice, $sendCost, 2);
|
|
|
$actPrice = $prePrice;
|
|
|
$realPrice = $prePrice;
|
|
|
+
|
|
|
if (isset($data['modifyPrice'])) {
|
|
|
//商家打折,修改金额
|
|
|
$modifyPrice = $data['modifyPrice'] ?? 0;
|
|
|
@@ -157,6 +158,16 @@ class PurchaseClass extends BaseClass
|
|
|
$realPrice = $modifyPrice;
|
|
|
}
|
|
|
} else {
|
|
|
+
|
|
|
+ if (isset($ghs['giveDiscount']) && $ghs['giveDiscount'] < 1 && $ghs['giveDiscount'] > 0) {
|
|
|
+ $data['discountType'] = dict::getDict('discountType', 'discount');
|
|
|
+ $give = bcsub(1, $ghs['giveDiscount'], 2);
|
|
|
+ $discountAmount = bcmul($prePrice, $give, 2);
|
|
|
+ $data['discountAmount'] = $discountAmount;
|
|
|
+ $actPrice = bcsub($prePrice, $discountAmount, 2);
|
|
|
+ $realPrice = $actPrice;
|
|
|
+ }
|
|
|
+
|
|
|
//验证优惠券
|
|
|
$couponId = isset($data['couponId']) ? $data['couponId'] : 0;
|
|
|
if (!empty($couponId)) {
|
|
|
@@ -175,7 +186,9 @@ class PurchaseClass extends BaseClass
|
|
|
$data['discountAmount'] = $coupon->amount;
|
|
|
}
|
|
|
$data['couponId'] = $couponId;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
$data['prePrice'] = $prePrice;
|
|
|
$data['actPrice'] = $actPrice;
|
|
|
$data['realPrice'] = $realPrice;
|