tanyanfei hai 6 meses
pai
achega
59a2fb8d25
Modificáronse 3 ficheiros con 29 adicións e 20 borrados
  1. 6 3
      pages/avg/avg.js
  2. 6 3
      pages/index/index.js
  3. 17 14
      pages/matchdetail/matchdetail.js

+ 6 - 3
pages/avg/avg.js

@@ -120,9 +120,9 @@ Page({
         records = res.data.data.list.reverse()
         var days=res.data.data.list,weeks=[]
         days=days.reverse()
-        for(let i=0;i<52;i++){
+        for(let i=0;i<55;i++){
           weeks.push({
-            name:'第'+(i+1)+'周',
+            name:'',
             data:[],
             total:0
           })
@@ -131,8 +131,11 @@ Page({
           var w=this.getWeekNumber(item.stock_date)
           weeks[w-1].data.push(item)
         })
-        weeks.forEach(item=>{
+        weeks=weeks.filter(item=>item.data.length>0)
+        var w_text=['一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五']
+        weeks.forEach((item,index)=>{
           if(item.data.length>0){
+            item.name='第'+w_text[index]+'周'
             var total=0
             var money = 10000.0
             item.data.forEach(i=>{

+ 6 - 3
pages/index/index.js

@@ -75,9 +75,9 @@ Page({
       $api.getAvg({match_id:res.data.data[0].match_id}).then(res=>{
         var days=res.data.data.list,weeks=[]
         days=days.reverse()
-        for(let i=0;i<52;i++){
+        for(let i=0;i<55;i++){
           weeks.push({
-            name:'第'+(i+1)+'周',
+            name:'',
             data:[],
             total:0
           })
@@ -86,8 +86,11 @@ Page({
           var w=this.getWeekNumber(item.stock_date)
           weeks[w-1].data.push(item)
         })
-        weeks.forEach(item=>{
+        weeks=weeks.filter(item=>item.data.length>0)
+        var w_text=['一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五']
+        weeks.forEach((item,index)=>{
           if(item.data.length>0){
+            item.name='第'+w_text[index]+'周'
             var total=0
             var money = 10000.0
             item.data.forEach(i=>{

+ 17 - 14
pages/matchdetail/matchdetail.js

@@ -171,9 +171,9 @@ Page({
   getWeek(list){
     var days=list,weeks=[]
     days=days.reverse()
-    for(let i=0;i<52;i++){
+    for(let i=0;i<55;i++){
       weeks.push({
-        name:'第'+(i+1)+'周',
+        name:'',
         data:[],
         total:0
       })
@@ -182,19 +182,22 @@ Page({
       var w=this.getWeekNumber(item.stock_date)
       weeks[w-1].data.push(item)
     })
-        weeks.forEach(item=>{
-          if(item.data.length>0){
-            var total=0
-            var money = 10000.0
-            item.data.forEach(i=>{
-              var incom=Number(i.today_income.replace('%',''))
-              money += money*incom/100.0
-              i.date=(new Date(i.stock_date).getMonth()+1)+'/'+(new Date(i.stock_date).getDate())
-            })
-            total = (money-10000)*100.0/10000.0
-            item.total=total.toFixed(2)
-          }
+    weeks=weeks.filter(item=>item.data.length>0)
+    var w_text=['一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五']
+    weeks.forEach((item,index)=>{
+      if(item.data.length>0){
+        item.name='第'+w_text[index]+'周'
+        var total=0
+        var money = 10000.0
+        item.data.forEach(i=>{
+          var incom=Number(i.today_income.replace('%',''))
+          money += money*incom/100.0
+          i.date=(new Date(i.stock_date).getMonth()+1)+'/'+(new Date(i.stock_date).getDate())
         })
+        total = (money-10000)*100.0/10000.0
+        item.total=total.toFixed(2)
+      }
+    })
         this.setData({
           days:weeks.reverse()
         })