Commit 2de16e25 authored by hujun's avatar hujun

系统设置

parent cc358130
...@@ -114,7 +114,7 @@ class Setting extends Basic ...@@ -114,7 +114,7 @@ class Setting extends Basic
$config = new SystemConfig(); $config = new SystemConfig();
if ($this->request->isGet()) { if ($this->request->isGet()) {
//获取数据 //获取数据
$data = $config->getSetting(); $data = $config->getSettingV2();
} else { } else {
$config_name_arr = json_decode($this->params['config_name'], true); $config_name_arr = json_decode($this->params['config_name'], true);
foreach ($config_name_arr as $k =>$v) { foreach ($config_name_arr as $k =>$v) {
......
...@@ -48,4 +48,20 @@ class SystemConfig extends BaseModel ...@@ -48,4 +48,20 @@ class SystemConfig extends BaseModel
return $result; return $result;
} }
/**
* 获取参数设置
*
* @param array $where
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getSettingV2( $where = [], $field = 'id,config_name,config_type,rule') {
return $this->field($field)
->where($where)
->select();
}
} }
\ No newline at end of file
...@@ -24,10 +24,9 @@ define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], fu ...@@ -24,10 +24,9 @@ define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], fu
data: param, data: param,
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
console.log (data.data); var temp = document.getElementById('setting_list_tpl').innerHTML;
var temp = document.getElementById ('setting_list_tpl').innerHTML; var doTtmpl = doT.template(temp);
var doTtmpl = doT.template (temp); $("#info").html(doTtmpl(data.data));
$ ("#info").html (doTtmpl (data.data));
} }
}); });
}, },
......
<script id="setting_list_tpl" type="text/template"> <script id="setting_list_tpl" type="text/template">
<div class="form-group"> <div class="form-group">
[% for(var item in it){ %]
[% if (it[item]['config_type'] == 10) { %]
<label class="col-sm-4 control-label" style="text-align: right">商铺自动下架天数:</label>
<div class="col-sm-8">
<input type="number" class="form-control btn5" name="shop_day_num" placeholder="商铺自动下架天数" value="[%= it[item]['rule'] %]">
</div>
[% } else if (it[item]['config_type'] == 20) { %]
<label class="col-sm-4 control-label" style="text-align: right">是否使用隐号系统:</label> <label class="col-sm-4 control-label" style="text-align: right">是否使用隐号系统:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="radio" style="display: inline-block"> <div class="radio" style="display: inline-block">
...@@ -19,6 +26,7 @@ ...@@ -19,6 +26,7 @@
</label> </label>
</div> </div>
</div> </div>
<label class="col-sm-4 control-label" style="text-align: right">客户隐号绑定有效期(天数):</label> <label class="col-sm-4 control-label" style="text-align: right">客户隐号绑定有效期(天数):</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" class="form-control btn5" name="day_num" placeholder="隐号绑定天数" value="[%= it['day_num'] %]"> <input type="number" class="form-control btn5" name="day_num" placeholder="隐号绑定天数" value="[%= it['day_num'] %]">
...@@ -29,23 +37,22 @@ ...@@ -29,23 +37,22 @@
<input type="number" class="form-control btn5" name="landlord_phone_day" placeholder="隐号绑定天数" value="[%= it['landlord_phone_day'] %]"> <input type="number" class="form-control btn5" name="landlord_phone_day" placeholder="隐号绑定天数" value="[%= it['landlord_phone_day'] %]">
</div> </div>
<label class="col-sm-4 control-label" style="text-align: right">商铺自动下架天数</label> <label class="col-sm-4 control-label" style="text-align: right">业务员拨打电话限制</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" class="form-control btn5" name="shop_day_num" placeholder="商铺自动下架天数" value="[%= it['down_time'] %]"> <input type="number" class="form-control btn5" name="agent_call_day" placeholder="天数" value="[%= it['agent_call_day'] %]">
<input type="number" class="form-control btn5" name="agent_call_number" placeholder="次数" value="[%= it['agent_call_number'] %]">
</div> </div>
[% } else if (it[item]['config_type'] == 30) { %]
<label class="col-sm-4 control-label" style="text-align: right">新客户保护期有效小时数:</label> <label class="col-sm-4 control-label" style="text-align: right">新客户保护期有效小时数:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" class="form-control btn5" name="new_client_hours" placeholder="新客户保护期有效小时数" value="[%= it['new_client_hours'] %]"> <input type="number" class="form-control btn5" name="new_client_hours" placeholder="新客户保护期有效小时数" value="[%= it['new_client_hours'] %]">
</div> </div>
[% } else if (it[item]['config_type'] == 40) { %]
<label class="col-sm-4 control-label" style="text-align: right">业务员最多可查看的商铺数量:</label> <label class="col-sm-4 control-label" style="text-align: right">业务员最多可查看的商铺数量:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" class="form-control btn5" name="agent_shop_num" placeholder="业务员最多可查看的商铺数量" value="[%= it['agent_shop_num'] %]"> <input type="number" class="form-control btn5" name="agent_shop_num" placeholder="业务员最多可查看的商铺数量" value="[%= it['agent_shop_num'] %]">
</div> </div>
<label class="col-sm-4 control-label" style="text-align: right">业务员拨打电话限制:</label> [% } %]
<div class="col-sm-8"> [% } %]
<input type="number" class="form-control btn5" name="agent_call_day" placeholder="天数" value="[%= it['agent_call_day'] %]">
<input type="number" class="form-control btn5" name="agent_call_number" placeholder="次数" value="[%= it['agent_call_number'] %]">
</div>
</div> </div>
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment