withdrew.js
3.29 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
/**
* 提现 操作
*/
! function($) {
"use strict";
var config = {
selectCb: function() {} //选中回调
};
/**
* 初始化下拉控件
* @param {[type]} $ele [元素]
* @param {Function} cb [选中回调]
*/
function initSlect($ele, cb) {
var $select_form = $(".select-form", $ele);
var $current = $(".current", $ele);
$ele.on("click", ".change", function openForm() {
$select_form.show();
$(".change", $ele).hide();
});
$ele.on("click", ".current", function openForm() {
$select_form.show();
$(".change", $ele).hide();
});
$ele.on("click", ".select-form .banks li", function openForm() {
$(".change", $ele).show();
$select_form.hide();
var cardId = Number($(this).attr('data-cardid'));
$current.html($.clone($(this)[0]));
if (typeof cb === "function") {
cb(cardId);
}
});
$('body').on('click', function(e) {
var $dropmenu = $(".dropmenu");
var target = $(e.target);
if (target.closest('html').length && !target.closest('.current').length && !target.closest('.select-form .banks li').length && $(".select-form", $ele).is(":visible")) {
$(".change", $ele).show();
$select_form.hide();
}
});
}
function init() {
// 初始化下拉选择
initSlect($(".modal-select"), config.selectCb);
// 业务事件
bindEvent();
}
function on_btn_addbank() {
$('.modal-select').hide();
$("#ids_addbankbox").show();
return false;
}
function on_btn_reback_select() {
on_btn_reback2add();
$('.modal-select').show();
$("#ids_addbankbox").hide();
}
function on_btns_selectbank2add() {
$("#btns_selectbank2add").hide();
$("#ids_addbankform").show();
}
function on_btn_reback2add() {
$("#ids_addbankform").hide();
$("#btns_selectbank2add").show();
}
function bindEvent() {
$("#btn_addbank").click(on_btn_addbank);
$("#btn_reback_select").click(on_btn_reback_select);
$("#btns_selectbank2add").on('click', 'a', on_btns_selectbank2add);
$("#btn_reback2add").click(on_btn_reback2add);
}
if (!window.withdrew) {
window.withdrew = {
init: init,
config: function(key, value) {
if (!/\w+/.test(key)) {
return false;
}
if (typeof value !== "undefined") {
config[key] = value;
} else {
return config[key];
}
}
};
}
}(jQuery);
//apply
$(function() {
withdrew.config('selectCb', function(id) {
console.log(id);
});
withdrew.init();
});
define(function(require, exports, module) {
var Miniclock = require('miniclock');
require('fancybox');
$('.fancy').fancybox({
});
$('.timer').on({
click: function(){
new Miniclock(this, {
SD: "重新发送",
WT: "s",
ban: "disabled",
callback: function(){
}
});
}
})
});