diff --git a/src/views/openpage/queryTraceInfo.vue b/src/views/openpage/queryTraceInfo.vue index a79b540..7a7af89 100644 --- a/src/views/openpage/queryTraceInfo.vue +++ b/src/views/openpage/queryTraceInfo.vue @@ -126,6 +126,7 @@ export default { }, created() { // this.queryData(); + this.recordLatestBill(); }, watch: { // "billCode": { @@ -152,13 +153,20 @@ export default { recordLatestBill(billCode){ const storage = window.localStorage.getItem('queryDataStorage') ? JSON.parse(window.localStorage.getItem('queryDataStorage')) : {} this.latestBillList = storage["latestBillList"] ? storage["latestBillList"] : []; - this.latestBillList.push(billCode); - let list= this.latestBillList.filter(function(item, index, arr) { - return arr.indexOf(item, 0) === index; - }) - this.latestBillList=list; - storage["latestBillList"] = this.latestBillList - window.localStorage.setItem('queryDataStorage', JSON.stringify(storage)) + + if(billCode){ + this.latestBillList.push(billCode); + let list= this.latestBillList.filter(function(item, index, arr) { + return arr.indexOf(item, 0) === index; + }) + this.latestBillList=list; + } + + if(this.latestBillList&&this.latestBillList.length>0){ + this.latestBillList= this.latestBillList.reverse() + storage["latestBillList"] = this.latestBillList + window.localStorage.setItem('queryDataStorage', JSON.stringify(storage)) + } }, latestClick(item){