rabin 6 months ago
parent
commit
3d406c78e2
3 changed files with 19 additions and 10 deletions
  1. 1 0
      src/place/lib/Act.php
  2. 13 10
      src/place/lib/Price.php
  3. 5 0
      src/resource/goods/lib/Order.php

+ 1 - 0
src/place/lib/Act.php

@@ -97,6 +97,7 @@ class Act
                         }
                     }
                     if (strstr($this->db->config['load'], 'order')) {
+                        $info['cash'] = Dever::load('price', 'place')->getText($info['cash'], $info['type']);
                         if ($v['type'] == 3) {
                             $info['detail'] = Dever::load('order', 'goods')->getDetail($v['id']);
                             $info['info'] = '共' . intval($info['num']) . '件商品';

+ 13 - 10
src/place/lib/Price.php

@@ -86,17 +86,20 @@ class Price
     public function getDiscount($price, $vip, $agent)
     {
         $result = array();
-        # 获取会员价
-        if ($vip && isset($vip[Place::$user['vip_id']])) {
-            $price = $vip[Place::$user['vip_id']][1];
-        }
-        # 获取代理价
-        if ($agent && isset($agent[Place::$user['agent_id']])) {
-            $agent_price = $agent[Place::$user['agent_id']][1];
-            if ($agent_price < $price) {
-                $price = $agent_price;
+        if (Place::$uid) {
+            # 获取会员价
+            if ($vip && isset($vip[Place::$user['vip_id']])) {
+                $price = $vip[Place::$user['vip_id']][1];
+            }
+            # 获取代理价
+            if ($agent && isset($agent[Place::$user['agent_id']])) {
+                $agent_price = $agent[Place::$user['agent_id']][1];
+                if ($agent_price < $price) {
+                    $price = $agent_price;
+                }
             }
         }
+        
         # 获取折扣+代金券的价格,暂时没有
         return $price;
     }
@@ -118,7 +121,7 @@ class Price
     public function getValue($value, $price, $type)
     {
         if ($type == 3) {
-            return number_format($price * ($value/100), 2);
+            return $value ? number_format($price * ($value/100), 2) : 0.00;
         } elseif ($value || $value === '0') {
             return number_format($value, 2);
         }

+ 5 - 0
src/resource/goods/lib/Order.php

@@ -7,6 +7,11 @@ class Order
     public function getDetail($id)
     {
         $result = Dever::db('order_detail', 'place')->select(array('type' => 3, 'order_id' => $id), array('col' => 'id,name,pic,sku_name,sku_id,cash,num'));
+        if ($result) {
+            foreach ($result as &$v) {
+                $v['cash'] = Dever::load('price', 'place')->getText($v['cash'], 3);
+            }
+        }
         return $result;
     }