Browse Source

藏品合成

xxxrrrdddd 2 years ago
parent
commit
032fcee8eb

+ 2 - 0
application/admin/controller/Goods.php

@@ -292,6 +292,7 @@ class Goods extends Backend
                 $this->validate($data=input('row/a'),[
                     'buy_type'=>['require','in:0,1,2'],
                     'buy_before_time|提前购买时间'=>['requireIf:buy_type,1'],
+                    'buy_before_user_limit|提前购买限制数量'=>['requireIf:buy_type,1','integer','egt:0'],
                 ]);
                 if($data['buy_type']!=0){
                     $this->validate($data,[
@@ -303,6 +304,7 @@ class Goods extends Backend
                 $this->error($e->getMessage());
             }
             $row['buy_type']=$data['buy_type'];
+            $row['buy_before_user_limit']=$data['buy_before_user_limit'];
             $row['buy_before_time']=$data['buy_before_time'];
             $row->save();
             $buy=$row->buy()->where('source_goods_id',$data['source_goods_id'])->find();

+ 8 - 1
application/admin/view/goods/buy.html

@@ -19,15 +19,22 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('提前购买限制数量')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input type="text" min="0" class="form-control" name="row[buy_before_user_limit]" value="{$row.buy_before_user_limit}"/>只有选择提前购买才生效
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('指定藏品')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input data-params='{"custom[is_del]":"0"}' readonly data-rule="" data-source="goods/index" class="form-control selectpage" name="row[source_goods_id]" type="text" value="{$row.buy[0]['source_goods_id']|default=''}">
+            只有选择空头才生效
         </div>
     </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('所需藏品数量')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input name="row[num]" class="form-control" value="{$row.buy.0.num|default=0}" type="number" data-rule="required;integer" min="0"/>
+            <input name="row[num]" class="form-control" value="{$row.buy.0.num|default=0}" type="number" data-rule="required;integer" min="0"/>只有选择空头才生效
         </div>
     </div>
     <div class="form-group layer-footer">

+ 2 - 2
extend/logicmodel/GoodsLogic.php

@@ -282,8 +282,8 @@ class GoodsLogic
         $where['g.is_show'] = 1;
         $where['g.id'] = $id;
         $field = ['g.*','gc.name goods_category_name','a.name author_name','a.image author_image','n.name network_name','gc.is_convert'];
-        $field[] = 'c.name as buy_goods_name';
-        $field[] = 'b.num as buy_need_num';
+        $field[] = 'c.name as buy_goods_name';//空头所需藏品
+        $field[] = 'b.num as buy_need_num';//空头所需藏品数量
 
         $goodsData =  new Goods();
         $data = $goodsData

+ 2 - 1
public/assets/js/backend/goods.js

@@ -103,7 +103,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 }
                                 a.push(`<div>开启方式:${open}</div>`)
                                 a.push(`<div>时间:${info.buy_before_time}</div>`)
-                                a.push(`<div>所需藏品:<div style="color: #00caff">${names.join('<br>')}</div></div>`)
+                                a.push(`<div>限购:${info.buy_before_user_limit||0}</div>`)
+                                a.push(`<div style="color: #00caff;">所需藏品:${names.join('')}</div>`)
                                 if(buyAuth) {
                                     a.push(`<div><a class="btn btn-success btn-sm btn-buy-set" data-id="${info.id}">设置</a></div>`)
                                 }