feat: 扫码签到功能

This commit is contained in:
2026-03-19 17:41:23 +08:00
parent e2c8ae752d
commit fc8831316b
9 changed files with 467 additions and 346 deletions

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -53,6 +53,7 @@ return [
'Verification_method 1' => '自助签到(范围1000米)', 'Verification_method 1' => '自助签到(范围1000米)',
'Verification_method 2' => '管理员核销', 'Verification_method 2' => '管理员核销',
'Applet_activity_qrcode_path' => '活动小程序码', 'Applet_activity_qrcode_path' => '活动小程序码',
'Checked_in_qrcode' => '签到二维码',
'Points_status' => '设置是否获得积分', 'Points_status' => '设置是否获得积分',
'Points_status 1' => '是', 'Points_status 1' => '是',
'Points_status 2' => '否', 'Points_status 2' => '否',

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -20,6 +20,9 @@ return [
'State 3' => '退款中', 'State 3' => '退款中',
'State 4' => '已退款', 'State 4' => '已退款',
'State 5' => '已驳回', 'State 5' => '已驳回',
'check_in_status' => '签到状态',
'checked_in' => '已签到',
'unchecked_in' => '未签到',
'Is_sign_in' => '核销状态', 'Is_sign_in' => '核销状态',
'Is_sign_in 1' => '已核销', 'Is_sign_in 1' => '已核销',
'Is_sign_in 2' => '未核销', 'Is_sign_in 2' => '未核销',

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -42,7 +42,8 @@ class Activity extends Model
'state_text', 'state_text',
'is_verifying_text', 'is_verifying_text',
'status_text', 'status_text',
'applet_activity_qrcode_path' 'applet_activity_qrcode_path',
'checked_in_qrcode'
]; ];
@@ -186,6 +187,7 @@ class Activity extends Model
$response = $app->app_code->getUnlimit($ids, [ $response = $app->app_code->getUnlimit($ids, [
'page' => $path, 'page' => $path,
'check_path' => false, 'check_path' => false,
'env_version' => 'develop',
]); ]);
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) { if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
@@ -202,6 +204,48 @@ class Activity extends Model
return $value; 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() public function getPointsStatusList()
{ {
return ['2' => __('Points_status 2'), '1' => __('Points_status 1')]; return ['2' => __('Points_status 2'), '1' => __('Points_status 1')];
@@ -216,6 +260,4 @@ class Activity extends Model
{ {
return ['1' => __('启用单独证书'), '2' => __('使用统一证书')]; return ['1' => __('启用单独证书'), '2' => __('使用统一证书')];
} }
} }

View File

@@ -9,11 +9,6 @@
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('wdsxh/activity/activity_apply/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('wdsxh/activity/activity_apply/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('wdsxh/activity/activity_apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> <!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('wdsxh/activity/activity_apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('wdsxh/activity/activity_apply/edit')}" data-operate-edit="{:$auth->check('wdsxh/activity/activity_apply/edit')}"

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -97,20 +97,31 @@ class Activity extends Api
$id = $this->request->get('id'); $id = $this->request->get('id');
$data = $this->model $data = $this->model
->where('id',$id) ->where('id',$id)
->field('id,images,start_time,end_time,name,fees,state activity_state, ->field([
contacts,mobile, 'id', 'images', 'start_time', 'end_time', 'name', 'fees',
organizing_method,url,address,longitude,latitude,content, 'state' => 'activity_state', 'contacts', 'mobile',
is_verifying,refund, 'organizing_method', 'url', 'address', 'longitude',
apply_time, 'latitude', 'content', 'is_verifying', 'refund',
activity_auth, 'apply_time', 'activity_auth', 'points_status', 'points',
points_status,points, 'apply_field_state', 'apply_limit_number', 'non_member_registration_status'
apply_field_state, ])
apply_limit_number,
non_member_registration_status')
->find(); ->find();
if (!$data) { if (!$data) {
$this->error('活动不存在'); $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()) { if ($this->auth->isLogin()) {
$wechat_id = (new UserWechat())->where('user_id',$this->auth->id)->value('id'); $wechat_id = (new UserWechat())->where('user_id',$this->auth->id)->value('id');
$activityApplyObj = (new \app\api\model\wdsxh\activity\ActivityApply()) $activityApplyObj = (new \app\api\model\wdsxh\activity\ActivityApply())
@@ -123,6 +134,7 @@ class Activity extends Api
$data['apply_id'] = ''; $data['apply_id'] = '';
$data['reject'] = ''; $data['reject'] = '';
} else { } else {
$data['check_in_status'] = $activityApplyObj['check_in_status'];
$data['pay_state'] = $activityApplyObj['state']; $data['pay_state'] = $activityApplyObj['state'];
$data['apply_id'] = $activityApplyObj['id']; $data['apply_id'] = $activityApplyObj['id'];
$activityRefundObj = (new Refund()) $activityRefundObj = (new Refund())
@@ -490,7 +502,3 @@ class Activity extends Api
$this->success('请求成功',['show_status'=>$is_status]); $this->success('请求成功',['show_status'=>$is_status]);
} }
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -516,6 +516,55 @@ class ActivityApply extends Api
} }
/**
* Desc 签到(单纯签到功能不涉核销)
*
* @param type $param
* @return type
* Created by jsasg
*/
public function checked_in()
{
if(!$this->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) private function handle_custom_data($data)
{ {
$custom_field = array('name','mobile'); $custom_field = array('name','mobile');
@@ -530,7 +579,3 @@ class ActivityApply extends Api
return $result; return $result;
} }
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展 // | 麦沃德科技赋能开发者,助力商协会发展
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved. // | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@@ -32,6 +32,34 @@ class Activity extends Base
protected $updateTime = false; protected $updateTime = false;
protected $deleteTime = false; protected $deleteTime = false;
protected $append = [
'actitity_state_trans'
];
public function getActitityStateTransAttr($value, $data)
{
if ($data['activity_state'] < 3) {
$now = time();
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
// 当前时间小于报名截止时间,状态流转处于:报名中
if ($now < $data['apply_time']) $value = 1;
// 当前时间大于等于报名截止时间小于开始时间,状态流转处于:未开始
if ($now >= $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() protected static function init()
{ {
self::afterUpdate(function ($row) { self::afterUpdate(function ($row) {
@@ -65,7 +93,3 @@ class Activity extends Base
}); });
} }
} }

View File

@@ -1,213 +1,215 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = { var Controller = {
index: function () { index: function () {
// 初始化表格参数配置 // 初始化表格参数配置
Table.api.init({ Table.api.init({
extend: { extend: {
index_url: 'wdsxh/activity/activity/index' + location.search, index_url: 'wdsxh/activity/activity/index' + location.search,
add_url: 'wdsxh/activity/activity/add', add_url: 'wdsxh/activity/activity/add',
edit_url: 'wdsxh/activity/activity/edit', edit_url: 'wdsxh/activity/activity/edit',
del_url: 'wdsxh/activity/activity/del', del_url: 'wdsxh/activity/activity/del',
multi_url: 'wdsxh/activity/activity/multi', multi_url: 'wdsxh/activity/activity/multi',
import_url: 'wdsxh/activity/activity/import', import_url: 'wdsxh/activity/activity/import',
table: 'wdsxh_activity', table: 'wdsxh_activity',
} }
}); });
var table = $("#table"); var table = $("#table");
table.on('post-body.bs.table', function (e, settings, json, xhr) { table.on('post-body.bs.table', function (e, settings, json, xhr) {
$(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]); $(".btn-editone,.btn-edit,.btn-add").data("area", ["100%", "100%"]);
}); });
// 初始化表格 // 初始化表格
table.bootstrapTable({ table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url, url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id', pk: 'id',
sortName: 'weigh', sortName: 'weigh',
fixedRightNumber: 1, fixedRightNumber: 1,
columns: [ columns: [
[ [
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), operate: 'LIKE'}, {field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'fees', title: __('Fees'), operate:'BETWEEN'}, {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: '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: '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: '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: '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: '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: '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: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'weigh', title: __('Weigh'), operate: false}, {field: 'weigh', title: __('Weigh'), operate: false},
{field: 'status', title: __('Status'), searchList: {"normal":__('Status normal'),"hidden":__('Status hidden')}, formatter: Table.api.formatter.status}, {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: '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: 'checked_in_qrcode', title: __('Checked_in_qrcode'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, {field: 'points_status', title: __('Points_status'), searchList: { "1": __('Points_status 1'), "2": __('Points_status 2'), "3": __('Points_status 3') }, formatter: Table.api.formatter.normal},
buttons:[ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
{ buttons:[
name: 'list', {
text: __('报名列表'), name: 'list',
title: __('报名列表'), text: __('报名列表'),
classname: 'btn btn-xs btn-info btn-dialog', title: __('报名列表'),
icon: 'fa fa-list', classname: 'btn btn-xs btn-info btn-dialog',
extend: 'data-area=["100%","100%"]', icon: 'fa fa-list',
url: 'wdsxh/activity/activity_apply?activity_id={id}', extend: 'data-area=["100%","100%"]',
callback: function (data) { url: 'wdsxh/activity/activity_apply?activity_id={id}',
Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); callback: function (data) {
}, Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
visible: function (row) { },
//返回true时按钮显示,返回false隐藏 visible: function (row) {
return true; //返回true时按钮显示,返回false隐藏
} return true;
}, }
{ },
name: 'verification_qr_code', {
text: __('公众号签到二维码'), name: 'verification_qr_code',
title: __('公众号签到二维码'), text: __('公众号签到二维码'),
classname: 'btn btn-xs bg-olive btn-dialog', title: __('公众号签到二维码'),
icon: 'fa fa-qrcode', classname: 'btn btn-xs bg-olive btn-dialog',
extend: 'data-area=["40%","60%"]', icon: 'fa fa-qrcode',
url: 'wdsxh/activity/activity/verification_qr_code', extend: 'data-area=["40%","60%"]',
visible: function (row) { url: 'wdsxh/activity/activity/verification_qr_code',
if(Config.wananchi_appid !== null && Config.wananchi_appid !== undefined && Config.wananchi_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ visible: function (row) {
return true; if(Config.wananchi_appid !== null && Config.wananchi_appid !== undefined && Config.wananchi_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){
}else{ return true;
return false; }else{
} return false;
}, }
}, },
{ },
name: 'verification_applet_code', {
text: __('小程序签到二维码'), name: 'verification_applet_code',
title: __('小程序签到二维码'), text: __('小程序签到二维码'),
classname: 'btn btn-xs bg-black btn-dialog', title: __('小程序签到二维码'),
icon: 'fa fa-qrcode', classname: 'btn btn-xs bg-black btn-dialog',
extend: 'data-area=["40%","60%"]', icon: 'fa fa-qrcode',
url: 'wdsxh/activity/activity/verification_applet_code', extend: 'data-area=["40%","60%"]',
visible: function (row) { url: 'wdsxh/activity/activity/verification_applet_code',
if(Config.applet_appid !== null && Config.applet_appid !== undefined && Config.applet_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){ visible: function (row) {
return true; return false;
}else{ // if(Config.applet_appid !== null && Config.applet_appid !== undefined && Config.applet_appid !== '' && row.is_verifying == '1' && row.verification_method == 1 && row.state != '3'){
return false; // return true;
} // }else{
}, // return false;
}, // }
{ },
name: 'fieldset', },
text: __('自定义报名字段'), {
title: __('自定义报名字段'), name: 'fieldset',
classname: 'btn btn-xs btn-primary btn-dialog', text: __('自定义报名字段'),
icon: 'fa fa-list', title: __('自定义报名字段'),
extend: 'data-area=["100%","100%"]', classname: 'btn btn-xs btn-primary btn-dialog',
url: 'wdsxh/activity/activity_fieldset/fieldset', icon: 'fa fa-list',
visible: function (row) { extend: 'data-area=["100%","100%"]',
if(row.apply_field_state == 1){ url: 'wdsxh/activity/activity_fieldset/fieldset',
return true; visible: function (row) {
}else{ if(row.apply_field_state == 1){
return false; return true;
} }else{
}, return false;
}, }
{ },
name: 'certificate_design', },
text: __('设置证书'), {
title: __('设置证书'), name: 'certificate_design',
classname: 'btn btn-xs btn-success btn-dialog', text: __('设置证书'),
icon: 'fa fa-certificate', title: __('设置证书'),
extend: 'data-area=["100%","100%"]', classname: 'btn btn-xs btn-success btn-dialog',
url: 'wdsxh/activity/certificate_design/index', icon: 'fa fa-certificate',
visible: function (row) { extend: 'data-area=["100%","100%"]',
// 只有启用单独证书时才显示按钮 url: 'wdsxh/activity/certificate_design/index',
if(row.certificate_enabled == '1'){ visible: function (row) {
return true; // 只有启用单独证书时才显示按钮
}else{ if(row.certificate_enabled == '1'){
return false; return true;
} }else{
}, return false;
} }
] },
} }
] ]
] }
}); ]
]
// 为表格绑定事件 });
Table.api.bindevent(table);
}, // 为表格绑定事件
add: function () { Table.api.bindevent(table);
Controller.api.bindevent(); },
}, add: function () {
edit: function () { Controller.api.bindevent();
Controller.api.bindevent(); },
}, edit: function () {
verification_qr_code: function () { Controller.api.bindevent();
Controller.api.bindevent(); },
}, verification_qr_code: function () {
api: { Controller.api.bindevent();
bindevent: function () { },
Form.api.bindevent($("form[role=form]")); api: {
$(document).on('change','input[name="row[organizing_method]"]',function (){ bindevent: function () {
var type=$(this).val(); Form.api.bindevent($("form[role=form]"));
switch (type){ $(document).on('change','input[name="row[organizing_method]"]',function (){
case "1": var type=$(this).val();
$('.address').addClass('hide'); switch (type){
$('.url').removeClass('hide'); case "1":
break; $('.address').addClass('hide');
case "2": $('.url').removeClass('hide');
$('.url').addClass('hide'); break;
$('.address').removeClass('hide'); case "2":
break; $('.url').addClass('hide');
} $('.address').removeClass('hide');
}); break;
$(document).on('change','input[name="row[is_verifying]"]',function (){ }
var type=$(this).val(); });
switch (type){ $(document).on('change','input[name="row[is_verifying]"]',function (){
case "1"://需要核销 var type=$(this).val();
$('.verification_method').removeClass('hide'); switch (type){
break; case "1"://需要核销
case "2"://不需要核销 $('.verification_method').removeClass('hide');
$('.verification_method').addClass('hide'); break;
$('.verifying_wechat_ids').addClass('hide'); case "2"://不需要核销
break; $('.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){ $(document).on('change','input[name="row[verification_method]"]',function (){
case "1"://核销方式:自动签到 var type=$(this).val();
$('.verifying_wechat_ids').addClass('hide'); switch (type){
break; case "1"://核销方式:自动签到
case "2"://核销方式:管理员核销 $('.verifying_wechat_ids').addClass('hide');
$('.verifying_wechat_ids').removeClass('hide'); break;
break; case "2"://核销方式:管理员核销
} $('.verifying_wechat_ids').removeClass('hide');
}); break;
$(document).on('change','input[name="row[points_status]"]',function (){ }
var type=$(this).val(); });
switch (type){ $(document).on('change','input[name="row[points_status]"]',function (){
case "1"://能活动积分 var type=$(this).val();
$('.points').removeClass('hide'); switch (type){
break; case "1"://能活动积分
case "2"://不能活动积分 $('.points').removeClass('hide');
$('.points').addClass('hide'); break;
break; case "2"://不能活动积分
} $('.points').addClass('hide');
}); break;
$(document).on('change','input[name="row[certificate_enabled]"]',function (){ }
var type=$(this).val(); });
switch (type){ $(document).on('change','input[name="row[certificate_enabled]"]',function (){
case "1"://启用单独证书 var type=$(this).val();
$('.certificate_data').removeClass('hide'); switch (type){
break; case "1"://启用单独证书
case "2"://使用统一证书 $('.certificate_data').removeClass('hide');
$('.certificate_data').addClass('hide'); break;
break; case "2"://使用统一证书
} $('.certificate_data').addClass('hide');
}); break;
} }
} });
}; }
return Controller; }
}); };
return Controller;
});

View File

@@ -1,97 +1,98 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = { var Controller = {
index: function () { index: function () {
// 初始化表格参数配置 // 初始化表格参数配置
Table.api.init({ Table.api.init({
extend: { extend: {
index_url: 'wdsxh/activity/activity_apply/index' + location.search + '&activity_id=' + Config.activity_id, 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, add_url: 'wdsxh/activity/activity_apply/add?activity_id=' + Config.activity_id,
multi_url: 'wdsxh/activity/activity_apply/multi', multi_url: 'wdsxh/activity/activity_apply/multi',
import_url: 'wdsxh/activity/activity_apply/import', import_url: 'wdsxh/activity/activity_apply/import',
table: 'wdsxh_activity_apply', table: 'wdsxh_activity_apply',
} }
}); });
var table = $("#table"); var table = $("#table");
// 初始化表格 // 初始化表格
table.bootstrapTable({ table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url, url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id', pk: 'id',
sortName: 'id', sortName: 'id',
columns: [ columns: [
[ [
// {checkbox: true}, // {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'order_no', title: '订单号', operate: false}, {field: 'order_no', title: '订单号', operate: false},
{field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'}, {field: 'wechat.nickname', title: '用户昵称', operate: 'LIKE'},
{field: 'wechat.avatar', title: '用户头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'wechat.avatar', title: '用户头像', operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'wechat.mobile', title: '用户电话', operate: false}, {field: 'wechat.mobile', title: '用户电话', operate: false},
{field: 'activity.name', title: __('Activity.name'), operate: 'LIKE'}, {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.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.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: '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: '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: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'pay_time', title: __('付款时间'), operate:false}, {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: 'check_in_status', title: __('check_in_status'), searchList: {"checked_in":__('checked_in'),"unchecked_in":__('unchecked_in')}, formatter: Table.api.formatter.normal},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, {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},
buttons: [ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
{ buttons: [
name: 'field_data_details', {
text: __('报名信息'), name: 'field_data_details',
title: __('报名信息'), text: __('报名信息'),
classname: 'btn btn-xs btn-primary btn-dialog', title: __('报名信息'),
icon: 'fa', classname: 'btn btn-xs btn-primary btn-dialog',
extend: 'data-area=["100%","100%"]', icon: 'fa',
url: 'wdsxh/activity/activity_apply/field_data_details', extend: 'data-area=["100%","100%"]',
visible: function (row) { url: 'wdsxh/activity/activity_apply/field_data_details',
if(row.show_field_data == 1){ visible: function (row) {
return true; if(row.show_field_data == 1){
}else{ return true;
return false; }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.on('post-body.bs.table', function (e, settings, json, xhr) {
}) $(".btn-editone,.btn-edit,.btn-add").data("area", ["80%", "80%"]);
})
// 为表格绑定事件
Table.api.bindevent(table); // 为表格绑定事件
}, Table.api.bindevent(table);
add: function () { },
Controller.api.bindevent(); add: function () {
$(document).on('click','#select-user',function () { Controller.api.bindevent();
Fast.api.open('wdsxh/member/member/activity_seluser?activity_id='+ Config.activity_id,'选择用户',{ $(document).on('click','#select-user',function () {
area:['80%','95%'], Fast.api.open('wdsxh/member/member/activity_seluser?activity_id='+ Config.activity_id,'选择用户',{
callback:function(data){ area:['80%','95%'],
console.log(data); callback:function(data){
if(data){ console.log(data);
$('#c-uid').val(data.id); if(data){
$('#c-user').val(data.nickname); $('#c-uid').val(data.id);
}else{ $('#c-user').val(data.nickname);
Layer.alert("请选择用户"); }else{
} Layer.alert("请选择用户");
} }
}); }
}); });
}, });
field_data_details: function () { },
Controller.api.bindevent(); field_data_details: function () {
}, Controller.api.bindevent();
api: { },
bindevent: function () { api: {
Form.api.bindevent($("form[role=form]")); bindevent: function () {
} Form.api.bindevent($("form[role=form]"));
} }
}; }
return Controller; };
}); return Controller;
});