From 35134a9aa28fd1bc9fed432c82b876ae0eab0d04 Mon Sep 17 00:00:00 2001 From: Wen Fangping Date: Mon, 14 Mar 2022 12:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=8A=9F=E5=BE=B7=E7=AE=B1?= =?UTF-8?q?=E6=9C=AA=E6=98=BE=E7=A4=BA=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 8 ++++++++ src/api/index.js | 2 +- src/pages/goods-detail/index.vue | 27 ++++++++++++++++++++------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 47664c5..fb7854c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -145,6 +145,14 @@ export default { justify-content: center; } +.read-more{ + height: 1.3rem; + text-align: center; + font-size: .4rem; + line-height: 1.3rem; + color: #888; +} + @keyframes loading { from{ transform: rotateZ(0); diff --git a/src/api/index.js b/src/api/index.js index 9aa7246..707b7ee 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -129,7 +129,7 @@ const getDynamicDetail = (dynamic_id = '') => service.get(`/api/dynamic/detail?i const getCommonGoods = (temple_id = '', page, size = 10) => service.get(`/api/common/get-list?temple_id=${temple_id}&page=${page}&size=${size}`); // 获取订单榜 -const getOrderCompare = (temple_id = '1', type = '', goods_id = '', goods_type = '') => service.get(`/api/order/get-compare?temple_id=${temple_id}&type=${type}&goods_id=${goods_id}&goods_type=${goods_type}`); +const getOrderCompare = (temple_id = '1', page = 1, type = '', goods_id = '', goods_type = '') => service.get(`/api/order/get-compare?temple_id=${temple_id}&page=${page}&type=${type}&goods_id=${goods_id}&goods_type=${goods_type}`); // 根据agent_id获取订单榜 const getOrderCompareByAgentId = (agent_id = '1', type = '', goods_id = '', goods_type = '') => service.get(`/api/order/get-compare?agent_id=${agent_id}&type=${type}&goods_id=${goods_id}&goods_type=${goods_type}`); diff --git a/src/pages/goods-detail/index.vue b/src/pages/goods-detail/index.vue index 9bacb96..cffcd15 100644 --- a/src/pages/goods-detail/index.vue +++ b/src/pages/goods-detail/index.vue @@ -33,11 +33,13 @@
感恩功德
+
没有更多了
+
查看更多
@@ -120,6 +122,8 @@ export default { { id: 3, name: '总榜', }, ], payList: [], + page: 1, + noMore: false, } }, computed: { @@ -204,7 +208,7 @@ export default { const { goods_id, temple_id } = this.$route.query; const response = await getGoodsDetail(type, goods_id, temple_id); this.data = response; - await this.getPayRecords({ id: 1}); + await this.getPayRecords(this.lTypeId, 1); this.$nextTick(() => { this.paddingBottom = this.$refs.fixedBottom.getOffsetHeight() }) @@ -213,12 +217,21 @@ export default { link: location.href }) }, + // 获取更多感恩功德1 + loadMoreFn(){ + this.page += 1; + this.getPayRecords(this.lTypeId, this.page) + }, // 获取感恩功德 - async getPayRecords(lType){ - this.listType = lType.id; - const res = await getOrderCompare(this.query.temple_id, this.listType, this.query.goods_id, 3 ); - console.log('pay record', res) - this.payList = res.list; + async getPayRecords(lTypeId, page){ + this.page = page; + this.lTypeId = lTypeId; + const res = await getOrderCompare(this.query.temple_id, this.page, this.lTypeId, this.query.goods_id, 3 ); + if(this.page === 1){ + this.payList = []; + } + this.payList = this.payList.concat(res.list); + this.noMore = res.list.length === 0; }, } }