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 | 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 | 38 | const requestSign = function(inputData) { |
36 | 39 | |
37 | 40 | var jsonList = inputData || {}; |
38 | 41 | |
39 | - // jsonList.orgId = public_orgId; | |
42 | + jsonList.orgId = public_orgId; | |
40 | 43 | jsonList.sign_type = "md5"; |
41 | 44 | jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104"; |
42 | 45 | jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E"; |
... | ... | @@ -44,7 +47,7 @@ const requestSign = function(inputData) { |
44 | 47 | jsonList.terminalSource = "11"; |
45 | 48 | jsonList.token = getGlobalUser("globalUser").token; |
46 | 49 | // jsonList.token = getGlobalUser("globalUser").token; |
47 | - // jsonList.token = 'eb1538c4c2ee45d7b2610cf071c4a27f'; | |
50 | + // jsonList.token = 'af7ed65335f842ee8f754e841ff940ea'; | |
48 | 51 | |
49 | 52 | var arrData = []; |
50 | 53 | for (var key in jsonList) { |
... | ... | @@ -135,6 +138,7 @@ export default { |
135 | 138 | userLoginout, |
136 | 139 | useraboutUs, |
137 | 140 | walletAccount, |
141 | + rechargeList, | |
138 | 142 | // 通过商户ID查询停车记录信息 |
139 | 143 | getBusinessParkOrderByBusIdForPage:serverUrl + "/business/h5/order/getBusinessParkOrderByBusIdForPage", |
140 | 144 | } | ... | ... |
common/filters.js
... | ... | @@ -36,6 +36,13 @@ const toFixed2 = num => { |
36 | 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 | 47 | const toThousands =(num)=> { |
41 | 48 | var result = [], |
... | ... | @@ -66,6 +73,7 @@ export default { |
66 | 73 | RMB, |
67 | 74 | cutString, |
68 | 75 | toFixed2, |
76 | + ortherToFixed, | |
69 | 77 | toThousands, |
70 | 78 | sexFilter, |
71 | 79 | } | ... | ... |
pages/moneyRecharge/moneyRecharge.vue
... | ... | @@ -10,10 +10,16 @@ |
10 | 10 | <uni-grid :column="3" :highlight="true" :showBorder="false" :square="false" @change="change"> |
11 | 11 | <uni-grid-item v-for="(item, index) in ListData" :index="index" :key="index"> |
12 | 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 | 16 | </view> |
15 | 17 | </uni-grid-item> |
16 | 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 | 23 | </uni-section> |
18 | 24 | |
19 | 25 | <view class="uni-list-cell-pd"> |
... | ... | @@ -40,39 +46,23 @@ |
40 | 46 | </template> |
41 | 47 | |
42 | 48 | <script> |
43 | - | |
44 | 49 | export default { |
45 | 50 | data() { |
46 | 51 | return { |
47 | 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 | 54 | currentIndex: 0, |
68 | - | |
55 | + // isShowInput: false, | |
56 | + rechargeNum: '', | |
69 | 57 | } |
70 | 58 | }, |
71 | 59 | onLoad() { |
72 | 60 | |
73 | 61 | }, |
74 | 62 | mounted() { |
75 | - this.recharge() | |
63 | + this.recharge(); | |
64 | + this.rechargeList(); | |
65 | + | |
76 | 66 | }, |
77 | 67 | methods: { |
78 | 68 | recharge() { |
... | ... | @@ -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 | 98 | let { |
96 | 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 | 110 | detailCell() { |
104 | - | |
111 | + | |
105 | 112 | } |
106 | 113 | } |
107 | 114 | } | ... | ... |