Files
OMS/app/iostock/view/analysis/set_nsale_day.html
2026-01-04 19:08:31 +08:00

93 lines
3.0 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.
-->
<div class="data-action" style="padding:5px;">
<form action="<{$set_nsale_day_form_action}>" method="post" id="nsale_day_filter_form">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left" nowrap="nowrap">
<{$set_nsale_day_title}><{help}><{$set_nsale_day_help_message}><{/help}>:
<br />
<select name="nsale_day_select" id="nsale_day_select">
<{foreach from=$select_data key=key item=item}>
<option value="<{$key}>" <{if $selected_value == $key}>selected="selected"<{/if}>><{$item}></option>
<{/foreach}>
</select>
<input type="text" width="30" id="nsale_day_input" name="nsale_day_input" value="<{$nsale_day_byself}>" <{if $part_select_value == 'choose_select'}> style="display:none"<{/if}>>
<{button type="submit" class="filterBtn btn-thirdly" label="确定" id="brandSetNsaleDayForm"}>
<input type="hidden" id="part_select" name="part_select" value="<{$part_select_value}>">
</td>
</tr>
</table>
</form>
</div>
<script>
(function(){
$('nsale_day_select').addEvent("change",function(e){
var nsale_day_select_value = $('nsale_day_select').value;
if(nsale_day_select_value == 99999){
$('nsale_day_input').show();
$('part_select').value = 'choose_input';
}else{
$('nsale_day_input').hide();
$('part_select').value = "choose_select";
}
});
$('brandSetNsaleDayForm').addEvent("click",function(e){
var current_part_select_value = $('part_select').value;
if(current_part_select_value == "choose_input"){
var nsale_day_input = $('nsale_day_input').value.trim();
if(nsale_day_input == ""){
MessageBox.error('请填写自定义天数');
e.stop();
return;
}
if(parseInt(nsale_day_input) <= "0"){
MessageBox.error('自定义天数必须大于0');
e.stop();
return;
}
if(isNaN(nsale_day_input)){
MessageBox.error('自定义天数为数字格式');
e.stop();
return;
}
}
//prevent do 99999 value
var nsale_day_select = $('nsale_day_select').value;
if(nsale_day_select == "99999" && current_part_select_value == "choose_select"){
MessageBox.error('您选择的自定义 请正确填写自定义天数');
e.stop();
return;
}
_form = $('nsale_day_filter_form');
_form.store('target',{
onSuccess:function(){
$('brandSetNsaleDayForm').getParent('.dialog').retrieve('instance').close();
}
});
_form.fireEvent('submit',{stop:$empty});
});
})();
</script>