buli
2022-05-09 0953b3b5fcf19c627c6479a6b86648df653c40db
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<apex:page id="Page" standardController="productSet__c" extensions="SearchSetProductController" sidebar="false" showHeader="false" action="{!init}">
<!-- XHL-20190426-AddStart -->
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <script type="text/javascript">
 
        function SelectDoneJS(){
            SelectDone();
            // alert('1111111111');
            // SetMuiltProduct();
        }
 
        function SetMuiltProduct(){
 
            
 
            var Str = j$(escapeVfId("Page:mainForm:setPFString")).value();
            // alert(Str);
            var Size = j$(escapeVfId("activitiesSize")).value();
            var productSetNames = '';
            var flag = '0';
            var errorFlag = false;
            var errorMsg = '';
            for (var i= 0; i < Size ;i++) {
                var Checkbox = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Checkbox")).value();
                var quantity = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Quantity")).value();
                var QuantityReference = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":QuantityReference")).value();
                var Discount = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Discount")).value();
                var Name = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Name")).value();
                if (Checkbox == 'on') {
 
                    if (parseFloat(Discount).toString() == "NaN" || parseFloat(Discount) <= 0 || 
                        parseFloat(quantity).toString() == "NaN" || quantity.indexOf(".") != -1 || 
                        parseFloat(quantity) < 0 || (quantity == 0 && quantity == QuantityReference) ) {
                        errorFlag = true;
 
                        if (errorMsg == '') {
                            errorMsg = Name;
                        } else {
                            errorMsg = errorMsg + ',' +Name;
                        }
                    }
 
                    if (quantity == 0 && quantity != QuantityReference ) {
                        flag = '1';
                        if (productSetNames == '') {
                            productSetNames = Name;
                        } else {
                            productSetNames += ';' + Name;
                        }
                    } 
                    
                }
            }
            if (errorFlag) {
                alert('您已选择[ '+errorMsg+' ]产品配套,尚未填写有效数字,请确认');
                return;
            }
            if (flag == '1') {
                if(confirm("您即将删除"+productSetNames+",确认完成么?")){
                    
                    top.window.opener.setProductEntryGateway(Str);
                    top.window.close();
                    return;
                }else{
                    return;
                }
            }
            
 
            if(Str==''||Str==null){
                if(confirm("您尚未选取任何产品配套,确认完成么?")){
                    top.window.opener.setProductEntryGateway(Str);
                    top.window.close();
                }else{
                }
            }else{
                 top.window.opener.setProductEntryGateway(Str);
                 top.window.close();
            } 
            
        }
        
    </script>
    <style type="text/css">
        div#iframelike {
            color: #fff;
            height: 300px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
    <apex:outputPanel id="all">
        <apex:form id="mainForm">
        <apex:actionFunction action="{!SelectDone}" name="SelectDone" reRender="setPFString" oncomplete="SetMuiltProduct();"/>
        <apex:inputHidden value="{!setPFString}" id="setPFString"/>
        <input type="hidden" id="activitiesSize" value="{!activitiesSize}" />
            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Product_Assort_Search}">
 
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <colgroup>
                        <col width="12" />
                        <col width="20" />
                        <col width="20" />
                        <col width="200" />
                        <col width="200" />
                        <col width="200" />
                        <col width="100" />
                        <col width="128" />
                    </colgroup>
                    
                    <tr>
                        <td>&nbsp;</td>
                        <th>{!$Label.Search_Condition}</th>
                        <td>&nbsp;</td>
                        <th>{!$Label.Set_Name}</th>
                        <th>{!$Label.Set_Code}</th>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><apex:inputText value="{!SearchName}" style="width:150px" required="false"/></td>
                        <td><apex:inputText value="{!SearchCode}" style="width:150px" required="false"/></td>
                        
                        <td><apex:commandButton value="{!$Label.Search}" action="{!serContact}" style="width:100px" rerender="idRezultVisitor" /></td>
                        <!-- <td><apex:commandButton value="添加" onclick="SelectDone()" style="width:100px"/></td> -->
                        <td><apex:commandButton value="添加" onclick="SelectDoneJS();return false;" style="width:100px"/></td>
                    </tr>
                    <tr>
                        <td style="border-bottom: 1px solid #888;" colspan="15">&nbsp;</td>
                    </tr>
                </table>
                <table width="900" border="0" style="background-color:#DCDCDC">
                    <tr>
                        <td width="12">&nbsp;</td>
                        <th valign="top">{!$Label.Search_Result}</th>
                        <td width="20">&nbsp;</td>
                        <td>
                            <table border="0">
                                <tr>
                                    <td>
                                    <div id="iframelike" style="width:770px">
                                        <apex:pageBlockTable id="idRezultVisitor" value="{!activities}" var="c" border="1" columns="7" columnsWidth="30px,120px,300px,90x,200px,50px">
                                            <apex:column >
                                                <apex:facet name="header">选择</apex:facet>
                                                <apex:inputCheckbox value="{!c.isSelected}" id="Checkbox"/>
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Set_Name}</apex:facet>
                                                <apex:outputText value="{!c.Name}" id="Name"/>   
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Set_Code}</apex:facet>
                                                <apex:outputText value="{!c.Code}" />
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">{!$Label.Quantity}</apex:facet>
                                                <apex:InputText value="{!c.Quantity}" Id="Quantity"/>
                                                <apex:inputHidden id="QuantityReference" value="{!c.QuantityReference}"/>
                                            </apex:column>
                                            <apex:column >
                                                <apex:facet name="header">折扣</apex:facet>
                                                <apex:InputText value="{!c.Discount}" Id="Discount"/>
                                            </apex:column>
                                            
                                        </apex:pageBlockTable>
                                    </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
        </apex:form>
    </apex:outputPanel>
</apex:page>