wupengfei 2 years ago
parent
commit
a6887a9ff0

+ 19 - 0
application/common/model/WashType.php

@@ -0,0 +1,19 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 洗涤类型
+class WashType extends Model
+{
+
+    // 获取分类
+    public static function getWashType($is_all,$is_column = 0)
+    {
+        $list =  static::field('id,title')->when($is_all,function ($q)use ($is_all){
+            if(!$is_all) $q->where('is_deleted',0)->where('status',1);
+        })->order('sort desc ,id desc')
+            ->select()->toArray();
+        return $is_column ? array_column($list,null,'id') : $list;
+    }
+
+
+}

+ 4 - 1
application/mall/controller/WashClothes.php

@@ -85,7 +85,10 @@ class WashClothes extends Controller
      */
     protected function _form_filter(&$data)
     {
-        if($this->request->isGet()) $this->all_cate = \app\common\model\WashCate::getAllCateByModule(input('module'),0);
+        if($this->request->isGet()){
+            $this->all_cate = \app\common\model\WashCate::getAllCateByModule(input('module'),0);
+            $this->wash_type = \app\common\model\WashType::getWashType(0);
+        }
         if($this->request->isPost() && $this->request->action() == 'edit')unset($data['module']);
     }
 

+ 13 - 0
application/mall/view/wash_clothes/form.html

@@ -24,6 +24,19 @@
                 </div>
             </div>
 
+
+
+            <div class="layui-form-item">
+                <label class="layui-form-label label-required">清洗类型</label>
+                <div class="layui-input-block">
+                    <select class="layui-select" name="wash_type">
+                        {foreach $wash_type as $v}
+                        <option value="{$v.id}" {if isset($vo.wash_type) && $vo.wash_type== $v.id}selected{/if}>{$v.title}</option>
+                        {/foreach}
+                    </select>
+                </div>
+            </div>
+
             <div class="layui-form-item">
                 <label class="layui-form-label label-required">封面</label>
                 <div class="layui-input-block">