ldDetailed.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="ldDetailed-container">
  3. <!-- 筛选菜单 -->
  4. <u-dropdown ref="uDropdown" class="filter-dropdown">
  5. <u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle()"></u-dropdown-item>
  6. <u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle()"></u-dropdown-item>
  7. </u-dropdown>
  8. <scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
  9. <!-- 列表数据 -->
  10. <view class="cell-item-con">
  11. <view class="cell-item" v-for="(item, index) in listdata" :key="index">
  12. <text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text>
  13. <view class="cell-item-main" v-for="(subItem, ind) in item.monthDataList" :key="ind">
  14. <view :class="['cell-item-pic']">
  15. <u-image mode="scaleToFill" v-if="subItem.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
  16. <u-image mode="scaleToFill" v-else shape="circle" width="70rpx" height="70rpx" src="/static/bued.png"></u-image>
  17. </view>
  18. <view class="cell-item-c">
  19. <text class="cell-item-des">{{subItem.operateTypeDictValue||'--'}}</text>
  20. <text class="cell-item-date">{{subItem.createDate}}</text>
  21. </view>
  22. <view :class="['cell-item-score', subItem.changeType == 'ADD' ? 'black' : 'red']">
  23. <text>{{subItem.changeType == 'ADD' ? '+'+subItem.changeNum : '-'+subItem.changeNum}}</text>
  24. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  25. </view>
  26. </view>
  27. <view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
  28. <u-empty :text="noDataText" mode="list"></u-empty>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="nodata" v-if="listdata.length==0 && status!='loading'">
  33. <u-empty :text="noDataText" mode="list"></u-empty>
  34. </view>
  35. <view class="loadmore">
  36. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </template>
  41. <script>
  42. import {ldUsedQuery} from '@/api/user.js'
  43. import getDate from '@/libs/getDate'
  44. import moment from 'moment'
  45. export default {
  46. data() {
  47. return {
  48. listdata: [],
  49. pageNo: 1, // 当前页码
  50. pageSize: 10, // 每页条数
  51. total: 0, // 数据总条数
  52. noDataText: '暂无数据', // 列表请求状态提示语
  53. status: 'loadmore', // 加载中状态
  54. timeScope: 'threeMonth', // 时间类别 1:近三个月 2:本月 3:本月前一月 4:本月前2月
  55. queryParam: { // 过滤条件
  56. changeType: '', // 金币变更类型
  57. },
  58. optionsType: [
  59. { label: '所有记录', value: '', },
  60. { label: '获取记录', value: 'ADD', },
  61. { label: '使用记录', value: 'SUB', }
  62. ]
  63. }
  64. },
  65. onShow() {
  66. this.searchHandle()
  67. },
  68. onLoad() {
  69. this.timeScope = 'threeMonth'
  70. this.queryParam.changeType = ''
  71. },
  72. computed: {
  73. // 时间过滤条件
  74. optionsScope(){ // 过滤条件 近3个月
  75. let arr = [
  76. { label: '近3个月', value: 'threeMonth' },
  77. { label: '本月', value: 'thisMonth' }
  78. ]
  79. arr[2] = { label: new Date().getMonth() + '月', value: 'lastMonth' }
  80. arr[3] = { label: new Date().getMonth()-1 + '月', value: 'lastTwoMonth' }
  81. return arr
  82. },
  83. titType(){ // 过滤条件 所有记录 title
  84. const row = this.optionsType.find(item => item.value == this.queryParam.changeType)
  85. return row ? row.label : this.optionsType[0].label
  86. },
  87. titScope(){ // 过滤条件 近3个月 title
  88. const row = this.optionsScope.find(item => item.value == this.timeScope)
  89. return row ? row.label : this.optionsScope[0].label
  90. },
  91. // 查询时间段
  92. queryDate() {
  93. var dt = new Date();
  94. const threeTime = dt.setMonth( dt.getMonth()-2 )
  95. const quickType = {
  96. threeMonth: [moment(getDate.getThreeMonthDays().starttime), moment(getDate.getThreeMonthDays().endtime)],
  97. lastMonth: [moment(getDate.getLastMonthDays().starttime), moment(getDate.getLastMonthDays().endtime)],
  98. thisMonth: [moment(getDate.getCurrMonthDays().starttime), moment(getDate.getCurrMonthDays().endtime)],
  99. lastTwoMonth: [moment(getDate.getLastTwoMonthDays().starttime), moment(getDate.getLastTwoMonthDays().endtime)],
  100. }
  101. let queryTime = {
  102. beginDate: quickType[this.timeScope][0].format('YYYY-MM-DD'),
  103. endDate: quickType[this.timeScope][1].format('YYYY-MM-DD')
  104. }
  105. return queryTime
  106. },
  107. },
  108. methods:{
  109. // 搜索查询
  110. searchHandle () {
  111. this.status = "loading"
  112. let params = Object.assign(this.queryParam,this.queryDate)
  113. console.log(params,'pppppppp')
  114. ldUsedQuery(params).then(res => {
  115. console.log(res,'pppppppp')
  116. if (res.status == 200) {
  117. let list = res.data
  118. // 查询3个月时 数据处理
  119. if (this.timeScope == 'threeMonth') {
  120. list.map(item=>{
  121. let m = moment(item.month).month()+1
  122. item.month = (m == moment().month()+1) ? '本月' : m+'月'
  123. })
  124. }
  125. this.listdata = list
  126. } else {
  127. this.noDataText = res.message
  128. this.listdata = []
  129. this.total = 0
  130. }
  131. this.status = "nomore"
  132. })
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang="less">
  138. page{
  139. height: 100%;
  140. background-color: #fff;
  141. }
  142. .ldDetailed-container{
  143. width: 100%;
  144. height: 100%;
  145. .nodata{
  146. margin: 50upx 0;
  147. }
  148. // 筛选菜单
  149. .filter-dropdown{
  150. background-color: #fff!important;
  151. .u-dropdown__menu__item{
  152. background-color: #fff!important;
  153. }
  154. }
  155. // 列表
  156. .scroll-con{
  157. height: calc(100% - 40);
  158. overflow: auto;
  159. }
  160. // 列表样式
  161. .cell-item-con{
  162. .cell-item{
  163. background-color: #fff;
  164. color: #606266;
  165. .cell-item-month{
  166. display: block;
  167. color: #909399;
  168. font-size: 26rpx;
  169. padding: 16rpx 30rpx;
  170. background-color: #f8f8f8;
  171. }
  172. .cell-item-main{
  173. display: flex;
  174. align-items: center;
  175. padding: 20rpx 30rpx;
  176. border-bottom: 1rpx solid #e9e9e9;
  177. .cell-item-pic{
  178. flex-shrink: 0;
  179. margin-right: 20rpx;
  180. width: 90rpx;
  181. height: 90rpx;
  182. line-height: 90rpx;
  183. background-color: #FFFFFF;
  184. border-radius: 50%;
  185. text-align: center;
  186. }
  187. .cell-item-c{
  188. flex-grow: 1;
  189. .cell-item-des{
  190. display: block;
  191. color: #606266;
  192. font-size: 30rpx;
  193. margin-bottom: 10rpx;
  194. }
  195. .cell-item-date{
  196. display: block;
  197. color: #909399;
  198. font-size: 24rpx;
  199. }
  200. }
  201. .cell-item-score{
  202. flex-shrink: 0;
  203. font-size: 40rpx;
  204. display: flex;
  205. align-items: center;
  206. }
  207. .black{
  208. color: #01c9b2;
  209. }
  210. .red{
  211. color: red;
  212. }
  213. .orange{
  214. background-color: #fcbd71;
  215. color: #fff;
  216. }
  217. }
  218. .cell-item-main:last-child{
  219. border: none;
  220. }
  221. }
  222. }
  223. }
  224. </style>