Browse Source

账单过滤type字段处理

Sinea 1 year ago
parent
commit
b640c9409a
1 changed files with 20 additions and 7 deletions
  1. 20 7
      pages/self/bill/filter.vue

+ 20 - 7
pages/self/bill/filter.vue

@@ -3,8 +3,8 @@
 		<view class="filter-item">
 			<view class="label">开票状态</view>
 			<view class="tag-group">
-				<view :class="{ item: true, active: filterForm.type === item }" v-for="(item, index) in typeOption" :key="index" @click="filterForm.type = item">
-					{{ item }}
+				<view :class="{ item: true, active: filterForm.type === item.value }" v-for="(item, index) in typeOption" :key="index" @click="filterForm.type = item.value">
+					{{ item.label }}
 				</view>
 			</view>
 		</view>
@@ -42,12 +42,25 @@ export default {
 		return {
 			filterForm: {
 				keyword: '',
-				type: '全部',
+				type: '',
 				date: '最近30天',
 				dateRanges: [],
 				sort: 'asc'
 			},
-			typeOption: ['全部', '应付账单', '应收账单'],
+			typeOption: [
+				{
+					label: '全部',
+					value: ''
+				},
+				{
+					label: '应付账单',
+					value: '应付'
+				},
+				{
+					label: '应收账单',
+					value: '应收'
+				}
+			],
 			dateOption: ['最近30天', '最近90天', '本季度', '本年度'],
 			sortOption: [
 				{
@@ -67,7 +80,7 @@ export default {
 			const isCustomDate = data.date.indexOf('至') > -1;
 			this.filterForm = {
 				keyword: data.keyword,
-				type: data.type === '' ? '全部' : data.type,
+				type: data.type,
 				date: isCustomDate ? '自定义' : data.date,
 				dateRanges: isCustomDate ? data.date.split('至') : [],
 				sort: data.sort
@@ -86,7 +99,7 @@ export default {
 			}
 			uni.$emit('updateData', {
 				keyword,
-				type: type === '全部' ? '' : type,
+				type,
 				date: date === '自定义' ? dateRanges.join('至') : date,
 				sort
 			});
@@ -95,7 +108,7 @@ export default {
 		handleReset() {
 			this.filterForm = {
 				keyword: this.filterForm.keyword,
-				type: '全部',
+				type: '',
 				date: '最近30天',
 				dateRanges: [],
 				sort: 'asc'