Files
OMS/app/inventorydepth/view/regulation/frame_apply.html
2025-12-28 23:13:25 +08:00

209 lines
9.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
Copyright © ShopeX http://www.shopex.cn. All rights reserved.
See LICENSE file for license details.
-->
<div class='division'>
<h3><{$title}></h3>
<form method='post' action='index.php?app=inventorydepth&ctl=regulation_apply&act=save' id='regulation-apply-form'>
<input type='hidden' name='init_bn' value="<{$data.bn|default:$init_bn}>">
<input type='hidden' name='id' value="<{$data.id|default:''}>">
<div class='tableform'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th><span class="red">*</span> 应用编号:</th>
<td><input type='text' name='bn' value="<{$data.bn|default:''}>" vtype='required' class='x-input' <{if $data.bn}>readonly='readonly'<{/if}> ></td>
</tr>
<tr>
<th><span class="red">*</span> 应用名称:</th>
<td><{input type='text' name='heading' value=$data.heading vtype='required'}></td>
</tr>
<tr id='condition-tr'>
<th><span class="red">*</span> 规则类型:</th>
<td>
<{if $data.condition=='stock'}> 更新销售库存 <{elseif $data.condition=='frame'}> 更新商品上下架状态 <{/if}>
<input type='hidden' name='condition' value="<{$data.condition}>">
</td>
</tr>
<tr>
<th><span class="red">*</span> 触发类型:</th>
<td><{input type="select" required=true name="style" options=$options.style value=$data.style}></td>
</tr>
<tr id='apply-range'>
<th><span class="red">*</span> 应用范围:</th>
<td>
<input id='all_shop' type='checkbox' name='shop_id[]' value='_ALL_' <{if $data.shop_id.0 == '_ALL_'}>checked<{/if}> onclick='allShop(this);'>所有店铺
<ul id='shops' <{if $data.shop_id.0 == '_ALL_'}>style="display:none;"<{/if}>>
<{foreach from=$data.shops item=shop}>
<li class='span-auto' style='min-width: 118px;margin-bottom:5px;' ><input type='checkbox' name='shop_id[]' value='<{$shop.shop_id}>' <{if in_array($shop.shop_id,$data.shop_id)}>checked<{/if}> onchange="javascript:if(this.checked){this.getNext('span').setStyle('color','red');}else{this.getNext('span').setStyle('color','');}"><span <{if in_array($shop.shop_id,$data.shop_id)}>style='font-size:14px;font-weight:bold;color:red;' <{else}>style='font-size:14px;font-weight:bold;' <{/if}> ><{$shop.name}></span></li>
<{/foreach}>
<div class='clear'></div>
</ul>
</td>
</tr>
<tr>
<th><span class="red">*</span> 应用对象:</th>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class='choose' id='choose_frame' <{if $data.condition!='frame'}>style='display:none;'<{/if}>>
<td>
<div style='margin-bottom:5px;'><input type='checkbox' name='apply-goods-all' value='true' onclick="isAll(this);" <{if $data.apply_goods == '_ALL_'}>checked<{/if}> >全部商品</div>
<div <{if $data.apply_goods == '_ALL_' }>style="visibility:hidden;"<{/if}>>
<{input type='inventorydepth_object' object='shop_items@inventorydepth' multiple=true breakpoint='0' name='goods_id' textcol='title' value=$data.pgid callback='goods_object_callback' replacehtml=$replacehtml emptytext='添加店铺商品'}>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th>平台SKU ID:</th>
<td><textarea rows="6" cols="50" name="shop_sku_id" placeholder="如果一个OMS商品对应平台多个SKU ID且无需回写所有SKU ID请以逗号隔开所需回写SKU ID"><{$data.shop_sku_id}></textarea></td>
</tr>
<tr>
<th>专用供货仓:</th>
<td>
<select id="supply-branch-sel" name="supply_branch_bn[]" multiple>
<{foreach from=$branchOptions key=bn item=name}>
<option value="<{$bn}>" <{if is_array($data.supply_branch_bn) && in_array($bn, $data.supply_branch_bn)}>selected<{/if}>><{$name}></option>
<{/foreach}>
</select>
<{help}>专用供货仓,优先级高于店铺默认供货仓,留空则使用店铺默认供货仓<{/help}>
</td>
</tr>
<tr>
<th><span class="red">*</span> 应用规则:</th>
<td><{input type='object' object='regulation' multiple=false breakpoint='0' name='regulation_id' value=$data.regulation_id filter="type=2&using=true&condition={$data.condition}" }></td>
</tr>
<tr>
<th><span class="red">*</span> 开始时间:</th>
<td><{input type='time' name='start_time' value=$data.start_time vtype='required'}></td>
</tr>
<tr>
<th><span class="red">*</span> 结束时间:</th>
<td><{input type='time' name='end_time' value=$data.end_time vtype='required'}></td>
</tr>
<tr>
<th>规则应用等级</th>
<td><{input type='text' vtype='unsignedint' name='priority' value=$data.priority|default:99 size=8}>
<{help}>数值越大越先执行<{/help}>
</td>
</tr>
<tr>
<th><span class="red">*</span> 应用启用状态 :</th>
<td><{if $data.using=='true'}>启用<{else}>停用<{/if}></td>
</tr>
</tbody>
</table>
</div>
</form>
</div>
<{capture name='footbar'}>
<div class='table-action'>
<{button type='button' label='确认' id='regulation-apply-submit'}>
<{button type='button' label='取消' onclick='javascript:window.close();'}>
</div>
<{/capture}>
<script>
var change_url = function(url){
var newurl = url.split('&');
var gg = newurl.getLast();
var ii = newurl.indexOf(gg);
var ggg = gg.split('=');
var ggg_key = ggg[0];
var ggg_value = decodeURIComponent(ggg[1]);
if (!$('all_shop').checked){
$ES('#shops input[name="shop_id[]"]:checked').each(function(item){
ggg_value += '&filter[shop_id][]='+item.get('value');
});
}
ggg_value = encodeURIComponent(ggg_value);
gg = ggg_key+ '=' + ggg_value;
newurl[ii] = gg;
url = newurl.join('&');
return url;
};
function goods_object_callback(rs,handle){
var length = handle.getElements('.row').length;
var html = '已选择了'+length+'个商品,'+"<a href='javascript:void(0);' onclick='goods_selected_show();'>查看选中商品.</a>";
if ($defined($('hand-selected-goods')))
{
$('hand-selected-goods').setHTML(html);
} else {
var div = new Element('div',{'html':html,'id':'hand-selected-goods'});
div.injectBefore(handle);
}
}
function goods_selected_show(){
new Dialog('index.php?app=inventorydepth&ctl=regulation_apply&act=showGoods',{
ajaxoptions:{data:$('hand-selected-goods').getNext('div'),method:'post'}
});
}
function allShop(el){
if (el.checked)
{
$('shops').hide();
$('shops').getElements('input').set('disabled',true);
}else{
$('shops').show();
$('shops').getElements('input').set('disabled',false);
}
}
function isAll(el){
if (el.checked) {
el.getParent('div').getNext('div').setStyle('visibility','hidden');
}else{
el.getParent('div').getNext('div').setStyle('visibility','visible');
}
}
void function(){
$('regulation-apply-submit').addEvent('click',function(){
var form = $('regulation-apply-form');
W.page(form.action,{
data:form,
onComplete:function(resp){
resp = JSON.decode(resp);
if (resp.error)
{
MessageBox.error(resp.error);
return ;
}
opener.finderGroup["<{$env.get._finder.finder_id}>"].refresh.delay(400,opener.finderGroup["<{$env.get._finder.finder_id}>"]);
setTimeout("window.close()",200);
}
});
});
}();
// 初始化专用供货仓tail组件
var supplyBranchSel = tail.select("#supply-branch-sel", {
multiContainer: true,
height: 660,
searchMinLength: 0,
openAbove: true,
multiSelectAll: true,
placeholder:'请选择专用供货仓',
search:true
});
</script>