Commit 9576e38143ef4a009b9f62807264bcb72e2bf3db
1 parent
f349e3fb
预存款流水优化
Showing
2 changed files
with
22 additions
and
6 deletions
packageD/pages/user/deposit/query/index.js
| ... | ... | @@ -75,10 +75,26 @@ Page({ |
| 75 | 75 | onLoad: function(options) { |
| 76 | 76 | console.log(options); |
| 77 | 77 | // 设置日期选择器的结束时间为当前日期 |
| 78 | - var now=new Date(); | |
| 79 | - var nowDate = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate(); | |
| 80 | - var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000); | |
| 81 | - var startDate=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); | |
| 78 | + var now=new Date(); | |
| 79 | + let now_mot=now.getMonth() + 1 | |
| 80 | + if (now_mot <10) { | |
| 81 | + now_mot='0'+now_mot | |
| 82 | + } | |
| 83 | + let now_date=now.getDate() | |
| 84 | + if (now_date <10) { | |
| 85 | + now_date='0'+now_date | |
| 86 | + } | |
| 87 | + var nowDate = now.getFullYear() + '-' + now_mot + '-' + now_date; | |
| 88 | + var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000); | |
| 89 | + let old_mot=date.getMonth() + 1 | |
| 90 | + if (old_mot <10) { | |
| 91 | + old_mot='0'+old_mot | |
| 92 | + } | |
| 93 | + let old_date=date.getDate() | |
| 94 | + if (old_date <10) { | |
| 95 | + old_date='0'+old_date | |
| 96 | + } | |
| 97 | + var startDate=date.getFullYear() + '-' + old_mot + '-' + old_date; | |
| 82 | 98 | this.setData({ |
| 83 | 99 | ItemInfo:options.itemid, |
| 84 | 100 | datet:startDate, | ... | ... |
packageD/pages/user/deposit/query/index.wxml
| ... | ... | @@ -46,8 +46,8 @@ |
| 46 | 46 | <view class='time'>{{details.BillDate}}</view> |
| 47 | 47 | </view> |
| 48 | 48 | </view> |
| 49 | - <view class="val" style='color:{{(details.InSum>0)?"green":""}}'> | |
| 50 | - {{(details.InSum>0)?"+"+details.InSum:(details.OutSum>0)?"-"+details.OutSum:0}}元 | |
| 49 | + <view class="val" style='color:{{(details.InSum>0 || details.OutSum *(-1)>0 )?"green":""}}'> | |
| 50 | + {{(details.InSum) ? (details.InSum>0 ? ('+'+details.InSum) :(details.InSum) ) : (details.OutSum ? (details.OutSum *(-1) >0 ? ('+'+details.OutSum *(-1)) : details.OutSum *(-1) ):0)}}元 | |
| 51 | 51 | </view> |
| 52 | 52 | </view> |
| 53 | 53 | </block> | ... | ... |