admin update for type and company_id mv from brand to biz
This commit is contained in:
@@ -32,10 +32,6 @@ class Brand extends HD_Controller
|
||||
$this->data['brand_name'] && $where["brand_name like '%" . $this->data['brand_name'] . "%'"] = null;
|
||||
$count = $this->bizBrand->count($where);
|
||||
$list = $this->bizBrand->select($where, 'id desc', $page, $pagesize);
|
||||
$typeAry = $this->bizBrand->type_ary();//类型
|
||||
foreach($list as &$brand){
|
||||
$brand['type_name'] = $typeAry[$brand['type']];
|
||||
}
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['_title'] = '品牌列表';
|
||||
@@ -47,7 +43,6 @@ class Brand extends HD_Controller
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$this->load->model("sys/sys_company_model", 'company_model');
|
||||
|
||||
if ($id) {
|
||||
$info = $this->bizBrand->get(array('id' => $id));
|
||||
@@ -56,20 +51,12 @@ class Brand extends HD_Controller
|
||||
}
|
||||
$action = '/biz/brand/brand/edit';
|
||||
} else {
|
||||
$info = array('type' => 0, 'company_id' => 0);
|
||||
$info = array();
|
||||
$action = '/biz/brand/brand/add';
|
||||
}
|
||||
|
||||
//获取公司ID列表
|
||||
$where = array('status' => 1);
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, short';
|
||||
$map_company = $this->company_model->map('id', 'short', $where, $orderby, 0, 0, $select);
|
||||
|
||||
$this->data['info'] = $info;
|
||||
$this->data['action'] = $action;
|
||||
$this->data['typeAry'] = $this->bizBrand->type_ary();
|
||||
$this->data['companyAry'] = $map_company;
|
||||
$this->data['_title'] = $id ? '编辑品牌' : '新增品牌';
|
||||
return $this->show_view('biz/brand/edit');
|
||||
}
|
||||
@@ -111,8 +98,6 @@ class Brand extends HD_Controller
|
||||
$add_brand_data = array(
|
||||
'brand_name' => $brand_name,
|
||||
'brand_logo' => $img,
|
||||
'type' => intval($type),
|
||||
'company_id' => intval($info['company_id']),
|
||||
'c_time' => time()
|
||||
);
|
||||
$brand_id = $this->bizBrand->add($add_brand_data);
|
||||
@@ -149,8 +134,6 @@ class Brand extends HD_Controller
|
||||
$add_brand_data = array(
|
||||
'brand_name' => $brand_name,
|
||||
'brand_logo' => $img,
|
||||
'type' => intval($type),
|
||||
'company_id' => intval($info['company_id']),
|
||||
);
|
||||
$this->bizBrand->update($add_brand_data, array('id' => $id));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
|
||||
@@ -158,10 +158,19 @@ class Store extends HD_Controller
|
||||
);
|
||||
}
|
||||
$this->data['citys'] = $rows_city;
|
||||
$biz = array('province_id' => '350');//默认福建城市
|
||||
$biz = array('province_id' => '350', 'type' => 0, 'company_id' => 0);//默认福建城市
|
||||
$this->data['biz'] = $biz;
|
||||
}
|
||||
|
||||
//获取公司ID列表
|
||||
$this->load->model("sys/sys_company_model", 'company_model');
|
||||
$where = array('status' => 1);
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, short';
|
||||
$map_company = $this->company_model->map('id', 'short', $where, $orderby, 0, 0, $select);
|
||||
|
||||
$this->data['typeAry'] = $this->biz_model->type_ary();
|
||||
$this->data['companyAry'] = $map_company;
|
||||
$this->data['_title'] = $id ? '编辑门店' : '新增门店';
|
||||
$this->show_view('biz/store/edit', true);
|
||||
}
|
||||
@@ -190,6 +199,8 @@ class Store extends HD_Controller
|
||||
$biz['address'] = $this->input->post('address', true);
|
||||
$biz['lat'] = $this->input->post('lat', true);
|
||||
$biz['lng'] = $this->input->post('lng', true);
|
||||
$biz['type'] = intval($this->input->post('type', true));
|
||||
$biz['company_id'] = intval($this->input->post('company_id', true));
|
||||
|
||||
//上传头像
|
||||
$biz['headimg'] = $this->input->post('headimg');
|
||||
@@ -248,6 +259,8 @@ class Store extends HD_Controller
|
||||
$biz['address'] = $this->input->post('address', true);
|
||||
$biz['lat'] = $this->input->post('lat', true);
|
||||
$biz['lng'] = $this->input->post('lng', true);
|
||||
$biz['type'] = intval($this->input->post('type', true));
|
||||
$biz['company_id'] = intval($this->input->post('company_id', true));
|
||||
|
||||
//上传头像
|
||||
$biz['headimg'] = $this->input->post('headimg');
|
||||
|
||||
@@ -22,24 +22,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input wp40">
|
||||
<select name="type" v-model="info.type">
|
||||
<option value="0">选择类型</option>
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">公司:</label>
|
||||
<div class="am-para-input wp40">
|
||||
<select name="type" v-model="info.company_id">
|
||||
<option value="0">选择公司</option>
|
||||
<option v-for="(v,i) in companyAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
|
||||
@@ -54,15 +36,12 @@
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info:{},
|
||||
action:'',
|
||||
typeAry:[]
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.action = '<?=$action?>';
|
||||
vm.typeAry = <?=json_encode($typeAry)?>;
|
||||
vm.companyAry = <?=json_encode($companyAry)?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>品牌名称</span></th>
|
||||
<th width="10%"><span>类型</span></th>
|
||||
<th width="30%"><span>品牌名称</span></th>
|
||||
<th width="35%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -33,7 +32,6 @@
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['brand_name'] ?></td>
|
||||
<td><?= $v['type_name'] ?></td>
|
||||
<td>
|
||||
<a href="javascript:void (0);" data-modal="/biz/brand/brand/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a> |
|
||||
|
||||
@@ -264,6 +264,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input wp20">
|
||||
<select name="type" v-model="info.type">
|
||||
<option value="0">选择类型</option>
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">公司:</label>
|
||||
<div class="am-para-input wp20">
|
||||
<select name="company_id" v-model="info.company_id">
|
||||
<option value="0">选择公司</option>
|
||||
<option v-for="(v,i) in companyAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">附加标签:</label>
|
||||
@@ -413,7 +431,10 @@
|
||||
brand_name: "<?=$biz['brand_name'] ? $biz['brand_name'] : ""?>",
|
||||
lists: {
|
||||
level3: <?=json_encode($brand_list)?>
|
||||
}
|
||||
},
|
||||
typeAry:<?=json_encode($typeAry)?>,
|
||||
companyAry:<?=json_encode($companyAry)?>,
|
||||
info:<?=json_encode($biz)?>
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
|
||||
@@ -16,19 +16,4 @@ class Biz_brand_model extends HD_Model
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
* @param null $key
|
||||
* @return mixed
|
||||
*/
|
||||
function type_ary($key = null){
|
||||
$map = array('1' => '直营店', '2' => '二网', '3' => '合作店');
|
||||
|
||||
if(!is_null($key)){
|
||||
return $map[$key];
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,19 @@ class Biz_model extends HD_Model
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
* @param null $key
|
||||
* @return mixed
|
||||
*/
|
||||
function type_ary($key = null){
|
||||
$map = array('1' => '合伙店', '2' => '加盟店', '3' => '代理店');
|
||||
|
||||
if(!is_null($key)){
|
||||
return $map[$key];
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ create table lc_biz (
|
||||
u_time timestamp not null default current_timestamp on update current_timestamp comment '更新时间',
|
||||
primary key (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商家表';
|
||||
alter table lc_biz add column type tinyint(1) not null default 0 comment '类型:1-直营店,2-二网,3-合作店' after floor;
|
||||
alter table lc_biz add column company_id int not null default 0 comment '公司ID' after type;
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:品牌表
|
||||
@@ -42,6 +44,8 @@ create table lc_biz_brand (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='品牌表';
|
||||
alter table lc_biz_brand add column type tinyint(1) not null default 0 comment '类型:1-直营店,2-二网,3-合作店' after brand_logo;
|
||||
alter table lc_biz_brand add column company_id int not null default 0 comment '公司ID' after type;
|
||||
alter table lc_biz_brand drop column type;
|
||||
alter table lc_biz_brand drop column company_id;
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:商家标签关系
|
||||
|
||||
Reference in New Issue
Block a user