<apex:page Controller="SpecialPriceController" showHeader="true" sidebar="false" id="allPage" action="{!init}">
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
|
<apex:includeScript value="/soap/ajax/29.0/connection.js"/>
|
<apex:includeScript value="/soap/ajax/29.0/apex.js"/>
|
<script>
|
window.sfdcPage.appendToOnloadQueue(function() { calonLoad() });
|
function calonLoad() {
|
var isInput = {!isInput};
|
if (isInput) {
|
//说明状态不是草案中 则设置页面锁定不可编辑
|
//1.查询条件锁定
|
j$(escapeVfId('allPage:allForm:searchBlock:StateMaster')).attr("disabled", true);
|
j$(escapeVfId('allPage:allForm:searchBlock:StateMaster2')).attr("disabled", true);
|
j$(escapeVfId('allPage:allForm:searchBlock:StateMaster3')).attr("disabled", true);
|
j$(escapeVfId('allPage:allForm:searchBlock:StateMaster4')).attr("disabled", true);
|
j$(escapeVfId('allPage:allForm:searchBlock:StateMaster5')).attr("disabled", true);
|
j$(escapeVfId('allPage:allForm:searchBlock:importId')).attr("disabled", true);
|
var productCount = j$(escapeVfId('allPage:allForm:productInfoSection:productRecoedsCount')).value();
|
for (var i = 0; i < productCount; i++) {
|
j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('disabled',true);
|
j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSD')).attr('disabled',true);
|
j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSDC')).attr('disabled',true);
|
}
|
}
|
}
|
function refreshPageSizeJs() {
|
refreshPageSize();
|
}
|
function checkAll() {
|
var productCount = j$(escapeVfId('allPage:allForm:productInfoSection:productRecoedsCount')).value();
|
if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
|
//console.log(productCount);
|
for (var i = 0; i < productCount; i++) {
|
j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked',true);
|
}
|
} else {
|
for (var i = 0; i < productCount; i++) {
|
j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked',false);
|
}
|
}
|
}
|
|
function setCheckBox(j,oldvalue,oldvalue2) {
|
var z,x,v;
|
var a = j.id;
|
|
var i = a.substring(0,a.lastIndexOf(':'));
|
v = j$(escapeVfId(i+':inputSD')).value().trim();
|
// z = parseFloat(j$(escapeVfId(i+':inputSD')).value());
|
|
// if(v!='' && isNaN(v)){
|
// window.alert("特殊折扣必须是数字!");
|
// document.getElementById(i+':inputSD').value = "";
|
// return;
|
// }
|
|
if(v!='' && (v>100 || v<0)){
|
window.alert("特殊折扣不正确,请输入0~100的数字!");
|
document.getElementById(i+':inputSD').value = "";
|
return;
|
}
|
|
if( v!=oldvalue && oldvalue!='0'){
|
document.getElementById(i+':inputSDC').value = "";
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
}else{
|
|
// //需要判断之前的金额有没有值,如果有 要设置选中
|
// document.getElementById(i+':inputSDC').value = "";
|
// j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
|
document.getElementById(i+':inputSDC').value = "";
|
if (oldvalue2 != '0') {
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
}
|
}
|
if (v != null && v != '' && oldvalue == '0') {
|
j$(escapeVfId(i +':consumablesCountproRowCheckbox')).attr('checked',true);
|
}
|
|
}
|
|
|
// <!-- //add by rentx 2020-12-22 -->
|
function setCheckBoxSDC(j,oldvalue,oldvalue2) {
|
var z,x,v;
|
var a = j.id;
|
|
var i = a.substring(0,a.lastIndexOf(':'));
|
v = j$(escapeVfId(i+':inputSDC')).value().trim();
|
// z = parseFloat(j$(escapeVfId(i+':inputSDC')).value());
|
// if(v!='' && isNaN(v)){
|
// window.alert("特殊折扣必须是数字!");
|
// document.getElementById(i+':inputSDC').value = "";
|
// return;
|
// }
|
|
console.log('当前输入的值::'+v);
|
console.log('特殊折扣(金额)::'+oldvalue);
|
console.log('特殊折扣(%)::'+oldvalue2);
|
if(v!='' && v<0){
|
window.alert("特殊折扣不正确,请输入正确的数字!");
|
document.getElementById(i+':inputSDC').value = "";
|
return;
|
}
|
|
if( v!=oldvalue && oldvalue!='0'){
|
document.getElementById(i+':inputSD').value = "";
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
}else{
|
//需要判断之前的%有没有值,如果有值,则设置选中
|
// document.getElementById(i+':inputSD').value = "";
|
// j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
|
document.getElementById(i+':inputSD').value = "";
|
if (oldvalue2 != '0') {
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',true);
|
}else{
|
j$(escapeVfId(i+':consumablesCountproRowCheckbox')).attr('checked',false);
|
}
|
}
|
if (v != null && v != '' && oldvalue == '0') {
|
j$(escapeVfId(i +':consumablesCountproRowCheckbox')).attr('checked',true);
|
}
|
|
}
|
// <!-- //add by rentx 2020-12-22 -->
|
|
function fillJs() {
|
//var cnt = {!productRecoedsCount};
|
var cnt = j$(escapeVfId('allPage:allForm:productInfoSection:productRecoedsCount')).value();
|
var specialDiscount = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill:0:Special_Discount')).value();
|
|
if(specialDiscount!='' && isNaN(specialDiscount)){
|
window.alert("特殊折扣必须是数字!");
|
return;
|
}
|
|
if(specialDiscount!='' && (specialDiscount>100 || specialDiscount<0)){
|
window.alert("特殊折扣不正确,请输入0~100的数字!");
|
return;
|
}
|
|
for (var i = 0; i < cnt; i++) {
|
if(j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked') == 'checked'){
|
document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSD').value = specialDiscount;
|
document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSDC').value = null;
|
}
|
}
|
}
|
// gzw add 20210802
|
function fillJ1s() {
|
//var cnt = {!productRecoedsCount};
|
var cnt = j$(escapeVfId('allPage:allForm:productInfoSection:productRecoedsCount')).value();
|
var specialDiscount = j$(escapeVfId('allPage:allForm:productInfoSection:BlockTablefill1:0:Special_Discount1')).value();
|
|
if(specialDiscount!='' && isNaN(specialDiscount)){
|
window.alert("折扣金额必须是数字!");
|
return;
|
}
|
|
// if(specialDiscount!='' && (specialDiscount>100 || specialDiscount<0)){
|
// window.alert("特殊折扣不正确,请输入0~100的数字!");
|
// return;
|
// }
|
|
for (var i = 0; i < cnt; i++) {
|
if(j$(escapeVfId('allPage:allForm:productInfoSection:productInfoListview:' + i + ':consumablesCountproRowCheckbox')).attr('checked') == 'checked'){
|
document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSDC').value = specialDiscount;
|
document.getElementById('allPage:allForm:productInfoSection:productInfoListview:' + i + ':inputSD').value = null;
|
}
|
}
|
}
|
// gzw add 20210802
|
|
|
function saveJs() {
|
blockme();
|
//beforeSaveJs();
|
save();
|
}
|
|
function searchProductJs() {
|
blockme();
|
searchProduct();
|
}
|
|
function showcategory2Js() {
|
showcategory2();
|
}
|
|
function showcategory3Js() {
|
showcategory3();
|
}
|
function showcategory4Js() {
|
showcategory4();
|
}
|
function showcategory5Js() {
|
showcategory5();
|
}
|
</script>
|
<apex:form id="allForm">
|
<apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="productInfoSection,messageText" />
|
<apex:actionFunction name="save" action="{!save}" rerender="message,messageText" onComplete="unblockUI();">
|
</apex:actionFunction>
|
<apex:actionFunction name="showcategory2" action="{!showcategory2}" rerender="searchBlock, message,messageText">
|
</apex:actionFunction>
|
<apex:actionFunction name="showcategory3" action="{!showcategory3}" rerender="searchBlock, message,messageText">
|
</apex:actionFunction>
|
<apex:actionFunction name="showcategory4" action="{!showcategory4}" rerender="searchBlock, message,messageText">
|
</apex:actionFunction>
|
<apex:actionFunction name="showcategory5" action="{!showcategory5}" rerender="searchBlock, message,messageText">
|
</apex:actionFunction>
|
<apex:actionFunction name="searchProduct" action="{!searchProduct}" rerender="productInfoSection, message,messageText" onComplete="unblockUI();">
|
</apex:actionFunction>
|
<apex:outputPanel id="allPanel">
|
<apex:outputPanel id="messageText">
|
<table>
|
<tr>
|
<td>
|
<div id="ErrorName" style="color: red;font-weight: bold;" >{!alertMessage}</div>
|
</td>
|
</tr>
|
</table>
|
</apex:outputPanel>
|
<apex:outputPanel id="message">
|
<apex:pageMessages />
|
</apex:outputPanel>
|
<apex:pageBlock id="searchBlock">
|
<table>
|
<colgroup>
|
<col width="50px"/>
|
<col width="100px"/>
|
<col width="60px"/>
|
<col width="20px"/>
|
<col width="100px"/>
|
<col width="60px"/>
|
<col width="20px"/>
|
<col width="100px"/>
|
<col width="60px"/>
|
<col width="20px"/>
|
<col width="100px"/>
|
<col width="60px"/>
|
<col width="20px"/>
|
<col width="100px"/>
|
<col width="60px"/>
|
<col width="20px"/>
|
<col width="80px"/>
|
</colgroup>
|
<tr>
|
<td align="right"></td>
|
<td align="right">管理编码:</td>
|
<td style="text-align:left; width:70px;" colspan = "2">
|
<apex:outputField value="{!acc.Parent.Management_Code__c}"/>
|
</td>
|
<td align="right">经销商名称:</td>
|
<td style="text-align:left; width:70px;" colspan = "3">
|
<apex:outputField value="{!acc.Parent.Name}"/>
|
</td>
|
<td align="right" colspan = "3">经销商合同名称:</td>
|
<td style="text-align:left; width:70px;" colspan = "4">
|
<apex:outputField value="{!acc.Name}"/>
|
</td>
|
<td align="right"></td>
|
</tr>
|
<tr>
|
<td colspan = "16" style="height: 10px"></td>
|
</tr>
|
<tr>
|
<td align="right"></td>
|
<td align="right">第1分类:</td>
|
<td style="text-align:left; width:70px;">
|
<apex:selectList id="StateMaster" value="{!category1}" size="1" style="width:90px" onchange="showcategory2Js();return false;">
|
<apex:selectOptions value="{!category1OptionList}"/>
|
</apex:selectList>
|
</td>
|
<td/>
|
<td align="right">第2分类:</td>
|
<td style="text-align:left; width:70px;">
|
<apex:selectList id="StateMaster2" value="{!category2}" size="1" style="width:90px" onchange="showcategory3Js();return false;">
|
<apex:selectOptions value="{!category2OptionList}"/>
|
</apex:selectList>
|
</td>
|
<td/>
|
<td align="right">第3分类:</td>
|
<td style="text-align:left; width:70px;">
|
<apex:selectList id="StateMaster3" value="{!category3}" size="1" style="width:90px" onchange="showcategory4Js();return false;">
|
<apex:selectOptions value="{!category3OptionList}"/>
|
</apex:selectList>
|
</td>
|
<td/>
|
<td align="right">第4分类:</td>
|
<td style="text-align:left; width:70px;">
|
<apex:selectList id="StateMaster4" value="{!category4}" size="1" style="width:90px" onchange="showcategory5Js();return false;" >
|
<apex:selectOptions value="{!category4OptionList}"/>
|
</apex:selectList>
|
</td>
|
<td/>
|
<td align="right">第5分类:</td>
|
<td style="text-align:left; width:70px;">
|
<apex:selectList id="StateMaster5" value="{!category5}" size="1" style="width:90px">
|
<apex:selectOptions value="{!category5OptionList}"/>
|
</apex:selectList>
|
</td>
|
<td align="right" rowspan = "3"><apex:commandButton disabled="{!isInput}" value="检索" style="width: 100px;" onclick="searchProductJs();return false;" /></td>
|
</tr>
|
<tr>
|
<td colspan = "15" style="height: 10px"></td>
|
</tr>
|
<tr>
|
<td align="right"></td>
|
<td align="right">关键字:</td>
|
<td style="text-align:left; width:70px;" colspan = "3">
|
<apex:inputText id="importId" value="{!keyword}"/>
|
<c:helpicon helpText="可以使用关键字检索产品型号和产品名称。"/>
|
</td>
|
<!-- <td align="right" >特约店产品</td>
|
<td align="left"><apex:inputCheckbox value="{!Pro2DealerFlag}" id="Pro2DealerFlag" style="width:20px"/>
|
</td> -->
|
|
</tr>
|
</table>
|
</apex:pageBlock>
|
|
<apex:pageBlock title="产品信息" id="productInfoSection">
|
<apex:pageBlockButtons location="top" >
|
<apex:commandButton onclick="saveJs();" disabled="{!isInput}" value="保存" style="margin-left:30px;width:100px" rerender="dummy" />
|
</apex:pageBlockButtons>
|
|
<apex:outputPanel style="float:right;" >
|
<apex:pageBlockTable value="{!dpc}" var="a" id="BlockTablefill1">
|
<apex:column headerValue="特殊折扣(金额)" >
|
<apex:inputField id="Special_Discount1" value="{!a.Special_Campaign_Price__c}" style="width: 80px;"/>
|
</apex:column>
|
|
<apex:column >
|
<apex:commandButton onclick="fillJ1s();" disabled="{!isInput}" value="应用金额" style="margin-left:10px;width:100px" rerender="dummy" />
|
</apex:column>
|
</apex:pageBlockTable>
|
</apex:outputPanel>
|
|
<apex:outputPanel style="float:right;" >
|
<apex:pageBlockTable value="{!dpc}" var="a" id="BlockTablefill">
|
<apex:column headerValue="特殊折扣(%)" >
|
<apex:inputField id="Special_Discount" value="{!a.Special_Discount__c}" style="width: 80px;"/>
|
</apex:column>
|
|
<apex:column >
|
<apex:commandButton onclick="fillJs();" disabled="{!isInput}" value="应用折扣" style="margin-left:10px;width:100px" rerender="dummy" />
|
</apex:column>
|
</apex:pageBlockTable>
|
</apex:outputPanel>
|
|
|
<apex:inputHidden id="productRecoedsCount" value="{!productRecoedsCount}"/>
|
<table class="list" border="0" cellpadding="0" cellspacing="0">
|
<colgroup>
|
<col width="6%" />
|
<col width="34%" />
|
<col width="10%" />
|
<col width="10%" />
|
<col width="10%" />
|
<col width="10%" />
|
<col width="10%" />
|
<col width="10%" />
|
</colgroup>
|
<tr class="headerRow">
|
<th><input type='checkbox' onClick='checkAll()' id='checker'/>选择</th>
|
<th style="width:40%">产品名称</th>
|
<th style="width:10%">第1分类</th>
|
<th style="width:10%">第2分类</th>
|
<th style="width:10%">第3分类</th>
|
<th style="width:10%">第4分类</th>
|
<th style="width:10%">第5分类</th>
|
<!-- <th style="width:10%">特殊折扣</th> -->
|
<th style="width:10%">特殊折扣(%)</th>
|
<th style="width:10%">特殊折扣(金额)</th>
|
<!-- <th style="width:10%">(%)</th> -->
|
<!-- <th style="width:10%">(金额)</th> -->
|
|
</tr>
|
<apex:repeat value="{!productInfoListview}" var="records" id="productInfoListview">
|
<tr class="dataRow">
|
<td>
|
<apex:inputCheckbox value="{!records.check}" id="consumablesCountproRowCheckbox"/>
|
</td>
|
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Name__c}"/>
|
</td>
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Category1__c}"/>
|
</td>
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Category2__c}"/>
|
</td>
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Category3__c}"/>
|
</td>
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Category4__c}"/>
|
</td>
|
<td class="dataCell">
|
<apex:outputField value="{!records.pro.Category5__c}"/>
|
</td>
|
<!-- //add by rentx 2020-12-22 -->
|
<td class="dataCell" >
|
<apex:inputField style="width: 80px;" onclick="setCheckBox(this,{!IF(records.dealerPro.Special_Discount__c!=null,records.dealerPro.Special_Discount__c,0)},{!IF(records.dealerPro.Special_Campaign_Price__c!=null,records.dealerPro.Special_Campaign_Price__c,0)})" onblur="setCheckBox(this,{!IF(records.dealerPro.Special_Discount__c!=null,records.dealerPro.Special_Discount__c,0)},{!IF(records.dealerPro.Special_Campaign_Price__c!=null,records.dealerPro.Special_Campaign_Price__c,0)})" value="{!records.dpac.Special_Discount__c}" id="inputSD"/>
|
|
</td>
|
<td class="dataCell" >
|
<apex:inputField style="width: 80px;" onclick="setCheckBoxSDC(this,{!IF(records.dealerPro.Special_Campaign_Price__c!=null,records.dealerPro.Special_Campaign_Price__c,0)},{!IF(records.dealerPro.Special_Discount__c!=null,records.dealerPro.Special_Discount__c,0)})" onblur="setCheckBoxSDC(this,{!IF(records.dealerPro.Special_Campaign_Price__c!=null,records.dealerPro.Special_Campaign_Price__c,0)},{!IF(records.dealerPro.Special_Discount__c!=null,records.dealerPro.Special_Discount__c,0)})" value="{!records.dpac.ProductDiscount__c}" id="inputSDC"/>
|
</td>
|
<!-- <td class="dataCell" > -->
|
<!-- <apex:outputField style="width: 80px;" value="{!records.dealerPro.Special_Discount__c}" /> -->
|
<!-- </td> -->
|
<!-- //add by rentx 2020-12-22 -->
|
<!-- <td class="dataCell" > -->
|
<!-- <apex:outputField style="width: 80px;" value="{!records.dealerPro.Special_Campaign_Price__c}"/> -->
|
<!-- </td> -->
|
<!-- //add by rentx 2020-12-22 -->
|
</tr>
|
</apex:repeat>
|
</table>
|
<table style="width: 100%">
|
<tr>
|
<td>
|
<!-- Page X of Y -->
|
<!-- PageNumber:当前页面所在位置,ResultSize:记录总条数,PageSize:每页记录条数 -->
|
<apex:outputText value="{!(currentpage * pagesize)+1-pagesize}-{!IF((currentpage * pagesize)>totalcount, totalcount,
|
(currentpage * pagesize))} 共 {!totalcount} 个" />
|
</td>
|
<td align="center">
|
<div class="paginator line1">
|
<span class="prevNextLinks">
|
<span class="prevNext">
|
<apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToFirst}" oncomplete="refreshPageSizeJs();" title="首页" >
|
<img src="/s.gif" title="首页" alt="首页" class="{!if((hasPrevious),'first','firstoff')}"/>
|
</apex:commandLink>
|
</span>
|
<span class="prevNext">
|
<apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToPrevious}" oncomplete="refreshPageSizeJs();" title="上一页">
|
<img src="/s.gif" title="上一页" alt="上一页" class="{!if((hasPrevious),'prev','prevoff')}"/>上一页
|
</apex:commandLink>
|
</span>
|
<!-- -->
|
<span class="prevNext" >
|
<apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToNext}" oncomplete="refreshPageSizeJs();" title="下一页">下一页
|
<img src="/s.gif" title="下一页" alt="下一页" class="{!if((hasNext),'next','nextoff')}"/>
|
</apex:commandLink>
|
</span>
|
<span class="prevNext">
|
<apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!moveToLast}" oncomplete="refreshPageSizeJs();" title="尾页">
|
<img src="/s.gif" title="尾页" alt="尾页" class="{!if((hasNext),'last','lastoff')}"/>
|
</apex:commandLink>
|
</span>
|
</span>
|
</div>
|
</td>
|
<td align="right" width="20%">
|
</td>
|
</tr>
|
</table>
|
</apex:pageBlock>
|
</apex:outputPanel>
|
</apex:form>
|
</apex:page>
|