rabin 2 年之前
父节点
当前提交
b1c8043fa2

+ 14 - 0
app/goods/lib/Set.php

@@ -56,11 +56,18 @@ class Set
                                 $result[$i]['min'] = $other['min'];
                             }
                             if (isset($other['total_num'])) {
+                                /*
                                 if ($col == 'type_id') {
                                     $result[$i]['total'] = $other['total_num'];
                                 } else {
                                     $result[$i]['total'] = $other['total_num'] - $other['sell_num'];
                                 }
+                                */
+                                if (isset($other['sell_num'])) {
+                                    $result[$i]['total'] = $other['total_num'] - $other['sell_num'];
+                                } else {
+                                    $result[$i]['total'] = $other['total_num'];
+                                }
                                 
                             } else {
                                 $result[$i]['total'] = $other['num'];
@@ -131,11 +138,18 @@ class Set
                                         $children['min'] = $other_sku['min'];
                                     }
                                     if (isset($other_sku['total_num'])) {
+                                        /*
                                         if ($col == 'type_id') {
                                             $children['total'] = $other_sku['total_num'];
                                         } else {
                                             $children['total'] = $other_sku['total_num'] - $other_sku['sell_num'];
                                         }
+                                        */
+                                        if (isset($other_sku['sell_num'])) {
+                                            $children['total'] = $other_sku['total_num'] - $other_sku['sell_num'];
+                                        } else {
+                                            $children['total'] = $other_sku['total_num'];
+                                        }
                                         
                                         
                                     } else {

+ 2 - 2
service/agent/assets/pc/html/setMemberGoods.html

@@ -42,7 +42,7 @@
                             <tr>
                                 <th lay-data="{field:'name'}">商品名称</th>
                                 <th lay-data="{field:'price', edit: 'text'}">价值(元)</th>
-                                <th lay-data="{field:'number', edit: 'text'}">更改数量</th>
+                                <th lay-data="{field:'number', edit: 'text'}">更改剩余数量</th>
                                 <th lay-data="{field:'operation'}">操作</th>
                             </tr>
                         </thead>
@@ -52,7 +52,7 @@
                     </table>
                 </div>
                 <div class="total ft16">
-                    合计:【<span> 当前总数量:<i class="totalNum">0</i> </span>
+                    合计:【<span> 当前剩余总数量:<i class="totalNum">0</i> </span>
                 </div>
                 <table class="reading layui-table" lay-even="">
                     <tbody>

+ 1 - 0
service/agent/lib/Member_set.php

@@ -158,6 +158,7 @@ class Member_set
                     	Dever::load('agent/lib/member_set')->log($w['mid'], '', $w['type'], $w['type_id'], $w['sku_id'], $v['total'], 0, $w['total_num'], $name, $desc);
                     }
                 } else {
+                    $w['total_num'] += $info['sell_num'];
                     $w['where_id'] = $info['id'];
                     $w['state'] = 1;
                     $state = Dever::db('agent/member_goods')->update($w);

+ 1 - 1
service/agent/lib/Set.php

@@ -94,7 +94,7 @@ class Set
                         $data[1]['children'][$k]['price'] = 0;
                         $sku_id = array();
                         foreach ($info as $k1 => $v1) {
-                            $num += $v1['total_num'];
+                            $num += ($v1['total_num']-$v1['sell_num']);
                             if ($v1['sku_id'] > 0) {
                                 $code = Dever::db('card/code')->find($v1['sku_id']);
                                 $data[1]['children'][$k]['price'] += $code['total_cash'];