|
@@ -1,5 +1,10 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view>
|
|
|
|
|
|
|
+<!-- <view style="min-height: 100%;">-->
|
|
|
|
|
+ <up-pull-refresh
|
|
|
|
|
+ :refreshing="refreshing"
|
|
|
|
|
+ :threshold="60"
|
|
|
|
|
+ @refresh="onRefresh"
|
|
|
|
|
+ >
|
|
|
<view class="shoppingCart copy-data">
|
|
<view class="shoppingCart copy-data">
|
|
|
<view class="borRadius14">
|
|
<view class="borRadius14">
|
|
|
<view
|
|
<view
|
|
@@ -288,6 +293,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ </up-pull-refresh>
|
|
|
<view
|
|
<view
|
|
|
class="footer acea-row row-between-wrapper"
|
|
class="footer acea-row row-between-wrapper"
|
|
|
v-if="cartList.valid.length > 0"
|
|
v-if="cartList.valid.length > 0"
|
|
@@ -338,20 +344,22 @@
|
|
|
id="product-window"
|
|
id="product-window"
|
|
|
>
|
|
>
|
|
|
</productWindow>
|
|
</productWindow>
|
|
|
- <!-- <view class="uni-p-b-96"></view> -->
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- <view class="uni-p-b-96"></view> -->
|
|
|
<!-- <view class="uni-p-b-98"></view> -->
|
|
<!-- <view class="uni-p-b-98"></view> -->
|
|
|
<!-- #ifdef MP -->
|
|
<!-- #ifdef MP -->
|
|
|
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
|
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
|
|
<!-- #endif -->
|
|
<!-- #endif -->
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
<!-- 自定义 tabBar -->
|
|
<!-- 自定义 tabBar -->
|
|
|
<customTabBar :current="2" :showBackTop="false" />
|
|
<customTabBar :current="2" :showBackTop="false" />
|
|
|
- </view>
|
|
|
|
|
|
|
+
|
|
|
|
|
+<!-- </view>-->
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, reactive, computed,watch } from "vue";
|
|
import { ref, reactive, computed,watch } from "vue";
|
|
|
-import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";
|
|
|
|
|
|
|
+import { onLoad, onShow, onReachBottom,onPullDownRefresh } from "@dcloudio/uni-app";
|
|
|
import { useAppStore } from "@/stores/app.js";
|
|
import { useAppStore } from "@/stores/app.js";
|
|
|
import {
|
|
import {
|
|
|
getCartList,
|
|
getCartList,
|
|
@@ -417,6 +425,8 @@ const isLogin = computed(()=>appStore.isLogin);
|
|
|
// 添加全选的值控制
|
|
// 添加全选的值控制
|
|
|
const allCheckboxValue = ref([]);
|
|
const allCheckboxValue = ref([]);
|
|
|
|
|
|
|
|
|
|
+const refreshing = ref(false);
|
|
|
|
|
+
|
|
|
// 监听isAllSelect的变化,同步到allCheckboxValue
|
|
// 监听isAllSelect的变化,同步到allCheckboxValue
|
|
|
watch(isAllSelect, (newVal) => {
|
|
watch(isAllSelect, (newVal) => {
|
|
|
if (newVal) {
|
|
if (newVal) {
|
|
@@ -430,24 +440,38 @@ onLoad((options) => {
|
|
|
// if (!isLogin.value) {
|
|
// if (!isLogin.value) {
|
|
|
// toLogin();
|
|
// toLogin();
|
|
|
// }
|
|
// }
|
|
|
|
|
+ canShow.value = false;
|
|
|
|
|
+ if (isLogin.value) {
|
|
|
|
|
+
|
|
|
|
|
+ resetAllState();
|
|
|
|
|
+
|
|
|
|
|
+ Promise.allSettled([
|
|
|
|
|
+ getCartListFn(),
|
|
|
|
|
+ getInvalidList(),
|
|
|
|
|
+ getHostProduct()
|
|
|
|
|
+ ]).finally(() => {
|
|
|
|
|
+ // 添加一个短暂延迟,确保 DOM 更新完成
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ canShow.value = true;
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
// 隐藏原生 tabBar
|
|
// 隐藏原生 tabBar
|
|
|
uni.hideTabBar();
|
|
uni.hideTabBar();
|
|
|
-
|
|
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const onRefresh = () => {
|
|
|
|
|
+ console.log('refresj=========')
|
|
|
|
|
+ refreshing.value = true;
|
|
|
canShow.value = false;
|
|
canShow.value = false;
|
|
|
if (isLogin.value) {
|
|
if (isLogin.value) {
|
|
|
// 重置所有状态
|
|
// 重置所有状态
|
|
|
resetAllState();
|
|
resetAllState();
|
|
|
-
|
|
|
|
|
- // 设置加载状态
|
|
|
|
|
- // uni.showLoading({
|
|
|
|
|
- // title: '加载中...',
|
|
|
|
|
- // mask: true
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // 使用 Promise.allSettled 避免单个失败影响整体
|
|
|
|
|
|
|
+ console.log('+++++++++++++=========')
|
|
|
Promise.allSettled([
|
|
Promise.allSettled([
|
|
|
getCartListFn(),
|
|
getCartListFn(),
|
|
|
getInvalidList(),
|
|
getInvalidList(),
|
|
@@ -456,11 +480,12 @@ onShow(() => {
|
|
|
// 添加一个短暂延迟,确保 DOM 更新完成
|
|
// 添加一个短暂延迟,确保 DOM 更新完成
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
canShow.value = true;
|
|
canShow.value = true;
|
|
|
|
|
+ refreshing.value = false;
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
}, 50);
|
|
}, 50);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-});
|
|
|
|
|
|
|
+};
|
|
|
function resetAllState() {
|
|
function resetAllState() {
|
|
|
footerswitch.value = true;
|
|
footerswitch.value = true;
|
|
|
goodsHidden.value = false;
|
|
goodsHidden.value = false;
|
|
@@ -1111,7 +1136,6 @@ async function getCartListFn() {
|
|
|
|
|
|
|
|
const c = await getCartCounts(true, "sum");
|
|
const c = await getCartCounts(true, "sum");
|
|
|
cartCount.value = c.data.count;
|
|
cartCount.value = c.data.count;
|
|
|
-
|
|
|
|
|
// 当没有商品时,获取推荐商品
|
|
// 当没有商品时,获取推荐商品
|
|
|
if (c.data.count === 0) {
|
|
if (c.data.count === 0) {
|
|
|
await getHostProduct();
|
|
await getHostProduct();
|