wugg 2 years ago
parent
commit
fdf82adcd4
1 changed files with 12 additions and 1 deletions
  1. 12 1
      app/admin/controller/Sale.php

+ 12 - 1
app/admin/controller/Sale.php

@@ -104,7 +104,6 @@ class Sale extends BaseController
         }
         $origin_price = $origin['nake_fee'];
         $sale_price = isset($this->post['good_price'])&&$this->post['good_price']!="" ? floatval($this->post['good_price']):0;
-
         if($goodtype==1){
             $good = Db::name("good_ladder")->where(["skuCode"=>$skuCode,"is_del"=>0,"status"=>1])->where([["min_num",
                 "<=",$good_num]])->order("min_num desc")->find();
@@ -2777,6 +2776,18 @@ class Sale extends BaseController
         if($sale_num===""){
             return error_show(1003,"参数sale_num不能为空");
         }
+        $ct = Db::name('good_platform')->alias('a')->join('good b', 'b.spuCode=a.spuCode', 'left')
+            ->where(['a.skuCode' =>$skuCode])->find();
+        if ($ct == false) {
+            return error_show(1002, "未找到商品数据");
+        }
+        $origin = Db::name("good_nake")->where([["spuCode","=",$ct['spuCode']],["min_num","<=", $sale_num],["is_del","=",
+            0]])->order("min_num desc")->find();
+        if($origin==false){
+            $origin = Db::name("good_nake")->where([["spuCode","=",$ct['spuCode']],["is_del","=",
+                0]])->order("min_num asc")->find();
+            return error_show(1003,"不满足成本最低阶梯数量{$origin['min_num']}");
+        }
         if($is_activity==1){
             $act = Db::name("activity_info")->alias("a")->leftJoin("good_activity b","a.activity_code=b.activity_code")
                 ->where(["a.skuCode"=>$skuCode,"a.is_del"=>0,"a.status"=>1,"b.status"=>6,"b.is_del"=>0])->find();