|
@@ -2,22 +2,25 @@
|
|
|
<view class="ldDetailed-container">
|
|
|
<!-- 筛选菜单 -->
|
|
|
<u-dropdown ref="uDropdown" class="filter-dropdown">
|
|
|
- <u-dropdown-item v-model="queryParam.recordType" :title="titType" :options="optionsType" @change="searchHandle(1)"></u-dropdown-item>
|
|
|
- <u-dropdown-item v-model="queryParam.recordScope" :title="titScope" :options="optionsScope" @change="searchHandle(1)"></u-dropdown-item>
|
|
|
+ <u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle()"></u-dropdown-item>
|
|
|
+ <u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle()"></u-dropdown-item>
|
|
|
</u-dropdown>
|
|
|
<scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
|
|
|
<!-- 列表数据 -->
|
|
|
<view class="cell-item-con">
|
|
|
<view class="cell-item" v-for="(item, index) in listdata" :key="index">
|
|
|
- <text class="cell-item-month">{{item.month}}</text>
|
|
|
- <view class="cell-item-main" v-for="(subItem, ind) in item.list" :key="ind">
|
|
|
- <text :class="['cell-item-pic', subItem.type == 1?'orange':'']">{{subItem.type == 1 ? '收' : '支'}}</text>
|
|
|
+ <text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text>
|
|
|
+ <view class="cell-item-main" v-for="(subItem, ind) in item.monthDataList" :key="ind">
|
|
|
+ <text :class="['cell-item-pic', subItem.changeType == 'ADD'?'orange':'']">{{subItem.changeType == 'ADD' ? '收' : '支'}}</text>
|
|
|
<view class="cell-item-c">
|
|
|
- <text class="cell-item-des">{{subItem.dec}}</text>
|
|
|
- <text class="cell-item-date">{{subItem.creatDate}}</text>
|
|
|
+ <text class="cell-item-des">{{subItem.remarks}}</text>
|
|
|
+ <text class="cell-item-date">{{subItem.createDate}}</text>
|
|
|
</view>
|
|
|
- <text :class="['cell-item-score', Number(subItem.score) > 0 ? 'red' : 'black']">{{Number(subItem.score)>0 ? '+'+subItem.score : subItem.score}}</text>
|
|
|
+ <text :class="['cell-item-score', subItem.changeType == 'ADD' ? 'red' : 'black']">
|
|
|
+ {{subItem.changeType == 'ADD' ? '+'+subItem.changeNum : subItem.changeNum}}
|
|
|
+ </text>
|
|
|
</view>
|
|
|
+ <u-empty class="nodata" :text="noDataText" v-if="item.monthDataList.length==0 && status!='loading'" mode="list"></u-empty>
|
|
|
</view>
|
|
|
</view>
|
|
|
<u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
|
|
@@ -29,92 +32,98 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {ldUsedQuery} from '@/api/user.js'
|
|
|
+ import getDate from '@/libs/getDate'
|
|
|
+ import moment from 'moment'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- listdata: [
|
|
|
- {
|
|
|
- month: '本月',
|
|
|
- list: [
|
|
|
- { type: 1, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: +25 },
|
|
|
- { type: 2, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: -30 },
|
|
|
- { type: 3, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: -15 },
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- month: '10月',
|
|
|
- list: [
|
|
|
- { type: 1, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: +25 },
|
|
|
- { type: 2, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: -30 },
|
|
|
- { type: 3, dec: '投递可回收物获得乐豆', creatDate: '2020-11-04 14:08', score: -15 },
|
|
|
- ]
|
|
|
- }
|
|
|
- ],
|
|
|
+ listdata: [],
|
|
|
pageNo: 1, // 当前页码
|
|
|
pageSize: 10, // 每页条数
|
|
|
total: 0, // 数据总条数
|
|
|
noDataText: '暂无数据', // 列表请求状态提示语
|
|
|
status: 'loadmore', // 加载中状态
|
|
|
+ timeScope: 'threeMonth', // 时间类别 1:近三个月 2:本月 3:本月前一月 4:本月前2月
|
|
|
queryParam: { // 过滤条件
|
|
|
- recordType: '',
|
|
|
- recordScope: ''
|
|
|
+ changeType: '', // 金币变更类型
|
|
|
},
|
|
|
optionsType: [
|
|
|
- { label: '所有记录', value: 1, },
|
|
|
- { label: '获取记录', value: 2, },
|
|
|
- { label: '使用记录', value: 3, }
|
|
|
+ { label: '所有记录', value: '', },
|
|
|
+ { label: '获取记录', value: 'ADD', },
|
|
|
+ { label: '使用记录', value: 'SUB', }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
- this.searchHandle(1)
|
|
|
+ this.searchHandle()
|
|
|
},
|
|
|
onLoad() {
|
|
|
+ this.timeScope = 'threeMonth'
|
|
|
+ this.queryParam.changeType = ''
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 时间过滤条件
|
|
|
optionsScope(){ // 过滤条件 近3个月
|
|
|
let arr = [
|
|
|
- { label: '近3个月', value: 1 },
|
|
|
- { label: '本月', value: 2 }
|
|
|
+ { label: '近3个月', value: 'threeMonth' },
|
|
|
+ { label: '本月', value: 'thisMonth' }
|
|
|
]
|
|
|
- arr[2] = { label: new Date().getMonth() + '月', value: 3 }
|
|
|
- arr[3] = { label: new Date().getMonth()-1 + '月', value: 4 }
|
|
|
+ arr[2] = { label: new Date().getMonth() + '月', value: 'lastMonth' }
|
|
|
+ arr[3] = { label: new Date().getMonth()-1 + '月', value: 'lastTwoMonth' }
|
|
|
return arr
|
|
|
},
|
|
|
titType(){ // 过滤条件 所有记录 title
|
|
|
- const row = this.optionsType.find(item => item.value == this.queryParam.recordType)
|
|
|
+ const row = this.optionsType.find(item => item.value == this.queryParam.changeType)
|
|
|
return row ? row.label : this.optionsType[0].label
|
|
|
},
|
|
|
titScope(){ // 过滤条件 近3个月 title
|
|
|
- const row = this.optionsScope.find(item => item.value == this.queryParam.recordScope)
|
|
|
+ const row = this.optionsScope.find(item => item.value == this.timeScope)
|
|
|
return row ? row.label : this.optionsScope[0].label
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 查询时间段
|
|
|
+ queryDate() {
|
|
|
+ var dt = new Date();
|
|
|
+ const threeTime = dt.setMonth( dt.getMonth()-2 )
|
|
|
+ const quickType = {
|
|
|
+ threeMonth: [moment(getDate.getThreeMonthDays().starttime), moment(getDate.getThreeMonthDays().endtime)],
|
|
|
+ lastMonth: [moment(getDate.getLastMonthDays().starttime), moment(getDate.getLastMonthDays().endtime)],
|
|
|
+ thisMonth: [moment(getDate.getCurrMonthDays().starttime), moment(getDate.getCurrMonthDays().endtime)],
|
|
|
+ lastTwoMonth: [moment(getDate.getLastTwoMonthDays().starttime), moment(getDate.getLastTwoMonthDays().endtime)],
|
|
|
+ }
|
|
|
+ let queryTime = {
|
|
|
+ beginDate: quickType[this.timeScope][0].format('YYYY-MM-DD'),
|
|
|
+ endDate: quickType[this.timeScope][1].format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ return queryTime
|
|
|
+ },
|
|
|
+
|
|
|
},
|
|
|
methods:{
|
|
|
// 搜索查询
|
|
|
- searchHandle (pageNo) {
|
|
|
+ searchHandle () {
|
|
|
this.status = "loading"
|
|
|
- pageNo ? this.pageNo = pageNo : null
|
|
|
- // searchSuppliers({
|
|
|
- // pageNo: this.pageNo,
|
|
|
- // pageSize: this.pageSize,
|
|
|
- // queryWord: this.queryValue
|
|
|
- // }).then(res => {
|
|
|
- // if (res.status == 200) {
|
|
|
- // if(this.pageNo>1){
|
|
|
- // this.listdata = this.listdata.concat(res.data.list || [])
|
|
|
- // }else{
|
|
|
- // this.listdata = res.data.list || []
|
|
|
- // }
|
|
|
- // this.total = res.data.count || 0
|
|
|
- // this.listdata.length == 0 && this.queryValue != '' ? this.noDataText = '没有搜索到相关结果' : this.noDataText = '暂无数据'
|
|
|
- // } else {
|
|
|
- // this.noDataText = res.message
|
|
|
- // this.listdata = []
|
|
|
- // this.total = 0
|
|
|
- // }
|
|
|
+ let params = Object.assign(this.queryParam,this.queryDate)
|
|
|
+ console.log(params,'pppppppp')
|
|
|
+ ldUsedQuery(params).then(res => {
|
|
|
+ console.log(res,'pppppppp')
|
|
|
+ if (res.status == 200) {
|
|
|
+ let list = res.data
|
|
|
+ // 查询3个月时 数据处理
|
|
|
+ if (this.timeScope == 'threeMonth') {
|
|
|
+ list.map(item=>{
|
|
|
+ let m = moment(item.month).month()+1
|
|
|
+ item.month = (m == moment().month()+1) ? '本月' : m+'月'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.listdata = list
|
|
|
+ } else {
|
|
|
+ this.noDataText = res.message
|
|
|
+ this.listdata = []
|
|
|
+ this.total = 0
|
|
|
+ }
|
|
|
this.status = "loadmore"
|
|
|
- // })
|
|
|
+ })
|
|
|
},
|
|
|
// scroll-view到底部加载更多
|
|
|
onreachBottom() {
|
|
@@ -131,8 +140,13 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
|
+ page{
|
|
|
+ height: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
.ldDetailed-container{
|
|
|
width: 100%;
|
|
|
+ height: 100%;
|
|
|
// 筛选菜单
|
|
|
.filter-dropdown{
|
|
|
background-color: #fff!important;
|