dever 3 роки тому
батько
коміт
65c4bed19f

+ 17 - 1
service/agent/database/member_goods.php

@@ -176,7 +176,23 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'text',
             'list'      => true,
-            'list_order' => 7,
+            'list_name' => '未兑换价值',
+            'list'      => '({total_num} - {sell_num})*{price}',
+            'list_order' => 9,
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '单件价值',
+            'default'   => '0',
+            'desc'      => '单件价值',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => true,
+            'list_name' => '已兑换价值',
+            'list'      => '{sell_num}*{price}',
+            'list_order' => 10,
         ),
 
         'state'     => array

+ 12 - 7
service/agent/lib/Manage.php

@@ -325,7 +325,7 @@ class Manage
     # 新增权益
     private function addGoods($order, $v)
     {
-        $price = 0;
+        $cash = $price = 0;
         $t = intval($order['price']/10000);
         if ($t <= 0) {
             $t = 1;
@@ -333,7 +333,8 @@ class Manage
         if ($v['type'] == 1) {
             $v['num'] = $v['num'] * $t;
             $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['type_id'], $v['sku_id']);
-            $price = $goods_info['price'] * $v['num'];
+            $price = $goods_info['price'];
+            $cash = $goods_info['price'] * $v['num'];
             if (isset($goods_info['sku'])) {
                 $sku = '-' . $goods_info['sku']['string'];
             } else {
@@ -347,15 +348,17 @@ class Manage
             if (!$card) {
                 return false;
             }
-            $price = $card['price']*$v['num'] * $t;
-            $v['sku_id'] = Dever::load('card/lib/code')->create($card, 2, $order['mid'], $order['id'], $price);
+            $cash = $card['price']*$v['num'] * $t;
+            $price = $cash;
+            $v['sku_id'] = Dever::load('card/lib/code')->create($card, 2, $order['mid'], $order['id'], $cash);
             if (!$v['sku_id']) {
                 return false;
             }
             $name = $card['name'];
         } elseif ($v['type'] == 3) {
             $prize = Dever::db('setting/prize')->find($v['type_id']);
-            $price = $prize['price']*$v['num'];
+            $price = $prize['price'];
+            $cash = $prize['price']*$v['num'];
             $name = $prize['name'];
         }
 
@@ -368,7 +371,8 @@ class Manage
         if ($info) {
             $up['where_id'] = $info['id'];
             $up['total_num'] = $info['total_num'] + $v['num'];
-            $up['cash'] = $price;
+            $up['cash'] = $cash;
+            $up['price'] = $price;
             $up['name'] = $name;
             $state = Dever::db('agent/member_goods')->update($up);
 
@@ -379,7 +383,8 @@ class Manage
         } else {
             $up = $where;
             $up['total_num'] = $v['num'];
-            $up['cash'] = $price;
+            $up['cash'] = $cash;
+            $up['price'] = $price;
             $up['name'] = $name;
             $state = Dever::db('agent/member_goods')->insert($up);
             if ($state) {

+ 10 - 7
service/agent/lib/Member_set.php

@@ -80,11 +80,12 @@ class Member_set
                 }
             } else {
                 $w['total_num'] = $v['total'];
-                $price = 0;
+                $cash = $price = 0;
                 
                 if ($type == 1) {
                     $goods_info = Dever::load('goods/lib/info')->getInfoBySku($w['type_id'], $w['sku_id']);
-                    $price = $goods_info['price'] * $w['total_num'];
+                    $price = $goods_info['price'];
+                    $cash = $goods_info['price'] * $w['total_num'];
                     if (isset($goods_info['sku'])) {
                         $sku = '-' . $goods_info['sku']['string'];
                     } else {
@@ -97,9 +98,9 @@ class Member_set
                     if (!$card) {
                         continue;
                     }
-                    $price = $card['price'] * $w['total_num'];
+                    $cash = $price = $card['price'] * $w['total_num'];
                     $w['total_num'] = 1;
-                    $w['sku_id'] = Dever::load('card/lib/code')->create($card, 2, $mid, -1, $price);
+                    $w['sku_id'] = Dever::load('card/lib/code')->create($card, 2, $mid, -1, $cash);
                     if (!$w['sku_id']) {
                         continue;
                     }
@@ -107,15 +108,17 @@ class Member_set
                 } elseif ($type == 2 && $sku_id > 0) {
                     # 体验卡
                     $card = Dever::db('card/code')->find($w['sku_id']);
-                    $price = $card['total_cash'];
+                    $cash = $price = $card['total_cash'];
                     $card = Dever::db('card/info')->find($card['card_id']);
                     $name = $card['name'];
                 } elseif ($type == 3) {
                     $prize = Dever::db('setting/prize')->find($w['type_id']);
-                    $price = $prize['price'] * $w['total_num'];
+                    $price = $prize['price'];
+                    $cash = $prize['price'] * $w['total_num'];
                     $name = $prize['name'];
                 }
-                $w['cash'] = $price;
+                $w['cash'] = $cash;
+                $w['price'] = $price;
                 $w['name'] = $name;
                 if (!$info) {
                     $state = Dever::db('agent/member_goods')->insert($w);

+ 17 - 1
service/bill/database/goods_stat.php

@@ -81,7 +81,7 @@ return array
             'desc'      => 'sku_id',
             'match'     => 'is_numeric',
             'list'      => true,
-            'list_name' => '剩余数量',
+            'list_name' => '未兑换数量',
             'list'      => '{total_num} - {sell_num}',
             'list_order' => 7,
         ),
@@ -132,9 +132,25 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'text',
             'list'      => true,
+            'list_name' => '未兑换价值',
+            'list'      => '({total_num} - {sell_num})*{price}',
             'list_order' => 9,
         ),
 
+        'price'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '单件价值',
+            'default'   => '0',
+            'desc'      => '单件价值',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => true,
+            'list_name' => '已兑换价值',
+            'list'      => '{sell_num}*{price}',
+            'list_order' => 10,
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',