You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-pc/pages/account/index/home/module/LogisitcsInfo.vue

184 lines
4.5 KiB

<!--
* @Author: ch
* @Date: 2022-05-04 17:49:21
* @LastEditors: ch
* @LastEditTime: 2022-05-04 17:50:11
* @Description: file content
-->
<template>
<div class="home-logisitcs">
<div class="home-logisitcs-label">我的物流</div>
<!-- 无物流信息 -->
<div
v-if="loadFinish && total === 0"
class="home-logisitcs-empty flex flex-center flex-middle"
>
<img src="~/assets/img/account/home/logisitcs-empty.png" />
</div>
<!-- 有物流信息 -->
<div v-else v-loading="loading">
<div v-infinite-scroll="handleListload" class="home-logisitcs-content">
<div
v-for="item in list"
:key="item.orderNo"
class="home-logisitcs-content__item flex flex-middle flex-between"
>
<div class="logisitcs-content-item__info flex flex-start">
<img :src="item.img" />
<div class="content-item-info__wrap flex-1">
<p class="item-info-wrap__title">
{{ item.title }}
</p>
<div class="item-info-wrap__orderNo">
<span>{{ `${item.companyName}: ${item.orderNo}` }}</span>
<span class="item-info-wrap__orderNo--light"></span>
</div>
</div>
</div>
<UiButton
type="yellow_line"
:radius="true"
@click="onOrderEnsure(item)"
>确认收货</UiButton
>
</div>
</div>
</div>
<UiConfirm
title="确认收到货了吗?"
:visible.sync="ensureOrderVisible"
@confirm="handleOrderEnsure"
/>
</div>
</template>
<script>
import UiButton from "@/components/UiButton.vue";
import UiConfirm from "@/components/UiConfirm.vue";
import { ApiGetOrderLogisticsList } from "@/plugins/api/order";
export default {
components: { UiButton, UiConfirm },
data() {
return {
total: 0,
query: {
pageIndex: 1,
length: 10,
},
selectOrderId: 0,
ensureOrderVisible: false,
list: [],
loading: false,
loadFinish: false,
};
},
mounted() {
this.getLogisticsList();
},
methods: {
// 获取待收货物流信息
async getLogisticsList() {
this.loading = true;
const { result } = await ApiGetOrderLogisticsList({ ...this.query });
this.loading = false;
this.loadFinish = true;
if (result) {
const { total, list } = result;
this.total = total;
if (list && list.length > 0) {
this.list = this.list.concat(list);
}
}
},
onOrderEnsure({ orderNo }) {
this.selectOrderId = orderNo;
this.ensureOrderVisible = true;
},
// 确认收货
handleOrderEnsure() {},
// 上拉加载
handleListload() {
console.log("enter");
if (this.total > 0 && this.list.length < this.total) {
// 执行接口请求
this.query.pageIndex += 1;
this.getLogisticsList();
}
},
},
};
</script>
<style lang="scss" scoped>
.home-logisitcs {
width: 620px;
border: 1px solid #dddddd;
.home-logisitcs-label {
height: 42px;
line-height: 42px;
padding: 0 22px;
border-bottom: 1px solid #dddddd;
background: #f8f8f8;
font-size: 14px;
color: #333333;
}
.home-logisitcs-empty {
height: 310px;
img {
width: 228px;
height: 144px;
}
}
.home-logisitcs-content {
max-height: 620px;
overflow: auto;
padding: 30px;
&::-webkit-scrollbar {
width: 4px;
background-color: none;
}
&::-webkit-scrollbar-track {
background-color: none;
}
&::-webkit-scrollbar-thumb {
background: #dddddd;
border-radius: 10px;
}
.home-logisitcs-content__item {
margin-bottom: 30px;
&:last-child {
margin-bottom: 0;
}
.logisitcs-content-item__info {
img {
width: 60px;
height: 60px;
margin-right: 18px;
border-radius: 2px;
}
.content-item-info__wrap {
.item-info-wrap__title {
width: 309px;
font-size: 14px;
color: #666666;
margin-bottom: 8px;
}
.item-info-wrap__orderNo {
display: inline-block;
color: #999999;
font-size: 12px;
}
.item-info-wrap__orderNo--light {
color: #ff875b;
margin-left: 30px;
cursor: pointer;
}
}
}
}
}
}
</style>