Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mingPayMobile
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
mingPayMobile
Commits
297a096b
Commit
297a096b
authored
Oct 11, 2019
by
fengzhaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MOD: 修改钱补零
parent
4db97799
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
168 additions
and
84 deletions
+168
-84
http.js
API/http.js
+21
-47
app.js
app.js
+5
-4
action.js
pages/action/action.js
+1
-0
allowanceList.js
pages/allowanceList/allowanceList.js
+2
-1
allowanceRecordList.axml
pages/allowanceRecordList/allowanceRecordList.axml
+3
-3
allowanceRecordList.js
pages/allowanceRecordList/allowanceRecordList.js
+5
-4
billDetails.axml
pages/billDetails/billDetails.axml
+8
-8
billDetails.js
pages/billDetails/billDetails.js
+2
-1
index.axml
pages/index/index.axml
+1
-0
index.js
pages/index/index.js
+7
-1
payment.js
pages/payment/payment.js
+105
-11
recordList.axml
pages/recordList/recordList.axml
+3
-3
recordList.js
pages/recordList/recordList.js
+5
-1
No files found.
API/http.js
View file @
297a096b
...
...
@@ -12,16 +12,16 @@ const $http = (url, data, type, loadingType) => {
let
loginTime
=
hasToken
.
expires_in
||
''
;
// 用户登陆时间
let
token
=
hasToken
.
access_token
||
''
;
let
refresh_token
=
hasToken
.
refresh_token
// 刷新token
let
mingUserId
=
dd
.
getStorageSync
({
key
:
'mingUserId'
}
.
data
)
let
mingUserId
=
dd
.
getStorageSync
({
key
:
'mingUserId'
}
).
data
// 时间戳未过期
if
(
!!
hasToken
&&
((
new
Date
()).
getTime
()
-
hasToken
.
loginTime
<
hasToken
.
expires_in
*
1000
)){
// if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime)< 30 * 1000){
data
.
orgId
=
dd
.
corpId
;
let
sendData
=
''
;
for
(
let
key
in
data
){
sendData
=
`
${
sendData
}${
key
}
=
${
data
[
key
]}
&`
}
sendData
=
sendData
.
substring
(
0
,
sendData
.
length
-
1
);
console
.
log
(
sendData
);
return
new
Promise
((
resolve
,
reject
)
=>
{
dd
.
httpRequest
({
headers
:
{
...
...
@@ -33,6 +33,7 @@ const $http = (url, data, type, loadingType) => {
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
res
.
data
.
resultCode
===
0
)
{
console
.
log
(
res
.
data
.
data
)
return
resolve
(
res
.
data
.
data
)
}
else
{
// 修改系统繁忙时loading隐藏
...
...
@@ -44,6 +45,7 @@ const $http = (url, data, type, loadingType) => {
}
},
fail
:
function
(
res
)
{
console
.
log
(
'调用失败'
)
dd
.
hideLoading
();
dd
.
alert
({
content
:
'系统繁忙'
,
...
...
@@ -55,8 +57,9 @@ const $http = (url, data, type, loadingType) => {
}
// 时间戳过期
else
{
dd
.
getNetworkType
({
success
:
(
res
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
dd
.
getNetworkType
({
success
:
(
res
)
=>
{
// 有网的情况下
if
(
res
.
networkAvailable
)
{
dd
.
httpRequest
({
...
...
@@ -64,11 +67,9 @@ const $http = (url, data, type, loadingType) => {
'Authorization'
:
'Basic bWluZ3BheS1waG9uZTptaW5ncGF5LXBob25l'
,
'Content-Type'
:
'application/x-www-form-urlencoded'
},
dataType
:
'json'
,
data
:
{
username
:
mingUserId
,
password
:
mingUserId
,
scope
:
'server'
,
grant_type
:
'password'
,
grant_type
:
'refresh_token'
,
refresh_token
:
refresh_token
},
url
:
`http://
${
app
.
globalData
.
globalUrl
}
/auth/oauth/token`
,
...
...
@@ -83,7 +84,13 @@ const $http = (url, data, type, loadingType) => {
loginTime
:
(
new
Date
()).
getTime
()
}
})
$http
(
url
,
data
,
type
)
dd
.
setStorageSync
({
key
:
'a'
,
data
:
1
})
$http
(
url
,
data
,
type
).
then
(
res
=>
{
return
resolve
(
res
)
})
},
fail
:
function
(
res
)
{
console
.
log
(
'err'
,
res
)
...
...
@@ -94,44 +101,6 @@ const $http = (url, data, type, loadingType) => {
dd
.
hideLoading
()
}
})
// dd.getAuthCode({
// success:function(resultCode){
// dd.httpRequest({
// headers: {"Content-Type": "application/json"},
// url: `http://${app.globalUrl}/v1/auth/token?version=v1&code=${resultCode.authCode}&orgId=${dd.corpId}`,
// method: 'POST',
// dataType: 'json',
// success: function(res) {
// // 全局存储用户信息token和用户信息
// const data = res.data.data
// // 更新用户内部信息
// dd.setStorageSync({
// key: 'token',
// data: {
// access_token: data.accessToken.access_token,
// token_type: data.accessToken.token_type,
// expires_in: data.accessToken.expires_in,
// loginTime: (new Date()).getTime()
// }
// });
// dd.setStorageSync({
// key: 'userId',
// data: data.oapiUser.userid
// });
// $http(url, data, type)
// },
// fail: function(res) {
// console.log(res)
// }
// });
// },
// fail:function(err){
// dd.alert({
// content: '系统繁忙',
// buttonText: '确定'
// });
// }
// });
}
else
{
dd
.
alert
({
...
...
@@ -141,7 +110,11 @@ const $http = (url, data, type, loadingType) => {
dd
.
hideLoading
()
}
}
});
})
}
}
export
default
{
$http
}
\ No newline at end of file
app.js
View file @
297a096b
...
...
@@ -14,11 +14,12 @@ App({
},
// axios.defaults.baseURL = 'http://192.168.1.106:8400' // 本地荣
// axios.defaults.baseURL = 'http://192.168.1.102:8400' // 本地钱
// axios.defaults.baseURL = 'http://139.
196.213.18:8400
' // beta环境
// axios.defaults.baseURL = 'http://139.
224.55.14:9999
' // beta环境
globalData
:
{
loadingType
:
0
,
globalUrl
:
'192.168.1.101:9999'
// globalUrl: '192.168.1.102:8400'
// globalUrl: '139.196.213.18:8400'
// globalUrl: '192.168.1.101:9999'
// globalUrl: '192.168.1.102:9999'
globalUrl
:
'139.224.55.14:9999'
// globalUrl: ':9999'
}
});
pages/action/action.js
View file @
297a096b
...
...
@@ -35,6 +35,7 @@ Page({
content
:
'系统繁忙'
,
buttonText
:
'确定'
});
dd
.
hideLoading
()
}
}
}
...
...
pages/allowanceList/allowanceList.js
View file @
297a096b
...
...
@@ -27,7 +27,8 @@ Page({
})
},
endTimeToStr
(
time
)
{
let
timeData
=
new
Date
(
parseInt
(
time
))
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
let
timeData
=
new
Date
(
time
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
...
...
pages/allowanceRecordList/allowanceRecordList.axml
View file @
297a096b
...
...
@@ -12,7 +12,7 @@
<view>
<view class="listType">
<text>充值</text>
<text>+{{item.orderAmount}}</text>
<text>+{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">
<text>{{item.createDate}}</text>
...
...
@@ -26,7 +26,7 @@
<view>
<view class="listType">
<text>消费</text>
<text>-{{item.orderAmount}}</text>
<text>-{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">
<text>{{item.createDate}}</text>
...
...
@@ -41,7 +41,7 @@
<view>
<view class="listType">
<text>退款</text>
<text style="color: #FFC64F">+{{item.orderAmount}}</text>
<text style="color: #FFC64F">+{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">{{item.createDate}}</view>
</view>
...
...
pages/allowanceRecordList/allowanceRecordList.js
View file @
297a096b
...
...
@@ -12,7 +12,6 @@ Page({
onLoad
(
query
)
{
this
.
resetData
()
dd
.
setNavigationBar
({
title
:
'账单记录'
});
console
.
log
(
query
);
this
.
setData
({
subsidyNo
:
query
.
subsidyNo
})
...
...
@@ -27,7 +26,6 @@ Page({
})
},
queryListPaymentRecord
(
str
)
{
console
.
log
(
str
)
const
_that
=
this
;
let
data
=
{
currentPage
:
this
.
data
.
currentPage
,
...
...
@@ -36,11 +34,12 @@ Page({
subsidyNo
:
this
.
data
.
subsidyNo
}
$http
.
$http
(
'isv/consume/list_payment_record'
,
data
,
'GET'
).
then
((
res
)
=>
{
console
.
log
(
'allowanceRecordList.js'
+
res
)
console
.
log
(
'allowanceRecordList.js'
,
res
)
let
dataList
=
[...
res
.
recordList
];
let
recordAlliwanceListDataSource
=
_that
.
data
.
recordAlliwanceListData
if
(
dataList
.
length
>
0
)
{
dataList
.
map
((
item
,
index
)
=>
{
console
.
log
(
'item.createDate'
,
item
.
createDate
)
item
.
createDate
=
_that
.
timeToStr
(
item
.
createDate
)
recordAlliwanceListDataSource
.
push
(
item
)
})
...
...
@@ -68,7 +67,9 @@ Page({
this
.
queryListPaymentRecord
()
},
timeToStr
(
time
)
{
let
timeData
=
new
Date
(
parseInt
(
time
))
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
let
timeData
=
new
Date
(
time
)
console
.
log
(
'timeData'
,
timeData
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
...
...
pages/billDetails/billDetails.axml
View file @
297a096b
...
...
@@ -2,18 +2,18 @@
<view class="title" a:if="{{recordData.payTypeCode === 'INTERNAL_RECHAGE' || recordData.payTypeCode === 'EXTERNAL_ALI_RECHAGE'}}">充值</view>
<view class="title" a:else="{{recordData.status === 'SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">消费</view>
<view class="title" a:else="{{recordData.status === 'REFUND_SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">退款</view>
<view class="money" a:if="{{recordData.payTypeCode === 'INTERNAL_RECHAGE' || recordData.payTypeCode === 'EXTERNAL_ALI_RECHAGE'}}">+{{recordData.orderAmount}}</view>
<view class="money" a:else="{{recordData.status === 'SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">-{{recordData.orderAmount}}</view>
<view class="money" a:else="{{recordData.status === 'REFUND_SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">+{{recordData.orderAmount}}</view>
<view class="money" a:if="{{recordData.payTypeCode === 'INTERNAL_RECHAGE' || recordData.payTypeCode === 'EXTERNAL_ALI_RECHAGE'}}">+{{recordData.orderAmount
.toFixed(2)
}}</view>
<view class="money" a:else="{{recordData.status === 'SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">-{{recordData.orderAmount
.toFixed(2)
}}</view>
<view class="money" a:else="{{recordData.status === 'REFUND_SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">+{{recordData.orderAmount
.toFixed(2)
}}</view>
<view class="{{recordData.payTypeCode === 'INTERNAL_CONSUME' && recordData.orderStatus === 'REFUND_SUCCESS' ? 'type colorChange' : 'type'}}">{{recordData.payTypeCode === 'INTERNAL_CONSUME' && recordData.orderStatus === 'REFUND_SUCCESS' ? '已退款' : '交易成功'}}</view>
<view class="detailsItem" a:if="{{recordData.status === 'SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">
<view>
<view>实付金额</view>
<view>-{{recordData.realityAmount}}</view>
<view>-{{recordData.realityAmount
.toFixed(2)
}}</view>
</view>
<view>
<view>津贴金额</view>
<view>-{{recordData.subsidyAmount}}</view>
<view>-{{recordData.subsidyAmount
c
}}</view>
</view>
<view>
<view>创建时间</view>
...
...
@@ -31,11 +31,11 @@
<view class="detailsItem" a:if="{{recordData.status === 'REFUND_SUCCESS' && recordData.payTypeCode === 'INTERNAL_CONSUME'}}">
<view>
<view>退款金额</view>
<view>+{{recordData.realityAmount}}</view>
<view>+{{recordData.realityAmount
.toFixed(2)
}}</view>
</view>
<view>
<view>退款津贴</view>
<view>+{{recordData.subsidyAmount}}</view>
<view>+{{recordData.subsidyAmount
.toFixed(2)
}}</view>
</view>
<view>
<view>创建时间</view>
...
...
@@ -49,7 +49,7 @@
<view class="detailsItem" a:if="{{recordData.payTypeCode === 'INTERNAL_RECHAGE' || recordData.payTypeCode === 'EXTERNAL_ALI_RECHAGE'}}">
<view>
<view>充值金额</view>
<view>+{{recordData.orderAmount}}</view>
<view>+{{recordData.orderAmount
.toFixed(2)
}}</view>
</view>
<view>
<view>创建时间</view>
...
...
pages/billDetails/billDetails.js
View file @
297a096b
...
...
@@ -17,7 +17,8 @@ Page({
this
.
queryListPaymentRecord
()
},
timeToStr
(
time
)
{
let
timeData
=
new
Date
(
parseInt
(
time
))
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
let
timeData
=
new
Date
(
time
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
...
...
pages/index/index.axml
View file @
297a096b
...
...
@@ -19,6 +19,7 @@
<view touchStart="touchStyle" onTap="navigatorToAllowanceList"><image mode="scaleToFill" src="./../../assets/allowance.png"/>津贴</view>
<view touchStart="touchStyle" onTap="navigatorToRecordList"><image mode="scaleToFill" src="./../../assets/bill.png"/>账单</view>
</view>
<!-- <button size="default" type="primary" onTap="clear">琴姐专用按钮</button> -->
<!--
<view onTap="navigatorToAlipayRecharge">
...
...
pages/index/index.js
View file @
297a096b
...
...
@@ -8,6 +8,13 @@ Page({
realityBalance
:
''
,
cardNo
:
''
},
// clear() {
// console.log(11111111111)
// dd.removeStorageSync({
// key: 'token.data.access_token',
// });
// },
onLoad
(
query
)
{
const
_that
=
this
;
dd
.
setNavigationBar
({
...
...
@@ -39,7 +46,6 @@ Page({
ddUserId
:
ddUserId
}
$http
.
$http
(
'isv/account/queryAccountDetail'
,
data
,
'GET'
).
then
((
res
)
=>
{
console
.
log
(
res
)
this
.
setData
({
name
:
res
.
name
,
realityBalance
:
res
.
realityBalance
,
...
...
pages/payment/payment.js
View file @
297a096b
...
...
@@ -20,6 +20,7 @@ Page({
title
:
'付款码'
});
},
// 点击刷新二维码
clickRefreshQRcode
(){
const
_that
=
this
;
clearInterval
(
timeRefreshQRcode
);
...
...
@@ -28,21 +29,113 @@ Page({
_that
.
refreshQRcode
();
},
55000
);
},
// 生成二维码
refreshQRcode
(){
const
_that
=
this
;
let
hasToken
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
;
let
token
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
access_token
;
let
timestamp
=
(
new
Date
()).
getTime
();
let
url
=
aes
.
getAES
(
JSON
.
stringify
({
"token"
:
token
,
"timestamp"
:
timestamp
,
}))
let
size
=
272
let
ecc
=
2
let
name
=
'myQrcode'
const
ctx
=
dd
.
createCanvasContext
(
name
);
QR
.
draw
(
url
,
ctx
,
size
,
Number
(
ecc
));
let
expires_in
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
expires_in
;
let
refresh_token
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
refresh_token
;
if
(
!!
hasToken
&&
((
new
Date
()).
getTime
()
-
hasToken
.
loginTime
<
(
hasToken
.
expires_in
-
60
)
*
1000
))
{
// if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime < 30 * 1000)) {
let
timestamp
=
(
new
Date
()).
getTime
();
let
url
=
aes
.
getAES
(
JSON
.
stringify
({
"token"
:
token
,
"timestamp"
:
timestamp
,
}))
let
size
=
272
let
ecc
=
2
let
name
=
'myQrcode'
console
.
log
(
111111111111
)
const
ctx
=
dd
.
createCanvasContext
(
name
);
QR
.
draw
(
url
,
ctx
,
size
,
Number
(
ecc
));
console
.
log
(
11111111111111
)
}
else
{
dd
.
getNetworkType
({
success
:
(
res
=>
{
// 网络可用的情况下 刷新token
if
(
res
.
networkAvailable
)
{
dd
.
httpRequest
({
headers
:
{
'Authorization'
:
'Basic bWluZ3BheS1waG9uZTptaW5ncGF5LXBob25l'
,
'Content-Type'
:
'application/x-www-form-urlencoded'
},
url
:
`http://
${
app
.
globalData
.
globalUrl
}
/auth/oauth/token`
,
dataType
:
'json'
,
data
:
{
grant_type
:
'refresh_token'
,
refresh_token
:
refresh_token
},
method
:
'POST'
,
success
:
function
(
res
)
{
console
.
log
(
res
)
dd
.
setStorageSync
({
key
:
'token'
,
data
:
{
access_token
:
res
.
data
.
access_token
,
expires_in
:
res
.
data
.
expires_in
,
refresh_token
:
res
.
data
.
refresh_token
,
loginTime
:
(
new
Date
()).
getTime
()
}
})
_that
.
setData
({
b
:
1
})
hasToken
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
;
token
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
access_token
;
expires_in
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
expires_in
;
refresh_token
=
dd
.
getStorageSync
({
key
:
'token'
}).
data
.
refresh_token
;
let
timestamp
=
(
new
Date
()).
getTime
();
let
url
=
aes
.
getAES
(
JSON
.
stringify
({
"token"
:
token
,
"timestamp"
:
timestamp
,
}))
let
size
=
272
let
ecc
=
2
let
name
=
'myQrcode'
const
ctx
=
dd
.
createCanvasContext
(
name
);
QR
.
draw
(
url
,
ctx
,
size
,
Number
(
ecc
));
},
fail
:
function
(
res
)
{
dd
.
alert
({
content
:
'系统繁忙'
,
buttonText
:
'确定'
})
dd
.
hideLoading
()
}
})
}
else
{
dd
.
alert
({
content
:
'请连接网络后重新进入'
,
buttonText
:
'确定'
})
dd
.
hideLoading
()
}
})
})
}
// let timestamp = (new Date()).getTime();
// let url = aes.getAES(JSON.stringify({
// "token": token,
// "timestamp": timestamp,
// }))
// let size = 272
// let ecc = 2
// let name = 'myQrcode'
// const ctx = dd.createCanvasContext(name);
// QR.draw(url, ctx, size, Number(ecc));
},
onReady
()
{
// 页面加载完成
console
.
log
(
' onReady'
)
clearInterval
(
timeRefreshQRcode
);
const
_that
=
this
;
_that
.
refreshQRcode
();
...
...
@@ -51,9 +144,10 @@ Page({
},
55000
);
},
onShow
()
{
console
.
log
(
'进入onshow'
)
//刷新二维码
const
_that
=
this
;
clearInterval
(
timeRefreshQRcode
);
const
_that
=
this
;
_that
.
refreshQRcode
();
timeRefreshQRcode
=
setInterval
(
function
()
{
_that
.
refreshQRcode
();
...
...
pages/recordList/recordList.axml
View file @
297a096b
...
...
@@ -31,7 +31,7 @@
<view>
<view class="listType">
<text>充值</text>
<text>+{{item.orderAmount}}</text>
<text>+{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">
<text>{{item.createDate}}</text>
...
...
@@ -45,7 +45,7 @@
<view>
<view class="listType">
<text>消费</text>
<text>-{{item.orderAmount}}</text>
<text>-{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">
<text>{{item.createDate}}</text>
...
...
@@ -60,7 +60,7 @@
<view>
<view class="listType">
<text>退款</text>
<text style="color: #FFC64F">+{{item.orderAmount}}</text>
<text style="color: #FFC64F">+{{item.orderAmount
.toFixed(2)
}}</text>
</view>
<view class="listTime">{{item.createDate}}</view>
</view>
...
...
pages/recordList/recordList.js
View file @
297a096b
...
...
@@ -119,6 +119,7 @@ Page({
let
recordListDataSource
=
_that
.
data
.
recordListData
if
(
dataList
.
length
>
0
)
{
dataList
.
map
((
item
,
index
)
=>
{
console
.
log
(
' item.createDate'
,
item
.
createDate
)
item
.
createDate
=
_that
.
timeToStr
(
item
.
createDate
)
recordListDataSource
.
push
(
item
)
})
...
...
@@ -183,7 +184,10 @@ Page({
this
.
queryListPaymentRecord
()
},
timeToStr
(
time
)
{
let
timeData
=
new
Date
(
parseInt
(
time
))
time
=
time
.
replace
(
/
\-
/g
,
"/"
)
let
timeData
=
new
Date
(
time
)
console
.
log
(
'time'
,
time
)
console
.
log
(
'timeData'
,
timeData
)
let
year
=
timeData
.
getFullYear
()
let
month
=
timeData
.
getMonth
()
+
1
let
date
=
timeData
.
getDate
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment