ylj20011123 5d8cf4605f update
2025-07-07 20:02:40 +08:00

404 lines
9.5 KiB
Vue

<template>
<view class="main">
<div class="fliter">
<!-- <div class="select_box">
<div class="search_box">
<img
src="/static/images/home/search_icon.svg"
alt=""
class="search_icon"
/>
<input
v-model="searchText"
confirm-type="search"
@confirm="getorderList"
placeholder="请输入关键字"
class="select_input"
/>
</div>
<div class="select_btn" @click="handleSelect">
<img
src="/static/images/home/select_icon.svg"
alt=""
class="select_icon"
/>
筛选
</div>
</div> -->
<div class="tabs">
<div class="tabs_item" :class="currentTab === item.value ? 'tab_active' : ''" v-for="(item, idx) in tabList"
:key="idx" @click="handleTab(item.value)">
{{ item.label }}
</div>
</div>
<div class="sum_count" v-if="TotalCount > 0">
共<span>{{ TotalCount }}</span>笔订单, 合计<span>{{ TotalAmount }}</span>元
</div>
</div>
<scroll-view v-if="orderList && orderList.length > 0" class="srcollView" scroll-y="true" refresher-enabled="true"
@refresherrefresh="handleRefresherrefresh" :refresher-triggered="triggered" @scrolltolower="handleScrollTolower">
<div @click="goEvaluate(item)" v-for="(item, idx) in orderList" :key="idx">
<OrderItem :obj="item" @handleGetOrderList="handleGetOrderList" />
</div>
<view class="inBottom">
<text class="bottomText">{{
pageMsg.isOver ? "我是有底线的" : "下拉加载更多"
}}</text>
</view>
</scroll-view>
<no-data text="暂无订单数据" v-else />
</view>
</template>
<script>
import NoData from "../../../components/noData.vue";
import OrderItem from "./components/orderItem.vue";
export default {
data() {
return {
tabList: [
{
label: "全部订单",
value: 1,
},
{
label: "待支付",
value: 2,
},
{
label: "待接单",
value: 3,
},
{
label: "制作中",
value: 4,
},
{
label: "已完成",
value: 5,
},
],
currentTab: 1,
orderList: [],
pageMsg: {
pageIndex: 1,
pageSize: 10,
isOver: false,
},
searchType: "",
triggered: false,
};
},
components: {
OrderItem,
NoData,
},
onLoad(query) {
if (query.type) {
this.searchType = query.type;
this.currentTab = Number(this.searchType) + 1;
}
let type =
this.currentTab === 1
? ""
: this.currentTab === 2
? "1005"
: this.currentTab === 3
? "1010"
: this.currentTab === 4
? "2000"
: this.currentTab === 5
? "3000"
: "";
// 获取订单数据
this.handleGetOrderList(type);
// this.$utils.addUserBehaviorNew();
_this.$utils.addUserBehaviorNew({
behaviorRecordDesc: "进入点餐订单页面"
});
},
methods: {
// 滚动到底部 加载更多
handleScrollTolower() {
this.pageMsg.pageIndex = this.pageMsg.pageIndex + 1;
let type =
this.currentTab === 1
? ""
: this.currentTab === 2
? "1005"
: this.currentTab === 3
? "1010"
: this.currentTab === 4
? "2000"
: this.currentTab === 5
? "3000"
: "";
this.handleGetOrderList(type);
},
// 下拉刷新的方法
async handleRefresherrefresh() {
this.orderList = [];
this.pageMsg = {
pageIndex: 1,
pageSize: 10,
isOver: false,
};
this.triggered = true;
let type =
this.currentTab === 1
? ""
: this.currentTab === 2
? "1005"
: this.currentTab === 3
? "1010,2000"
: this.currentTab === 4
? "2010"
: this.currentTab === 5
? ""
: "";
await this.handleGetOrderList(type);
this.triggered = false;
},
handleTab(val) {
this.pageMsg = {
pageIndex: 1,
pageSize: 10,
isOver: false,
};
this.currentTab = val;
this.orderList = [];
let type =
this.currentTab === 1
? ""
: this.currentTab === 2
? "1005"
: this.currentTab === 3
? "1010"
: this.currentTab === 4
? "2000"
: this.currentTab === 5
? "3000"
: "";
this.handleGetOrderList(type);
},
// 获取订单数据
async handleGetOrderList(status) {
if (this.pageMsg.isOver) {
return;
}
uni.showLoading({
title: "正在加载...",
mask: true,
});
const req = {
action_type: "GetOrderList",
salebillType: 6000,
salebillState: status || "",
PageIndex: this.pageMsg.pageIndex,
pageSize: this.pageMsg.pageSize,
ownerUnitId: 911,
requestType: "application/x-www-form-urlencoded",
};
const data = await this.$api.postCoop(req);
console.log("data", data);
let oldOrderList = [];
if (this.orderList && this.orderList.length > 0) {
oldOrderList = JSON.parse(JSON.stringify(this.orderList));
}
// 手动添加待付款、待发货、待收货
let list = data.Data ? data.Data.List : [];
let resList = [];
if (list && list.length > 0) {
if (this.currentTab === 5) {
list.forEach((item) => {
if (
item.SALEBILL_STATE >= 3000 &&
item.SALEBILL_STATE !== 8999 &&
item.SALEBILL_STATE !== 9000 &&
item.SALEBILL_STATE !== 9999
) {
resList.push(item);
}
});
} else {
resList = list;
}
}
console.log("获取订单数据", resList);
if (resList && resList.length < 10) {
this.pageMsg.isOver = true;
}
this.orderList = oldOrderList.concat(resList);
uni.hideLoading();
},
goEvaluate(item) {
console.log("item", item);
uni.navigateTo({
url:
"/pages/order/orderFoodDetail/index?sellchildid=" +
(item.SALEBILL_CHILD_ID || "") +
"&orderInternal=" +
(item.SALEBILL_ID || "") +
"&orderStatus=" +
(item.SALEBILL_STATE || "") +
"&SUPPLIER_NAME=" +
(item.SUPPLIER_NAME || ""),
});
},
},
};
</script>
<style lang="less" scoped>
.main {
width: 100vw;
height: 100vh;
.fliter {
background: #fff;
margin-bottom: 24rpx;
.select_box {
display: flex;
flex-direction: row;
padding: 16rpx 32rpx 8rpx;
align-items: center;
justify-content: space-between;
.search_box {
width: 558rpx;
height: 72rpx;
background: #f2f4f5;
display: flex;
flex-direction: row;
align-items: center;
border-radius: 36rpx;
img {
width: 35rpx;
height: 35rpx;
margin: auto 16rpx auto 24rpx;
}
.select_input {
width: 476rpx;
border: none;
height: 40rpx;
font-size: 28rpx;
}
}
.select_btn {
display: flex;
flex-direction: row;
align-items: center;
font-size: 28rpx;
color: #6c737a;
img {
width: 35rpx;
height: 35rpx;
margin-right: 12rpx;
}
}
}
.tabs {
width: 100%;
height: 88rpx;
display: flex;
.tabs_item {
text-align: center;
color: #6c737a;
font-size: 28rpx;
line-height: 88rpx;
flex: 1;
}
.tab_active {
color: #1890ff;
font-weight: 600;
position: relative;
}
.tab_active:after {
content: "";
display: block;
position: absolute;
bottom: 2rpx;
left: 50%;
margin-left: -24rpx;
width: 48rpx;
height: 6rpx;
background: #1890ff;
border-radius: 2rpx;
}
}
.sum_count {
height: 72rpx;
background: #fff;
border-radius: 2rpx;
padding-left: 32rpx;
line-height: 72rpx;
font-size: 28rpx;
color: #6c737a;
border-top: 2rpx solid #f2f4f5;
span {
color: #020e1a;
}
}
}
.srcollView {
width: 100%;
height: calc(100vh - 160rpx);
.inBottom {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
.bottomText {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 26rpx;
color: #d0d0d0;
line-height: 40rpx;
text-align: justify;
font-style: normal;
position: relative;
padding: 6rpx 0;
}
.bottomText::after {
content: "";
width: 30vw;
height: 2rpx;
background: #e0e0e0;
position: absolute;
left: -32vw;
top: 50%;
}
.bottomText::before {
content: "";
width: 30vw;
height: 2rpx;
background: #e0e0e0;
position: absolute;
right: -32vw;
top: 50%;
}
}
}
}
</style>