diff --git a/components/UiButton.vue b/components/UiButton.vue index 99d1aff..b1b823b 100644 --- a/components/UiButton.vue +++ b/components/UiButton.vue @@ -10,7 +10,7 @@ disabled 是否禁用 true false --> diff --git a/components/UiConfirm.vue b/components/UiConfirm.vue index db3f225..06725bc 100644 --- a/components/UiConfirm.vue +++ b/components/UiConfirm.vue @@ -45,7 +45,7 @@ export default { methods: { onConfirm() { this.$emit("confirm"); - this.visible = false; + this.dialogVisible = false; }, }, }; diff --git a/pages/account/index/home/module/LogisitcsInfo.vue b/pages/account/index/home/module/LogisitcsInfo.vue index e9175b2..711f933 100644 --- a/pages/account/index/home/module/LogisitcsInfo.vue +++ b/pages/account/index/home/module/LogisitcsInfo.vue @@ -11,17 +11,18 @@
我的物流
-
+
@@ -68,6 +69,11 @@ export default { data() { return { selectOrderId: 0, + query: { + pageIndex: 1, + length: 15, + }, + total: 0, confirmOrderVisible: false, list: [], loading: false, @@ -81,27 +87,43 @@ export default { // 获取待收货物流信息 async getLogisticsList() { this.loading = true; - const { result } = await ApiGetOrderLogisticsList(); + const { result } = await ApiGetOrderLogisticsList({ ...this.query }); this.loading = false; this.loadFinish = true; if (result) { - this.list = result.map((item) => { - const goods = item.products || [{ productImageUrl: "" }]; - const logisticsList = item.logistics.logisticsDataList || [ - { context: "暂无物流信息" }, - ]; - return { - ...item, - cover: goods[0].productImageUrl, // 订单封面 - logisticsContext: logisticsList[0].context, // 物流详细信息 - }; - }); + const { total, records } = result; + this.total = total; + if (records && records.length > 0) { + const formatRecords = records.map((item) => { + const goods = item.products || [{ productImageUrl: "" }]; + const logisticsList = item.logistics.logisticsDataList || [ + { context: "暂无物流信息" }, + ]; + return { + ...item, + cover: goods[0].productImageUrl, // 订单封面 + logisticsContext: logisticsList[0].context, // 物流详细信息 + }; + }); + this.list = this.list.concat(formatRecords); + } } }, onOrderConfirm({ orderId }) { this.selectOrderId = orderId; this.confirmOrderVisible = true; }, + // 上拉加载 + handleListload() { + if (this.total > 0 && this.list.length < this.total) { + // 执行接口请求 + this.query.pageIndex += 1; + this.getLogisticsList(); + } + }, + onJumpOrderDetail(id) { + this.$router.push(`/account/order/detail?id=${id}`); + }, // 确认收货 async handleOrderEnsure() { @@ -110,7 +132,9 @@ export default { }); this.confirmOrderVisible = false; if (result) { - Message.success("收货成功"); + Message.success("确认收货成功"); + this.list = []; + this.query.pageIndex = 1; this.getLogisticsList(); } }, @@ -154,6 +178,7 @@ export default { } .home-logisitcs-content__item { margin-bottom: 30px; + cursor: pointer; &:last-child { margin-bottom: 0; } diff --git a/plugins/api/order.js b/plugins/api/order.js index ba98387..fd817a4 100644 --- a/plugins/api/order.js +++ b/plugins/api/order.js @@ -68,8 +68,8 @@ export const ApiGetOrderLogistics = ({orderId}) => * 获取物流列表 * @param {*} params */ -export const ApiGetOrderLogisticsList = () => - ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/listReceiveOrder`)); +export const ApiGetOrderLogisticsList = (params) => + ToAsyncAwait(axiosTk.get(`${BASE_URL}/app/tradeOrder/listReceiveOrder`, { params })); /** * 确认收货