You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
98
static/app2/js/distribution.js
Executable file
98
static/app2/js/distribution.js
Executable file
@ -0,0 +1,98 @@
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var userId = self.userId
|
||||
var idx = 0;
|
||||
var curIdx;
|
||||
var productNum = "";
|
||||
var couponsNum = '';
|
||||
var click = false;
|
||||
var type, payPwd, num;
|
||||
//获取数据
|
||||
JZL.ajax(qlgUrl('app/users/getInvestmentMoney'), {
|
||||
userId: userId
|
||||
}, function(data) {
|
||||
// console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
productNum = data.productNum;
|
||||
couponsNum = data.couponsNum;
|
||||
$(".product .productNum").val(productNum);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$(".nav").on("tap", ".nav-item", function() {
|
||||
curIdx = idx
|
||||
idx = $(this).index()
|
||||
|
||||
$(".nav .nav-item ").eq(idx).addClass("active")
|
||||
$(".nav .nav-item ").not($(".nav .nav-item ").eq(idx)).removeClass("active")
|
||||
$(".content .content_ ").eq(idx).show()
|
||||
$(".content .content_ ").not($(".content .content_ ").eq(idx)).hide()
|
||||
if (0 == idx) { //product
|
||||
if (curIdx != idx) {
|
||||
//获取数据
|
||||
$(".product .productNum").val(productNum);
|
||||
}
|
||||
|
||||
} else if (1 == idx) { //voucher
|
||||
if (curIdx != idx) {
|
||||
//获取数据
|
||||
$('.voucher .couponsNum ').val(couponsNum)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(".down").on("tap", function() {
|
||||
if (true == click) {
|
||||
return
|
||||
}
|
||||
click = true;
|
||||
|
||||
|
||||
if ('' == $('.product .productNum').val() || '' == $.trim($('.product .productNum').val())) {
|
||||
mui.alert("券值不能为空");
|
||||
return;
|
||||
}
|
||||
if ($('.product .productNum').val() < 15) {
|
||||
mui.alert("券值不能低于15 ");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == idx) { //product
|
||||
num = parseFloat($('.product .productNum').val())
|
||||
type = 1;
|
||||
payPwd = $('.proPassWord').val();
|
||||
|
||||
}
|
||||
if (1 == idx) { //voucher
|
||||
//ajax
|
||||
num = parseFloat($('.voucher .couponsNum').val())
|
||||
type = 2;
|
||||
payPwd = $('.vouPassWord').val();
|
||||
|
||||
}
|
||||
if ('' == payPwd) {
|
||||
mui.alert("操作密码不能为空");
|
||||
return;
|
||||
}
|
||||
console.log(idx);
|
||||
JZL.ajax(qlgUrl("app/users/distributionInvestmentMoney"), {
|
||||
userId: userId,
|
||||
type: type,
|
||||
num: num,
|
||||
payPwd: payPwd
|
||||
}, function(data) {
|
||||
if (1 == data.status){
|
||||
mui.toast(data.msg)
|
||||
mui.back();
|
||||
}else {
|
||||
mui.alert (data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user