|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<ul class="tab">
|
|
|
|
<li v-for="(tab, i) in tabs" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
|
|
|
|
<uni-search-bar class="search" radius="5" placeholder="请输入姓名、订单号" v-model="keyword" clearButton="auto" cancelButton="none" />
|
|
|
|
</uni-card>
|
|
|
|
|
|
|
|
<view class="filter">
|
|
|
|
<sl-filter :independence="true" :menuList="menuList" @result="result"></sl-filter>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<template v-if="list.length">
|
|
|
|
<view class="list">
|
|
|
|
<uni-swipe-action>
|
|
|
|
<uni-swipe-action-item
|
|
|
|
v-for="item in list"
|
|
|
|
:threshold="0"
|
|
|
|
:right-options="delOption"
|
|
|
|
@click="del(item)"
|
|
|
|
>
|
|
|
|
<view class="item" @click="toDetail(item)">
|
|
|
|
<view class="c-name">{{ item.orderNumber }}</view>
|
|
|
|
<view class="info">
|
|
|
|
<view class="left">
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">客户名称:</text>
|
|
|
|
<text class="val">{{ item.customerName }}</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">订单金额:</text>
|
|
|
|
<text class="val">{{ item.orderAmount }}</text>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">订单内容:</text>
|
|
|
|
<view class="val ell-wrap">
|
|
|
|
<view :class="{ell: !item.toggle}">{{ item.orderContent }}</view>
|
|
|
|
<view v-if="!item.toggle" class="toggle" @click.stop="toggle(item)">展开</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="line">
|
|
|
|
<text class="name">下单日期:</text>
|
|
|
|
<text class="val">{{ item.createTime }}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view :class="['type', 'type' + item.orderStatus]">
|
|
|
|
{{ menuList[0].detailList.find(e => e.value === item.orderStatus).title }}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</uni-swipe-action-item>
|
|
|
|
</uni-swipe-action>
|
|
|
|
</view>
|
|
|
|
<uni-load-more :status="status" />
|
|
|
|
</template>
|
|
|
|
<empty v-else></empty>
|
|
|
|
|
|
|
|
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../orderDetail/orderDetail')"></uni-icons>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { queryCustomer } from '@/apis/modules/client.js'
|
|
|
|
import { list, del } from '@/apis/modules/order.js'
|
|
|
|
import slFilter from '@/components/sl-filter/sl-filter.vue'
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
menuList: [
|
|
|
|
{
|
|
|
|
'title': '订单状态',
|
|
|
|
'detailTitle': '请选择订单状态',
|
|
|
|
'key': 'orderStatus',
|
|
|
|
'isMutiple': false,
|
|
|
|
'detailList': [
|
|
|
|
{
|
|
|
|
'title': '全部',
|
|
|
|
'value': ''
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '待发货',
|
|
|
|
'value': 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '已完成',
|
|
|
|
'value': 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '排序',
|
|
|
|
'detailTitle': '请选择排序(按下单日期)',
|
|
|
|
'key': 'sort',
|
|
|
|
'isSort': true,
|
|
|
|
'isMutiple': false,
|
|
|
|
'detailList': [
|
|
|
|
{
|
|
|
|
'title': '倒序',
|
|
|
|
'value': 'desc'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'title': '顺序',
|
|
|
|
'value': 'asc'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
curTab: 0,
|
|
|
|
tabs: [
|
|
|
|
{
|
|
|
|
name: '我的订单',
|
|
|
|
id: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '团队全部订单',
|
|
|
|
id: 1
|
|
|
|
}
|
|
|
|
],
|
|
|
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
|
|
|
isFilter: 0, // 是否是在筛选。0->否,1->是
|
|
|
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
|
|
|
searchTimer: null,
|
|
|
|
orderStatus: '',
|
|
|
|
sort: 'desc',
|
|
|
|
keyword: '',
|
|
|
|
list: [],
|
|
|
|
page: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
delOption: [{
|
|
|
|
text: '删除',
|
|
|
|
style: {
|
|
|
|
backgroundColor: '#F56C6C'
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
slFilter,
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
keyword () {
|
|
|
|
clearTimeout(this.searchTimer)
|
|
|
|
this.searchTimer = setTimeout(() => {
|
|
|
|
this.initList()
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// 下拉刷新
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.initList()
|
|
|
|
setTimeout(() => {
|
|
|
|
uni.stopPullDownRefresh()
|
|
|
|
}, 1500)
|
|
|
|
},
|
|
|
|
// 上拉加载
|
|
|
|
onReachBottom() {
|
|
|
|
if (this.reachBottom >= 0) {
|
|
|
|
this.reachBottom = 1
|
|
|
|
this.status = 'loading'
|
|
|
|
this.getList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
// 清除产品缓存
|
|
|
|
try {
|
|
|
|
uni.removeStorageSync('courses')
|
|
|
|
} catch (e) {}
|
|
|
|
this.initList()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getList() {
|
|
|
|
list({
|
|
|
|
businessManagerId: this.$util.getBmId(),
|
|
|
|
keywords: this.keyword,
|
|
|
|
pageNum: this.page,
|
|
|
|
pageSize: this.pageSize,
|
|
|
|
sort: this.sort,
|
|
|
|
orderStatus: this.orderStatus
|
|
|
|
}).then(({ data }) => {
|
|
|
|
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值
|
|
|
|
const list = data.records
|
|
|
|
list.map(e => {
|
|
|
|
e.toggle = e.orderContent.length < 14 // 超过了14个字才需要显示展开按钮
|
|
|
|
})
|
|
|
|
this.list = this.reachBottom > 0 ? [...this.list, ...list] : list
|
|
|
|
this.page++ // 每次获取了数据后page+1
|
|
|
|
const noMore = this.list.length === data.total // 是否加载完所有数据
|
|
|
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
|
|
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
|
|
|
}).catch(e => {})
|
|
|
|
},
|
|
|
|
initList() {
|
|
|
|
this.page = 1
|
|
|
|
this.reachBottom = 0
|
|
|
|
this.getList()
|
|
|
|
},
|
|
|
|
// 展开
|
|
|
|
toggle(item) {
|
|
|
|
item.toggle = !item.toggle
|
|
|
|
},
|
|
|
|
// 筛选确定回调
|
|
|
|
result(val) {
|
|
|
|
if (val.orderStatus !== undefined) this.orderStatus = val.orderStatus
|
|
|
|
if (val.sort) this.sort = val.sort
|
|
|
|
this.initList()
|
|
|
|
},
|
|
|
|
// tab切换
|
|
|
|
tabChange(tab) {
|
|
|
|
this.curTab = tab.id
|
|
|
|
},
|
|
|
|
// 跳转详情
|
|
|
|
toDetail(item) {
|
|
|
|
this.$util.to(`../orderDetail/orderDetail?orderId=${item.orderId}&show=1`)
|
|
|
|
},
|
|
|
|
// 删除
|
|
|
|
del(e) {
|
|
|
|
console.log(e);
|
|
|
|
const that = this
|
|
|
|
uni.showModal({
|
|
|
|
title: '提示',
|
|
|
|
content: '确定要删除吗?',
|
|
|
|
success(res) {
|
|
|
|
if (res.confirm) {
|
|
|
|
del({
|
|
|
|
ids: [e.orderId]
|
|
|
|
}).then(res => {
|
|
|
|
that.$util.sucMsg('删除成功')
|
|
|
|
that.initList()
|
|
|
|
}).catch(res => {})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.filter {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
.list {
|
|
|
|
margin-top: 20rpx;
|
|
|
|
background-color: #fff;
|
|
|
|
.item {
|
|
|
|
padding: 20rpx 40rpx;
|
|
|
|
border-bottom: 1px solid #f1f1f1;
|
|
|
|
}
|
|
|
|
.c-name {
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.info {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
margin-top: 10rpx;
|
|
|
|
}
|
|
|
|
.left {
|
|
|
|
max-width: 70%;
|
|
|
|
}
|
|
|
|
.line {
|
|
|
|
display: flex;
|
|
|
|
padding: 10rpx 0;
|
|
|
|
}
|
|
|
|
.name {
|
|
|
|
margin-right: 10rpx;
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
.val {
|
|
|
|
max-width: 88%;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
.ell {
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
.toggle {
|
|
|
|
margin-top: 10rpx;
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #0e92ef;
|
|
|
|
}
|
|
|
|
.type {
|
|
|
|
margin-left: 20rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #ff7b2d;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.type1 {
|
|
|
|
color: #bdbdbd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|