Browse Source

no message

feature/v1.2
xpz2018 5 years ago
parent
commit
31b42524a0
6 changed files with 38 additions and 75 deletions
  1. 93
      pages/process/agent-list/index.js
  2. 2
      pages/process/agent-list/index.json
  3. 2
      pages/process/agent-list/index.wxml
  4. 4
      pages/process/payment-list/index.json
  5. 10
      pages/process/payment-list/index.wxml
  6. 2
      project.config.json

93
pages/process/agent-list/index.js

@ -1,11 +1,9 @@
// pages/process/order-list/index.js // pages/process/order-list/index.js
import { getAgentOrderList } from "../../../api/payment" import { getAgentOrderList } from "../../../api/payment"
const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
Page({ Page({
// * 页面的初始数据
data: { data: {
height: app.globalData.fragmentHeight - 90, height: app.globalData.fragmentHeight - 90,
tabIndex: 0, tabIndex: 0,
@ -24,20 +22,13 @@ Page({
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
}, },
title: '全部',
lastTime: null lastTime: null
}, },
// * 生命周期函数--监听页面加载 // * 生命周期函数--监听页面加载
onLoad: function (options) { onLoad: function (options) {
event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight - 90, title: this.data.title })
this.setData({ height: app.globalData.fragmentHeight - 90 })
this.fetchOrderList() this.fetchOrderList()
}, },
onEvent: function(message){
if (message.what == 12) {
this.onRefreshList()
}
},
onTabChange: function ({detail}) { onTabChange: function ({detail}) {
if (this.data.tabIndex == Number(detail.index)) { if (this.data.tabIndex == Number(detail.index)) {
return return
@ -64,66 +55,48 @@ Page({
} else { } else {
this.setData({ requesting: true }) this.setData({ requesting: true })
} }
console.log('getAgentOrderList======67')
getAgentOrderList(this.data.form).then(result => { getAgentOrderList(this.data.form).then(result => {
this.handResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
},
handResult: function(result){
if (result.data && result.data.records.length) {
var respList = result.data.records
// 对返回的消息列表进行处理,将同一天的消息显示在一起
for (let i = 0; i < respList.length; i++) {
if (util.isEmpty(this.data.lastTime)) {
this.data.lastTime = respList[i].createTime
if (this.data.lastTime.length > 10) {
this.data.lastTime = this.data.lastTime.substring(0, 10)
if (result.data && result.data.records.length) {
var respList = result.data.records
// 对返回的消息列表进行处理,将同一天的消息显示在一起
for (let i = 0; i < respList.length; i++) {
if (util.isEmpty(this.data.lastTime)) {
this.data.lastTime = respList[i].createTime
if (this.data.lastTime.length > 10) {
this.data.lastTime = this.data.lastTime.substring(0, 10)
}
respList[i].tipsTime = this.data.lastTime
} else {
var itemTime = respList[i].createTime
if (itemTime.length > 10) {
itemTime = itemTime.substring(0, 10)
}
if (this.data.lastTime !== itemTime) {
respList[i].tipsTime = itemTime
}
this.data.lastTime = itemTime
} }
respList[i].tipsTime = this.data.lastTime
}
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total
if(this.data.form.pageNum == 1){
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), top: 0, finished, requesting: false, loading: false })
} else { } else {
var itemTime = respList[i].createTime
if (itemTime.length > 10) {
itemTime = itemTime.substring(0, 10)
}
if (this.data.lastTime !== itemTime) {
respList[i].tipsTime = itemTime
}
this.data.lastTime = itemTime
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
} }
}
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else { } else {
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
this.setData({ finished: true, requesting: false, loading: false })
} }
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
}, },
lookItem: function (e) { lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.navigateTo({ url: `/pages/process/order-info/index?agent=1&id=${item.orderId}` }) wx.navigateTo({ url: `/pages/process/order-info/index?agent=1&id=${item.orderId}` })
},
onUnload: function(){
event.remove('OrderMessage', this)
} }
}) })

2
pages/process/agent-list/index.json

@ -2,8 +2,6 @@
"usingComponents": { "usingComponents": {
"refresh-view": "/components/refresher/index", "refresh-view": "/components/refresher/index",
"van-button": "/components/button/index", "van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
"van-tabs": "/components/tabs/index", "van-tabs": "/components/tabs/index",
"van-tab": "/components/tab/index", "van-tab": "/components/tab/index",
"van-cell": "/components/cell/index", "van-cell": "/components/cell/index",

2
pages/process/agent-list/index.wxml

@ -18,7 +18,7 @@
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex"> <view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<view class="bg-white" wx:for="{{pageItem}}" wx:key="index"> <view class="bg-white" wx:for="{{pageItem}}" wx:key="index">
<view style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}"> <view style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:64rpx;padding-left:32rpx">{{item.tipsTime}}</text>
<text class="text-sg" style="line-height:72rpx;margin-left:32rpx;margin-top:8rpx">{{item.tipsTime}}</text>
</view> </view>
<view class="item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> <view class="item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view class="flex flex-justify"> <view class="flex flex-justify">

4
pages/process/payment-list/index.json

@ -1,10 +1,6 @@
{ {
"usingComponents": { "usingComponents": {
"refresh-view": "/components/refresher/index", "refresh-view": "/components/refresher/index",
"van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
"van-checkbox": "/components/checkbox/index",
"van-cell": "/components/cell/index", "van-cell": "/components/cell/index",
"van-divider": "/components/divider/index", "van-divider": "/components/divider/index",
"van-loading": "/components/loading/index" "van-loading": "/components/loading/index"

10
pages/process/payment-list/index.wxml

@ -14,16 +14,12 @@
</view> </view>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex"> <view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<view class="bg-white" wx:for="{{pageItem}}" wx:key="index"> <view class="bg-white" wx:for="{{pageItem}}" wx:key="index">
<view class="flex flex-justify" style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:72rpx;padding-left:32rpx">{{item.tipsTime}}</text>
<!-- <view class="flex flex-center" style="padding-right:32rpx" wx:if="{{item.vcheck}}" bindtap="checkSame">
<view class="text-gray" style="margin-right:8rpx">同一客户合并付款</view>
<van-checkbox value="{{ form.isSameCustomer }}" icon-size="32rpx"></van-checkbox>
</view> -->
<view style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:72rpx;margin-left:32rpx;margin-top:8rpx">{{item.tipsTime}}</text>
</view> </view>
<view class="flex flex-justify item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> <view class="flex flex-justify item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view style="height: 88rpx"> <view style="height: 88rpx">
<view class="flex text-sg text-black">
<view class="flex text-sg text-black" style="align-items: center">
<text>客户名称:{{item.factoryCustomerName}}</text> <text>客户名称:{{item.factoryCustomerName}}</text>
<text wx:if="{{item.status != 1 && item.factoryCustomerMobile}}">({{item.factoryCustomerMobile}})</text> <text wx:if="{{item.status != 1 && item.factoryCustomerMobile}}">({{item.factoryCustomerMobile}})</text>
</view> </view>

2
project.config.json

@ -12,7 +12,7 @@
"minified": true, "minified": true,
"newFeature": false, "newFeature": false,
"coverView": true, "coverView": true,
"nodeModules": true,
"nodeModules": false,
"autoAudits": false, "autoAudits": false,
"showShadowRootInWxmlPanel": false, "showShadowRootInWxmlPanel": false,
"scopeDataCheck": false, "scopeDataCheck": false,

Loading…
Cancel
Save