chuweiqiang 1 rok pred
rodič
commit
d278e62663

+ 1 - 1
application/admin/view/books/books/add.html

@@ -212,7 +212,7 @@
             <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number">
         </div>
     </div>
-    <div class="form-group">
+    <div class="form-group" id="entity_price">
         <label class="control-label col-xs-12 col-sm-2">{:__('Entity_price')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-entity_price" data-rule="required" class="form-control" step="0.01" name="row[entity_price]" type="number">

+ 7 - 1
application/admin/view/books/books/edit.html

@@ -215,12 +215,18 @@
             <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
         </div>
     </div>
-    <div class="form-group">
+
+    {if $row.book_type == '1'}
+    <div class="form-group" style="display: none">
+        {else}
+        <div class="form-group">
+    {/if}
         <label class="control-label col-xs-12 col-sm-2">{:__('Entity_price')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-entity_price" data-rule="required" class="form-control" step="0.01" name="row[entity_price]" type="number" value="{$row.entity_price|htmlentities}">
         </div>
     </div>
+
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 5 - 3
application/api/controller/Books.php

@@ -203,17 +203,19 @@ class Books extends Api
             ->field('id,title,image,book_type,is_new_recommend,author,is_awards,price,entity_price,createtime,updatetime,level_id,arrangement_id,speciality_id,series_id,is_series')
             ->select();
         $lists = $list;
+        $listss = [];
         if($this->auth->isLogin()) {
             $uid = $this->auth->id;
             foreach ($lists as $k => $v) {
                 $UserGoods = new UserGoods();
                 $good = $UserGoods->where('user_id', $uid)->where('goods_type', 0)->where('goods_id', $v['id'])->find();
-                if ($good) {
-                    unset($lists[$k]);
+                if (!$good) {
+                    $listss[] = $v;
+//                    unset($lists[$k]);
                 }
             }
         }
-        $this->success('操作成功',$lists);
+        $this->success('操作成功',$listss);
     }
 
     /**

+ 15 - 0
public/assets/js/backend/books/books.js

@@ -81,6 +81,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         },
         api: {
             bindevent: function () {
+                $(document).on("change", "#c-book_type", function(){
+                    //后续操作
+                    var type = $("#c-book_type").val();
+                    console.log(type);
+                    if(type == 0){
+                        $("#entity_price").show();
+                    }else{
+                        $("#entity_price").hide();
+                    }
+                    // "#c-jump_id"
+                    // $('#c-jump_id').selectPageClear();
+                    // $('#category_id').selectPageData("basesetting/paytype/selectpage");
+                    //$("#c-jump_id").data("selectPageObject").option.data = "basesetting/paytype/selectpage";
+                    return {custom: {type: $("#c-jump_type").val()}};
+                });
                 Form.api.bindevent($("form[role=form]"));
             }
         }