Commit 2ecfd683 authored by Facius's avatar Facius

feat: 前台-订单列表-页面

parent 246bdd71
<template> <template>
<TabBarPage title="扳手会" :fixed="true" @click="goTop"> <TabBarPage title="扳手会" :fixed="true" @click="goTop">
<view class="content-view"> <view class="content-view">
<scroll-view style="height: 100%;" scroll-y @scrolltolower="reachBottom" :scroll-top="scrollTop" @scroll="scroll" <scroll-view
scroll-anchoring scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" style="height: 100%;"
refresher-background="#F4F5F7" @refresherrefresh="onRefresh" scroll-y
@refresherrestore="onRestore" enable-back-to-top> @scrolltolower="reachBottom"
<image class="banner-image" :src="bannerImage" @click="handleClickBanner"></image> :scroll-top="scrollTop"
@scroll="scroll"
<view class="msg-view"> scroll-anchoring
<view class="msg-title">最新消息</view> scroll-y="true"
<view class="msg-list-view"> refresher-enabled="true"
<view class="msg-content" v-for="(item, index) in messageList" :key="index" @click="toNewsDetail(item)"> :refresher-triggered="triggered"
<view class="msg-content-view"> :refresher-threshold="100"
<view class="left-view"> refresher-background="#F4F5F7"
<image class="msg-icon" :src="msgStyleImage[item.is_top]"></image> @refresherrefresh="onRefresh"
<text class="msg-text">{{ item.title }}</text> @refresherrestore="onRestore"
</view> enable-back-to-top
<image class="right-icon" :src="shouyeyouImage"></image> >
</view> <image
<view class="line-view" v-if="index != 1"></view> class="banner-image"
</view> :src="bannerImage"
</view> @click="handleClickBanner"
</view> ></image>
<view class="sticky">
<text>订单推荐</text> <view class="msg-view">
</view> <view class="msg-title">最新消息</view>
<view class="order-view"> <view class="msg-list-view">
<!-- 入驻成功之后显示推荐订单列表 --> <view
<view class="order-list-view" v-if="loaded"> class="msg-content"
<!-- 入驻前--> v-for="(item, index) in messageList"
<view v-if="needSettled" class="tip-view"> :key="index"
<image :src="weiruzhuImage" class="tip-view-image"></image> @click="toNewsDetail(item)"
<view class="tip-other">入驻后平台将向您分配或推荐订单</view> >
<u-button class="settle-button" type="primary" shape="circle" @click="immediatelyIn" <view class="msg-content-view">
:custom-style="buttonStyle"> <view class="left-view">
立即入驻 <image
</u-button> class="msg-icon"
</view> :src="msgStyleImage[item.is_top]"
<template v-else> ></image>
<!-- 入驻成功之后无推荐订单 --> <text class="msg-text">{{ item.title }}</text>
<view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view"> </view>
<NoOrder /> <image class="right-icon" :src="shouyeyouImage"></image>
</view> </view>
<view v-else class="order-item-view"> <view class="line-view" v-if="index != 1"></view>
<view v-for="(item, index) in orderList" :key="index"> </view>
<OrderCell :orderData="item" type="waitAccept" :location="location" </view>
@click="handleClick" @action="handleClick"> </view>
</OrderCell> <view class="sticky">
</view> <text>订单推荐</text>
<u-loadmore v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 1" :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore> </view>
</view> <view class="order-view">
</template> <!-- 入驻成功之后显示推荐订单列表 -->
</view> <view class="order-list-view" v-if="loaded">
</view> <!-- 入驻前-->
<view class="bottom-view" v-if="needSettled || orderList.length <= 0"> <view v-if="needSettled" class="tip-view">
<view class="bottom-line-view"></view> <image :src="weiruzhuImage" class="tip-view-image"></image>
<view class="bottom-text">我也是有底线哒</view> <view class="tip-other">入驻后平台将向您分配或推荐订单</view>
<view class="bottom-line-view"></view> <u-button
</view> class="settle-button"
</scroll-view> type="primary"
</view> shape="circle"
</TabBarPage> @click="immediatelyIn"
:custom-style="buttonStyle"
>
立即入驻
</u-button>
</view>
<template v-else>
<!-- 入驻成功之后无推荐订单 -->
<view
v-if="orderList.length <= 0 && loadedOrder"
class="no-order-view"
>
<NoOrder />
</view>
<view v-else class="order-item-view">
<view v-for="(item, index) in orderList" :key="index">
<OrderCell
:orderData="item"
type="waitAccept"
:location="location"
@click="handleClick"
@action="handleClick"
>
</OrderCell>
</view>
<u-loadmore
v-show="
(search.pageNumber == 1 && loadedOrder) ||
search.pageNumber > 1
"
:status="currentLoadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view>
</template>
</view>
</view>
<view class="bottom-view" v-if="needSettled || orderList.length <= 0">
<view class="bottom-line-view"></view>
<view class="bottom-text">我也是有底线哒</view>
<view class="bottom-line-view"></view>
</view>
</scroll-view>
</view>
</TabBarPage>
</template> </template>
<script> <script>
import util from "@/utils/util.js"; import util from '@/utils/util.js'
import TabBarPage from "@/components/tabBarList/index.vue" import TabBarPage from '@/components/tabBarList/index.vue'
import NoOrder from "@/components/order/noOrder.vue" import NoOrder from '@/components/order/noOrder.vue'
const app = getApp(); const app = getApp()
import OrderCell from "@/components/order/index.vue"; import OrderCell from '@/components/order/index.vue'
export default { export default {
components: { components: {
OrderCell, OrderCell,
TabBarPage, TabBarPage,
NoOrder, NoOrder,
}, },
data() { data() {
return { return {
status: 0, // 入驻状态:0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',6=>'已签约',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' status: 0, // 入驻状态:0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',6=>'已签约',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
location: [], // 经纬度 location: [], // 经纬度
title: false, title: false,
title: "Hello", title: 'Hello',
loaded: false, loaded: false,
loadedOrder: false, loadedOrder: false,
needSettled: true, needSettled: true,
count: 0, // 推荐订单数量 count: 0, // 推荐订单数量
messageList: [], messageList: [],
currentLoadStatus: "loading", currentLoadStatus: 'loading',
orderList: [], orderList: [],
search: { search: {
token: "", token: '',
pageNumber: 0, pageNumber: 0,
pageSize: 100, pageSize: 100,
}, },
waitInit: false, // 当token为空时,等待自动登录结束 waitInit: false, // 当token为空时,等待自动登录结束
triggered: true, triggered: true,
scrollTop: 0, scrollTop: 0,
old: { old: {
scrollTop: 0 scrollTop: 0,
} },
}; }
}, },
watch: { watch: {
vuex_token(val, oldVal) { vuex_token(val, oldVal) {
// 监听token变化,如果更新则重新加载页面数据 // 监听token变化,如果更新则重新加载页面数据
val && this.waitInit && this.getData() val && this.waitInit && this.getData()
} },
}, },
computed: { computed: {
buttonStyle() { buttonStyle() {
return { return {
width: "300rpx", width: '300rpx',
height: "80rpx", height: '80rpx',
"font-size": "32rpx", 'font-size': '32rpx',
"font-weight": "bold", 'font-weight': 'bold',
}; }
}, },
msgStyleImage() { countKeys() {
return { return [
'1': process.uniEnv.qn_base_url + "zhiding.png", // 置顶 'toAppointmentCount',
'0': process.uniEnv.qn_base_url + "tongzhi.png", // 通知 'toCheckinCount',
// '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息 'toFinishCount',
} 'reviewingCount',
}, 'exceptionCount',
bannerImage() { ]
return process.uniEnv.qn_base_url + 'banner-1.png' },
}, msgStyleImage() {
shouyeyouImage() { return {
return process.uniEnv.qn_base_url + 'shouyeyou.png' '1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶
}, '0': process.uniEnv.qn_base_url + 'tongzhi.png', // 通知
weiruzhuImage() { // '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息
return process.uniEnv.qn_base_url + 'weiruzhu.png' }
}, },
}, bannerImage() {
onLoad(e) { return process.uniEnv.qn_base_url + 'banner-1.png'
app.trackPage('自营平台首页') },
this._freshing = false; shouyeyouImage() {
if(this.vuex_token) { return process.uniEnv.qn_base_url + 'shouyeyou.png'
this.getOrderCount() },
} else { weiruzhuImage() {
this.waitInit = true return process.uniEnv.qn_base_url + 'weiruzhu.png'
} },
}, },
onShow() { onLoad(e) {
// 每次进入页面都刷新入驻状态 app.trackPage('自营平台首页')
this.pageNumber = 0 this._freshing = false
if (this.vuex_token) {
this.initSettleInfo(); this.getOrderCount()
}, } else {
methods: { this.waitInit = true
getData() { }
this.getOrderCount() },
this.initSettleInfo(); onShow() {
}, // 每次进入页面都刷新入驻状态
handleClick(item, type, showCountTime) { // 跳转工单详情页面 showCountTime:是否显示倒计时 this.pageNumber = 0
// type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息 this.initSettleInfo()
uni.navigateTo({ },
url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime methods: {
}) getData() {
}, this.getOrderCount()
async initSettleInfo() { this.initSettleInfo()
let self = this; },
// 加载消息列表 handleClick(item, type, showCountTime) {
this.loadMessageList(); // 跳转工单详情页面 showCountTime:是否显示倒计时
if (this.vuex_token) { // type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
const callBack = (vm, result) => { uni.navigateTo({
// 后台自动判断入驻流程是否完成,前台通过status确定状态 url:
if (result && result.record) { 'pages/order/detail?id=' +
item.orderId +
vm.needSettled = result.needSettled; '&type=' +
vm.status = Number(result.record.status || '0'); type +
// vm.status = 8 '&showCountTime=' +
} showCountTime,
}; })
self.search.pageNumber = 0 },
self.loadedOrder = false async initSettleInfo() {
self.loadOrderList(); let self = this
await app.getBaseInfo(self, callBack); // 加载消息列表
if (this.status == 7) { this.loadMessageList()
this.getLocation() if (this.vuex_token) {
} const callBack = (vm, result) => {
this.loaded = true; // 后台自动判断入驻流程是否完成,前台通过status确定状态
} else { if (result && result.record) {
this.loaded = true vm.needSettled = result.needSettled
} vm.status = Number(result.record.status || '0')
// vm.status = 8
}, }
loadMessageList() { }
let self = this; self.search.pageNumber = 0
self.$u.api.listByNotice().then((res) => { self.loadedOrder = false
uni.stopPullDownRefresh() // 结束下拉刷新 self.loadOrderList()
if (res.code == 200) { await app.getBaseInfo(self, callBack)
if (res.data && res.data.length > 2) { if (this.status == 7) {
self.messageList = res.data.slice(0, 2); this.getLocation()
} else { }
self.messageList = res.data || []; this.loaded = true
} } else {
} else { this.loaded = true
console.log(res.message, "初始化消息列表异常"); }
} },
}); loadMessageList() {
}, let self = this
loadOrderList() { self.$u.api.listByNotice().then((res) => {
this.search.pageNumber += 1 uni.stopPullDownRefresh() // 结束下拉刷新
let self = this; if (res.code == 200) {
// 加载订单列表 if (res.data && res.data.length > 2) {
self.search.token = self.vuex_token; self.messageList = res.data.slice(0, 2)
self.$u.api.listByRecommendOrder(self.search).then((res) => { } else {
self.loadedOrder = true self.messageList = res.data || []
}
if (res.code == 200 && res.data) { } else {
if (self.search.pageNumber == 1) { console.log(res.message, '初始化消息列表异常')
self.orderList = [] }
} })
if (res.data.list) { },
// self.orderList.push(...res.data.list) loadOrderList() {
this.search.pageNumber += 1
// 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算 let self = this
var time = new Date().getTime() // 加载订单列表
for (var item of res.data.list) { self.search.token = self.vuex_token
item.currentCellTime = time self.$u.api.listByRecommendOrder(self.search).then((res) => {
self.orderList.push(item); self.loadedOrder = true
}
} if (res.code == 200 && res.data) {
if (self.search.pageNumber == 1) {
self.currentLoadStatus = res.data.total > self.orderList.length && (res.data.list || []).length == self.search.pageSize ? 'loadmore' : 'nomore' self.orderList = []
}
} else { if (res.data.list) {
console.log(res.message, "初始化订单列表异常"); // self.orderList.push(...res.data.list)
}
self.$nextTick(()=>{ // 更新每一条时间戳,防止后台返回的数据和原先一样,不触发ordercell的时间计算
if (self._freshing) { var time = new Date().getTime()
self.triggered = false; for (var item of res.data.list) {
self._freshing = false; item.currentCellTime = time
} self.orderList.push(item)
}) }
}); }
},
reachBottom() { self.currentLoadStatus =
if (this.vuex_token) { res.data.total > self.orderList.length &&
if (this.currentLoadStatus != 'loadmore') return (res.data.list || []).length == self.search.pageSize
this.currentLoadStatus == 'loading' ? 'loadmore'
this.loadOrderList() : 'nomore'
} } else {
}, console.log(res.message, '初始化订单列表异常')
onRefresh() { }
if (this._freshing) return self.$nextTick(() => {
this._freshing = true if (self._freshing) {
this.initSettleInfo() self.triggered = false
}, self._freshing = false
onRestore() { }
this.triggered = 'restore'; // 需要重置 })
}, })
scroll(e) { },
this.old.scrollTop = e.detail.scrollTop reachBottom() {
}, if (this.vuex_token) {
goTop(e) { if (this.currentLoadStatus != 'loadmore') return
this.scrollTop = this.old.scrollTop this.currentLoadStatus == 'loading'
this.$nextTick(function() { this.loadOrderList()
this.scrollTop = 0 }
}); },
}, onRefresh() {
/* 立即入驻 */ if (this._freshing) return
immediatelyIn() { this._freshing = true
if (this.vuex_token) { this.initSettleInfo()
// 用户已登录 },
var pageIndex = 1; onRestore() {
// 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' this.triggered = 'restore' // 需要重置
switch (this.status) { },
case 1: scroll(e) {
case 2: this.old.scrollTop = e.detail.scrollTop
case 3: },
case 4: goTop(e) {
pageIndex = 2; this.scrollTop = this.old.scrollTop
break; this.$nextTick(function() {
case 8: this.scrollTop = 0
pageIndex = 3; })
break; },
case 5: /* 立即入驻 */
case 6: immediatelyIn() {
pageIndex = 4; if (this.vuex_token) {
break; // 用户已登录
case 7: var pageIndex = 1
pageIndex = 5; // 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
break; switch (this.status) {
default: case 1:
pageIndex = 1; case 2:
break; case 3:
} case 4:
pageIndex = 2
uni.navigateTo({ break
url: this.status > 0 ? case 8:
"/pages/settle/prompt?pageIndex=" + pageIndex : "/pages/settle/index", pageIndex = 3
}); break
} else { case 5:
// 用户未登录 case 6:
uni.navigateTo({ pageIndex = 4
url: "pages/login/index", break
}); case 7:
} pageIndex = 5
}, break
// 获取订单数量 default:
getOrderCount() { pageIndex = 1
var self = this; // 加载订单列表 break
self.$u.api.listOrderCount().then((res) => { }
if (res.code == 200) {
if (res.data) { uni.navigateTo({
var count = 0 url:
for (var i in res.data) { this.status > 0
count += res.data[i] ? '/pages/settle/prompt?pageIndex=' + pageIndex
} : '/pages/settle/index',
// 修改tab总数 })
if (count > 0) { } else {
uni.setTabBarBadge({ // 用户未登录
index: 1, uni.navigateTo({
text: String(count) url: 'pages/login/index',
}) })
} else { }
uni.removeTabBarBadge({ },
index: 1 // 获取订单数量
}) getOrderCount() {
} var self = this // 加载订单列表
self.$u.api.listOrderCount().then((res) => {
} if (res.code == 200) {
if (res.data) {
} else { var count = 0
console.log(res.message, "获取订单数量失败!"); for (var item of this.countKeys) {
} count += res.data[item] || 0
}); }
}, // 修改tab总数
/** if (count > 0) {
* 获取当前位置的经纬度 uni.setTabBarBadge({
*/ index: 1,
getLocation() { text: String(count),
let self = this })
uni.getLocation({ } else {
type: 'gcj02', uni.removeTabBarBadge({
success: function(res) { index: 1,
self.location = [res.latitude, res.longitude] })
}, }
complete: function(res) { }
if (res.errMsg.indexOf('auth') != -1) { } else {
uni.showModal({ console.log(res.message, '获取订单数量失败!')
title: '提示', }
content: '获取权限失败,请到设置页面开启权限', })
confirmText: '好的', },
success(res) { /**
if (res.confirm) { * 获取当前位置的经纬度
uni.openSetting({ */
success(res) { getLocation() {
console.log(res.authSetting) let self = this
} uni.getLocation({
}); type: 'gcj02',
} success: function(res) {
self.location = [res.latitude, res.longitude]
} },
}) complete: function(res) {
} if (res.errMsg.indexOf('auth') != -1) {
}, uni.showModal({
fail: function(err) { title: '提示',
} content: '获取权限失败,请到设置页面开启权限',
}); confirmText: '好的',
}, success(res) {
toNewsDetail(item) { if (res.confirm) {
wx.navigateTo({ uni.openSetting({
url: '/pages/learn/news-details', success(res) {
success: function(res) { console.log(res.authSetting)
res.eventChannel.emit('acceptDataFromLearn', item) },
} })
}); }
}, },
handleClickBanner() { })
uni.navigateTo({ }
url: "/pages/mine/customer/index" + '?type=exclusive', },
}); fail: function(err) {},
}, })
}, },
}; toNewsDetail(item) {
wx.navigateTo({
url: '/pages/learn/news-details',
success: function(res) {
res.eventChannel.emit('acceptDataFromLearn', item)
},
})
},
handleClickBanner() {
uni.navigateTo({
url: '/pages/mine/customer/index' + '?type=exclusive',
})
},
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.banner-image { .banner-image {
width: 730rpx; width: 730rpx;
height: 280rpx; height: 280rpx;
margin-left: -16rpx; margin-left: -16rpx;
} }
.content-view { .content-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
} }
.msg-view { .msg-view {
.msg-title { .msg-title {
color: #333333; color: #333333;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
padding: 1rpx 0rpx 30rpx 0rpx; padding: 1rpx 0rpx 30rpx 0rpx;
} }
.msg-list-view { .msg-list-view {
border-radius: 12rpx; border-radius: 12rpx;
background-color: #ffffff; background-color: #ffffff;
padding: 12rpx 30rpx; padding: 12rpx 30rpx;
height: 174rpx; height: 174rpx;
} }
.msg-content { .msg-content {
color: #333333; color: #333333;
font-size: 26rpx; font-size: 26rpx;
.msg-content-view { .msg-content-view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-top: 20rpx; margin-top: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.left-view { .left-view {
display: flex; display: flex;
align-items: center; align-items: center;
.msg-icon { .msg-icon {
width: 80rpx; width: 80rpx;
height: 36rpx; height: 36rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.msg-text { .msg-text {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
width: 448rpx; width: 448rpx;
} }
} }
.right-icon { .right-icon {
width: 14rpx; width: 14rpx;
height: 24rpx; height: 24rpx;
} }
} }
.line-view { .line-view {
height: 2rpx; height: 2rpx;
background-color: #f4f5f7; background-color: #f4f5f7;
} }
} }
} }
.logo {
.logo { height: 200 rpx;
height: 200 rpx; width: 100%;
width: 100%; margin: 0 rpx auto 50 rpx auto;
margin: 0 rpx auto 50 rpx auto; }
}
.text-area {
.text-area { display: flex;
display: flex; justify-content: center;
justify-content: center; }
}
.title {
.title { font-size: 36 rpx;
font-size: 36 rpx; color: #8f8f94;
color: #8f8f94; }
}
// .sticky-view {
// .sticky-view { // position: sticky;
// position: sticky; // position: -webkit-sticky;
// position: -webkit-sticky; // top: 0rpx;
// top: 0rpx; // width: 100%;
// width: 100%; // height: 200rpx;
// height: 200rpx; // background-color: black;
// background-color: black; // }
// }
.sticky {
.sticky { background-color: #f4f5f7;
background-color: #f4f5f7; color: #fff;
color: #fff; padding: 24 rpx;
padding: 24 rpx; text-align: left;
text-align: left; font-size: 32rpx;
font-size: 32rpx; font-weight: bold;
font-weight: bold; color: #333333;
color: #333333; padding: 46rpx 0 28rpx 0;
padding: 46rpx 0 28rpx 0; }
}
.order-view {
.order-view { text-align: center;
text-align: center;
.order-list-view {
.order-list-view { .tip-view {
padding: 30rpx;
.tip-view { background-color: #ffffff;
padding: 30rpx; border-radius: 12rpx;
background-color: #ffffff; min-height: 460rpx;
border-radius: 12rpx;
min-height: 460rpx; .tip-view-image {
width: 328rpx;
.tip-view-image { height: 200rpx;
width: 328rpx; margin-top: 30rpx;
height: 200rpx; }
margin-top: 30rpx;
} .tip-other {
font-size: 28rpx;
.tip-other { color: #666666;
font-size: 28rpx; margin-bottom: 30rpx;
color: #666666; }
margin-bottom: 30rpx;
} .settle-button {
}
.settle-button {} }
}
.order-item-view {
.order-item-view { background-color: #f4f5f7;
background-color: #F4F5F7; border-radius: 12rpx;
border-radius: 12rpx; margin-bottom: 20rpx;
margin-bottom: 20rpx; }
} }
} }
}
.bottom-view {
.bottom-view { display: flex;
display: flex; align-items: center;
align-items: center; justify-content: space-between;
justify-content: space-between; padding: 50rpx 40rpx 50rpx 40rpx;
padding: 50rpx 40rpx 50rpx 40rpx;
.bottom-line-view {
.bottom-line-view { background-color: #d5d5d5;
background-color: #D5D5D5; height: 2rpx;
height: 2rpx; width: 30%;
width: 30%; }
}
.bottom-text {
.bottom-text { color: #999999;
color: #999999; font-size: 24rpx;
font-size: 24rpx; }
} }
} </style>
</style>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<text class="search-btn-text">搜订单</text> <text class="search-btn-text">搜订单</text>
</view> </view>
</view> </view>
<view class="u-tabs-box" v-show="curNow == 0"> <view class="u-tabs-box">
<u-tabs <u-tabs
height="66" height="66"
activeColor="#2272FF" activeColor="#2272FF"
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
inactive-color="#999" inactive-color="#999"
bar-height="4" bar-height="4"
bar-width="44" bar-width="44"
:offset="[0, 0]" :offset="offset[curNow]"
:list="list" :list="list[curNow]"
count="total" count="total"
:current="current" :current="current"
@change="change" @change="change"
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<view v-for="(item, index) in orderList" :key="item.orderId"> <view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell <OrderCell
:orderData="item" :orderData="item"
:type="orderType" :type="cellType"
:location="dataValue" :location="dataValue"
@click="handleClick" @click="handleClick"
@action="handleClickCellButton" @action="handleClickCellButton"
...@@ -106,26 +106,46 @@ export default { ...@@ -106,26 +106,46 @@ export default {
pageSize: 1000, // 因为需要排序,所以暂时去掉分页 pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [], orderList: [],
list: [ list: [
{ [
name: '待预约', {
total: 0, name: '待预约',
}, total: 0,
{ },
name: '待签到', {
total: 0, name: '待签到',
}, total: 0,
{ },
name: '待完工', {
total: 0, name: '待完工',
}, total: 0,
{ },
name: '审核中', {
total: 0, name: '审核中',
}, total: 0,
{ },
name: '异常单', {
total: 0, name: '异常单',
}, total: 0,
},
{
name: '已完工',
total: 0,
},
],
[
{
name: '待联系',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '异常单',
total: 0,
},
],
], ],
current: 0, current: 0,
loadStatus: 'loading', loadStatus: 'loading',
...@@ -141,38 +161,54 @@ export default { ...@@ -141,38 +161,54 @@ export default {
}, },
computed: { computed: {
subList() { subList() {
return ['待处理', '已完工'] return ['全部订单', '今日订单']
}, },
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工' // 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() { orderType() {
return this.indexStatus[this.currentIndex] return this.indexStatus[this.curNow][this.current]
}, },
currentIndex() { cellType() {
return this.curNow == 0 ? this.current : 5 return this.orderType == 'waitLianxi' ? '' : this.orderType
},
offset() {
return [
[0, 0],
[0, 44],
]
}, },
sousuoImage() { sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png' return process.uniEnv.qn_base_url + 'sousuo.png'
}, },
types() { types() {
return { return [
waitAppointment: 0, // 待预约、 {
waitCheckIn: 1, // 待签到、 waitAppointment: 0, // 待预约、
waitFinish: 2, // 待完工、 waitCheckIn: 1, // 待签到、
audit: 3, // 审核中、 waitFinish: 2, // 待完工、
exception: 4, // 异常单、 audit: 3, // 审核中、
finish: 5, //已完工 exception: 4, // 异常单、
} finish: 5, //已完工
},
{
waitLianxi: 0, // 待联系、
waitFinish: 1, // 待完工、
exception: 2, // 异常单、
},
]
}, },
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish //waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() { indexStatus() {
return { return [
0: 'waitAppointment', [
1: 'waitCheckIn', 'waitAppointment',
2: 'waitFinish', 'waitCheckIn',
3: 'audit', 'waitFinish',
4: 'exception', 'audit',
5: 'finish', 'exception',
} 'finish',
],
['waitLianxi', 'waitFinish', 'exception'],
]
}, },
countKeys() { countKeys() {
return [ return [
...@@ -181,15 +217,16 @@ export default { ...@@ -181,15 +217,16 @@ export default {
'toFinishCount', 'toFinishCount',
'reviewingCount', 'reviewingCount',
'exceptionCount', 'exceptionCount',
'todayDlxCount',
'todayDwgCount',
'todayYcdCount',
] ]
}, },
noMore() { noMore() {
return this.orderList.length == 0 && this.loaded return this.orderList.length == 0 && this.loaded
}, },
noOrderCustomStyle() { noOrderCustomStyle() {
return this.curNow == 0 return 'margin-top: 100rpx;background-color: #F4F5F7'
? 'margin-top: 100rpx;background-color: #F4F5F7'
: 'margin-top: 200rpx;background-color: #F4F5F7'
}, },
}, },
onLoad(e) { onLoad(e) {
...@@ -217,10 +254,10 @@ export default { ...@@ -217,10 +254,10 @@ export default {
reachBottom(e) { reachBottom(e) {
if (this.loadStatus != 'loadmore') return if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading' this.loadStatus == 'loading'
this.getOrderList(this.currentIndex) this.getOrderList()
}, },
// 页面数据 // 页面数据
getOrderList(index) { getOrderList() {
// 状态处理 // 状态处理
this.pageNumber += 1 this.pageNumber += 1
if (this.pageNumber == 1) { if (this.pageNumber == 1) {
...@@ -230,7 +267,7 @@ export default { ...@@ -230,7 +267,7 @@ export default {
pageNumber: this.pageNumber, pageNumber: this.pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize,
keyword: '', keyword: '',
type: this.indexStatus[index], type: this.orderType,
} }
var self = this var self = this
self.$u.api.listOrder(param).then((res) => { self.$u.api.listOrder(param).then((res) => {
...@@ -242,10 +279,14 @@ export default { ...@@ -242,10 +279,14 @@ export default {
} }
if (res.data.list) { if (res.data.list) {
self.orderList.push(...res.data.list) self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) { if (
self.list[self.types[res.data.type]].total = res.data.total self.list[this.curNow][self.types[this.curNow][res.data.type]]
) {
self.list[this.curNow][
self.types[this.curNow][res.data.type]
].total = res.data.total
} }
self.orderList.sort((x, y) => { self.orderList.sort((x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1 return x.currentOverTime <= y.currentOverTime ? 1 : -1
}) })
...@@ -271,19 +312,26 @@ export default { ...@@ -271,19 +312,26 @@ export default {
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
var self = this this.$u.api.listOrderCount().then((res) => {
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data) {
// 修改各个tab数量 // 修改各个tab数量
var j = 0
var i = 0 var i = 0
var count = 0 var count = 0
for (var item of self.list) { for (var items of this.list) {
item.total = res.data[self.countKeys[i]] for (var item of items) {
count += item.total console.log(this.curNow, i, this.countKeys[i])
i++ item.total = res.data[this.countKeys[i]] || 0
if (j == 0) {
// 待处理数量加起来
count += item.total
console.log('count', item)
}
i++
}
j++
} }
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
...@@ -302,9 +350,9 @@ export default { ...@@ -302,9 +350,9 @@ export default {
}) })
}, },
handleClickCellButton(item, type) { handleClickCellButton(item, type) {
if (type == 'exception') { if (type == 'exception') {
this.$u.api.workerDealWithError(item.orderId).then(() => {}) this.$u.api.workerDealWithError(item.orderId).then(() => {})
} }
// 去完工 // 去完工
uni.navigateTo({ uni.navigateTo({
url: url:
...@@ -362,7 +410,7 @@ export default { ...@@ -362,7 +410,7 @@ export default {
reloadOrderList() { reloadOrderList() {
this.pageNumber = 0 this.pageNumber = 0
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(this.currentIndex) this.getOrderList()
}, },
scroll(e) { scroll(e) {
this.old.scrollTop = e.detail.scrollTop this.old.scrollTop = e.detail.scrollTop
...@@ -381,7 +429,12 @@ export default { ...@@ -381,7 +429,12 @@ export default {
.u-tabs-box { .u-tabs-box {
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
// .u-tabs-box {
// margin-bottom: 20rpx !important;
// }
// /deep/ .u-tab-bar {
// bottom: 10rpx !important;
// }
.tab-view { .tab-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
...@@ -403,7 +456,7 @@ export default { ...@@ -403,7 +456,7 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding-bottom: 20rpx; padding-bottom: 18rpx;
.search-sub { .search-sub {
height: 72rpx; height: 72rpx;
......
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