Browse Source

优化客户列表

feature/v2.2
xpz2018 4 years ago
parent
commit
3545b6dc3f
12 changed files with 250 additions and 496 deletions
  1. 2
      app.json
  2. 166
      pages/home/customer-list/index.js
  3. 92
      pages/home/customer-list/index.wxml
  4. 31
      pages/home/customer-list/index.wxss
  5. 139
      pages/process/check-list/index.js
  6. 14
      pages/process/check-list/index.json
  7. 79
      pages/process/check-list/index.wxml
  8. 6
      pages/process/check-list/index.wxss
  9. 123
      pages/process/payment-list/index.js
  10. 12
      pages/process/payment-list/index.json
  11. 76
      pages/process/payment-list/index.wxml
  12. 6
      pages/process/payment-list/index.wxss

2
app.json

@ -13,12 +13,10 @@
"pages/ztbvip/member/index",
"pages/ztbvip/payment/index",
"pages/process/agent-list/index",
"pages/process/check-list/index",
"pages/process/order-list/index",
"pages/process/order-price/index",
"pages/process/order-check/index",
"pages/process/order-info/index",
"pages/process/payment-list/index",
"pages/process/payment/index",
"pages/process/outside-list/index",
"pages/process/outside-add/index",

166
pages/home/customer-list/index.js

@ -3,6 +3,7 @@ import Scene from '../../index/scene'
import { getCustomerList } from "../../../api/saas"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const pinyin = require('../../../utils/pinyin.js')
const app = getApp()
Scene({
@ -15,14 +16,22 @@ Scene({
loading: true,
requesting: false,
finished: false,
searchList: [],
orderList: [],
form: {
name: '',
pageNum: 1,
pageSize: 15
pageSize: 1500
},
total: 0,
page: 0,
index: 0,
titleHeight: 240,
indexHeight: 0,
itemHeight: 0,
scrollViewId: '', // scroll-view滚动到的子元素的id 锚点
touchmove: false, // 是否在索引表上滑动
touchmoveIndex: -1
},
/**
* 生命周期函数--监听页面加载
@ -31,7 +40,15 @@ Scene({
if(options.type){
this.data.type = Number(options.type)
}
this.setData({ height: app.globalData.fragmentHeight - 100 })
var height = app.globalData.fragmentHeight - 100
if(height > 1024){
this.data.indexHeight = 1024
} else {
this.data.indexHeight = height
}
var titleHeight = this.px2rpx(app.globalData.CustomBar) + 116
var itemHeight = parseInt(this.data.indexHeight / 25)
this.setData({ height, itemHeight, indexHeight: this.data.indexHeight, titleHeight })
event.on('EventMessage', this, this.onEvent)
this.fetchCustomerList()
},
@ -39,14 +56,15 @@ Scene({
if (message.what == 101) {
this.onRefreshList()
} else if (message.what == 102) {
this.setData({ [`orderList[${this.data.page}][${this.data.index}]`]: message.detail })
// this.setData({ [`orderList[${this.data.page}][${this.data.index}]`]: message.detail })
this.onRefreshList()
}
},
onRefreshList: function () {
if (this.data.requesting) {
return
}
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
this.setData({ orderList: [], searchList: [], ['form.pageNum']: 1, ['form.name']: '', loading: true, finished: false })
this.fetchCustomerList()
},
fetchCustomerList: function () {
@ -60,32 +78,114 @@ Scene({
}
getCustomerList(this.data.form).then(result => {
if (result.data && result.data.records && result.data.records.length) {
var respList = result.data.records
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
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
// var respList = result.data.records
// 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
// this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
this.data.total = result.data.total
this.initList(result.data.records)
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
console.log(err)
this.setData({ requesting: false, loading: false })
util.showToast(err)
}).then(() => {
this.refresh = this.refresh || this.selectComponent('#refresh')
this.refresh.setRefresh(false)
// this.refresh = this.refresh || this.selectComponent('#refresh')
// this.refresh.setRefresh(false)
})
},
initList: function(records){
let orderList = this.data.orderList
let i = 0
/**
* 1调用外部js的方法ChineseToPinYin对数据进行分组
* 2分组的结果存在排序有误的情况,例如I组,V组等没有汉字的分组
*/
records.forEach(item => {
let bool = orderList.some(element => {
return element.sign == pinyin.ChineseToPinYin(item.name).substr(0, 1)
})
if (orderList.length == 0 || !bool) {
orderList.push({ id: i, sign: pinyin.ChineseToPinYin(item.name).substr(0, 1), data: [item] })
i++
} else if (bool) {
let a = pinyin.ChineseToPinYin(item.name).substr(0, 1)
for (let s in orderList) {
if (a == orderList[s].sign) {
orderList[s].data.push(item)
}
}
}
})
/**
* 3对分组好的数据进行排序
* 4根据标志sign的ASCII码进行初次排序筛选
* 5如果标志sign不在A到Z之间,则添加到#分组中
*/
orderList.forEach((item, index) => {
if ((item.sign.charCodeAt() < 65 || item.sign.charCodeAt() > 90) && item.sign.charCodeAt() != 35) {
orderList.splice(index, 1, "")
// 注:此处为防止splice分割后,数组索引index发生变化,故将需要剔除的元素替换为“”,后再将其剔除
let i = this.data.orderList.findIndex(item => {
return item.sign == '#'
})
if (i != -1) {
item.data.forEach(element => { orderList[i].data.push(element) })
} else {
orderList.push({ id: 99, sign: '#', data: item.data })
}
}
})
// 利用filter方法,剔除之前存在的空元素
orderList = orderList.filter(function (item) {
return item != ''; // 注:IE9(不包含IE9)以下的版本没有trim()方法
})
// 利用sort方法进行排序
orderList.sort(this.listSort('sign'))
// 一般情况下#分组在最下面,在此做以处理
if (orderList[0].sign == '#') {
orderList.splice(0, 1).forEach(item => {
orderList.push(item)
})
}
this.setData({ orderList, requesting: false, loading: false, total: this.data.total })
},
// 排序
listSort(sign) {
return function (a, b) {
var value1 = a[sign].charCodeAt();
var value2 = b[sign].charCodeAt();
return value1 - value2
}
},
onChange: function({detail}) {
this.data.form.name = detail
this.setData({ ['form.name']: detail })
let result = []
this.data.orderList.forEach(item => {
item.data.forEach(element => {
if (element.name.indexOf(detail.toLocaleUpperCase()) !== -1 || element.mobile.indexOf(detail.toLocaleUpperCase()) !== -1) {
result.push(element)
}
})
})
this.setData({ searchList: result })
},
onSearch: function(){
this.onRefreshList()
},
customerInfo: function(e){
this.data.page = e.currentTarget.dataset.page
this.data.index = e.currentTarget.dataset.index
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
var item = null
if(util.isEmpty(this.data.form.name)){
this.data.page = e.currentTarget.dataset.page
this.data.index = e.currentTarget.dataset.index
item = this.data.orderList[e.currentTarget.dataset.page].data[e.currentTarget.dataset.index]
} else {
this.data.index = e.currentTarget.dataset.index
item = this.data.searchList[e.currentTarget.dataset.index]
}
if(this.data.type){
const channel = this.getOpenerEventChannel()
channel.emit('onCallback', { what: 130, detail: item })
@ -99,12 +199,46 @@ Scene({
}
},
bindCustomer: function(e){
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
var item = null
if(util.isEmpty(this.data.form.name)){
this.data.page = e.currentTarget.dataset.page
this.data.index = e.currentTarget.dataset.index
item = this.data.orderList[e.currentTarget.dataset.page].data[e.currentTarget.dataset.index]
} else {
this.data.index = e.currentTarget.dataset.index
item = this.data.searchList[e.currentTarget.dataset.index]
}
wx.navigateTo({ url: `/pages/home/registe/index?id=${item.id}` })
},
addCustomer: function(){
wx.navigateTo({ url: `/pages/home/customer-info/index?` })
},
rpx2px: function(rpx) {
return rpx / 750 * app.globalData.windowWidth;
},
px2rpx: function(px) {
return px * 750 / app.globalData.windowWidth;
},
touchStart: function(e) {
this.setData({ touchmove: true })
let pageY = this.px2rpx(e.touches[0].pageY)
let index = Math.floor((pageY - this.data.titleHeight) / this.data.itemHeight)
let item = this.data.orderList[index]
if (item) {
this.setData({ scrollViewId: item.sign == '#' ? 'E_' : item.sign, touchmoveIndex: index })
}
},
touchMove: function(e) {
let pageY = this.px2rpx(e.touches[0].pageY)
let index = Math.floor((pageY - this.data.titleHeight) / this.data.itemHeight)
let item = this.data.orderList[index]
if (item) {
this.setData({ scrollViewId: item.sign == '#' ? 'E_' : item.sign, touchmoveIndex: index })
}
},
touchEnd: function() {
this.setData({ touchmove: false, touchmoveIndex: -1 })
},
onUnload: function(){
event.remove('EventMessage', this)
}

92
pages/home/customer-list/index.wxml

@ -3,10 +3,10 @@
<view slot="content">客户列表</view>
</cu-custom>
<van-search value="{{ form.name }}" shape="round" placeholder="请输入搜索关键词" use-action-slot bind:change="onChange">
<!-- <van-search value="{{ form.name }}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<view slot="action" bind:tap="onSearch" style="padding: 0rpx 8rpx">搜索</view>
</van-search>
<refresh-view id="refresh" height="{{height}}" bind:refresh="onRefreshList" bind:loadmore="fetchCustomerList">
</van-search> -->
<!-- <refresh-view id="refresh" height="{{height}}" bind:refresh="onRefreshList" bind:loadmore="fetchCustomerList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
@ -30,30 +30,76 @@
</view>
</van-cell>
</view>
<!--加载更多的UI-->
<van-divider content-position="center" wx:if="{{ form.pageNum > 1}}" custom-style="padding:0rpx 120rpx">
<van-loading type="spinner" size="16" wx:if="{{!finished}}" />
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider>
</refresh-view>
</refresh-view> -->
<van-search value="{{ form.name }}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<!-- <view slot="action" bind:tap="addCustomer" style="padding: 0rpx 8rpx">添加客户</view> -->
<van-button slot="action" plain type="info" size="small" bind:click="addCustomer">添加客户</van-button>
</van-search>
<scroll-view class="scrollList" scroll-y scroll-into-view="{{scrollViewId}}" style="height:{{height}}rpx">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<!-- 查询城市 -->
<view wx:if="{{form.name}}">
<van-cell clickable wx:for="{{searchList}}" wx:key="index">
<view slot="title" class="flex flex-justify" data-index="{{index}}" bindtap="customerInfo">
<!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> -->
<view style="width:100%;flex:1">
<view class="text-sg text-bold">{{item.name || ''}}</view>
<view class="text-sm text-gray" style="line-height:32rpx;height:32rpx">
<text wx:if="{{item.mobile}}">{{'电话号码:' + item.mobile}}</text>
<text wx:elif="{{item.cardNo}}">{{'卡号:' + item.cardNo}}</text>
</view>
</view>
<view class="text-blue" style="padding:6rpx 0rpx" data-index="{{index}}" catchtap="bindCustomer" wx:if="{{!item.userId}}">注册纸通宝</view>
</view>
</van-cell>
</view>
<view wx:else>
<!-- 列表 -->
<block wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex" wx:if="{{pageItem.data[0]}}">
<view style="background-color:#f3f3f3;" id="{{pageItem.sign == '#' ? 'E_' : pageItem.sign}}">
<text class="text-sg" style="line-height:50rpx;padding-left:32rpx">{{pageItem.sign}}</text>
</view>
<van-cell clickable wx:for="{{pageItem.data}}" wx:key="index">
<view slot="title" class="flex flex-justify" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="customerInfo">
<!-- <van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" /> -->
<view style="width:100%;flex:1">
<view class="text-sg text-bold">{{item.name || ''}}</view>
<view class="text-sm text-gray" style="line-height:32rpx;height:32rpx">
<text wx:if="{{item.mobile}}">{{'电话号码:' + item.mobile}}</text>
<text wx:elif="{{item.cardNo}}">{{'卡号:' + item.cardNo}}</text>
</view>
</view>
<view class="text-blue" style="padding:6rpx 24rpx;" data-page="{{pageIndex}}" data-index="{{index}}"
catchtap="bindCustomer" wx:if="{{!item.userId}}">注册纸通宝</view>
</view>
</van-cell>
</block>
<van-divider content-position="center" custom-style="padding:0rpx 120rpx">
<text class="text-df">共计{{total}}个客户</text>
</van-divider>
</view>
</scroll-view>
<!-- <van-overlay show="{{ true }}" duration="{{0}}" bind:click="onClickHideEmbedded">
<view class="wrapper flex-column" catch:tap="noop">
<view style="position: relative;background-color:white;margin-top:48px">
<van-image use-loading-slot width="525rpx" height="525rpx" src="data:image/png;base64,{{base64}}">
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
<text class="text-df text-white" style="margin-top:36rpx;text-align:center">
<text>邀请</text>
<text class="text-blue">{{customerName}}</text>
<text>注册纸通宝</text>
</text>
<text class="text-df text-white" style="text-align:center">请让客户使用微信进行扫码注册</text>
<van-icon name="close" color="white" size="36px" custom-style="margin-top:48px" catch:tap="onClickHideEmbedded" />
</view>
</van-overlay> -->
<view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<!-- <view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<van-button round type="info" icon="plus" bind:click="addCustomer" custom-style="width: 100rpx;height: 100rpx;"></van-button>
</view> -->
<notification id="qn-notification"/>
<!-- 右侧定位 -->
<view wx:if="{{!form.name}}" class="list-bar" style="height:{{indexHeight}}rpx;top:{{titleHeight}}rpx"
catchtouchstart="touchStart" catchtouchmove="touchMove" catchtouchend="touchEnd" catchtouchcancel="touchEnd">
<text wx:for="{{orderList}}" wx:key="index" class="list-text" style="height:{{itemHeight}}rpx;color:{{index == touchmoveIndex ? '#008AFF' : '#333333'}}">{{item.sign}}</text>
</view>
<notification id="qn-notification"/>
<view class="list-alert" wx:if="{{touchmove && orderList[touchmoveIndex].sign}}">
{{orderList[touchmoveIndex].sign}}
</view>

31
pages/home/customer-list/index.wxss

@ -5,4 +5,35 @@
justify-content: center;
height: 100%;
padding: 0px 15%;
}
/* 右侧定位 */
.list-bar{
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
z-index: 19;
position: absolute;
right: 0;
width: 60rpx;
}
.list-text{
font-size: 22rpx;
}
.list-alert{
position: absolute;
z-index: 20;
width: 160rpx;
height: 160rpx;
left: 50%;
top: 50%;
margin-left: -80rpx;
margin-top: -80rpx;
border-radius: 80rpx;
text-align: center;
line-height: 160rpx;
font-size: 70rpx;
color: #fff;
background-color: rgba(0, 0, 0, 0.5);
}

139
pages/process/check-list/index.js

@ -1,139 +0,0 @@
// pages/process/order-list/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { getFactoryOrderList, cancelOrder } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Scene({
// * 页面的初始数据
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
status: '',
pageNum: 1,
pageSize: 15
},
title: '全部',
lastTime: null
},
// * 生命周期函数--1-定价 2-待过皮重 3-待过榜审核 4-待付款 41-代付中 42-待结算 5-已完成 6-已关闭
onLoad: function (options) {
if(options.status){
this.data.form.status = Number(options.status)
if(this.data.form.status == 1){
this.data.title = '待定价订单'
} else if(this.data.form.status == 2){
this.data.title = '待过皮重'
} else if(this.data.form.status == 3){
this.data.title = '待付款订单'
} else if(this.data.form.status == 4){
this.data.title = '已完成订单'
} else if(this.data.form.status == 5){
this.data.title = '已关闭订单'
}
}
event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight, title: this.data.title })
this.fetchOrderList()
},
onEvent: function(message){
if (message.what == 12) {
this.onRefreshList()
}
},
onRefreshList: function () {
if (this.data.requesting) {
return
}
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
this.data.lastTime = null
this.fetchOrderList()
},
//1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
this.data.requesting = true
getFactoryOrderList(this.data.form).then(result => {
this.handResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
}).then(() => {
this.refresh = this.refresh || this.selectComponent('#refresh')
this.refresh.setRefresh(false)
})
},
handResult: function(result){
if (result.data && result.data.records && 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
}
}
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
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
cancelOrder(e.currentTarget.dataset.id).then(result => {
wx.hideLoading()
util.showToast('订单已经取消')
this.onRefreshList()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
})
},
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.status == 2 || item.status == 3 || item.status == 4 || item.status == 5){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + item.id })
} else if(item.status == 1){
wx.navigateTo({ url: `/pages/process/order-price/index?id=${item.id}` })
}
},
priceOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-price/index?id=' + e.currentTarget.dataset.id })
},
repriceOrder: function(e){
wx.navigateTo({ url: `/pages/process/order-check/index?id=${e.currentTarget.dataset.id}` })
},
checkOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + e.currentTarget.dataset.id })
},
onUnload: function(){
event.remove('OrderMessage', this)
}
})

14
pages/process/check-list/index.json

@ -1,14 +0,0 @@
{
"usingComponents": {
"refresh-view": "/components/refresh-view/index",
"van-button": "/components/button/index",
"van-icon": "/components/icon/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"van-dialog": "/components/dialog/index",
"notification": "/pages/message/notification/index"
}
}

79
pages/process/check-list/index.wxml

@ -1,79 +0,0 @@
<!--pages/process/order-list/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">{{title}}</view>
</cu-custom>
<refresh-view id="refresh" bind:refresh="onRefreshList" height="{{height}}" bind:loadmore="fetchOrderList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<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 style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:64rpx;padding-left:32rpx">{{item.tipsTime}}</text>
</view>
<view style="background-color:#f3f3f3;height:16rpx" wx:else></view>
<view class="item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view class="flex flex-justify" style="border-bottom: 1rpx solid #f3f3f3;padding-bottom:16rpx">
<view class="flex flex-center">
<van-icon name="/assets/image/icon-logoc.png" size="56rpx"/>
<view class="flex flex-center text-sg text-black van-ellipsis text-bold" style="justify-content: flex-start;max-width: 500rpx;">
<text style="margin-left:24rpx;text-align: center;line-height: 18px;">{{item.factoryCustomerName}}</text>
<text style="text-align: center;line-height: 18px;" wx:if="{{item.factoryCustomerMobile}}">-{{item.factoryCustomerMobile}}</text>
</view>
</view>
<view class="text-df" wx:if="{{item.status == 1}}">待定价</view>
<view class="text-df" wx:elif="{{item.status == 2}}">待过皮重</view>
<view class="text-df" style="color:#FF5368" wx:elif="{{item.status == 3}}">待审核</view>
<view class="text-df" style="color:#FA541C" wx:elif="{{item.status == 4}}">待付款</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 41}}">代付中</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 42}}">待结算</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 5}}">已完成</view>
<view class="text-df text-gray" wx:elif="{{item.status == 6}}">已关闭</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx" wx:if="{{item.productName}}">
<view class="text-sm text-black" style="margin-left:80rpx">品类:</view>
<view class="text-sm text-black">{{item.productName}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">毛重(公斤):</view>
<view class="text-sm text-black">{{item.totalWeight || '- -'}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">结算重量(公斤):</view>
<view class="text-sm text-black">{{item.settleWeight || '- -'}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">单价(元/公斤):</view>
<view class="text-sm text-black">{{item.unitPrice || '- -'}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">结算金额(元):</view>
<view class="text-sm text-black">{{item.settlePrice || '- -'}}</view>
</view>
<view class="flex" style="justify-content: flex-end;margin-top:16rpx">
<van-button round plain type="default" custom-style="height:64rpx;width:200rpx" data-id="{{item.id}}"
bind:click="cancelOrder">取消订单</van-button>
<van-button round type="info" custom-style="margin-left:24rpx;height:64rpx;width:200rpx" data-id="{{item.id}}"
bind:click="priceOrder" wx:if="{{item.status == 1}}">定价</van-button>
<van-button round plain type="default" custom-style="height:64rpx;width:200rpx" data-id="{{item.id}}"
bind:click="repriceOrder" wx:if="{{item.status == 3}}">重新定价</van-button>
<van-button round type="info" custom-style="margin-left:24rpx;height:64rpx;width:200rpx" data-id="{{item.id}}"
bind:click="checkOrder" wx:if="{{item.status == 3}}">审核</van-button>
</view>
</view>
</view>
</view>
<!--加载更多的UI-->
<van-divider content-position="center" wx:if="{{ form.pageNum > 1}}" custom-style="padding:0rpx 120rpx">
<van-loading type="spinner" size="16" wx:if="{{!finished}}" />
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider>
</refresh-view>
<van-dialog id="van-dialog" />
<notification id="qn-notification"/>

6
pages/process/check-list/index.wxss

@ -1,6 +0,0 @@
/* pages/process/order-list/index.wxss */
.item-content{
padding: 20rpx 32rpx 20rpx 0rpx;
margin-left:32rpx;
align-items: flex-start;
}

123
pages/process/payment-list/index.js

@ -1,123 +0,0 @@
// pages/process/order-list/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { getFactoryOrderList, cancelOrder } from "../../../api/saas"
const util = require('../../../utils/util')
const app = getApp()
Scene({
// * 页面的初始数据
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
status: 4,
funcType: 0,
isSameCustomer: 0,
pageNum: 1,
pageSize: 15
},
lastTime: null
},
// * 生命周期函数--监听页面加载
onLoad: function (options) {
this.setData({ height: app.globalData.fragmentHeight, admin: app.userInfo.type && app.userInfo.type.indexOf('ADMIN') >= 0 })
this.fetchOrderList()
},
checkSame: function(){
this.onRefreshList(this.data.form.isSameCustomer ? 0 : 1)
},
onRefreshList: function (isame) {
if (this.data.requesting) {
return
}
this.setData({ orderList: [], ['form.pageNum']: 1, ['form.isSameCustomer']: isame == 1 ? 1 : 0, loading: true, finished: false })
this.data.lastTime = null
this.fetchOrderList()
},
//1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
this.data.requesting = true
getFactoryOrderList(this.data.form).then(result => {
if (result.data && result.data.records && 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(this.data.form.pageNum == 1 && i == 0){
respList[i].vcheck = true
}
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
}
}
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
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
}).then(() => {
this.refresh = this.refresh || this.selectComponent('#refresh')
this.refresh.setRefresh(false)
})
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
cancelOrder(e.currentTarget.dataset.id).then(result => {
wx.hideLoading()
util.showToast('订单已经取消')
this.onRefreshList()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
})
},
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(!this.data.admin) {
wx.navigateTo({ url: `/pages/process/order-info/index?id=${item.id}` })
return
}
const that = this
wx.navigateTo({
url: `/pages/process/payment/index?channel=1`,
events: {
onOrderChange: (data) => {
if (data.what == 12) {
that.onRefreshList(that.data.form.isSameCustomer)
}
}
},
success: function(res) {
res.eventChannel.emit('onParam', item)
}
})
}
})

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

@ -1,12 +0,0 @@
{
"usingComponents": {
"refresh-view": "/components/refresh-view/index",
"van-cell": "/components/cell/index",
"van-button": "/components/button/index",
"van-icon": "/components/icon/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"van-dialog": "/components/dialog/index",
"notification": "/pages/message/notification/index"
}
}

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

@ -1,76 +0,0 @@
<!--pages/process/order-list/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">待付款订单</view>
</cu-custom>
<refresh-view id="refresh" bind:refresh="onRefreshList" height="{{height}}" bind:loadmore="fetchOrderList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<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 style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:64rpx;padding-left:32rpx">{{item.tipsTime}}</text>
</view>
<view style="background-color:#f3f3f3;height:16rpx" wx:else></view>
<view class="item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view class="flex flex-justify" style="border-bottom: 1rpx solid #f3f3f3;padding-bottom:16rpx">
<view class="flex flex-center">
<van-icon name="/assets/image/icon-logoc.png" size="56rpx"/>
<view class="flex flex-center text-sg text-black van-ellipsis text-bold" style="justify-content: flex-start;max-width: 500rpx;">
<text style="margin-left:24rpx;text-align: center;line-height: 18px;">{{item.factoryCustomerName}}</text>
<text style="text-align: center;line-height: 18px;" wx:if="{{item.factoryCustomerMobile}}">-{{item.factoryCustomerMobile}}</text>
</view>
</view>
<view class="text-df" wx:if="{{item.status == 1}}">待定价</view>
<view class="text-df" wx:elif="{{item.status == 2}}">待过皮重</view>
<view class="text-df" wx:elif="{{item.status == 3}}">待审核</view>
<view class="text-df" style="color:#FA541C" wx:elif="{{item.status == 4}}">待付款</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 41}}">代付中</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 42}}">待结算</view>
<view class="text-df" style="color:#028A00" wx:elif="{{item.status == 5}}">已完成</view>
<view class="text-df text-gray" wx:elif="{{item.status == 6}}">已关闭</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx" wx:if="{{item.productName}}">
<view class="text-sm text-black" style="margin-left:80rpx">品类:</view>
<view class="text-sm text-black">{{item.productName}}</view>
</view>
<!-- <view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">毛重(公斤):</view>
<view class="text-sm text-black">{{item.totalWeight || '- -'}}</view>
</view> -->
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">结算重量(公斤):</view>
<view class="text-sm text-black">{{item.settleWeight || '- -'}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">单价(元/公斤):</view>
<view class="text-sm text-black">{{item.unitPrice || '- -'}}</view>
</view>
<view class="flex flex-justify" style="margin-top:12rpx">
<view class="text-sm text-black" style="margin-left:80rpx">结算金额(元):</view>
<view class="text-sm text-black">{{item.settlePrice || '- -'}}</view>
</view>
<view class="flex" style="justify-content: flex-end;margin-top:16rpx">
<van-button round plain type="default" custom-style="height:64rpx;width:200rpx" data-id="{{item.id}}"
bind:click="cancelOrder" wx:if="{{item.status != 6}}">取消订单</van-button>
<van-button round type="info" custom-style="margin-left:24rpx;height:64rpx;width:200rpx" data-page="{{pageIndex}}" data-index="{{index}}"
bind:click="lookItem" wx:if="{{(item.status == 4 || item.status == 42) && admin}}">去支付</van-button>
</view>
</view>
</view>
</view>
<!--加载更多的UI-->
<van-divider content-position="center" wx:if="{{ form.pageNum > 1}}" custom-style="padding:0rpx 120rpx">
<van-loading type="spinner" size="16" wx:if="{{!finished}}" />
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider>
</refresh-view>
<van-dialog id="van-dialog" />
<notification id="qn-notification"/>

6
pages/process/payment-list/index.wxss

@ -1,6 +0,0 @@
/* pages/process/order-list/index.wxss */
.item-content{
padding: 20rpx 32rpx 20rpx 0rpx;
margin-left:32rpx;
align-items: flex-start;
}
Loading…
Cancel
Save