fix: unify account bill date filters

This commit is contained in:
qiuxiang 2026-09-23 17:45:04 +08:00
parent fd3ac23a36
commit 667cfd0b3a
2 changed files with 5 additions and 3 deletions

View File

@ -81,7 +81,9 @@ export default {
data(){return{loading:false,loadError:false,sync:null,rows:[],sourceColumns:[],configuredColumns:[],columnsTitle:'',sourceGroups:[],summary:{income:0,expense:0,balance:0,count:0},total:0,currentPage:1,lastPage:1,perPage:20,filters:emptyFilters(this.billType),queryFilters:emptyFilters(this.billType),resultFilters:null,filterOptions:{shops:[],bill_items:[]},filterOptionsLoading:false,filterOptionsError:false,requestSerial:0,sort:{key:'occurred_at',dir:'desc'},exportMode:'filtered-visible'};},
computed:{
isDouyin(){return this.billType==='douyin';},
usesStableDateControl(){return ['pinduoduo','dewu'].indexOf(this.billType)!==-1;},
// Every account-bill tab uses the same explicit picker path. Keeping one
// control avoids browser-native date inputs appearing on older tabs.
usesStableDateControl(){return true;},
usesMirrorOptions(){return ['douyin','pinduoduo','dewu','jd-transactions','jd-wallet'].indexOf(this.billType)!==-1;},
invalidDateRange(){return Boolean(this.filters.start&&this.filters.end&&this.filters.start>this.filters.end);},
startDateConfig(){return {...dateConfig,maxDate:this.filters.end||null};},

View File

@ -122,13 +122,13 @@ test('calendar selection submits both bounds, resets pagination and preserves da
assert.equal(opened, true);
});
test('authoritative pinduoduo and dewu pages enable the stable full-control date picker treatment', () => {
test('all account-bill pages enable the stable full-control date picker treatment', () => {
const { instance: pinduoduo } = component(async () => response(), 'pinduoduo');
const { instance: dewu } = component(async () => response(), 'dewu');
const { instance: douyin } = component(async () => response(), 'douyin');
assert.equal(pinduoduo.usesStableDateControl, true);
assert.equal(dewu.usesStableDateControl, true);
assert.equal(douyin.usesStableDateControl, false);
assert.equal(douyin.usesStableDateControl, true);
assert.match(sfc.template.content, /is-stable-date/);
assert.match(source, /\.tw-date\.is-stable-date \.tw-date-control/);
});