Commit 3b7af3a28da39037c9c2ba31fbd345d0e3aa293e

Authored by chenbiao
1 parent 15d5c692

add 我的钱包 接口联调

common/common.js
@@ -36,15 +36,15 @@ const requestSign = function(inputData) { @@ -36,15 +36,15 @@ const requestSign = function(inputData) {
36 36
37 var jsonList = inputData || {}; 37 var jsonList = inputData || {};
38 38
39 - jsonList.orgId = public_orgId; 39 + // jsonList.orgId = public_orgId;
40 jsonList.sign_type = "md5"; 40 jsonList.sign_type = "md5";
41 jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104"; 41 jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104";
42 jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E"; 42 jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E";
43 jsonList.salt = getSalt(); 43 jsonList.salt = getSalt();
44 jsonList.terminalSource = "11"; 44 jsonList.terminalSource = "11";
45 - // jsonList.token = getGlobalUser("globalUser").token; 45 + jsonList.token = getGlobalUser("globalUser").token;
46 // jsonList.token = getGlobalUser("globalUser").token; 46 // jsonList.token = getGlobalUser("globalUser").token;
47 - jsonList.token = 'eb1538c4c2ee45d7b2610cf071c4a27f'; 47 + // jsonList.token = 'eb1538c4c2ee45d7b2610cf071c4a27f';
48 48
49 var arrData = []; 49 var arrData = [];
50 for (var key in jsonList) { 50 for (var key in jsonList) {
common/filters.js
@@ -31,21 +31,9 @@ const RMB = (value) => { @@ -31,21 +31,9 @@ const RMB = (value) => {
31 return `¥${value}` 31 return `¥${value}`
32 } 32 }
33 33
34 -// 保留两位小数 34 +// 保留两位小数
35 const toFixed2 = num => { 35 const toFixed2 = num => {
36 - let f = Number(parseFloat(num));  
37 - if (isNaN(f)) return false;  
38 - let z = Math.round(num * 100) / 100;  
39 - let s = z.toString();  
40 - let rs = s.indexOf('.');  
41 - if (rs < 0) {  
42 - rs = s.length;  
43 - s += '.';  
44 - }  
45 - while (s.length <= rs + 2) {  
46 - s += '0';  
47 - }  
48 - return s 36 + return isNaN(num) ? 0.00 : parseFloat((num/100).toFixed(2));
49 } 37 }
50 38
51 // 数字每三位加个逗号 39 // 数字每三位加个逗号
@@ -4,7 +4,7 @@ import store from &#39;./store&#39; @@ -4,7 +4,7 @@ import store from &#39;./store&#39;
4 import common from "./common/common.js"; 4 import common from "./common/common.js";
5 import { myRequest } from './common/requestServer.js' 5 import { myRequest } from './common/requestServer.js'
6 //引入封装的过滤器 filters 6 //引入封装的过滤器 filters
7 -import * as filters from './common/filters.js' 7 +import filters from './common/filters.js'
8 // 挂在Vue属性 全局通过this.$myRequest()可以访问到 8 // 挂在Vue属性 全局通过this.$myRequest()可以访问到
9 Vue.prototype.$common = common 9 Vue.prototype.$common = common
10 Vue.prototype.$myRequest = myRequest 10 Vue.prototype.$myRequest = myRequest
pages/index/index.vue
@@ -103,15 +103,15 @@ @@ -103,15 +103,15 @@
103 } 103 }
104 }, 104 },
105 onLoad() { 105 onLoad() {
106 - let userToken= uni.getStorageSync("globalUser").token;  
107 - if(userToken){  
108 - this.userIsLogin = false;  
109 - let indexInfo= uni.getStorageSync("indexInfo");  
110 - this.userName=indexInfo.userName;  
111 -  
112 - }else{  
113 - this.userIsLogin = true;  
114 - } 106 + let userToken = uni.getStorageSync("globalUser").token;
  107 + if (userToken) {
  108 + this.userIsLogin = false;
  109 + let indexInfo = uni.getStorageSync("indexInfo");
  110 + this.userName = indexInfo.userName;
  111 +
  112 + } else {
  113 + this.userIsLogin = true;
  114 + }
115 }, 115 },
116 methods: { 116 methods: {
117 login() { 117 login() {
@@ -193,12 +193,12 @@ @@ -193,12 +193,12 @@
193 193
194 }); 194 });
195 }, 195 },
196 - toRecordPage() {  
197 - uni.navigateTo({  
198 - url: '../parkRecordList/parkRecordList' 196 + toRecordPage() {
  197 + uni.navigateTo({
  198 + url: '../parkRecordList/parkRecordList'
199 199
200 - });  
201 - }, 200 + });
  201 + },
202 202
203 203
204 204
pages/moneyRecharge/moneyRecharge.vue
1 <template> 1 <template>
2 - <view>  
3 -  
4 - <view class="rechargeTop">  
5 - <view class="toDetail uni-list-cell-pd uni-right" @click="detailCell">明细 ></view>  
6 - <view class="rechargeNum uni-center">¥{{acctBalance}}</view>  
7 - </view>  
8 -  
9 - <uni-section title="充值金额" type="line" padding>  
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">  
12 - <view class="grid-item-box" style="background-color: #fff;">  
13 - <view class="text" :class="currentIndex==index?'itemActive':''">{{item.text}}</view>  
14 - </view>  
15 - </uni-grid-item>  
16 - </uni-grid>  
17 - </uni-section>  
18 -  
19 - <view class="uni-list-cell-pd">  
20 - 温馨提示:暂不支持退款,请谨慎选择充值金额!  
21 - </view>  
22 - <view class="border-bg"></view>  
23 -  
24 - <view class="order-title">  
25 - 支付方法  
26 - </view>  
27 - <view class="order-line"></view>  
28 -  
29 - <view class="orderwaysview">  
30 - <image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image>  
31 - <view class="order-info" style="margin-left: 8px;">  
32 - 微信支付  
33 - </view>  
34 - <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image>  
35 - </view>  
36 -  
37 - <button @click="payClick" class="button-sp-area" type="primary" plain="true">确认充值</button>  
38 -  
39 - </view> 2 + <view>
  3 +
  4 + <view class="rechargeTop">
  5 + <view class="toDetail uni-list-cell-pd uni-right" @click="detailCell">明细 ></view>
  6 + <view class="rechargeNum uni-center">¥{{acctBalance | toFixed2 }}</view>
  7 + </view>
  8 +
  9 + <uni-section title="充值金额" type="line" padding>
  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">
  12 + <view class="grid-item-box" style="background-color: #fff;">
  13 + <view class="text" :class="currentIndex==index?'itemActive':''">{{item.text}}</view>
  14 + </view>
  15 + </uni-grid-item>
  16 + </uni-grid>
  17 + </uni-section>
  18 +
  19 + <view class="uni-list-cell-pd">
  20 + 温馨提示:暂不支持退款,请谨慎选择充值金额!
  21 + </view>
  22 + <view class="border-bg"></view>
  23 +
  24 + <view class="order-title">
  25 + 支付方法
  26 + </view>
  27 + <view class="order-line"></view>
  28 +
  29 + <view class="orderwaysview">
  30 + <image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image>
  31 + <view class="order-info" style="margin-left: 8px;">
  32 + 微信支付
  33 + </view>
  34 + <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image>
  35 + </view>
  36 +
  37 + <button @click="payClick" class="button-sp-area" type="primary" plain="true">确认充值</button>
  38 +
  39 + </view>
40 </template> 40 </template>
41 41
42 <script> 42 <script>
43 -import common from "../../common/common.js";  
44 -export default {  
45 - data() {  
46 - return {  
47 - acctBalance:'0.00',  
48 - ListData: [  
49 - {  
50 - text: '100元'  
51 - },  
52 - {  
53 - text: '200元'  
54 - },  
55 - {  
56 - text: '300元'  
57 - },  
58 - {  
59 - text: '600元'  
60 - },  
61 - {  
62 - text: '1000元'  
63 - },  
64 - {  
65 - text: '其他'  
66 - },  
67 - ],  
68 - currentIndex: 0,  
69 -  
70 - }  
71 - },  
72 - onLoad() {  
73 -  
74 - },  
75 - mounted() {  
76 - this.recharge()  
77 - },  
78 - methods: {  
79 - recharge() {  
80 - let that = this;  
81 - that.$myRequest({  
82 - url: that.$common.walletAccount,  
83 - method: 'POST',  
84 - data: that.$common.requestSign()  
85 - }).then(res => {  
86 -  
87 - console.log(res)  
88 - let data = res.data;  
89 - that.acctBalance = data.acctBalance;  
90 -  
91 - }) 43 +
  44 + export default {
  45 + data() {
  46 + return {
  47 + 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 + ],
  67 + currentIndex: 0,
  68 +
  69 + }
  70 + },
  71 + onLoad() {
  72 +
  73 + },
  74 + mounted() {
  75 + this.recharge()
92 }, 76 },
93 -  
94 - change(e) {  
95 -  
96 - let {  
97 - index  
98 - } = e.detail  
99 -  
100 - this.currentIndex = index  
101 - console.log(index+1)  
102 -  
103 - },  
104 -  
105 - }  
106 -} 77 + methods: {
  78 + recharge() {
  79 + let that = this;
  80 + that.$myRequest({
  81 + url: that.$common.walletAccount,
  82 + method: 'POST',
  83 + data: that.$common.requestSign()
  84 + }).then(res => {
  85 +
  86 + console.log(res)
  87 + let data = res.data;
  88 + that.acctBalance = data.acctBalance;
  89 +
  90 + })
  91 + },
  92 +
  93 + change(e) {
  94 +
  95 + let {
  96 + index
  97 + } = e.detail
  98 +
  99 + this.currentIndex = index
  100 + console.log(index + 1)
  101 +
  102 + },
  103 + detailCell() {
  104 +
  105 + }
  106 + }
  107 + }
107 </script> 108 </script>
108 109
109 <style scoped lang="scss"> 110 <style scoped lang="scss">
110 - .rechargeTop{  
111 - height: 100px;  
112 - background: #007AFF;  
113 - color: #fff;  
114 - position: relative;  
115 - }  
116 - .toDetail{  
117 - /*text-align: right;*/  
118 -  
119 - }  
120 - .rechargeNum{  
121 - font-size: 30px;  
122 - }  
123 - .text {  
124 - width: 80%;  
125 - height: 60px;  
126 - line-height: 60px;  
127 - margin: 10px auto;  
128 - border: 1px solid #ccc;  
129 - text-align: center;  
130 - }  
131 -  
132 - .itemActive {  
133 - background: #f0ad4e;  
134 - }  
135 -  
136 - .order-title {  
137 - font-size: 18px;  
138 - margin-left: 16px;  
139 - margin-top: 15px;  
140 - font-weight: bold;  
141 - color: #404040;  
142 - }  
143 -  
144 - .order-info {  
145 - font-size: 14px;  
146 - margin-left: 15px;  
147 - margin-top: 12px;  
148 - color: #404040;  
149 - }  
150 -  
151 - .order-line {  
152 - background: #D9D9D9;  
153 - height: 1px;  
154 - margin-top: 12px;  
155 - margin-left: 15px;  
156 - padding: 0px;  
157 - overflow: hidden;  
158 - /* 透明度 */  
159 - opacity: 0.5;  
160 - }  
161 -  
162 - .order-line-bold {  
163 - background: #FAFAFA;  
164 - height: 12px;  
165 - margin-top: 12px;  
166 - padding: 0px;  
167 - overflow: hidden;  
168 - }  
169 -  
170 - .flex-row-justify-between {  
171 - display: flex;  
172 - flex-direction: row;  
173 - justify-content: space-between;  
174 - }  
175 -  
176 - .flex-row-justify-end {  
177 - display: flex;  
178 - flex-direction: row;  
179 - /* 水平对齐*/  
180 - align-items: baseline;  
181 -  
182 - }  
183 -  
184 - .order-discount {  
185 - color: #C8C7CC;  
186 - margin-right: 20 upx;  
187 - /* margin-right: 12px ; */  
188 - /* margin-top:12px ; */  
189 -  
190 - }  
191 -  
192 - .orderwaysview {  
193 - display: flex;  
194 - flex-direction: row;  
195 - }  
196 -  
197 - .orderways {  
198 - width: 18px;  
199 - height: 18px;  
200 - margin-left: 15px;  
201 - margin-top: 14px;  
202 - }  
203 -  
204 - .orderwaysSel {  
205 - width: 16px;  
206 - height: 16px;  
207 - margin-left: auto;  
208 - margin-right: 14px;  
209 - margin-top: 14px;  
210 - /* justify-content:flex-end; */  
211 - }  
212 -  
213 - .button-sp-area {  
214 - margin: 0 auto;  
215 - width: 60%;  
216 - margin-top: 40px;  
217 -  
218 - } 111 + .rechargeTop {
  112 + height: 100px;
  113 + background: #007AFF;
  114 + color: #fff;
  115 + position: relative;
  116 + }
  117 +
  118 + .toDetail {
  119 + /*text-align: right;*/
  120 +
  121 + }
  122 +
  123 + .rechargeNum {
  124 + font-size: 30px;
  125 + }
  126 +
  127 + .text {
  128 + width: 80%;
  129 + height: 60px;
  130 + line-height: 60px;
  131 + margin: 10px auto;
  132 + border: 1px solid #ccc;
  133 + text-align: center;
  134 + }
  135 +
  136 + .itemActive {
  137 + background: #f0ad4e;
  138 + }
  139 +
  140 + .order-title {
  141 + font-size: 18px;
  142 + margin-left: 16px;
  143 + margin-top: 15px;
  144 + font-weight: bold;
  145 + color: #404040;
  146 + }
  147 +
  148 + .order-info {
  149 + font-size: 14px;
  150 + margin-left: 15px;
  151 + margin-top: 12px;
  152 + color: #404040;
  153 + }
  154 +
  155 + .order-line {
  156 + background: #D9D9D9;
  157 + height: 1px;
  158 + margin-top: 12px;
  159 + margin-left: 15px;
  160 + padding: 0px;
  161 + overflow: hidden;
  162 + /* 透明度 */
  163 + opacity: 0.5;
  164 + }
  165 +
  166 + .order-line-bold {
  167 + background: #FAFAFA;
  168 + height: 12px;
  169 + margin-top: 12px;
  170 + padding: 0px;
  171 + overflow: hidden;
  172 + }
  173 +
  174 + .flex-row-justify-between {
  175 + display: flex;
  176 + flex-direction: row;
  177 + justify-content: space-between;
  178 + }
  179 +
  180 + .flex-row-justify-end {
  181 + display: flex;
  182 + flex-direction: row;
  183 + /* 水平对齐*/
  184 + align-items: baseline;
  185 +
  186 + }
  187 +
  188 + .order-discount {
  189 + color: #C8C7CC;
  190 + margin-right: 20 upx;
  191 + /* margin-right: 12px ; */
  192 + /* margin-top:12px ; */
  193 +
  194 + }
  195 +
  196 + .orderwaysview {
  197 + display: flex;
  198 + flex-direction: row;
  199 + }
  200 +
  201 + .orderways {
  202 + width: 18px;
  203 + height: 18px;
  204 + margin-left: 15px;
  205 + margin-top: 14px;
  206 + }
  207 +
  208 + .orderwaysSel {
  209 + width: 16px;
  210 + height: 16px;
  211 + margin-left: auto;
  212 + margin-right: 14px;
  213 + margin-top: 14px;
  214 + /* justify-content:flex-end; */
  215 + }
  216 +
  217 + .button-sp-area {
  218 + margin: 0 auto;
  219 + width: 60%;
  220 + margin-top: 40px;
  221 +
  222 + }
219 </style> 223 </style>