|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace bizGhs\order\classes;
|
|
|
|
|
|
+use bizGhs\product\classes\ProductClass;
|
|
|
use common\components\imgUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
@@ -36,18 +37,33 @@ class OrderItemClass extends BaseClass
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
- //添加和修改花材
|
|
|
- public static function replace($orderSn, $product)
|
|
|
+ //添加修改花材 shish 2021.1.22
|
|
|
+ public static function replace($info, $product, $add = false)
|
|
|
{
|
|
|
//快速付款没有商品
|
|
|
if (empty($product)) {
|
|
|
return false;
|
|
|
}
|
|
|
- self::deleteByCondition(['orderSn' => $orderSn]);
|
|
|
- foreach ($product as $key => $val) {
|
|
|
- $product[$key]['orderSn'] = $orderSn;
|
|
|
+ if ($add) {
|
|
|
+ $orderSn = $info['orderSn'];
|
|
|
+ } else {
|
|
|
+ if (isset($info['sendStatus']) == false) {
|
|
|
+ util::fail('订单无配送状态');
|
|
|
+ }
|
|
|
+ //确认当前订单是否还可以修改花材
|
|
|
+ if ($info['sendStatus'] >= OrderClass::ORDER_STATUS_SENDING) {
|
|
|
+ util::fail('此订单已经不能修改花材');
|
|
|
+ }
|
|
|
}
|
|
|
- self::batchAdd($product);
|
|
|
+
|
|
|
+ //价格等信息
|
|
|
+ $product = ProductClass::computedPriceByItemInfo($product);
|
|
|
+
|
|
|
+ $orderSn = $info['orderSn'];
|
|
|
+ OrderItemClass::replace($orderSn, $product);
|
|
|
+
|
|
|
+ //未发货前可以修改花材。未发货前未付款的总金额要变化,未发货前已付款的,只改变成本,成本超过总金额的,则不允许修改。 todo @lqh
|
|
|
+ //修改价格
|
|
|
}
|
|
|
|
|
|
}
|