高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
public with sharing class StatusPageController {
    public StatusPageController() {
        Inquiryform = new Inquiry_form__c();
    }
    public String status{get;set;}
    public String search{get;set;}
    public String reason{get;set;}
    public Inquiry_form__c Inquiryform{get; set;}
 
    public void init(){
        String infId = ApexPages.currentPage().getParameters().get('id');
        List<Inquiry_form__c> infList = [SELECT id,Reasons_options__c,Opp_Name_Search__c,Follow_Content__c,Follow_Content_Other__c,Status__c FROM Inquiry_form__c WHERE id =  :infId];
        if (infList.size() == 0) {
            
        }else{
            Inquiryform = infList[0];
        }
    }
    public void save(){
        try{
            if (String.isBlank(Inquiryform.Reasons_options__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '不需要理由不能为空'));
                return;
            }
            if (Inquiryform.Reasons_options__c == '已经有询价' && String.isBlank(Inquiryform.Opp_Name_Search__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '已有询价名称不能为空'));
                return;
            }
            Inquiryform.Status__c = '02.不需要';
            update Inquiryform;
        }catch (Exception ex){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));
        }
    }
    public void savefo(){
        try {
            if (String.isBlank(Inquiryform.Follow_Content__c) && String.isBlank(Inquiryform.Follow_Content_Other__c)) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '跟进内容不能为空'));
            }
        
            Inquiryform.Status__c = '03.已跟进';
            update Inquiryform;
        }
        catch (Exception ex) {
            
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));
        }
    }
}