sMSOrder.js
6.56 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
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
(function (angular) {
function sMSOrder($scope, systemService, DTColumnBuilder, DTOptionsBuilder, $state, $filter, Utils) {
systemService.getMerchantSmsNum(function (response) {
if (response.data != null){
$scope.smsNum = response.data.smsNum;
if (response.data.smsSend != null){
$scope.smsSend = response.data.smsSend;
}else{
$scope.smsSend = 0;
}
if ($scope.smsNum <= 0){
$scope.rechargeShow1 = true;
$scope.rechargeShow2 = false;
$scope.rechargeShow3 = false;
$scope.smsNumLackTips = "当前短信已用完,请及时充值";
return;
}
$scope.smsLimit = response.data.smsLimit;
if ($scope.smsNum < $scope.smsLimit) {
$scope.rechargeShow2 = true;
$scope.rechargeShow1 = false;
$scope.rechargeShow3 = false;
$scope.smsNumLackTips = "当前短信仅剩" + $scope.smsNum + "条" + ",请及时充值";
}
else if($scope.smsNum >= $scope.smsLimit){
$scope.rechargeShow3 = true;
$scope.rechargeShow1 = false;
$scope.rechargeShow2 = false;
$scope.smsNumLackTips = "当前短信剩余" + $scope.smsNum + "条";
}
else{
$scope.rechargeShow1 = false;
$scope.rechargeShow2 = false;
$scope.rechargeShow3 = false;
}
}
else{
$scope.smsNum = 0;
$scope.smsSend = 0;
}
});
var payTypeFunc = (function () {
return function (e, dt, node, config) {
var results = null;
if (node.payType == null) {
results = "--"
} else {
//(0: 嘀嘀充值卡,1:银联,2:支付宝,3:微信扫码,4:话费充值卡,5:微信网页)'
if (node.payType == 1){
results = "银联";
}
else if(node.payType == 2){
results = "支付宝";
}
else if(node.payType == 3){
results = "微信";
}
else if(node.payType == 4){
results = "话费充值卡";
}
else if(node.payType == 5){
results = "微信";
}
else{
results = "错误";
}
}
return results;
};
})();
var payStatusFunc = (function () {
return function (e, dt, node, config) {
var results = null;
if (node.payStatus == null) {
results = "--"
} else {
//(0: 嘀嘀充值卡,1:银联,2:支付宝,3:微信扫码,4:话费充值卡,5:微信网页)'
if (node.payStatus == 1){
results = "待支付";
}
else if(node.payStatus == 2){
results = "已支付";
}
else if(node.payStatus == 3){
results = "支付失败";
}
else{
results = "---";
}
}
return results;
};
})();
var successTimeFunc = (function () {
return function (e, dt, node, config) {
var results = null;
if (node.successTime == null) {
results = "-----";
} else {
results = node.successTime;
}
return results;
};
})();
$scope.dtColumns = [
DTColumnBuilder.newColumn('code').withOption('width',80).withTitle('订单号'),
DTColumnBuilder.newColumn('packageName').withOption('width',70).withTitle('套餐名称'),
DTColumnBuilder.newColumn('purchaseCount').withOption('width',50).withTitle('购买数量'),
DTColumnBuilder.newColumn('smsCount').withOption('width',50).withTitle('短信数量'),
DTColumnBuilder.newColumn('payMoney').withOption('width',50).withTitle('购买金额'),
DTColumnBuilder.newColumn('payStatus').withOption('width',50).withTitle('支付状态').renderWith(payStatusFunc),
DTColumnBuilder.newColumn('payType').withOption('width',50).withTitle('支付方式').renderWith(payTypeFunc),
DTColumnBuilder.newColumn('successTime').withOption('width',120).withTitle('支付时间').renderWith(successTimeFunc)
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withOption('num', false)
.withFixedColumns({
leftColumns: 1,
rightColumns: 0
});
function getParams(){
var obj = {};
if ($scope.code != null && $scope.code.length > 0){
obj.code = $scope.code;
}
if ($scope.packageName != null && $scope.packageName.length > 0) {
obj.packageName = $scope.packageName;
}
if ($scope.payType != null) {
obj.payType = $scope.payType;
}
//obj.payStatus = 2;
return obj;
}
$scope.dtInstance = {
serverData : systemService.getSmsRechargeListInfo
};
//短信充值
$scope.sMSRecharge = function (id) {
$state.go('system.sms.recharge',{id:id});
};
$scope.searchBnt = function(){
var params = getParams();
$scope.dtInstance.query({condition: params});
}
$scope.exportExcel = function(){
if($scope.isExporting) return;
var params = getParams();
var options={
url:"smsMarketingManage/exportSmsRechargeListInfo"
};
Utils.exportExcel(options, params, function(){
$scope.$apply(function(){
$scope.isExporting = false
})
});
};
}
angular.module('system').controller('sMSOrder', sMSOrder);
})(angular);