rationInviteConfig.js
2.68 KB
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
var bigDeal=function(){
return {
agreeRationPopup : function(current,usableAmount,minApply,maxApply,inviteId,endAmount) {
var tr=$(current).parent().parent();
$("#inviteId").val(inviteId)
$("#otcCode").html(tr.find('td:eq(1)').html());
$("#otcName").html(tr.find('td:eq(2)').html());
$("#price").html(tr.find('td:eq(5)').html());
$("#enableCount").html(usableAmount);//usableAmout剩下的可以邀约的数量
var enableAmount=parseInt(endAmount);
$("#enableAmount").html(enableAmount);
var firstNumber=parseInt(minApply);
var lastNumber=parseInt(maxApply);
$("#firstNumber").html((firstNumber));
$("#lastNumber").html(lastNumber);
if(usableAmount<enableAmount){
$("#invite_count").val(usableAmount);
}
else if(enableAmount<firstNumber){
$("#invite_count").val(enableAmount);
}else if(enableAmount>firstNumber&&enableAmount>lastNumber){
$("#invite_count").val(lastNumber);
}else{
$("#invite_count").val(enableAmount);
}
easyDialog.open({
container : 'agreeRationPopup'
});
bigDeal.checkNumber();
},
checkNumber:function(){
var price=$("#price").html();
var inviteCount=$("#invite_count").val();
$("#record_fare").html((price*inviteCount).toFixed(2));
},
showMessage:function(text){
easyDialog.open({
container : 'validateMessage'
});
$("#dialog-validate-content").html(text);
}
}
}();
$(function(){
/**立刻配售*/
var isSubmit = false;
$('#submit').click(function() {
bigDeal.checkNumber();
var invite_count=$("#invite_count").val();//同意数量
var firstNumber=$("#firstNumber").html();
var lastNumber=$("#lastNumber").html();
var enableCount=$("#enableCount").html();
var enableAmount=$("#enableAmount").html();
if(parseInt(invite_count)==0){
bigDeal.showMessage('卖出数量不能为0');
$('#invite_count').focus();
return;
}
if(parseInt(invite_count)<parseInt(firstNumber)){
bigDeal.showMessage('卖出数量不能小于'+firstNumber);
$('#invite_count').focus();
return;
}
if(parseInt(invite_count)>parseInt(lastNumber)){
bigDeal.showMessage('卖出数量不能大于'+lastNumber);
$('#invite_count').focus();
return;
}
if(parseInt(invite_count)>parseInt(enableCount)){
bigDeal.showMessage('对不起,您出售的数量大于剩余购买量('+enableCount+'),故出售失败。');
$('#invite_count').focus();
return;
}
isSubmit = true;
$.post('/ration/invite/config/inviteSave', $('#configForm').serializeArray(), function(data) {
if (data.success == true) {
easyDialog.open({
container : 'successMessage'
});
} else {
bigDeal.showMessage(data.data);
isSubmit = false;
}
});
});
})