mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-15 13:22:51 +00:00
产品管理添加移到回收站和回收站还原,修复产品属性编辑报错bug
This commit is contained in:
parent
6322868965
commit
50fe61491f
@ -348,7 +348,7 @@ class StoreProduct extends AuthController
|
||||
if(!$id) return $this->failed('数据不存在!');
|
||||
$result = StoreProductAttrResult::getResult($id);
|
||||
$image = ProductModel::where('id',$id)->value('image');
|
||||
$this->assign(compact('id','result','product','image'));
|
||||
$this->assign(compact('id','result','image'));
|
||||
return $this->fetch();
|
||||
}
|
||||
/**
|
||||
@ -426,10 +426,15 @@ class StoreProduct extends AuthController
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
|
||||
if(!$id) return $this->failed('数据不存在');
|
||||
if(!ProductModel::be(['id'=>$id])) return $this->failed('产品数据不存在');
|
||||
if(ProductModel::be(['id'=>$id,'is_del'=>1])){
|
||||
return Json::fail(ProductModel::getErrorInfo('暂不支持回收站删除产品!'));
|
||||
$data['is_del'] = 0;
|
||||
if(!ProductModel::edit($data,$id))
|
||||
return Json::fail(ProductModel::getErrorInfo('恢复失败,请稍候再试!'));
|
||||
else
|
||||
return Json::successful('成功恢复产品!');
|
||||
}else{
|
||||
$data['is_del'] = 1;
|
||||
if(!ProductModel::edit($data,$id))
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
</script>
|
||||
<!--操作-->
|
||||
<script type="text/html" id="act">
|
||||
<button type="button" class="layui-btn layui-btn-xs btn-success" onclick="$eb.createModalFrame('{{d.store_name}}-属性','{:Url('attr')}?id={{d.id}}',{h:700,w:800})">
|
||||
<button type="button" class="layui-btn layui-btn-xs btn-success" onclick="$eb.createModalFrame('{{d.store_name}}-属性','{:Url('attr')}?id={{d.id}}',{h:600,w:800})">
|
||||
属性
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.store_name}}-编辑','{:Url('edit')}?id={{d.id}}',{h:700,w:1100})">
|
||||
@ -131,11 +131,19 @@
|
||||
<a href="javascript:void(0);" onclick="$eb.createModalFrame(this.innerText,'{:Url('ump.store_combination/combination')}?id={{d.id}}')">
|
||||
<i class="fa fa-hand-lizard-o"></i> 开启拼团</a>
|
||||
</li>
|
||||
{{# if(d.is_del){ }}
|
||||
<li>
|
||||
<a href="javascript:void(0);" lay-event='delstor'>
|
||||
<i class="fa fa-trash"></i> 删除
|
||||
<i class="fa fa-trash"></i> 恢复产品
|
||||
</a>
|
||||
</li>
|
||||
{{# }else{ }}
|
||||
<li>
|
||||
<a href="javascript:void(0);" lay-event='delstor'>
|
||||
<i class="fa fa-trash"></i> 移到回收站
|
||||
</a>
|
||||
</li>
|
||||
{{# } }}
|
||||
<li>
|
||||
<a href="{:Url('store.storeProductReply/index')}?product_id={{d.id}}">
|
||||
<i class="fa fa-warning"></i> 评论查看
|
||||
@ -279,6 +287,8 @@
|
||||
switch (event) {
|
||||
case 'delstor':
|
||||
var url=layList.U({c:'store.store_product',a:'delete',q:{id:data.id}});
|
||||
if(data.is_del) var code = {title:"操作提示",text:"确定恢复产品操作吗?",type:'info',confirm:'是的,恢复该产品'};
|
||||
else var code = {title:"操作提示",text:"确定将该产品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
|
||||
$eb.$swal('delete',function(){
|
||||
$eb.axios.get(url).then(function(res){
|
||||
if(res.status == 200 && res.data.code == 200) {
|
||||
@ -289,7 +299,7 @@
|
||||
}).catch(function(err){
|
||||
$eb.$swal('error',err);
|
||||
});
|
||||
})
|
||||
},code)
|
||||
break;
|
||||
case 'open_image':
|
||||
$eb.openImage(data.image);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user