后台修改
This commit is contained in:
parent
73d1cbfe44
commit
4148793380
@ -1245,6 +1245,21 @@ class Api extends BaseController
|
|||||||
return table_assign(0, '', $result);
|
return table_assign(0, '', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changestatus(){
|
||||||
|
$data = get_params();
|
||||||
|
if($data){
|
||||||
|
$where['product_id'] = $data['product_id'];
|
||||||
|
$d['is_show'] = $data['is_show'];
|
||||||
|
$res = Db::connect('shop')->table('eb_store_product')->where($where)->update($d);
|
||||||
|
if($res){
|
||||||
|
return to_assign(200, '操作成功');
|
||||||
|
}else{
|
||||||
|
return to_assign(0, '操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return to_assign(0, '操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class Product extends BaseController
|
|||||||
// request()->isAjax()
|
// request()->isAjax()
|
||||||
// Ajax 前端获取数据
|
// Ajax 前端获取数据
|
||||||
$params= get_params();
|
$params= get_params();
|
||||||
|
// halt($params);
|
||||||
$where = self::auth();
|
$where = self::auth();
|
||||||
|
|
||||||
if (isset($params['keywords']) && !empty($params['keywords'])){
|
if (isset($params['keywords']) && !empty($params['keywords'])){
|
||||||
@ -93,6 +93,7 @@ class Product extends BaseController
|
|||||||
$where['keyword'] = $where['store_name'] = $params['keywords'];
|
$where['keyword'] = $where['store_name'] = $params['keywords'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$page = empty($params['page'])?1:$params['page'];
|
$page = empty($params['page'])?1:$params['page'];
|
||||||
$limit = empty($params['limit'])?10:$params['limit'];
|
$limit = empty($params['limit'])?10:$params['limit'];
|
||||||
|
|
||||||
@ -108,17 +109,25 @@ class Product extends BaseController
|
|||||||
$where['is_show'] = empty($params['state'])?'':$params['state'];
|
$where['is_show'] = empty($params['state'])?'':$params['state'];
|
||||||
$where['temp_id'] = empty($params['shipping_tem'])?'':$params['shipping_tem'];
|
$where['temp_id'] = empty($params['shipping_tem'])?'':$params['shipping_tem'];
|
||||||
$where['labels'] = empty($params['tag'])?'':$params['tag'];
|
$where['labels'] = empty($params['tag'])?'':$params['tag'];
|
||||||
$where['type'] = empty($params['type'])?'':$params['type'];//实体商品:0 虚拟商品:1
|
$where['type'] = empty($params['type'])?'1':$params['type'];
|
||||||
// $where['status'] = 0;//管理、审核、通过
|
// $where['status'] = 0;//管理、审核、通过
|
||||||
|
// if(isset($params['type']) && !empty($params['type'])){
|
||||||
|
// if($params['type'] == 1){
|
||||||
|
// $where['is_show'] = 1;
|
||||||
|
// }
|
||||||
|
// if($params['type'] == 2){
|
||||||
|
// $where['is_show'] = 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// $where['is_ficti'] = 1;//是否虚拟销量
|
// $where['is_ficti'] = 1;//是否虚拟销量
|
||||||
// $where['product_id'] = 0;
|
// $where['product_id'] = 0;
|
||||||
// ['order','sort']
|
// ['order','sort']
|
||||||
// soft //软删除
|
// soft //软删除
|
||||||
// $params['mer_id'] = $this->mer_id;
|
// $params['mer_id'] = $this->mer_id;
|
||||||
if (!empty($params['mer_id'])) {
|
if (!empty($params['mer_id']) || !empty($this->mer_id)) {
|
||||||
$mer_id = get_params('mer_id');
|
// $mer_id = get_params('mer_id');
|
||||||
|
$mer_id = $this->mer_id;
|
||||||
$where = array_merge($where, $this->switchType($where['type'],$mer_id,0));
|
$where = array_merge($where, $this->switchType($where['type'],$mer_id,0));
|
||||||
}
|
}
|
||||||
$mer_id = isset($params['mer_id'])?$params['mer_id']:NULL;
|
$mer_id = isset($params['mer_id'])?$params['mer_id']:NULL;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<div class="layui-form">
|
<div class="layui-form">
|
||||||
<form id="filterform" class="layui-form gg-form-bar border-t border-x" >
|
<form id="filterform" class="layui-form gg-form-bar border-t border-x" >
|
||||||
<input id="protype" type="hidden" name="type" value="">
|
<input id="protype" type="hidden" name="type" value="1">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
|
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
@ -262,6 +262,22 @@
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
width:150,
|
width:150,
|
||||||
},{
|
},{
|
||||||
|
field: 'is_show',
|
||||||
|
title: '商品状态',
|
||||||
|
align: 'center',
|
||||||
|
width:150,
|
||||||
|
escape:true,
|
||||||
|
templet: function (d)
|
||||||
|
{
|
||||||
|
if (d.is_show == 1) {
|
||||||
|
return '<input type="checkbox" checked="checked" name="is_show" lay-filter="switchTest" lay-skin="switch" lay-text="上架|未上架" value="1" userId=' + d.product_id + '>'
|
||||||
|
} else if (d.is_show == 0) {
|
||||||
|
return '<input type="checkbox" name="is_show" lay-filter="switchTest" lay-skin="switch" lay-text="上架|未上架" value="0" userId=' + d.product_id + '>'
|
||||||
|
}
|
||||||
|
// var html = d.is_show ? '上架显示' : '平台关闭';
|
||||||
|
// return html;
|
||||||
|
},
|
||||||
|
},{
|
||||||
field: 'is_good',
|
field: 'is_good',
|
||||||
title: '推荐级别',
|
title: '推荐级别',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@ -281,16 +297,6 @@
|
|||||||
var html = d.is_used ? '显示' : '隐藏';
|
var html = d.is_used ? '显示' : '隐藏';
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
},{
|
|
||||||
field: 'is_show',
|
|
||||||
title: '商品状态',
|
|
||||||
align: 'center',
|
|
||||||
width:150,
|
|
||||||
templet: function (d)
|
|
||||||
{
|
|
||||||
var html = d.is_show ? '上架显示' : '平台关闭';
|
|
||||||
return html;
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
field: 'keyword',
|
field: 'keyword',
|
||||||
title: '标签',
|
title: '标签',
|
||||||
@ -355,7 +361,7 @@
|
|||||||
|
|
||||||
var $ = layui.$, active = {
|
var $ = layui.$, active = {
|
||||||
reload: function(){
|
reload: function(){
|
||||||
let dataRload = getformdata();;
|
let dataRload = getformdata();
|
||||||
//执行重载
|
//执行重载
|
||||||
table.reload('article', {
|
table.reload('article', {
|
||||||
page: {
|
page: {
|
||||||
@ -432,7 +438,33 @@
|
|||||||
active[type] ? active[type].call(this, othis) : '';
|
active[type] ? active[type].call(this, othis) : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
//监听指定开关
|
||||||
|
form.on('switch(switchTest)', function (data) { //根据lay-filter进行监听
|
||||||
|
console.log(this.checked ? "1" : "0");
|
||||||
|
var is_show = this.checked ? "1" : "0"; //锁定状态赋值为1,未锁定赋值为2,根据数据库中的值
|
||||||
|
console.log(data.elem.attributes['userId'].nodeValue); //获取修改数据的参数条件
|
||||||
|
$.ajax({
|
||||||
|
url: '/admin/api/changestatus',
|
||||||
|
type: 'post',
|
||||||
|
data: {
|
||||||
|
'product_id': data.elem.attributes['userId'].nodeValue,
|
||||||
|
'is_show': is_show
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
if(res.code==200){
|
||||||
|
layer.msg('操作成功');
|
||||||
|
}else{
|
||||||
|
layer.msg('操作失败');
|
||||||
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
location.reload();
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
form.render();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// 获取表单所有参数
|
// 获取表单所有参数
|
||||||
|
Loading…
x
Reference in New Issue
Block a user