后台会员级别及会员权益关联入会类型
This commit is contained in:
@@ -35,13 +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 $member_benefit_model = null;
|
protected $benefit_model = null;
|
||||||
|
protected $join_config_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->member_benefit_model = new \app\admin\model\wdsxh\member\MemberBenefits;
|
$this->benefit_model = new \app\admin\model\wdsxh\member\MemberBenefits;
|
||||||
|
$this->join_config_model = new \app\admin\model\wdsxh\member\JoinConfig;
|
||||||
$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;
|
||||||
@@ -114,8 +116,12 @@ class Level extends Backend
|
|||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
if (false === $this->request->isPost()) {
|
if (false === $this->request->isPost()) {
|
||||||
$benefits = $this->member_benefit_model->getSimpleByStatus(0);
|
$benefits = $this->benefit_model->getSimpleByStatus(0);
|
||||||
$this->view->assign('benefits', $benefits);
|
$this->view->assign('benefits', $benefits);
|
||||||
|
|
||||||
|
$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');
|
||||||
@@ -170,11 +176,14 @@ 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 = $this->member_benefit_model->getSimpleByStatus(0);
|
$benefits = $this->benefit_model->getSimpleByStatus(0);
|
||||||
$this->view->assign('benefits', $benefits);
|
$this->view->assign('benefits', $benefits);
|
||||||
if (is_null($row['benefits_id'])) {
|
if (is_null($row['benefits_id'])) {
|
||||||
$row['benefits_id'] = [];
|
$row['benefits_id'] = [];
|
||||||
}
|
}
|
||||||
|
$join_config = $this->join_config_model->getSimpleByStatus();
|
||||||
|
$this->view->assign('join_config', $join_config);
|
||||||
|
|
||||||
$this->view->assign('row', $row);
|
$this->view->assign('row', $row);
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,16 @@ use app\common\controller\Backend;
|
|||||||
*/
|
*/
|
||||||
class Rights extends Backend
|
class Rights extends Backend
|
||||||
{
|
{
|
||||||
|
protected $join_config_model = null;
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
$this->model = new \app\admin\model\wdsxh\member\MemberBenefits();
|
$this->model = new \app\admin\model\wdsxh\member\MemberBenefits();
|
||||||
$this->view->assign("statusList", $this->model->getDisabledList());
|
$this->view->assign("statusList", $this->model->getDisabledList());
|
||||||
|
|
||||||
|
$this->join_config_model = new \app\admin\model\wdsxh\member\JoinConfig();
|
||||||
|
$this->view->assign('join_config', $this->join_config_model->getSimpleByStatus());
|
||||||
$this->searchFields = ['title'];
|
$this->searchFields = ['title'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ use think\Model;
|
|||||||
class JoinConfig extends Model
|
class JoinConfig extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表名
|
// 表名
|
||||||
protected $name = 'wdsxh_member_join_config';
|
protected $name = 'wdsxh_member_join_config';
|
||||||
|
|
||||||
// 自动写入时间戳字段
|
// 自动写入时间戳字段
|
||||||
protected $autoWriteTimestamp = false;
|
protected $autoWriteTimestamp = false;
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ class JoinConfig extends Model
|
|||||||
'type_text',
|
'type_text',
|
||||||
'status_text'
|
'status_text'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getTypeList()
|
public function getTypeList()
|
||||||
{
|
{
|
||||||
return ['1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3')];
|
return ['1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3')];
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,9 @@
|
|||||||
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
||||||
<option value="1">个人会员</option>
|
{foreach $join_config as $item}
|
||||||
<option value="2">单位会员</option>
|
<option value="{$item.id}">{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,8 +27,9 @@
|
|||||||
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
||||||
<option value="1" {eq name="row.join_config_id" value="1"}checked{/eq}>个人会员</option>
|
{foreach $join_config as $item}
|
||||||
<option value="2" {eq name="row.join_config_id" value="2"}checked{/eq}>单位会员</option>
|
<option value="{$item.id}" {eq name="row.join_config_id" value="$item.id"}selected{/eq}>{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,13 +6,14 @@
|
|||||||
<input id="c-name" data-rule="required" class="form-control" name="row[title]" type="text" placeholder="请输入权益名称">
|
<input id="c-name" data-rule="required" class="form-control" name="row[title]" type="text" placeholder="请输入权益名称">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
||||||
<option value="1">个人会员</option>
|
{foreach $join_config as $item}
|
||||||
<option value="2">单位会员</option>
|
<option value="{$item.id}">{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
<label class="control-label col-xs-12 col-sm-2">入会类型:</label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
<select id="input-group" name="row[join_config_id]" class="selectpicker form-control" placeholder="请选择入会类型" >
|
||||||
<option value="1" {eq name="row.join_config_id" value="1"}checked{/eq}>个人会员</option>
|
{foreach $join_config as $item}
|
||||||
<option value="2" {eq name="row.join_config_id" value="2"}checked{/eq}>单位会员</option>
|
<option value="{$item.id}" {eq name="row.join_config_id" value="$item.id"}selected{/eq}>{$item.name}</option>
|
||||||
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user