xieruidong 2 年之前
父節點
當前提交
886eb3c74d
共有 3 個文件被更改,包括 29 次插入5 次删除
  1. 20 0
      app/admin/controller/Merchant.php
  2. 7 3
      app/admin/view/merchant/form.html
  3. 2 2
      app/admin/view/merchant/index.html

+ 20 - 0
app/admin/controller/Merchant.php

@@ -33,4 +33,24 @@ class Merchant extends Controller
         $this->assign('row',$row);
         $this->fetch('form');
     }
+    /**
+     * 商家审核
+     * @auth true
+     * @menu true
+     */
+    public function audit($id){
+        $data=$this->_vali([
+            'audit.require'=>'结果必须',
+            'audit.in:2,3'=>'结果有误',
+            'why.requireIf:audit,3'=>'原因必须',
+        ]);
+        $row=DataMerchants::with(['user'])->find($id    );
+        if($row['audit']!=1){
+            $this->error('该信息已审核');
+        }
+        $row['audit']=$data['audit'];
+        $row['why']=$data['why'];
+        $row->save();
+        $this->success('审核成功');
+    }
 }

+ 7 - 3
app/admin/view/merchant/form.html

@@ -93,8 +93,12 @@
                     if(!v){
                         return
                     }
-                    $.ajax('{:sysuri()}',{
-                        data:form,
+                    $.ajax("{:url('audit')}",{
+                        data:{
+                            audit:form.audit,
+                            why:form.why,
+                            id:form.id,
+                        },
                         type:'post',
                         beforeSend(){
                             _this.saving=true
@@ -102,7 +106,7 @@
                         success({code,info}){
                             if(code){
                                 _this.$message.success('保存成功')
-                                window.history.back()
+                                $('[data-close]').trigger('click')
                             }else{
                                 _this.$message.error(info)
                             }

+ 2 - 2
app/admin/view/merchant/index.html

@@ -55,8 +55,8 @@
                     return d.name
                     }},
                 {field: 'full_address', title: '地址', align: 'left', minWidth: 140},
-                {field: 'contact_name', title: '联系人', align: 'center', minWidth: 80, style: 'color:blue;font-size:16px'},
-                {field: 'contact_phone', title: '联系电话', align: 'center', minWidth: 80, style: 'color:blue;font-size:16px'},
+                {field: 'contact_name', title: '联系人', align: 'center', minWidth: 80,},
+                {field: 'contact_phone', title: '联系电话', align: 'center', minWidth: 80,},
                 {field: 'status', title: '状态', align: 'center', minWidth: 110, templet(d){
                     return d.audit_text
                     }},