Commit 190d04f7 by 高淑倩

kpi

parent d3e23e19
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 50,
"current": -1,
"list": [
{
"id": -1,
......@@ -375,13 +375,6 @@
"scene": null
},
{
"id": 50,
"name": "kpi",
"pathName": "pages/shopping/kpi/kpi",
"query": "",
"scene": null
},
{
"id": -1,
"name": "销售任务详情",
"pathName": "shoppingGuid/page/pages/saleTaskInfo/saleTaskInfo",
......
......@@ -14,9 +14,10 @@ wxService.page({
// { name: '维护任务', type: 4, isActive: false }
],
current: 1,
list : [{id:1,},{id:2},{id:3},{id:4},{id:5},{id:6},{id:7},{id:8}],
list : [],
pageSize: 10,
pageNo: 1
pageNo: 1,
totalPages: 0
},
/**
......@@ -49,8 +50,15 @@ wxService.page({
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
data.content.forEach(item=>{
let curStart = new Date(item.task.startTime)
let curEnd = new Date(item.task.endTime)
item.task.startTime = `${curStart.getMonth()}${curStart.getDay()}日`
item.task.endTime = `${curEnd.getMonth()}${curEnd.getDay()}日`
})
this.setData({
list: pageNo == 1? [...data.content]: [...this.data.list,...data.content],
totalPages: data.totalPages
})
}
}
......@@ -70,6 +78,7 @@ wxService.page({
this.setData({
pageNo: 1,
totalPages: 0,
navBar: this.data.navBar,
current: this.data.current
},()=>{
......@@ -116,11 +125,13 @@ wxService.page({
*/
onReachBottom: function () {
console.log('-------------')
this.setData({
pageNo: this.data.pageNo + 1,
},()=>{
const {pageSize, pageNo,current} = this.data
this.getTaskPage(pageSize, pageNo,current)
})
if(pageNo < totalPages) {
this.setData({
pageNo: this.data.pageNo + 1,
},()=>{
const {pageSize, pageNo,current} = this.data
this.getTaskPage(pageSize, pageNo,current)
})
}
}
})
\ No newline at end of file
<!--shoppingGuid/page/pages/kpi/kpi.wxml-->
<wxs src="../../../../wxs/utils.wxs" module="utils" />
<!-- KPI界面 -->
<view class='main-container'>
<view class='header-tab'>
......@@ -25,20 +26,20 @@
wx:for-item="item">
<view class='status-bar'>
<view class='status'>
已完成:<text>133</text>
已完成:<text>10</text>
</view>
<view class='percent'>133%</view>
<view class='percent'>{{utils.toPercent( 10, 100) }}</view>
</view>
<view class='task-time'>
<image src='/assets/imgs/shoppingGuide/kpi_task_time.png' mode='widthFix'></image>
<text>9月1日~10月1日</text>
<text>{{item.task.startTime}}~{{item.task.endTime}}</text>
</view>
<view class='task-info'>
<view class='lf'>
<image src='/assets/imgs/shoppingGuide/kpi_task_name.png' mode='widthFix'></image>
<text>新品上市任务</text>
<text>{{item.task.name}}</text>
</view>
<view class='rg'> 目标:100000 </view>
<view class='rg'> 目标:{{item.task.target}} </view>
</view>
</view>
</view>
......@@ -54,20 +55,20 @@
wx:for-item="item">
<view class='status-bar'>
<view class='status'>
已完成:<text>133</text>
已完成:<text>10</text>
</view>
<view class='percent'>133%</view>
<view class='percent'>{{utils.toPercent( 10, 100) }}</view>
</view>
<view class='task-time'>
<image src='/assets/imgs/shoppingGuide/kpi_task_time.png' mode='widthFix'></image>
<text>9月1日~10月1日</text>
<text>{{item.task.startTime}}~{{item.task.endTime}}</text>
</view>
<view class='task-info'>
<view class='lf'>
<image src='/assets/imgs/shoppingGuide/kpi_task_name.png' mode='widthFix'></image>
<text>普通会员招募</text>
<text>{{item.task.name}}</text>
</view>
<view class='rg'> 目标:100 </view>
<view class='rg'> 目标:{{item.task.target}} </view>
</view>
</view>
</view>
......
......@@ -4,6 +4,10 @@ function date(time,format){
return date.getFullYear() + '-' + date.getMonth() + 1 + '-'+ date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' +date.getSeconds();
}
function toPercent(num, total) {
return (Math.round(num / total * 10000) / 100.00 + "%");// 小数点后两位百分比
}
function numberFormat(val,d){
if(val){
return val.toFixed(d || 2);
......@@ -46,6 +50,7 @@ function hanlerLinkNeedAuth(link){
module.exports = {
toPercent:toPercent,
formateUrl:formateUrl,
numberFormat: numberFormat,
date: date,
......
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