添加全局返补比例设置布局
This commit is contained in:
parent
bf67ee94a0
commit
c3612b0f8c
@ -16,7 +16,10 @@ class Subsidy extends AdminBase
|
||||
$get = $this->request->get();
|
||||
return JsonServer::success('获取成功', SubsidyLogic::lists($get));
|
||||
}
|
||||
return view();
|
||||
|
||||
return view('', [
|
||||
'config' => SubsidyLogic::getSubsidyConfig()
|
||||
]);
|
||||
}
|
||||
|
||||
public function add()
|
||||
@ -59,4 +62,17 @@ class Subsidy extends AdminBase
|
||||
return JsonServer::error(SubsidyLogic::getError() ?: '操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 设置全局返补比例
|
||||
public function setSubsidyConfig()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
if (SubsidyLogic::setSubsidyConfig($post)) {
|
||||
return JsonServer::success('操作成功');
|
||||
}
|
||||
|
||||
return JsonServer::error(SubsidyLogic::getError() ?: '操作失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,8 @@ namespace app\admin\logic\goods;
|
||||
use app\common\basics\Logic;
|
||||
use app\common\model\goods\GoodsBrand;
|
||||
use app\common\model\goods\GoodsSubsidy;
|
||||
use app\common\server\ConfigServer;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -55,6 +57,7 @@ class SubsidyLogic extends Logic
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
@ -78,6 +81,7 @@ class SubsidyLogic extends Logic
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
@ -88,4 +92,38 @@ class SubsidyLogic extends Logic
|
||||
{
|
||||
return GoodsSubsidy::update(['is_delete' => 1, 'delete_time' => time()], ['id' => $id]);
|
||||
}
|
||||
|
||||
// 获取全局返补比例
|
||||
public static function getSubsidyConfig()
|
||||
{
|
||||
return [
|
||||
'promote_user' => ConfigServer::get('subsidy', 'promote_user'),
|
||||
'promote_store' => ConfigServer::get('subsidy', 'promote_store'),
|
||||
'platform_services' => ConfigServer::get('subsidy', 'platform_services'),
|
||||
'no_level' => ConfigServer::get('subsidy', 'no_level'),
|
||||
];
|
||||
}
|
||||
|
||||
// 设置全局返补比例
|
||||
public static function setSubsidyConfig($post)
|
||||
{
|
||||
try {
|
||||
if (empty($post['promote_user']) && empty($post['promote_store']) && empty($post['platform_services']) && empty($post['no_level'])) {
|
||||
self::$error = '所提交的字段内容不能为空';
|
||||
return false;
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
ConfigServer::set('subsidy', 'promote_user', str_replace('%', '', $post['promote_user']));
|
||||
ConfigServer::set('subsidy', 'promote_store', str_replace('%', '', $post['promote_store']));
|
||||
ConfigServer::set('subsidy', 'platform_services', str_replace('%', '', $post['platform_services']));
|
||||
ConfigServer::set('subsidy', 'no_level', str_replace('%', '', $post['no_level']));
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,9 @@
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.w-300 {
|
||||
.info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
@ -30,32 +32,40 @@
|
||||
|
||||
<fieldset class="layui-elem-field" style="margin: 10px 15px;">
|
||||
<legend>全平台</legend>
|
||||
<form id="all_platform">
|
||||
<form class="layui-form" id="all_platform">
|
||||
<div class="layui-field-box">
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">推广用户收益:</lable>
|
||||
<div class="w-300">
|
||||
<input type="text" name="promote_user" id="promote_user" placeholder="请输入推广用户收益" autocomplete="off" class="layui-input">
|
||||
<div class="info">
|
||||
<input value="{$config.promote_user}" type="text" name="promote_user" id="promote_user" placeholder="请输入推广用户收益" autocomplete="off" class="layui-input">
|
||||
<p style="margin-left: 10px">%</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">推广店铺收益:</lable>
|
||||
<div class="w-300">
|
||||
<input type="text" name="promote_store" id="promote_store" placeholder="请输入推广店铺收益" autocomplete="off" class="layui-input">
|
||||
<div class="info">
|
||||
<input value="{$config.promote_store}" type="text" name="promote_store" id="promote_store" placeholder="请输入推广店铺收益" autocomplete="off" class="layui-input">
|
||||
<p style="margin-left: 10px">%</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">平台服务费:</lable>
|
||||
<div class="w-300">
|
||||
<input type="text" name="platform_services" id="platform_services" placeholder="请输入平台服务费" autocomplete="off" class="layui-input">
|
||||
<div class="info">
|
||||
<input value="{$config.platform_services}" type="text" name="platform_services" id="platform_services" placeholder="请输入平台服务费" autocomplete="off" class="layui-input">
|
||||
<p style="margin-left: 10px">%</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: flex">
|
||||
<lable class="layui-form-label">无级码费用:</lable>
|
||||
<div class="w-300">
|
||||
<input type="text" name="no_level" id="no_level" placeholder="请输入无级码费用" autocomplete="off" class="layui-input">
|
||||
<div class="info">
|
||||
<input value="{$config.no_level}" type="text" name="no_level" id="no_level" placeholder="请输入无级码费用" autocomplete="off" class="layui-input">
|
||||
<p style="margin-left: 10px">%</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="add_subsidy_config" style="text-align: center;width: 450px;">
|
||||
<button class="layui-btn layui-btn-sm {$view_theme_color} layEvent" lay-submit lay-filter="submit">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
@ -229,5 +239,22 @@
|
||||
, {fixed: 'right', title: '操作', align: 'center', width: 300, toolbar: '#subsidy-operation'}
|
||||
]);
|
||||
|
||||
form.on('submit(submit)', function(data){
|
||||
like.ajax({
|
||||
url: '{:url("goods.subsidy/setSubsidyConfig")}',
|
||||
data: data.field,
|
||||
type: "post",
|
||||
success: function (res) {
|
||||
if (res.code == 1) {
|
||||
layui.layer.msg(res.msg, {
|
||||
offset: '15px'
|
||||
, icon: 1
|
||||
, time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user