Commit 95bada66 authored by chicheng's avatar chicheng

经销商市场支持费用查询添加查询条件

parent 6a8f5e75
...@@ -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,6 +31,38 @@ ...@@ -22,6 +31,38 @@
</view> </view>
</view> </view>
</view> </view>
<view class="text-block" v-if="condition.option === 'BT'">
<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'">
<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">
...@@ -88,8 +129,19 @@ ...@@ -88,8 +129,19 @@
loadingText: '加载中...', loadingText: '加载中...',
refreshing: false, refreshing: false,
isOpened: 'none', isOpened: 'none',
// 日期查询选项:是、介于、小于等于、大于等于
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: {
...@@ -122,9 +174,23 @@ ...@@ -122,9 +174,23 @@
// 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;
...@@ -141,15 +207,28 @@ ...@@ -141,15 +207,28 @@
// 构建查询条件对象,与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) {
...@@ -282,6 +361,16 @@ ...@@ -282,6 +361,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 {
......
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