From 28f2056fb6809575223bbbf31418a570852ac3f0 Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Tue, 15 Apr 2025 18:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=AE=A2=E5=8D=95=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96=20=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=8F=90=E7=8E=B0=E5=90=8E=E5=8F=B0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=B4=A2=E5=8A=A1=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=90=8E=E5=8F=B0=E6=9F=A5=E8=AF=A2=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E6=B4=BB=E5=8A=A8=E5=90=8E=E5=8F=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BC=98=E5=8C=96=20=E7=94=A8=E6=88=B7=E5=8F=91?= =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=8D=95=E6=8E=A5=E5=8F=A3=20=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E4=BA=BA=E5=A4=84=E7=90=86=E5=94=AE=E5=90=8E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../school/activity/order/Order.php | 4 +- .../zh-cn/school/activity/order/order.php | 8 +- .../zh-cn/school/activity/order/order_log.php | 4 +- .../model/school/activity/order/Order.php | 19 +- .../model/school/activity/order/OrderLog.php | 2 +- .../view/school/activity/activity/index.html | 12 + .../school/activity/order/order/index.html | 30 ++ .../withdrawal/userwithdrawal_log/index.html | 11 + .../api/controller/school/NewActivity.php | 4 +- .../controller/school/newactivity/Order.php | 33 ++ .../school/newworker/activity/Order.php | 37 +++ application/common/hooks.php | 12 + .../common/listener/activity/OrderHook.php | 186 +++++++++++ .../model/school/activity/order/Order.php | 299 +++++++++++++++++- .../model/school/activity/order/OrderCode.php | 9 +- .../model/school/activity/order/OrderLog.php | 2 +- .../model/school/activity/order/SettleLog.php | 3 +- .../js/backend/school/activity/activity.js | 44 +++ .../js/backend/school/activity/order/order.js | 126 +++++++- .../user/withdrawal/userwithdrawal_log.js | 43 +++ 20 files changed, 869 insertions(+), 19 deletions(-) diff --git a/application/admin/controller/school/activity/order/Order.php b/application/admin/controller/school/activity/order/Order.php index 31e998d..94f167b 100644 --- a/application/admin/controller/school/activity/order/Order.php +++ b/application/admin/controller/school/activity/order/Order.php @@ -27,6 +27,8 @@ class Order extends Backend $this->view->assign("beforeStatusList", $this->model->getBeforeStatusList()); $this->view->assign("serverStatusList", $this->model->getServerStatusList()); $this->view->assign("authStatusList", $this->model->getAuthStatusList()); + $this->view->assign("suspendStatusList", $this->model->getSuspendStatusList()); + } @@ -68,7 +70,7 @@ class Order extends Backend $row->getRelation('user')->visible(['nickname','realname','mobile','avatar']); $row->getRelation('activity')->visible(['title','images']); - $row->getRelation('detail')->visible(['title']); + $row->getRelation('detail')->visible(['title',"feel"]); } $result = array("total" => $list->total(), "rows" => $list->items()); diff --git a/application/admin/lang/zh-cn/school/activity/order/order.php b/application/admin/lang/zh-cn/school/activity/order/order.php index 3acbc9b..51a3311 100644 --- a/application/admin/lang/zh-cn/school/activity/order/order.php +++ b/application/admin/lang/zh-cn/school/activity/order/order.php @@ -27,6 +27,8 @@ return [ 'Set status to 5' => '设为退款结算中', 'Status 6' => '已退款', 'Set status to 6' => '设为已退款', + 'Status 7' => '售后挂起', + 'Set status to 7' => '设为售后挂起', 'Status 9' => '已完成', 'Set status to 9' => '设为已完成', 'Before_status' => '售后前状态', @@ -73,5 +75,9 @@ return [ 'Activity.title' => '活动标题', 'Activity.images' => '活动轮播图', 'Detail.title' => '活动标题', - 'Edit' => '详情' + 'Edit' => '详情', + 'Suspend_status' => '挂起原因', + 'Suspend_status 0' => '未挂起', + 'Suspend_status 1' => '售后拒绝', + 'Suspend_status 2' => '售后超时', ]; diff --git a/application/admin/lang/zh-cn/school/activity/order/order_log.php b/application/admin/lang/zh-cn/school/activity/order/order_log.php index 3c80489..2baf6d8 100644 --- a/application/admin/lang/zh-cn/school/activity/order/order_log.php +++ b/application/admin/lang/zh-cn/school/activity/order/order_log.php @@ -27,5 +27,7 @@ return [ 'Deletetime' => '删除时间', 'Order.order_no' => '订单号', 'User.nickname' => '昵称', - 'User.avatar' => '头像' + 'User.avatar' => '头像', + 'Status 7' => '售后挂起', + 'Set status to 7' => '设为售后挂起', ]; diff --git a/application/admin/model/school/activity/order/Order.php b/application/admin/model/school/activity/order/Order.php index bbac747..78336c2 100644 --- a/application/admin/model/school/activity/order/Order.php +++ b/application/admin/model/school/activity/order/Order.php @@ -30,6 +30,7 @@ class Order extends Model 'status_text', 'before_status_text', 'server_status_text', + 'suspend_status_text', 'canceltime_text', 'paytime_text', 'auth_time_text', @@ -49,9 +50,25 @@ class Order extends Model public function getStatusList() { - return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'), '9' => __('Status 9')]; + return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'), '7' => __('Status 7'), '9' => __('Status 9')]; } + + public function getSuspendStatusList() + { + return ['0' => __('未挂起'), '1' => __('售后拒绝'), '2' => __('售后超时')]; + } + + + public function getSuspendStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['suspend_status']) ? $data['suspend_status'] : ''); + $list = $this->getSuspendStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getBeforeStatusList() { return ['-3' => __('Before_status -3'), '0' => __('Before_status 0'), '2' => __('Before_status 2'), '3' => __('Before_status 3'), '4' => __('Before_status 4'), '6' => __('Before_status 6'), '9' => __('Before_status 9')]; diff --git a/application/admin/model/school/activity/order/OrderLog.php b/application/admin/model/school/activity/order/OrderLog.php index 2b2be4d..c06701d 100644 --- a/application/admin/model/school/activity/order/OrderLog.php +++ b/application/admin/model/school/activity/order/OrderLog.php @@ -32,7 +32,7 @@ class OrderLog extends Model public function getStatusList() { - return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'), '9' => __('Status 9')]; + return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'),'7' => __('Status 7'), '9' => __('Status 9')]; } diff --git a/application/admin/view/school/activity/activity/index.html b/application/admin/view/school/activity/activity/index.html index 5ab4123..2cefc28 100644 --- a/application/admin/view/school/activity/activity/index.html +++ b/application/admin/view/school/activity/activity/index.html @@ -2,12 +2,24 @@
{:build_heading(null,FALSE)} + + + + + + +
diff --git a/application/admin/view/school/activity/order/order/index.html b/application/admin/view/school/activity/order/order/index.html index e06839a..dd6e997 100644 --- a/application/admin/view/school/activity/order/order/index.html +++ b/application/admin/view/school/activity/order/order/index.html @@ -2,12 +2,42 @@
{:build_heading(null,FALSE)} + + + + + + + + + + + + + + +
diff --git a/application/admin/view/user/withdrawal/userwithdrawal_log/index.html b/application/admin/view/user/withdrawal/userwithdrawal_log/index.html index 0be9851..342fdb9 100644 --- a/application/admin/view/user/withdrawal/userwithdrawal_log/index.html +++ b/application/admin/view/user/withdrawal/userwithdrawal_log/index.html @@ -8,6 +8,17 @@
  • {$vo}
  • {/foreach} + + + + + + diff --git a/application/api/controller/school/NewActivity.php b/application/api/controller/school/NewActivity.php index 2c79831..b357faa 100644 --- a/application/api/controller/school/NewActivity.php +++ b/application/api/controller/school/NewActivity.php @@ -85,7 +85,7 @@ class NewActivity extends Base * @ApiParams(name = "sign_start_time", type = "int",required=false,description = "报名开始时间10位秒级时间戳") * @ApiParams(name = "sign_end_time", type = "int",required=false,description = "报名结束时间10位秒级时间戳") * @ApiParams(name = "auth_status", type = "int",required=false,description = "审核状态:0=待审核,1=审核通过,2=审核不通过 ,不传查所有,可按多值逗号拼接") - * @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索") + * @ApiParams(name = "cate_ids", type = "string",required=false,description = "平台分类ids 多值逗号拼接") * @ApiParams(name = "province", type = "string",required=false,description = "省编号") * @ApiParams(name = "city", type = "string",required=false,description = "市编号") * @ApiParams(name = "district", type = "string",required=false,description = "县区编号") @@ -118,7 +118,7 @@ class NewActivity extends Base $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字 $params["shop_id"] = $this->request->get('shop_id/d', ''); //机构店铺id - $params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id + $params["cate_ids"] = $this->request->get('cate_ids/s', ''); //机构店铺id $params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id $params["province"] = $this->request->get('province/s', ''); //机构店铺id diff --git a/application/api/controller/school/newactivity/Order.php b/application/api/controller/school/newactivity/Order.php index ebd71a6..c3c9c49 100644 --- a/application/api/controller/school/newactivity/Order.php +++ b/application/api/controller/school/newactivity/Order.php @@ -264,6 +264,39 @@ class Order extends Base + /** + * @ApiTitle( 订单申请售后接口 ) + * @ApiSummary(订单申请售后) + * @ApiMethod(POST) + * @ApiParams(name = "order_no", type = "string",required=true,description = "需要售后的订单号") + * @ApiParams(name = "auth_reason", type = "string",required=true,description = "申请理由") + * @ApiParams(name = "num", type = "int",required=true,description = "退票数") + * @ApiReturn({ + * + *}) + */ + public function after_sales(){ + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $classes_order = $this->request->post('order_no/s', 0); //课程id + $auth_reason = $this->request->post('auth_reason/s', ''); //订单号 + $num = $this->request->post('num/d', ''); //订单号 + try{ + //当前申请状态 + $res = $this->model->afterSales($classes_order,$num,$auth_reason,$user_id ,true,'user',$user_id,true); + + + }catch (\Exception $e){ +// Log::log($e->getMessage()); + $this->error($e->getMessage(),['errcode'=>$e->getCode()]); + } + $this->success('申请售后成功', $res); + } + + + + diff --git a/application/api/controller/school/newworker/activity/Order.php b/application/api/controller/school/newworker/activity/Order.php index 08be50a..1cf7586 100644 --- a/application/api/controller/school/newworker/activity/Order.php +++ b/application/api/controller/school/newworker/activity/Order.php @@ -162,4 +162,41 @@ class Order extends Base + + + /** + * @ApiTitle( 处理售后接口) + * @ApiSummary(处理售后接口) + * @ApiMethod(POST) + * @ApiParams(name = "order_no", type = "string",required=true,description = "售后订单id或售后订号") + * @ApiParams(name = "status", type = "string",required=true,description = "yes=同意,no=驳回") + * @ApiParams(name = "price", type = "string",required=false,description = "同意的售后金额") + * @ApiParams(name = "reject_reason", type = "string",required=false,description = "驳回原因") + * @ApiReturn({ + * + *}) + */ + public function shop_confirmation(){ + $this->model = new OrderModel; + //判断登录用户是否是员工 + $this->setUrlLock(); + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $order_no = $this->request->post('order_no/s', ''); //订单号 + $status = $this->request->post('status/s', 0); //审核状态 + $price = $this->request->post('price/f', 0); + $reject_reason = $this->request->post('reject_reason/s', ''); + + try{ + //当前申请状态 + $res = $this->model->shopConfirmation($order_no,$status,$price,$reject_reason,0,true,'user',$user_id,true); + }catch (\Throwable $e){ + $this->error($e->getMessage()); + } + $this->success('调用成功', $res); + } + + + } \ No newline at end of file diff --git a/application/common/hooks.php b/application/common/hooks.php index fd830ee..56d4157 100644 --- a/application/common/hooks.php +++ b/application/common/hooks.php @@ -312,6 +312,18 @@ $newactivityOrderHooks = [ 'app\\common\\listener\\activity\\OrderHook' ], + 'activity_order_after_sales_after' => [ // 订单申请售后 + 'app\\common\\listener\\activity\\OrderHook' + ], + + 'activity_order_shop_confirm_after' => [ // 订单售后同意 + 'app\\common\\listener\\activity\\OrderHook' + ], + + 'activity_order_shop_reject_after' => [ // 订单售后拒绝 + 'app\\common\\listener\\activity\\OrderHook' + ], + ]; diff --git a/application/common/listener/activity/OrderHook.php b/application/common/listener/activity/OrderHook.php index c957025..704ce36 100644 --- a/application/common/listener/activity/OrderHook.php +++ b/application/common/listener/activity/OrderHook.php @@ -48,6 +48,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -104,6 +105,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -167,6 +169,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -225,6 +228,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -288,6 +292,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -341,6 +346,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -407,6 +413,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -462,6 +469,7 @@ class OrderHook "real_refundprice" => $order["real_refundprice"], "sub_refundprice" => $order["sub_refundprice"], "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], "address"=>$detail["address"]."(".$detail["address_detail"].")", "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 "end_time" => date("Y-m-d H:i",$detail["end_time"]), @@ -498,6 +506,184 @@ class OrderHook + // 订单申请售后成功 + public function activityOrderAfterSalesAfter(&$params) + { + ["order"=>$order] = $params; + + $order = Order::where("id" , $order["id"])->find(); + + $detail = $order->detail; + $user = $order->user; + //记录订单日志 + $mini_type = "activity_order"; + $to_id = $order["user_id"]; + $status ="activity"; + $params=[ + "event"=>"activity_order_after_sales_after", + "order_id"=>$order["id"], + "order_no"=>$order["order_no"], + "activity_id"=>$order["activity_id"], + "title"=>$detail["title"], + "images"=>$detail["images"], + ]; + $param = [ + "title"=>$detail["title"], + "order_no" => $order["order_no"], + "nickname" => $user["nickname"], + "realname" => $user["realname"], + "mobile" => $user["mobile"], + "price" => $order["totalprice"], + "payprice" => $order["payprice"], + "real_refundprice" => $order["real_refundprice"], + "sub_refundprice" => $order["sub_refundprice"], + "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], + "address"=>$detail["address"]."(".$detail["address_detail"].")", + "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "end_time" => date("Y-m-d H:i",$detail["end_time"]), + "sign_start_time" => date("Y-m-d H:i",$detail["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "sign_end_time" => date("Y-m-d H:i",$detail["sign_end_time"]), + ]; + + //发用户 + (new MessageConfig) + ->setTemplate($params["event"]."_user") + ->setTemplateData($param) + ->setToUid($to_id) + ->setMessageStatus($status) + ->setMessageMiniType($mini_type) + ->setMessageParams($params) + ->sendMessage(); + //发所有核销员 + (new MessageConfig) + ->setTemplate($params["event"]."_verification") + ->setTemplateData($param) + ->setToUid($detail["user_id"]) + ->setMessageStatus($status) + ->setMessageMiniType($mini_type) + ->setMessageParams($params) + ->sendMessage(); + + + } + + + + + + // 订单售后同意 + public function activityOrderShopConfirmAfter(&$params) + { + ["order"=>$order] = $params; + + $order = Order::where("id" , $order["id"])->find(); + + $detail = $order->detail; + $user = $order->user; + //记录订单日志 + $mini_type = "activity_order"; + $to_id = $order["user_id"]; + $status ="activity"; + $params=[ + "event"=>"activity_order_after_sales_after", + "order_id"=>$order["id"], + "order_no"=>$order["order_no"], + "activity_id"=>$order["activity_id"], + "title"=>$detail["title"], + "images"=>$detail["images"], + ]; + $param = [ + "title"=>$detail["title"], + "order_no" => $order["order_no"], + "nickname" => $user["nickname"], + "realname" => $user["realname"], + "mobile" => $user["mobile"], + "price" => $order["totalprice"], + "payprice" => $order["payprice"], + "real_refundprice" => $order["real_refundprice"], + "sub_refundprice" => $order["sub_refundprice"], + "first_refundprice" => $order["first_refundprice"], + "total_refundprice" => $order["total_refundprice"], + "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], + "address"=>$detail["address"]."(".$detail["address_detail"].")", + "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "end_time" => date("Y-m-d H:i",$detail["end_time"]), + "sign_start_time" => date("Y-m-d H:i",$detail["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "sign_end_time" => date("Y-m-d H:i",$detail["sign_end_time"]), + ]; + + //发用户 + (new MessageConfig) + ->setTemplate($params["event"]) + ->setTemplateData($param) + ->setToUid($to_id) + ->setMessageStatus($status) + ->setMessageMiniType($mini_type) + ->setMessageParams($params) + ->sendMessage(); + + } + + + + + + // 订单售后拒绝 + public function activityOrderShopRejectAfter(&$params) + { + ["order"=>$order] = $params; + + $order = Order::where("id" , $order["id"])->find(); + + $detail = $order->detail; + $user = $order->user; + //记录订单日志 + $mini_type = "activity_order"; + $to_id = $order["user_id"]; + $status ="activity"; + $params=[ + "event"=>"activity_order_after_sales_after", + "order_id"=>$order["id"], + "order_no"=>$order["order_no"], + "activity_id"=>$order["activity_id"], + "title"=>$detail["title"], + "images"=>$detail["images"], + ]; + $param = [ + "title"=>$detail["title"], + "order_no" => $order["order_no"], + "nickname" => $user["nickname"], + "realname" => $user["realname"], + "mobile" => $user["mobile"], + "price" => $order["totalprice"], + "payprice" => $order["payprice"], + "real_refundprice" => $order["real_refundprice"], + "sub_refundprice" => $order["sub_refundprice"], + "total_refundprice" => $order["total_refundprice"], + "reason" => $order["reason"], + "auth_reason" => $order["auth_reason"], + "address"=>$detail["address"]."(".$detail["address_detail"].")", + "start_time" => date("Y-m-d H:i",$detail["start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "end_time" => date("Y-m-d H:i",$detail["end_time"]), + "sign_start_time" => date("Y-m-d H:i",$detail["sign_start_time"]), //格式化日期格式 $order["start_time"], //格式化日期格式 + "sign_end_time" => date("Y-m-d H:i",$detail["sign_end_time"]), + ]; + + //发用户 + (new MessageConfig) + ->setTemplate($params["event"]) + ->setTemplateData($param) + ->setToUid($to_id) + ->setMessageStatus($status) + ->setMessageMiniType($mini_type) + ->setMessageParams($params) + ->sendMessage(); + + } + + diff --git a/application/common/model/school/activity/order/Order.php b/application/common/model/school/activity/order/Order.php index 4b572f6..b7206fe 100644 --- a/application/common/model/school/activity/order/Order.php +++ b/application/common/model/school/activity/order/Order.php @@ -3,6 +3,8 @@ namespace app\common\model\school\activity\order; use addons\epay\library\Service; +use app\admin\model\Admin; +use app\admin\model\Manystore; use app\common\model\BaseModel; use app\common\model\school\activity\Activity; use app\common\model\school\activity\Refund; @@ -39,6 +41,7 @@ class Order extends BaseModel 'status_text', 'before_status_text', 'server_status_text', + 'suspend_status_text', 'canceltime_text', 'paytime_text', 'auth_time_text', @@ -58,9 +61,26 @@ class Order extends BaseModel public function getStatusList() { - return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'), '9' => __('Status 9')]; + return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'),'7' => __('Status 7'), '9' => __('Status 9')]; } + + + public function getSuspendStatusList() + { + return ['0' => __('未挂起'), '1' => __('售后拒绝'), '2' => __('售后超时')]; + } + + + public function getSuspendStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['suspend_status']) ? $data['suspend_status'] : ''); + $list = $this->getSuspendStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getBeforeStatusList() { return ['-3' => __('Before_status -3'), '0' => __('Before_status 0'), '2' => __('Before_status 2'), '3' => __('Before_status 3'), '4' => __('Before_status 4'), '6' => __('Before_status 6'), '9' => __('Before_status 9')]; @@ -622,6 +642,7 @@ class Order extends BaseModel $order_data["payprice"] = 0; $order_data["status"] = '0'; $order_data["settle_log_time"] = $activity_info["settlement_time"]; + $order_data["last_time"] = $activity_info["end_time"] + config("site.activity_end_sales"); //根据手续费比例$activity_info["fee_scale"] 计算手续费 $order_data["fee_price"] = bcmul($order_data["totalprice"],$order_data["fee_scale"],2); //手续费保底不能低于site.activity_settle_min_fee @@ -1098,7 +1119,7 @@ class Order extends BaseModel * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ - public static function checkOptionAuth($classes_order_id,$oper_id,$oper_type,$only_user=false,$only_shop=false,$only_admin=false){ + public static function checkOptionAuth($classes_order_id,$oper_id,$oper_type,$only_user=false,$only_shop=false,$only_admin=false,$only_shop_user=false){ //课程是否存在并上架 $classesOrder = Order::where("id",$classes_order_id)->find(); @@ -1112,6 +1133,7 @@ class Order extends BaseModel if($oper_id != $classesOrder["user_id"]){ if($only_user) throw new \Exception("您无权操作该订单!"); + //说明是操作员 $help_user_info = User::where('id',$oper_id)->find(); if(!$help_user_info) throw new \Exception("代下单员工不存在!"); @@ -1119,6 +1141,8 @@ class Order extends BaseModel //判断当前订单课程是否在此课程授权范围内 if(!in_array($classesOrder["activity_id"],$classes_activity_ids)) throw new \Exception("该活动不在您的授权范围内,无法代操作!"); }else{ + if($only_shop_user) throw new \Exception("您无权操作该订单!"); + $classes_activity_ids = (new Activity())->getActivityAuthIds($oper_id); //不是员工并且想操作只有机构能操作的单 if(!in_array($classesOrder["activity_id"],$classes_activity_ids) && $only_shop)throw new \Exception("您无权操作该订单!"); @@ -1801,6 +1825,24 @@ class Order extends BaseModel $order->refundtime = time(); $order->refund_json = json_encode($pay_json); $order->save(); + + + //若存在剩余金额,结算给发布者 + if($order->sub_refundprice > $order->fee_scale){ + //报废旧的结算单 + SettleLog::where("activity_order_id",$order['id']) + ->where("status" ,"in",["1","2"]) + ->update([ + "status"=>"-1", + "canceltime" => time() + ]); + //插入新结算单 + (new SettleLog)->generatorLog($order['id']); + } + + + + return $order; } @@ -1901,25 +1943,63 @@ class Order extends BaseModel * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ - public static function getHaveAfterSalesOrder($refund_sn){ + public static function getHaveAfterSalesOrder($refund_sn,$check=true){ // $where = [self::STATUS_NOPAY,self::STATUS_PAYED]; - $order = self::where('refund_no|order_no|id',$refund_sn)->where('status','5')->where("sub_refundprice",">",0)->find(); + $order = self::where('refund_no|order_no|id',$refund_sn)->where('status',"in",["2","3","9"])->where("sub_refundprice",">",0)->find(); if(!$order)throw new \Exception("不是可直接退款的订单!"); + $detail = $order->detail; + if(!$detail)throw new \Exception("找不到订单详情!"); + if($check){ + if(!in_array($order['status'],["2","3","9"])) throw new \Exception("不是可申请售后的订单!"); + //申请售后必须是活动结束后n秒内 + $last_time = $detail['end_time'] + config('site.activity_end_sales'); + if(time() > $last_time) throw new \Exception("已超过发起售后的最后期限!"); + + } return $order; } + public function updateAfterSales($order,$total_refundprice,$auth_reason,$check=true){ + if(is_numeric($order))$order = self::getHaveAfterSalesOrder($order,$check); + $order["before_status"] = $order["status"]; + $order["status"] = "4"; + $order["server_status"] = "3"; + $order["auth_time"] = time(); + $order["auth_status"] = 0; + $order["auth_reason"] = $auth_reason; + $order["total_refundprice"] = $total_refundprice; + $order["first_refundprice"] = $total_refundprice; + $order->save(); + } + + /** 发起售后 * @param $order_no + * @param $user_id * @param $trans * @return true * @throws \Exception */ - public function afterSales($order,$trans=false){ - if(is_numeric($order))$order = self::getHaveAfterSalesOrder($order); + public function afterSales($order,$num,$auth_reason,$user_id ,$check=true,$oper_type='user',$oper_id=0,$trans=false){ + if(is_numeric($order))$order = self::getHaveAfterSalesOrder($order,$check); if(!$order)throw new \Exception("找不到订单"); - // + if($check){ + //用户操作权限检测 + self::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type); + + } + $detail = $order->detail; + if(!$detail)throw new \Exception("找不到订单详情!"); + if(!$auth_reason) throw new \Exception("请填写申请原因"); + + + //$num至少要1,至多要订单数量 + if($num < 1 || $num > $order['num']) throw new \Exception("数量错误"); + $total_refundprice = bcmul($detail['price'],$num,2); + + if($total_refundprice < 0.01 || $total_refundprice > $order['sub_refundprice']) throw new \Exception("退款金额错误"); //判断逻辑 if($trans){ @@ -1927,6 +2007,17 @@ class Order extends BaseModel } $res = true; try{ + //设置订单申请状态 + $this->updateAfterSales($order,$total_refundprice,$auth_reason,$check); + + //订单日志 + OrderLog::log($order['id'],"活动订单申请售后:".$auth_reason, $oper_type, $oper_id); + + //调用订单取消事件 + $data = ['order' => self::where("id",$order['id'])->find(),"user_id"=>$order['user_id'],"oper_type"=>$oper_type,"oper_id"=>$oper_id]; + \think\Hook::listen('activity_order_after_sales_after', $data); + + if($trans){ self::commitTrans(); @@ -1944,6 +2035,200 @@ class Order extends BaseModel + public static function getHaveShopConfirmationOrder($refund_sn,$check=true){ +// $where = [self::STATUS_NOPAY,self::STATUS_PAYED]; + $order = self::where('refund_no|order_no|id',$refund_sn)->where('status',"in",["4","7"])->where("sub_refundprice",">",0)->find(); + if(!$order)throw new \Exception("不是可直接退款的订单!"); + $detail = $order->detail; + if(!$detail)throw new \Exception("找不到订单详情!"); + if($check){ + + } + + return $order; + } + + + + + + /**机构同意并确认价格 + * @param $order + * @return array|false|\PDOStatement|string|Model + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public static function updateShopConfirmationOrder($order,$price){ + if(is_string($order))$order = self::getHaveShopConfirmationOrder($order); + $order->status = "5";//refund_status + $order->service_stauts = "6"; + $order->auth_status = 1; + $order->total_refundprice = $price; + $order->refundtime = time(); + $order->save(); + return $order; + } + + + + /**机构拒绝售后 + * @param $order + * @return array|false|\PDOStatement|string|Model + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public static function updateShopConfirmationFailOrder($order,$reason){ + if(is_string($order))$order = self::getHaveShopConfirmationOrder($order); + $order->status = "7";//refund_status + $order->service_stauts = "6"; + $order->auth_status = 2; + $order->reason = $reason; + $order->suspend_status = '1'; + $order->save(); + return $order; + } + + + + + /**发布者售后提交确认信息 + * @param $order_no + * @param int $user_id + * @param string $status yes同意 no拒绝 + *@param string $price 商定价格 + *@param string $reject_reason 拒绝原因 + * @param bool $check + * @param bool $trans + * @return bool + * @throws \Exception + */ + public function shopConfirmation($order_no,$status,$price,$reject_reason,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){ + + //得到机构售后提交确认订单 + $order = self::getHaveShopConfirmationOrder($order_no); + if($check){ + //用户操作权限检测 + Order::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type,false,true); + } + $classesorder = $order; + if(!$classesorder)throw new \Exception("订单不存在!"); + + switch ($status){ + case 'yes': + //同意 + //验证价格正确性 + //金额必须小于等于剩余未退全额 + $price = floatval($price); + if($price > $classesorder['sub_refundprice']){ + throw new \Exception("价格必须小于等于剩余应退全额!"); + } + //数据修正大于剩余未退全额 则等于剩余未退 + $price = $price > $classesorder['sub_refundprice'] ? $classesorder['sub_refundprice'] : $price; + if($price<=0)throw new \Exception("同意退款必须大于0!"); + + //如果非全额退款,剩余金额必须大于订单支付时的手续费 + if($price < $classesorder['sub_refundprice']){ + $sub_price = bcsub($classesorder['sub_refundprice'] , $price,2); + if($sub_price <= $classesorder['fee_price']){ + throw new \Exception("如果未退全款,剩余未退金额必须大于订单支付时的手续费{$classesorder['fee_price']}!"); + } + } + + break; + case 'no': + //拒绝 + //拒绝原因必填 + if(!$reject_reason)throw new \Exception("拒绝原因必填!"); + + + + break; + default: + throw new \Exception("参数错误!"); + } + + + //判断逻辑 + if($trans){ + self::beginTrans(); + } + $res = true; + try{ + //事务逻辑 + //更新售后为取消状态 + switch ($status){ + case 'yes': + //同意 + + //更新订单状态为同意 + $order = self::updateShopConfirmationOrder($order,$price); + + //插入订单日志 + if(!$user_id ||$order["user_id"] !=$user_id ){ + OrderLog::log($order['id'],"[系统操作]活动订单售后已处理,用户发起金额为{$order['first_refundprice']},确认退款金额为{$price}元,等待退款到账",$oper_type ?: 'user', $oper_id ?: $order['user_id']); + }else{ + OrderLog::log($order['id'],"活动订单售后已处理,用户发起金额为{$order['first_refundprice']},确认退款金额为{$price}元,等待退款到账",$oper_type ?: 'user', $oper_id ?: $order['user_id']); + } + + //调用订单事件 + $data = ['order' => self::where("id",$order['id'])->find(),"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id]; + \think\Hook::listen('activity_order_shop_confirm_after', $data); + + + //执行退款 + //执行退款 + self::orderRefund($order['order_no'],$price,$oper_type,$oper_id); + + + + + + break; + case 'no': + //拒绝 + + //更新 + //更新售后为机构驳回结单状态 + $order = self::updateShopConfirmationFailOrder($order,$reject_reason); + + //插入订单日志 + if(!$user_id ||$order["user_id"] !=$user_id ){ + $order::log($order['id'],"[系统操作]活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']); + }else{ + $order::log($order['id'],"活动订单售后驳回,订单挂起,等待官方处理",$oper_type ?: 'user', $oper_id ?: $order['user_id']); + } + + //调用订单取消事件 + $data = ['order' => self::where("id",$order['id'])->find(),"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id]; + \think\Hook::listen('activity_order_shop_reject_after', $data); + + + break; + default: + throw new \Exception("参数错误!"); + } + //执行课时数更新 + $res1 = order::statisticsAndUpdateClassesNumber($order['classes_order_id']); + + + if($trans){ + self::commitTrans(); + } + }catch (\Exception $e){ + if($trans){ + self::rollbackTrans(); + } + throw new \Exception($e->getMessage()); + } + return $res1; + } + + + + + } diff --git a/application/common/model/school/activity/order/OrderCode.php b/application/common/model/school/activity/order/OrderCode.php index 7cddcff..b0165f2 100644 --- a/application/common/model/school/activity/order/OrderCode.php +++ b/application/common/model/school/activity/order/OrderCode.php @@ -180,10 +180,15 @@ class OrderCode extends BaseModel //得到可取消订单 $ordercode = self::getHaveVerificationOrderCode($code,$check); $order = $ordercode->order; + if(!$order) throw new \Exception("订单异常!"); + $detail = $order->detail; + if(!$detail) throw new \Exception("订单异常!"); if($check){ //用户操作权限检测 - Order::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type); - + Order::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type,false,true); + if($detail["user_id"] != $user_id){ + throw new \Exception("当前用户不是核销员!"); + } } //判断逻辑 diff --git a/application/common/model/school/activity/order/OrderLog.php b/application/common/model/school/activity/order/OrderLog.php index c0ccb4b..a863988 100644 --- a/application/common/model/school/activity/order/OrderLog.php +++ b/application/common/model/school/activity/order/OrderLog.php @@ -34,7 +34,7 @@ class OrderLog extends BaseModel public function getStatusList() { - return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'), '9' => __('Status 9')]; + return ['-3' => __('Status -3'), '0' => __('Status 0'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4'), '5' => __('Status 5'), '6' => __('Status 6'),'7' => __('Status 7'), '9' => __('Status 9')]; } diff --git a/application/common/model/school/activity/order/SettleLog.php b/application/common/model/school/activity/order/SettleLog.php index be8dca7..7e684b4 100644 --- a/application/common/model/school/activity/order/SettleLog.php +++ b/application/common/model/school/activity/order/SettleLog.php @@ -143,7 +143,7 @@ class SettleLog extends BaseModel foreach ($orders as $order){ //剩余金额大于手续费的订单,并且未插入此结算单的 $sub_refundprice = bcsub($order["sub_refundprice"],$order["fee_price"],2); - if($sub_refundprice > 0){ + if($sub_refundprice >= 0.01){ $log = self::where("activity_order_id",$order["id"])->where("status","not in",["-1"])->find(); if(!$log){ (new self)->generatorLog($order["id"]); @@ -237,6 +237,7 @@ class SettleLog extends BaseModel "activity_id" => $order->activity_id, "activity_order_detail_id" => $detail->id, ]; + if($data["settle_price"] < 0.01) return false; //判断逻辑 if($trans){ self::beginTrans(); diff --git a/public/assets/js/backend/school/activity/activity.js b/public/assets/js/backend/school/activity/activity.js index 5b58e44..473eb6a 100644 --- a/public/assets/js/backend/school/activity/activity.js +++ b/public/assets/js/backend/school/activity/activity.js @@ -140,6 +140,50 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde // 为表格绑定事件 Table.api.bindevent(table); + + + + + //自定义Tab筛选条件 + $('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { + var value = $(this).data("value"); + var options = table.bootstrapTable('getOptions'); + var queryParams = options.queryParams; + options.pageNumber = 1; + options.queryParams = function (params) { + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 + params = queryParams(params); + + //如果希望追加搜索条件,可使用 + var filter = params.filter ? JSON.parse(params.filter) : {}; + var op = params.op ? JSON.parse(params.op) : {}; + if (value!=="") { + //这里可以自定义多个筛选条件 + filter.auth_status = value; + op.auth_status = '='; + }else{ + //console.log("111111111111111111"); + //选全部时要移除相应的条件 + delete filter.auth_status; + delete op.auth_status; + } + + params.filter = JSON.stringify(filter); + params.op = JSON.stringify(op); + + //如果希望忽略搜索栏搜索条件,可使用 + //params.filter = JSON.stringify(value?{admin_id: value}:{}); + //params.op = JSON.stringify(value?{admin_id: '='}:{}); + return params; + }; + + table.trigger("uncheckbox"); + table.bootstrapTable('refresh', {pageNumber: 1}); + return false; + }); + + + }, recyclebin: function () { // 初始化表格参数配置 diff --git a/public/assets/js/backend/school/activity/order/order.js b/public/assets/js/backend/school/activity/order/order.js index 7de4400..c919bba 100644 --- a/public/assets/js/backend/school/activity/order/order.js +++ b/public/assets/js/backend/school/activity/order/order.js @@ -37,7 +37,7 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde {field: 'activity.title', title: __('Activity.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'activity.images', title: __('Activity.images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, - {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"0":__('Status 0'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"6":__('Status 6'),"9":__('Status 9')}, formatter: Table.api.formatter.status}, + {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"0":__('Status 0'),"2":__('Status 2'),"3":__('Status 3'),"4":__('Status 4'),"5":__('Status 5'),"6":__('Status 6'),"7":__('Status 7'),"9":__('Status 9')}, formatter: Table.api.formatter.status}, {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, @@ -58,6 +58,9 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde {field: 'pay_type', title: __('Pay_type'), searchList: {"yue":__('Pay_type yue'),"wechat":__('Pay_type wechat')}, formatter: Table.api.formatter.normal}, {field: 'before_status',visible:false, title: __('Before_status'), searchList: {"-3":__('Before_status -3'),"0":__('Before_status 0'),"2":__('Before_status 2'),"3":__('Before_status 3'),"4":__('Before_status 4'),"6":__('Before_status 6'),"9":__('Before_status 9')}, formatter: Table.api.formatter.status}, {field: 'server_status', title: __('Server_status'), searchList: {"0":__('Server_status 0'),"3":__('Server_status 3'),"6":__('Server_status 6')}, formatter: Table.api.formatter.status}, + + {field: 'suspend_status', title: __('Suspend_status'), searchList: {"0":__('Suspend_status 0'),"1":__('Suspend_status 1'),"2":__('Suspend_status 2')}, formatter: Table.api.formatter.status}, + {field: 'canceltime',visible:false, title: __('Canceltime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'paytime',visible:false, title: __('Paytime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'auth_time',visible:false, title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, @@ -69,6 +72,7 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde {field: 'sub_refundprice', title: __('Sub_refundprice'), operate:'BETWEEN'}, {field: 'platform', title: __('Platform'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'reason',visible:false, title: __('Reason'), operate: 'LIKE'}, + {field: 'auth_reason',visible:false, title: __('售后申请原因'), operate: 'LIKE'}, {field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status}, {field: 'auth_user_id',visible:false, title: __('Auth_user_id')}, {field: 'auth_type',visible:false, title: __('Auth_type'), operate: 'LIKE'}, @@ -271,6 +275,126 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde // 为表格绑定事件 Table.api.bindevent(table); + + + + //自定义Tab筛选条件 + $('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { + var value = $(this).data("value"); + var options = table.bootstrapTable('getOptions'); + var queryParams = options.queryParams; + options.pageNumber = 1; + options.queryParams = function (params) { + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 + params = queryParams(params); + + //如果希望追加搜索条件,可使用 + var filter = params.filter ? JSON.parse(params.filter) : {}; + var op = params.op ? JSON.parse(params.op) : {}; + if (value!=="") { + //这里可以自定义多个筛选条件 + filter.server_status = value; + op.server_status = '='; + }else{ + //console.log("111111111111111111"); + //选全部时要移除相应的条件 + delete filter.server_status; + delete op.server_status; + } + + params.filter = JSON.stringify(filter); + params.op = JSON.stringify(op); + + //如果希望忽略搜索栏搜索条件,可使用 + //params.filter = JSON.stringify(value?{admin_id: value}:{}); + //params.op = JSON.stringify(value?{admin_id: '='}:{}); + return params; + }; + + table.trigger("uncheckbox"); + table.bootstrapTable('refresh', {pageNumber: 1}); + return false; + }); + + + //自定义Tab筛选条件 + $('.panel-heading .nav2-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { + var value = $(this).data("value"); + var options = table.bootstrapTable('getOptions'); + var queryParams = options.queryParams; + options.pageNumber = 1; + options.queryParams = function (params) { + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 + params = queryParams(params); + + //如果希望追加搜索条件,可使用 + var filter = params.filter ? JSON.parse(params.filter) : {}; + var op = params.op ? JSON.parse(params.op) : {}; + if (value!=="") { + //这里可以自定义多个筛选条件 + filter.auth_status = value; + op.auth_status = '='; + }else{ + //console.log("111111111111111111"); + //选全部时要移除相应的条件 + delete filter.auth_status; + delete op.auth_status; + } + + params.filter = JSON.stringify(filter); + params.op = JSON.stringify(op); + + //如果希望忽略搜索栏搜索条件,可使用 + //params.filter = JSON.stringify(value?{admin_id: value}:{}); + //params.op = JSON.stringify(value?{admin_id: '='}:{}); + return params; + }; + + table.trigger("uncheckbox"); + table.bootstrapTable('refresh', {pageNumber: 1}); + return false; + }); + + + + //自定义Tab筛选条件 + $('.panel-heading .nav3-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { + var value = $(this).data("value"); + var options = table.bootstrapTable('getOptions'); + var queryParams = options.queryParams; + options.pageNumber = 1; + options.queryParams = function (params) { + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 + params = queryParams(params); + + //如果希望追加搜索条件,可使用 + var filter = params.filter ? JSON.parse(params.filter) : {}; + var op = params.op ? JSON.parse(params.op) : {}; + if (value!=="") { + //这里可以自定义多个筛选条件 + filter.suspend_status = value; + op.suspend_status = '='; + }else{ + //console.log("111111111111111111"); + //选全部时要移除相应的条件 + delete filter.suspend_status; + delete op.suspend_status; + } + + params.filter = JSON.stringify(filter); + params.op = JSON.stringify(op); + + //如果希望忽略搜索栏搜索条件,可使用 + //params.filter = JSON.stringify(value?{admin_id: value}:{}); + //params.op = JSON.stringify(value?{admin_id: '='}:{}); + return params; + }; + + table.trigger("uncheckbox"); + table.bootstrapTable('refresh', {pageNumber: 1}); + return false; + }); + }, recyclebin: function () { // 初始化表格参数配置 diff --git a/public/assets/js/backend/user/withdrawal/userwithdrawal_log.js b/public/assets/js/backend/user/withdrawal/userwithdrawal_log.js index 6d9b318..3fb7952 100644 --- a/public/assets/js/backend/user/withdrawal/userwithdrawal_log.js +++ b/public/assets/js/backend/user/withdrawal/userwithdrawal_log.js @@ -120,6 +120,49 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde // 为表格绑定事件 Table.api.bindevent(table); + + + + //自定义Tab筛选条件 + $('.panel-heading .nav-custom-condition a[data-toggle="tab"]', table.closest(".panel-intro")).on('shown.bs.tab', function (e) { + var value = $(this).data("value"); + var options = table.bootstrapTable('getOptions'); + var queryParams = options.queryParams; + options.pageNumber = 1; + options.queryParams = function (params) { + //这一行必须要存在,否则在点击下一页时会丢失搜索栏数据 + params = queryParams(params); + + //如果希望追加搜索条件,可使用 + var filter = params.filter ? JSON.parse(params.filter) : {}; + var op = params.op ? JSON.parse(params.op) : {}; + if (value!=="") { + //这里可以自定义多个筛选条件 + filter.withdrawal_status = value; + op.withdrawal_status = '='; + }else{ + //console.log("111111111111111111"); + //选全部时要移除相应的条件 + delete filter.withdrawal_status; + delete op.withdrawal_status; + } + + params.filter = JSON.stringify(filter); + params.op = JSON.stringify(op); + + //如果希望忽略搜索栏搜索条件,可使用 + //params.filter = JSON.stringify(value?{admin_id: value}:{}); + //params.op = JSON.stringify(value?{admin_id: '='}:{}); + return params; + }; + + table.trigger("uncheckbox"); + table.bootstrapTable('refresh', {pageNumber: 1}); + return false; + }); + + + }, add: function () { Controller.api.bindevent();