Commit 0fb8942c authored by 李驰骋's avatar 李驰骋

票账管理页面调整

parent 2727ebc4
/.DS_Store /.DS_Store
/unpackage /unpackage
/unpackage/ /unpackage/
/unpackage/dist/
/unpackage/
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"type" : "uniCloud" "type" : "uniCloud"
}, },
{ {
"playground" : "standard", "playground" : "custom",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
......
...@@ -6,7 +6,16 @@ ...@@ -6,7 +6,16 @@
</view> </view>
<view class="main"> <view class="main">
<view class="middle view"> <view class="middle view">
<view class="text-block text-block-last"> <view class="text-block">
<text class="middle-date">查询条件</text>
<view class="middle-date-des">
<picker @change="bindPickerOptionChange" :value="conditionOptionIndex" :range="dateOptions" range-key="label">
<text class="uni-input">{{dateOptions[conditionOptionIndex].label}}</text>
</picker>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
</view>
<view class="text-block" v-if="condition.option !== 'BT'">
<text class="middle-date">查询日期</text> <text class="middle-date">查询日期</text>
<view class="middle-date-des"> <view class="middle-date-des">
<view class="picker-year"> <view class="picker-year">
...@@ -22,15 +31,45 @@ ...@@ -22,15 +31,45 @@
</view> </view>
</view> </view>
</view> </view>
<view class="text-block" v-if="condition.option === 'BT'" key="start-date">
<text class="middle-date">开始日期</text>
<view class="middle-date-des">
<view class="picker-year">
<view class="uni-list-cell">
<view class="uni-list-cell-db">
<picker class="picker-block" @change="bindPickerStartDateChange" mode="date"
:value="condition.posting_date_start" fields='day'>
<text class="uni-input">{{condition.posting_date_start || '请选择开始日期'}}</text>
</picker>
</view>
</view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="text-block text-block-last" v-if="condition.option === 'BT'" key="end-date">
<text class="middle-date">结束日期</text>
<view class="middle-date-des">
<view class="picker-year">
<view class="uni-list-cell">
<view class="uni-list-cell-db">
<picker class="picker-block" @change="bindPickerEndDateChange" mode="date"
:value="condition.posting_date_end" fields='day'>
<text class="uni-input">{{condition.posting_date_end || '请选择结束日期'}}</text>
</picker>
</view>
</view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
</view>
</view>
</view> </view>
<view class="planout-block"> <view class="planout-block">
<button class="btn" type="default" @tap="search"> <button class="btn" type="default" @tap="search">
<text class="btn-text">查询</text> <text class="btn-text">查询</text>
</button> </button>
</view> </view>
<scroll-view :style='scrollHeight' class="scroll-area" scroll-y="true" lower-threshold='150' <list class="scroll-area view" scrollable loadmoreoffset='100' show-scrollbar='false' @loadmore="scrolltolower">
@scrolltolower='scrolltolower'>
<list class="scroll-area view" loadmoreoffset='100' show-scrollbar='false' @loadmore="scrolltolower">
<cell class="list-cell" v-for="(item,index) in lists" :key='index'> <cell class="list-cell" v-for="(item,index) in lists" :key='index'>
<view class="middle view planout-block-item"> <view class="middle view planout-block-item">
<view class="text-block"> <view class="text-block">
...@@ -58,14 +97,15 @@ ...@@ -58,14 +97,15 @@
</cell> </cell>
<cell> <cell>
<view class="loading-more" v-if='lists.length>0'> <view class="loading-more" v-if='lists.length>0'>
<text class="loading-more-text">-- 到底了 --</text> <text class="loading-more-text" v-if="lists.length >= page.totalCount && page.totalCount > 0">-- 到底了 --</text>
<text class="loading-more-text" v-else-if="isLoading">加载中...</text>
<text class="loading-more-text" v-else>上拉加载更多</text>
</view> </view>
<view class="loading-more" v-else> <view class="loading-more" v-else>
<text class="loading-more-text">暂无数据</text> <text class="loading-more-text">暂无数据</text>
</view> </view>
</cell> </cell>
</list> </list>
</scroll-view>
</view> </view>
</view> </view>
...@@ -88,8 +128,20 @@ ...@@ -88,8 +128,20 @@
loadingText: '加载中...', loadingText: '加载中...',
refreshing: false, refreshing: false,
isOpened: 'none', isOpened: 'none',
isLoading: false, // 添加加载状态,防止重复请求
// 日期查询选项:是、介于、小于等于、大于等于
dateOptions: [
{ label: '是', value: 'EQ' },
{ label: '介于', value: 'BT' },
{ label: '小于等于', value: 'LE' },
{ label: '大于等于', value: 'GE' }
],
conditionOptionIndex: 0, // 默认选择"是"
condition: { condition: {
posting_date: '' option: 'EQ', // 默认是"是"
posting_date: '', // 单个日期(用于EQ、LE、GE)
posting_date_start: '', // 开始日期(用于BT)
posting_date_end: '' // 结束日期(用于BT)
}, },
lists: [], lists: [],
page: { page: {
...@@ -110,11 +162,6 @@ ...@@ -110,11 +162,6 @@
'height': `${this.sysinfo.safeArea.height }px`, 'height': `${this.sysinfo.safeArea.height }px`,
} }
}, },
scrollHeight() {
return {
'height': `${this.sysinfo.safeArea.height - 180 - 44}px`,
}
},
...mapState(['sysinfo', 'userInfo', 'userBpData']) ...mapState(['sysinfo', 'userInfo', 'userBpData'])
}, },
created() { created() {
...@@ -122,34 +169,73 @@ ...@@ -122,34 +169,73 @@
// this.queryData(1); // this.queryData(1);
}, },
methods: { methods: {
bindPickerOptionChange(e) {
this.conditionOptionIndex = e.detail.value
this.condition.option = this.dateOptions[e.detail.value].value
// 切换选项时清空日期
this.condition.posting_date = ''
this.condition.posting_date_start = ''
this.condition.posting_date_end = ''
},
bindPickerDateChange(e) { bindPickerDateChange(e) {
this.condition.posting_date = e.detail.value this.condition.posting_date = e.detail.value
}, },
bindPickerStartDateChange(e) {
this.condition.posting_date_start = e.detail.value
},
bindPickerEndDateChange(e) {
this.condition.posting_date_end = e.detail.value
},
search() { search() {
this.lists = []; this.lists = [];
this.page.page = 1; this.page.page = 1;
this.page.totalCount = 0; // 重置总数
this.queryData(1); this.queryData(1);
}, },
scrolltolower() { scrolltolower() {
if (this.lists.length >= this.page.totalCount) { // 防止重复请求
if (this.isLoading) {
return;
}
// 判断是否已加载完所有数据
if (this.lists.length >= this.page.totalCount && this.page.totalCount > 0) {
return; return;
} }
this.page.page++; this.page.page++;
this.queryData(this.page.page); this.queryData(this.page.page);
}, },
async queryData(pageNo) { async queryData(pageNo) {
// 防止重复请求
if (this.isLoading) {
return;
}
this.isLoading = true;
// 构建查询条件对象,与PC端格式保持一致 // 构建查询条件对象,与PC端格式保持一致
const allConditions = {} const allConditions = {}
// 处理日期条件,单个日期查询(EQ),转换为SAP格式数组(属性名小写,与PC端保持一致) // 处理日期条件,根据选项类型构建不同的查询条件(属性名小写,与PC端保持一致)
if (this.condition.option === 'BT') {
// 介于:需要开始日期和结束日期
if (this.condition.posting_date_start || this.condition.posting_date_end) {
allConditions.posting_date = [{
sign: 'I',
option: 'BT',
low: this.condition.posting_date_start || '',
high: this.condition.posting_date_end || ''
}]
}
} else if (this.condition.option === 'EQ' || this.condition.option === 'LE' || this.condition.option === 'GE') {
// 是、小于等于、大于等于:只需要单个日期
if (this.condition.posting_date) { if (this.condition.posting_date) {
allConditions.posting_date = [{ allConditions.posting_date = [{
sign: 'I', sign: 'I',
option: 'EQ', option: this.condition.option,
low: this.condition.posting_date, low: this.condition.posting_date,
high: '' high: ''
}] }]
} }
}
// 处理客户条件(如果存在) // 处理客户条件(如果存在)
if (this.condition.customer && this.condition.customer.length > 0) { if (this.condition.customer && this.condition.customer.length > 0) {
...@@ -175,22 +261,41 @@ ...@@ -175,22 +261,41 @@
...allConditions, ...allConditions,
page: pageNo, page: pageNo,
pagesize: this.page.pagesize, pagesize: this.page.pagesize,
totalCount: this.page.totalCount, totalCount: pageNo === 1 ? 0 : this.page.totalCount, // 第一页时重置totalCount
is_result: 1, is_result: 1,
sort: [] sort: []
} }
try {
if (pageNo === 1) {
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
}
const res = await apiGetMarketSupportFee(params); const res = await apiGetMarketSupportFee(params);
if (pageNo === 1) {
uni.hideLoading(); uni.hideLoading();
}
if (res && res.data) { if (res && res.data) {
if (pageNo === 1) { if (pageNo === 1) {
this.lists = res.data || []; this.lists = res.data || [];
} else { } else {
this.lists = this.lists.concat(res.data || []); this.lists = this.lists.concat(res.data || []);
} }
this.page.totalCount = res?.TOTALCOUNT || res?.totalCount || res?.Total || this.page.totalCount; // 更新总数,优先使用后端返回的总数
const totalCount = res?.TOTALCOUNT || res?.totalCount || res?.Total || 0;
if (totalCount > 0) {
this.page.totalCount = totalCount;
}
}
} catch (error) {
console.error('查询失败', error);
if (pageNo === 1) {
uni.hideLoading();
}
} finally {
this.isLoading = false;
} }
} }
} }
...@@ -236,8 +341,10 @@ ...@@ -236,8 +341,10 @@
.main { .main {
position: relative; position: relative;
flex-direction: column; flex-direction: column;
flex: 1;
margin-top: -164rpx; margin-top: -164rpx;
padding: 0 16rpx; padding: 0 16rpx;
min-height: 0;
} }
.middle { .middle {
...@@ -282,6 +389,16 @@ ...@@ -282,6 +389,16 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
position: relative;
}
.middle-date-des picker {
flex: 1;
min-width: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
} }
.picker-year { .picker-year {
...@@ -386,7 +503,7 @@ ...@@ -386,7 +503,7 @@
} }
.scroll-area { .scroll-area {
overflow-y: scroll; flex: 1;
} }
.list-cell { .list-cell {
......
...@@ -35,6 +35,13 @@ ...@@ -35,6 +35,13 @@
</view> </view>
<text class="entry-bill-text">销售订单</text> <text class="entry-bill-text">销售订单</text>
</view> </view>
<view class="entry-block" @click="goPage('ticket-order')" v-if='!isChildCustomer'>
<view class="entry-bill">
<image class="entry-bill-icon entry-bill-icon_billing"
src="@/static/image/usercenter_ticketorder@3x.png" mode=""></image>
</view>
<text class="entry-bill-text">制票通知单</text>
</view>
<view class="entry-block" @click="goPage('billing-invoice')"> <view class="entry-block" @click="goPage('billing-invoice')">
<view class="entry-bill"> <view class="entry-bill">
...@@ -44,13 +51,6 @@ ...@@ -44,13 +51,6 @@
</view> </view>
<text class="entry-bill-text">账票管理</text> <text class="entry-bill-text">账票管理</text>
</view> </view>
<view class="entry-block" @click="goPage('ticket-order')" v-if='!isChildCustomer'>
<view class="entry-bill">
<image class="entry-bill-icon entry-bill-icon_billing"
src="@/static/image/usercenter_ticketorder@3x.png" mode=""></image>
</view>
<text class="entry-bill-text">制票通知单</text>
</view>
<!-- <view class="entry-block" @click="goPage('produce-order')"> <!-- <view class="entry-block" @click="goPage('produce-order')">
<view class="entry-bill"> <view class="entry-bill">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment