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"
scroll-anchoring
scroll-y="true"
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
refresher-background="#F4F5F7"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
enable-back-to-top
>
<image
class="banner-image"
:src="bannerImage"
@click="handleClickBanner"
></image>
<view class="msg-view"> <view class="msg-view">
<view class="msg-title">最新消息</view> <view class="msg-title">最新消息</view>
<view class="msg-list-view"> <view class="msg-list-view">
<view class="msg-content" v-for="(item, index) in messageList" :key="index" @click="toNewsDetail(item)"> <view
class="msg-content"
v-for="(item, index) in messageList"
:key="index"
@click="toNewsDetail(item)"
>
<view class="msg-content-view"> <view class="msg-content-view">
<view class="left-view"> <view class="left-view">
<image class="msg-icon" :src="msgStyleImage[item.is_top]"></image> <image
class="msg-icon"
:src="msgStyleImage[item.is_top]"
></image>
<text class="msg-text">{{ item.title }}</text> <text class="msg-text">{{ item.title }}</text>
</view> </view>
<image class="right-icon" :src="shouyeyouImage"></image> <image class="right-icon" :src="shouyeyouImage"></image>
...@@ -32,23 +56,43 @@ ...@@ -32,23 +56,43 @@
<view v-if="needSettled" class="tip-view"> <view v-if="needSettled" class="tip-view">
<image :src="weiruzhuImage" class="tip-view-image"></image> <image :src="weiruzhuImage" class="tip-view-image"></image>
<view class="tip-other">入驻后平台将向您分配或推荐订单</view> <view class="tip-other">入驻后平台将向您分配或推荐订单</view>
<u-button class="settle-button" type="primary" shape="circle" @click="immediatelyIn" <u-button
:custom-style="buttonStyle"> class="settle-button"
type="primary"
shape="circle"
@click="immediatelyIn"
:custom-style="buttonStyle"
>
立即入驻 立即入驻
</u-button> </u-button>
</view> </view>
<template v-else> <template v-else>
<!-- 入驻成功之后无推荐订单 --> <!-- 入驻成功之后无推荐订单 -->
<view v-if="orderList.length <= 0 && loadedOrder" class="no-order-view"> <view
v-if="orderList.length <= 0 && loadedOrder"
class="no-order-view"
>
<NoOrder /> <NoOrder />
</view> </view>
<view v-else class="order-item-view"> <view v-else class="order-item-view">
<view v-for="(item, index) in orderList" :key="index"> <view v-for="(item, index) in orderList" :key="index">
<OrderCell :orderData="item" type="waitAccept" :location="location" <OrderCell
@click="handleClick" @action="handleClick"> :orderData="item"
type="waitAccept"
:location="location"
@click="handleClick"
@action="handleClick"
>
</OrderCell> </OrderCell>
</view> </view>
<u-loadmore v-show="(search.pageNumber == 1 && loadedOrder) || search.pageNumber > 1" :status="currentLoadStatus" bgColor="#F4F5F7"></u-loadmore> <u-loadmore
v-show="
(search.pageNumber == 1 && loadedOrder) ||
search.pageNumber > 1
"
:status="currentLoadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view> </view>
</template> </template>
</view> </view>
...@@ -64,13 +108,13 @@ ...@@ -64,13 +108,13 @@
</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,
...@@ -81,16 +125,16 @@ ...@@ -81,16 +125,16 @@
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,
}, },
...@@ -98,29 +142,38 @@ ...@@ -98,29 +142,38 @@
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',
}; }
},
countKeys() {
return [
'toAppointmentCount',
'toCheckinCount',
'toFinishCount',
'reviewingCount',
'exceptionCount',
]
}, },
msgStyleImage() { msgStyleImage() {
return { return {
'1': process.uniEnv.qn_base_url + "zhiding.png", // 置顶 '1': process.uniEnv.qn_base_url + 'zhiding.png', // 置顶
'0': process.uniEnv.qn_base_url + "tongzhi.png", // 通知 '0': process.uniEnv.qn_base_url + 'tongzhi.png', // 通知
// '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息 // '3': process.uniEnv.qn_base_url + "xiaoxi.png", // 消息
} }
}, },
...@@ -136,8 +189,8 @@ ...@@ -136,8 +189,8 @@
}, },
onLoad(e) { onLoad(e) {
app.trackPage('自营平台首页') app.trackPage('自营平台首页')
this._freshing = false; this._freshing = false
if(this.vuex_token) { if (this.vuex_token) {
this.getOrderCount() this.getOrderCount()
} else { } else {
this.waitInit = true this.waitInit = true
...@@ -147,68 +200,72 @@ ...@@ -147,68 +200,72 @@
// 每次进入页面都刷新入驻状态 // 每次进入页面都刷新入驻状态
this.pageNumber = 0 this.pageNumber = 0
this.initSettleInfo(); this.initSettleInfo()
}, },
methods: { methods: {
getData() { getData() {
this.getOrderCount() this.getOrderCount()
this.initSettleInfo(); this.initSettleInfo()
}, },
handleClick(item, type, showCountTime) { // 跳转工单详情页面 showCountTime:是否显示倒计时 handleClick(item, type, showCountTime) {
// 跳转工单详情页面 showCountTime:是否显示倒计时
// type类型 // type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息 // 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime url:
'pages/order/detail?id=' +
item.orderId +
'&type=' +
type +
'&showCountTime=' +
showCountTime,
}) })
}, },
async initSettleInfo() { async initSettleInfo() {
let self = this; let self = this
// 加载消息列表 // 加载消息列表
this.loadMessageList(); this.loadMessageList()
if (this.vuex_token) { if (this.vuex_token) {
const callBack = (vm, result) => { const callBack = (vm, result) => {
// 后台自动判断入驻流程是否完成,前台通过status确定状态 // 后台自动判断入驻流程是否完成,前台通过status确定状态
if (result && result.record) { if (result && result.record) {
vm.needSettled = result.needSettled
vm.needSettled = result.needSettled; vm.status = Number(result.record.status || '0')
vm.status = Number(result.record.status || '0');
// vm.status = 8 // vm.status = 8
} }
}; }
self.search.pageNumber = 0 self.search.pageNumber = 0
self.loadedOrder = false self.loadedOrder = false
self.loadOrderList(); self.loadOrderList()
await app.getBaseInfo(self, callBack); await app.getBaseInfo(self, callBack)
if (this.status == 7) { if (this.status == 7) {
this.getLocation() this.getLocation()
} }
this.loaded = true; this.loaded = true
} else { } else {
this.loaded = true this.loaded = true
} }
}, },
loadMessageList() { loadMessageList() {
let self = this; let self = this
self.$u.api.listByNotice().then((res) => { self.$u.api.listByNotice().then((res) => {
uni.stopPullDownRefresh() // 结束下拉刷新 uni.stopPullDownRefresh() // 结束下拉刷新
if (res.code == 200) { if (res.code == 200) {
if (res.data && res.data.length > 2) { if (res.data && res.data.length > 2) {
self.messageList = res.data.slice(0, 2); self.messageList = res.data.slice(0, 2)
} else { } else {
self.messageList = res.data || []; self.messageList = res.data || []
} }
} else { } else {
console.log(res.message, "初始化消息列表异常"); console.log(res.message, '初始化消息列表异常')
} }
}); })
}, },
loadOrderList() { loadOrderList() {
this.search.pageNumber += 1 this.search.pageNumber += 1
let self = this; let self = this
// 加载订单列表 // 加载订单列表
self.search.token = self.vuex_token; self.search.token = self.vuex_token
self.$u.api.listByRecommendOrder(self.search).then((res) => { self.$u.api.listByRecommendOrder(self.search).then((res) => {
self.loadedOrder = true self.loadedOrder = true
...@@ -223,22 +280,25 @@ ...@@ -223,22 +280,25 @@
var time = new Date().getTime() var time = new Date().getTime()
for (var item of res.data.list) { for (var item of res.data.list) {
item.currentCellTime = time item.currentCellTime = time
self.orderList.push(item); self.orderList.push(item)
} }
} }
self.currentLoadStatus = res.data.total > self.orderList.length && (res.data.list || []).length == self.search.pageSize ? 'loadmore' : 'nomore' self.currentLoadStatus =
res.data.total > self.orderList.length &&
(res.data.list || []).length == self.search.pageSize
? 'loadmore'
: 'nomore'
} else { } else {
console.log(res.message, "初始化订单列表异常"); console.log(res.message, '初始化订单列表异常')
} }
self.$nextTick(()=>{ self.$nextTick(() => {
if (self._freshing) { if (self._freshing) {
self.triggered = false; self.triggered = false
self._freshing = false; self._freshing = false
} }
}) })
}); })
}, },
reachBottom() { reachBottom() {
if (this.vuex_token) { if (this.vuex_token) {
...@@ -253,7 +313,7 @@ ...@@ -253,7 +313,7 @@
this.initSettleInfo() this.initSettleInfo()
}, },
onRestore() { onRestore() {
this.triggered = 'restore'; // 需要重置 this.triggered = 'restore' // 需要重置
}, },
scroll(e) { scroll(e) {
this.old.scrollTop = e.detail.scrollTop this.old.scrollTop = e.detail.scrollTop
...@@ -262,75 +322,75 @@ ...@@ -262,75 +322,75 @@
this.scrollTop = this.old.scrollTop this.scrollTop = this.old.scrollTop
this.$nextTick(function() { this.$nextTick(function() {
this.scrollTop = 0 this.scrollTop = 0
}); })
}, },
/* 立即入驻 */ /* 立即入驻 */
immediatelyIn() { immediatelyIn() {
if (this.vuex_token) { if (this.vuex_token) {
// 用户已登录 // 用户已登录
var pageIndex = 1; var pageIndex = 1
// 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交' // 0=>'待提交',1=>'待审核',2=>'已通过',3=>'备选',4=>'已驳回',5=>'已签约',6=>'未支付保证金',7=>'已支付保证金',8=>'已通过考试',9=>'待提交'
switch (this.status) { switch (this.status) {
case 1: case 1:
case 2: case 2:
case 3: case 3:
case 4: case 4:
pageIndex = 2; pageIndex = 2
break; break
case 8: case 8:
pageIndex = 3; pageIndex = 3
break; break
case 5: case 5:
case 6: case 6:
pageIndex = 4; pageIndex = 4
break; break
case 7: case 7:
pageIndex = 5; pageIndex = 5
break; break
default: default:
pageIndex = 1; pageIndex = 1
break; break
} }
uni.navigateTo({ uni.navigateTo({
url: this.status > 0 ? url:
"/pages/settle/prompt?pageIndex=" + pageIndex : "/pages/settle/index", this.status > 0
}); ? '/pages/settle/prompt?pageIndex=' + pageIndex
: '/pages/settle/index',
})
} else { } else {
// 用户未登录 // 用户未登录
uni.navigateTo({ uni.navigateTo({
url: "pages/login/index", url: 'pages/login/index',
}); })
} }
}, },
// 获取订单数量 // 获取订单数量
getOrderCount() { getOrderCount() {
var self = this; // 加载订单列表 var self = this // 加载订单列表
self.$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) {
var count = 0 var count = 0
for (var i in res.data) { for (var item of this.countKeys) {
count += res.data[i] count += res.data[item] || 0
} }
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
index: 1, index: 1,
text: String(count) text: String(count),
}) })
} else { } else {
uni.removeTabBarBadge({ uni.removeTabBarBadge({
index: 1 index: 1,
}) })
} }
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, '获取订单数量失败!')
} }
}); })
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
...@@ -353,47 +413,45 @@ ...@@ -353,47 +413,45 @@
uni.openSetting({ uni.openSetting({
success(res) { success(res) {
console.log(res.authSetting) console.log(res.authSetting)
} },
});
}
}
}) })
} }
}, },
fail: function(err) { })
} }
}); },
fail: function(err) {},
})
}, },
toNewsDetail(item) { toNewsDetail(item) {
wx.navigateTo({ wx.navigateTo({
url: '/pages/learn/news-details', url: '/pages/learn/news-details',
success: function(res) { success: function(res) {
res.eventChannel.emit('acceptDataFromLearn', item) res.eventChannel.emit('acceptDataFromLearn', item)
} },
}); })
}, },
handleClickBanner() { handleClickBanner() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/mine/customer/index" + '?type=exclusive', 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;
...@@ -448,35 +506,34 @@ ...@@ -448,35 +506,34 @@
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;
...@@ -485,13 +542,12 @@ ...@@ -485,13 +542,12 @@
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 { .tip-view {
padding: 30rpx; padding: 30rpx;
background-color: #ffffff; background-color: #ffffff;
...@@ -510,25 +566,26 @@ ...@@ -510,25 +566,26 @@
margin-bottom: 30rpx; 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%;
} }
...@@ -537,5 +594,5 @@ ...@@ -537,5 +594,5 @@
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,6 +106,7 @@ export default { ...@@ -106,6 +106,7 @@ export default {
pageSize: 1000, // 因为需要排序,所以暂时去掉分页 pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [], orderList: [],
list: [ list: [
[
{ {
name: '待预约', name: '待预约',
total: 0, total: 0,
...@@ -126,6 +127,25 @@ export default { ...@@ -126,6 +127,25 @@ export default {
name: '异常单', name: '异常单',
total: 0, 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]
},
cellType() {
return this.orderType == 'waitLianxi' ? '' : this.orderType
}, },
currentIndex() { offset() {
return this.curNow == 0 ? this.current : 5 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, // 待预约、 waitAppointment: 0, // 待预约、
waitCheckIn: 1, // 待签到、 waitCheckIn: 1, // 待签到、
waitFinish: 2, // 待完工、 waitFinish: 2, // 待完工、
audit: 3, // 审核中、 audit: 3, // 审核中、
exception: 4, // 异常单、 exception: 4, // 异常单、
finish: 5, //已完工 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,8 +279,12 @@ export default { ...@@ -242,8 +279,12 @@ 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) => {
...@@ -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) {
console.log(this.curNow, i, this.countKeys[i])
item.total = res.data[this.countKeys[i]] || 0
if (j == 0) {
// 待处理数量加起来
count += item.total count += item.total
console.log('count', item)
}
i++ i++
} }
j++
}
// 修改tab总数 // 修改tab总数
if (count > 0) { if (count > 0) {
uni.setTabBarBadge({ uni.setTabBarBadge({
...@@ -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