Commit 297a096b by fengzhaoyu

MOD: 修改钱补零

parent 4db97799
......@@ -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
......@@ -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'
}
});
......@@ -35,6 +35,7 @@ Page({
content: '系统繁忙',
buttonText: '确定'
});
dd.hideLoading()
}
}
}
......
......@@ -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()
......
......@@ -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>
......
......@@ -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()
......
......@@ -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.subsidyAmountc}}</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>
......
......@@ -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()
......
......@@ -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">
......
......@@ -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,
......
......@@ -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();
......
......@@ -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>
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment