Files
OMS/app/ome/view/admin/goods/detail/frame.html
2026-01-04 19:08:31 +08:00

110 lines
3.2 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<form action="index.php?app=ome&ctl=admin_goods_editor&act=toAdd&type=<{$type}>" method="post" name="gEditor" id="gEditor">
<input type="hidden" name="goods[goods_id]" value="<{$goods.goods_id}>" id="gEditor-GId-input"/>
<div id="gEditor-Body">
<{include file="admin/goods/detail/page.html"}>
</div>
</form>
<script>
var goodsEditor = null;
var goodsEditFrame = (function(){
goodsEditor = new omeShopExGoodsEditor('gEditor',{url:'<{$url}>',goods_id:'<{$goods.id}>'});
var SESS_ID='<{$session_id}>';
/*
* sign:{
1:保存并增加相似商品,
2:保存并返回,
3:保存当前不返回,
* }
*/
var _form=$('gEditor'),_formActionURL=_form.get('action');
subGoodsForm = function (event,sign){
var specOBJ='';
if($('productNode')&&$('productNode').retrieve('specOBJ')){
if(!$('productNode').retrieve('specOBJ').data.length){
return new MessageBox('请先添加货品!!!',{type:'error',autohide:true});
}
specOBJ=$('productNode').retrieve('specOBJ').toHideInput($('productNode').getElement('tr'));
}
var target={extraData:$('finder-tag').toQueryString()+'&'+specOBJ,onComplete:function(){}};
switch (sign){
case 1:
$extend(target,{
onComplete:function(){
clearOldValue();
}});
break;
case 2:
$extend(target,{
onComplete:function(rs){
if( JSON.decode(rs).success=='添加成功'){
var fg = opener.finderGroup;
for(fid in fg){
if(fid){
fg[fid].refresh();
}
}
window.close();
}
}}
);
break;
case 3:
$extend(target,{
onComplete:function(rs){
var fg = opener.finderGroup;
for(fid in fg){
if(fid){
fg[fid].refresh();
}
}
var id = JSON.decode(rs).goods_id;
if(id > 0){
$('gEditor-GId-input').value =id;
}
if(JSON.decode(rs).success){
history.go(0);
}
}}
);
break;
}
_form.store('target',target);
_form.set('action',_formActionURL+'&but='+sign).fireEvent('submit',new Event(event));
};
var clearOldValue=function(){
$('id_gname').set('value','');
$('gEditor-GId-input').set('value','');
if($$('.product_id').length)
$$('.product_id').each(function(el){
el.value='';
});
}
});
goodsEditFrame();
</script>