Files
OMS/app/finance/view/bill/setting.html
2026-01-04 19:08:31 +08:00

80 lines
3.1 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.
-->
<script>
var item_i=1;
</script>
<h5>费用项管理</h5>
<table class="gridlist" style="width:80%;cellspacing:0; cellpadding:0;margin-left:10%">
<tr>
<td>费用类</td>
<td></td>
<td></td>
</tr>
<{foreach from=$fee_item key=type_id item=item}>
<tr>
<td><{$item.name}></td>
<td></td>
<td><a href="javascript:void(0)" onclick="additem(<{$type_id}>)">增加费用项</a></td>
</tr>
<{foreach from=$item.item key=name item=items}>
<tr class="type_<{$type_id}>">
<td></td>
<td><{$items.name}></td>
<td><{if $items.inlay != 'true'}><a href="javascript:void(0)" onclick="delitem(this,<{$name}>)">删除</a><{/if}></td>
</tr>
<{/foreach}>
<{/foreach}>
</table>
<script>
function additem(e){
var i = item_i++;
var tpl="<td></td><td><input type='text' name='additem' id='add_"+e+'_'+i+"'><span style='color:red' id='show_"+e+'_'+i+"'></span></td><td><a href='javascript:void(0)' id='button_"+e+'_'+i+"' onclick='do_additem("+e+","+i+")'>确定</a></td>";
var location =$$('.type_'+e).getLast();
new Element('tr.type_'+e,{html:tpl}).injectAfter(location);
}
function do_additem(type_id,tmp_id){
var name = $('add_'+type_id+'_'+tmp_id).value;
new Request({url:'index.php?app=finance&ctl=bill_setting&act=do_additem',method:'post',data:'name='+name+'&fee_type_id='+type_id,
onSuccess:function(json){
rs = JSON.decode(json);
if(rs.rsp == 'fail'){
$('show_'+type_id+'_'+tmp_id).set('html',rs.msg);
}else if(rs.rsp == 'succ'){
$('add_'+type_id+'_'+tmp_id).getParent('td').set('html',rs.fee_item+"<span style='color:red' id='show_"+rs.fee_item_id+"'></span>");
$('button_'+type_id+'_'+tmp_id).getParent('td').set('html','<a href="javascript:void(0)" onclick="delitem(this,'+rs.fee_item_id+')">删除</a>');
}
}
}).send();
}
function delitem(obj,fee_item_id){
if(confirm('否删除费用项')){
new Request({url:'index.php?app=finance&ctl=bill_setting&act=do_delitem',method:'post',data:'fee_item_id='+fee_item_id,
onSuccess:function(json){
rs = JSON.decode(json);
if(rs.rsp == 'fail'){
return MessageBox.error(rs.msg);
}else if(rs.rsp == 'succ'){
obj.getParent('tr').remove();
}
}
}).send();
}else{
return;
}
}
</script>