feat: 扫码签到功能

This commit is contained in:
2026-03-19 17:41:23 +08:00
parent e2c8ae752d
commit 1156b2f4e2
9 changed files with 457 additions and 349 deletions

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -42,7 +42,8 @@ class Activity extends Model
'state_text',
'is_verifying_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, [
'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' => __('使用统一证书')];
}
}

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-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>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('wdsxh/activity/activity_apply/edit')}"

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -94,23 +94,49 @@ class Activity extends Api
if(!$this->request->isGet()) {
$this->error('请求类型错误');
}
$id = $this->request->get('id');
$data = $this->model
$id = $this->request->get('id');
$activity = $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) {
if (!$activity) {
$this->error('活动不存在');
}
$data = $activity->toArray();
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
if ($data['activity_state'] < 3) {
$now = time();
// 当前时间小于报名截止时间,状态流转处于:报名中
if ($now < $data['apply_time']) $data['actitity_state_trans'] = 1;
// 当前时间大于等于报名截止时间小于开始时间,状态流转处于:未开始
if ($now >= $data['apply_time'] && $now < $data['start_time']) $data['actitity_state_trans'] = 2;
// 当前时间大于等于开始时间小于等于结束时间,状态流转处于:进行中
if ($now >= $data['start_time'] && $now <= $data['end_time']) {
$data['actitity_state_trans'] = 3;
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
$activity->state = $data['activity_state'] = 2;
$activity->save();
}
// 当前时间大于结束时间,状态流转处于:已结束
if ($now > $data['end_time']) {
$data['actitity_state_trans'] = 4;
// 如果活动已结束,则根据当前时间更新状态
$activity->state = $data['activity_state'] = 3;
$activity->save();
}
} else {
// 活动结束,状态流转就一直处理:已结束
$data['actitity_state_trans'] = 4;
}
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 +149,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 +517,3 @@ class Activity extends Api
$this->success('请求成功',['show_status'=>$is_status]);
}
}

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | 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)
{
$custom_field = array('name','mobile');
@@ -530,7 +579,3 @@ class ActivityApply extends Api
return $result;
}
}

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -65,7 +65,3 @@ class Activity extends Base
});
}
}

View File

@@ -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;
});

View File

@@ -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;
});