<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminConfigBuilder; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Core\Dao\ModelUtil; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Module\ModuleManager; use ModStart\Support\Concern\HasFields; use Module\Member\Biz\Vip\MemberVipBiz; use Module\Member\Util\MemberVipUtil; class MemberVipSetController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $enw1u) { $enw1u->init('member_vip_set')->field(function ($enw1u) { $enw1u->layoutPanel('基础信息', function ($enw1u) { $enw1u->id('id', 'ID')->addable(true)->editable(true)->ruleUnique('member_vip_set')->required()->defaultValue(ModelUtil::sortNext('member_vip_set', array(), 'id')); $enw1u->text('title', '名称')->required()->ruleUnique('member_vip_set'); $enw1u->text('flag', '英文标识')->required()->ruleUnique('member_vip_set'); $enw1u->switch('visible', '可见')->gridEditable(true)->tip('开启后前台用户可见'); $enw1u->switch('isDefault', '默认')->optionsYesNo()->help('会员是否默认为该等级')->required(); $enw1u->image('icon', '图标'); $enw1u->currency('price', '价格')->required(); $enw1u->number('vipDays', '时间')->required()->help('单位为天，365表示1年'); $enw1u->text('desc', '简要说明')->required(); $enw1u->richHtml('content', '详细说明')->required(); if (ModuleManager::getModuleConfig('Member', 'creditEnable', false)) { $enw1u->switch('creditPresentEnable', '赠送积分')->when('=', true, function ($hUMbi) { $hUMbi->number('creditPresentValue', '赠送积分数量'); })->optionsYesNo()->listable(false); } }); foreach (MemberVipBiz::all() as $rqlzz) { $enw1u->layoutPanel($rqlzz->title(), function ($enw1u) use($rqlzz) { $rqlzz->vipField($enw1u); }); } $enw1u->display('created_at', L('Created At'))->listable(false); $enw1u->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $zBPGV) { $zBPGV->like('title', '名称'); })->gridOperateAppend('
<a href="javascript:;" class="btn btn-primary" data-dialog-width="90%" data-dialog-height="90%" data-dialog-request="' . modstart_admin_url('member_vip_set/config') . '">
    <i class="iconfont icon-cog"></i>
    功能设置
</a>
<a href="javascript:;" class="btn btn-primary" data-dialog-width="90%" data-dialog-height="90%" data-dialog-request="' . modstart_admin_url('member_vip_right') . '">
    <i class="iconfont icon-cube"></i>
    权益设置
</a>
')->operateFixed('right')->enablePagination(false)->defaultOrder(array('sort', 'asc'))->canSort(true)->canShow(false)->title('用户VIP等级')->addDialogSize(array('600px', '95%'))->editDialogSize(array('600px', '95%'))->hookSaved(function (Form $hUMbi) { MemberVipUtil::clearCache(); }); } public function config(AdminConfigBuilder $enw1u) { goto xUrkA; QP1q2: return $enw1u->perform(); goto Romoz; IAs3T: $enw1u->pageTitle('功能设置'); goto Y9cCA; xUrkA: $enw1u->useDialog(); goto IAs3T; Y9cCA: $enw1u->richHtml('Member_VipContent', 'VIP开通说明')->help('默认为 VIP开通说明'); goto XLKYP; XLKYP: $enw1u->formClass('wide'); goto QP1q2; Romoz: } }