From 35fc21e14e480635bf78c64d9b3247823390ff0b Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Wed, 12 Jun 2024 10:04:00 +0800 Subject: [PATCH] add --- components/goodPopup.vue | 3 +-- pages.json | 2 +- pages/cart/cart.vue | 7 +++---- pages/index/index.vue | 21 ++++++++++---------- pagesOrder/order/order.vue | 40 ++++++++++++++++++++++---------------- 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/components/goodPopup.vue b/components/goodPopup.vue index 576c9e7..b2157e8 100644 --- a/components/goodPopup.vue +++ b/components/goodPopup.vue @@ -70,8 +70,7 @@ cart_num: '' }); const setData = (e) => { - console.log(datas.value) - + console.log(e) datas.value = e; } diff --git a/pages.json b/pages.json index cde40b2..ce933a0 100644 --- a/pages.json +++ b/pages.json @@ -123,7 +123,7 @@ "path": "order/order", "style": { "navigationBarTitleText": "我的订单", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "navigationStyle": "custom" } }, diff --git a/pages/cart/cart.vue b/pages/cart/cart.vue index e68d88b..13ef109 100644 --- a/pages/cart/cart.vue +++ b/pages/cart/cart.vue @@ -61,7 +61,7 @@ - + {{item.name}} @@ -69,7 +69,7 @@ {{item.unit_name}} - ¥{{item.sell}} + ¥{{item.price}} 加入购物车 @@ -187,7 +187,6 @@ title: '请选择商品', icon: 'none' }); - console.log(cartList.value) cartList.value.forEach(item => { if (item.check) list.push(item.id); }) @@ -223,7 +222,7 @@ }; const changeGood = (data) => { // 确定选择商品重量 showGoodPopup.value = false; - addCart(data.product_id, data.cart_num); + addCart(data.product_id || data.id, data.cart_num); } const cartList = ref([]); diff --git a/pages/index/index.vue b/pages/index/index.vue index f6951ee..ac3ee88 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -2,18 +2,17 @@ - - - {{STORE_INFO.name}} - - - - {{STORE_INFO.detailed_address}} - - \ No newline at end of file diff --git a/pagesOrder/order/order.vue b/pagesOrder/order/order.vue index c83569e..1e9ac58 100644 --- a/pagesOrder/order/order.vue +++ b/pagesOrder/order/order.vue @@ -16,7 +16,9 @@ - + import { onLoad, - onUnload + onUnload, + onPullDownRefresh } from "@dcloudio/uni-app" import { ref } from 'vue'; - import { - onPullDownRefresh - } from "@dcloudio/uni-app" import good from "./component/good.vue"; import orderCanclePopup from "@/components/orderCanclePopup.vue" import modal from "@/components/modal.vue" @@ -149,7 +149,6 @@ current } }) => { - console.log('current', current) swiperCurrent.value = current; tabsActive.value = current; @@ -338,7 +337,7 @@ [], [] ]) - const getOrderList = (type = 0, status = '', paid = 1) => { + const getOrderList = (type = 0, status = '', paid = 1, ifPullReFresh = false) => { if (where.value[type].loadend) return; where.value[type].loading = true; orderListApi({ @@ -353,6 +352,8 @@ if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true; where.value[type].page_no++; where.value[type].loading = false; + if (ifPullReFresh) uni.stopPullDownRefresh(); + }).catch(err => { where.value[type].loading = false; }) @@ -367,15 +368,17 @@ } // 搜索 - const searchOn = () => { + const searchOn = (ifPullReFresh = false) => { orderList.value[+swiperCurrent.value] = []; where.value[+swiperCurrent.value].page_no = 1; where.value[+swiperCurrent.value].loadend = false; - if (swiperCurrent.value == 0) getOrderList(0, '', ''); //全部 - if (swiperCurrent.value == 1) getOrderList(1, '', 0); //代付款 - if (swiperCurrent.value == 2) getOrderList(2, 1, 1); //待核销 - if (swiperCurrent.value == 3) getOrderList(3, 2, 1); //已核销 - if (swiperCurrent.value == 4) getOrderList(4, -1, 1); //退款 + if (swiperCurrent.value == 0) getOrderList(0, '', '', ifPullReFresh); //全部 + if (swiperCurrent.value == 1) getOrderList(1, '', 0, ifPullReFresh); //代付款 + if (swiperCurrent.value == 2) getOrderList(2, 1, 1, ifPullReFresh); //待核销 + if (swiperCurrent.value == 3) getOrderList(3, 2, 1, ifPullReFresh); //已核销 + if (swiperCurrent.value == 4) getOrderList(4, -1, 1, ifPullReFresh); //退款 + + } let back = 0; @@ -413,11 +416,14 @@ uni.$off('reLoadOrderList', reloadAll) }) - onPullDownRefresh(() => { + const triggered = ref(false); + const refresherrefresh = (type = 1) => { + triggered.value = true; searchOn() - console.log(454) - uni.stopPullDownRefresh() - }) + setTimeout(() => { + triggered.value = false; + }, 500) + }