修复删除带来的列表页面数据为空未自动减少页码请求问题

This commit is contained in:
YeMingfei666 2024-10-15 16:07:28 +08:00
parent 15626e4d33
commit 982bc23d3f
12 changed files with 56 additions and 23 deletions

View File

@ -90,7 +90,9 @@
}
setCurrentPage(newPage)
}
watch(()=>props.page,(newval)=>{
currentPage.value =newval
})
watch(() => currentPage.value, (newval) => {
emits('change', newval)
emits('update:page', newval)

View File

@ -130,7 +130,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxcf0fe8cdba153fd6",
"appid" : "wxcbff1cfb27c1066c",
"setting" : {
"urlCheck" : false,
"minified" : true,

View File

@ -12,8 +12,8 @@
:showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category>
</view>
<view class="u-m-t-44">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements" @change="pageChange"></my-pagination>
<view class="u-m-t-44" v-if="pageData.list.length>0">
<my-pagination :page="pageData.query.page+1" :size="pageData.query.size" :totalElements="pageData.totalElements" @change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
</view>
@ -136,7 +136,7 @@
},
showGoodsDetail:false,
query:{
page: 1,
page: 0,
size:10
},
totalElements:0,
@ -302,6 +302,9 @@
const islast=pageData.list.length===1
$productCategory.del([pageData.list[index].id]).then(res=>{
infoBox.showToast('删除成功')
if(islast&&pageData.query.page>=1){
pageData.query.page-=1
}
// if(islast&&pageData.query.page>=1){
// pageData.query.page--
// }

View File

@ -9,8 +9,8 @@
@isShowChange="isSHowChange" :index="index" :data="item" :showChecked="showChecked"
:showDetail="pageData.showGoodsDetail"></my-category>
</view>
<view class="u-m-t-44">
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
<view class="u-m-t-44" v-if="pageData.list.length>0">
<my-pagination :page="pageData.query.page+1" :size="pageData.query.size" :totalElements="pageData.totalElements"
@change="pageChange"></my-pagination>
<view style="height: 200rpx;"></view>
</view>
@ -327,6 +327,9 @@
const islast = pageData.list.length === 1
$productCategory.del([pageData.list[index].id]).then(res => {
infoBox.showToast('删除成功')
if(islast&&pageData.query.page>=1){
pageData.query.page-=1
}
// if(islast&&pageData.query.page>=1){
// pageData.query.page--
// }

View File

@ -257,7 +257,7 @@
<uni-easyinput :paddingNone="inputPaddingNone"
@blur="priceFormat(sku,'firstShared')" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="sku.firstShared" type="digit"
placeholder="请输入起售数量" />
placeholder="请输入分销金额" />
</uni-forms-item>
<uni-forms-item label="商品条码">
<uni-easyinput disabled :paddingNone="inputPaddingNone"
@ -857,8 +857,9 @@
title: '删除成功'
})
setTimeout(() => {
uni.$emit('del:productIndex',option.productId)
go.back()
}, 1000)
}, 500)
})
}

View File

@ -52,7 +52,7 @@
<my-img-empty tips="未找到相关商品"></my-img-empty>
</template>
<template v-if="pageData.goodsList.length">
<my-pagination :totalElements="pageData.totalElements" :size="pageData.query.size"
<my-pagination :page="pageData.query.page+1" :totalElements="pageData.totalElements" :size="pageData.query.size"
@change="pageChange"></my-pagination>
</template>
@ -401,9 +401,17 @@
function watchEmitInit() {
uni.$off('update:productIndex')
uni.$off('del:productIndex')
uni.$on('update:productIndex', (data) => {
getGoodsList()
})
uni.$on('del:productIndex', (productId) => {
if(pageData.goodsList.length<=1){
pageData.query.page-=1
}
getGoodsList()
})
}
onShow(() => {
// getGoodsList()

View File

@ -41,7 +41,7 @@
</view>
</view>
</view>
<view class="u-flex-1 u-text-center">
<!-- <view class="u-flex-1 u-text-center">
<view class="font-bold color-000 pr-16">0</view>
<view class="u-flex u-row-center">
<view class="color-999">优惠券</view>
@ -55,7 +55,7 @@
<view class="u-flex u-row-center">
<view class="color-999">已消费</view>
</view>
</view>
</view> -->
</view>

View File

@ -221,7 +221,11 @@
{
title: '退出登录',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg',
pageUrl: 'PAGES_LOGIN'
pageUrl: 'PAGES_LOGIN',
clickFunc:()=>{
storageManage.cleanByLogout()
go.to('PAGES_LOGIN',{},'redirect')
}
}
];

View File

@ -356,10 +356,11 @@ let showMap = () => {
switchChange('address')
},
fail: function(err) {
uni.showToast({
title:err,
icon:'error'
})
console.log(err);
// uni.showToast({
// title:err,
// icon:'error'
// })
}
})

View File

@ -56,14 +56,14 @@
<view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}"
@click="changeAllListSel(statusItemIndex)"
@click="changeAllListSel(statusItemIndex,statusItem)"
v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}}
</view>
</view>
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20">
<up-button @click="moreShowHide">取消</up-button>
<up-button type="primary" @click="moreShowHide">确定</up-button>
<up-button type="primary" @click="statusConfirm">确定</up-button>
</view>
</up-popup>
@ -80,7 +80,7 @@
watch
} from 'vue';
const emits = defineEmits(['update:time', 'update:status','clearUser'])
const emits = defineEmits(['update:time', 'update:status','clearUser','updateStatus'])
function userShowClose() {
userShow.value = false
@ -187,7 +187,7 @@
function changeStatusSel(i) {
statusData.sel = i
emits('update:status', i)
emits('updateStatus', i)
}
function datePickerConfirm(e) {
@ -195,8 +195,15 @@
emits('update:time', [e.start, e.end])
}
function changeAllListSel(i) {
function changeAllListSel(i,item) {
statusData.allListSel = i
console.log(i);
}
function statusConfirm(){
const status=statusData.allList[statusData.allListSel].key
statusData.sel=status
emits('updateStatus',status)
moreShowHide()
}
</script>

View File

@ -4,7 +4,7 @@
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
<up-search v-bind="search" v-model="search.val"></up-search>
</view>
<filter-vue @clearUser="clearQueryUser" v-model:status="order.data.query.status" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
</view>
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
<template v-if="order.data.list.length>0">
@ -68,6 +68,9 @@
console.log(order.data.page);
init()
}
function updateQuery(key,e){
order.setQuery(key,e)
}
watch(()=>order.data.query.createdAt,(newval)=>{
init()
})

View File

@ -387,6 +387,7 @@ class SchemaValidator extends RuleValidator {
}
async validateUpdate(data, allData) {
console.log(allData);
let result = this._checkFieldInSchema(data)
if (!result) {
result = await this.invokeValidateUpdate(data, false, allData)