2752 lines
86 KiB
JavaScript
2752 lines
86 KiB
JavaScript
define(['app', 'service', 'jquery', 'layer','area'], function (app) {//
|
||
'use strict';
|
||
//用户个人中心
|
||
app.controller('userCenterCtrl', function ($scope, $rootScope, UserCenter, Storage, ENV, Check, $state, Market, $filter, Auth, $interval, fixedFun, $stateParams, $timeout, Recharge,timeExample,$window,PayAction) {
|
||
|
||
$scope.timeExample=timeExample;
|
||
|
||
//清除定时器公共
|
||
$scope.$on("$destroy",function(){
|
||
$interval.cancel($scope.payTime);
|
||
$interval.cancel($scope.timerTel);
|
||
$interval.cancel($scope.farmerTimer);
|
||
});
|
||
//检查是不是微信原生支付
|
||
$scope.is_weixn = (function (){
|
||
var ua = navigator.userAgent.toLowerCase();
|
||
if(ua.match(/MicroMessenger/i)=="micromessenger") {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
})();
|
||
$scope.layDateFun=function (objID) {
|
||
var laydate = layui.laydate;
|
||
laydate.render({
|
||
elem: '#'+objID //指定元素
|
||
});
|
||
}
|
||
//短信验证码公共方法
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.telModel=function(imgCode,limit,btnTxt,telType,imgId,val){
|
||
var num = 60;//验证码有效时间设置
|
||
if (Check.empty(imgCode)) {//检查图片验证码是否为空
|
||
layer.msg("请输入图片验证码");
|
||
return false;
|
||
};
|
||
if (limit) {
|
||
$scope.modelTelLimit = false;
|
||
//开始请求短信
|
||
if(val){
|
||
Auth.getTelCode(val, '', telType, imgCode).then(function (data) {//成功
|
||
$scope.modelTelTxt = num + " s";
|
||
layer.msg(data.msg);
|
||
$scope.timerTel = $interval(function () {
|
||
num--;
|
||
if (num <= 0) {
|
||
$scope.modelTelTxt = "重新获取";
|
||
$scope.modelTelLimit = true; //重新获取短信,及过期设置
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
} else {
|
||
$scope.modelTelTxt = num + " s";
|
||
}
|
||
}, 1000);
|
||
|
||
|
||
}, function (data) {
|
||
$scope.modelTelLimit = false;
|
||
layer.msg(data);
|
||
if(data=='验证码错误'){//imgCodetemp
|
||
var imgCodeTemp=$("#"+imgId).attr('ng-src');
|
||
$("#"+imgId).attr('src',imgCodeTemp+"?"+Math.random());
|
||
|
||
}
|
||
|
||
|
||
})
|
||
}else{
|
||
Auth.getTelCode($scope.userHomeLoad.telphone, '', telType, imgCode).then(function (data) {//成功
|
||
$scope.modelTelTxt = num + " s";
|
||
layer.msg(data.msg);
|
||
$scope.timerTel = $interval(function () {
|
||
num--;
|
||
if (num <= 0) {
|
||
$scope.modelTelTxt = "重新获取";
|
||
$scope.modelTelLimit = true; //重新获取短信,及过期设置
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
} else {
|
||
$scope.modelTelTxt = num + " s";
|
||
}
|
||
}, 1000);
|
||
|
||
|
||
}, function (data) {
|
||
$scope.modelTelLimit = false;
|
||
layer.msg(data);
|
||
if(data=='验证码错误'){//imgCodetemp
|
||
var imgCodeTemp=$("#"+imgId).attr('ng-src');
|
||
$("#"+imgId).attr('src',imgCodeTemp+"?"+Math.random());
|
||
|
||
}
|
||
|
||
|
||
})
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
//公共分页
|
||
$scope.pageTotalModel='';//总页数
|
||
$scope.currentPageModel = 1;//当前页
|
||
//页码校验 keyup blur
|
||
$scope.pageInputKeyUp = function (num) {
|
||
var num = parseInt(num);
|
||
$scope.currentPageModel = num;
|
||
if($scope.currentPageModel<=0){
|
||
$scope.currentPageModel=1;
|
||
}
|
||
|
||
};
|
||
$scope.pageInputModel = function (num) {
|
||
var num = parseInt(num);
|
||
$scope.currentPageModel = num;
|
||
if ($scope.currentPageModel >= $scope.pageTotalModel) {
|
||
$scope.currentPageModel = $scope.pageTotalModel;
|
||
}else if($scope.currentPageModel <= 0){
|
||
$scope.currentPageModel = 1;
|
||
}
|
||
if(!$scope.currentPageModel){//初始化
|
||
$scope.currentPageModel=1;
|
||
}
|
||
};
|
||
// 点击获取列表数据
|
||
var getPageModel = function (getDataFun,argu1,argu2,argu3,argu4,argu5) {
|
||
getDataFun(1,argu1,argu2,argu3,argu4,argu5);
|
||
return {
|
||
homePage: function () {//首页
|
||
if ($scope.currentPageModel == 1) {
|
||
$scope.currentPageModel = 1;
|
||
return false;
|
||
}
|
||
$scope.currentPageModel = 1;
|
||
getDataFun($scope.currentPageModel,argu1,argu2,argu3,argu4,argu5);//获取数据
|
||
},
|
||
lasePage: function () {//末页
|
||
if ($scope.currentPageModel == $scope.pageTotalModel) {
|
||
$scope.currentPageModel = $scope.pageTotalModel;
|
||
return false;
|
||
}
|
||
$scope.currentPageModel = $scope.pageTotalModel;
|
||
getDataFun($scope.currentPageModel,argu1,argu2,argu3,argu4,argu5);//获取数据
|
||
},
|
||
nextPage: function () {//下一页
|
||
$scope.currentPageModel += 1;
|
||
if ($scope.currentPageModel > $scope.pageTotalModel) {
|
||
$scope.currentPageModel = $scope.pageTotalModel
|
||
return false;
|
||
}
|
||
getDataFun($scope.currentPageModel,argu1,argu2,argu3,argu4,argu5);//获取数据
|
||
},
|
||
prePage: function () {//上一页
|
||
$scope.currentPageModel -= 1;
|
||
if ($scope.currentPageModel <= 0) {
|
||
$scope.currentPageModel = 1;
|
||
return false;
|
||
}
|
||
getDataFun($scope.currentPageModel,argu1,argu2,argu3,argu4,argu5);//获取数据
|
||
},
|
||
goToPageFun: function () {
|
||
getDataFun($scope.currentPageModel,argu1,argu2,argu3,argu4,argu5);//获取数据
|
||
}
|
||
}
|
||
};
|
||
|
||
layui.use(['layer','form','laydate'],function(){
|
||
var layer = layui.layer,
|
||
laydate = layui.laydate;
|
||
// form = layui.form();
|
||
|
||
//检测是不是有本地存储
|
||
if (!Storage.get('user')) {
|
||
Auth.loginExit();
|
||
};
|
||
var timer;
|
||
//农产链接地址
|
||
$scope.farmGameUrl = ENV.imgSrc;
|
||
//navSlid 导航信息的显示
|
||
$scope.openAuth = $stateParams.openAuth ? $stateParams.openAuth : 0;//菜单open
|
||
$scope.childCurrent = $stateParams.childCurrent ? $stateParams.childCurrent : 0;//子菜单显示状态
|
||
$scope.enterGameUrlFun=function(){
|
||
$scope.enterGameUrl=$scope.farmGameUrl+"/farm?token="+Storage.get("user");
|
||
return false;
|
||
}
|
||
|
||
//图片上传 jquery
|
||
$scope.formUrlSet = ENV.API_URL + "/User/uploadAvatar";
|
||
|
||
//上传图片函数
|
||
$scope.showImageUser;//用户头像的地址
|
||
|
||
$scope.IDCardFrontImg;//身份证正面
|
||
$scope.IDCardBackImg;//身份证反面
|
||
|
||
$scope.IDCardFrontImgBase;//身份证正面base
|
||
$scope.IDCardBackImgBase;//身份证反面base
|
||
|
||
$scope.tiXianImg;//提现图片上传
|
||
$scope.tiXianImgName;//图片名称
|
||
$scope.haveCkeckImg=false;//是否选择上传图片
|
||
|
||
$scope.uploadImgFun = function (dataImg, type,callBack) {//dataImg (base64 数据)
|
||
UserCenter.uploadAvatarFun(dataImg, type).then(function (res) {
|
||
|
||
if(res.code==0){
|
||
layer.msg('上传成功');
|
||
if(type=='avatar'){
|
||
//$scope.showImageUser = ENV.imgSrc + res.data;
|
||
}else if(type=='wx_img'){
|
||
$scope.haveCkeckImg=false;//隐藏立即上传
|
||
}
|
||
callBack && callBack();
|
||
}else{
|
||
layer.msg(res.msg);
|
||
}
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
|
||
};
|
||
$scope.imgChangeFun=function(files,fileID){
|
||
$scope.imageHabeLoad=false;
|
||
var reader = new FileReader();
|
||
var imgdata;
|
||
var imageData=files[0];
|
||
reader.readAsDataURL(files[0]);
|
||
reader.onload = (function (file) {
|
||
if (fileID == 'imgTest') {//头像
|
||
$("#showImage")[0].src = file.target.result;
|
||
imgdata = file.target.result;
|
||
$scope.uploadImgFun(imgdata, 'avatar');
|
||
}else if (fileID == 'IDCardFrontImg') {
|
||
$scope.IDCardFrontImg = imageData.name;
|
||
$scope.IDCardFrontImgBase = file.target.result;
|
||
} else if (fileID == 'IDCardBackImg') {
|
||
$scope.IDCardBackImg = imageData.name;
|
||
$scope.IDCardBackImgBase = file.target.result;
|
||
}else if (fileID == 'imgTiXian') {
|
||
//提现图片
|
||
$scope.tiXianImg=file.target.result;
|
||
$scope.tiXianImgName=imageData.name;
|
||
$scope.haveCkeckImg=true;
|
||
|
||
}
|
||
$scope.imageHabeLoad=true;
|
||
$scope.$apply();
|
||
|
||
|
||
|
||
});
|
||
|
||
}
|
||
|
||
//开始上传图片
|
||
$scope.tiXianImgUpdate=function () {
|
||
$scope.uploadImgFun($scope.tiXianImg, 'wx_img');
|
||
}
|
||
$scope.spreadDecide = false;//判断是否有推广吗
|
||
$scope.spreadDecideNum;//上级推广吗
|
||
$scope.farmerTimer;//农贸市场定时器
|
||
|
||
$scope.openAuthFun = function (num) {//菜单
|
||
$interval.cancel($scope.payTime)
|
||
$scope.childCurrent = 0;//重置子菜单
|
||
|
||
$scope.openAuth = num;//打开菜单
|
||
if(num==2){$scope.homeLoad();}
|
||
if (num == 1) {//农贸市场
|
||
$interval.cancel($scope.farmerTimer);//清除定时器
|
||
$scope.nongMaoFun = function () {
|
||
Market.productList().then(function (data) {
|
||
angular.forEach(data, function (v, k) {
|
||
//v.marketinfo.thumb = ENV.imgSrc + v.marketinfo.thumb;
|
||
})
|
||
$scope.pageData = data;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
$scope.nongMaoFun();
|
||
$scope.farmerTimer=$interval(function () {//5s刷新一下
|
||
$scope.nongMaoFun();
|
||
}, 5000);
|
||
|
||
|
||
}
|
||
if (num == 0) {//推广中心
|
||
//return false;
|
||
//alert('111111');
|
||
var ImgCodeFun = ENV.imgSrc + '/web/#/register/' + $scope.userHomeLoad.id;
|
||
//$scope.fruitImgUrl = "http://qr.liantu.com/api.php?text=https://fir.im/6a5s";
|
||
var fruitImgUrl = "http://api.k780.com:88/?app=qr.get&data="+encodeURIComponent(ImgCodeFun);
|
||
$scope.fruitHttpUrl =ImgCodeFun;
|
||
$("#fruitImg").attr('src',fruitImgUrl);
|
||
//$scope.fruitImgUrl = "http://qr.liantu.com/api.php?text=https://fir.im/6a5s";
|
||
//$scope.fruitImgUrl = "http://api.k780.com:88/?app=qr.get&data="+encodeURIComponent(ImgCodeFun)+"&level=L&size=9";
|
||
//$scope.fruitHttpUrl =ImgCodeFun;
|
||
|
||
//var ImgCodeGame = ENV.imgSrc+'/farm/?ref='+$scope.userHomeLoad.id;
|
||
//$scope.GameImgUrl = "http://qr.liantu.com/api.php?text=https://fir.im/gjcl";
|
||
//$scope.GameImgUrl = "https://sp0.baidu.com/5aU_bSa9KgQFm2e88IuM_a/micxp1.duapp.com/qr.php?value="+encodeURIComponent(ImgCodeGame);
|
||
//$scope.GameHttpUrl =ImgCodeGame;
|
||
|
||
UserCenter.addSpreadFun($scope.addSpreadNum).then(function (data) {
|
||
$scope.spreadDecide = true;
|
||
$scope.spreadDecideNum = data;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}
|
||
})
|
||
|
||
|
||
}
|
||
if(num == 3){//点击进入渠道代理
|
||
|
||
$scope.pageTotalModel='';//总页数
|
||
$scope.currentPageModel = 1;//当前页
|
||
//数据模型
|
||
var options=[];
|
||
$scope.myAchiveFun=function(page,argu1,argu2){
|
||
UserCenter.channelListFun(page,argu1,argu2).then(function(data){
|
||
$scope.consumptionAllachive=data.data.amountAll;//消费
|
||
$scope.commissionAllachive=data.data.totalprice;//佣金
|
||
|
||
$scope.ArticalListQD=data.data.list;
|
||
$scope.pageTotalModel=data.data.total_pages;
|
||
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
$scope.getPageModel=getPageModel($scope.myAchiveFun);
|
||
|
||
//查询
|
||
$scope.MyAchiveSearch=function(){
|
||
$scope.currentPageModel = 1;//当前页
|
||
var start=$("#MyAchiveStart").val(),end=$("#MyAchiveEnd").val();
|
||
if(angular.isUndefined(start) ||end.length==0){
|
||
layer.msg("请选择开始时间")
|
||
return false;
|
||
}
|
||
if(angular.isUndefined(end) ||end.length==0){
|
||
layer.msg("请选择时间");
|
||
return false;
|
||
}
|
||
$scope.getPageModel=getPageModel($scope.myAchiveFun,start,end);
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
//三级联动
|
||
$scope.shennongAddValue='';//sn地址默认值
|
||
var province=[];
|
||
var city=[];
|
||
var country=[];
|
||
$scope.isZXS;
|
||
$scope.xiangZhenShow;
|
||
for(var i=0;i<arrCity.length;i++){
|
||
province.push(arrCity[i].name);
|
||
}
|
||
$scope.s_province=province;
|
||
$scope.nextSelectedFun=function(val,lev){
|
||
if(lev==0){//省直辖市
|
||
$scope.s_city="";
|
||
$scope.s_county='';
|
||
for(var i=0;i<arrCity.length;i++){
|
||
if(arrCity[i].name==val){
|
||
if(arrCity[i].type==0){
|
||
$scope.isZXS=true;
|
||
}else{
|
||
$scope.isZXS=false;
|
||
}
|
||
city=[];
|
||
var tempCity=arrCity[i].sub;
|
||
for(var j=0;j<tempCity.length;j++){
|
||
city.push(tempCity[j].name);
|
||
}
|
||
break;
|
||
}
|
||
};
|
||
$scope.shennongAddValue='';
|
||
$scope.shennongAddValue+=$scope.province;
|
||
$scope.s_city=city;
|
||
}else if(lev==1){//县
|
||
$scope.s_county='';
|
||
for(var i=0;i<arrCity.length;i++){
|
||
if(arrCity[i].name==$scope.province){
|
||
var tempCity=arrCity[i].sub;
|
||
for(var j=0;j<tempCity.length;j++){
|
||
if(tempCity[j].name==val && $scope.isZXS==false){
|
||
country=[];
|
||
var tempCountry=tempCity[j].sub;
|
||
for(var k=0;k<tempCountry.length;k++){
|
||
country.push(tempCountry[k].name);
|
||
}
|
||
|
||
$scope.s_county=country;
|
||
|
||
break;
|
||
|
||
}else{
|
||
$scope.s_county='';
|
||
$scope.country='';
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
$scope.shennongAddValue+=$scope.city;
|
||
}
|
||
}
|
||
$scope.countryShennong=function(val){//
|
||
$scope.shennongAddValue+=val;
|
||
}
|
||
|
||
//绑定提现账户
|
||
$scope.bankShowBtn = false;//银行列表
|
||
$scope.userHaveBank = false;//是否已经绑定
|
||
$scope.withdrawCheck = function () {//检查是否绑定,是 提现 否 绑定
|
||
UserCenter.withdrawFun().then(function (data) {//已经绑定
|
||
console.log(data);
|
||
$scope.bankChecked = data.error_msg.dueBank;//银行名字
|
||
$scope.CardNo = data.error_msg.zfb;//银行账号
|
||
$scope.dueBankAccount=data.error_msg.realname;//开户姓名
|
||
|
||
$scope.bankaccount = data.error_msg.bankaccount;//开户行
|
||
|
||
$scope.userHaveBank = true;
|
||
$scope.bankListShow = null;
|
||
}, function (data) {//没有绑定
|
||
$scope.province = "请选择";//省
|
||
$scope.city = "请选择";//市
|
||
$scope.country="请选择";//县/乡
|
||
$scope.userHaveBank = false;
|
||
$scope.bankListShow = function () {//银行列表
|
||
$scope.bankShowBtn = !$scope.bankShowBtn;
|
||
}
|
||
})
|
||
}
|
||
$scope.withdrawCheck();
|
||
|
||
//初次获取委托(0) 或者交易记录 (1)
|
||
$scope.newHistorySearchFun = function (page,sid, type, createtime, endtime) {
|
||
UserCenter.newHistorySearch(page,sid, type, createtime, endtime).then(function (data) {
|
||
$scope.pageTotalModel=data.total_pages;
|
||
angular.forEach(data.list, function (v, k) {
|
||
if (v.del == 0) {//有操作
|
||
if (v.dealnum != v.num && v.dealnum != 0) {
|
||
v.statusName = '未完全成交';
|
||
} else if (v.dealnum == 0) {
|
||
v.statusName = '未成交';
|
||
}
|
||
} else if (v.del == 1) {//没有操作
|
||
// v.statusName=;
|
||
if (v.dealnum == v.num) {
|
||
v.statusName = '完全成交';
|
||
} else if (v.dealnum == 0) {
|
||
v.statusName = '已撤销';
|
||
} else if (v.num - v.dealnum > 0) {
|
||
v.statusName = '未完全成交';
|
||
}
|
||
}
|
||
});
|
||
$scope.ArticalListWT=data.list;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
};
|
||
|
||
|
||
//实名认证1(默认false,调整身份证修改为true)
|
||
$scope.nameCheckOne = false;
|
||
$scope.nameCheckOneHave = false;//是否进行过实名认证
|
||
$scope.nameCheckLenvel = '[C1]';//实名认证等级
|
||
$scope.userIDStates = 0;//C2申请认证状态 0未认证 1通过认证费 2等待认证
|
||
$scope.trueNameUpdate = function (realname, idcard) {//实名认证信息提交
|
||
|
||
UserCenter.realNameFun(realname, idcard).then(function (data) {
|
||
$scope.nameCheckOne = true;
|
||
$scope.userIDStates = data.status;
|
||
// $scope.userIDStates=1;
|
||
if ($scope.nameCheckOne) {//实名认证c1 设置安全设置里面的实名认证等级
|
||
if ($scope.userIDStates == 1) {
|
||
$scope.nameCheckLenvel = '[C2]';//实名认证等级
|
||
}
|
||
}
|
||
$scope.trueNameEdit = data.realname;
|
||
$scope.trueCodeEdit = data.idcard;
|
||
}, function (data) {
|
||
$scope.nameCheckOne = false;//实名认证1
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
$scope.trueNameUpdate();//检验是否认证
|
||
|
||
//乡镇是否显示s_county country
|
||
if($scope.s_county){
|
||
$scope.xiangZhenShow=true;
|
||
}else if($scope.country){
|
||
$scope.xiangZhenShow=true;
|
||
}else{
|
||
$scope.xiangZhenShow=false;
|
||
}
|
||
//身份证图片上传
|
||
$scope.userIDupdate = function () {
|
||
if (!$scope.IDCardFrontImgBase) {
|
||
layer.msg("请上传身份证正面图片!");
|
||
return false;
|
||
}
|
||
;
|
||
if (!$scope.IDCardBackImgBase) {
|
||
layer.msg("请上传身份证反面图片!");
|
||
return false;
|
||
}
|
||
;
|
||
var type = 'FrontImg';
|
||
$('body').prepend($rootScope.loadingStr);
|
||
|
||
var dataStatus=[];
|
||
var callBack=function () {
|
||
dataStatus.push(1);
|
||
if(dataStatus.length==2){
|
||
$(".loadingBox").remove();
|
||
$scope.userIDStates = 2;
|
||
}
|
||
}
|
||
var dataArray=[{'data':$scope.IDCardFrontImgBase,'type':'FrontImg'},{'data':$scope.IDCardBackImgBase,'type':'BackImg'}];
|
||
for(var i=0;i<dataArray.length;i++){
|
||
$scope.uploadImgFun(dataArray[i].data,dataArray[i].type,callBack);
|
||
}
|
||
|
||
}
|
||
|
||
//提现图文教程
|
||
$scope.tiXianShow=false;
|
||
$scope.tiXianTeacher=function(){
|
||
$scope.tiXianShow=!$scope.tiXianShow;
|
||
}
|
||
|
||
//小额支付开启
|
||
|
||
$scope.updataSmallpay = function (imgCode, telCode) {//uid,status,imgCode,telCode
|
||
var status;
|
||
if ($scope.SmallpayOpened) {//处于开启 关闭操作
|
||
status=0;
|
||
}else{//处于关闭 开启操作
|
||
status=1;
|
||
}
|
||
UserCenter.SmallpayFun(status, imgCode, telCode).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
if(data.data==1){
|
||
$scope.SmallpayOpened=true;
|
||
}else{
|
||
$scope.SmallpayOpened=false;
|
||
}
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
$scope.childCurrent=1;//跳转安全设置
|
||
},function(data){
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
};
|
||
|
||
$scope.childMenuClick = function (num, sid) {//子菜单 sid商品id
|
||
|
||
$interval.cancel($scope.payTime);//订单查询清除
|
||
$timeout.cancel($scope.timer);
|
||
$scope.childCurrent = num;
|
||
if ($scope.openAuth == 0) {//用户中心
|
||
|
||
if ($scope.childCurrent == 3) {
|
||
$scope.AmountCheck = function (val) {//输入改变的时候
|
||
var AmountNum = parseInt(val);
|
||
if (AmountNum >= 20000) {
|
||
$scope.Amount = 19999;
|
||
};
|
||
};
|
||
//支付类型选泽
|
||
$scope.AmountType = 1;
|
||
$scope.AmountCheckType = function (val) {
|
||
if (val > 1) {
|
||
layer.msg("该支付暂时还未开通,敬请等待……");
|
||
return false;
|
||
}
|
||
$scope.AmountType = val;
|
||
};
|
||
|
||
$scope.AmountCheckBlur = function (val) {//失去焦点的时候
|
||
$scope.AmountCheck(val);
|
||
if ($scope.Amount <= 1) {
|
||
$scope.Amount = 1;
|
||
};
|
||
|
||
var AmountStr = String(val);
|
||
if (AmountStr< 1) {
|
||
layer.msg("充值数量不低于1");
|
||
$scope.Amount=AmountStr*1+1;
|
||
}
|
||
;
|
||
};
|
||
|
||
//定时刷新(发起扫码支付使用)
|
||
var payTimer=function (orderNum) {
|
||
UserCenter.checkOrderFun(orderNum).then(function(data){
|
||
//1 chenggogn 2 daizhifu 3 shibai
|
||
if(data==1){
|
||
$interval.cancel($scope.payTime);
|
||
$scope.childMenuClick(3);
|
||
alert('支付成功');
|
||
}
|
||
});
|
||
};
|
||
|
||
//微信支付
|
||
$scope.wx_paySelf=function(){
|
||
// layer.msg("微信原生支付开发中,请稍等");
|
||
PayAction.PayAction($scope.Amount,"WeChat").then(function(data){
|
||
console.log("微信原生支付开发中")
|
||
});
|
||
}
|
||
|
||
$scope.scanCodeFun=function(){
|
||
console.log(Storage.get('user'),"点击获取")
|
||
var Amounttype;
|
||
if ($scope.AmountType == 0) {
|
||
Amounttype = 'wxpay';
|
||
$scope.payTypeAmount="微信";
|
||
}
|
||
if ($scope.AmountType == 1) {
|
||
Amounttype = 'alipay';
|
||
$scope.payTypeAmount="支付宝";
|
||
}
|
||
Recharge.RechargeFun($scope.Amount, Amounttype).then(function (data) {
|
||
console.log(data)
|
||
window.location.href='/pay/index.php?orderid='+data.error_msg.order_id+'&payType='+data.error_msg.payType+'&money='+data.error_msg.money;
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
//请求充值记录
|
||
$scope.scanCodeHistory = function () {
|
||
Recharge.RechargeHistoryFun().then(function (data) {
|
||
angular.forEach(data, function (v, k) {
|
||
if (v.status == 1) {
|
||
v.payStatusTitle = "支付成功"
|
||
} else if (v.status == 0) {
|
||
v.payStatusTitle = "待付款"
|
||
}
|
||
|
||
if(v.payType=="alipay"){
|
||
v.payType="支付宝";
|
||
}
|
||
if(v.payType=="wxpay"){
|
||
v.payType="微信";
|
||
}
|
||
|
||
})
|
||
$scope.scanCodeHistoryList = data;
|
||
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
};
|
||
$scope.scanCodeHistory();
|
||
}
|
||
if ($scope.childCurrent == 4) {
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
//5 s 后跳转金币绑定账户 提现纪录
|
||
$scope.XNBshow=false;//显示银行卡还是虚拟币
|
||
//提现纪录
|
||
$scope.getGoldHistory = function () {
|
||
UserCenter.withdrawHistoryFun().then(function (data) {
|
||
angular.forEach(data, function (v, k) {
|
||
if (v.status == 0) {
|
||
v.passType = "审核中";
|
||
}
|
||
if (v.status == 1) {
|
||
v.passType = "已提现";
|
||
}
|
||
if (v.status == 2) {
|
||
v.passType = "提现拒绝";
|
||
}
|
||
|
||
|
||
})
|
||
$scope.pageGoldHistory = data;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}//不是sn
|
||
|
||
$scope.shennongCard=function(){//sn提现纪录 银行卡 虚拟币
|
||
UserCenter.virtualListFun().then(function(data){
|
||
$scope.shennongHistory=data.data;
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
};
|
||
|
||
var shennongFun=function (){
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
//获取短信验证码
|
||
$scope.getTelModel=function(){
|
||
$scope.telModel($scope.modelImgCode,$scope.modelTelLimit,$scope.modelTelTxt,'withdraw','goldImgCode');
|
||
}
|
||
|
||
|
||
$scope.userGetAmount = 100;//用户体现金币
|
||
$scope.goldImgCode//用户二维码
|
||
$scope.getGoldNumCheck//用户手机验证码
|
||
|
||
//可用金币
|
||
$scope.GetAmountCheck = function (val) {
|
||
var val=parseInt(val);
|
||
if(val*1<0){
|
||
val=val*-1;
|
||
}
|
||
if (val*1 > $scope.userHomeLoad.gold*1) {
|
||
layer.msg("可用金币不足!");
|
||
$scope.userGetAmount=Math.floor($scope.userHomeLoad.gold/100)*100;
|
||
}else if(val>50000){
|
||
layer.msg('单次提现的最高限额为50000金币');
|
||
$scope.userGetAmount=50000;
|
||
}else{
|
||
$scope.userGetAmount=val;
|
||
}
|
||
}
|
||
|
||
//提现
|
||
$scope.getGoldOutFun = function () {
|
||
if (angular.isUndefined($scope.userGetAmount)) {
|
||
layer.msg("提现金币不能为空");
|
||
return false;
|
||
}
|
||
if ($scope.userHomeLoad.gold*1 <100 || $scope.userGetAmount*1>$scope.userHomeLoad.gold*1) {
|
||
layer.msg("可用金币不足");
|
||
$scope.userGetAmount=100;
|
||
return false;
|
||
}else{
|
||
if($scope.userGetAmount%100!=0){//输入的数量不是100的整数倍
|
||
layer.msg('体现金币为100的整数倍');
|
||
if($scope.userGetAmount<100){
|
||
$scope.userGetAmount=100
|
||
}else{
|
||
$scope.userGetAmount=Math.floor($scope.userGetAmount/100)*100;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
// if (angular.isUndefined($scope.modelTelCode)) {
|
||
// layer.msg("短信验证码不能为空");
|
||
// return false;
|
||
// }
|
||
|
||
UserCenter.goldWithdrawFun($scope.province, $scope.city,$scope.country, $scope.withdrawtype, $scope.CardNo, $scope.bankaccount, $scope.userGetAmount,$scope.modelImgCode,$scope.modelTelCode,$scope.trueNameEdit,$scope.userTXpwd).then(function (data) {
|
||
|
||
$scope.userGetAmount= 100;
|
||
//$scope.modelImgCode=$scope.modelTelCode=$scope.userTXpwd='';
|
||
|
||
layer.msg(data.error_msg);
|
||
// var imgCodeTemp=$("#goldImgCode").attr('ng-src');
|
||
// $("#goldImgCode").attr('src',imgCodeTemp+"?"+Math.random());
|
||
$scope.openAuth=$scope.childCurrent=0;
|
||
$scope.homeLoad();
|
||
$scope.getGoldHistory();//历史记录
|
||
|
||
}, function (data) {
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
if(data.code==403){
|
||
layer.msg(data.error_msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.error_msg);
|
||
}
|
||
});
|
||
|
||
|
||
};
|
||
};
|
||
//虚拟币不显示
|
||
if($rootScope.XNB){//先判断是否sn 然后是金币或者是虚拟币
|
||
if($rootScope.XNB.type==3){//虚拟币
|
||
$scope.shennongName=$scope.shennongGoldNum=$scope.shennongTel=$scope.province=$scope.city=$scope.country=$scope.shennongAddValue=$scope.userTXpwd='';
|
||
|
||
$scope.XNBshow=true;
|
||
$scope.shennongAddType=$rootScope.XNB.type==3?'虚拟币':'银行卡';
|
||
$scope.shennongAddValShow=false;
|
||
$scope.shennongAddChecked={'address':'','id':''};//当前选中的地址
|
||
//提现金币数量
|
||
$scope.shennongNum=function(val){
|
||
var val=parseInt(val);
|
||
if(val*1<0 || !val){
|
||
$scope.shennongGoldNum=0;
|
||
}else{
|
||
$scope.shennongGoldNum=val;
|
||
}
|
||
}
|
||
$scope.shennongTelFun=function(val){
|
||
var val=parseInt(val);
|
||
if(val*1<0 || !val){
|
||
$scope.shennongTel=0;
|
||
}else{
|
||
$scope.shennongTel=val;
|
||
}
|
||
}
|
||
//地址管理 sn 增删改查
|
||
$scope.addressManage=function(type,id){
|
||
//type,username ,address,mobile,id type,$scope.shennongName ,$scope.shennongAddValue,$scope.shennongTel,id,callBack
|
||
|
||
if(type == 'list'){//获取列表
|
||
$scope.shennongAddList='';
|
||
UserCenter.shopAddressFun(type).then(function(data){
|
||
$scope.shennongAddList=data.data;
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
}else if(type == 'add'){//增加
|
||
|
||
if (!$scope.shennongAddValue) {
|
||
layer.msg("地址不能为空");
|
||
return false;
|
||
}
|
||
UserCenter.shopAddressFun(type,$scope.shennongName ,$scope.shennongAddValue,$scope.shennongTel,id).then(function(data){
|
||
layer.msg(data.msg);
|
||
$scope.addressManage('list');
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
}else if(type=='del'){//删除
|
||
if(!$scope.shennongAddChecked.id){
|
||
layer.msg("请选择地址后再进行此操作!");
|
||
return false;
|
||
}
|
||
UserCenter.shopAddressFun(type,'' ,'','',$scope.shennongAddChecked.id).then(function(data){
|
||
layer.msg(data.msg);
|
||
$scope.addressManage('list');
|
||
$scope.shennongAddValue='';
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
|
||
};
|
||
//获取地址 存在的话就显示,不存在的话就为空
|
||
$scope.addressManage('list');
|
||
$scope.shennongCard();//获取虚拟币提现记录
|
||
|
||
$scope.shennongAddtoggle=function(){
|
||
$scope.shennongAddValShow=!$scope.shennongAddValShow;
|
||
}
|
||
$scope.shennongAddSet=function(val,id){
|
||
$scope.shennongAddValue=val;
|
||
$scope.shennongAddValShow=false;
|
||
$scope.shennongAddChecked.address=val;
|
||
$scope.shennongAddChecked.id=id;
|
||
}
|
||
|
||
//虚拟币提现 操作
|
||
$scope.shennongGoldOutFun=function(){
|
||
|
||
if (!$scope.shennongGoldNum) {
|
||
layer.msg("金币不能为空");
|
||
return false;
|
||
}
|
||
if (!$scope.shennongAddValue) {
|
||
layer.msg("地址不能为空");
|
||
return false;
|
||
}
|
||
if (!$scope.userTXpwd) {
|
||
layer.msg("密码不能为空");
|
||
return false;
|
||
}
|
||
UserCenter.virtualFun($scope.shennongGoldNum,$scope.shennongTel,$scope.shennongAddValue,$scope.shennongName,$scope.userTXpwd).then(function(data){
|
||
$scope.s_county=$scope.shennongName=$scope.shennongGoldNum=$scope.shennongTel=$scope.province=$scope.city=$scope.country=$scope.shennongAddValue=$scope.userTXpwd='';
|
||
layer.msg(data.msg);
|
||
$scope.homeLoad();
|
||
$scope.shennongCard();
|
||
|
||
},function(data){
|
||
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
}else if($rootScope.XNB.type==4){//银行卡
|
||
|
||
if(!$scope.userHaveBank){//未绑定
|
||
$scope.timerNumChange = 6;
|
||
$timeout.cancel($scope.timer);
|
||
$scope.timerNum = function () {
|
||
$scope.timerNumChange -= 1;
|
||
if ($scope.timerNumChange <= 0) {
|
||
$scope.childMenuClick(7);
|
||
$timeout.cancel($scope.timer);
|
||
return;
|
||
}
|
||
$scope.timer = $timeout(function () {
|
||
$scope.timerNum();
|
||
}, 1000);
|
||
}
|
||
|
||
$scope.timerNum();
|
||
|
||
}//银行卡绑定检测
|
||
shennongFun();
|
||
$scope.getGoldHistory();//提现纪录
|
||
|
||
}
|
||
}else{//不是sn
|
||
if(!$scope.userHaveBank){//未绑定
|
||
$scope.timerNumChange = 6;
|
||
$timeout.cancel($scope.timer);
|
||
$scope.timerNum = function () {
|
||
$scope.timerNumChange -= 1;
|
||
if ($scope.timerNumChange <= 0) {
|
||
$scope.childMenuClick(7);
|
||
$timeout.cancel($scope.timer);
|
||
return;
|
||
}
|
||
$scope.timer = $timeout(function () {
|
||
$scope.timerNum();
|
||
}, 1000);
|
||
}
|
||
|
||
$scope.timerNum();
|
||
|
||
}//银行卡绑定检测
|
||
shennongFun();
|
||
$scope.getGoldHistory();
|
||
};
|
||
|
||
};
|
||
|
||
|
||
if ($scope.childCurrent == 5) {
|
||
$scope.TypeId="全部";
|
||
$scope.goldCostListFun = function (type, start, end,page) {
|
||
UserCenter.goldCostFun(type, start, end,page).then(function (data) {
|
||
angular.forEach(data.list, function (v, k) {
|
||
if (v.status == 0) {
|
||
v.statuName = '审核中';
|
||
}
|
||
if (v.status == 1) {
|
||
v.statuName = '成功';
|
||
}
|
||
if (v.status == 2) {
|
||
v.statuName = '失败';
|
||
}
|
||
});
|
||
$scope.goldCostData = data.list;
|
||
$scope.spreadTotalPage=data.total;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
$scope.goldCostListFun( $scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),1);
|
||
//查询
|
||
$scope.goldCostCheck = function () {
|
||
var type = $scope.TypeId, createtime = $("#timeStartGold").val(), endtime = $("#timeEndGold").val();
|
||
//为空校验
|
||
if (type=="全部") {
|
||
type=""
|
||
}
|
||
if (Check.empty(createtime) || Check.empty(endtime)) {
|
||
layer.msg("请选择开始或结束时间");
|
||
return false;
|
||
} else {
|
||
if (createtime > endtime) {
|
||
layer.msg("错误:开始时间大于结束时间");
|
||
return false;
|
||
}
|
||
;
|
||
var time = new Date().getFullYear();
|
||
var timeTemp = endtime.substr(0, 4);
|
||
if (timeTemp > time) {
|
||
layer.msg("请输入有效的时间");
|
||
return false;
|
||
}
|
||
}
|
||
if (Check.date(createtime) || Check.date(endtime)) {
|
||
layer.msg("请选择正确的时间格式:2017-04-07");
|
||
return false;
|
||
}
|
||
$scope.spreadListPage=1;
|
||
$scope.goldCostListFun(type, createtime, endtime,1);
|
||
}
|
||
$scope.spreadListPage=1;
|
||
|
||
//推广奖励分页
|
||
$scope.homePageInfo=function(){//首页
|
||
$scope.spreadListPage=1;
|
||
$scope.goldCostListFun($scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),$scope.spreadListPage);
|
||
}
|
||
$scope.prePageInfo=function(){//上一页
|
||
$scope.spreadListPage-=1;
|
||
if($scope.spreadListPage<1){
|
||
$scope.spreadListPage=1;
|
||
return;
|
||
}
|
||
$scope.goldCostListFun($scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),$scope.spreadListPage);
|
||
}
|
||
$scope.nextPageInfo=function(){//下一页
|
||
$scope.spreadListPage+=1;
|
||
if($scope.spreadListPage>$scope.spreadTotalPage){
|
||
$scope.spreadListPage=$scope.spreadTotalPage;
|
||
return;
|
||
}
|
||
$scope.goldCostListFun($scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),$scope.spreadListPage);
|
||
}
|
||
$scope.lastPageInfo=function(){//末叶
|
||
$scope.spreadListPage=$scope.spreadTotalPage;
|
||
$scope.goldCostListFun($scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),$scope.spreadListPage);
|
||
|
||
}
|
||
|
||
$scope.pageInputInfo = function (num) {//页码校验
|
||
|
||
var num = parseInt(num);
|
||
$scope.spreadListPage = num;
|
||
if ($scope.spreadListPage >= $scope.spreadTotalPage || $scope.spreadListPage <= 0) {
|
||
if ($scope.spreadListPage >= $scope.spreadTotalPage) {
|
||
$scope.spreadListPage = $scope.spreadTotalPage;
|
||
} else if ($scope.spreadListPage <= 0) {
|
||
$scope.spreadListPage = 1;
|
||
}
|
||
}
|
||
|
||
|
||
};
|
||
|
||
$scope.jumpPageInfo=function(){
|
||
var page=$scope.spreadListPage;
|
||
$scope.goldCostListFun($scope.TypeId,$("#timeStartGold").val(),$("#timeEndGold").val(),$scope.spreadListPage);
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 6) {//实名认证
|
||
$scope.nameCheckOneHave=false;
|
||
$scope.trueNameOne = function (val) {
|
||
if (val) {
|
||
//申请c2认证
|
||
$scope.nameCheckOneHave = true;
|
||
|
||
} else {
|
||
if (angular.isUndefined($scope.trueNameEdit)) {//
|
||
layer.msg("请填写您的真实姓名");
|
||
return false;
|
||
}
|
||
if (angular.isUndefined($scope.trueCodeEdit)) {
|
||
layer.msg("请填写您的身份证号码");
|
||
return false;
|
||
}
|
||
var preg = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
|
||
if (!preg.test($scope.trueCodeEdit)) {
|
||
layer.msg('请正确填写您的身份证号码');
|
||
return false;
|
||
}
|
||
$scope.trueNameUpdate($scope.trueNameEdit, $scope.trueCodeEdit);
|
||
}
|
||
}
|
||
}
|
||
if ($scope.childCurrent == 7) {//绑定提现账户
|
||
$scope.bankChecked;//银行选中
|
||
|
||
$scope.bankCheckedFun = function (title) {
|
||
$scope.bankShowBtn = false;
|
||
if (title == 2) {
|
||
$scope.bankChecked = "中国工商银行";
|
||
}
|
||
if (title == 3) {
|
||
$scope.bankChecked = "中国农业银行";
|
||
}
|
||
if (title == 4) {
|
||
$scope.bankChecked = "中国银行";
|
||
}
|
||
if (title == 5) {
|
||
$scope.bankChecked = "中国建设银行";
|
||
}
|
||
if (title == 6) {
|
||
$scope.bankChecked = "交通银行";
|
||
}
|
||
if (title == 7) {
|
||
$scope.bankChecked = "中国邮政储蓄银行";
|
||
}
|
||
if (title == 8) {
|
||
$scope.bankChecked = "招商银行";
|
||
}
|
||
if (title == 9) {
|
||
$scope.bankChecked = "兴业银行";
|
||
}
|
||
if (title == 10) {
|
||
$scope.bankChecked = "民生银行";
|
||
}
|
||
if (title == 11) {
|
||
$scope.bankChecked = "平安银行";
|
||
}
|
||
};
|
||
|
||
$scope.bankInfoUpdate = function () {//绑定银行账号提交 userBankName
|
||
if (angular.isUndefined($scope.dueBankAccount)) {
|
||
layer.msg("请选择支付宝姓名!");
|
||
return false;
|
||
}
|
||
|
||
|
||
if (angular.isUndefined($scope.CardNo)) {
|
||
layer.msg("请填写支付宝账号!");
|
||
return false;
|
||
}
|
||
|
||
|
||
UserCenter.withdrawFun($scope.CardNo,$scope.dueBankAccount).then(function (data) {
|
||
if(data.code==0){
|
||
|
||
layer.msg('绑定成功');
|
||
$scope.userHaveBank = true;
|
||
$scope.bankListShow = null;
|
||
//$scope.childMenuClick(4);
|
||
//$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.error_msg);
|
||
|
||
}
|
||
//layer.msg(data.error_msg);
|
||
|
||
}, function (data) {
|
||
if(data.code==0){
|
||
|
||
layer.msg('绑定成功');
|
||
$scope.userHaveBank = true;
|
||
$scope.bankListShow = null;
|
||
//$scope.childMenuClick(4);
|
||
//$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.error_msg);
|
||
}
|
||
});
|
||
};
|
||
$scope.changBindBank = function () {//修改账户
|
||
$scope.userHaveBank = false;
|
||
$scope.bankListShow = function () {//银行列表
|
||
$scope.bankShowBtn = !$scope.bankShowBtn;
|
||
}
|
||
};
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 9) {//修改绑定手机
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
|
||
// $scope.getTelNumChange = "获取手机验证码";
|
||
// $scope.telLimitChange = true;//短信重复获取限制
|
||
$scope.updateUserTel = false;//下一步显示
|
||
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
|
||
|
||
$scope.getTelModel=function(){
|
||
if($rootScope.ComonEdit.user_type == 'nong'&&!$scope.userHomeLoad.telphone){
|
||
if(Check.empty($scope.nongMobilFirst) || Check.tel($scope.nongMobilFirst)){
|
||
layer.msg('请填写正确的手机号');return;
|
||
}
|
||
}
|
||
$scope.telModel($scope.modelImgCode,$scope.modelTelLimit,$scope.modelTelTxt,'restPhone','changeVCode',$scope.nongMobilFirst);
|
||
}
|
||
|
||
|
||
$scope.nextUserTel = function () {//点击进行下一步
|
||
if($rootScope.ComonEdit.user_type == 'nong'&&!$scope.userHomeLoad.telphone){//
|
||
if(Check.empty($scope.nongMobilFirst) || Check.tel($scope.nongMobilFirst)){
|
||
layer.msg('请填写正确的手机号');return;
|
||
}
|
||
}
|
||
if (Check.empty($scope.modelImgCode)) {
|
||
layer.msg("请填写图片验证码!");
|
||
return false;
|
||
}
|
||
;
|
||
if (Check.empty($scope.modelTelCode)) {
|
||
layer.msg("请填写手机验证码!");
|
||
return false;
|
||
}
|
||
if($rootScope.ComonEdit.user_type == 'nong' && !$scope.userHomeLoad.telphone){
|
||
UserCenter.changeTelFunNF($scope.nongMobilFirst, $scope.modelTelCode).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.childMenuClick(0);
|
||
$scope.homeLoad();
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}else{
|
||
UserCenter.changeTelFun($scope.userHomeLoad.telphone, $scope.modelImgCode, $scope.modelTelCode).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.updateUserTel = true;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
};
|
||
|
||
//tijiao
|
||
$scope.updateUserTelFun = function () {
|
||
if (Check.empty($scope.updateNewMobil)) {
|
||
layer.msg("手机号码不能为空");
|
||
return false;
|
||
}
|
||
if (Check.tel($scope.updateNewMobil)) {
|
||
layer.msg("请输入正确的手机号码");
|
||
return false;
|
||
}
|
||
//请求更改
|
||
UserCenter.changeTelFun($scope.userHomeLoad.user, $scope.modelImgCode, $scope.modelTelCode, $scope.updateNewMobil).then(function (data) {
|
||
layer.msg(data.msg);
|
||
Storage.remove('user');
|
||
$rootScope.rootUser = false;
|
||
$rootScope.rootUserInfo = null;
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
$state.go('root.auth');
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
|
||
}
|
||
if ($scope.childCurrent == 10) {
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
//获取短信验证码
|
||
$scope.getTelModel=function(){
|
||
$scope.telModel($scope.modelImgCode,$scope.modelTelLimit,$scope.modelTelTxt,'freePay','smallMoneyPAy');
|
||
}
|
||
|
||
|
||
//确认开启
|
||
$scope.smallMoneyOpen = function () {
|
||
var imgCode = $scope.modelImgCode;
|
||
var telCode = $scope.modelTelCode;
|
||
if (angular.isUndefined(imgCode)) {
|
||
layer.msg("图片验证码不能为空!");
|
||
return;
|
||
}
|
||
if (angular.isUndefined(telCode)) {
|
||
layer.msg("短信验证码不能为空!");
|
||
return;
|
||
}
|
||
|
||
$scope.updataSmallpay(imgCode, telCode);
|
||
}
|
||
}
|
||
if($scope.childCurrent == 12){
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
//支付密码
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.modelImgCode=$scope.modelTelCode=$scope.modelPassword=$scope.modelRePassword='';
|
||
//获取短信验证码
|
||
$scope.getTelModel=function(){
|
||
$scope.telModel($scope.modelImgCode,$scope.modelTelLimit,$scope.modelTelTxt,'payPassword','payPassword');
|
||
}
|
||
//支付密码成功
|
||
$scope.payPasswordUpdate=function(){
|
||
if(angular.isUndefined($scope.modelImgCode) || $scope.modelImgCode==''){
|
||
layer.msg('图片验证码不能为空');
|
||
return false;
|
||
}
|
||
if(angular.isUndefined($scope.modelTelCode) || $scope.modelTelCode==''){
|
||
layer.msg('短信验证码不能为空');
|
||
return false;
|
||
}
|
||
if(angular.isUndefined($scope.modelPassword) || $scope.modelPassword==''||angular.isUndefined($scope.modelRePassword) || $scope.modelRePassword==''){
|
||
layer.msg('密码不能为空');
|
||
return false;
|
||
}
|
||
if($scope.modelPassword!=$scope.modelRePassword){
|
||
layer.msg('两次输入的密码不一样!');
|
||
return false;
|
||
}
|
||
|
||
UserCenter.setPayPasswordFun($scope.modelImgCode,$scope.modelTelCode,$scope.modelPassword,$scope.modelRePassword).then(function(data){
|
||
layer.msg(data.msg);
|
||
$scope.modelImgCode=$scope.modelTelCode=$scope.modelPassword=$scope.modelRePassword='';
|
||
$scope.childCurrent=1;
|
||
$scope.payPassword=true;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
;
|
||
if ($scope.openAuth == 1) {//农贸市场
|
||
if ($scope.childCurrent == 1) {//委托管理
|
||
$scope.ProductIdN='0';$scope.IsBuyN="2";
|
||
|
||
// $scope.getHistory(0);
|
||
|
||
$scope.pageTotalModel='';//总页数
|
||
$scope.currentPageModel = 1;//当前页
|
||
//模板
|
||
$scope.newListCheck = function (page,sid, type, createtime, endtime) {
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
$scope.getPageModel = getPageModel($scope.newHistorySearchFun);
|
||
|
||
//查询
|
||
$scope.newListCheckSearch=function () {
|
||
$scope.currentPageModel = 1;
|
||
var sid = $scope.ProductIdN, type = $scope.IsBuyN, createtime = $("#timeStartN").val(), endtime = $("#timeEndN").val();
|
||
//为空校验
|
||
if (Check.empty(sid)) {
|
||
layer.msg("请选择产品");
|
||
return false;
|
||
}
|
||
if (Check.empty(type)) {
|
||
layer.msg("请选择类别");
|
||
return false;
|
||
}
|
||
if (Check.empty(createtime) || Check.empty(endtime)) {
|
||
layer.msg("请选择开始或结束时间");
|
||
return false;
|
||
} else {
|
||
if (createtime > endtime) {
|
||
layer.msg("错误:开始时间大于结束时间");
|
||
return false;
|
||
}
|
||
;
|
||
var time = new Date().getFullYear();
|
||
var timeTemp = endtime.substr(0, 4);
|
||
if (timeTemp > time) {
|
||
layer.msg("请输入有效的时间");
|
||
return false;
|
||
}
|
||
}
|
||
if (Check.date(createtime) || Check.date(endtime)) {
|
||
layer.msg("请选择正确的时间格式:2017-04-07");
|
||
return false;
|
||
}
|
||
|
||
$scope.getPageModel = getPageModel($scope.newHistorySearchFun,sid, type, createtime, endtime);//page,sid, type, createtime, endtime
|
||
|
||
}
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 2) {//交易记录
|
||
|
||
$scope.ProductId=$scope.IsBuy='0';
|
||
|
||
// $scope.getHistory(1); 查询记录
|
||
|
||
$scope.pageTotalModel='';//总页数
|
||
$scope.currentPageModel = 1;//当前页
|
||
$scope.oldListCheck = function (page,sid, type, createtime, endtime) {
|
||
|
||
UserCenter.oldHistorySearch(page,sid, type, createtime, endtime).then(function (data) {
|
||
$scope.ArticalListJL=data.list;
|
||
$scope.pageTotalModel=data.total_pages;
|
||
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
}
|
||
|
||
|
||
|
||
$scope.getPageModel = getPageModel($scope.oldListCheck);
|
||
|
||
$scope.oldListCheckSearch=function () {
|
||
$scope.currentPageModel = 1;
|
||
|
||
var sid = $scope.ProductId, type = $scope.IsBuy, createtime = $('#timeStart').val(), endtime = $('#timeEnd').val();
|
||
//为空校验
|
||
if (Check.empty(sid)) {
|
||
layer.msg("请选择产品");
|
||
return false;
|
||
}
|
||
if (Check.empty(type)) {
|
||
layer.msg("请选择类别");
|
||
return false;
|
||
}
|
||
if (Check.empty(createtime) || Check.empty(endtime)) {
|
||
layer.msg("请选择开始或结束时间");
|
||
return false;
|
||
} else {
|
||
var time = new Date().getFullYear();
|
||
var timeTemp = endtime.substr(0, 4);
|
||
if (timeTemp > time) {
|
||
layer.msg("请输入有效的时间");
|
||
return false;
|
||
}
|
||
}
|
||
if (Check.date(createtime) || Check.date(endtime)) {
|
||
layer.msg("请选择正确的时间格式:2017-04-07");
|
||
return false;
|
||
}
|
||
|
||
$scope.getPageModel = getPageModel($scope.oldListCheck,sid, type, createtime, endtime);
|
||
|
||
}
|
||
|
||
}
|
||
if ($scope.childCurrent == 3) {//果实重生列表
|
||
UserCenter.havingProduct().then(function (data) {
|
||
angular.forEach(data.product, function (v, k) {
|
||
v.thumb = ENV.imgSrc + v.thumb;
|
||
})
|
||
$scope.newProductObj = data.product;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
if ($scope.childCurrent == 7) {//重生表单提交
|
||
UserCenter.getProductInfo(sid).then(function (data) {
|
||
$scope.productRecovery = data;
|
||
$scope.parecoveryNum = 1000;
|
||
$scope.parecoveryPrice=data.price;
|
||
$scope.parecoveryFee = $scope.parecoveryNum*(data.price*100000)/1000000;//$scope.productRecovery.charge
|
||
|
||
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
$scope.parecoveryNumFun = function () {
|
||
if ($scope.parecoveryNum < 0 || $scope.parecoveryNum == null) {
|
||
$scope.parecoveryNum = 1000;
|
||
}
|
||
if($scope.parecoveryNum>$scope.productRecovery.num){
|
||
$scope.parecoveryNum=Math.floor($scope.productRecovery.num/1000)*1000;
|
||
}
|
||
$scope.parecoveryFee =$scope.parecoveryNum*($scope.parecoveryPrice*100000)/1000000;//$scope.productRecovery.charge
|
||
}
|
||
//数量判断
|
||
$scope.parecoveryNumPass = function (num) {
|
||
if (num % 1000 != 0) {//sellNum 卖出数量 buyInfo.num sellMoney
|
||
if (num < 1000) {
|
||
layer.msg("输入的数量必须为1000的整数倍");
|
||
if($scope.productRecovery.num<1000){
|
||
$scope.parecoveryNum = 0;
|
||
}else{
|
||
$scope.parecoveryNum = 1000;
|
||
}
|
||
|
||
} else {//大于等于100,小数的整数部分进行计算
|
||
layer.msg("输入的数量必须为1000的整数倍");
|
||
$scope.parecoveryNum = Math.floor(num / 1000) * 1000;
|
||
|
||
if ($scope.parecoveryNum > $scope.productRecovery.num) {
|
||
layer.msg("持有量不足!")
|
||
$scope.parecoveryNum = Math.floor($scope.productRecovery.num / 1000) * 1000;
|
||
}
|
||
|
||
}
|
||
} else {
|
||
if ($scope.parecoveryNum > $scope.productRecovery.num) {
|
||
layer.msg("持有量不足!")
|
||
$scope.parecoveryNum = Math.floor($scope.productRecovery.num / 1000) * 1000;
|
||
}
|
||
}
|
||
}
|
||
$scope.productReset=$scope.parecoveryNum
|
||
//提交
|
||
$scope.Rebirth = function () {//uid sid num fee
|
||
UserCenter.renascenceFun(sid, $scope.parecoveryNum, $scope.parecoveryFee).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.childCurrent = 4;//重生记录显示
|
||
UserCenter.renascenceHistory().then(function (data) {
|
||
$scope.renascenceHistoryList = data.list;
|
||
})
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
};
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 4) {//重生记录
|
||
$scope.chognshengPage=function(page){
|
||
UserCenter.renascenceHistory(page).then(function (data) {
|
||
$scope.renascenceHistoryList = data.list;
|
||
$scope.spreadTotalPageHis=data.total;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
$scope.spreadListPageHis=1;
|
||
$scope.spreadTotalPageHis;
|
||
$scope.chognshengPage(1);
|
||
|
||
|
||
//重生记录分页
|
||
$scope.homePage=function(){//首页
|
||
$scope.spreadListPageHis=1;
|
||
$scope.chognshengPage($scope.spreadListPageHis);
|
||
}
|
||
$scope.prePage=function(){//上一页
|
||
$scope.spreadListPageHis-=1;
|
||
if($scope.spreadListPageHis<1){
|
||
$scope.spreadListPageHis=1;
|
||
return;
|
||
}
|
||
$scope.chognshengPage($scope.spreadListPageHis);
|
||
}
|
||
$scope.nextPage=function(){//下一页
|
||
$scope.spreadListPageHis+=1;
|
||
if($scope.spreadListPageHis>$scope.spreadTotalPageHis){
|
||
$scope.spreadListPageHis=$scope.spreadTotalPageHis;
|
||
return;
|
||
}
|
||
$scope.chognshengPage($scope.spreadListPageHis);
|
||
}
|
||
$scope.lastPage=function(){//末叶
|
||
$scope.spreadListPageHis=$scope.spreadTotalPageHis;
|
||
$scope.chognshengPage($scope.spreadListPageHis);
|
||
|
||
}
|
||
|
||
$scope.pageInputTGJL = function (num) {//页码校验
|
||
|
||
var num = parseInt(num);
|
||
$scope.spreadListPageHis = num;
|
||
if ($scope.spreadListPageHis >= $scope.spreadTotalPageHis || $scope.spreadListPageHis <= 0) {
|
||
if ($scope.spreadListPageHis >= $scope.spreadTotalPageHis) {
|
||
$scope.spreadListPageHis = $scope.spreadTotalPageHis;
|
||
} else if ($scope.spreadListPageHis <= 0) {
|
||
$scope.spreadListPageHis = 1;
|
||
}
|
||
}
|
||
|
||
|
||
};
|
||
|
||
$scope.jumpPage=function(){
|
||
$scope.chognshengPage($scope.spreadListPageHis);
|
||
}
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 5) {//果实赠送
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
if($rootScope.ComonEdit.keyWords=='金果'){
|
||
$scope.productSendGold=1;
|
||
}else{
|
||
$scope.productSendGold=0;
|
||
}
|
||
|
||
if(!$scope.payPassword){
|
||
layer.msg('您还没有设置支付密码,请设置');
|
||
$timeout(function(){
|
||
$scope.openAuth=0;
|
||
$scope.childMenuClick(12);
|
||
},2000);
|
||
|
||
}
|
||
|
||
//拥有产品及赠送数量
|
||
UserCenter.havingProduct().then(function (data) {
|
||
angular.forEach(data.product, function (v, k) {
|
||
v.thumb = ENV.imgSrc + v.thumb;
|
||
})
|
||
$scope.newProductList = data.product;
|
||
if(data.sms.giveNum==''||data.sms.giveNum==null||data.sms.giveNum==undefined){
|
||
$scope.haveGiveNum=0;
|
||
}else{
|
||
$scope.haveGiveNum=data.sms.giveNum;//data.sms.giveNum
|
||
}
|
||
|
||
// if($scope.SmallpayOpened){
|
||
// if($scope.haveGiveNum*1<200){
|
||
// $scope.giveVariable=false;
|
||
// }else{
|
||
// $scope.giveVariable=true;
|
||
// }
|
||
// }else{
|
||
// $scope.giveVariable=true;
|
||
// }
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
$scope.modelTelLimit=true;
|
||
$scope.modelTelTxt = "获取手机验证码";
|
||
$scope.modelImgCode=$scope.modelTelCode='';
|
||
//获取短信验证码
|
||
$scope.getTelModel=function(){
|
||
$scope.telModel($scope.modelImgCode,$scope.modelTelLimit,$scope.modelTelTxt,'give','imgCode');
|
||
}
|
||
|
||
|
||
$scope.productToggle = false;//果实选择显示开关
|
||
$scope.productToggleFun = function () {
|
||
$scope.productToggle = !$scope.productToggle;
|
||
}
|
||
$scope.productDefault;//点击果实选择
|
||
$scope.productSendNum = 10;//默认数量
|
||
|
||
$scope.productSet = function (title, sid, price, haveNum) {//商品选择
|
||
$scope.productDefault = title;
|
||
$scope.productToggle = false;
|
||
$scope.productDefaultSid = sid;
|
||
$scope.productSendNum=10;
|
||
$scope.sendPriceDefault = price;
|
||
$scope.productSendFee = fixedFun($scope.productSendNum * price * 0.1);
|
||
$scope.haveProductNum = haveNum;//持有数量;
|
||
};
|
||
$scope.keyFun = function (val) {
|
||
if (!$scope.productSendFee) {
|
||
layer.msg("请选择产品");
|
||
return false;
|
||
}
|
||
$scope.productSendNum = val;
|
||
$scope.productSendFee = fixedFun($scope.productSendNum * $scope.sendPriceDefault * 0.1);
|
||
}
|
||
|
||
$scope.sendNumPass = function (num) {//果实赠送数量
|
||
if (!$scope.productSendFee) {
|
||
return false;
|
||
}
|
||
if (num % 10 != 0) {//sellNum 卖出数量 buyInfo.num sellMoney
|
||
if (num < 10) {
|
||
layer.msg("输入的数量必须为10的整数倍");
|
||
$scope.productSendNum = 0;
|
||
} else {//大于等于10,小数的整数部分进行计算
|
||
layer.msg("输入的数量必须为10的整数倍");
|
||
$scope.productSendNum = Math.floor(num / 10) * 10;
|
||
if ($scope.productSendNum > $scope.haveProductNum) {
|
||
layer.msg("持有量不足!")
|
||
$scope.productSendNum = Math.floor($scope.haveProductNum / 10) * 10;
|
||
}
|
||
|
||
}
|
||
} else {
|
||
if ($scope.productSendNum > $scope.haveProductNum) {
|
||
layer.msg("持有量不足!")
|
||
$scope.productSendNum = Math.floor($scope.haveProductNum / 10) * 10;
|
||
}
|
||
}
|
||
$scope.productSendFee = fixedFun($scope.productSendNum * $scope.sendPriceDefault * 0.1);
|
||
|
||
};
|
||
$scope.suoQuFun=function(val){
|
||
var val=parseInt(val);
|
||
if(val*1<0 || !val){
|
||
$scope.productSendGold=0;
|
||
}else{
|
||
$scope.productSendGold=val;
|
||
}
|
||
}
|
||
//提交
|
||
$scope.sentUpdate = function () {//uid,sid,accept,number,imgCode,telCode $scope.modelImgCode=$scope.modelTelCode
|
||
//为空校验
|
||
if (Check.empty($scope.productDefault)) {
|
||
layer.msg("请选择产品");
|
||
return false;
|
||
}
|
||
if (Check.empty($scope.acceptPeople)) {
|
||
layer.msg("请填写接收对象");
|
||
return false;
|
||
}
|
||
if (Check.empty($scope.productSendNum)) {
|
||
layer.msg("请填写赠送数量");
|
||
return false;
|
||
}
|
||
if (Check.empty($scope.modelImgCode)) {
|
||
layer.msg("请填写图片验证码");
|
||
return false;
|
||
}
|
||
// if($scope.giveVariable){
|
||
// if (Check.empty($scope.modelTelCode)) {
|
||
// layer.msg("请填写手机验证码");
|
||
// return false;
|
||
// }
|
||
// }
|
||
|
||
if($rootScope.configObjGame.fruits!=9){
|
||
if (typeof $scope.productSendGold!="number") {
|
||
layer.msg("请填写索取金币");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
if (Check.empty($scope.paySendPWD)) {//paySendPWD
|
||
layer.msg("请填写支付密码");
|
||
return false;
|
||
}
|
||
if($scope.ComonEdit.keyWords=='金果'){
|
||
if($scope.productSendGold<1){
|
||
layer.msg('索取金币的值不能为0,最低为1');
|
||
$scope.productSendGold=1;
|
||
return false;
|
||
}
|
||
}
|
||
|
||
//请求?uid, sid, accept, number, imgCode, telCode, mobil
|
||
UserCenter.giveProductFun( $scope.productDefaultSid, $scope.acceptPeople, $scope.productSendNum, $scope.modelImgCode, $scope.modelTelCode, $scope.userHomeLoad.telphone,$scope.productSendGold,$scope.paySendPWD).then(function (data) {
|
||
$scope.acceptPeople= $scope.modelImgCode=$scope.modelTelCode=$scope.paySendPWD='';
|
||
$scope.productSendNum=10;
|
||
if($rootScope.ComonEdit.keyWords=='金果'){
|
||
$scope.productSendGold=1;
|
||
}else{
|
||
$scope.productSendGold=0;
|
||
}
|
||
$interval.cancel($scope.timerTel);//清除定时器
|
||
layer.msg(data.msg);
|
||
UserCenter.havingProduct().then(function (data) {
|
||
angular.forEach(data, function (v, k) {
|
||
v.thumb = ENV.imgSrc + v.thumb;
|
||
})
|
||
$scope.newProductList = data;
|
||
$scope.childMenuClick(6);
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
};
|
||
});
|
||
}, function (data) {
|
||
$scope.modelImgCode=$scope.modelTelCode=$scope.paySendPWD='';
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
};
|
||
|
||
|
||
}
|
||
|
||
if ($scope.childCurrent == 6) {//赠送记录uid,sid,id,type
|
||
|
||
$scope.acceptGiveChecked = 0;//0 接受 1 赠送
|
||
$scope.pageTotalNum;//赠送记录分页总数
|
||
$scope.acceptGiveChange = function (num) {
|
||
$scope.acceptGiveChecked = num;
|
||
$scope.currentPageNews = 1;
|
||
$scope.giveHistoryGet(1, $scope.acceptGiveChecked);
|
||
|
||
};
|
||
//
|
||
$scope.giveHistoryGet = function (page, type) {
|
||
UserCenter.giveHistoryFun(page, '', '').then(function (data) {
|
||
|
||
var give = data.data.give;
|
||
var accept = data.data.accept;
|
||
if (type == 0) {//接受
|
||
|
||
$scope.pageTotalNum = Math.ceil(accept.length / 10);
|
||
angular.forEach(accept, function (v, k) {//接受
|
||
if (v.status == 0) {
|
||
v.stateCurrent = "待接收";
|
||
} else if (v.status == 1) {
|
||
v.stateCurrent = "已接收";
|
||
} else if (v.status == 2) {
|
||
v.stateCurrent = "已退回";
|
||
}
|
||
|
||
});
|
||
// $scope.giveHistoryLsitAccept = accept;
|
||
$scope.pageDataOld=accept;
|
||
$scope.getNewsList($scope.currentPageNews);
|
||
} else if (type == 1) {//赠送
|
||
$scope.pageTotalNum = Math.ceil(give.length / 10);
|
||
angular.forEach(give, function (v, k) {//送出
|
||
if (v.status == 0) {
|
||
v.stateCurrent = "未接收";
|
||
} else if (v.status == 1) {
|
||
v.stateCurrent = "已接收";
|
||
} else if (v.status == 2) {
|
||
v.stateCurrent = "已撤销";
|
||
}
|
||
|
||
});
|
||
|
||
// $scope.giveHistoryLsitGive = give;
|
||
$scope.pageDataOld=give;
|
||
$scope.getNewsList($scope.currentPageNews);
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
//自动返回检验
|
||
UserCenter.autoReturnFun().then(function (data) {
|
||
$scope.giveHistoryGet(1, $scope.acceptGiveChecked);//加载列表信息
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
|
||
|
||
|
||
//操作 撤销和接受
|
||
$scope.cancelGiveHistory = function (id, type) {
|
||
var strPay="<div class='pay-box'><p class='pay-tips'>* 请确认相关信息是否正确!</p><div class='pay-passpwd'><label>支付密码:</label><input type='password' placeholder='请输入支付密码' id='sendPayPWD'/></div><div class='pay-box-btn'><span id='cancelPayBtn'>取消</span><span id='surePayBtn'>确认</span></div></div>";
|
||
|
||
|
||
if (type == 'refuse') {//退回
|
||
UserCenter.giveHistoryFun('', id, type).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.giveHistoryGet(1, $scope.acceptGiveChecked);//更新数据
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}else if (type == 'cancel') {//撤销
|
||
|
||
UserCenter.giveHistoryFun('', id, type).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.giveHistoryGet(1, $scope.acceptGiveChecked);//更新数据
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}else if (type == 'accept') {//接受
|
||
|
||
layer.open({
|
||
type: 1,
|
||
skin: 'layui-layer-rim', //加上边框
|
||
// area: ['420px', '240px'], //宽高
|
||
content: strPay
|
||
});
|
||
|
||
$("#surePayBtn").click(function(){
|
||
var pwd=$("#sendPayPWD").val();
|
||
UserCenter.giveHistoryFun('', id, type,pwd).then(function (data) {
|
||
layer.msg(data.msg);
|
||
$scope.giveHistoryGet(1, $scope.acceptGiveChecked);//更新数据
|
||
layer.closeAll();
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
})
|
||
$("#cancelPayBtn").click(function(){
|
||
layer.closeAll();
|
||
})
|
||
|
||
|
||
}
|
||
}
|
||
|
||
//分页制作
|
||
$scope.currentPageNews = 1;
|
||
$scope.pageInput = function (num) {//页码校验
|
||
var num = parseInt(num);
|
||
$scope.currentPageNews = num;
|
||
if ($scope.currentPageNews >= $scope.pageTotalNum || $scope.currentPageNews <= 0) {
|
||
if ($scope.currentPageNews >= $scope.pageTotalNum) {
|
||
$scope.currentPageNews = $scope.pageTotalNum;
|
||
} else if ($scope.currentPageNews <= 0) {
|
||
$scope.currentPageNews = 1;
|
||
}
|
||
}
|
||
return $scope.currentPageNews;
|
||
;
|
||
|
||
};
|
||
|
||
// 点击获取列表数据
|
||
$scope.goToGetList = function () {
|
||
return {
|
||
homePage: function () {//首页
|
||
if ($scope.currentPageNews == 1) {
|
||
$scope.currentPageNews = 1;
|
||
return false;
|
||
}
|
||
$scope.currentPageNews = 1;
|
||
$scope.getNewsList($scope.currentPageNews);//获取数据
|
||
},
|
||
lasePage: function () {//末页
|
||
if ($scope.currentPageNews == $scope.pageTotalNum) {
|
||
$scope.currentPageNews = $scope.pageTotalNum;
|
||
return false;
|
||
}
|
||
$scope.currentPageNews = $scope.pageTotalNum;
|
||
$scope.getNewsList($scope.currentPageNews);//获取数据
|
||
},
|
||
nextPage: function () {//下一页
|
||
$scope.currentPageNews += 1;
|
||
if ($scope.currentPageNews > $scope.pageTotalNum) {
|
||
$scope.currentPageNews = $scope.pageTotalNum
|
||
return false;
|
||
}
|
||
$scope.getNewsList($scope.currentPageNews);//获取数据
|
||
},
|
||
prePage: function () {//上一页
|
||
$scope.currentPageNews -= 1;
|
||
if ($scope.currentPageNews <= 0) {
|
||
$scope.currentPageNews = 1;
|
||
return false;
|
||
}
|
||
$scope.getNewsList($scope.currentPageNews);//获取数据
|
||
},
|
||
goToPageFun: function () {
|
||
$scope.getNewsList($scope.currentPageNews);//获取数据
|
||
}
|
||
}
|
||
}();
|
||
$scope.getNewsList = function (pageNum, num) {//对数据分页
|
||
|
||
var num = num ? num : 10;//显示条数
|
||
var startPos = (pageNum - 1) * num;
|
||
var totalNum = $scope.pageTotalNum;
|
||
var newData = [];
|
||
for (var i = startPos; i < (startPos + num); i++) {
|
||
if ($scope.pageDataOld[i] == undefined || $scope.pageDataOld[i] == null || $scope.pageDataOld[i] == '') {
|
||
break;
|
||
}
|
||
newData.push($scope.pageDataOld[i]);
|
||
}
|
||
$scope.ArticalList = newData;
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
;
|
||
|
||
if ($scope.openAuth == 2) {//推广中心
|
||
//alert('1111');
|
||
var ImgCodeFun = ENV.imgSrc + '/web/#/register/' + $scope.userHomeLoad.id;
|
||
//$scope.fruitImgUrl = "http://qr.liantu.com/api.php?text=https://fir.im/6a5s";
|
||
var fruitImgUrl = "http://api.k780.com:88/?app=qr.get&data="+encodeURIComponent(ImgCodeFun);
|
||
$scope.fruitHttpUrl =ImgCodeFun;
|
||
$("#fruitImg").attr('src',fruitImgUrl);
|
||
if ($scope.childCurrent == 1) {//推广列表
|
||
$scope.tuiguangPageHis=1;//当前页
|
||
$scope.tuiguangotalPage;//总页数
|
||
$scope.tuiguangFun=function(page){
|
||
UserCenter.getSpreadListFun(page).then(function (data) {
|
||
console.log(data)
|
||
$scope.getSpreadListHis=data;
|
||
var tempArr=[];
|
||
angular.forEach(data.items,function(v,k){
|
||
tempArr.push(v);
|
||
})
|
||
|
||
$scope.pageDataOldHis = tempArr;
|
||
|
||
|
||
$scope.tuiguangotalPage=angular.isArray(tempArr)?Math.ceil(tempArr.length/10):1;
|
||
$scope.getNewsListHis(1);
|
||
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.error_msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.error_msg);
|
||
}
|
||
})
|
||
}
|
||
$scope.tuiguangFun(1);
|
||
|
||
//推广列表分页
|
||
$scope.goToGetListHis = function () {
|
||
return {
|
||
homePage: function () {//首页
|
||
if ($scope.tuiguangPageHis == 1) {
|
||
$scope.tuiguangPageHis = 1;
|
||
return false;
|
||
}
|
||
$scope.tuiguangPageHis = 1;
|
||
$scope.getNewsListHis($scope.tuiguangPageHis);
|
||
},
|
||
lasePage: function () {//末页
|
||
if ($scope.tuiguangPageHis == $scope.tuiguangotalPage) {
|
||
$scope.tuiguangPageHis = $scope.tuiguangotalPage;
|
||
return false;
|
||
}
|
||
$scope.tuiguangPageHis = $scope.tuiguangotalPage;
|
||
$scope.getNewsListHis($scope.tuiguangPageHis);
|
||
},
|
||
nextPage: function () {//下一页
|
||
$scope.tuiguangPageHis += 1;
|
||
if ($scope.tuiguangPageHis > $scope.tuiguangotalPage) {
|
||
$scope.tuiguangPageHis = $scope.tuiguangotalPage
|
||
return false;
|
||
}
|
||
$scope.getNewsListHis($scope.tuiguangPageHis);
|
||
},
|
||
prePage: function () {//上一页
|
||
$scope.tuiguangPageHis -= 1;
|
||
if ($scope.tuiguangPageHis <= 0) {
|
||
$scope.tuiguangPageHis = 1;
|
||
return false;
|
||
}
|
||
$scope.getNewsListHis($scope.tuiguangPageHis);
|
||
},
|
||
goToPageFun: function () {
|
||
$scope.getNewsListHis($scope.tuiguangPageHis);
|
||
}
|
||
}
|
||
}();
|
||
$scope.getNewsListHis = function (pageNum, num) {//对数据分页
|
||
|
||
var num = num ? num : 10;//显示条数
|
||
var startPos = (pageNum - 1) * num;
|
||
var totalNum = $scope.tuiguangotalPage;
|
||
var newData = [];
|
||
for (var i = startPos; i < (startPos + num); i++) {
|
||
if ($scope.pageDataOldHis[i] == undefined || $scope.pageDataOldHis[i] == null || $scope.pageDataOldHis[i] == '') {
|
||
break;
|
||
}
|
||
newData.push($scope.pageDataOldHis[i]);
|
||
}
|
||
$scope.getSpreadListData = newData;
|
||
|
||
}
|
||
$scope.pageInputHis = function (num) {//页码校验
|
||
var num = parseInt(num);
|
||
$scope.tuiguangPageHis = num;
|
||
if ($scope.tuiguangPageHis >= $scope.tuiguangotalPage || $scope.tuiguangPageHis <= 0) {
|
||
if ($scope.tuiguangPageHis >= $scope.tuiguangotalPage) {
|
||
$scope.tuiguangPageHis = $scope.tuiguangotalPage;
|
||
} else if ($scope.tuiguangPageHis <= 0) {
|
||
$scope.tuiguangPageHis = 1;
|
||
}
|
||
}
|
||
|
||
|
||
};
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 2) {//推广奖励
|
||
//获取奖励列表
|
||
$scope.spreadListPage=1;
|
||
$scope.spreadTotalPage;
|
||
$scope.spreadListAdd=0;//推广奖励列表奖励金币总计
|
||
$scope.spreadTypeId='0';
|
||
$scope.spreadRewardFun=function(from,type,time,page){
|
||
UserCenter.spreadListFun(from,type,time,page).then(function(data){
|
||
console.log(data.data);
|
||
|
||
$scope.spreadListAdd=data.data.total_money?data.data.total_money:0;
|
||
$scope.spreadListData=data.data.list;
|
||
$scope.spreadTotalPage=Math.ceil(data.data.total/10);
|
||
|
||
|
||
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.error_msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.error_msg);
|
||
}
|
||
})
|
||
}
|
||
$scope.spreadRewardFun();
|
||
|
||
$scope.spreadTime={'start':$("#StartDate").val(),'end':$("#EndDate").val()};
|
||
$scope.spreadRewardRequire=function(){
|
||
var from=$scope.FromAccount,type=$scope.spreadTypeId,start=$("#StartDate").val(),end=$("#EndDate").val(),page=$scope.spreadListPage;
|
||
|
||
if(angular.isUndefined(from)){
|
||
layer.msg("来源不能为空!");
|
||
return false;
|
||
};
|
||
if(angular.isUndefined(type)){
|
||
layer.msg("类型不能为空!");
|
||
return false;
|
||
};
|
||
if(angular.isUndefined(start) || start.length==0){
|
||
layer.msg("开始时间不能为空!");
|
||
return false;
|
||
};
|
||
if(angular.isUndefined(end)||end.length==0){
|
||
layer.msg("结束时间不能为空!");
|
||
return false;
|
||
};
|
||
var time={'start':start,'end':end}
|
||
$scope.spreadListPage=1;
|
||
$scope.spreadTime={'start':$("#StartDate").val(),'end':$("#EndDate").val()};
|
||
$scope.spreadRewardFun(from,type,time,page);
|
||
}
|
||
|
||
//推广奖励分页
|
||
$scope.homePage=function(){//首页
|
||
$scope.spreadListPage=1;
|
||
$scope.spreadRewardFun($scope.FromAccount,$scope.spreadTypeId,$scope.spreadTime,$scope.spreadListPage);
|
||
}
|
||
$scope.prePage=function(){//上一页
|
||
$scope.spreadListPage-=1;
|
||
if($scope.spreadListPage<1){
|
||
$scope.spreadListPage=1;
|
||
return;
|
||
}
|
||
$scope.spreadRewardFun($scope.FromAccount,$scope.spreadTypeId,$scope.spreadTime,$scope.spreadListPage);
|
||
}
|
||
$scope.nextPage=function(){//下一页
|
||
$scope.spreadListPage+=1;
|
||
if($scope.spreadListPage>$scope.spreadTotalPage){
|
||
$scope.spreadListPage=$scope.spreadTotalPage;
|
||
return;
|
||
}
|
||
$scope.spreadRewardFun($scope.FromAccount,$scope.spreadTypeId,$scope.spreadTime,$scope.spreadListPage);
|
||
}
|
||
$scope.lastPage=function(){//末叶
|
||
$scope.spreadListPage=$scope.spreadTotalPage;
|
||
$scope.spreadRewardFun($scope.FromAccount,$scope.spreadTypeId,$scope.spreadTime,$scope.spreadListPage);
|
||
|
||
}
|
||
|
||
$scope.pageInputTGJL = function (num) {//页码校验
|
||
|
||
var num = parseInt(num);
|
||
$scope.spreadListPage = num;
|
||
if ($scope.spreadListPage >= $scope.spreadTotalPage || $scope.spreadListPage <= 0) {
|
||
if ($scope.spreadListPage >= $scope.spreadTotalPage) {
|
||
$scope.spreadListPage = $scope.spreadTotalPage;
|
||
} else if ($scope.spreadListPage <= 0) {
|
||
$scope.spreadListPage = 1;
|
||
}
|
||
}
|
||
|
||
|
||
};
|
||
|
||
$scope.jumpPage=function(){
|
||
var page=$scope.spreadListPage;
|
||
$scope.spreadRewardFun($scope.FromAccount,$scope.spreadTypeId,$scope.spreadTime,$scope.spreadListPage);
|
||
}
|
||
|
||
|
||
}
|
||
if ($scope.childCurrent == 3) {//补推广码
|
||
$scope.updateAddSpread = function () {
|
||
if (Check.empty($scope.addSpreadNum)) {
|
||
layer.msg("请填写推广码!")
|
||
return false;
|
||
}
|
||
if (!angular.isNumber($scope.addSpreadNum) || $scope.addSpreadNum < 0) {
|
||
layer.msg("推广码必须是数字,并且大于零");
|
||
}
|
||
UserCenter.addSpreadFun($scope.addSpreadNum).then(function (data) {
|
||
$scope.spreadDecide = true;
|
||
$scope.spreadDecideNum = data;
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
}
|
||
if ($scope.childCurrent == 4) {//联系资料 uid,tencent,wxpay,telphone
|
||
UserCenter.getConnectionFun().then(function (data) {
|
||
|
||
$scope.contnctTelPhone = data.telphone;
|
||
$scope.contnctWechet = data.wxpay;
|
||
$scope.contnctTencent = data.tencent;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
$scope.contnctUpdata = function () {//提交资料
|
||
var tel = $scope.contnctTelPhone;//手机号
|
||
var weixin = $scope.contnctWechet;//微信
|
||
var QQ = $scope.contnctTencent;//QQ
|
||
if(Check.empty(tel) && Check.empty(weixin) && Check.empty(QQ)){
|
||
layer.msg("联系方式至少填写一种");
|
||
return false;
|
||
}
|
||
if(Check.empty(tel)==undefined){
|
||
if (Check.tel(tel)) {
|
||
layer.msg("请输入正确的手机号!");
|
||
return false;
|
||
}
|
||
}
|
||
|
||
UserCenter.connectionFun( QQ, weixin, tel).then(function (data) {
|
||
layer.msg("提交成功");
|
||
$scope.contnctTelPhone = data.telphone;
|
||
$scope.contnctWechet = data.wxpay;
|
||
$scope.contnctTencent = data.tencent;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
|
||
}
|
||
}
|
||
if ($scope.childCurrent == 5) {
|
||
//获取导师资料;
|
||
UserCenter.teacherInfoFun().then(function (data) {
|
||
if (data.thumb) {
|
||
data.thumb = ENV.imgSrc + data.thumb;
|
||
}
|
||
$scope.teacherInfo = data;
|
||
$scope.spreadDecide = true;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
}
|
||
;
|
||
if($scope.openAuth == 3){
|
||
if($scope.childCurrent==0){
|
||
$scope.currentPageModel = 1;//当前页
|
||
}
|
||
if($scope.childCurrent==1){
|
||
$scope.MyTeamSta='';//结算状态 0 全部
|
||
|
||
$scope.pageTotalModel='';//总页数
|
||
$scope.currentPageModel = 1;//当前页
|
||
//请求数据模型
|
||
$scope.channelListAdd=function(page,end){
|
||
UserCenter.channelListAddFun(page,end).then(function(res){
|
||
$scope.ammountAll=res.data.ammountAll;
|
||
$scope.pageTotalModel=res.data.total_pages;
|
||
$scope.ArticalListTM=res.data.list;
|
||
},function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
|
||
$scope.getPageModel = getPageModel($scope.channelListAdd);
|
||
|
||
//查询
|
||
$scope.channelListAddSear=function(){
|
||
var end=$("#MyTeamEnd").val();
|
||
if(angular.isUndefined(end) ||end.length==0){
|
||
layer.msg("请选择时间");
|
||
return false;
|
||
}
|
||
$scope.currentPageModel = 1;
|
||
$scope.getPageModel = getPageModel($scope.channelListAdd,end);
|
||
};
|
||
|
||
|
||
|
||
}
|
||
if($scope.childCurrent==2){
|
||
|
||
$scope.receiveRMB;//可领取
|
||
$scope.noReceiveRMB;//不可领取额
|
||
$scope.yongjingFun=function(){
|
||
UserCenter.receiveRMBFun().then(function(data){
|
||
$scope.receiveRMB=data.data.yes;
|
||
$scope.noReceiveRMB=data.data.no;
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
$scope.yongjingFun();
|
||
|
||
$scope.getReceiveRMB=function(){//领取佣金
|
||
|
||
if($scope.receiveRMB*1<=0){
|
||
layer.msg("您没有可领取的佣金,请继续努力!");
|
||
return false;
|
||
}
|
||
UserCenter.updateReceiveRMBFun().then(function(data){
|
||
layer.msg(data.msg);
|
||
$scope.yongjingFun();
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
if ($scope.openAuth==0 && $scope.childCurrent==3) {//游戏充值跳转页面
|
||
//$scope.childMenuClick(3);
|
||
}
|
||
|
||
//持有产品(0) 经营状况(1)
|
||
$scope.haveProduct = 0;
|
||
$scope.haveProductFun = function (val) {
|
||
$scope.haveProduct = val;
|
||
if (val == 0) {//持有产品
|
||
UserCenter.haveProduct().then(function (data) {
|
||
|
||
$scope.haveTotal = 0;
|
||
angular.forEach(data['product'], function (v, k) {
|
||
v.thumb = ENV.imgSrc + v.thumb;
|
||
v.shiZhi=(v.price * 1)*(v.number*1);
|
||
$scope.haveTotal +=(v.price*1)* (1*v.number);
|
||
});
|
||
$scope.haveProductData = data['product'];
|
||
if(angular.isArray($scope.haveProductData)){
|
||
if($scope.haveProductData.length>0){
|
||
$scope.haveProductDataShow=true;
|
||
};
|
||
}else{
|
||
$scope.haveProductDataShow=false;
|
||
}
|
||
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
} else if (val == 1) {//经营状况
|
||
UserCenter.managementState().then(function (data) {
|
||
|
||
$scope.managementTotal = 0;
|
||
angular.forEach(data, function (v, k) {
|
||
v.thumb = ENV.imgSrc + v.thumb;
|
||
$scope.managementTotal += v.reward * 100000;
|
||
})
|
||
$scope.managementTotal = $scope.managementTotal / 100000;
|
||
$scope.managementData = data;
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
|
||
}
|
||
//渠道代理
|
||
$scope.channelRebate=false;//是否为渠道代理
|
||
//用户首页
|
||
$scope.homeLoad = function () {
|
||
UserCenter.home().then(function (data) {
|
||
|
||
/*if(data.userInfo.smallfruit==1){//开启
|
||
$scope.SmallpayOpened = true;
|
||
}else{//关闭
|
||
$scope.SmallpayOpened = false;
|
||
}
|
||
if($rootScope.ComonEdit.user_type != 'nong'){
|
||
if(!data.userInfo.telphone){
|
||
data.userInfo.telphone=data.userInfo.user;
|
||
}
|
||
}*/
|
||
|
||
/*if($scope.is_weixn && !data.userInfo.openid){
|
||
//微信中,并且openid 存在
|
||
location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxad33c56a3cc506c1&redirect_uri=http%3A%2F%2Fss.9rsc.com%2Findex%2Fwechat&response_type=code&scope=snsapi_base&state="+data.userInfo.openid+"#wechat_redirect"
|
||
}*/
|
||
console.log(data);
|
||
$scope.userHomeLoad = data.error_msg;
|
||
var ImgCodeFun = ENV.imgSrc + '/web/#/register/' + data.error_msg.id;
|
||
//$scope.fruitImgUrl = "http://qr.liantu.com/api.php?text=https://fir.im/6a5s";
|
||
var fruitImgUrl = "http://api.k780.com:88/?app=qr.get&data="+encodeURIComponent(ImgCodeFun);
|
||
$scope.fruitHttpUrl =ImgCodeFun;
|
||
$("#fruitImg").attr('src',fruitImgUrl);
|
||
/*$scope.diamondPrice=data.gold;
|
||
$scope.landPriceAll=data.landPriceAll;
|
||
$scope.landProductPriceAll=data.landProductPriceAll;
|
||
$scope.userMoneyAll=data.userInfo.Frozen*1+data.userInfo.gold*1+$scope.landProductPriceAll*1+$scope.landPriceAll*1+$scope.diamondPrice*1
|
||
|
||
$scope.tiXianImg=data.tiXianImg;//提现二维码图片
|
||
|
||
$scope.payPassword=data.payPassword==1 ? true : false;//支付密码是否设置
|
||
$scope.kkPayInfo=data.other.payInfo ? data.other.payInfo:"您还没有设置信息,请在后台设置添加。";//自定义的充值金额数字*/
|
||
|
||
|
||
$scope.showImageUser = $scope.userHomeLoad.avatar;
|
||
|
||
/*
|
||
*/
|
||
//var channelRebateTemp=parseInt(data.userInfo.channelRebate);//
|
||
//if(channelRebateTemp>0){
|
||
// $scope.channelRebate=true;
|
||
//}
|
||
|
||
//$scope.userTel = data.user;
|
||
//判断时间更改问候语
|
||
/*var now = new Date();
|
||
var hr = now.getHours();
|
||
var userHellow;
|
||
if (hr == 0) {
|
||
userHellow = ',晚安!明天早些起床哦!';
|
||
}
|
||
if (hr == 1) {
|
||
userHellow = ",午夜1点多了,还在干什么啊?";
|
||
}
|
||
if (hr == 2) {
|
||
userHellow = ",是不是该睡觉了?";
|
||
}
|
||
if (hr == 3) {
|
||
userHellow = ",还不睡!小心变熊猫!";
|
||
}
|
||
if (hr == 4) {
|
||
userHellow = ",您是一夜未睡还是刚起床呀?";
|
||
}
|
||
if (hr == 5) {
|
||
userHellow = ",您这么早起床有事吗?";
|
||
}
|
||
if (hr == 6) {
|
||
userHellow = ",您已经准备要刷牙洗脸了?";
|
||
}
|
||
if (hr == 7) {
|
||
userHellow = ",您准备要去上班或上课了吗?";
|
||
}
|
||
if (hr == 8) {
|
||
userHellow = ",早餐吃了沒呀?已经开始上班了吗?";
|
||
}
|
||
if (hr == 9) {
|
||
userHellow = ",来杯咖啡,好好上班。";
|
||
}
|
||
if (hr == 10) {
|
||
userHellow = ",现在是上午10点了!困吗?";
|
||
}
|
||
if (hr == 11) {
|
||
userHellow = ",再忍耐一下,就快午休了!";
|
||
}
|
||
if (hr == 12) {
|
||
userHellow = ",吃饭去吧!";
|
||
}
|
||
if (hr == 13) {
|
||
userHellow = ",想不想要睡个午觉呀?";
|
||
}
|
||
if (hr == 14) {
|
||
userHellow = ",不要边打瞌睡边流口水哦!";
|
||
}
|
||
if (hr == 15) {
|
||
",来杯热茶,让精神抖擞起来?";
|
||
}
|
||
if (hr == 16) {
|
||
userHellow = ",再忍一下...就快下班了!";
|
||
}
|
||
if (hr == 17) {
|
||
userHellow = ",准备好下班了吗?";
|
||
}
|
||
if (hr == 18) {
|
||
userHellow = ",终于下班了!";
|
||
}
|
||
if (hr == 19) {
|
||
userHellow = ",吃饭了吗?不要虐待自己喔!";
|
||
}
|
||
if (hr == 20) {
|
||
userHellow = ",晚安!看完新闻,看看书吧?";
|
||
}
|
||
if (hr == 21) {
|
||
userHellow = ",来杯热茶,让精神抖擞起来!";
|
||
}
|
||
if (hr == 22) {
|
||
userHellow = ",来杯热茶,让精神抖擞起来!";
|
||
}
|
||
if (hr == 23) {
|
||
userHellow = ",哇!又是一天过去了,准备上床睡觉了!";
|
||
}
|
||
$scope.userHomeLoad.sayHellow = userHellow;//问候语
|
||
|
||
*/
|
||
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
//$scope.haveProductFun(0);//获取产品信息
|
||
}
|
||
$scope.homeLoad();
|
||
//修改密码
|
||
$scope.changPwd = function () {
|
||
//$scope.userTel pwdOld pwdNew pwdNewAgain
|
||
//密码
|
||
|
||
if (Check.empty($scope.pwdOld)) {
|
||
layer.msg("原密码不能为空");
|
||
return;
|
||
}
|
||
if (Check.empty($scope.pwdNew) || Check.empty($scope.pwdNewAgain)) {
|
||
layer.msg("新密码不能为空");
|
||
return;
|
||
}
|
||
if ($scope.pwdNew.length < 6 || $scope.pwdNewAgain.length < 6) {
|
||
layer.msg("新密码长度不能小于6位");
|
||
return;
|
||
}
|
||
if ($scope.pwdNew != $scope.pwdNewAgain) {
|
||
layer.msg("两次输入新密码不一样!")
|
||
return;
|
||
}
|
||
//pwdOld,pwdNew,pwdNewAgain,user
|
||
UserCenter.restPwdFun($scope.pwdOld, $scope.pwdNew, $scope.pwdNewAgain, $scope.userTel).then(function (data) {
|
||
layer.msg(data.msg);
|
||
|
||
// Storage.get('local').userPwd='';//清空记录的密码
|
||
var localTemp = Storage.get('local');
|
||
localTemp.userPwd = '';
|
||
Storage.set('local', localTemp);
|
||
Auth.loginExit();//重新登陆
|
||
|
||
}, function (data) {
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
|
||
}
|
||
//撤销委托
|
||
$scope.cancelEntrust = function (id) {
|
||
Market.cancelFun(id).then(function (data) {//success
|
||
layer.msg(data.msg);
|
||
$scope.newHistorySearchFun();
|
||
},function(data){
|
||
if(data.code==403){
|
||
layer.msg(data.msg);
|
||
$rootScope.loginExit();
|
||
}else{
|
||
layer.msg(data.msg);
|
||
}
|
||
})
|
||
}
|
||
}
|
||
);
|
||
})
|
||
});
|