/** *Created by ZHJY on 2020/7/14. */ var payContainer = new Vue({ el:"#payContainer", data: { type:'', pageType:'',//页面类型 payAmount:0,//本次支付金额 isRequest:false, isSuccess:true, paySuccessCounter:'', maxtime:10, linkText:'立即跳转', openLink:'/myaccount/orderlist--1-1.html', isSuccessText:'' }, filters: { NumFormat:function(value) { if(!value) return '0.00'; var intPart = Number(value) - Number(value)%1; //获取整数部分(这里是windy93的方法) var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断 var floatPart = ".00"; //预定义小数部分 var value2Array = value.toString().split("."); if(value2Array.length == 2) { //=2表示数据有小数位 floatPart = value2Array[1].toString(); //拿到小数部分 if(floatPart.length == 1) { //补0,实际上用不着 return intPartFormat + "." + floatPart + '0'; } else { return intPartFormat + "." + floatPart; } } else { return intPartFormat + floatPart; } } }, methods: { infoRequestBody:function(){//初始化支付状态信息 var _self = this; if( _self.type == 'success'){ _self.isSuccess = true; if(_self.pageType == 'second'){ _self.isSuccessText ='支付成功,商品会在1-2个工作日内进行审核'; }else{ _self.isSuccessText ='支付成功'; } }else{ _self.isSuccessText ='支付失败'; _self.isSuccess = false; } //处理根据类型做跳转 switch (_self.pageType) { case 'www': _self.linkText = '订单列表'; _self.openLink = '/user/order/list.html?state=0'; break; case 'second': if(_self.isSuccess){ _self.linkText = '二手商品页面'; _self.openLink = '/flea-market/list.html'; }else{ _self.linkText = '发布二手商品页面'; _self.openLink = '/flea-market/form.html'; } break; default: _self.linkText = '回到首页'; _self.openLink = '/index.html'; } _self.isRequest = true; var timeClock = setInterval(function(){ _self.maxtime--; if (_self.maxtime == 0) { window.location.href = _self.openLink; clearInterval(timeClock); _self.maxtime = 10; _self.isRefresh = true; } },1000); }, toFixedFn:function(text){//处理小数点后两位数 return Number(text).toFixed(2); } }, mounted: function () { var _self = this; _self.pageType = CAIMEI.getUrlParam('pageType'); _self.type = CAIMEI.getUrlParam('type'); _self.payAmount = CAIMEI.getUrlParam('payAmount'); _self.infoRequestBody(); } });