2025-10-17
收货地址添加修改
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<view class="message-container">
|
||||
<scroll-view scroll-y="true" style="height: 100%;">
|
||||
<scroll-view scroll-y="true" :style="'height:'+height+'px'" @scrolltolower="loadMallData"
|
||||
:refresher-threshold="50" :refresher-triggered="isRefresher" refresher-background="transparent"
|
||||
refresher-enabled="true" @refresherrefresh="reflash">
|
||||
<view class="header-search">
|
||||
<u-search :action-style="searchBtn" shape="square" bg-color="#CADBFF" placeholder="输入商品名称或商品种类"
|
||||
v-model="keyword"></u-search>
|
||||
@@ -133,22 +135,32 @@
|
||||
</view>
|
||||
</template>
|
||||
</u-waterfall>
|
||||
<u-loadmore margin-top="20" :status="loadStatus"></u-loadmore>
|
||||
</view>
|
||||
|
||||
<u-loadmore margin-top="20" :status="loadStatus" color="#fff"></u-loadmore>
|
||||
<view class="box-div"></view>
|
||||
|
||||
</scroll-view>
|
||||
</view>
|
||||
<Tabbar id="tabbarId"></Tabbar>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref, onMounted
|
||||
ref, onMounted, getCurrentInstance
|
||||
} from 'vue';
|
||||
import { mallAPI } from '../../api/mall';
|
||||
import { getImageUrl } from '../../util/common';
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const height = ref(0)
|
||||
const loadHeight = () => {
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
let screenHeight = res.screenHeight
|
||||
uni.createSelectorQuery().in(instance.proxy).select("#tabbarId").boundingClientRect((data : any) => {
|
||||
height.value = screenHeight - data.height
|
||||
}).exec()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const keyword = ref('')
|
||||
const searchBtn = {
|
||||
@@ -167,11 +179,10 @@
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const params = ref({
|
||||
keyword: '',
|
||||
page: 1,
|
||||
limit: 5,
|
||||
limit: 10,
|
||||
category: ''
|
||||
})
|
||||
const mallList = ref([])
|
||||
@@ -192,17 +203,28 @@
|
||||
|
||||
// 加载数据
|
||||
const loadMallData = () => {
|
||||
console.log(111);
|
||||
if (loadStatus.value == 'nomore') return
|
||||
mallAPI.getMallList(params.value).then((res) => {
|
||||
console.log(res.data);
|
||||
mallList.value = mallList.value.concat(res.data.products)
|
||||
maxPage.value = res.data.pagination.pages
|
||||
params.value.page++
|
||||
if (maxPage.value < params.value.page) {
|
||||
loadStatus.value = 'nomore'
|
||||
}
|
||||
}).finally(() => {
|
||||
isRefresher.value = false
|
||||
})
|
||||
}
|
||||
const isRefresher = ref(false)
|
||||
const reflash = () => {
|
||||
isRefresher.value = true
|
||||
params.value.page = 1
|
||||
params.value.category = ''
|
||||
params.value.keyword = ''
|
||||
loadStatus.value = 'loadmore'
|
||||
loadMallData()
|
||||
}
|
||||
|
||||
const handleCheck = (item : any) => {
|
||||
uni.navigateTo({
|
||||
@@ -211,6 +233,7 @@
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadHeight()
|
||||
loadMallData()
|
||||
})
|
||||
</script>
|
||||
@@ -333,7 +356,7 @@
|
||||
|
||||
|
||||
.box-div {
|
||||
padding: 30rpx 0rpx;
|
||||
padding: 60rpx 0rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user