Commit b398dc4a7966dade5d45ec49714b2a7cc665b87a
1 parent
3b7af3a2
add 我的钱包 接口联调
Showing
3 changed files
with
52 additions
and
33 deletions
common/common.js
| @@ -29,14 +29,17 @@ const userLoginout = serverUrl + "/business/h5/index/logout"; | @@ -29,14 +29,17 @@ const userLoginout = serverUrl + "/business/h5/index/logout"; | ||
| 29 | const useraboutUs = serverUrl + "/business/h5/index/aboutUs"; | 29 | const useraboutUs = serverUrl + "/business/h5/index/aboutUs"; |
| 30 | 30 | ||
| 31 | // 商户账户余额信息 | 31 | // 商户账户余额信息 |
| 32 | -const walletAccount = serverUrl + "/business/h5/wallet/account"; | 32 | +const walletAccount = serverUrl + "/business/h5/wallet/account"; |
| 33 | + | ||
| 34 | +// 商户充值金额列表 | ||
| 35 | +const rechargeList = serverUrl + "/business/h5/wallet/rechargeList"; | ||
| 33 | 36 | ||
| 34 | // | 37 | // |
| 35 | const requestSign = function(inputData) { | 38 | const requestSign = function(inputData) { |
| 36 | 39 | ||
| 37 | var jsonList = inputData || {}; | 40 | var jsonList = inputData || {}; |
| 38 | 41 | ||
| 39 | - // jsonList.orgId = public_orgId; | 42 | + jsonList.orgId = public_orgId; |
| 40 | jsonList.sign_type = "md5"; | 43 | jsonList.sign_type = "md5"; |
| 41 | jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104"; | 44 | jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104"; |
| 42 | jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E"; | 45 | jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E"; |
| @@ -44,7 +47,7 @@ const requestSign = function(inputData) { | @@ -44,7 +47,7 @@ const requestSign = function(inputData) { | ||
| 44 | jsonList.terminalSource = "11"; | 47 | jsonList.terminalSource = "11"; |
| 45 | jsonList.token = getGlobalUser("globalUser").token; | 48 | jsonList.token = getGlobalUser("globalUser").token; |
| 46 | // jsonList.token = getGlobalUser("globalUser").token; | 49 | // jsonList.token = getGlobalUser("globalUser").token; |
| 47 | - // jsonList.token = 'eb1538c4c2ee45d7b2610cf071c4a27f'; | 50 | + // jsonList.token = 'af7ed65335f842ee8f754e841ff940ea'; |
| 48 | 51 | ||
| 49 | var arrData = []; | 52 | var arrData = []; |
| 50 | for (var key in jsonList) { | 53 | for (var key in jsonList) { |
| @@ -135,6 +138,7 @@ export default { | @@ -135,6 +138,7 @@ export default { | ||
| 135 | userLoginout, | 138 | userLoginout, |
| 136 | useraboutUs, | 139 | useraboutUs, |
| 137 | walletAccount, | 140 | walletAccount, |
| 141 | + rechargeList, | ||
| 138 | // 通过商户ID查询停车记录信息 | 142 | // 通过商户ID查询停车记录信息 |
| 139 | getBusinessParkOrderByBusIdForPage:serverUrl + "/business/h5/order/getBusinessParkOrderByBusIdForPage", | 143 | getBusinessParkOrderByBusIdForPage:serverUrl + "/business/h5/order/getBusinessParkOrderByBusIdForPage", |
| 140 | } | 144 | } |
common/filters.js
| @@ -36,6 +36,13 @@ const toFixed2 = num => { | @@ -36,6 +36,13 @@ const toFixed2 = num => { | ||
| 36 | return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2)); | 36 | return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2)); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | +// 钱保留两位小数+其他 | ||
| 40 | +const ortherToFixed = num => { | ||
| 41 | + if(num === -1) return '其他'; | ||
| 42 | + return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2)); | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | + | ||
| 39 | // 数字每三位加个逗号 | 46 | // 数字每三位加个逗号 |
| 40 | const toThousands =(num)=> { | 47 | const toThousands =(num)=> { |
| 41 | var result = [], | 48 | var result = [], |
| @@ -66,6 +73,7 @@ export default { | @@ -66,6 +73,7 @@ export default { | ||
| 66 | RMB, | 73 | RMB, |
| 67 | cutString, | 74 | cutString, |
| 68 | toFixed2, | 75 | toFixed2, |
| 76 | + ortherToFixed, | ||
| 69 | toThousands, | 77 | toThousands, |
| 70 | sexFilter, | 78 | sexFilter, |
| 71 | } | 79 | } |
pages/moneyRecharge/moneyRecharge.vue
| @@ -10,10 +10,16 @@ | @@ -10,10 +10,16 @@ | ||
| 10 | <uni-grid :column="3" :highlight="true" :showBorder="false" :square="false" @change="change"> | 10 | <uni-grid :column="3" :highlight="true" :showBorder="false" :square="false" @change="change"> |
| 11 | <uni-grid-item v-for="(item, index) in ListData" :index="index" :key="index"> | 11 | <uni-grid-item v-for="(item, index) in ListData" :index="index" :key="index"> |
| 12 | <view class="grid-item-box" style="background-color: #fff;"> | 12 | <view class="grid-item-box" style="background-color: #fff;"> |
| 13 | - <view class="text" :class="currentIndex==index?'itemActive':''">{{item.text}}</view> | 13 | + <view class="text" :class="currentIndex==index?'itemActive':''"> |
| 14 | + {{item.rechargeCode | ortherToFixed}} | ||
| 15 | + </view> | ||
| 14 | </view> | 16 | </view> |
| 15 | </uni-grid-item> | 17 | </uni-grid-item> |
| 16 | </uni-grid> | 18 | </uni-grid> |
| 19 | + <view class="jy-fix-height34" :style="isShowInput?'':'display:none;'"> | ||
| 20 | + <input class="jy-fix-height34 uni-list-cell-hover" type="digit" v-model="rechargeNum" | ||
| 21 | + placeholder=" 请输入金额" /> | ||
| 22 | + </view> | ||
| 17 | </uni-section> | 23 | </uni-section> |
| 18 | 24 | ||
| 19 | <view class="uni-list-cell-pd"> | 25 | <view class="uni-list-cell-pd"> |
| @@ -40,39 +46,23 @@ | @@ -40,39 +46,23 @@ | ||
| 40 | </template> | 46 | </template> |
| 41 | 47 | ||
| 42 | <script> | 48 | <script> |
| 43 | - | ||
| 44 | export default { | 49 | export default { |
| 45 | data() { | 50 | data() { |
| 46 | return { | 51 | return { |
| 47 | acctBalance: '0.00', | 52 | acctBalance: '0.00', |
| 48 | - ListData: [{ | ||
| 49 | - text: '100元' | ||
| 50 | - }, | ||
| 51 | - { | ||
| 52 | - text: '200元' | ||
| 53 | - }, | ||
| 54 | - { | ||
| 55 | - text: '300元' | ||
| 56 | - }, | ||
| 57 | - { | ||
| 58 | - text: '600元' | ||
| 59 | - }, | ||
| 60 | - { | ||
| 61 | - text: '1000元' | ||
| 62 | - }, | ||
| 63 | - { | ||
| 64 | - text: '其他' | ||
| 65 | - }, | ||
| 66 | - ], | 53 | + ListData: [], |
| 67 | currentIndex: 0, | 54 | currentIndex: 0, |
| 68 | - | 55 | + // isShowInput: false, |
| 56 | + rechargeNum: '', | ||
| 69 | } | 57 | } |
| 70 | }, | 58 | }, |
| 71 | onLoad() { | 59 | onLoad() { |
| 72 | 60 | ||
| 73 | }, | 61 | }, |
| 74 | mounted() { | 62 | mounted() { |
| 75 | - this.recharge() | 63 | + this.recharge(); |
| 64 | + this.rechargeList(); | ||
| 65 | + | ||
| 76 | }, | 66 | }, |
| 77 | methods: { | 67 | methods: { |
| 78 | recharge() { | 68 | recharge() { |
| @@ -89,19 +79,36 @@ | @@ -89,19 +79,36 @@ | ||
| 89 | 79 | ||
| 90 | }) | 80 | }) |
| 91 | }, | 81 | }, |
| 82 | + rechargeList() { | ||
| 83 | + let that = this; | ||
| 84 | + that.$myRequest({ | ||
| 85 | + url: that.$common.rechargeList, | ||
| 86 | + method: 'POST', | ||
| 87 | + data: that.$common.requestSign() | ||
| 88 | + }).then(res => { | ||
| 92 | 89 | ||
| 93 | - change(e) { | 90 | + console.log(res) |
| 91 | + let data = res.data; | ||
| 92 | + that.ListData = data; | ||
| 94 | 93 | ||
| 94 | + }) | ||
| 95 | + }, | ||
| 96 | + change(e) { | ||
| 97 | + let that = this; | ||
| 95 | let { | 98 | let { |
| 96 | index | 99 | index |
| 97 | - } = e.detail | ||
| 98 | - | ||
| 99 | - this.currentIndex = index | ||
| 100 | - console.log(index + 1) | ||
| 101 | - | 100 | + } = e.detail; |
| 101 | + that.currentIndex = index; | ||
| 102 | + | ||
| 103 | + if (that.ListData[index].rechargeCode == -1) { | ||
| 104 | + console.log('1') | ||
| 105 | + that.isShowInput = true; | ||
| 106 | + that.rechargeNum = '' | ||
| 107 | + } | ||
| 108 | + that.isShowInput = false; | ||
| 102 | }, | 109 | }, |
| 103 | detailCell() { | 110 | detailCell() { |
| 104 | - | 111 | + |
| 105 | } | 112 | } |
| 106 | } | 113 | } |
| 107 | } | 114 | } |