|
|
@@ -132,12 +132,31 @@ class OrderClass extends BaseClass
|
|
|
$data['prePrice'] = $currentPrice;
|
|
|
$actPrice = $currentPrice;
|
|
|
$realPrice = $currentPrice;
|
|
|
- //客户采购时使用红包
|
|
|
+
|
|
|
+ //商家自己开单时
|
|
|
+ if (isset($data['modifyPrice'])) {
|
|
|
+ $modifyPrice = $data['modifyPrice'] ?? 0;
|
|
|
+ if ($modifyPrice > $currentPrice) {
|
|
|
+ //人工和资材费用
|
|
|
+ $data['labourCost'] = bcsub($modifyPrice, $currentPrice, 2);
|
|
|
+ }
|
|
|
+ if ($modifyPrice < $currentPrice) {
|
|
|
+ //优惠金额
|
|
|
+ $data['discountAmount'] = bcsub($currentPrice, $modifyPrice, 2);
|
|
|
+ $data['discountType'] = dict::getDict('discountType', 'discount');
|
|
|
+ }
|
|
|
+ $actPrice = $modifyPrice;
|
|
|
+ $realPrice = $modifyPrice;
|
|
|
+ }
|
|
|
+
|
|
|
+ //客户采购时使用红包时
|
|
|
if (isset($data['discountType']) && $data['discountType'] == dict::getDict('discountType', 'hb')) {
|
|
|
$discountAmount = $data['discountAmount'] ?? 0;
|
|
|
- $actPrice = bcsub($currentPrice, $discountAmount, 2);
|
|
|
- $realPrice = $actPrice;
|
|
|
+ $currentDiscountPrice = bcsub($currentPrice, $discountAmount, 2);
|
|
|
+ $actPrice = $currentDiscountPrice;
|
|
|
+ $realPrice = $currentDiscountPrice;
|
|
|
}
|
|
|
+
|
|
|
$data['actPrice'] = $actPrice;
|
|
|
$data['realPrice'] = $realPrice;
|
|
|
|