<apex:page id="Page" Controller="NewReplacementOpportunityController" sidebar="true" showHeader="true" action="{!init}">
|
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
|
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
|
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
|
|
<script>
|
var staticResource = JSON.parse('{!staticResource}');
|
var txId = '';
|
function getPIData(){
|
let opportunityPayloadList = [];
|
let opportunityPIData = new Object();
|
opportunityPIData.dealerSalesStaffName = document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').value
|
opportunityPayloadList.push(opportunityPIData);
|
return JSON.stringify(opportunityPayloadList);
|
}
|
function saveJs() {
|
blockme();
|
new Promise(function(resolve,reject){
|
//加密
|
let queryPostBack = function(data){
|
document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').value = data.object[0].dealerSalesStaffName;
|
document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:opportunityAWSDataId').value = data.object[0].dataId;
|
txId = data.txId;
|
resolve('success');
|
};
|
AWSService.post(staticResource.newUrl,getPIData(),queryPostBack,staticResource.token);
|
}).then(function(data){
|
saveBtn();
|
Trans();
|
})
|
}
|
|
//aws 确认
|
function Trans(){
|
let b = HasError();
|
if(b){
|
//清空代理商销售担当者名
|
document.getElementById('Page:mainForm:idSearchSetProduct:j_id35:j_id38:opp_DealerSalesStaffName').value=''
|
}
|
AWSService.post(staticResource.transactionUrl, JSON.stringify({
|
"txId":txId,
|
"isSuccess":b ? 0 : 1
|
}), function(result){
|
console.log('Trans result = '+ JSON.stringify(result));
|
}, staticResource.token);
|
}
|
|
function HasError(){
|
let e = document.getElementById("Page:mainForm:message");
|
return e.children[0]!=null;
|
}
|
|
function saveYesJs() {
|
blockme();
|
saveBtnYes();
|
}
|
|
function saveNoJs() {
|
blockme();
|
saveBtnNo();
|
}
|
|
function cancelJs() {
|
var baseUrl = '{!baseUrl}';
|
var rtUrl = '{!rtUrl}';
|
if (rtUrl == 'null' || rtUrl == '') {
|
rtUrl = '{!conId}';
|
}
|
window.location.href = baseUrl + "/" + rtUrl;
|
}
|
</script>
|
|
<apex:form id="mainForm">
|
<apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="Trans();unblockUI();"/>
|
<apex:actionFunction action="{!saveBtnYes}" name="saveBtnYes" reRender="mainForm,message" oncomplete="unblockUI();"/>
|
<apex:actionFunction action="{!saveBtnNo}" name="saveBtnNo" reRender="mainForm,message" oncomplete="unblockUI();"/>
|
|
<apex:outputPanel id="message">
|
<apex:messages styleClass="editListError"/>
|
</apex:outputPanel>
|
|
<input type="hidden" id="hasError" value="{!hasError}"/>
|
<input type="hidden" id="isDealerPage" value="{!isDealerPage}"/>
|
<apex:pageBlock id="idSearchSetProduct" title="新建询价" tabStyle="Opportunity">
|
<apex:pageBlockButtons location="top">
|
<apex:commandButton style="width:50px" onclick="saveJs();" value="保存" rerender="dummy" rendered="{!IF(hasError == true, false, true)}"/>
|
<apex:commandButton style="width:50px" onclick="cancelJs();" value="取消" rerender="dummy" rendered="{!IF(hasError == true, false, true)}"/>
|
<apex:commandButton style="width:50px" onclick="saveYesJs();" value="是" rerender="dummy" rendered="{!IF(hasError == true, true, false)}"/>
|
<apex:commandButton style="width:50px" onclick="saveNoJs();" value="否" rerender="dummy" rendered="{!IF(hasError == true, true, false)}"/>
|
</apex:pageBlockButtons>
|
|
<apex:pageBlockSection title="询价信息" columns="2">
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="询价名称" for="opp_Name"/>
|
<apex:inputField value="{!opp.Name}" id="opp_Name"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="产品分类" for="opp_ProductSegment"/>
|
<apex:inputField value="{!opp.ProductSegment__c}" id="opp_ProductSegment" required="true"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="客户名" for="opp_Account"/>
|
<apex:inputField value="{!opp.AccountId}" id="opp_Account" required="true"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="询价币种" for="opp_CurrencyIsoCode"/>
|
<apex:inputField value="{!opp.CurrencyIsoCode}" id="opp_CurrencyIsoCode"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="类型" for="opp_Type"/>
|
<apex:inputField value="{!opp.Type}" id="opp_Type"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="金额" for="opp_Amount"/>
|
<apex:inputField value="{!opp.Amount}" id="opp_Amount"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="整机/零件" for="opp_MachineParts"/>
|
<apex:inputField value="{!opp.Machine_Parts__c}" id="opp_MachineParts"/>
|
</apex:pageBlockSectionItem>
|
</apex:pageBlockSection>
|
|
<apex:pageBlockSection title="附加信息" columns="2">
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="内贸 / 外贸" for="opp_TradeType"/>
|
<apex:inputField value="{!opp.TradeType__c}" id="opp_TradeType" required="true"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="销售方式" for="opp_SalesChannel"/>
|
<apex:inputField value="{!opp.SalesChannel__c}" id="opp_SalesChannel" required="true"/>
|
</apex:pageBlockSectionItem>
|
</apex:pageBlockSection>
|
|
<apex:pageBlockSection title="经销商相关信息" columns="2">
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="代理商名" for="opp_Dealer"/>
|
<apex:inputField value="{!opp.Dealer__c}" id="opp_Dealer"/>
|
</apex:pageBlockSectionItem>
|
<apex:pageBlockSectionItem >
|
<apex:outputLabel value="代理商销售担当者名" for="opp_DealerSalesStaffName"/>
|
<apex:inputField value="{!opp.DealerSalesStaffName__c}" id="opp_DealerSalesStaffName" required="true"/>
|
</apex:pageBlockSectionItem>
|
<apex:inputHidden id="opportunityAWSDataId" value="{!opp.AWS_Data_Id__c}"/>
|
</apex:pageBlockSection>
|
|
</apex:pageBlock>
|
|
|
</apex:form>
|
</apex:page>
|