diff --git a/common/common.js b/common/common.js index 764546d..a54e292 100644 --- a/common/common.js +++ b/common/common.js @@ -4,7 +4,7 @@ import md5 from './md5.min.js'; var serverUrl = "https://bus.jycrtc.com"; //江阴微信小程序appid -const hs_wxPay_appId = 'wxfdc1af620d3ab750'; +const hs_wxPay_appId = 'wxfdc1af620d3ab750'; // 江阴慧停车orgId const public_orgId = '10107'; @@ -34,6 +34,18 @@ const walletAccount = serverUrl + "/business/h5/wallet/account"; // 商户充值金额列表 const rechargeList = serverUrl + "/business/h5/wallet/rechargeList"; +// 余额明细下拉框选择列表 +const walletKindType = serverUrl + "/business/h5/wallet/kindType"; + +// 余额明细总览 +const detailSummary = serverUrl + "/business/h5/wallet/detailSummary"; + +// 余额明细-分页 +const walletDetailsPage = serverUrl + "/business/h5/wallet/detailsPage"; + +// 钱包充值-微信 +const publicUnifiedOrder = serverUrl + "/business/h5/pay/weixinpay/publicUnifiedOrder"; + // 通过商户ID查询停车记录信息 const getBusinessParkOrderByBusIdForPage = serverUrl + "/business/h5/order/getBusinessParkOrderByBusIdForPage"; @@ -123,56 +135,52 @@ var getGlobalUser = function(key) { } // 除了金额 -var moneyFormat = function (val) { - return (val/100).toFixed(2) +var moneyFormat = function(val) { + return (val / 100).toFixed(2) } -var dateFormat = function (msd) { // 时间转换 - var time = msd - - if (null != time && "" != time) { - - if (time > 60 && time < 60 * 60) { +var dateFormat = function(msd) { // 时间转换 + var time = msd - time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) - + if (null != time && "" != time) { - parseInt(time / 60.0)) * 60) + "秒"; + if (time > 60 && time < 60 * 60) { - } + time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) - - else if (time >= 60 * 60 && time < 60 * 60 * 24) { + parseInt(time / 60.0)) * 60) + "秒"; - time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) - + } else if (time >= 60 * 60 && time < 60 * 60 * 24) { - parseInt(time / 3600.0)) * 60) + "分钟" + + time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) - - parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - + parseInt(time / 3600.0)) * 60) + "分钟" + - parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - - } else if (time >= 60 * 60 * 24) { + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; - time = parseInt(time / 3600.0 / 24) + "天" + parseInt((parseFloat(time / 3600.0 / 24) - + } else if (time >= 60 * 60 * 24) { - parseInt(time / 3600.0 / 24)) * 24) + "小时" + parseInt((parseFloat(time / 3600.0) - + time = parseInt(time / 3600.0 / 24) + "天" + parseInt((parseFloat(time / 3600.0 / 24) - - parseInt(time / 3600.0)) * 60) + "分钟" + + parseInt(time / 3600.0 / 24)) * 24) + "小时" + parseInt((parseFloat(time / 3600.0) - - parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - + parseInt(time / 3600.0)) * 60) + "分钟" + - parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; + parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) - - } + parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; - else { + } else { - time = parseInt(time) + "秒"; + time = parseInt(time) + "秒"; - } + } - } + } - return time; + return time; } export default { @@ -208,7 +216,9 @@ export default { //陈彪接口 rechargeList, - - - + walletKindType, + detailSummary, + walletDetailsPage, + publicUnifiedOrder, + } diff --git a/common/filters.js b/common/filters.js index 563b008..98d6d08 100644 --- a/common/filters.js +++ b/common/filters.js @@ -31,42 +31,52 @@ const RMB = (value) => { return `¥${value}` } -// 钱保留两位小数 -const toFixed2 = num => { - return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2)); +// 处理金额两位小数 +const toFixed2 = value => { + if (!value) { + return '0.00'; + } else { + return (value / 100).toFixed(2); + } + } // 钱保留两位小数+其他 const ortherToFixed = num => { - if(num === -1) return '其他'; - return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2)); + if (num === '0' || num === undefined || num === null || num === '' || num === NaN) { + return '0.00'; + } else if (num === -1) { + return '其他'; + } else { + return (num / 100).toFixed(2); + } } // 数字每三位加个逗号 -const toThousands =(num)=> { - var result = [], - counter = 0; - num = (num || 0).toString().split(''); - for (var i = num.length - 1; i >= 0; i--) { - counter++; - result.unshift(num[i]); - if (!(counter % 3) && i != 0) { - result.unshift(','); - } - } - return result.join(''); - } - - // 根据身份证号码判断男女 - const sexFilter = value => { - if (!value) { - return '' - } else { - let data = value.substr(16, 1) % 2 === 1 ? '男' : '女' - return data - } - } +const toThousands = (num) => { + var result = [], + counter = 0; + num = (num || 0).toString().split(''); + for (var i = num.length - 1; i >= 0; i--) { + counter++; + result.unshift(num[i]); + if (!(counter % 3) && i != 0) { + result.unshift(','); + } + } + return result.join(''); +} + +// 根据身份证号码判断男女 +const sexFilter = value => { + if (!value) { + return '' + } else { + let data = value.substr(16, 1) % 2 === 1 ? '男' : '女' + return data + } +} export default { tranNull, diff --git a/pages/moneyRecharge/moneyRecharge.vue b/pages/moneyRecharge/moneyRecharge.vue index 7f05ea6..7b0d719 100644 --- a/pages/moneyRecharge/moneyRecharge.vue +++ b/pages/moneyRecharge/moneyRecharge.vue @@ -6,7 +6,7 @@ ¥{{acctBalance | toFixed2 }} - + @@ -16,9 +16,9 @@ - - + + @@ -54,6 +54,7 @@ currentIndex: 0, isShowInput: false, rechargeNum: '', + maxlength: 6 //默认一个长度 } }, onLoad() { @@ -104,11 +105,30 @@ console.log('1') that.isShowInput = true; that.rechargeNum = '' + } else { + that.isShowInput = false; } - that.isShowInput = false; + }, - detailCell() { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 3; //长度是小数点后两位 + if (value.length > dot + 3) {} + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 6; + } + }, + + detailCell() { + uni.navigateTo({ + url: '../rechargeDetail/rechargeDetail' + + }); } } } @@ -227,4 +247,14 @@ margin-top: 40px; } + .payInut{ + display: flex; + box-sizing: border-box; + flex-direction: row; + align-items: center; + border: 1px solid #DCDFE6; + border-radius: 4px; + min-height: 36px; + padding-left: 10px; + } diff --git a/pages/rechargeDetail/rechargeDetail.vue b/pages/rechargeDetail/rechargeDetail.vue index 5895917..872c48c 100644 --- a/pages/rechargeDetail/rechargeDetail.vue +++ b/pages/rechargeDetail/rechargeDetail.vue @@ -1,258 +1,251 @@