Jelajahi Sumber

Merge branch 'feature/dd-1172-deluseless' into feature/dd-1839-1172

root 3 tahun lalu
induk
melakukan
30a35d3b47

+ 1 - 3
backendApi/modules/v1/controllers/ShopController.php

@@ -140,9 +140,7 @@ class ShopController extends BaseController {
         $data = ShopGoods::findOneAsArray('ID=:ID', [':ID' => $id]);
         $data['SELL_TYPE'] = explode(',',$data['SELL_TYPE']);
         $data['GIFT_TYPE'] = explode(',',$data['GIFT_TYPE']);
-        if ($data['TYPE'] == 1 || $data['TYPE'] == 2) {
-            $data['SELL_DISCOUNT'] = ShopGoods::GOODS_TYPE[$data['TYPE']]['discount']/100;
-        }
+        
         return static::notice(['goodsInfo'=>$data,'sellType' => ShopGoods::SALE_TYPE, 'goodsType' => ShopGoods::GOODS_TYPE, 'giftType' => ShopGoods::GIFT_TYPE]);
     }
 

+ 1 - 9
backendApi/modules/v1/models/lists/shop/GoodsList.php

@@ -57,15 +57,7 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                 'SELL_DISCOUNT' => [
                     'header' => '商品折扣',
                     'value' => function($row) {
-                        $discount = 0;
-                        if ($row['TYPE'] == 1) {
-                            $discount = '0.5';
-                        } else if($row['TYPE'] == 2) {
-                            $discount = '0.6';
-                        } else {
-                            $discount = $row['SELL_DISCOUNT'];
-                        }
-
+                        $discount = $row['SELL_DISCOUNT'];
                         return $discount;
                     },
                     'headerOther' => ['width' => '150'],

+ 6 - 20
common/models/forms/OrderForm.php

@@ -283,20 +283,13 @@ class OrderForm extends Model
         $ids = $this->goodsId;
         $totalAmount = 0;
         $totalPv = 0;
-        $goodsType = ShopGoods::GOODS_TYPE;
         foreach ($this->goodsNum as $k => $v) {
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
                 if($goods['STORE_NUMS']>0){
-                    if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
-                        $discount = $goodsType[$goods['TYPE']]['discount'];
-                        $realPrice = $goods['SELL_PRICE'] * $discount/100;
-                        $realPv = $goods['PRICE_PV'] * $discount/100;
-                    } else {
-                        $discount = $goods['SELL_DISCOUNT'];
-                        $realPrice = $goods['SELL_PRICE'] * $discount;
-                        $realPv = $goods['PRICE_PV'] * $discount;
-                    }
+                    $discount = $goods['SELL_DISCOUNT'];
+                    $realPrice = $goods['SELL_PRICE'] * $discount;
+                    $realPv = $goods['PRICE_PV'] * $discount;
                     $totalAmount += $realPrice * intval($v);
                     $totalPv += $realPv * intval($v);
 //                    if($this->payType=='cash') {
@@ -475,20 +468,13 @@ class OrderForm extends Model
         $ids = $this->goodsId;
         $totalAmount = 0;
         $totalPv = 0;
-        $goodsType = ShopGoods::GOODS_TYPE;
         foreach ($this->goodsNum as $k => $v) {
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
                 if($goods['STORE_NUMS']>0){
-                    if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
-                        $discount = $goodsType[$goods['TYPE']]['discount'];
-                        $realPrice = $goods['SELL_PRICE'] * $discount/100;
-                        $realPv = $goods['PRICE_PV'] * $discount/100;
-                    } else {
-                        $discount = $goods['SELL_DISCOUNT'];
-                        $realPrice = $goods['SELL_PRICE'] * $discount;
-                        $realPv = $goods['PRICE_PV'] * $discount;
-                    }
+                    $discount = $goods['SELL_DISCOUNT'];
+                    $realPrice = $goods['SELL_PRICE'] * $discount;
+                    $realPv = $goods['PRICE_PV'] * $discount;
                     $totalAmount += $realPrice * intval($v);
                     $totalPv += $realPv * intval($v);
                     $this->_orderGoods[] = [

+ 2 - 12
frontendApi/modules/v1/controllers/ShopController.php

@@ -44,12 +44,7 @@ class ShopController extends BaseController {
             'from' => ShopGoods::tableName(),
         ]);
         foreach ($data['list'] as $key => $value) {
-            if ($value['TYPE'] == 1 || $value['TYPE'] == 2) {
-                $data['list'][$key]['DISCOUNT'] = ShopGoods::GOODS_TYPE[$value['TYPE']]['discount'];
-            } else {
-                $data['list'][$key]['DISCOUNT'] = $value['SELL_DISCOUNT']*100;
-            }
-            // $data['list'][$key]['DISCOUNT'] = ShopGoods::GOODS_TYPE[$value['TYPE']]['discount'];
+            $data['list'][$key]['DISCOUNT'] = $value['SELL_DISCOUNT']*100;
         }
         return static::notice($data);
     }
@@ -188,12 +183,7 @@ class ShopController extends BaseController {
             'from' => ShopGoods::tableName(),
         ]);
         foreach ($data['list'] as $key => $value) {
-            if ($value['TYPE'] == 1 || $value['TYPE'] == 2) {
-                $data['list'][$key]['DISCOUNT'] = ShopGoods::GOODS_TYPE[$value['TYPE']]['discount'];
-            } else {
-                $data['list'][$key]['DISCOUNT'] = $value['SELL_DISCOUNT']*100;
-            }
-            //$data['list'][$key]['DISCOUNT'] = ShopGoods::GOODS_TYPE[$value['TYPE']]['discount'];
+            $data['list'][$key]['DISCOUNT'] = $value['SELL_DISCOUNT']*100;  
         }
         return static::notice($data);
     }