Compare commits
23 Commits
e2c8ae752d
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| ef525ac05d | |||
| 0388fafc0f | |||
| b4ab15fae0 | |||
| a70bc231be | |||
| 742254c55d | |||
| 43a4a1a8dd | |||
| 1f24148801 | |||
| e078a2689b | |||
| bdc0ff2399 | |||
| 317016f2a8 | |||
| 370a994ba8 | |||
| 0756cb91d4 | |||
| 1698794311 | |||
| 47cdd4c92d | |||
| 4537d070c8 | |||
| 97b77e179d | |||
| a9751ef42c | |||
| 3e735efd23 | |||
| 18aae7e3e0 | |||
| 52c0b234db | |||
| 507894c8b4 | |||
| 2180501efd | |||
| 76a6e430b9 |
@@ -35,11 +35,15 @@ class Level extends Backend
|
|||||||
protected $model = null;
|
protected $model = null;
|
||||||
protected $modelValidate = true;
|
protected $modelValidate = true;
|
||||||
protected $pay_method = null;
|
protected $pay_method = null;
|
||||||
|
protected $join_config_model = null;
|
||||||
|
protected $benefits_project_model = null;
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
$this->model = new \app\admin\model\wdsxh\member\Level;
|
$this->model = new \app\admin\model\wdsxh\member\Level;
|
||||||
|
$this->join_config_model = new \app\admin\model\wdsxh\member\JoinConfig;
|
||||||
|
$this->benefits_project_model = new \app\admin\model\wdsxh\member\MemberBenefitsProject();
|
||||||
$this->view->assign("statusList", $this->model->getStatusList());
|
$this->view->assign("statusList", $this->model->getStatusList());
|
||||||
$pay_method = (new FeesConfig())->where('id',1)->value('pay_method');
|
$pay_method = (new FeesConfig())->where('id',1)->value('pay_method');
|
||||||
$this->pay_method = $pay_method;
|
$this->pay_method = $pay_method;
|
||||||
@@ -103,6 +107,30 @@ class Level extends Backend
|
|||||||
$this->error(__('No rows were deleted'));
|
$this->error(__('No rows were deleted'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据入会类型筛选权益
|
||||||
|
*
|
||||||
|
* @param type $param
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public function benefits()
|
||||||
|
{
|
||||||
|
$join_config_id = $this->request->get('join_config_id');
|
||||||
|
$benefits_project = $this->benefits_project_model->getSimpleByStatus(0, $join_config_id);
|
||||||
|
if (empty($benefits_project)) {
|
||||||
|
return json([
|
||||||
|
'code' => 1,
|
||||||
|
'msg' => __('No benefits found'),
|
||||||
|
'data' => []
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return json([
|
||||||
|
'code' => 0,
|
||||||
|
'msg' => 'success',
|
||||||
|
'data' => $benefits_project,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*
|
*
|
||||||
@@ -112,6 +140,12 @@ class Level extends Backend
|
|||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
|
$benefits_project = $this->benefits_project_model->getSimpleByStatus(0);
|
||||||
|
$this->view->assign('benefits_project', $benefits_project);
|
||||||
|
|
||||||
|
$join_config = $this->join_config_model->getSimpleByStatus();
|
||||||
|
$this->view->assign('join_config', $join_config);
|
||||||
|
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
$params = $this->request->post('row/a');
|
$params = $this->request->post('row/a');
|
||||||
@@ -166,6 +200,16 @@ class Level extends Backend
|
|||||||
$this->error(__('You have no permission'));
|
$this->error(__('You have no permission'));
|
||||||
}
|
}
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
|
$benefits_project = $this->benefits_project_model->getSimpleByStatus(0);
|
||||||
|
$this->view->assign('benefits_project', $benefits_project);
|
||||||
|
|
||||||
|
$join_config = $this->join_config_model->getSimpleByStatus();
|
||||||
|
$this->view->assign('join_config', $join_config);
|
||||||
|
|
||||||
|
if (empty($row['benefits_project'])) {
|
||||||
|
$row['benefits_project'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
$this->view->assign('row', $row);
|
$this->view->assign('row', $row);
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|||||||
63
application/admin/controller/wdsxh/member/Rights.php
Executable file
63
application/admin/controller/wdsxh/member/Rights.php
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller\wdsxh\member;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员列表
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Rights extends Backend
|
||||||
|
{
|
||||||
|
protected $level_model = null;
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
$this->model = new \app\admin\model\wdsxh\member\MemberBenefits();
|
||||||
|
$this->view->assign("statusList", $this->model->getDisabledList());
|
||||||
|
|
||||||
|
$this->level_model = new \app\admin\model\wdsxh\member\Level;
|
||||||
|
$level_id = $this->request->get('level_id');
|
||||||
|
if (!empty($level_id)) {
|
||||||
|
$level = $this->level_model->get($level_id);
|
||||||
|
$this->view->assign('join_config_id', $level['join_config_id']);
|
||||||
|
}
|
||||||
|
$this->searchFields = ['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
|
$level_id = $this->request->get('level_id');
|
||||||
|
if (false === $this->request->isAjax()) {
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
||||||
|
if ($this->request->request('keyField')) {
|
||||||
|
return $this->selectpage();
|
||||||
|
}
|
||||||
|
|
||||||
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||||
|
$list = $this->model
|
||||||
|
->where(function($query) use($level_id) {
|
||||||
|
$query->where('level_id', $level_id);
|
||||||
|
})
|
||||||
|
->where($where)
|
||||||
|
->order($sort, $order)
|
||||||
|
->paginate($limit);
|
||||||
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||||
|
return json($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
68
application/admin/controller/wdsxh/member/RightsProject.php
Normal file
68
application/admin/controller/wdsxh/member/RightsProject.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\controller\wdsxh\member;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员列表
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class RightsProject extends Backend
|
||||||
|
{
|
||||||
|
protected $join_config_model = null;
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
$this->model = new \app\admin\model\wdsxh\member\MemberBenefitsProject();
|
||||||
|
$this->searchFields = ['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected $beforeActionList = [
|
||||||
|
'statusList' => ['only'=>'index'],
|
||||||
|
'joinConfig' => ['only'=>'add,edit'],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function statusList()
|
||||||
|
{
|
||||||
|
$this->view->assign("statusList", $this->model->getDisabledList());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function joinConfig()
|
||||||
|
{
|
||||||
|
$this->join_config_model = new \app\admin\model\wdsxh\member\JoinConfig();
|
||||||
|
$this->view->assign('join_config', $this->join_config_model->getSimpleByStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->request->filter(['strip_tags', 'trim']);
|
||||||
|
if (false === $this->request->isAjax()) {
|
||||||
|
return $this->view->fetch();
|
||||||
|
}
|
||||||
|
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
||||||
|
if ($this->request->request('keyField')) {
|
||||||
|
return $this->selectpage();
|
||||||
|
}
|
||||||
|
|
||||||
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||||
|
$list = $this->model
|
||||||
|
->with(['joinConfig'])
|
||||||
|
->where($where)
|
||||||
|
->order($sort, $order)
|
||||||
|
->paginate($limit);
|
||||||
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||||
|
return json($result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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' => '否',
|
||||||
|
|||||||
@@ -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' => '未核销',
|
||||||
|
|||||||
12
application/admin/lang/zh-cn/wdsxh/member/rights.php
Normal file
12
application/admin/lang/zh-cn/wdsxh/member/rights.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Member Benefits Title' => '权益名称',
|
||||||
|
'Member Benefits Image' => '权益图标',
|
||||||
|
'Member Benefits Desc' => '权益描述',
|
||||||
|
'Member Benefits Sort' => '排序',
|
||||||
|
'Member Benefits Status' => '状态',
|
||||||
|
'Member Benefits Enabled' => '显示',
|
||||||
|
'Member Benefits Disabled' => '隐藏',
|
||||||
|
'Member Benefits Operate' => '操作',
|
||||||
|
];
|
||||||
11
application/admin/lang/zh-cn/wdsxh/member/rights_project.php
Normal file
11
application/admin/lang/zh-cn/wdsxh/member/rights_project.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Member Benefits Project Join Config Name' => '入会类型',
|
||||||
|
'Member Benefits Project Name' => '权益项目',
|
||||||
|
'Member Benefits Project Sort' => '排序',
|
||||||
|
'Member Benefits Project Status' => '状态',
|
||||||
|
'Member Benefits Project Enabled' => '显示',
|
||||||
|
'Member Benefits Project Disabled' => '隐藏',
|
||||||
|
'Member Benefits Project Operate' => '操作',
|
||||||
|
];
|
||||||
@@ -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' => 'trial', // 正式版为 "release",体验版为 "trial",开发版为 "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' => 'trial', // 正式版为 "release",体验版为 "trial",开发版为 "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' => __('使用统一证书')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,12 @@ class JoinConfig extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSimpleByStatus($status = 'normal')
|
||||||
|
{
|
||||||
|
return Self::field(['id', 'name'])->where(function($query) use ($status) {
|
||||||
|
if (null !== $status) {
|
||||||
|
$query->where('status', '=', $status);
|
||||||
|
}
|
||||||
|
})->order('weigh', 'asc')->select();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ class Level extends Model
|
|||||||
protected $updateTime = 'updatetime';
|
protected $updateTime = 'updatetime';
|
||||||
protected $deleteTime = false;
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
protected $type = [
|
||||||
|
'benefits_project' => 'json',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
// 追加属性
|
// 追加属性
|
||||||
protected $append = [
|
protected $append = [
|
||||||
'status_text'
|
'status_text'
|
||||||
|
|||||||
68
application/admin/model/wdsxh/member/MemberBenefits.php
Normal file
68
application/admin/model/wdsxh/member/MemberBenefits.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\model\wdsxh\member;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class MemberBenefits extends Model
|
||||||
|
{
|
||||||
|
// 表名
|
||||||
|
protected $name = 'wdsxh_member_benefits';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'created_at';
|
||||||
|
protected $updateTime = 'updated_at';
|
||||||
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
'disabled_text'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected static function init()
|
||||||
|
{
|
||||||
|
self::afterInsert(function ($row) {
|
||||||
|
$pk = $row->getPk();
|
||||||
|
$row->getQuery()->where($pk, $row[$pk])->update(['sort' => $row[$pk]]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDisabledList()
|
||||||
|
{
|
||||||
|
return ['0' => __('Member Benefits Enabled'), '1' => __('Member Benefits Disabled')];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDisabledTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['disabled']) ? $data['disabled'] : '');
|
||||||
|
$list = $this->getDisabledList();
|
||||||
|
return isset($list[$value]) ? $list[$value] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSimpleByStatus($disabled = 0, $join_config_id = null)
|
||||||
|
{
|
||||||
|
return Self::field(['id', 'title'])->where(function($query) use ($disabled, $join_config_id) {
|
||||||
|
if (null !== $disabled) {
|
||||||
|
$query->where('disabled', '=', $disabled);
|
||||||
|
}
|
||||||
|
if (null !== $join_config_id) {
|
||||||
|
$query->where('join_config_id', '=', $join_config_id);
|
||||||
|
}
|
||||||
|
})->order('sort', 'asc')->select();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\admin\model\wdsxh\member;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
|
||||||
|
class MemberBenefitsProject extends Model
|
||||||
|
{
|
||||||
|
// 表名
|
||||||
|
protected $name = 'wdsxh_member_benefits_project';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'created_at';
|
||||||
|
protected $updateTime = 'updated_at';
|
||||||
|
protected $deleteTime = false;
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
'disabled_text'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function joinConfig()
|
||||||
|
{
|
||||||
|
return $this->hasOne(JoinConfig::class, 'id', 'join_config_id')->bind(['join_config_name' => 'name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected static function init()
|
||||||
|
{
|
||||||
|
self::afterInsert(function ($row) {
|
||||||
|
$pk = $row->getPk();
|
||||||
|
$row->getQuery()->where($pk, $row[$pk])->update(['sort' => $row[$pk]]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDisabledList()
|
||||||
|
{
|
||||||
|
return ['0' => __('Member Benefits Project Enabled'), '1' => __('Member Benefits Project Disabled')];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDisabledTextAttr($value, $data)
|
||||||
|
{
|
||||||
|
$value = $value ? $value : (isset($data['disabled']) ? $data['disabled'] : '');
|
||||||
|
$list = $this->getDisabledList();
|
||||||
|
return isset($list[$value]) ? $list[$value] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSimpleByStatus($disabled = 0, $join_config_id = null)
|
||||||
|
{
|
||||||
|
return Self::field(['id', 'name'])->where(function($query) use ($disabled, $join_config_id) {
|
||||||
|
if (null !== $disabled) {
|
||||||
|
$query->where('disabled', '=', $disabled);
|
||||||
|
}
|
||||||
|
if (null !== $join_config_id) {
|
||||||
|
$query->where('join_config_id', '=', $join_config_id);
|
||||||
|
}
|
||||||
|
})->order('sort', 'asc')->select();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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')}"
|
||||||
|
|||||||
@@ -12,6 +12,44 @@
|
|||||||
<input id="c-fees" data-rule="required" class="form-control" step="0.01" name="row[fees]" type="number" {if $pay_method == '1'}value="0.00"{/if}>
|
<input id="c-fees" data-rule="required" class="form-control" step="0.01" name="row[fees]" type="number" {if $pay_method == '1'}value="0.00"{/if}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-join-config" name="row[join_config_id]" class="selectpicker form-control" data-live-search="true" placeholder="请选择入会类型">
|
||||||
|
{foreach $join_config as $item}
|
||||||
|
<option value="{$item.id}">{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--会员权益项目-->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">会员权益项目:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-benefits" name="row[benefits_project][]" class="selectpicker form-control" multiple title="请选择权益项目" placeholder="请选择权益项目">
|
||||||
|
{foreach $benefits_project as $project}
|
||||||
|
<option value="{$project.id}">{$project.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--会员轮播背景图-->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">会员卡片:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" placeholder="请选择或上传图片">
|
||||||
|
<div class="input-group-addon no-border no-padding">
|
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> Upload</button></span>
|
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> Choose</button></span>
|
||||||
|
</div>
|
||||||
|
<span class="msg-box n-right" for="c-image"></span>
|
||||||
|
</div>
|
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
@@ -27,13 +65,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="statusList" item="vo"}
|
{foreach name="statusList" item="vo"}
|
||||||
<label for="row[status]-{$key|htmlentities}"><input id="row[status]-{$key|htmlentities}" name="row[status]" type="radio" value="{$key|htmlentities}" {in name="key" value="normal"}checked{/in} /> {$vo|htmlentities}</label>
|
<label for="row[status]-{$key|htmlentities}"><input id="row[status]-{$key|htmlentities}" name="row[status]" type="radio" value="{$key|htmlentities}" {in name="key" value="normal"}checked{/in} /> {$vo|htmlentities}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group layer-footer">
|
<div class="form-group layer-footer">
|
||||||
@@ -43,3 +79,236 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
// 获取DOM元素
|
||||||
|
var joinConfigSelect = document.getElementById('input-join-config');
|
||||||
|
var benefitsSelect = document.getElementById('input-benefits');
|
||||||
|
|
||||||
|
if (!joinConfigSelect || !benefitsSelect) return;
|
||||||
|
|
||||||
|
var pendingXhr = null;
|
||||||
|
var benefitsCache = {};
|
||||||
|
|
||||||
|
// 刷新 bootstrap-select (因为selectpicker需要jQuery,这里用原生方式触发)
|
||||||
|
function refreshSelectpicker(selectEl) {
|
||||||
|
// bootstrap-select 的刷新方法需要通过 jQuery 调用
|
||||||
|
if (typeof $ !== 'undefined' && $ && $(selectEl).selectpicker) {
|
||||||
|
$(selectEl).selectpicker('refresh');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置禁用状态
|
||||||
|
function setDisabled(selectEl, disabled) {
|
||||||
|
selectEl.disabled = disabled;
|
||||||
|
refreshSelectpicker(selectEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空已选中的权益值
|
||||||
|
function clearBenefitsSelected() {
|
||||||
|
// 清空所有option的selected状态
|
||||||
|
for (var i = 0; i < benefitsSelect.options.length; i++) {
|
||||||
|
benefitsSelect.options[i].selected = false;
|
||||||
|
}
|
||||||
|
// 同时设置select的值为空
|
||||||
|
benefitsSelect.value = '';
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 渲染权益选项
|
||||||
|
function renderBenefits(benefitsList) {
|
||||||
|
// 清空原有选项
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
|
||||||
|
if (!benefitsList || benefitsList.length === 0) {
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '暂无权益';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < benefitsList.length; i++) {
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.value = benefitsList[i].id;
|
||||||
|
option.textContent = benefitsList[i].title;
|
||||||
|
benefitsSelect.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 防XSS
|
||||||
|
function escapeHtml(str) {
|
||||||
|
if (!str) return '';
|
||||||
|
return String(str).replace(/[&<>]/g, function(m) {
|
||||||
|
if (m === '&') return '&';
|
||||||
|
if (m === '<') return '<';
|
||||||
|
if (m === '>') return '>';
|
||||||
|
return m;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求接口获取权益
|
||||||
|
function fetchBenefits(joinConfigId) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
if (!joinConfigId) {
|
||||||
|
resolve([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (benefitsCache[joinConfigId]) {
|
||||||
|
resolve(benefitsCache[joinConfigId]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var apiUrl = '/fxWbNZyTRt.php/wdsxh/member/level/benefits?join_config_id=' + encodeURIComponent(joinConfigId);
|
||||||
|
|
||||||
|
if (pendingXhr) {
|
||||||
|
pendingXhr.abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
pendingXhr = xhr;
|
||||||
|
xhr.open('GET', apiUrl, true);
|
||||||
|
xhr.timeout = 10000;
|
||||||
|
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
try {
|
||||||
|
var res = JSON.parse(xhr.responseText);
|
||||||
|
var benefitsList = [];
|
||||||
|
|
||||||
|
// 解析接口返回数据
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
benefitsList = res;
|
||||||
|
} else if (res && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
} else if (res && Array.isArray(res.list)) {
|
||||||
|
benefitsList = res.list;
|
||||||
|
} else if (res && res.code === 1 && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
} else if (res && res.code === 0 && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标准化格式
|
||||||
|
var normalized = [];
|
||||||
|
for (var i = 0; i < benefitsList.length; i++) {
|
||||||
|
var item = benefitsList[i];
|
||||||
|
var id = item.id || item.value || 0;
|
||||||
|
var title = item.title || item.name || item.label || '未命名';
|
||||||
|
if (id != 0) {
|
||||||
|
normalized.push({ id: id, title: title });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
benefitsCache[joinConfigId] = normalized;
|
||||||
|
resolve(normalized);
|
||||||
|
} catch(e) {
|
||||||
|
console.error('解析响应失败:', e);
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error('请求失败:', xhr.status);
|
||||||
|
reject(new Error('请求失败: ' + xhr.status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.onerror = function() {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
reject(new Error('网络错误'));
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.ontimeout = function() {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
reject(new Error('请求超时'));
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 入会类型变更处理
|
||||||
|
function onJoinConfigChange() {
|
||||||
|
var joinId = joinConfigSelect.value;
|
||||||
|
|
||||||
|
if (!joinId) {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '请先选择入会类型';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先清空已选中的权益值
|
||||||
|
clearBenefitsSelected();
|
||||||
|
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
|
||||||
|
fetchBenefits(joinId).then(function(benefitsList) {
|
||||||
|
if (!benefitsList.length) {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '暂无权益';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderBenefits(benefitsList);
|
||||||
|
}).catch(function() {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var errorOption = document.createElement('option');
|
||||||
|
errorOption.value = '';
|
||||||
|
errorOption.disabled = true;
|
||||||
|
errorOption.textContent = '加载失败,请重试';
|
||||||
|
benefitsSelect.appendChild(errorOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听入会类型变化
|
||||||
|
joinConfigSelect.addEventListener('change', onJoinConfigChange);
|
||||||
|
|
||||||
|
// 页面初始化
|
||||||
|
setTimeout(function() {
|
||||||
|
refreshSelectpicker(joinConfigSelect);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
|
||||||
|
var defaultJoinId = joinConfigSelect.value;
|
||||||
|
if (defaultJoinId) {
|
||||||
|
fetchBenefits(defaultJoinId).then(function(benefitsList) {
|
||||||
|
if (benefitsList.length) {
|
||||||
|
renderBenefits(benefitsList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '请先选择入会类型';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -12,6 +12,44 @@
|
|||||||
<input id="c-fees" data-rule="required" class="form-control" step="0.01" name="row[fees]" type="number" value="{$row.fees|htmlentities}">
|
<input id="c-fees" data-rule="required" class="form-control" step="0.01" name="row[fees]" type="number" value="{$row.fees|htmlentities}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-join-config" name="row[join_config_id]" class="selectpicker form-control" data-live-search="true" placeholder="请选择入会类型">
|
||||||
|
{foreach $join_config as $item}
|
||||||
|
<option value="{$item.id}" {eq name="row.join_config_id" value="$item.id"}selected{/eq}>{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--会员权益项目-->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">会员权益项目:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-benefits" name="row[benefits_project][]" class="selectpicker form-control" multiple title="请选择权益项目" placeholder="请选择权益项目">
|
||||||
|
{foreach $benefits_project as $project}
|
||||||
|
<option value="{$project.id}" {if in_array($project.id, $row.benefits_project)}selected{/if}>{$project.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--会员轮播背景图-->
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">会员卡片:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" value="{$row.image|htmlentities}" type="text" placeholder="请选择或上传图片">
|
||||||
|
<div class="input-group-addon no-border no-padding">
|
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> Upload</button></span>
|
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> Choose</button></span>
|
||||||
|
</div>
|
||||||
|
<span class="msg-box n-right" for="c-image"></span>
|
||||||
|
</div>
|
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
@@ -27,13 +65,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
{foreach name="statusList" item="vo"}
|
{foreach name="statusList" item="vo"}
|
||||||
<label for="row[status]-{$key|htmlentities}"><input id="row[status]-{$key|htmlentities}" name="row[status]" type="radio" value="{$key|htmlentities}" {in name="key" value="$row.status"}checked{/in} /> {$vo|htmlentities}</label>
|
<label for="row[status]-{$key|htmlentities}"><input id="row[status]-{$key|htmlentities}" name="row[status]" type="radio" value="{$key|htmlentities}" {in name="key" value="$row.status"}checked{/in} /> {$vo|htmlentities}</label>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group layer-footer">
|
<div class="form-group layer-footer">
|
||||||
@@ -43,3 +79,257 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
// 获取DOM元素
|
||||||
|
var joinConfigSelect = document.getElementById('input-join-config');
|
||||||
|
var benefitsSelect = document.getElementById('input-benefits');
|
||||||
|
|
||||||
|
if (!joinConfigSelect || !benefitsSelect) return;
|
||||||
|
|
||||||
|
var pendingXhr = null;
|
||||||
|
var benefitsCache = {};
|
||||||
|
|
||||||
|
// 保存原始的权益选中值(页面渲染时PHP已经设置的选中状态)
|
||||||
|
var originalSelectedBenefits = [];
|
||||||
|
for (var i = 0; i < benefitsSelect.options.length; i++) {
|
||||||
|
if (benefitsSelect.options[i].selected && benefitsSelect.options[i].value !== '') {
|
||||||
|
originalSelectedBenefits.push(benefitsSelect.options[i].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新 bootstrap-select
|
||||||
|
function refreshSelectpicker(selectEl) {
|
||||||
|
if (typeof $ !== 'undefined' && $ && $(selectEl).selectpicker) {
|
||||||
|
$(selectEl).selectpicker('refresh');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置禁用状态
|
||||||
|
function setDisabled(selectEl, disabled) {
|
||||||
|
selectEl.disabled = disabled;
|
||||||
|
refreshSelectpicker(selectEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空已选中的权益值
|
||||||
|
function clearBenefitsSelected() {
|
||||||
|
for (var i = 0; i < benefitsSelect.options.length; i++) {
|
||||||
|
benefitsSelect.options[i].selected = false;
|
||||||
|
}
|
||||||
|
benefitsSelect.value = '';
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置权益选中的值(用于初始化时还原选中项)
|
||||||
|
function setBenefitsSelected(selectedValues) {
|
||||||
|
for (var i = 0; i < benefitsSelect.options.length; i++) {
|
||||||
|
var option = benefitsSelect.options[i];
|
||||||
|
if (selectedValues.indexOf(option.value) !== -1) {
|
||||||
|
option.selected = true;
|
||||||
|
} else {
|
||||||
|
option.selected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 渲染权益选项
|
||||||
|
function renderBenefits(benefitsList, selectedValues) {
|
||||||
|
// 清空原有选项
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
|
||||||
|
if (!benefitsList || benefitsList.length === 0) {
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '暂无权益';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < benefitsList.length; i++) {
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.value = benefitsList[i].id;
|
||||||
|
option.textContent = benefitsList[i].title;
|
||||||
|
// 如果传入了选中值,且当前id在选中值中,则设置为选中
|
||||||
|
if (selectedValues && selectedValues.length && selectedValues.indexOf(String(benefitsList[i].id)) !== -1) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
benefitsSelect.appendChild(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求接口获取权益
|
||||||
|
function fetchBenefits(joinConfigId) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
if (!joinConfigId) {
|
||||||
|
resolve([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (benefitsCache[joinConfigId]) {
|
||||||
|
resolve(benefitsCache[joinConfigId]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var apiUrl = '/fxWbNZyTRt.php/wdsxh/member/level/benefits?join_config_id=' + encodeURIComponent(joinConfigId);
|
||||||
|
|
||||||
|
if (pendingXhr) {
|
||||||
|
pendingXhr.abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
pendingXhr = xhr;
|
||||||
|
xhr.open('GET', apiUrl, true);
|
||||||
|
xhr.timeout = 10000;
|
||||||
|
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState === 4) {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
try {
|
||||||
|
var res = JSON.parse(xhr.responseText);
|
||||||
|
var benefitsList = [];
|
||||||
|
|
||||||
|
if (Array.isArray(res)) {
|
||||||
|
benefitsList = res;
|
||||||
|
} else if (res && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
} else if (res && Array.isArray(res.list)) {
|
||||||
|
benefitsList = res.list;
|
||||||
|
} else if (res && res.code === 1 && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
} else if (res && res.code === 0 && Array.isArray(res.data)) {
|
||||||
|
benefitsList = res.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var normalized = [];
|
||||||
|
for (var i = 0; i < benefitsList.length; i++) {
|
||||||
|
var item = benefitsList[i];
|
||||||
|
var id = item.id || item.value || 0;
|
||||||
|
var title = item.title || item.name || item.label || '未命名';
|
||||||
|
if (id != 0) {
|
||||||
|
normalized.push({ id: id, title: title });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
benefitsCache[joinConfigId] = normalized;
|
||||||
|
resolve(normalized);
|
||||||
|
} catch(e) {
|
||||||
|
console.error('解析响应失败:', e);
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(new Error('请求失败: ' + xhr.status));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.onerror = function() {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
reject(new Error('网络错误'));
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.ontimeout = function() {
|
||||||
|
pendingXhr = null;
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
reject(new Error('请求超时'));
|
||||||
|
};
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 入会类型变更处理(切换时清空已选中的权益,重新加载)
|
||||||
|
function onJoinConfigChange() {
|
||||||
|
var joinId = joinConfigSelect.value;
|
||||||
|
|
||||||
|
if (!joinId) {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '请先选择入会类型';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换时清空已选中的权益值
|
||||||
|
clearBenefitsSelected();
|
||||||
|
|
||||||
|
setDisabled(benefitsSelect, false);
|
||||||
|
|
||||||
|
fetchBenefits(joinId).then(function(benefitsList) {
|
||||||
|
if (!benefitsList.length) {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '暂无权益';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换后不保留任何选中值(因为权益列表已变)
|
||||||
|
renderBenefits(benefitsList, []);
|
||||||
|
}).catch(function() {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var errorOption = document.createElement('option');
|
||||||
|
errorOption.value = '';
|
||||||
|
errorOption.disabled = true;
|
||||||
|
errorOption.textContent = '加载失败,请重试';
|
||||||
|
benefitsSelect.appendChild(errorOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听入会类型变化
|
||||||
|
joinConfigSelect.addEventListener('change', onJoinConfigChange);
|
||||||
|
|
||||||
|
// 页面初始化:根据当前选中的入会类型,重新加载对应的权益列表,并还原选中的权益值
|
||||||
|
setTimeout(function() {
|
||||||
|
refreshSelectpicker(joinConfigSelect);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
|
||||||
|
var defaultJoinId = joinConfigSelect.value;
|
||||||
|
if (defaultJoinId) {
|
||||||
|
// 根据当前入会类型加载权益列表,并尝试还原原始选中的权益值(匹配的才保留)
|
||||||
|
fetchBenefits(defaultJoinId).then(function(benefitsList) {
|
||||||
|
if (benefitsList.length) {
|
||||||
|
// 检查原始选中值中哪些在新列表中
|
||||||
|
var newBenefitIds = benefitsList.map(function(b) { return String(b.id); });
|
||||||
|
var matchedSelected = [];
|
||||||
|
for (var i = 0; i < originalSelectedBenefits.length; i++) {
|
||||||
|
if (newBenefitIds.indexOf(originalSelectedBenefits[i]) !== -1) {
|
||||||
|
matchedSelected.push(originalSelectedBenefits[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderBenefits(benefitsList, matchedSelected);
|
||||||
|
} else {
|
||||||
|
benefitsSelect.innerHTML = '';
|
||||||
|
var emptyOption = document.createElement('option');
|
||||||
|
emptyOption.value = '';
|
||||||
|
emptyOption.disabled = true;
|
||||||
|
emptyOption.textContent = '暂无权益';
|
||||||
|
benefitsSelect.appendChild(emptyOption);
|
||||||
|
refreshSelectpicker(benefitsSelect);
|
||||||
|
}
|
||||||
|
}).catch(function() {
|
||||||
|
console.error('初始化加载权益失败');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setDisabled(benefitsSelect, true);
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="one">
|
<div class="tab-pane fade active in" id="one">
|
||||||
@@ -21,7 +20,6 @@
|
|||||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('wdsxh/member/level/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('wdsxh/member/level/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('wdsxh/member/level/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/member/level/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
|
||||||
|
|
||||||
<div class="dropdown btn-group {:$auth->check('wdsxh/member/level/multi')?'':'hide'}">
|
<div class="dropdown btn-group {:$auth->check('wdsxh/member/level/multi')?'':'hide'}">
|
||||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||||
<ul class="dropdown-menu text-left" role="menu">
|
<ul class="dropdown-menu text-left" role="menu">
|
||||||
@@ -30,8 +28,6 @@
|
|||||||
{/foreach}
|
{/foreach}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</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/member/level/edit')}"
|
data-operate-edit="{:$auth->check('wdsxh/member/level/edit')}"
|
||||||
@@ -40,7 +36,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
62
application/admin/view/wdsxh/member/rights/add.html
Executable file
62
application/admin/view/wdsxh/member/rights/add.html
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益名称:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[title]" type="text" placeholder="请输入权益名称">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益介绍:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[desc]" cols="50" placeholder="请输入权益介绍"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益图片:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" placeholder="请选择或上传图片">
|
||||||
|
<div class="input-group-addon no-border no-padding">
|
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> Upload</button></span>
|
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> Choose</button></span>
|
||||||
|
</div>
|
||||||
|
<span class="msg-box n-right" for="c-image"></span>
|
||||||
|
</div>
|
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">状态:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
<input id="status_normal" name="row[disabled]" type="radio" value="0" checked> 显示
|
||||||
|
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="status_hidden" name="row[disabled]" type="radio" value="1"> 隐藏
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">排序:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" data-rule="required" class="form-control" name="row[sort]" type="number" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="hidden" name="row[join_config_id]" value="{$join_config_id}">
|
||||||
|
<input type="hidden" name="row[level_id]" value="{$Think.get.level_id}">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">确认</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
62
application/admin/view/wdsxh/member/rights/edit.html
Executable file
62
application/admin/view/wdsxh/member/rights/edit.html
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益名称:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[title]" value="{$row.title|htmlentities}" type="text" placeholder="请输入权益名称">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益介绍:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[desc]" cols="50" placeholder="请输入权益介绍">{$row.desc|htmlentities}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益图片:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" value="{$row.image|htmlentities}" type="text" placeholder="请选择或上传图片">
|
||||||
|
<div class="input-group-addon no-border no-padding">
|
||||||
|
<span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> Upload</button></span>
|
||||||
|
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> Choose</button></span>
|
||||||
|
</div>
|
||||||
|
<span class="msg-box n-right" for="c-image"></span>
|
||||||
|
</div>
|
||||||
|
<ul class="row list-inline faupload-preview" id="p-image"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">状态:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
<input id="status_normal" name="row[disabled]" type="radio" value="0" {eq name="row.disabled" value="0"}checked{/eq}> 显示
|
||||||
|
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="status_hidden" name="row[disabled]" type="radio" value="1" {eq name="row.disabled" value="1"}checked{/eq}> 隐藏
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">排序:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" data-rule="required" class="form-control" name="row[sort]" value="{$row.sort}" type="number" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input type="hidden" name="row[join_config_id]" value="{$join_config_id}">
|
||||||
|
<input type="hidden" name="row[level_id]" value="{$Think.get.level_id|htmlentities}">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">确认</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
46
application/admin/view/wdsxh/member/rights/index.html
Executable file
46
application/admin/view/wdsxh/member/rights/index.html
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
|
||||||
|
<div class="panel-heading">
|
||||||
|
{:build_heading(null,FALSE)}
|
||||||
|
<ul class="nav nav-tabs" data-field="disabled">
|
||||||
|
<li class="{:$Think.get.disabled === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
||||||
|
{foreach name="statusList" item="vo"}
|
||||||
|
<li class="{:$Think.get.disabled === (string)$key ? 'active' : ''}"><a href="#t-{$key|htmlentities}" data-value="{$key|htmlentities}" data-toggle="tab">{$vo|htmlentities}</a></li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
<a href="javascript:;" onclick="goBack();" class="btn btn-default">
|
||||||
|
<i class="fa fa-arrow-left"></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/member/rights/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('wdsxh/member/rights/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('wdsxh/member/rights/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('wdsxh/member/rights/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function goBack() {
|
||||||
|
// 直接跳转到列表页,而不是 history.back()
|
||||||
|
window.location.href = 'level';
|
||||||
|
// setTimeout(()=>{
|
||||||
|
// location.reload(true)
|
||||||
|
// console.log('强刷了')
|
||||||
|
// }, 150);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
48
application/admin/view/wdsxh/member/rights_project/add.html
Executable file
48
application/admin/view/wdsxh/member/rights_project/add.html
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益项目:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" placeholder="请输入权益名称">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-join-config" name="row[join_config_id]" class="selectpicker form-control" data-live-search="true" placeholder="请选择入会类型">
|
||||||
|
{foreach $join_config as $item}
|
||||||
|
<option value="{$item.id}">{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">状态:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
<input id="status_normal" name="row[disabled]" type="radio" value="0" checked> 显示
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="status_hidden" name="row[disabled]" type="radio" value="1"> 隐藏
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">排序:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" data-rule="required" class="form-control" name="row[sort]" type="number" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">确认</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
49
application/admin/view/wdsxh/member/rights_project/edit.html
Executable file
49
application/admin/view/wdsxh/member/rights_project/edit.html
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">权益项目:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-name" data-rule="required" class="form-control" name="row[name]" value="{$row.name|htmlentities}" type="text" placeholder="请输入权益项目">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="input-join-config" name="row[join_config_id]" class="selectpicker form-control" data-live-search="true" placeholder="请选择入会类型">
|
||||||
|
{foreach $join_config as $item}
|
||||||
|
<option value="{$item.id}" {eq name="row.join_config_id" value="$item.id"}selected{/eq}>{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">状态:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<div class="radio">
|
||||||
|
<label>
|
||||||
|
<input id="status_normal" name="row[disabled]" type="radio" value="0" {eq name="row.disabled" value="0"}checked{/eq}> 显示
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input id="status_hidden" name="row[disabled]" type="radio" value="1" {eq name="row.disabled" value="1"}checked{/eq}> 隐藏
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">排序:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" data-rule="required" class="form-control" name="row[sort]" value="{$row.sort}" type="number" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">确认</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
32
application/admin/view/wdsxh/member/rights_project/index.html
Executable file
32
application/admin/view/wdsxh/member/rights_project/index.html
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
|
||||||
|
<div class="panel-heading">
|
||||||
|
{:build_heading(null,FALSE)}
|
||||||
|
<ul class="nav nav-tabs" data-field="disabled">
|
||||||
|
<li class="{:$Think.get.disabled === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
||||||
|
{foreach name="statusList" item="vo"}
|
||||||
|
<li class="{:$Think.get.disabled === (string)$key ? 'active' : ''}"><a href="#t-{$key|htmlentities}" data-value="{$key|htmlentities}" data-toggle="tab">{$vo|htmlentities}</a></li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
<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/member/rights/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('wdsxh/member/rights/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('wdsxh/member/rights/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('wdsxh/member/rights/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -95,22 +95,52 @@ class Activity extends Api
|
|||||||
$this->error('请求类型错误');
|
$this->error('请求类型错误');
|
||||||
}
|
}
|
||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$data = $this->model
|
$activity = $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 (!$activity) {
|
||||||
$this->error('活动不存在');
|
$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;
|
||||||
|
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
|
||||||
|
if ($data['activity_state'] != 2) {
|
||||||
|
$activity->state = $data['activity_state'] = 2;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 当前时间大于结束时间,状态流转处于:已结束
|
||||||
|
if ($now > $data['end_time']) {
|
||||||
|
$data['actitity_state_trans'] = 4;
|
||||||
|
// 如果活动已结束,则根据当前时间更新状态
|
||||||
|
if ($data['activity_state'] != 3) {
|
||||||
|
$activity->state = $data['activity_state'] = 3;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 活动结束,状态流转就一直处理:已结束
|
||||||
|
$data['actitity_state_trans'] = 4;
|
||||||
|
}
|
||||||
|
|
||||||
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 +153,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())
|
||||||
@@ -263,6 +294,35 @@ class Activity extends Api
|
|||||||
$v->fees = $orderObj ? $orderObj['pay_amount'] : '';
|
$v->fees = $orderObj ? $orderObj['pay_amount'] : '';
|
||||||
$v->organizing_method = $activityObj['organizing_method'];
|
$v->organizing_method = $activityObj['organizing_method'];
|
||||||
$v->activity_state = $activityObj['state'];
|
$v->activity_state = $activityObj['state'];
|
||||||
|
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
|
||||||
|
if ($v->activity_state < 3) {
|
||||||
|
$now = time();
|
||||||
|
// 当前时间小于报名截止时间,状态流转处于:报名中
|
||||||
|
if ($now < $activityObj['apply_time']) $v->actitity_state_trans = 1;
|
||||||
|
// 当前时间大于等于报名截止时间小于开始时间,状态流转处于:未开始
|
||||||
|
if ($now >= $activityObj['apply_time'] && $now < $activityObj['start_time']) $v->actitity_state_trans = 2;
|
||||||
|
// 当前时间大于等于开始时间小于等于结束时间,状态流转处于:进行中
|
||||||
|
if ($now >= $activityObj['start_time'] && $now <= $activityObj['end_time']) {
|
||||||
|
$v->actitity_state_trans = 3;
|
||||||
|
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
|
||||||
|
if ($activityObj['state'] != 2) {
|
||||||
|
$activityObj->state = $v->activity_state = 2;
|
||||||
|
$activityObj->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 当前时间大于结束时间,状态流转处于:已结束
|
||||||
|
if ($now > $activityObj['end_time']) {
|
||||||
|
$v->actitity_state_trans = 4;
|
||||||
|
// 如果活动已结束,则根据当前时间更新状态
|
||||||
|
if ($activityObj['state'] != 3) {
|
||||||
|
$activityObj->state = $v->activity_state = 3;
|
||||||
|
$activityObj->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 活动结束,状态流转就一直处理:已结束
|
||||||
|
$v->actitity_state_trans = 4;
|
||||||
|
}
|
||||||
$v->refund = $activityObj['refund'];
|
$v->refund = $activityObj['refund'];
|
||||||
$v->url = $activityObj['url'];
|
$v->url = $activityObj['url'];
|
||||||
$v->is_verifying = $activityObj['is_verifying'];
|
$v->is_verifying = $activityObj['is_verifying'];
|
||||||
@@ -490,7 +550,3 @@ class Activity extends Api
|
|||||||
$this->success('请求成功',['show_status'=>$is_status]);
|
$this->success('请求成功',['show_status'=>$is_status]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -441,18 +441,49 @@ class ActivityApply extends Api
|
|||||||
try {
|
try {
|
||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
$apply_id = $this->request->get('apply_id');
|
$apply_id = $this->request->get('apply_id');
|
||||||
$data = (new \app\api\model\wdsxh\activity\Activity())
|
$activity = (new \app\api\model\wdsxh\activity\Activity())
|
||||||
->where('id',$id)
|
->where('id',$id)
|
||||||
->field('id,images,start_time,end_time,name,fees,state activity_state,
|
->field(['id', 'images', 'start_time', 'end_time', 'name', 'fees',
|
||||||
contacts,mobile,
|
'state' => 'activity_state', 'contacts', 'mobile', 'organizing_method',
|
||||||
organizing_method,url,address,longitude,latitude,content,
|
'url', 'address', 'longitude', 'latitude', 'content', 'refund',
|
||||||
refund,
|
'apply_time', 'activity_auth', 'is_verifying', 'verification_method',
|
||||||
apply_time,
|
'points_status', 'points'
|
||||||
activity_auth,is_verifying,verification_method,points_status,points')
|
])
|
||||||
->find();
|
->find();
|
||||||
if (!$data) {
|
if (!$activity) {
|
||||||
$this->error('活动不存在');
|
$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;
|
||||||
|
// 如果活动未结束,则根据当前时间校验活动状态并更新状态
|
||||||
|
if ($data['activity_state'] != 2) {
|
||||||
|
$activity->state = $data['activity_state'] = 2;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 当前时间大于结束时间,状态流转处于:已结束
|
||||||
|
if ($now > $data['end_time']) {
|
||||||
|
$data['actitity_state_trans'] = 4;
|
||||||
|
// 如果活动已结束,则根据当前时间更新状态
|
||||||
|
if ($data['activity_state'] != 3) {
|
||||||
|
$activity->state = $data['activity_state'] = 3;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 活动结束,状态流转就一直处理:已结束
|
||||||
|
$data['actitity_state_trans'] = 4;
|
||||||
|
}
|
||||||
if ($data['points_status'] == 2) {
|
if ($data['points_status'] == 2) {
|
||||||
unset($data['points']);
|
unset($data['points']);
|
||||||
}
|
}
|
||||||
@@ -470,6 +501,7 @@ class ActivityApply extends Api
|
|||||||
if (!$activityApplyObj) {
|
if (!$activityApplyObj) {
|
||||||
$this->error('报名信息不存在');
|
$this->error('报名信息不存在');
|
||||||
}
|
}
|
||||||
|
$data['check_in_status'] = $activityApplyObj['check_in_status'];
|
||||||
$data['pay_state'] = $activityApplyObj['state'];
|
$data['pay_state'] = $activityApplyObj['state'];
|
||||||
$data['apply_id'] = $apply_id;
|
$data['apply_id'] = $apply_id;
|
||||||
$activityRefundObj = (new Refund())
|
$activityRefundObj = (new Refund())
|
||||||
@@ -516,6 +548,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 +611,3 @@ class ActivityApply extends Api
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
143
application/api/controller/wdsxh/member/MemberBenefits.php
Normal file
143
application/api/controller/wdsxh/member/MemberBenefits.php
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\api\controller\wdsxh\member;
|
||||||
|
|
||||||
|
use app\common\controller\Api;
|
||||||
|
use think\Collection;
|
||||||
|
|
||||||
|
class MemberBenefits extends Api
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = ['join_config', 'index'];
|
||||||
|
protected $noNeedRight = ['*'];
|
||||||
|
|
||||||
|
protected $join_config_model = null;
|
||||||
|
protected $level_model = null;
|
||||||
|
protected $article_model = null;
|
||||||
|
protected $benefits_model = null;
|
||||||
|
protected $benefits_project_model = null;
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
$this->join_config_model = new \app\api\model\wdsxh\member\JoinConfig();
|
||||||
|
$this->level_model = new \app\api\model\wdsxh\member\Level();
|
||||||
|
$this->article_model = new \app\api\model\wdsxh\article\Article();
|
||||||
|
$this->benefits_model = new \app\api\model\wdsxh\member\MemberBenefits();
|
||||||
|
$this->benefits_project_model = new \app\api\model\wdsxh\member\MemberBenefitsProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入会类型
|
||||||
|
*
|
||||||
|
* @param type $param
|
||||||
|
* @return \think\Response
|
||||||
|
*/
|
||||||
|
public function join_config()
|
||||||
|
{
|
||||||
|
$list = $this->join_config_model->field(['id', 'name'])
|
||||||
|
->where('status', 'normal')
|
||||||
|
->order(['weigh' => 'asc', 'id' => 'asc'])
|
||||||
|
->select();
|
||||||
|
$this->success('获取成功', $list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据入会类型查询会员级别及权益(每个级别下展示入会类型所有权益,并标记拥有状态)
|
||||||
|
*
|
||||||
|
* @param int $join_config_id 入会类型ID
|
||||||
|
* @return \think\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$join_config_id = $this->request->param('join_config_id', 0);
|
||||||
|
|
||||||
|
if (empty($join_config_id)) {
|
||||||
|
$this->error('入会类型参数不能为空');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询该入会类型下的所有会员级别(按权重升序)
|
||||||
|
$levels = $this->level_model
|
||||||
|
->field(['id', 'join_config_id', 'benefits_project', 'name', 'image', 'fees', 'content'])
|
||||||
|
->where('join_config_id', $join_config_id)
|
||||||
|
->where('status', 'normal')
|
||||||
|
->order('weigh', 'asc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
// 查询该入会类型下的所有会员权益(按排序值升序,排除禁用的)
|
||||||
|
$levels_id = array_column($levels, 'id');
|
||||||
|
$all_benefits = $this->benefits_model
|
||||||
|
->field(['id', 'join_config_id', 'level_id', 'title', 'image', 'desc'])
|
||||||
|
->where('join_config_id', $join_config_id)
|
||||||
|
->where('level_id', 'in', $levels_id)
|
||||||
|
->where('disabled', 0)
|
||||||
|
->order('sort', 'asc')
|
||||||
|
->select();
|
||||||
|
$benefis_maps = [];
|
||||||
|
foreach ($all_benefits as $key => $val) {
|
||||||
|
$benefis_maps['b_' . $val['level_id']][] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询该入会类型下的所有会员权益项目(按排序值升序,排除禁用的)
|
||||||
|
$all_benefits_project = $this->benefits_project_model
|
||||||
|
->field(['id', 'join_config_id', 'name'])
|
||||||
|
->where('join_config_id', $join_config_id)
|
||||||
|
->where('disabled', 0)
|
||||||
|
->order('sort', 'asc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
$levels = collection($levels)->toArray();
|
||||||
|
// 为每个级别构建完整的权益列表(含 has 标记)
|
||||||
|
$result_levels = [];
|
||||||
|
foreach ($levels as $level) {
|
||||||
|
if (!isset($level['benefits'])) {
|
||||||
|
$level['benefits'] = [];
|
||||||
|
}
|
||||||
|
if (!empty($benefis_maps['b_' . $level['id']])) {
|
||||||
|
$level['benefits'][] = $benefis_maps['b_' . $level['id']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$owned_ids = json_decode($level['benefits_project'], true) ?: [];
|
||||||
|
$owned_ids = array_map('intval', $owned_ids);
|
||||||
|
unset($level['benefits_project']);
|
||||||
|
if (!isset($level['all_benefits_projects'])) {
|
||||||
|
$level['all_benefits_projects'] = [];
|
||||||
|
}
|
||||||
|
foreach ($all_benefits_project as $v) {
|
||||||
|
$level['all_benefits_projects'][] = [
|
||||||
|
'id' => $v['id'],
|
||||||
|
'join_config_id' => $v['join_config_id'],
|
||||||
|
'name' => $v['name'],
|
||||||
|
'has' => !empty($owned_ids) && in_array($v['id'], $owned_ids, true),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result_levels[] = $level;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 会员动态
|
||||||
|
$result_articles = $this->article_model->alias('a')
|
||||||
|
->field(['a.id', 'a.type', 'a.title', 'a.image', 'a.link', 'a.createtime'])
|
||||||
|
->join('wdsxh_article_cat c', 'c.id = a.cat_id')
|
||||||
|
->where('c.id', 4)
|
||||||
|
->where('c.status', '1')
|
||||||
|
->where('a.status', '1')
|
||||||
|
->order([
|
||||||
|
'a.weigh' => 'desc',
|
||||||
|
'a.id' => 'desc'
|
||||||
|
])
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$this->success('请求成功', [
|
||||||
|
'levels_benefits' => $result_levels,
|
||||||
|
'articles' => $result_articles,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,7 +65,3 @@ class Activity extends Base
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
35
application/api/model/wdsxh/member/MemberBenefits.php
Normal file
35
application/api/model/wdsxh/member/MemberBenefits.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Class MemberBenefits
|
||||||
|
* Desc 会员权益模型
|
||||||
|
* Create on 2024/3/8 9:56
|
||||||
|
* Create by wangyafang
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace app\api\model\wdsxh\member;
|
||||||
|
|
||||||
|
|
||||||
|
use app\api\model\wdsxh\Base;
|
||||||
|
|
||||||
|
class MemberBenefits extends Base
|
||||||
|
{
|
||||||
|
// 表名
|
||||||
|
protected $name = 'wdsxh_member_benefits';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = false;
|
||||||
|
protected $updateTime = false;
|
||||||
|
protected $deleteTime = false;
|
||||||
|
}
|
||||||
34
application/api/model/wdsxh/member/MemberBenefitsProject.php
Normal file
34
application/api/model/wdsxh/member/MemberBenefitsProject.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Class MemberBenefits
|
||||||
|
* Desc 会员权益项目模型
|
||||||
|
* Create on 2024/3/8 9:56
|
||||||
|
* Create by wangyafang
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace app\api\model\wdsxh\member;
|
||||||
|
|
||||||
|
|
||||||
|
use app\api\model\wdsxh\Base;
|
||||||
|
|
||||||
|
class MemberBenefitsProject extends Base
|
||||||
|
{
|
||||||
|
// 表名
|
||||||
|
protected $name = 'wdsxh_member_benefits_project';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = false;
|
||||||
|
protected $updateTime = false;
|
||||||
|
}
|
||||||
@@ -239,3 +239,6 @@
|
|||||||
max-width: 15rem;
|
max-width: 15rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
public/assets/addons/wdsxh/img/member_benefits_apply_1.png
Executable file
BIN
public/assets/addons/wdsxh/img/member_benefits_apply_1.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 133 KiB |
BIN
public/assets/addons/wdsxh/img/member_benefits_apply_2.png
Executable file
BIN
public/assets/addons/wdsxh/img/member_benefits_apply_2.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -1642,4 +1642,7 @@ table.table-nowrap thead > tr > th {
|
|||||||
.autocontent .autocontent-caret:hover {
|
.autocontent .autocontent-caret:hover {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
.bootstrap-select .dropdown-toggle {
|
||||||
|
background-color: #fff !important;
|
||||||
|
}
|
||||||
/*# sourceMappingURL=backend.css.map */
|
/*# sourceMappingURL=backend.css.map */
|
||||||
@@ -43,6 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
{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: '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: '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,
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
buttons:[
|
buttons:[
|
||||||
@@ -87,11 +88,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
extend: 'data-area=["40%","60%"]',
|
extend: 'data-area=["40%","60%"]',
|
||||||
url: 'wdsxh/activity/activity/verification_applet_code',
|
url: 'wdsxh/activity/activity/verification_applet_code',
|
||||||
visible: function (row) {
|
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;
|
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;
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
{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: '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: '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,
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
buttons: [
|
buttons: [
|
||||||
|
|||||||
@@ -39,6 +39,47 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|||||||
|
|
||||||
// 为表格绑定事件
|
// 为表格绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
|
// 添加跳转按钮函数
|
||||||
|
function addJumpButtons() {
|
||||||
|
var tbody = document.querySelector('table tbody');
|
||||||
|
if (!tbody) return;
|
||||||
|
|
||||||
|
var rows = tbody.querySelectorAll('tr');
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
var row = rows[i];
|
||||||
|
var lastTd = row.querySelector('td:last-child');
|
||||||
|
if (lastTd && !lastTd.querySelector('.btn-jump')) {
|
||||||
|
var rowIndex = row.getAttribute('data-index');
|
||||||
|
var rowData = table.bootstrapTable('getData')[rowIndex];
|
||||||
|
if (rowData && rowData.id) {
|
||||||
|
var jumpBtn = document.createElement('a');
|
||||||
|
jumpBtn.href = 'javascript:;';
|
||||||
|
jumpBtn.className = 'btn btn-xs btn-success btn-jump';
|
||||||
|
jumpBtn.setAttribute('data-id', rowData.id);
|
||||||
|
jumpBtn.style.marginLeft = '5px';
|
||||||
|
jumpBtn.innerHTML = '<i class="fa fa-external-link"></i> 权益';
|
||||||
|
|
||||||
|
// 绑定点击事件
|
||||||
|
jumpBtn.onclick = (function(id) {
|
||||||
|
return function() {
|
||||||
|
window.location.href = 'rights?level_id=' + id;
|
||||||
|
};
|
||||||
|
})(rowData.id);
|
||||||
|
|
||||||
|
lastTd.appendChild(jumpBtn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 延迟执行确保表格已加载
|
||||||
|
setTimeout(addJumpButtons, 500);
|
||||||
|
|
||||||
|
// 监听表格刷新完成事件
|
||||||
|
table.on('load-success.bs.table', function() {
|
||||||
|
setTimeout(addJumpButtons, 100);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
add: function () {
|
add: function () {
|
||||||
Controller.api.bindevent();
|
Controller.api.bindevent();
|
||||||
|
|||||||
90
public/assets/js/backend/wdsxh/member/rights.js
Executable file
90
public/assets/js/backend/wdsxh/member/rights.js
Executable file
@@ -0,0 +1,90 @@
|
|||||||
|
define(["jquery", "bootstrap", "backend", "table", "form"], function (
|
||||||
|
$,
|
||||||
|
undefined,
|
||||||
|
Backend,
|
||||||
|
Table,
|
||||||
|
Form,
|
||||||
|
) {
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: "wdsxh/member/rights/index" + location.search,
|
||||||
|
add_url: "wdsxh/member/rights/add" + location.search,
|
||||||
|
edit_url: "wdsxh/member/rights/edit" + location.search,
|
||||||
|
del_url: "wdsxh/member/rights/del",
|
||||||
|
table: "wdsxh_member_rights",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
pk: "id",
|
||||||
|
sortName: "sort",
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{ checkbox: true },
|
||||||
|
{ field: "id", title: __("Id") },
|
||||||
|
{
|
||||||
|
field: "title",
|
||||||
|
title: __("Member Benefits Title"),
|
||||||
|
operate: "LIKE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "desc",
|
||||||
|
title: __("Member Benefits Desc"),
|
||||||
|
operate: "LIKE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "image",
|
||||||
|
title: __("Member Benefits Image"),
|
||||||
|
operate: false,
|
||||||
|
formatter: Table.api.formatter.image,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "sort",
|
||||||
|
title: __("Member Benefits Sort"),
|
||||||
|
operate: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "disabled",
|
||||||
|
title: __("Member Benefits Status"),
|
||||||
|
searchList: {
|
||||||
|
0: __("Member Benefits Enabled"),
|
||||||
|
1: __("Member Benefits Disabled"),
|
||||||
|
},
|
||||||
|
custom: { 0: "success", 1: "gray" },
|
||||||
|
formatter: Table.api.formatter.status,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "operate",
|
||||||
|
title: __("Member Benefits Operate"),
|
||||||
|
table: table,
|
||||||
|
events: Table.api.events.operate,
|
||||||
|
formatter: Table.api.formatter.operate,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
||||||
84
public/assets/js/backend/wdsxh/member/rights_project.js
Executable file
84
public/assets/js/backend/wdsxh/member/rights_project.js
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
define(["jquery", "bootstrap", "backend", "table", "form"], function (
|
||||||
|
$,
|
||||||
|
undefined,
|
||||||
|
Backend,
|
||||||
|
Table,
|
||||||
|
Form,
|
||||||
|
) {
|
||||||
|
var Controller = {
|
||||||
|
index: function () {
|
||||||
|
// 初始化表格参数配置 rights_project.js
|
||||||
|
Table.api.init({
|
||||||
|
extend: {
|
||||||
|
index_url: "wdsxh/member/rights_project/index" + location.search,
|
||||||
|
add_url: "wdsxh/member/rights_project/add" + location.search,
|
||||||
|
edit_url: "wdsxh/member/rights_project/edit" + location.search,
|
||||||
|
del_url: "wdsxh/member/rights_project/del",
|
||||||
|
table: "wdsxh_member_rights_project",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $("#table");
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
table.bootstrapTable({
|
||||||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||||
|
pk: "id",
|
||||||
|
sortName: "sort",
|
||||||
|
columns: [
|
||||||
|
[
|
||||||
|
{ checkbox: true },
|
||||||
|
{ field: "id", title: __("Id") },
|
||||||
|
{
|
||||||
|
field: "join_config_name",
|
||||||
|
title: __("Member Benefits Project Join Config Name"),
|
||||||
|
operate: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "name",
|
||||||
|
title: __("Member Benefits Project Name"),
|
||||||
|
operate: "LIKE",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "sort",
|
||||||
|
title: __("Member Benefits Project Sort"),
|
||||||
|
operate: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "disabled",
|
||||||
|
title: __("Member Benefits Project Status"),
|
||||||
|
searchList: {
|
||||||
|
0: __("Member Benefits Project Enabled"),
|
||||||
|
1: __("Member Benefits Project Disabled"),
|
||||||
|
},
|
||||||
|
custom: { 0: "success", 1: "gray" },
|
||||||
|
formatter: Table.api.formatter.status,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "operate",
|
||||||
|
title: __("Member Benefits Project Operate"),
|
||||||
|
table: table,
|
||||||
|
events: Table.api.events.operate,
|
||||||
|
formatter: Table.api.formatter.operate,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 为表格绑定事件
|
||||||
|
Table.api.bindevent(table);
|
||||||
|
},
|
||||||
|
add: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
edit: function () {
|
||||||
|
Controller.api.bindevent();
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
bindevent: function () {
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return Controller;
|
||||||
|
});
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user