会员级别添加关联权益及图片
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -35,11 +35,13 @@ class Level extends Backend
|
||||
protected $model = null;
|
||||
protected $modelValidate = true;
|
||||
protected $pay_method = null;
|
||||
protected $member_benefit_model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\member\Level;
|
||||
$this->member_benefit_model = new \app\admin\model\wdsxh\member\MemberBenefits;
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$pay_method = (new FeesConfig())->where('id',1)->value('pay_method');
|
||||
$this->pay_method = $pay_method;
|
||||
@@ -112,6 +114,8 @@ class Level extends Backend
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$benefits = $this->member_benefit_model->getSimpleByStatus(0);
|
||||
$this->view->assign('benefits', $benefits);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
@@ -166,6 +170,8 @@ class Level extends Backend
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
if (false === $this->request->isPost()) {
|
||||
$benefits = $this->member_benefit_model->getSimpleByStatus(0);
|
||||
$this->view->assign('benefits', $benefits);
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -17,13 +17,13 @@ use think\Model;
|
||||
class Level extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_member_level';
|
||||
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
@@ -32,11 +32,15 @@ class Level extends Model
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $type = [
|
||||
'benefits_id' => 'json',
|
||||
];
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
@@ -46,7 +50,7 @@ class Level extends Model
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
|
||||
@@ -53,4 +53,13 @@ class MemberBenefits extends Model
|
||||
$list = $this->getDisabledList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getSimpleByStatus($disabled = 0)
|
||||
{
|
||||
return Self::field(['id', 'title'])->where(function($query) use ($disabled) {
|
||||
if (null !== $disabled) {
|
||||
$query->where('disabled', '=', $disabled);
|
||||
}
|
||||
})->order('sort', 'asc')->select();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,10 @@
|
||||
<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-group" name="" class="selectpicker form-control" multiple title="请选择权益" placeholder="请选择权益" >
|
||||
<option value="1">专属客服</option>
|
||||
<option value="2">优先发货</option>
|
||||
<option value="3">折扣优惠</option>
|
||||
<option value="4">积分加倍</option>
|
||||
<option value="5">免邮特权</option>
|
||||
<select id="input-group" name="row[benefits_id][]" class="selectpicker form-control" multiple title="请选择权益" placeholder="请选择权益" >
|
||||
{foreach $benefits as $benefit}
|
||||
<option value="{$benefit.id}">{$benefit.title}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -41,9 +38,9 @@
|
||||
<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">{:__('Content')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
@@ -59,7 +56,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
|
||||
<div class="radio">
|
||||
{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>
|
||||
|
||||
@@ -16,13 +16,10 @@
|
||||
<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-group" name="" class="selectpicker form-control" multiple title="请选择权益" placeholder="请选择权益" >
|
||||
<option value="1">专属客服</option>
|
||||
<option value="2">优先发货</option>
|
||||
<option value="3">折扣优惠</option>
|
||||
<option value="4">积分加倍</option>
|
||||
<option value="5">免邮特权</option>
|
||||
<select id="input-group" name="row[benefits_id][]" class="selectpicker form-control" multiple title="请选择权益" placeholder="请选择权益" >
|
||||
{foreach $benefits as $benefit}
|
||||
<option value="{$benefit.id}" {if condition="in_array($benefit.id, $row.benefits_id)"}selected{/if}>{$benefit.title}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,7 +28,7 @@
|
||||
<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="请选择或上传图片">
|
||||
<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>
|
||||
@@ -41,9 +38,9 @@
|
||||
<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">{:__('Content')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
@@ -59,7 +56,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
|
||||
<div class="radio">
|
||||
{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>
|
||||
|
||||
Reference in New Issue
Block a user