155 lines
3.5 KiB
Vue
Raw Normal View History

2023-08-09 09:11:05 +08:00
<template>
2023-08-19 19:04:14 +08:00
<view>
<globalPopup ref="globalPopup"></globalPopup>
<u-sticky bgColor="#0122C7" style="width: 100vw">
<u-tabs :list="tabLists" @change="sectionChange" lineColor="#fff" :scrollable="false" lineWidth="40"
inactiveStyle="color:#fff" activeStyle="color:#fff"></u-tabs>
</u-sticky>
<view class="content">
<u-search placeholder="搜索你的订单" @search="getOrderList" :show-action="false" bg-color="white"
v-model="keywords"></u-search>
<view v-if="!orderlist.length">
<u-empty mode="data" icon="../../static/img/empty/data.png"> </u-empty>
</view>
2023-09-08 10:53:37 +08:00
<view v-else @scroll='scrolling'>
2023-08-19 19:04:14 +08:00
<logistiCard ref="logistiCards" v-for="(item, index) in orderlist" @getlist="getOrderList"
@showTost="showToast" @showToast2="showToast2" :goodsInfo="item" :key="index">
</logistiCard>
2023-09-08 10:53:37 +08:00
<u-loadmore :status="status" />
2023-08-19 19:04:14 +08:00
</view>
<!-- -->
<u-toast ref="uToast"></u-toast>
</view>
</view>
2023-08-09 09:11:05 +08:00
</template>
<script>
2023-08-19 19:04:14 +08:00
import {
getList
} from "@/api/logistics.js"
import globalPopup from "@/components/GlobalPopup/GlobalPopup.vue"
import {
informationAdd
} from "@/api/logistics.js"
import logistiCard from "@/components/logistiComptent/logistiCard/logistiCard.vue"
//#ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
export default {
components: {
logistiCard,
globalPopup
},
data() {
return {
2023-08-21 13:47:26 +08:00
is_captain: "",
2023-08-19 19:04:14 +08:00
notArr: [],
keywords: "",
tabLists: [{
name: '待配送',
}, {
name: '待送达'
}, {
name: '已送达'
}],
curNow: 0,
2023-09-08 10:53:37 +08:00
orderlist: [],
id: "",
status: "loadmore",
page_num: 1,
flag: false
2023-08-19 19:04:14 +08:00
}
},
methods: {
sectionChange(index) {
2023-08-18 16:03:25 +08:00
2023-08-19 19:04:14 +08:00
this.curNow = index.index;
this.getOrderList()
},
2023-08-18 16:03:25 +08:00
2023-08-19 19:04:14 +08:00
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
},
showToast2() {
// 6
this.$refs.uToast.show({
type: 'error',
message: "取件码不能为空",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png'
}, )
},
getOrderList() {
console.log("列表更新")
2023-09-08 10:53:37 +08:00
this.id = JSON.parse(uni.getStorageSync('USER_INFO')).id
2023-08-19 19:04:14 +08:00
getList({
status: this.curNow,
2023-09-08 10:53:37 +08:00
user_id: this.id,
2023-08-21 13:47:26 +08:00
keywords: this.keywords,
user_type: this.is_captain
2023-08-19 19:04:14 +08:00
}).then(res => {
this.orderlist = []
this.orderlist = res.data.data
})
}
2023-08-09 09:11:05 +08:00
2023-08-19 19:04:14 +08:00
},
2023-09-08 10:53:37 +08:00
2023-08-19 19:04:14 +08:00
onLoad() {
2023-09-08 10:53:37 +08:00
2023-08-21 13:47:26 +08:00
this.is_captain = JSON.parse(uni.getStorageSync('USER_INFO')).is_captain
2023-08-19 19:04:14 +08:00
let that = this
//#ifdef APP-PLUS
jpushModule.addNotificationListener(function(result) {
if (!that.notArr.includes(result.messageID)) {
that.$refs.globalPopup.showPopu();
that.getOrderList()
2023-08-09 09:11:05 +08:00
2023-08-19 19:04:14 +08:00
}
that.notArr.push(result.messageID)
})
// #endif
2023-09-08 10:53:37 +08:00
// window.addEventListener("scroll", this.scrolling);
2023-08-19 19:04:14 +08:00
},
2023-09-08 10:53:37 +08:00
2023-08-19 19:04:14 +08:00
onShow() {
this.getOrderList()
2023-08-09 09:11:05 +08:00
2023-09-08 10:53:37 +08:00
},
onReachBottom() {
if (this.flag) return
this.status = "loading"
this.page_num += 1
this.flag = true
getList({
status: this.curNow,
user_id: this.id,
keywords: this.keywords,
user_type: this.is_captain,
page_num: this.page_num
}).then(res => {
this.orderlist = this.orderlist.concat(res.data.data)
this.flag = false
if (!res.data.data.length) {
this.status = "nomore"
this.flag = true
}
})
},
2023-08-09 09:11:05 +08:00
2023-08-19 19:04:14 +08:00
}
2023-08-09 09:11:05 +08:00
</script>
<style lang='scss'>
2023-08-19 19:04:14 +08:00
.content {
margin-top: 2vh;
background-color: #f5f5f5;
padding: 0vh 2vw;
}
2023-08-09 09:11:05 +08:00
</style>