admin sys city update that add fee carno
This commit is contained in:
@@ -11,12 +11,16 @@ class City extends HD_Controller{
|
||||
|
||||
private $city = array('北京市', '上海市', '重庆市', '天津市');
|
||||
|
||||
protected $log_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model("area_model");
|
||||
$this->load->model("sys/sys_city_model");
|
||||
$this->load->model('sys/sys_area_model');
|
||||
|
||||
$this->log_dir = 'sys_' . get_class($this);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
@@ -73,6 +77,7 @@ class City extends HD_Controller{
|
||||
'city_id' => $city_id,
|
||||
'firstchar' => $v['firstchar'],
|
||||
'name' => $v['name'],
|
||||
'fee_carno' => sprintf('%.2f', $v['fee_carno']),
|
||||
'checked' => $city_checked[$city_id] ? 1 : 0,
|
||||
'countys' => $map_checked[$city_id] ? $map_checked[$city_id] : array(),
|
||||
);
|
||||
@@ -196,6 +201,26 @@ class City extends HD_Controller{
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存挂牌价
|
||||
* @return bool
|
||||
*/
|
||||
function edit_fee(){
|
||||
$lists = $this->input->post('lists');
|
||||
$lists = json_decode($lists, true);
|
||||
foreach($lists as $k => $v){
|
||||
$upd = array('fee_carno' => $v['fee_carno']);
|
||||
$where = array('id' => $v['id']);
|
||||
//更新城市的状态
|
||||
$ret = $this->sys_city_model->update($upd, $where);
|
||||
if(!$ret){
|
||||
debug_log("[error]# " . $this->sys_city_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<tr>
|
||||
<th width="15%"><span>城市ID</span></th>
|
||||
<th width="15%"><span>城市名称</span></th>
|
||||
<th width="10%"><span>挂牌价</span></th>
|
||||
<th width="10%"><span>操作</span></th>
|
||||
<th width=""><span>区域</span></th>
|
||||
</tr>
|
||||
@@ -33,6 +34,9 @@
|
||||
<tr v-for="(v,i) in lists">
|
||||
<td>{{v.city_id}}</td>
|
||||
<td>{{v.name}}</td>
|
||||
<td>
|
||||
<input style="width: 100%" type="text" name="fee_carno" v-model="v.fee_carno">
|
||||
</td>
|
||||
<td>
|
||||
<a data-ajax="post" data-action="/sys/city/city/del" :data-params-id="v.id" class="am-btn am-btn-danger am-btn-xs">删除</a>
|
||||
</td>
|
||||
@@ -43,7 +47,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td style="text-align: left"><button data-title="保存" type="button" class="am-btn am-btn-success am-btn-xs" @click="save_fee">保存挂牌价</button></td>
|
||||
<td></td>
|
||||
<td style="text-align: left">
|
||||
<button data-title="保存" type="button" class="am-btn am-btn-success am-btn-xs" @click="save_area">保存区域设置</button>
|
||||
</td>
|
||||
@@ -126,6 +133,43 @@
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
},
|
||||
//保存挂牌价
|
||||
save_fee:function(){
|
||||
var vm = this;
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
|
||||
$.ajax({
|
||||
url: '/sys/city/city/edit_fee',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {lists:JSON.stringify(vm.lists)},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{}
|
||||
|
||||
@@ -95,6 +95,7 @@ create table lc_sys_city(
|
||||
status tinyint(1) not null default 1 comment '状态 -1删除 0:禁用 1:启用',
|
||||
primary key(id)
|
||||
)ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='开通城市表';
|
||||
alter table lc_sys_city add column fee_carno decimal(12,2) not null default 0.00 comment '挂牌价' after firstchar;
|
||||
|
||||
|
||||
drop table if exists lc_sys_config;
|
||||
|
||||
Reference in New Issue
Block a user