弹窗支持全屏操作

This commit is contained in:
devil 2020-07-30 22:18:57 +08:00
parent 33f1ff9b42
commit 9e7037d05c
8 changed files with 91 additions and 28 deletions

View File

@ -7,6 +7,10 @@
<i class="am-icon-edit"></i>
<span>编辑</span>
</a>
<a class="am-btn am-btn-success am-btn-xs am-radius am-btn-block" href="{{:MyUrl('admin/goods/saveinfo', array_merge($params, ['id'=>$module_data['id'], 'is_copy'=>1]))}}">
<i class="am-icon-copy"></i>
<span>复制</span>
</a>
<button type="button" class="am-btn am-btn-danger am-btn-xs am-radius am-btn-block submit-delete" data-url="{{:MyUrl('admin/goods/delete')}}" data-id="{{$module_data.id}}" data-key="ids">
<i class="am-icon-trash-o"></i>
<span>删除</span>

View File

@ -546,7 +546,7 @@
</div>
<div class="am-form-group am-form-group-refreshing">
<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
<input type="hidden" name="id" {{if isset($data) and !empty($data['id']) and (!isset($params['is_copy']) or $params['is_copy'] neq 1)}} value="{{$data.id}}"{{/if}} />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>
</form>

View File

@ -1,23 +1,21 @@
{{if !empty($data)}}
<ul class="am-gallery am-avg-sm-2 am-avg-md-4 am-avg-lg-4 am-gallery-bordered">
{{foreach $data as $v}}
<li data-gid="{{$v.id}}" data-add-html='<a href="javascript:;" class="am-icon-btn am-icon-plus am-success goods-add-submit" data-type="add"></a>' data-del-html='<a href="javascript:;" class="am-icon-btn am-icon-remove am-danger goods-del-submit" data-type="del"></a>'>
<div class="am-gallery-item am-radius">
<a href="{{$v.goods_url}}" target="_blank" title="{{$v.title}}">
<img src="{{$v.images}}" alt="{{$v.title}}" />
</a>
<h3 class="am-gallery-title">{{$v.title}}</h3>
<div class="icon-submit-container">
{{if isset($v['is_exist']) and $v['is_exist'] eq 1}}
<a href="javascript:;" class="am-icon-btn am-icon-remove am-danger goods-del-submit" data-type="del"></a>
{{else /}}
<a href="javascript:;" class="am-icon-btn am-icon-plus am-success goods-add-submit" data-type="add"></a>
{{/if}}
</div>
{{foreach $data as $v}}
<li data-gid="{{$v.id}}" data-add-html='<a href="javascript:;" class="am-icon-btn am-icon-plus am-success goods-add-submit" data-type="add"></a>' data-del-html='<a href="javascript:;" class="am-icon-btn am-icon-remove am-danger goods-del-submit" data-type="del"></a>'>
<div class="am-gallery-item am-radius">
<a href="{{$v.goods_url}}" target="_blank" title="{{$v.title}}">
<img src="{{$v.images}}" alt="{{$v.title}}" />
</a>
<h3 class="am-gallery-title">{{$v.title}}</h3>
<div class="icon-submit-container">
{{if isset($v['is_exist']) and $v['is_exist'] eq 1}}
<a href="javascript:;" class="am-icon-btn am-icon-remove am-danger goods-del-submit" data-type="del"></a>
{{else /}}
<a href="javascript:;" class="am-icon-btn am-icon-plus am-success goods-add-submit" data-type="add"></a>
{{/if}}
</div>
</li>
{{/foreach}}
</ul>
</div>
</li>
{{/foreach}}
{{else /}}
<div class="table-no"><i class="am-icon-warning"></i> 没有相关商品</div>
{{/if}}

View File

@ -15,8 +15,8 @@
<div class="am-popup-inner">
<div class="am-popup-hd">
<h4 class="am-popup-title">商品添加</h4>
<span data-am-modal-close
class="am-close">&times;</span>
<span class="am-icon-arrows-alt am-full"></span>
<span data-am-modal-close class="am-close">&times;</span>
</div>
<div class="am-popup-bd am-padding-0">
<form class="am-form am-padding-sm goods-add-container">
@ -54,7 +54,9 @@
<!-- 商品列表 -->
<div class="am-scrollable-vertical am-margin-top-sm am-padding-bottom-xs goods-list-container" data-loading-msg="搜索中..." data-add-url="{{:MyUrl('admin/warehousegoods/goodsadd')}}" data-del-url="{{:MyUrl('admin/warehousegoods/goodsdel')}}">
<div class="table-no"><i class="am-icon-warning"></i> 请搜索商品</div>
<ul class="am-gallery am-avg-sm-3 am-avg-md-4 am-avg-lg-5 am-gallery-bordered">
<div class="table-no"><i class="am-icon-warning"></i> 请搜索商品</div>
</ul>
</div>
<!-- 分页 -->

View File

@ -756,7 +756,7 @@ class WarehouseGoodsService
'inventory' => $inventory_total,
'upd_time' => time(),
];
if(!Db::name('Goods')->where(['id'=>$goods_id])->update($data))
if(Db::name('Goods')->where(['id'=>$goods_id])->update($data) === false)
{
return DataReturn('商品库存同步失败', -21);
}

View File

@ -40,7 +40,7 @@ $(function()
var $this = $(this);
$this.button('loading');
$('.goods-list-container').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
$.ajax({
url: url,
type: 'post',
@ -52,18 +52,18 @@ $(function()
if(res.code == 0)
{
$('.goods-list-container').attr('data-is-init', 0);
$('.goods-list-container').html(res.data.data);
$('.goods-list-container ul.am-gallery').html(res.data.data);
$('.goods-page-container').html(PageLibrary(res.data.total, res.data.page_size, res.data.page, 4));
} else {
Prompt(res.msg);
$('.goods-list-container').html('<div class="table-no"><i class="am-icon-warning"></i> '+res.msg+'</div>');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> '+res.msg+'</div>');
}
},
error:function(res)
{
$this.button('reset');
Prompt('请求失败');
$('.goods-list-container').html('<div class="table-no"><i class="am-icon-warning"></i> 请求失败</div>');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-warning"></i> 请求失败</div>');
}
});
});
@ -105,5 +105,20 @@ $(function()
});
});
// 弹窗全屏
$('#warehouse-goods-popup').on('click', '.am-popup-hd .am-full', function()
{
var width = $(window).width();
var height = $(window).height();
if(width >= 630 && height >= 630)
{
var $parent = $(this).parents('.am-popup');
if($parent.hasClass('popup-full'))
{
$parent.find('.am-gallery').addClass('am-avg-lg-5').removeClass('am-avg-lg-8');
} else {
$parent.find('.am-gallery').addClass('am-avg-lg-8').removeClass('am-avg-lg-6');
}
}
});
});

View File

@ -107,6 +107,38 @@ form.am-form .am-form-group-refreshing, .plug-file-upload-view, .content-app-ite
.popup-not-title .am-close:hover {
background: #f22a30;
}
.am-popup-hd .am-close, .am-popup-hd .am-full {
width: 26px;
height: 26px;
line-height: 26px;
color: #999;
text-align: center;
}
.am-popup-hd .am-close {
font-size: 22px;
opacity: 1;
}
.am-popup-hd .am-close:hover {
color: #f22a30;
transform: none;
}
.am-popup-hd .am-full {
position: absolute;
right: 40px;
top: 11px;
cursor: pointer;
}
.am-popup-hd .am-full:hover {
color: #03A9F4;
}
.popup-full {
width: 100%;
height: 100%;
left: 0;
top: 0;
margin-left: 0;
margin-top: 0;
}
/**

View File

@ -2498,4 +2498,16 @@ $(function()
MapInit(lng, lat, null, null, false);
});
// 弹窗全屏
$(document).on('click', '.am-popup-hd .am-full', function()
{
var $parent = $(this).parents('.am-popup');
if($parent.hasClass('popup-full'))
{
$parent.removeClass('popup-full');
} else {
$parent.addClass('popup-full');
}
});
});