Browse Source

分页组件请求逻辑拆分

pull/89/head
zq 3 days ago
parent
commit
de33c5d48a
  1. 230
      src/components/Page.vue
  2. 284
      src/components/Page2.vue
  3. 223
      src/views/agent/checkOrderList.vue

230
src/components/Page.vue

@ -1,17 +1,17 @@
<template>
<div class="pagination flex gap10">
<!-- 首页按钮 -->
<GuipButton size="form" v-if="showFirstPage" @click="goToFirstPage" :disabled="page === 1">
<GuipButton size="form" v-if="showFirstPage" @click="goToFirstPage" :disabled="currentPage === 1">
首页
</GuipButton>
<!-- 上一页按钮 -->
<GuipButton size="form" v-if="showPrevPage" @click="goToPrevPage" :disabled="page === 1">
<GuipButton size="form" v-if="showPrevPage" @click="goToPrevPage" :disabled="currentPage === 1">
上一页
</GuipButton>
<!-- 当前页码 -->
<span v-if="showCurrentPage">{{ page }}</span>
<span v-if="showCurrentPage">{{ currentPage }}</span>
<!-- 下一页按钮 -->
<GuipButton size="form" v-if="showNextPage" @click="goToNextPage" :disabled="!hasNextPage">
@ -30,7 +30,9 @@
</div>
<!-- 总记录数 -->
<span v-if="showTotalRecords" class="total-records">{{ totalRecords }}条记录</span>
<span v-if="showTotalRecords" class="total-records">
{{ totalRecords }}条记录
</span>
</div>
</template>
@ -41,45 +43,50 @@ export default {
name: 'Pagination',
components: { GuipButton },
props: {
// URL
apiUrl: {
type: String,
required: true
//
currentPage: {
type: Number,
default: 1
},
//
hasNextPage: {
type: Boolean,
default: false
},
//
totalRecords: {
type: [Number, String],
default: 0
},
//
pageSize: {
type: Number,
default: 10
},
//
extraParams: {
type: Object,
default: () => ({})
//
isLoading: {
type: Boolean,
default: false
}
},
data() {
return {
page: 1,
jumpPage: 1,
end_page:0,
hasNextPage: false,
minId: null,
maxId: null,
totalRecords: 0,
buttonType:'',
totalPages: 1,
isLoading: false,
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU',
jumpPage: this.currentPage,
endPage: false
}
},
computed: {
//
totalPages() {
return Math.ceil(this.totalRecords / this.pageSize)
},
//
showFirstPage() {
return this.page > 2
return this.currentPage > 2;
},
//
showPrevPage() {
return this.page > 1
return this.currentPage > 1 || this.endPage
},
//
showCurrentPage() {
@ -87,11 +94,11 @@ export default {
},
//
showNextPage() {
return this.hasNextPage
return this.hasNextPage && !this.endPage
},
//
showLastPage() {
return !(this.end_page > 0) || this.hasNextPage
return !this.endPage
},
//
showJump() {
@ -99,157 +106,78 @@ export default {
},
//
showTotalRecords() {
return this.totalRecords > 0
}
},
created() {
this.fetchData()
},
methods: {
//
buildParams() {
const params = {
pagesize: this.pageSize,
page:this.page,
...this.extraParams
return Number(this.totalRecords) > 0
}
// maxidminid
if (this.page > 1) {
if (this.page === this.totalPages) {
//
params.maxid = this.maxId
} else {
//
if (this.buttonType == 'prev') {
params.maxid = this.maxId
} else {
params.minid = this.minId
}
}
}
if(this.end_page > 0){
delete params.page
delete params.maxid
delete params.minid
params.end_page = this.end_page
}else{
delete params.end_page
}
console.log(params,'params======');
return params
},
//
async fetchData() {
console.log('-----执行了');
this.isLoading = true
this.$emit('changeLoad',true)
try {
this.$http('POST', this.apiUrl, this.buildParams(), {
headers: {
'Auth': this.token
}
}).then(response => {
const data = response.data
this.hasNextPage = data.is_has_next_page
this.minId = data.minid || null
this.maxId = data.maxid || null
this.totalRecords = data.total_records || 0
if(this.totalRecords > 0){
//
this.totalPages = Math.ceil(this.totalRecords / this.pageSize)
this.page = this.totalPages || 1
this.jumpPage = this.page
}
//
this.$emit('update', data)
this.$emit('changeLoad',false)
})
} catch (error) {
console.error('分页请求失败:', error)
this.$emit('error', error)
this.$emit('changeLoad',false)
} finally {
this.isLoading = false
this.$emit('changeLoad',false)
watch: {
currentPage(newVal) {
this.jumpPage = newVal
}
},
methods: {
//
goToFirstPage() {
if (this.page === 1) return
this.page = 1
this.jumpPage = 1
this.end_page = 0;
this.buttonType = ''
this.fetchData()
if (this.currentPage === 1 || this.isLoading) return
this.endPage = false
this.$emit('page-change', {
page: 1,
endPage: false,
direction: 'first'
})
},
//
goToPrevPage() {
if (this.page <= 1) return
this.page--
this.jumpPage = this.page
this.end_page = 0;
this.buttonType = 'prev'
this.fetchData()
if (this.currentPage <= 1 || this.isLoading) return
this.endPage = false
this.$emit('page-change', {
page: this.currentPage - 1,
endPage: false,
direction: 'prev'
})
},
//
goToNextPage() {
if (!this.hasNextPage)return
this.page++
this.end_page = 0;
this.jumpPage = this.page
this.buttonType = 'next'
this.fetchData()
if (!this.hasNextPage || this.isLoading) return
this.endPage = false
this.$emit('page-change', {
page: this.currentPage + 1,
endPage: false,
direction: 'next'
})
},
//
goToLastPage() {
// if (this.page === this.totalPages) return
// this.page = this.totalPages
// this.jumpPage = this.totalPages
this.end_page = 1;
this.buttonType = ''
this.fetchData()
if (this.endPage || this.isLoading) return
this.endPage = true
this.$emit('page-change', {
page: this.totalPages,
endPage: true,
direction: 'last'
})
},
//
handleJump() {
let page = parseInt(this.jumpPage)
if (isNaN(page)) page = 1
if (isNaN(page) || page < 1) {
page = 1
//
if (page > this.totalPages) {
page = this.totalPages
this.jumpPage = page
}
// else if (page > this.totalPages) {
// page = this.totalPages
// }
if (page === this.page) return
if (page === this.currentPage || this.isLoading) return
this.page = page
this.jumpPage = page
this.fetchData()
}
},
watch: {
apiUrl() {
this.page = 1
this.fetchData()
},
pageSize() {
this.page = 1
this.fetchData()
},
extraParams: {
deep: true,
handler() {
this.page = 1
this.fetchData()
}
this.endPage = false
this.$emit('page-change', {
page,
endPage: false,
direction: 'jump'
})
}
}
}

284
src/components/Page2.vue

@ -0,0 +1,284 @@
<template>
<div class="pagination flex gap10">
<!-- 首页按钮 -->
<GuipButton size="form" v-if="showFirstPage" @click="goToFirstPage" :disabled="page === 1">
首页
</GuipButton>
<!-- 上一页按钮 -->
<GuipButton size="form" v-if="showPrevPage" @click="goToPrevPage" :disabled="page === 1">
上一页
</GuipButton>
<!-- 当前页码 -->
<span v-if="showCurrentPage">{{ page }}</span>
<!-- 下一页按钮 -->
<GuipButton size="form" v-if="showNextPage" @click="goToNextPage" :disabled="!hasNextPage">
下一页
</GuipButton>
<!-- 尾页按钮 -->
<GuipButton size="form" v-if="showLastPage" @click="goToLastPage">
尾页
</GuipButton>
<!-- 跳转输入 -->
<div class="page-jump flex gap10" v-if="showJump">
<input type="number" v-model.number="jumpPage" min="1" :max="totalPages">
<GuipButton size="form" @click="handleJump">跳转</GuipButton>
</div>
<!-- 总记录数 -->
<span v-if="showTotalRecords" class="total-records">{{ totalRecords }}条记录</span>
</div>
</template>
<script>
import GuipButton from '@/components/GuipButton.vue';
// 使
// <!-- <Page
// :api-url="'/agentnew/ajax_get_check_order_list'"
// :page-size="10"
// @update="handleUpdate"
// @error="handleError"
// @changeLoad="changeLoad"
// /> -->
export default {
name: 'Pagination',
components: { GuipButton },
props: {
// URL
apiUrl: {
type: String,
required: true
},
//
pageSize: {
type: Number,
default: 10
},
//
extraParams: {
type: Object,
default: () => ({})
}
},
data() {
return {
page: 1,
jumpPage: 1,
end_page: 0,
hasNextPage: false,
minId: null,
maxId: null,
totalRecords: 0,
buttonType: '',
totalPages: 1,
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU',
}
},
computed: {
//
showFirstPage() {
return this.page > 2
},
//
showPrevPage() {
return this.page > 1
},
//
showCurrentPage() {
return true
},
//
showNextPage() {
return this.hasNextPage
},
//
showLastPage() {
return !(this.end_page > 0) || this.hasNextPage
},
//
showJump() {
return true
},
//
showTotalRecords() {
return this.totalRecords > 0
}
},
created() {
this.fetchData()
},
methods: {
//
buildParams() {
const params = {
pagesize: this.pageSize,
page: this.page,
...this.extraParams
}
// maxidminid
if (this.page > 1) {
if (this.page === this.totalPages) {
//
params.maxid = this.maxId
} else {
//
if (this.buttonType == 'prev') {
params.maxid = this.maxId
} else {
params.minid = this.minId
}
}
}
if (this.end_page > 0) {
delete params.page
delete params.maxid
delete params.minid
params.end_page = this.end_page
} else {
delete params.end_page
}
console.log(params, 'params======');
return params
},
//
async fetchData() {
console.log('-----执行了');
this.$emit('changeLoad', true)
try {
this.$http('POST', this.apiUrl, this.buildParams(), {
headers: {
'Auth': this.token
}
}).then(response => {
const data = response.data
this.hasNextPage = data.is_has_next_page
this.minId = data.minid || null
this.maxId = data.maxid || null
this.totalRecords = data.total_records || 0
if (this.totalRecords > 0) {
//
this.totalPages = Math.ceil(this.totalRecords / this.pageSize)
this.page = this.totalPages || 1
this.jumpPage = this.page
this.end_page = 1;
}
//
this.$emit('update', data)
this.$emit('changeLoad', false)
})
} catch (error) {
console.error('分页请求失败:', error)
this.$emit('error', error)
this.$emit('changeLoad', false)
} finally {
this.$emit('changeLoad', false)
}
},
//
goToFirstPage() {
if (this.page === 1) return
this.page = 1
this.jumpPage = 1
this.end_page = 0;
this.buttonType = ''
this.fetchData()
},
//
goToPrevPage() {
if (this.page <= 1) return
this.page--
this.jumpPage = this.page
this.end_page = 0;
this.buttonType = 'prev'
this.fetchData()
},
//
goToNextPage() {
if (!this.hasNextPage) return
this.page++
this.end_page = 0;
this.jumpPage = this.page
this.buttonType = 'next'
this.fetchData()
},
//
goToLastPage() {
// if (this.page === this.totalPages) return
// this.page = this.totalPages
// this.jumpPage = this.totalPages
this.end_page = 1;
this.buttonType = ''
this.fetchData()
},
//
handleJump() {
let page = parseInt(this.jumpPage)
if (isNaN(page) || page < 1) {
page = 1
}
// else if (page > this.totalPages) {
// page = this.totalPages
// }
if (page === this.page) return
this.page = page
this.jumpPage = page
this.fetchData()
}
},
watch: {
apiUrl() {
this.page = 1
this.fetchData()
},
pageSize() {
this.page = 1
this.fetchData()
},
extraParams: {
deep: true,
handler() {
this.page = 1
this.fetchData()
}
}
}
}
</script>
<style scoped>
.pagination {
display: flex;
align-items: center;
justify-content: flex-end;
margin: 20px 0;
gap: 10px;
}
.page-jump input {
width: 50px;
padding: 5px;
border: 1px solid #ddd;
border-radius: 3px;
text-align: center;
}
.total-records {
margin-left: 10px;
color: #666;
}
</style>

223
src/views/agent/checkOrderList.vue

@ -7,16 +7,29 @@
<div class="elementWrap mb-10">
<el-form>
<div class="flex-between operateBtns">
<b>筛选及导出列表</b>
<div class="flex gap24">
<GuipButton size="table" type="ignore" @click="resetSearchParams">清空</GuipButton>
<GuipButton size="table" type="system" @click="getFilterParams">筛选</GuipButton>
<GuipButton size="table" type="primary">导出</GuipButton>
</div>
</div>
<div class="flex">
<p class="mr-12">时间范围</p>
<el-date-picker class="mr-32" v-model="searchDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
<el-date-picker class="mr-32" v-model="searchDate" type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
<GuipSelect class="mr-32" label="服务类型" v-model="searchType" :options="siteList" valueKey="uid" labelKey="name" @change="changeSearchSite()" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" label="服务类型" v-model="searchType" :options="siteList" valueKey="uid"
labelKey="name" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" label="站点" v-model="searchUid" :options="siteList" valueKey="uid" labelKey="name" @change="changeSearchSite()" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" label="站点" v-model="searchUid" :options="siteList" valueKey="uid"
labelKey="name" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" width="100px" label="报告状态" v-model="searchStatus" :options="searchStatusList" valueKey="uid" labelKey="name" @change="changeSearchSite()" :extraItem="{label:'全部',value:'all'}" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" width="100px" label="报告状态" v-model="searchStatus"
:options="searchStatusList" valueKey="uid" labelKey="name"
:extraItem="{ label: '全部', value: 'all' }" defaultValue="" placeholder="不限" clearable />
</div>
</el-form>
</div>
@ -28,15 +41,19 @@
<div class="flex" style="justify-content: space-between;">
<div class="flex">
<h3 class="checktitle mr-24">查重列表</h3>
<GuipSelect class="mr-32" label="报告格式" v-model="searchUid" :options="siteList" valueKey="uid" labelKey="name" @change="changeSearchSite()" defaultValue="" placeholder="不限" clearable />
<GuipSelect class="mr-32" label="报告格式" v-model="searchUid" :options="siteList"
valueKey="uid" labelKey="name" @change="changeSearchSite()" defaultValue=""
placeholder="不限" clearable />
</div>
<GuipInput label="订单号" v-model="searchTid" @blur="changeSearchTid()" placeholder="请输入订单号" ref="GuipInput" />
<GuipInput label="订单号" v-model="searchTid" @blur="changeSearchTid()" placeholder="请输入订单号"
ref="GuipInput" />
</div>
<PromptText class="my-32" text='订单提示:电商订单,提交检测后会自动发货,请勿手动发货、代收款订单,退款须由平台操作,不可私自退款' :type="2" />
<GuipTable :tableData="orderList" ref="multipleTable" autoColumn="true" :loading="tableLoading" max-height="400px">
<GuipTable :tableData="orderList" ref="multipleTable" autoColumn="true" :loading="tableLoading"
max-height="400px">
<el-table-column prop="sitename" label="站点" fixed="left" min-width="60px">
<template slot-scope="scope">
<div class="flex">
@ -71,14 +88,16 @@
<template slot-scope="scope">
<div class="flex" v-if="scope.row.status == 1">
<GuipToolTip :content="'下载报告 作者:' + scope.row.author + ' 标题:' + scope.row.title">
<a :href="'http://'+scope.row.domain+'/report/tid/'+tid+'/sid/'+scope.row.sale_id" target="_blank" v-for="tid in scope.row.tids" :key="tid">{{ tid }}</a>
<a :href="'http://' + scope.row.domain + '/report/tid/' + tid + '/sid/' + scope.row.sale_id"
target="_blank" v-for="tid in scope.row.tids" :key="tid">{{ tid }}</a>
</GuipToolTip>
</div>
<div class="" v-else>
<p v-for="tid in scope.row.tids" :key="tid">
{{ tid }}
<GuipToolTip content="待发货">
<img v-if="scope.row.pay_type==11 && scope.row.pdd_is_wait_deliver_goods[tid]==true" class="wh-16 ml-7" src="@/assets/wait_deliver_goods.svg" />
<img v-if="scope.row.pay_type == 11 && scope.row.pdd_is_wait_deliver_goods[tid] == true"
class="wh-16 ml-7" src="@/assets/wait_deliver_goods.svg" />
</GuipToolTip>
</p>
@ -122,22 +141,27 @@
<div v-if="scope.row.status == 1" class="status-item divgreen">
<span class="fontgreen">{{ scope.row.status_desc }}</span>
</div>
<div v-else-if="scope.row.status==3 || scope.row.status==11 || scope.row.status==12" class="status-item divblue">
<div v-else-if="scope.row.status == 3 || scope.row.status == 11 || scope.row.status == 12"
class="status-item divblue">
<span class="fontblue">{{ scope.row.status_desc }}</span>
</div>
<div v-else-if="scope.row.status==2 || scope.row.status==10 || scope.row.status==4" class="status-item divred">
<div v-else-if="scope.row.status == 2 || scope.row.status == 10 || scope.row.status == 4"
class="status-item divred">
<span class="fontred">{{ scope.row.status_desc }}</span>
</div>
<div v-else-if="scope.row.status==0 || scope.row.status==8" class="status-item divgray">
<div v-else-if="scope.row.status == 0 || scope.row.status == 8"
class="status-item divgray">
<span class="fontgray">{{ scope.row.status_desc }}</span>
</div>
<div v-else-if="scope.row.status == 5" class="status-item divorange">
<span class="fontorange">{{ scope.row.status_desc }}</span>
</div>
<div v-else-if="scope.row.status==6 || scope.row.status==7" class="status-item divpurple">
<div v-else-if="scope.row.status == 6 || scope.row.status == 7"
class="status-item divpurple">
<span class="fontpurple">{{ scope.row.status_desc }}</span>
</div>
<GuipToolTip v-if="scope.row.status==1 && scope.row.is_downloaded_report==1" content="已下载报告标识">
<GuipToolTip v-if="scope.row.status == 1 && scope.row.is_downloaded_report == 1"
content="已下载报告标识">
<img class="wh-16 ml-7" src="@/assets/downloaded.svg" />
</GuipToolTip>
@ -147,29 +171,20 @@
<el-table-column label="操作" fixed="right" min-width="120px">
<template slot-scope="scope">
<div class="flex">
<el-button v-if="scope.row.status==1" @click="showConfirmDelReport(scope.row)" type="text">删报告</el-button>
<el-button v-if="scope.row.status == 1" @click="showConfirmDelReport(scope.row)"
type="text">删报告</el-button>
</div>
</template>
</el-table-column>
</GuipTable>
<!-- <Page :total-records="orderListTotalRecords"
:is-has-next-page="isHasNextPage"
:page-size="orderListPageSize"
:current-page="orderListCurrentPage"
:next-min-id="orderListNextMinId"
:prev-max-id="orderListPrevMaxId"
@page-change="handlePageChange"></Page> -->
<Page
:api-url="'/agentnew/ajax_get_check_order_list'"
:page-size="10"
@update="handleUpdate"
@error="handleError"
@changeLoad="changeLoad"
/>
<Page :current-page="orderListCurrentPage" :has-next-page="isHasNextPage"
:total-records="orderListTotalRecords" :page-size="orderListPageSize" :is-loading="tableLoading"
@page-change="handlePageChange" />
</el-form>
</div>
<GuipDialog :dialogVisible="dialogVisibleDelReport" title="删除报告" confirmText="删除" cancelText="取消" :show-close-button="false"
:show-cancel-button="true" @confirm="confirmDelReport" @cancel="handleCancel"
<GuipDialog :dialogVisible="dialogVisibleDelReport" title="删除报告" confirmText="删除" cancelText="取消"
:show-close-button="false" :show-cancel-button="true" @confirm="confirmDelReport" @cancel="handleCancel"
@close="handleClose" @dialogVisibleChange="dialogVisibleChange">
<!-- 自定义内容 -->
<p class="mx-24 mt12 flex">是否删除 ID:{{ delReportId }} 报告删除后无法恢复</p>
@ -183,6 +198,7 @@
import GuipTable from '@/components/GuipTable.vue';
import GuipSelect from '@/components/GuipSelect.vue';
import GuipInput from '@/components/GuipInput.vue';
import GuipButton from '@/components/GuipButton.vue';
import GuipToolTip from '@/components/GuipToolTip.vue';
import GuipDialog from '@/components/GuipDialog.vue';
import Page from '@/components/Page.vue';
@ -193,6 +209,7 @@ export default {
components: {
GuipTable,
GuipSelect,
GuipButton,
GuipInput,
GuipToolTip,
GuipDialog,
@ -204,7 +221,7 @@ export default {
// AUTH
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTAwNTM3MjQsIm5iZiI6MTc1MDA1MzcyNCwiZXhwIjoxNzUyNjQ1NzI0LCJ1c2VyIjoic3VidXNlciIsImxvZ2luX3R5cGUiOjAsImFpZCI6IjEifQ.xyIqBLelB-k6jCifgRevBJTyg_Qrm6m1e4OcHhOpepU',
//
tableLoading: true,
tableLoading: false,
//
orderList: [],
orderListTotalRecords: 0,
@ -231,60 +248,72 @@ export default {
}
},
mounted() {
// this.getOrderList()
this.getOrderList()
},
methods: {
changeLoad(load){
this.tableLoading = load
},
handleUpdate(data) {
this.orderList = data.list;
this.searchStatusList = data.search_check_status
this.orderListTotalRecords = data.total_records
getFilterParams(){
console.log(this.searchDate,'searchDate===');
// this.getOrderList({
// searchDate:this.searchDate,
// searchStatus:this.searchStatus,
// searchType:this.searchType,
// })
},
resetSearchParams(){
this.searchDate = ''
this.searchStatus = ''
this.searchType = ''
// 使 $set
},
handleError(error) {
console.error('分页错误:', error)
//
},
getOrderList() {
var params = {
page: this.orderListCurrentPage,
getOrderList(params) {
this.tableLoading = true
try {
const requestParams = {
pagesize: this.orderListPageSize,
minid: this.orderListNextMinId,
maxid: this.orderListPrevMaxId,
end_page: this.orderListEndPage,
jump_to_page: this.orderListJumpToPage,
}
if (this.searchTid) {
params = {};
params.tid = this.searchTid
page: this.orderListCurrentPage,
...params
}
this.tableLoading = true
const that = this
that.orderList = []
this.$http('POST', '/agentnew/ajax_get_check_order_list', params,{
console.log(requestParams, 'requestParams===');
this.$http('POST', '/agentnew/ajax_get_check_order_list', requestParams, {
headers: {
'Auth': this.token
}
}).then(response => {
this.tableLoading = false
this.$nextTick(() => {
that.orderList = response.data.list
this.orderList = response.data.list
this.searchStatusList = response.data.search_check_status
this.orderListTotalRecords = response.data.total_records
this.orderListNextMinId = response.data.minid
this.orderListPrevMaxId = response.data.maxid
this.isHasNextPage = response.data.is_has_next_page
console.log(this.isHasNextPage, 'isHasNextPage')
// minIdmaxId
if (response.data.minid) this.orderListNextMinId = response.data.minid
if (response.data.maxid) this.orderListPrevMaxId = response.data.maxid
this.isHasNextPage = response.data.is_has_next_page;
if (this.orderListTotalRecords > 0) {
//
this.orderListCurrentPage = Math.ceil(this.orderListTotalRecords / this.orderListPageSize)
// this.page = this.totalPages || 1
// this.jumpPage = this.page
// this.end_page = 1;
}
// console.log(this.isHasNextPage, 'isHasNextPage')
})
}).catch(error => {
console.error(error, 'error')
})
} catch (error) {
console.error('数据加载失败:', error)
} finally {
this.tableLoading = false
}
},
getPayImg(pay_type) {
return require('@/assets/pay/pay_' + pay_type + '.svg');
},
@ -293,11 +322,11 @@ export default {
},
changeSearchSite() {
console.log(this.searchUid)
this.getOrderList()
// this.getOrderList()
},
changeSearchTid() {
console.log(this.searchTid)
this.getOrderList()
console.log(this.searchTid,'this.searchTid')
this.getOrderList({tid:this.searchTid})
},
// ---start
showConfirmDelReport(row) {
@ -338,33 +367,27 @@ export default {
},
// ---end
handlePageChange(params) {
// API
console.log('分页参数:', params);
//
this.orderListCurrentPage = params.page;
// minid/maxidAPI
if (params.isNext) {
// APIorderListNextMinId
this.orderListNextMinId = params.minid;
}
handlePageChange({ page, endPage, direction }) {
console.log(endPage, 'endPage===');
this.orderListCurrentPage = page
if (params.isPrev) {
// APIorderListPrevMaxId
this.orderListPrevMaxId = params.maxid;
}
const params = { page }
if (params.isLast) {
this.orderListEndPage = params.isLast;
//
if (direction === 'prev') {
params.maxid = this.orderListPrevMaxId
if (this.orderListNextMinId) params.minid = null
} else if (direction === 'next') {
params.minid = this.orderListNextMinId
if (this.orderListPrevMaxId) params.maxid = null
} else if (direction === 'last') {
params.end_page = 1
params.page = null
params.minid = null
params.maxid = null
}
if (params.isJump) {
this.orderListJumpToPage = params.page;
}
this.getOrderList()
this.getOrderList(params)
}
},
computed: {
@ -394,6 +417,10 @@ export default {
background: #fff;
}
.operateBtns {
padding: 17px 0;
}
::v-deep .custom-popover {
position: fixed !important;
// max-height: 290px;
@ -408,6 +435,7 @@ export default {
height: 16px;
z-index: 1;
}
.mb-10 {
margin-bottom: 10px;
}
@ -415,12 +443,15 @@ export default {
.mr-12 {
margin-right: 12px;
}
.mr-24 {
margin-right: 24px;
}
.mr-32 {
margin-right: 32px;
}
.my-32 {
margin-bottom: 32px;
margin-top: 32px;
@ -430,6 +461,7 @@ a {
text-decoration: none;
color: #006AFF;
}
a:hover {
text-decoration: underline;
}
@ -457,6 +489,7 @@ a:hover {
box-sizing: border-box;
border: 1px solid rgba(0, 194, 97, 0.6);
}
.fontgreen {
font-family: Microsoft YaHei UI;
font-size: 14px;
@ -466,11 +499,13 @@ a:hover {
letter-spacing: 0.08em;
color: #0DAF49;
}
.divblue {
background: #F2F7FF;
box-sizing: border-box;
border: 1px solid #BFDAFF;
}
.fontblue {
font-family: Microsoft YaHei UI;
font-size: 14px;
@ -486,6 +521,7 @@ a:hover {
box-sizing: border-box;
border: 1px solid #FFA39E;
}
.fontred {
font-family: Microsoft YaHei UI;
font-size: 14px;
@ -495,27 +531,33 @@ a:hover {
letter-spacing: 0.08em;
color: #FF4D4F;
}
.divgray {
background: #F6F7FA;
box-sizing: border-box;
border: 1px solid #DFE2E6;
}
.fontgray {
color: #626573;
}
.divorange {
background: #FFFBF2;
box-sizing: border-box;
border: 1px solid rgba(251, 131, 45, 0.38);
}
.fontorange {
color: #FB832D;
}
.divpurple {
background: #F9F2FF;
box-sizing: border-box;
border: 1px solid rgba(126, 118, 253, 0.28);
}
.fontpurple {
color: #6258FF;
}
@ -530,9 +572,8 @@ a:hover {
/* text/text_1 */
color: #1E2226;
}
.el-form-item {
margin-bottom: 0px
}
</style>
Loading…
Cancel
Save