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

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) setCurrentPage(newPage)
} }
watch(()=>props.page,(newval)=>{
currentPage.value =newval
})
watch(() => currentPage.value, (newval) => { watch(() => currentPage.value, (newval) => {
emits('change', newval) emits('change', newval)
emits('update:page', newval) emits('update:page', newval)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -221,7 +221,11 @@
{ {
title: '退出登录', title: '退出登录',
icon: '/static/indexImg/PAGE_SALES_SUMMARY.svg', 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') switchChange('address')
}, },
fail: function(err) { fail: function(err) {
uni.showToast({ console.log(err);
title:err, // uni.showToast({
icon:'error' // title:err,
}) // icon:'error'
// })
} }
}) })

View File

@ -56,14 +56,14 @@
<view style="height: 20rpx;"></view> <view style="height: 20rpx;"></view>
<view class="u-p-30 all-list u-flex u-flex-wrap gap-20"> <view class="u-p-30 all-list u-flex u-flex-wrap gap-20">
<view class="all-list-item" :class="{active:statusItemIndex==statusData.allListSel}" <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"> v-for="(statusItem,statusItemIndex) in statusData.allList" :key="statusItemIndex">
{{statusItem.label}} {{statusItem.label}}
</view> </view>
</view> </view>
<view class="u-flex u-p-t-30 u-p-b-30 u-p-l-20 u-p-r-20 gap-20"> <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 @click="moreShowHide">取消</up-button>
<up-button type="primary" @click="moreShowHide">确定</up-button> <up-button type="primary" @click="statusConfirm">确定</up-button>
</view> </view>
</up-popup> </up-popup>
@ -80,7 +80,7 @@
watch watch
} from 'vue'; } from 'vue';
const emits = defineEmits(['update:time', 'update:status','clearUser']) const emits = defineEmits(['update:time', 'update:status','clearUser','updateStatus'])
function userShowClose() { function userShowClose() {
userShow.value = false userShow.value = false
@ -187,7 +187,7 @@
function changeStatusSel(i) { function changeStatusSel(i) {
statusData.sel = i statusData.sel = i
emits('update:status', i) emits('updateStatus', i)
} }
function datePickerConfirm(e) { function datePickerConfirm(e) {
@ -195,8 +195,15 @@
emits('update:time', [e.start, e.end]) emits('update:time', [e.start, e.end])
} }
function changeAllListSel(i) { function changeAllListSel(i,item) {
statusData.allListSel = i statusData.allListSel = i
console.log(i);
}
function statusConfirm(){
const status=statusData.allList[statusData.allListSel].key
statusData.sel=status
emits('updateStatus',status)
moreShowHide()
} }
</script> </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"> <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> <up-search v-bind="search" v-model="search.val"></up-search>
</view> </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> </view>
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list> <order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
<template v-if="order.data.list.length>0"> <template v-if="order.data.list.length>0">
@ -68,6 +68,9 @@
console.log(order.data.page); console.log(order.data.page);
init() init()
} }
function updateQuery(key,e){
order.setQuery(key,e)
}
watch(()=>order.data.query.createdAt,(newval)=>{ watch(()=>order.data.query.createdAt,(newval)=>{
init() init()
}) })

View File

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