fix: 上拉分页查询判断

This commit is contained in:
wangzhuo
2025-08-22 17:09:15 +08:00
parent 1703e5987c
commit 8389a78b3a
2 changed files with 80 additions and 77 deletions

View File

@@ -23,55 +23,59 @@
/> />
</view> </view>
<!-- 分页部分 --> <!-- 分页部分 top="68rpx" -->
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" <mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff" :up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff"
class="scroll-h" :class="{'loading-scroll':cssFlag}" class="scroll-h" :class="{'loading-scroll':cssFlag}"
> >
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" <block v-for="(item, index) in list" :key="index">
@touchstart="handleTouchStart(item)" <view class="white-bg margin-bottom20"
@touchend="handleTouchEnd"> @touchstart="handleTouchStart(item)"
<view class="report-list"> @touchend="handleTouchEnd"
<view class="w-b-title title" @dblclick.stop="handleDetail(item)"> v-if="item && item.auditStatus !== '办事处审核通过'"
{{ item.cusName }} >
<!--<view v-if="item.nodeCode" class="r-right btn-edit" @click.prevent="handleCopyInfo(item)"> 复制信息 </view>--> <view class="report-list">
</view> <view class="w-b-title title" @dblclick.stop="handleDetail(item)">
<view class="r-list"> {{ item.cusName }}
<view class="r-left">客户人员名称</view> <!--<view v-if="item.nodeCode" class="r-right btn-edit" @click.prevent="handleCopyInfo(item)"> 复制信息 </view>-->
<view class="r-right">{{ item.userName }}</view> </view>
</view> <view class="r-list">
<view class="border-bottom"></view> <view class="r-left">客户人员名称</view>
<view class="r-right">{{ item.userName }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">性别</view>
<view class="r-right">{{ item.sex }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">手机号</view>
<view class="r-right">{{ item.mobilePhone || item.iphone }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">部门</view>
<view class="r-right">{{ item.userDept }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">业务员认定等级</view>
<view class="r-right">{{ item.salesmanThinkLevel }}</view>
</view>
<!--<view v-if="item.systemThinkLevel" class="r-list">
<view class="r-left">系统认定等级</view>
<view class="r-right">{{ item.systemThinkLevel }}</view>
</view>-->
<view class="r-list">
<view class="r-left">性别</view>
<view class="r-right">{{ item.sex }}</view>
</view> </view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">手机号</view>
<view class="r-right">{{ item.mobilePhone || item.iphone }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">部门</view>
<view class="r-right">{{ item.userDept }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">业务员认定等级</view>
<view class="r-right">{{ item.salesmanThinkLevel }}</view>
</view>
<!-- <view v-if="item.systemThinkLevel" class="r-list">
<view class="r-left">系统认定等级</view>
<view class="r-right">{{ item.systemThinkLevel }}</view>
</view>-->
</view> </view>
</view> </block>
</mescroll-uni> </mescroll-uni>
</view> </view>
</view> </view>
@@ -113,7 +117,7 @@ let handleSearch = () => {
watch(searchValue, (newValue, oldValue) => { watch(searchValue, (newValue, oldValue) => {
handleSearch() handleSearch()
}) })
let clearSearchValue = ()=>{ let clearSearchValue = () => {
searchValue.value = ''; searchValue.value = '';
} }
// 查询列表 // 查询列表
@@ -151,7 +155,7 @@ const downCallback = async (mescroll) => {
list.value = res.list; list.value = res.list;
cssFlag.value = false; cssFlag.value = false;
// 正确传递 total 参数 // 正确传递 total 参数
mescroll.endSuccess(res.list.length, res.total > (mescroll.size || upOption.page.size)); mescroll.endSuccess(res.list.length, res.total >= mescroll.size);
uni.hideLoading(); uni.hideLoading();
}, 500); }, 500);
@@ -173,7 +177,7 @@ const upCallback = async (mescroll) => {
list.value.push(...res.list); list.value.push(...res.list);
} }
// 正确判断是否还有更多数据 // 正确判断是否还有更多数据
mescroll.endSuccess(res.list.length, res.total > mescroll.num * mescroll.size); mescroll.endSuccess(res.list.length, res.total >= mescroll.size);
uni.hideLoading(); uni.hideLoading();
}, 500); }, 500);
} catch (error) { } catch (error) {
@@ -203,10 +207,8 @@ const getList = (pageIndex, pageSize) => {
let handleDetail = (item) => { let handleDetail = (item) => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/business/CRM/customer/components/customerUserEdit", url: "/pages/business/CRM/customer/components/customerUserEdit",
events: { events: {},
success(res) {
},
success(res){
res.eventChannel.emit('editCusData', {param: item, isAdd: false}) res.eventChannel.emit('editCusData', {param: item, isAdd: false})
} }
}) })
@@ -216,8 +218,8 @@ let handleDetail = (item) => {
let touchTimerId = null; let touchTimerId = null;
// 开始触摸 // 开始触摸
let handleTouchStart = (item)=>{ let handleTouchStart = (item) => {
touchTimerId = setTimeout(()=>{ touchTimerId = setTimeout(() => {
// console.log(item, "长按客户人员项") // console.log(item, "长按客户人员项")
handleChange(item) handleChange(item)
@@ -226,39 +228,39 @@ let handleTouchStart = (item)=>{
} }
// 结束触摸 // 结束触摸
let handleTouchEnd = ()=>{ let handleTouchEnd = () => {
if(touchTimerId !== null){ if (touchTimerId !== null) {
clearTimeout(touchTimerId); clearTimeout(touchTimerId);
} }
} }
// 变更主归属人 // 变更主归属人
let handleChange = (item)=>{ let handleChange = (item) => {
uni.showModal({ uni.showModal({
title: '是否将该客户人员主的归属人变更为自己?', title: '是否将该客户人员主的归属人变更为自己?',
editable: true, editable: true,
placeholderText: '请输入变更理由', placeholderText: '请输入变更理由',
success(res){ success(res) {
if(res.confirm){ if (res.confirm) {
if(res.content){ if (res.content) {
submissionOfChangeOfMainOwner({ submissionOfChangeOfMainOwner({
userId: item.userId, userId: item.userId,
userName: item.userName, userName: item.userName,
reasonForChange: res.content reasonForChange: res.content
}).then(res=>{ }).then(res => {
if(res.code===200){ if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '操作成功' title: '操作成功'
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: '操作失败', title: '操作失败',
icon: 'error' icon: 'error'
}) })
} }
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: '操作失败!变更原因不能为空', title: '操作失败!变更原因不能为空',
icon: 'none' icon: 'none'
@@ -270,21 +272,21 @@ let handleChange = (item)=>{
} }
// 复制信息 // 复制信息
let handleCopyInfo=(item)=>{ let handleCopyInfo = (item) => {
const {cusName, userName, sex, iphone, mobilePhone, jobTelphone, userDept, salesmanThinkLevel} = item; const {cusName, userName, sex, iphone, mobilePhone, jobTelphone, userDept, salesmanThinkLevel} = item;
/* item = JSON.stringify({ /* item = JSON.stringify({
'客户名称':item.cusName, '客户名称':item.cusName,
'客户人员名称': item.userName, '客户人员名称': item.userName,
'性别': item.sex, '性别': item.sex,
'手机号': item.iphone || item.mobilePhone || item.jobTelphone, '手机号': item.iphone || item.mobilePhone || item.jobTelphone,
'部门': item.userDept, '部门': item.userDept,
'业务员认定等级': item.salesmanThinkLevel} '业务员认定等级': item.salesmanThinkLevel}
); );
console.log(item, '复制信息');*/ console.log(item, '复制信息');*/
uni.setClipboardData({ uni.setClipboardData({
data: `客户名称:${cusName} data: `客户名称:${cusName}
客户人员名称:${userName} 客户人员名称:${userName}
性别:${iphone||mobilePhone||jobTelphone} 性别:${iphone || mobilePhone || jobTelphone}
部门:${userDept} 部门:${userDept}
业务员认定等级:${salesmanThinkLevel}`, 业务员认定等级:${salesmanThinkLevel}`,
success: function () { success: function () {
@@ -311,7 +313,6 @@ let handleCopyInfo=(item)=>{
} }
.search .btn-search { .search .btn-search {
border: none; border: none;
background: none; background: none;
@@ -338,12 +339,13 @@ let handleCopyInfo=(item)=>{
.white-bg { .white-bg {
padding-bottom: 10rpx; padding-bottom: 10rpx;
.w-b-title{
.w-b-title {
align-items: flex-start; align-items: flex-start;
} }
} }
.white-bg:hover{ .white-bg:hover {
//background-color: #f1f1f1; //background-color: #f1f1f1;
background-color: #f1f1f1; /* Chrome, Safari, Opera */ background-color: #f1f1f1; /* Chrome, Safari, Opera */
box-shadow: 0px 0px 5rpx white; box-shadow: 0px 0px 5rpx white;

View File

@@ -181,7 +181,8 @@ const upCallback = async (mescroll) => {
list.value.push(...res.list); list.value.push(...res.list);
} }
// 正确判断是否还有更多数据 // 正确判断是否还有更多数据
mescroll.endSuccess(res.list.length, res.total > mescroll.num * mescroll.size); mescroll.endBySize(res.list.length, res.total)
// mescroll.endSuccess(res.list.length, res.total > mescroll.num * mescroll.size);
}, 500); }, 500);
} catch (error) { } catch (error) {
console.log(error) console.log(error)