Browse Source

Merge branch 'master' of http://git.9026.com/swdz-WangHaijun/BaoMa

whj 4 years ago
parent
commit
8adecb6fe0

+ 2 - 2
app/Admin/Actions/backstage/User/service.php

xqd
@@ -7,12 +7,12 @@ use Illuminate\Database\Eloquent\Model;
 
 class service extends RowAction
 {
-    public $name = '服务包';
+    public $name = '服务包管理';
 
     public function handle(Model $model)
     {
         // $model ...
-        return $this->response()->success('跳转服务包库成功')->redirect('/admin/user_orders?patient_id='.$this->row->id.'&product_type=6');
+        return $this->response()->success('跳转服务包库成功')->redirect('/admin/user_order?user_id='.$this->row->id.'&product_type=6');
 
     }
 

+ 3 - 0
app/Admin/Controllers/CommunityNotice/CommunityNotices.php

xqd xqd xqd
@@ -3,6 +3,7 @@
 namespace App\Admin\Controllers\CommunityNotice;
 
 use App\Models\CommunityNotice;
+use App\Models\Organization;
 use Encore\Admin\Auth\Database\Administrator;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Facades\Admin;
@@ -28,6 +29,7 @@ class CommunityNotices extends AdminController
     {
         $grid = new Grid(new CommunityNotice());
         $grid->column('id', __('Id'))->sortable();
+        $grid->column('organization.name', __('发放社区'));
         $grid->column('title', __('标题'));
         $grid->column('type', __('类型'))->using([1=>'社区通告']);
         $grid->column('content', __('内容'))->limit(100,'...');
@@ -66,6 +68,7 @@ class CommunityNotices extends AdminController
     {
         $form = new Form(new CommunityNotice());
         $form->text('title', __('标题'));
+        $form->select('organization_id', __('发放的社区'))->options(Organization::all()->pluck('name','id'));
         $form->select('type', __('类型'))->options([1=>'社区端通告']);
         $form->editor('content', __('内容'));
         $form->submitted(function ($form){

+ 30 - 0
app/Admin/Controllers/CouponManagement/CouponManagementController.php

xqd
@@ -48,6 +48,36 @@ class CouponManagementController extends AdminController
         $grid->column('icon', __('券图标'))->image('',100,100);
         $grid->column('type', __('类型'))->using([1=>'满减券',2=>'折扣券']);
         $grid->column('usable_type', __('可用类型'))->using([1=>'全部产品通用',2=>'部分产品可用']);
+        $grid->column('CouponType', __('可用产品'))->pluck('product_type','id')->display(function ($i){
+            $name = [];
+            foreach ($i as $value)
+            {
+                switch ($value){
+                    case 1:
+                        array_push($name,'电话咨询');
+                        break;
+                    case 2:
+                        array_push($name,'图文咨询');
+                        break;
+                    case 3:
+                        array_push($name,'门诊咨询');
+                        break;
+                    case 4:
+                        array_push($name,'疫苗接种');
+                        break;
+                    case 5:
+                        array_push($name,'儿保预约');
+                        break;
+                    case 6:
+                        array_push($name,'服务包');
+                        break;
+                    case 7:
+                        array_push($name,'充值');
+                        break;
+                }
+            }
+            return $name;
+        })->label('info');
         $grid->column('money', __('满减券的优惠钱数'))->display(function ($money){
             return $money/100;
         });

+ 3 - 1
app/Admin/Controllers/UserManagement/BmUser/UserListController.php

xqd xqd
@@ -8,6 +8,7 @@ use App\Admin\Actions\backstage\User\BalanceLog;
 use App\Admin\Actions\backstage\User\BlackList;
 use App\Admin\Actions\backstage\User\coupons;
 use App\Admin\Actions\backstage\User\Orders;
+use App\Admin\Actions\backstage\User\service;
 use App\Models\Patient;
 use App\Models\User;
 use Encore\Admin\Controllers\AdminController;
@@ -40,11 +41,12 @@ class UserListController extends AdminController
         $actions->disableEdit();
         // 去掉查看
         $actions->disableView();
-        $actions->add(new archives());
+//        $actions->add(new archives());
         $actions->add(new BalanceLog());
         $actions->add(new BlackList());
         $actions->add(new coupons());
         $actions->add(new Orders());
+        $actions->add(new service());
     });
         //筛选
         $grid->filter(function ($filter){

+ 15 - 16
app/Admin/Controllers/UserManagement/BmUser/UserOrdersController.php

xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\UserManagement\BmUser;
 
+use App\Admin\Actions\backstage\Orders\ServicePack;
 use App\Models\Order;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
@@ -43,22 +44,20 @@ class UserOrdersController extends AdminController
             return date('Y-m-d H:i:s',$time);
         });
         $grid->column('product_type', __('产品类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约',6=>'服务包',7=>'充值']);
-        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付',3=>'服务包支付']);
-//        $grid->column('payment_type', __('支付方式'))->display(function ($payment_type){
-//            if ($payment_type == 1)
-//            {
-//                return '微信支付';
-//            }
-//            if ($payment_type == 2){
-//                return '余额支付';
-//            }
-//            if ($payment_type == 3){
-//////                dd($this);
-////                $patient_id = $this->patient_id;
-////                $orde_id = Order::where('patient_id',$patient_id)->where('product_type',6)->get('id');
-//                return '服务包支付';
-//            }
-//        });
+        $grid->column('payment_type', __('支付方式'))->display(function ($payment_type){
+            if ($payment_type == 1)
+            {
+                return '微信支付';
+            }
+            if ($payment_type == 2){
+                return '余额支付';
+            }
+            if ($payment_type == 3){
+                $name = ServicePack::where('id',$this->pay_order_pack_id)->pluck('name');
+                return '服务包支付('.$name[0].')';
+            }
+            return '';
+        });
         $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
         $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
         $grid->column('total_amount', __('订单总金额'))->display(function ($money){

+ 3 - 3
app/Admin/Controllers/UserManagement/BmUser/UserPatientsController.php

xqd xqd
@@ -19,7 +19,7 @@ class UserPatientsController extends AdminController
      *
      * @var string
      */
-    protected $title = '档案';
+    protected $title = '患者列表';
 
     /**
      * Make a grid builder.
@@ -43,14 +43,14 @@ class UserPatientsController extends AdminController
             // 去掉编辑
             $actions->disableEdit();
             //服务包
-            $actions->add(new service());
+//            $actions->add(new service());
 
         });
         $grid->column('id', __('档案id'));
         $grid->column('user_id', __('用户id'));
         $grid->column('name', __('患者姓名'));
         $grid->column('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女',]);
-        $grid->column('avatar', __('头像'))->image("",100,100);
+        $grid->column('avatar', __('头像'))->image("",'',50);
         $grid->column('age', __('年龄'));
         $grid->column('email', __('邮箱'));
         $grid->column('phone', __('联系电话'));

+ 2 - 2
app/Admin/Controllers/UserManagement/BmUser/UserServiceController.php

xqd xqd
@@ -18,7 +18,7 @@ class UserServiceController extends AdminController
      *
      * @var string
      */
-    protected $title = '服务包-保单';
+    protected $title = '服务包管理';
 
     /**
      * Make a grid builder.
@@ -32,7 +32,7 @@ class UserServiceController extends AdminController
         $uesr_id = \request('user_id');
         $grid->filter(function ($filter){
             $filter->disableIdFilter();
-            $filter->equal('patient_id','档案id');
+            $filter->equal('user_id','用户id');
             $filter->equal('product_type','订单类型');
         });
         $grid->actions(function ($actions) {

+ 2 - 2
app/Admin/routes.php

xqd
@@ -94,8 +94,8 @@ Route::group([
     $router->resource('users', UserManagement\BmUser\UserListController::class);
     //用户列表->查看患者档案
     $router->resource('user_patients', UserManagement\BmUser\UserPatientsController::class);
-    //查看患者档案->服务包
-    $router->resource('user_orders', UserManagement\BmUser\UserServiceController::class);
+    //用户列表->服务包管理
+    $router->resource('user_order', UserManagement\BmUser\UserServiceController::class);
     //用户列表->余额明细
     $router->resource('user_balance_logs', UserManagement\BmUser\UserBalanceLogController::class);
     //用户管理->优惠券管理

+ 3 - 0
app/Models/CommunityNotice.php

xqd
@@ -8,4 +8,7 @@ class CommunityNotice extends Model
 {
     //
     protected $table = 'community_notice';
+    public function organization(){
+        return $this->hasOne(Organization::class,'id','organization_id');
+    }
 }

+ 3 - 0
app/Models/Organization.php

xqd
@@ -36,4 +36,7 @@ class Organization extends BaseModel
     {
         return $this->hasOne(CdmsUsers::class,'org_id','id');
     }
+    public function communityNotice(){
+        return $this->hasOne(CommunityNotice::class,'organization_id','id');
+    }
 }