From fc8831316b57baa2b693bea5dd79e7b6388ed2c9 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Thu, 19 Mar 2026 17:41:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=AB=E7=A0=81=E7=AD=BE=E5=88=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lang/zh-cn/wdsxh/activity/activity.php | 3 +- .../zh-cn/wdsxh/activity/activity_apply.php | 5 +- .../admin/model/wdsxh/activity/Activity.php | 50 +- .../wdsxh/activity/activity_apply/index.html | 5 - .../controller/wdsxh/activity/Activity.php | 38 +- .../wdsxh/activity/ActivityApply.php | 55 ++- .../api/model/wdsxh/activity/Activity.php | 34 +- .../js/backend/wdsxh/activity/activity.js | 428 +++++++++--------- .../backend/wdsxh/activity/activity_apply.js | 195 ++++---- 9 files changed, 467 insertions(+), 346 deletions(-) diff --git a/application/admin/lang/zh-cn/wdsxh/activity/activity.php b/application/admin/lang/zh-cn/wdsxh/activity/activity.php index 1098675..2e6d2ed 100644 --- a/application/admin/lang/zh-cn/wdsxh/activity/activity.php +++ b/application/admin/lang/zh-cn/wdsxh/activity/activity.php @@ -1,6 +1,6 @@ '自助签到(范围1000米)', 'Verification_method 2' => '管理员核销', 'Applet_activity_qrcode_path' => '活动小程序码', + 'Checked_in_qrcode' => '签到二维码', 'Points_status' => '设置是否获得积分', 'Points_status 1' => '是', 'Points_status 2' => '否', diff --git a/application/admin/lang/zh-cn/wdsxh/activity/activity_apply.php b/application/admin/lang/zh-cn/wdsxh/activity/activity_apply.php index 9c27a2e..6aac613 100644 --- a/application/admin/lang/zh-cn/wdsxh/activity/activity_apply.php +++ b/application/admin/lang/zh-cn/wdsxh/activity/activity_apply.php @@ -1,6 +1,6 @@ '退款中', 'State 4' => '已退款', 'State 5' => '已驳回', + 'check_in_status' => '签到状态', + 'checked_in' => '已签到', + 'unchecked_in' => '未签到', 'Is_sign_in' => '核销状态', 'Is_sign_in 1' => '已核销', 'Is_sign_in 2' => '未核销', diff --git a/application/admin/model/wdsxh/activity/Activity.php b/application/admin/model/wdsxh/activity/Activity.php index a9931a0..81ed4a3 100644 --- a/application/admin/model/wdsxh/activity/Activity.php +++ b/application/admin/model/wdsxh/activity/Activity.php @@ -1,6 +1,6 @@ app_code->getUnlimit($ids, [ 'page' => $path, 'check_path' => false, + 'env_version' => 'develop', ]); if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { @@ -202,6 +204,48 @@ class Activity extends Model return $value; } + public function getCheckedInQrcodeAttr($value, $data) + { + $row = $data; + $row['createtime'] = self::where('id',$row['id'])->value('createtime'); + $save_path = '/uploads/wdsxh/check_in_qrcode/'.$row['id'].'/'.$row['createtime'].'.png'; + if (is_file(ROOT_PATH."public".$save_path)) { + $value = $save_path; + } else { + if(isset($row['id'])) { + $configObj = (new \app\admin\model\wdsxh\Config())->where('id',1)->find(); + if (!empty($configObj['applet_appid']) && !empty($configObj['applet_secret'])) { + $path = 'pagesActivity/index/details'; + $config = [ + 'app_id' => $configObj['applet_appid'], + 'secret' => $configObj['applet_secret'], + 'response_type' => 'array', + 'log' => [ + 'level' => 'debug', + ], + ]; + + $app = Factory::miniProgram($config); + $scene = http_build_query(['id' => $row['id'], 'op' => 'checked_in']); + $response = $app->app_code->getUnlimit($scene, [ + 'page' => $path, + 'check_path' => false, + 'env_version' => 'develop', + ]); + + if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { + $response->saveAs('uploads/wdsxh/check_in_qrcode/'.$row['id'], $row['createtime'].'.png'); + $value = $save_path; + } + } + } + } + if (!empty($value)) { + $value = request()->domain().$value; + } + return $value; + } + public function getPointsStatusList() { return ['2' => __('Points_status 2'), '1' => __('Points_status 1')]; @@ -216,6 +260,4 @@ class Activity extends Model { return ['1' => __('启用单独证书'), '2' => __('使用统一证书')]; } - - } diff --git a/application/admin/view/wdsxh/activity/activity_apply/index.html b/application/admin/view/wdsxh/activity/activity_apply/index.html index 34fb651..2142942 100644 --- a/application/admin/view/wdsxh/activity/activity_apply/index.html +++ b/application/admin/view/wdsxh/activity/activity_apply/index.html @@ -9,11 +9,6 @@ {:__('Add')} - - - - - request->get('id'); $data = $this->model ->where('id',$id) - ->field('id,images,start_time,end_time,name,fees,state activity_state, - contacts,mobile, - organizing_method,url,address,longitude,latitude,content, - is_verifying,refund, - apply_time, - activity_auth, - points_status,points, - apply_field_state, - apply_limit_number, - non_member_registration_status') + ->field([ + 'id', 'images', 'start_time', 'end_time', 'name', 'fees', + 'state' => 'activity_state', 'contacts', 'mobile', + 'organizing_method', 'url', 'address', 'longitude', + 'latitude', 'content', 'is_verifying', 'refund', + 'apply_time', 'activity_auth', 'points_status', 'points', + 'apply_field_state', 'apply_limit_number', 'non_member_registration_status' + ]) ->find(); if (!$data) { $this->error('活动不存在'); } + if ($data['activity_state'] < 3) { + $now = time(); + // 如果活动未结束,则根据当前时间校验活动状态并更新状态 + if ($now >= $data['start_time'] && $now <= $data['end_time']) { + $data->state = $data['activity_state'] = 2; + $data->save(); + } + if ($now > $data['end_time']) { + $data->state = $data['activity_state'] = 3; + $data->save(); + } + } + if ($this->auth->isLogin()) { $wechat_id = (new UserWechat())->where('user_id',$this->auth->id)->value('id'); $activityApplyObj = (new \app\api\model\wdsxh\activity\ActivityApply()) @@ -123,6 +134,7 @@ class Activity extends Api $data['apply_id'] = ''; $data['reject'] = ''; } else { + $data['check_in_status'] = $activityApplyObj['check_in_status']; $data['pay_state'] = $activityApplyObj['state']; $data['apply_id'] = $activityApplyObj['id']; $activityRefundObj = (new Refund()) @@ -490,7 +502,3 @@ class Activity extends Api $this->success('请求成功',['show_status'=>$is_status]); } } - - - - \ No newline at end of file diff --git a/application/api/controller/wdsxh/activity/ActivityApply.php b/application/api/controller/wdsxh/activity/ActivityApply.php index 041277a..6da889f 100644 --- a/application/api/controller/wdsxh/activity/ActivityApply.php +++ b/application/api/controller/wdsxh/activity/ActivityApply.php @@ -1,6 +1,6 @@ request->isGet()) { + $this->error('请求类型错误'); + } + + if (!$this->auth->isLogin()) { + $this->error('请先登录'); + } + + // 活动id + $id = $this->request->get('id'); + $activity = (new \app\api\model\wdsxh\activity\Activity())->where('id',$id)->find(); + if (empty($activity)) { + $this->error('活动不存在'); + } + if (3 == $activity['state'] || time() > $activity['end_time']) { + $this->error('活动已结束'); + } + + + $wechat_id = (new UserWechat())->where('user_id',$this->auth->id)->value('id'); + $activity_apply = $this->model->where('activity_id',$id)->where('wechat_id',$wechat_id)->find(); + // 如果用户未报名,不能签到 + if(empty($activity_apply)) { + $this->error('您还未报名该活动'); + } + // 如果已签到,不能再次签到 + if ('checked_in' == $activity_apply['check_in_status']) { + $this->error('您已签到'); + } + + // 设置已签到 + $activity_apply->check_in_status = 'checked_in'; + $activity_apply->checked_in_at = time(); + if ($activity_apply->save()) { + $this->success('签到成功'); + } + + $this->error('签到失败'); + } + private function handle_custom_data($data) { $custom_field = array('name','mobile'); @@ -530,7 +579,3 @@ class ActivityApply extends Api return $result; } } - - - - \ No newline at end of file diff --git a/application/api/model/wdsxh/activity/Activity.php b/application/api/model/wdsxh/activity/Activity.php index 87363c8..62c62ae 100644 --- a/application/api/model/wdsxh/activity/Activity.php +++ b/application/api/model/wdsxh/activity/Activity.php @@ -1,6 +1,6 @@ = $data['apply_time'] && $now < $data['start_time']) $value = 2; + // 当前时间大于等于开始时间小于等于结束时间,状态流转处于:进行中 + if ($now >= $data['start_time'] && $now <= $data['end_time']) { + $value = 3; + } + // 当前时间大于结束时间,状态流转处于:已结束 + if ($now > $data['end_time']) { + $value = 4; + } + } else { + // 活动结束,状态流转就一直处理:已结束 + $value = 4; + } + return $value; + } + protected static function init() { self::afterUpdate(function ($row) { @@ -65,7 +93,3 @@ class Activity extends Base }); } } - - - - \ No newline at end of file diff --git a/public/assets/js/backend/wdsxh/activity/activity.js b/public/assets/js/backend/wdsxh/activity/activity.js index 1b23c17..09502da 100644 --- a/public/assets/js/backend/wdsxh/activity/activity.js +++ b/public/assets/js/backend/wdsxh/activity/activity.js @@ -1,213 +1,215 @@ -define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'wdsxh/activity/activity/index' + location.search, - add_url: 'wdsxh/activity/activity/add', - edit_url: 'wdsxh/activity/activity/edit', - del_url: 'wdsxh/activity/activity/del', - multi_url: 'wdsxh/activity/activity/multi', - import_url: 'wdsxh/activity/activity/import', - table: 'wdsxh_activity', - } - }); - - var table = $("#table"); - - table.on('post-body.bs.table', function (e, settings, json, xhr) { - $(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]); - }); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - pk: 'id', - sortName: 'weigh', - fixedRightNumber: 1, - columns: [ - [ - {checkbox: true}, - {field: 'id', title: __('Id')}, - {field: 'name', title: __('Name'), operate: 'LIKE'}, - {field: 'fees', title: __('Fees'), operate:'BETWEEN'}, - {field: 'organizing_method', title: __('Organizing_method'), searchList: {"1":__('Organizing_method 1'),"2":__('Organizing_method 2')}, formatter: Table.api.formatter.normal}, - {field: 'apply_time', title: __('Apply_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal}, - {field: 'is_verifying', title: __('Is_verifying'), searchList: {"1":__('Is_verifying 1'),"2":__('Is_verifying 2')}, formatter: Table.api.formatter.normal}, - {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'weigh', title: __('Weigh'), operate: false}, - {field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status}, - {field: 'applet_activity_qrcode_path', title: __('Applet_activity_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, - {field: 'points_status', title: __('Points_status'), searchList: {"1":__('Points_status 1'),"2":__('Points_status 2'),"3":__('Points_status 3')}, formatter: Table.api.formatter.normal}, - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, - buttons:[ - { - name: 'list', - text: __('报名列表'), - title: __('报名列表'), - classname: 'btn btn-xs btn-info btn-dialog', - icon: 'fa fa-list', - extend: 'data-area=["100%","100%"]', - url: 'wdsxh/activity/activity_apply?activity_id={id}', - callback: function (data) { - Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); - }, - visible: function (row) { - //返回true时按钮显示,返回false隐藏 - return true; - } - }, - { - name: 'verification_qr_code', - text: __('公众号签到二维码'), - title: __('公众号签到二维码'), - classname: 'btn btn-xs bg-olive btn-dialog', - icon: 'fa fa-qrcode', - extend: 'data-area=["40%","60%"]', - url: 'wdsxh/activity/activity/verification_qr_code', - visible: function (row) { - if(Config.wananchi_appid !== null && Config.wananchi_appid !== undefined && Config.wananchi_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ - return true; - }else{ - return false; - } - }, - }, - { - name: 'verification_applet_code', - text: __('小程序签到二维码'), - title: __('小程序签到二维码'), - classname: 'btn btn-xs bg-black btn-dialog', - icon: 'fa fa-qrcode', - extend: 'data-area=["40%","60%"]', - url: 'wdsxh/activity/activity/verification_applet_code', - visible: function (row) { - if(Config.applet_appid !== null && Config.applet_appid !== undefined && Config.applet_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ - return true; - }else{ - return false; - } - }, - }, - { - name: 'fieldset', - text: __('自定义报名字段'), - title: __('自定义报名字段'), - classname: 'btn btn-xs btn-primary btn-dialog', - icon: 'fa fa-list', - extend: 'data-area=["100%","100%"]', - url: 'wdsxh/activity/activity_fieldset/fieldset', - visible: function (row) { - if(row.apply_field_state == 1){ - return true; - }else{ - return false; - } - }, - }, - { - name: 'certificate_design', - text: __('设置证书'), - title: __('设置证书'), - classname: 'btn btn-xs btn-success btn-dialog', - icon: 'fa fa-certificate', - extend: 'data-area=["100%","100%"]', - url: 'wdsxh/activity/certificate_design/index', - visible: function (row) { - // 只有启用单独证书时才显示按钮 - if(row.certificate_enabled == '1'){ - return true; - }else{ - return false; - } - }, - } - ] - } - ] - ] - }); - - // 为表格绑定事件 - Table.api.bindevent(table); - }, - add: function () { - Controller.api.bindevent(); - }, - edit: function () { - Controller.api.bindevent(); - }, - verification_qr_code: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - $(document).on('change','input[name="row[organizing_method]"]',function (){ - var type=$(this).val(); - switch (type){ - case "1": - $('.address').addClass('hide'); - $('.url').removeClass('hide'); - break; - case "2": - $('.url').addClass('hide'); - $('.address').removeClass('hide'); - break; - } - }); - $(document).on('change','input[name="row[is_verifying]"]',function (){ - var type=$(this).val(); - switch (type){ - case "1"://需要核销 - $('.verification_method').removeClass('hide'); - break; - case "2"://不需要核销 - $('.verification_method').addClass('hide'); - $('.verifying_wechat_ids').addClass('hide'); - break; - } - }); - $(document).on('change','input[name="row[verification_method]"]',function (){ - var type=$(this).val(); - switch (type){ - case "1"://核销方式:自动签到 - $('.verifying_wechat_ids').addClass('hide'); - break; - case "2"://核销方式:管理员核销 - $('.verifying_wechat_ids').removeClass('hide'); - break; - } - }); - $(document).on('change','input[name="row[points_status]"]',function (){ - var type=$(this).val(); - switch (type){ - case "1"://能活动积分 - $('.points').removeClass('hide'); - break; - case "2"://不能活动积分 - $('.points').addClass('hide'); - break; - } - }); - $(document).on('change','input[name="row[certificate_enabled]"]',function (){ - var type=$(this).val(); - switch (type){ - case "1"://启用单独证书 - $('.certificate_data').removeClass('hide'); - break; - case "2"://使用统一证书 - $('.certificate_data').addClass('hide'); - break; - } - }); - } - } - }; - return Controller; -}); +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'wdsxh/activity/activity/index' + location.search, + add_url: 'wdsxh/activity/activity/add', + edit_url: 'wdsxh/activity/activity/edit', + del_url: 'wdsxh/activity/activity/del', + multi_url: 'wdsxh/activity/activity/multi', + import_url: 'wdsxh/activity/activity/import', + table: 'wdsxh_activity', + } + }); + + var table = $("#table"); + + table.on('post-body.bs.table', function (e, settings, json, xhr) { + $(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]); + }); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'weigh', + fixedRightNumber: 1, + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'fees', title: __('Fees'), operate:'BETWEEN'}, + {field: 'organizing_method', title: __('Organizing_method'), searchList: {"1":__('Organizing_method 1'),"2":__('Organizing_method 2')}, formatter: Table.api.formatter.normal}, + {field: 'apply_time', title: __('Apply_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3')}, formatter: Table.api.formatter.normal}, + {field: 'is_verifying', title: __('Is_verifying'), searchList: {"1":__('Is_verifying 1'),"2":__('Is_verifying 2')}, formatter: Table.api.formatter.normal}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'weigh', title: __('Weigh'), operate: false}, + {field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status}, + {field: 'applet_activity_qrcode_path', title: __('Applet_activity_qrcode_path'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'checked_in_qrcode', title: __('Checked_in_qrcode'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'points_status', title: __('Points_status'), searchList: { "1": __('Points_status 1'), "2": __('Points_status 2'), "3": __('Points_status 3') }, formatter: Table.api.formatter.normal}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, + buttons:[ + { + name: 'list', + text: __('报名列表'), + title: __('报名列表'), + classname: 'btn btn-xs btn-info btn-dialog', + icon: 'fa fa-list', + extend: 'data-area=["100%","100%"]', + url: 'wdsxh/activity/activity_apply?activity_id={id}', + callback: function (data) { + Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); + }, + visible: function (row) { + //返回true时按钮显示,返回false隐藏 + return true; + } + }, + { + name: 'verification_qr_code', + text: __('公众号签到二维码'), + title: __('公众号签到二维码'), + classname: 'btn btn-xs bg-olive btn-dialog', + icon: 'fa fa-qrcode', + extend: 'data-area=["40%","60%"]', + url: 'wdsxh/activity/activity/verification_qr_code', + visible: function (row) { + if(Config.wananchi_appid !== null && Config.wananchi_appid !== undefined && Config.wananchi_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ + return true; + }else{ + return false; + } + }, + }, + { + name: 'verification_applet_code', + text: __('小程序签到二维码'), + title: __('小程序签到二维码'), + classname: 'btn btn-xs bg-black btn-dialog', + icon: 'fa fa-qrcode', + extend: 'data-area=["40%","60%"]', + url: 'wdsxh/activity/activity/verification_applet_code', + visible: function (row) { + return false; + // if(Config.applet_appid !== null && Config.applet_appid !== undefined && Config.applet_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ + // return true; + // }else{ + // return false; + // } + }, + }, + { + name: 'fieldset', + text: __('自定义报名字段'), + title: __('自定义报名字段'), + classname: 'btn btn-xs btn-primary btn-dialog', + icon: 'fa fa-list', + extend: 'data-area=["100%","100%"]', + url: 'wdsxh/activity/activity_fieldset/fieldset', + visible: function (row) { + if(row.apply_field_state == 1){ + return true; + }else{ + return false; + } + }, + }, + { + name: 'certificate_design', + text: __('设置证书'), + title: __('设置证书'), + classname: 'btn btn-xs btn-success btn-dialog', + icon: 'fa fa-certificate', + extend: 'data-area=["100%","100%"]', + url: 'wdsxh/activity/certificate_design/index', + visible: function (row) { + // 只有启用单独证书时才显示按钮 + if(row.certificate_enabled == '1'){ + return true; + }else{ + return false; + } + }, + } + ] + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + verification_qr_code: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + $(document).on('change','input[name="row[organizing_method]"]',function (){ + var type=$(this).val(); + switch (type){ + case "1": + $('.address').addClass('hide'); + $('.url').removeClass('hide'); + break; + case "2": + $('.url').addClass('hide'); + $('.address').removeClass('hide'); + break; + } + }); + $(document).on('change','input[name="row[is_verifying]"]',function (){ + var type=$(this).val(); + switch (type){ + case "1"://需要核销 + $('.verification_method').removeClass('hide'); + break; + case "2"://不需要核销 + $('.verification_method').addClass('hide'); + $('.verifying_wechat_ids').addClass('hide'); + break; + } + }); + $(document).on('change','input[name="row[verification_method]"]',function (){ + var type=$(this).val(); + switch (type){ + case "1"://核销方式:自动签到 + $('.verifying_wechat_ids').addClass('hide'); + break; + case "2"://核销方式:管理员核销 + $('.verifying_wechat_ids').removeClass('hide'); + break; + } + }); + $(document).on('change','input[name="row[points_status]"]',function (){ + var type=$(this).val(); + switch (type){ + case "1"://能活动积分 + $('.points').removeClass('hide'); + break; + case "2"://不能活动积分 + $('.points').addClass('hide'); + break; + } + }); + $(document).on('change','input[name="row[certificate_enabled]"]',function (){ + var type=$(this).val(); + switch (type){ + case "1"://启用单独证书 + $('.certificate_data').removeClass('hide'); + break; + case "2"://使用统一证书 + $('.certificate_data').addClass('hide'); + break; + } + }); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/wdsxh/activity/activity_apply.js b/public/assets/js/backend/wdsxh/activity/activity_apply.js index 61f2e2c..54c17c9 100644 --- a/public/assets/js/backend/wdsxh/activity/activity_apply.js +++ b/public/assets/js/backend/wdsxh/activity/activity_apply.js @@ -1,97 +1,98 @@ -define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { - - var Controller = { - index: function () { - // 初始化表格参数配置 - Table.api.init({ - extend: { - index_url: 'wdsxh/activity/activity_apply/index' + location.search + '&activity_id=' + Config.activity_id, - add_url: 'wdsxh/activity/activity_apply/add?activity_id=' + Config.activity_id, - multi_url: 'wdsxh/activity/activity_apply/multi', - import_url: 'wdsxh/activity/activity_apply/import', - table: 'wdsxh_activity_apply', - } - }); - - var table = $("#table"); - - // 初始化表格 - table.bootstrapTable({ - url: $.fn.bootstrapTable.defaults.extend.index_url, - pk: 'id', - sortName: 'id', - columns: [ - [ - // {checkbox: true}, - {field: 'id', title: __('Id')}, - {field: 'order_no', title: '订单号', operate: false}, - {field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'}, - {field: 'wechat.avatar', title: '用户头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, - {field: 'wechat.mobile', title: '用户电话', operate: false}, - {field: 'activity.name', title: __('Activity.name'), operate: 'LIKE'}, - {field: 'activity.start_time', title: __('Activity.start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'activity.end_time', title: __('Activity.end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'activity.fees', title: __('Activity.fees'), operate:'BETWEEN'}, - {field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4'),"5":__('State 5')}, formatter: Table.api.formatter.normal}, - {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'pay_time', title: __('付款时间'), operate:false}, - {field: 'is_sign_in', title: __('Is_sign_in'), searchList: {"1":__('Is_sign_in 1'),"2":__('Is_sign_in 2'),"3":__('Is_sign_in 3')}, formatter: Table.api.formatter.normal}, - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, - buttons: [ - { - name: 'field_data_details', - text: __('报名信息'), - title: __('报名信息'), - classname: 'btn btn-xs btn-primary btn-dialog', - icon: 'fa', - extend: 'data-area=["100%","100%"]', - url: 'wdsxh/activity/activity_apply/field_data_details', - visible: function (row) { - if(row.show_field_data == 1){ - return true; - }else{ - return false; - } - }, - }, - ] - } - ] - ] - }); - - table.on('post-body.bs.table', function (e, settings, json, xhr) { - $(".btn-editone,.btn-edit,.btn-add").data("area", ["80%", "80%"]); - }) - - // 为表格绑定事件 - Table.api.bindevent(table); - }, - add: function () { - Controller.api.bindevent(); - $(document).on('click','#select-user',function () { - Fast.api.open('wdsxh/member/member/activity_seluser?activity_id='+ Config.activity_id,'选择用户',{ - area:['80%','95%'], - callback:function(data){ - console.log(data); - if(data){ - $('#c-uid').val(data.id); - $('#c-user').val(data.nickname); - }else{ - Layer.alert("请选择用户"); - } - } - }); - }); - }, - field_data_details: function () { - Controller.api.bindevent(); - }, - api: { - bindevent: function () { - Form.api.bindevent($("form[role=form]")); - } - } - }; - return Controller; -}); +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'wdsxh/activity/activity_apply/index' + location.search + '&activity_id=' + Config.activity_id, + add_url: 'wdsxh/activity/activity_apply/add?activity_id=' + Config.activity_id, + multi_url: 'wdsxh/activity/activity_apply/multi', + import_url: 'wdsxh/activity/activity_apply/import', + table: 'wdsxh_activity_apply', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + // {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'order_no', title: '订单号', operate: false}, + {field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'}, + {field: 'wechat.avatar', title: '用户头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'wechat.mobile', title: '用户电话', operate: false}, + {field: 'activity.name', title: __('Activity.name'), operate: 'LIKE'}, + {field: 'activity.start_time', title: __('Activity.start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'activity.end_time', title: __('Activity.end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'activity.fees', title: __('Activity.fees'), operate:'BETWEEN'}, + {field: 'state', title: __('State'), searchList: {"1":__('State 1'),"2":__('State 2'),"3":__('State 3'),"4":__('State 4'),"5":__('State 5')}, formatter: Table.api.formatter.normal}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'pay_time', title: __('付款时间'), operate:false}, + {field: 'check_in_status', title: __('check_in_status'), searchList: {"checked_in":__('checked_in'),"unchecked_in":__('unchecked_in')}, formatter: Table.api.formatter.normal}, + {field: 'is_sign_in', title: __('Is_sign_in'), searchList: {"1":__('Is_sign_in 1'),"2":__('Is_sign_in 2'),"3":__('Is_sign_in 3')}, formatter: Table.api.formatter.normal}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, + buttons: [ + { + name: 'field_data_details', + text: __('报名信息'), + title: __('报名信息'), + classname: 'btn btn-xs btn-primary btn-dialog', + icon: 'fa', + extend: 'data-area=["100%","100%"]', + url: 'wdsxh/activity/activity_apply/field_data_details', + visible: function (row) { + if(row.show_field_data == 1){ + return true; + }else{ + return false; + } + }, + }, + ] + } + ] + ] + }); + + table.on('post-body.bs.table', function (e, settings, json, xhr) { + $(".btn-editone,.btn-edit,.btn-add").data("area", ["80%", "80%"]); + }) + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + $(document).on('click','#select-user',function () { + Fast.api.open('wdsxh/member/member/activity_seluser?activity_id='+ Config.activity_id,'选择用户',{ + area:['80%','95%'], + callback:function(data){ + console.log(data); + if(data){ + $('#c-uid').val(data.id); + $('#c-user').val(data.nickname); + }else{ + Layer.alert("请选择用户"); + } + } + }); + }); + }, + field_data_details: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +});